update 2026-09-25 06:56:42

This commit is contained in:
action committed 2026-09-25 06:56:42 +08:00
1 parent 45632307c8
commit 6ef6eec405
218 files changed
+45422 -299

No files matched your search

@@ -23,13 +23,13 @@ ipt_flag="OpenVPN Server"
ipt_rule() {
if [ "$1" = "add" ]; then
iptables -w -t nat -I postrouting_rule -s ${ip_segment%.*}.0/${ip_prefix} -m comment --comment "${ipt_flag}" -j MASQUERADE 2>/dev/null
iptables -w -I forwarding_rule -s ${ip_segment%.*}.0/${ip_prefix} -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
iptables -w -I input_rule -p ${proto} --dport ${port} -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
iptables -w -t nat -I POSTROUTING -s ${ip_segment%.*}.0/${ip_prefix} -m comment --comment "${ipt_flag}" -j MASQUERADE 2>/dev/null
iptables -w -I FORWARD -s ${ip_segment%.*}.0/${ip_prefix} -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
iptables -w -I INPUT -p ${proto} --dport ${port} -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
iptables -w -t mangle -I OUTPUT -p ${proto} --sport ${port} -m comment --comment "${ipt_flag}" -j RETURN 2>/dev/null
[ "${ipv6}" -eq 1 ] && {
ip6tables -w -I input_rule -p ${proto} --dport ${port} -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
ip6tables -w -I INPUT -p ${proto} --dport ${port} -m comment --comment "${ipt_flag}" -j ACCEPT 2>/dev/null
ip6tables -w -t mangle -I OUTPUT -p ${proto} --sport ${port} -m comment --comment "${ipt_flag}" -j RETURN 2>/dev/null
}
else
@@ -39,11 +39,11 @@ ipt_rule() {
$1 -w -D $2 $index 2>/dev/null
done
}
ipt_del "iptables" "forwarding_rule"
ipt_del "iptables" "input_rule"
ipt_del "iptables -t nat" "postrouting_rule"
ipt_del "iptables" "FORWARD"
ipt_del "iptables" "INPUT"
ipt_del "iptables -t nat" "POSTROUTING"
ipt_del "iptables -t mangle" "OUTPUT"
ipt_del "ip6tables" "input_rule"
ipt_del "ip6tables" "INPUT"
ipt_del "ip6tables -t mangle" "OUTPUT"
fi
}
@@ -72,6 +72,7 @@ gen_include() {
$(extract_rules 6 mangle)
EOT
}
exit 0
EOF
return 0
}
@@ -8,12 +8,6 @@ done
uci -q commit firewall
uci -q batch <<-EOF >/dev/null
delete firewall.openvpn_server
set firewall.openvpn_server=include
set firewall.openvpn_server.type=script
set firewall.openvpn_server.path=/var/etc/luci-app-openvpn-server.include
set firewall.openvpn_server.reload=1
delete firewall.ovpn_server
set firewall.ovpn_server=zone
set firewall.ovpn_server.name='ovpn_server'
@@ -26,8 +20,20 @@ uci -q batch <<-EOF >/dev/null
set firewall.lantoovpnserver=forwarding
set firewall.lantoovpnserver.src='lan'
set firewall.lantoovpnserver.dest='ovpn_server'
commit firewall
delete firewall.openvpn_server
set firewall.openvpn_server=include
set firewall.openvpn_server.type=script
set firewall.openvpn_server.path=/var/etc/luci-app-openvpn-server.include
EOF
if [ -x "/sbin/fw3" ] && [ ! -L "/sbin/fw3" ]; then
uci -q set firewall.openvpn_server.reload='1'
else
uci -q delete firewall.openvpn_server.reload
uci -q delete firewall.openvpn_server.fw4_compatible
fi
uci commit firewall
rm -rf /tmp/luci-*cache
exit 0