diff --git a/luci-app-openvpn-client/Makefile b/luci-app-openvpn-client/Makefile index 7b19aeff3..a758a559e 100644 --- a/luci-app-openvpn-client/Makefile +++ b/luci-app-openvpn-client/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-openvpn-client -PKG_VERSION:=20211229 +PKG_VERSION:=20240721 PKG_RELEASE:=1 LUCI_TITLE:=LuCI support for OpenVPN Client diff --git a/luci-app-openvpn-client/luasrc/model/cbi/openvpn-client/client.lua b/luci-app-openvpn-client/luasrc/model/cbi/openvpn-client/client.lua index aab282077..19be697c3 100644 --- a/luci-app-openvpn-client/luasrc/model/cbi/openvpn-client/client.lua +++ b/luci-app-openvpn-client/luasrc/model/cbi/openvpn-client/client.lua @@ -4,6 +4,11 @@ m = Map("luci-app-openvpn-client", translate("Client List")) m.apply_on_parse = true m.redirect = d.build_url("admin", "vpn", "openvpn-client") +m.on_apply = function(self) + luci.sys.call("/etc/init.d/luci-app-openvpn-client start %s" % arg[1]) + luci.http.redirect( self.redirect ) +end + s = m:section(NamedSection, arg[1], "clients", "") s.addremove = false s.anonymous = true @@ -41,6 +46,10 @@ o.rmempty = false o = s:option(DynamicList, "routes", translate("Static Routes")) o.placeholder = "192.168.10.0/24" +o = s:option(Flag, "allow_access", translate("Allow server access")) +o.default = "1" +o.rmempty = false + o = s:option(ListValue, "auth", translate("Auth")) o:value("", translate("None")) o:value("user_pass", translate("User/Pass")) diff --git a/luci-app-openvpn-client/po/zh-cn/openvpn-client.po b/luci-app-openvpn-client/po/zh-cn/openvpn-client.po index da6931bd3..03de08cc4 100644 --- a/luci-app-openvpn-client/po/zh-cn/openvpn-client.po +++ b/luci-app-openvpn-client/po/zh-cn/openvpn-client.po @@ -46,6 +46,9 @@ msgstr "不拉取路由" msgid "Static Routes" msgstr "静态路由" +msgid "Allow server access" +msgstr "允许服务端访问" + msgid "Auth" msgstr "身份认证" diff --git a/luci-app-openvpn-client/root/etc/init.d/luci-app-openvpn-client b/luci-app-openvpn-client/root/etc/init.d/luci-app-openvpn-client index 6a8b8df2c..a8199235a 100755 --- a/luci-app-openvpn-client/root/etc/init.d/luci-app-openvpn-client +++ b/luci-app-openvpn-client/root/etc/init.d/luci-app-openvpn-client @@ -97,6 +97,10 @@ start_instance() { _proxy="socks-proxy ${c_p_server} ${c_p_port} ${_proxy_auth}" fi } + + local c_allow_access_action="ACCEPT" + local c_allow_access=$(uci -q get ${CONFIG}.${cfgid}.allow_access || echo "1") + [ "${c_allow_access}" = "0" ] && c_allow_access_action="DROP" echo "#!/bin/sh" > ${TMP_OVPN_PATH}/${cfgid}/up.sh echo "#!/bin/sh" > ${TMP_OVPN_PATH}/${cfgid}/down.sh @@ -124,6 +128,7 @@ start_instance() { #允许服务端配置静态路由表访问内网 iptables -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 -t nat -I POSTROUTING -o ${c_dev} -m comment --comment "${c_dev}" -j MASQUERADE + iptables -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 -I FORWARD -i ${c_dev} -m comment --comment "${c_dev}" -j ACCEPT iptables -I FORWARD -o ${c_dev} -m comment --comment "${c_dev}" -j ACCEPT EOF @@ -135,6 +140,7 @@ start_instance() { \$1 -w -D \$2 \$index 2>/dev/null done } + ipt_del "iptables" "INPUT" ipt_del "iptables" "FORWARD" ipt_del "iptables -t nat" "POSTROUTING" EOF diff --git a/luci-app-ssr-mudb-server/luasrc/view/ssr_mudb_server/status.htm b/luci-app-ssr-mudb-server/luasrc/view/ssr_mudb_server/status.htm index d16021433..1dfc05fab 100644 --- a/luci-app-ssr-mudb-server/luasrc/view/ssr_mudb_server/status.htm +++ b/luci-app-ssr-mudb-server/luasrc/view/ssr_mudb_server/status.htm @@ -1,7 +1,3 @@ -<% -local ipkg = require "luci.model.ipkg" --%> -