Merge pull request #4459 from stangri/18.06-luci-app-vpnbypass
[18.06] luci-app-vpnbypass: ACL-related update
This commit is contained in:
commit
baa4f38333
5 changed files with 101 additions and 12 deletions
|
@ -10,7 +10,7 @@ LUCI_TITLE:=VPN Bypass Web UI
|
||||||
LUCI_DESCRIPTION:=Provides Web UI for VPNBypass service.
|
LUCI_DESCRIPTION:=Provides Web UI for VPNBypass service.
|
||||||
LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +vpnbypass
|
LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +vpnbypass
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_RELEASE:=19
|
PKG_RELEASE:=20
|
||||||
|
|
||||||
include ../../luci.mk
|
include ../../luci.mk
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ function index()
|
||||||
local e = entry({"admin", "vpn"}, firstchild(), _("VPN"), 60)
|
local e = entry({"admin", "vpn"}, firstchild(), _("VPN"), 60)
|
||||||
e.dependent = false
|
e.dependent = false
|
||||||
e.acl_depends = { "luci-app-vpnbypass" }
|
e.acl_depends = { "luci-app-vpnbypass" }
|
||||||
|
|
||||||
entry({"admin", "vpn", "vpnbypass"}, cbi("vpnbypass"), _("VPN Bypass"))
|
entry({"admin", "vpn", "vpnbypass"}, cbi("vpnbypass"), _("VPN Bypass"))
|
||||||
entry({"admin", "vpn", "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true
|
entry({"admin", "vpn", "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true
|
||||||
end
|
end
|
||||||
|
@ -12,18 +11,24 @@ end
|
||||||
|
|
||||||
function vpnbypass_action(name)
|
function vpnbypass_action(name)
|
||||||
local packageName = "vpnbypass"
|
local packageName = "vpnbypass"
|
||||||
|
local http = require "luci.http"
|
||||||
|
local sys = require "luci.sys"
|
||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
local util = require "luci.util"
|
||||||
if name == "start" then
|
if name == "start" then
|
||||||
luci.sys.init.start(packageName)
|
sys.init.start(packageName)
|
||||||
elseif name == "action" then
|
elseif name == "action" then
|
||||||
luci.util.exec("/etc/init.d/" .. packageName .. " restart >/dev/null 2>&1")
|
util.exec("/etc/init.d/" .. packageName .. " restart >/dev/null 2>&1")
|
||||||
luci.util.exec("/etc/init.d/dnsmasq restart >/dev/null 2>&1")
|
util.exec("/etc/init.d/dnsmasq restart >/dev/null 2>&1")
|
||||||
elseif name == "stop" then
|
elseif name == "stop" then
|
||||||
luci.sys.init.stop(packageName)
|
sys.init.stop(packageName)
|
||||||
elseif name == "enable" then
|
elseif name == "enable" then
|
||||||
luci.util.exec("uci set " .. packageName .. ".config.enabled=1; uci commit " .. packageName)
|
uci:set(packageName, "config", "enabled", "1")
|
||||||
|
uci:commit(packageName)
|
||||||
elseif name == "disable" then
|
elseif name == "disable" then
|
||||||
luci.util.exec("uci set " .. packageName .. ".config.enabled=0; uci commit " .. packageName)
|
uci:set(packageName, "config", "enabled", "0")
|
||||||
|
uci:commit(packageName)
|
||||||
end
|
end
|
||||||
luci.http.prepare_content("text/plain")
|
http.prepare_content("text/plain")
|
||||||
luci.http.write("0")
|
http.write("0")
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,8 +4,22 @@ local sys = require "luci.sys"
|
||||||
local util = require "luci.util"
|
local util = require "luci.util"
|
||||||
local packageName = "vpnbypass"
|
local packageName = "vpnbypass"
|
||||||
|
|
||||||
local packageVersion, statusText = nil, nil
|
function getPackageVersion()
|
||||||
packageVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) or ""
|
local opkgFile = "/usr/lib/opkg/status"
|
||||||
|
local line
|
||||||
|
local flag = false
|
||||||
|
for line in io.lines(opkgFile) do
|
||||||
|
if flag then
|
||||||
|
return line:match('[%d%.$-]+') or ""
|
||||||
|
elseif line:find("Package: " .. packageName:gsub("%-", "%%%-")) then
|
||||||
|
flag = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local packageVersion = getPackageVersion()
|
||||||
|
local statusText = nil
|
||||||
if packageVersion == "" then
|
if packageVersion == "" then
|
||||||
statusText = translatef("%s is not installed or not found", packageName)
|
statusText = translatef("%s is not installed or not found", packageName)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,86 +1,116 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:40
|
||||||
msgid "%s (disabled)"
|
msgid "%s (disabled)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:24
|
||||||
msgid "%s is not installed or not found"
|
msgid "%s is not installed or not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:57
|
||||||
msgid "Disable"
|
msgid "Disable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:88
|
||||||
msgid "Domains to Bypass"
|
msgid "Domains to Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:89
|
||||||
msgid ""
|
msgid ""
|
||||||
"Domains to be accessed directly (outside of the VPN tunnel), see %sREADME%s "
|
"Domains to be accessed directly (outside of the VPN tunnel), see %sREADME%s "
|
||||||
"for syntax"
|
"for syntax"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:54
|
||||||
msgid "Enable"
|
msgid "Enable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/root/usr/share/rpcd/acl.d/luci-app-vpnbypass.json:3
|
||||||
|
msgid "Grant UCI and file access for luci-app-vpnbypass"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/js.htm:51
|
||||||
msgid "Loading"
|
msgid "Loading"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:71
|
||||||
msgid "Local IP Addresses to Bypass"
|
msgid "Local IP Addresses to Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:71
|
||||||
msgid ""
|
msgid ""
|
||||||
"Local IP addresses or subnets with direct internet access (outside of the "
|
"Local IP addresses or subnets with direct internet access (outside of the "
|
||||||
"VPN tunnel)"
|
"VPN tunnel)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:57
|
||||||
msgid "Local Ports to Bypass"
|
msgid "Local Ports to Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:57
|
||||||
msgid "Local ports to trigger VPN Bypass"
|
msgid "Local ports to trigger VPN Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:78
|
||||||
msgid "Remote IP Addresses to Bypass"
|
msgid "Remote IP Addresses to Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:78
|
||||||
msgid ""
|
msgid ""
|
||||||
"Remote IP addresses or subnets which will be accessed directly (outside of "
|
"Remote IP addresses or subnets which will be accessed directly (outside of "
|
||||||
"the VPN tunnel)"
|
"the VPN tunnel)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:64
|
||||||
msgid "Remote Ports to Bypass"
|
msgid "Remote Ports to Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:64
|
||||||
msgid "Remote ports to trigger VPN Bypass"
|
msgid "Remote ports to trigger VPN Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:44
|
||||||
msgid "Restart"
|
msgid "Restart"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:36
|
||||||
msgid "Running"
|
msgid "Running"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:47
|
||||||
msgid "Service Status"
|
msgid "Service Status"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:46
|
||||||
msgid "Service Status [%s %s]"
|
msgid "Service Status [%s %s]"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:41
|
||||||
msgid "Start"
|
msgid "Start"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm:47
|
||||||
msgid "Stop"
|
msgid "Stop"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:38
|
||||||
msgid "Stopped"
|
msgid "Stopped"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua:4
|
||||||
msgid "VPN"
|
msgid "VPN"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua:7
|
||||||
msgid "VPN Bypass"
|
msgid "VPN Bypass"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:55
|
||||||
msgid "VPN Bypass Rules"
|
msgid "VPN Bypass Rules"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua:44
|
||||||
msgid "VPN Bypass Settings"
|
msgid "VPN Bypass Settings"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"luci-app-vpnbypass": {
|
||||||
|
"description": "Grant UCI and file access for luci-app-vpnbypass",
|
||||||
|
"read": {
|
||||||
|
"cgi-io": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"file": {
|
||||||
|
"/usr/lib/opkg/status": [
|
||||||
|
"read"
|
||||||
|
],
|
||||||
|
"/etc/init.d/vpnbypass *": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"/etc/init.d/dnsmasq restart *": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"/usr/bin/grep *": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"/usr/sbin/grep *": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"/usr/sbin/iptables *": [
|
||||||
|
"exec"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"uci": [
|
||||||
|
"dhcp",
|
||||||
|
"vpnbypass"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"write": {
|
||||||
|
"uci": [
|
||||||
|
"dhcp",
|
||||||
|
"vpnbypass"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue