mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-09-11 19:05:11 +08:00
31 lines
961 B
Bash
Executable File
31 lines
961 B
Bash
Executable File
#!/bin/ash
|
|
# =====================================================================
|
|
# /etc/uci-defaults/99-authshield-setup
|
|
#
|
|
# One-time setup script for AuthShield
|
|
# Adds a clean "include" section to firewall4 for /var/run/authshield.nft
|
|
# Enables and starts the service, then removes itself.
|
|
# =====================================================================
|
|
|
|
set -e
|
|
|
|
# Only add include section if not already defined
|
|
if ! uci show firewall | grep -q "path='/var/run/authshield.nft'"; then
|
|
uci batch <<'EOF'
|
|
set firewall.authshield=include
|
|
set firewall.authshield.type='script'
|
|
set firewall.authshield.path='/var/run/authshield.nft'
|
|
set firewall.authshield.reload='1'
|
|
commit firewall
|
|
EOF
|
|
fi
|
|
|
|
# Reload firewall and enable AuthShield service
|
|
/etc/init.d/firewall reload || true
|
|
/etc/init.d/authshield enable || true
|
|
/etc/init.d/authshield restart || true
|
|
|
|
# Remove self after successful execution
|
|
rm -f /etc/uci-defaults/99-authshield-setup
|
|
exit 0
|