mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 03:55:13 +08:00
🍉 Sync 2026-09-25 18:00:12
This commit is contained in:
1 parent
7c17dda4d0
commit
2ee65a261e
135 files changed
+5726
-7799
No files matched your search
@@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openvpn-client
|
||||
PKG_VERSION:=20250227
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
LUCI_TITLE:=LuCI support for OpenVPN Client
|
||||
LUCI_DEPENDS:=+openvpn-openssl +kmod-tun
|
||||
|
||||
@@ -129,11 +129,11 @@ start_instance() {
|
||||
cat <<-EOF >> ${TMP_OVPN_PATH}/${cfgid}/iptables_add.sh
|
||||
${TMP_OVPN_PATH}/${cfgid}/iptables_del.sh
|
||||
#允许服务端配置静态路由表访问内网
|
||||
iptables -w -t nat -I postrouting_rule -s \$(cat ${TMP_OVPN_PATH}/${cfgid}/network)/\$(cat ${TMP_OVPN_PATH}/${cfgid}/mask) -m comment --comment "${c_dev}" -j MASQUERADE
|
||||
iptables -w -t nat -I postrouting_rule -o ${c_dev} -m comment --comment "${c_dev}" -j MASQUERADE
|
||||
iptables -w -I input_rule -s \$(cat ${TMP_OVPN_PATH}/${cfgid}/network)/\$(cat ${TMP_OVPN_PATH}/${cfgid}/mask) -m comment --comment "${c_dev}" -j ${c_allow_access_action}
|
||||
iptables -w -I forwarding_rule -i ${c_dev} -m comment --comment "${c_dev}" -j ACCEPT
|
||||
iptables -w -I forwarding_rule -o ${c_dev} -m comment --comment "${c_dev}" -j ACCEPT
|
||||
iptables -w -t nat -I POSTROUTING -s \$(cat ${TMP_OVPN_PATH}/${cfgid}/network)/\$(cat ${TMP_OVPN_PATH}/${cfgid}/mask) -m comment --comment "${c_dev}" -j MASQUERADE
|
||||
iptables -w -t nat -I POSTROUTING -o ${c_dev} -m comment --comment "${c_dev}" -j MASQUERADE
|
||||
iptables -w -I INPUT -s \$(cat ${TMP_OVPN_PATH}/${cfgid}/network)/\$(cat ${TMP_OVPN_PATH}/${cfgid}/mask) -m comment --comment "${c_dev}" -j ${c_allow_access_action}
|
||||
iptables -w -I FORWARD -i ${c_dev} -m comment --comment "${c_dev}" -j ACCEPT
|
||||
iptables -w -I FORWARD -o ${c_dev} -m comment --comment "${c_dev}" -j ACCEPT
|
||||
EOF
|
||||
|
||||
cat <<-EOF >> ${TMP_OVPN_PATH}/${cfgid}/iptables_del.sh
|
||||
@@ -143,9 +143,9 @@ start_instance() {
|
||||
\$1 -w -D \$2 \$index 2>/dev/null
|
||||
done
|
||||
}
|
||||
ipt_del "iptables -w" "input_rule"
|
||||
ipt_del "iptables -w" "forwarding_rule"
|
||||
ipt_del "iptables -w -t nat" "postrouting_rule"
|
||||
ipt_del "iptables -w" "INPUT"
|
||||
ipt_del "iptables -w" "FORWARD"
|
||||
ipt_del "iptables -w -t nat" "POSTROUTING"
|
||||
EOF
|
||||
|
||||
cat <<-EOF >> ${TMP_OVPN_PATH}/${cfgid}/ipchange.sh
|
||||
@@ -162,6 +162,7 @@ start_instance() {
|
||||
|
||||
cat <<-EOF >> /var/etc/${CONFIG}.include
|
||||
${TMP_OVPN_PATH}/${cfgid}/iptables_add.sh
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
local c_routes=$(uci -q get ${CONFIG}.${cfgid}.routes)
|
||||
|
||||
@@ -5,8 +5,15 @@ uci -q batch <<-EOF >/dev/null
|
||||
set firewall.openvpn_client=include
|
||||
set firewall.openvpn_client.type=script
|
||||
set firewall.openvpn_client.path=/var/etc/luci-app-openvpn-client.include
|
||||
set firewall.openvpn_client.reload=1
|
||||
EOF
|
||||
|
||||
if [ -x "/sbin/fw3" ] && [ ! -L "/sbin/fw3" ]; then
|
||||
uci -q set firewall.openvpn_client.reload='1'
|
||||
else
|
||||
uci -q delete firewall.openvpn_client.reload
|
||||
uci -q delete firewall.openvpn_client.fw4_compatible
|
||||
fi
|
||||
uci commit firewall
|
||||
|
||||
rm -rf /tmp/luci-*cache
|
||||
exit 0
|
||||
Reference in new issue
Block a user