luci-app-https-dns-proxy: decrease reliance on shell commands; proper acl.d file; add cloudflare family/protect
Signed-off-by: Stan Grishin <stangri@melmac.net>
This commit is contained in:
parent
217d331d8d
commit
4ff9c263b0
7 changed files with 89 additions and 28 deletions
|
@ -10,7 +10,7 @@ LUCI_TITLE:=DNS Over HTTPS Proxy Web UI
|
||||||
LUCI_DESCRIPTION:=Provides Web UI for DNS Over HTTPS Proxy
|
LUCI_DESCRIPTION:=Provides Web UI for DNS Over HTTPS Proxy
|
||||||
LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +https-dns-proxy
|
LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +https-dns-proxy
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=8
|
||||||
|
|
||||||
include ../../luci.mk
|
include ../../luci.mk
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
return {
|
||||||
|
name = "Cloudflare-Family",
|
||||||
|
label = _("Cloudflare (Family Protection)"),
|
||||||
|
resolver_url = "https://family.cloudflare-dns.com/dns-query",
|
||||||
|
bootstrap_dns = "1.1.1.3,1.0.0.3,2606:4700:4700::1113,2606:4700:4700::1003",
|
||||||
|
help_link = "https://one.one.one.one/family/",
|
||||||
|
help_link_text = "Cloudflare"
|
||||||
|
}
|
|
@ -2,5 +2,7 @@ return {
|
||||||
name = "Cloudflare",
|
name = "Cloudflare",
|
||||||
label = _("Cloudflare"),
|
label = _("Cloudflare"),
|
||||||
resolver_url = "https://cloudflare-dns.com/dns-query",
|
resolver_url = "https://cloudflare-dns.com/dns-query",
|
||||||
bootstrap_dns = "1.1.1.1,1.0.0.1"
|
bootstrap_dns = "1.1.1.1,1.0.0.1,2606:4700:4700::1111,2606:4700:4700::1001",
|
||||||
|
help_link = "https://one.one.one.one/family/",
|
||||||
|
help_link_text = "Cloudflare"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
return {
|
||||||
|
name = "Cloudflare-Security",
|
||||||
|
label = _("Cloudflare (Security Protection)"),
|
||||||
|
resolver_url = "https://security.cloudflare-dns.com/dns-query",
|
||||||
|
bootstrap_dns = "1.1.1.1,1.0.0.1,2606:4700:4700::1111,2606:4700:4700::1001",
|
||||||
|
help_link = "https://one.one.one.one/family/",
|
||||||
|
help_link_text = "Cloudflare"
|
||||||
|
}
|
|
@ -9,7 +9,21 @@ local packageName = "https-dns-proxy"
|
||||||
local providers_dir = "/usr/lib/lua/luci/" .. packageName .. "/providers/"
|
local providers_dir = "/usr/lib/lua/luci/" .. packageName .. "/providers/"
|
||||||
local helperText = ""
|
local helperText = ""
|
||||||
|
|
||||||
function create_helper_text()
|
function getPackageVersion()
|
||||||
|
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
|
||||||
|
|
||||||
|
function createHelperText()
|
||||||
local initText = "<br />" .. translate("For more information on different options check") .. " "
|
local initText = "<br />" .. translate("For more information on different options check") .. " "
|
||||||
for filename in fs.dir(providers_dir) do
|
for filename in fs.dir(providers_dir) do
|
||||||
local p_func = loadfile(providers_dir .. filename)
|
local p_func = loadfile(providers_dir .. filename)
|
||||||
|
@ -25,7 +39,7 @@ function create_helper_text()
|
||||||
else
|
else
|
||||||
helperText = helperText .. ", "
|
helperText = helperText .. ", "
|
||||||
end
|
end
|
||||||
helperText = helperText .. [[<a href="]] .. url .. [[">]] .. domain .. [[</a>]]
|
helperText = helperText .. [[<a href="]] .. url .. [[" target="_blank">]] .. domain .. [[</a>]]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -35,7 +49,7 @@ function create_helper_text()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_provider_name(value)
|
function getProviderName(value)
|
||||||
for filename in fs.dir(providers_dir) do
|
for filename in fs.dir(providers_dir) do
|
||||||
local p_func = loadfile(providers_dir .. filename)
|
local p_func = loadfile(providers_dir .. filename)
|
||||||
setfenv(p_func, { _ = i18n.translate })
|
setfenv(p_func, { _ = i18n.translate })
|
||||||
|
@ -51,7 +65,7 @@ end
|
||||||
|
|
||||||
local packageStatus, packageStatusCode
|
local packageStatus, packageStatusCode
|
||||||
local ubusStatus = util.ubus("service", "list", { name = packageName })
|
local ubusStatus = util.ubus("service", "list", { name = packageName })
|
||||||
local packageVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) or ""
|
local packageVersion = getPackageVersion()
|
||||||
|
|
||||||
if packageVersion == "" then
|
if packageVersion == "" then
|
||||||
packageStatusCode = -1
|
packageStatusCode = -1
|
||||||
|
@ -81,7 +95,7 @@ else
|
||||||
end
|
end
|
||||||
la = la or "127.0.0.1"
|
la = la or "127.0.0.1"
|
||||||
lp = lp or n + 5053
|
lp = lp or n + 5053
|
||||||
packageStatus = packageStatus .. translatef("Running: %s DoH at %s:%s", get_provider_name(url), la, lp) .. "\n"
|
packageStatus = packageStatus .. translatef("Running: %s DoH at %s:%s", getProviderName(url), la, lp) .. "\n"
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -108,7 +122,7 @@ else
|
||||||
buttons.template = packageName .. "/buttons"
|
buttons.template = packageName .. "/buttons"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_helper_text()
|
createHelperText()
|
||||||
s3 = m:section(TypedSection, "https-dns-proxy", translate("Instances"),
|
s3 = m:section(TypedSection, "https-dns-proxy", translate("Instances"),
|
||||||
translatef("When you add/remove any instances below, they will be used to override the 'DNS forwardings' section of %sDHCP and DNS%s.", "<a href=\"" .. dispatcher.build_url("admin/network/dhcp") .. "\">", "</a>") .. helperText)
|
translatef("When you add/remove any instances below, they will be used to override the 'DNS forwardings' section of %sDHCP and DNS%s.", "<a href=\"" .. dispatcher.build_url("admin/network/dhcp") .. "\">", "</a>") .. helperText)
|
||||||
s3.template = "cbi/tblsection"
|
s3.template = "cbi/tblsection"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:58
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:72
|
||||||
msgid "%s is not installed or not found"
|
msgid "%s is not installed or not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -41,11 +41,19 @@ msgstr ""
|
||||||
msgid "Cloudflare"
|
msgid "Cloudflare"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.cloudflare-dns.family.lua:3
|
||||||
|
msgid "Cloudflare (Family Protection)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.cloudflare-dns.security.lua:3
|
||||||
|
msgid "Cloudflare (Security Protection)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/controller/https-dns-proxy.lua:4
|
#: applications/luci-app-https-dns-proxy/luasrc/controller/https-dns-proxy.lua:4
|
||||||
msgid "DNS HTTPS Proxy"
|
msgid "DNS HTTPS Proxy"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:92
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:106
|
||||||
msgid "DNS HTTPS Proxy Settings"
|
msgid "DNS HTTPS Proxy Settings"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -61,7 +69,7 @@ msgstr ""
|
||||||
msgid "Disable"
|
msgid "Disable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:163
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:177
|
||||||
msgid "EDNS client subnet"
|
msgid "EDNS client subnet"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -69,7 +77,7 @@ msgstr ""
|
||||||
msgid "Enable"
|
msgid "Enable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:13
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:27
|
||||||
msgid "For more information on different options check"
|
msgid "For more information on different options check"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -77,7 +85,7 @@ msgstr ""
|
||||||
msgid "Google"
|
msgid "Google"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:112
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:126
|
||||||
msgid "Instances"
|
msgid "Instances"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -89,11 +97,11 @@ msgstr ""
|
||||||
msgid "LibreDNS (No Ads)"
|
msgid "LibreDNS (No Ads)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:146
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:160
|
||||||
msgid "Listen address"
|
msgid "Listen address"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:159
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:173
|
||||||
msgid "Listen port"
|
msgid "Listen port"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -105,7 +113,7 @@ msgstr ""
|
||||||
msgid "ODVR (nic.cz)"
|
msgid "ODVR (nic.cz)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:166
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:180
|
||||||
msgid "Proxy server"
|
msgid "Proxy server"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -129,19 +137,19 @@ msgstr ""
|
||||||
msgid "Reload"
|
msgid "Reload"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:119
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:133
|
||||||
msgid "Resolver"
|
msgid "Resolver"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:84
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:98
|
||||||
msgid "Running: %s DoH at %s:%s"
|
msgid "Running: %s DoH at %s:%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:96
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:110
|
||||||
msgid "Service Status"
|
msgid "Service Status"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:94
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:108
|
||||||
msgid "Service Status [%s %s]"
|
msgid "Service Status [%s %s]"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -153,25 +161,25 @@ msgstr ""
|
||||||
msgid "Stop"
|
msgid "Stop"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:62
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:76
|
||||||
msgid "Stopped"
|
msgid "Stopped"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:49
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:63
|
||||||
msgid "Unknown Provider"
|
msgid "Unknown Provider"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:113
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:127
|
||||||
msgid ""
|
msgid ""
|
||||||
"When you add/remove any instances below, they will be used to override the "
|
"When you add/remove any instances below, they will be used to override the "
|
||||||
"'DNS forwardings' section of %sDHCP and DNS%s."
|
"'DNS forwardings' section of %sDHCP and DNS%s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:34
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:48
|
||||||
msgid "and"
|
msgid "and"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:64
|
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:78
|
||||||
msgid "disabled"
|
msgid "disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,32 @@
|
||||||
{
|
{
|
||||||
"luci-app-https-dns-proxy": {
|
"luci-app-https-dns-proxy": {
|
||||||
"description": "Grant UCI access for luci-app-https-dns-proxy",
|
"description": "Grant UCI and file access for luci-app-https-dns-proxy",
|
||||||
"read": {
|
"read": {
|
||||||
"uci": [ "https-dns-proxy" ]
|
"cgi-io": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"file": {
|
||||||
|
"/usr/lib/opkg/status": [
|
||||||
|
"read"
|
||||||
|
],
|
||||||
|
"/usr/lib/lua/luci/https-dns-proxy/providers/*": [
|
||||||
|
"read"
|
||||||
|
],
|
||||||
|
"/etc/init.d/dnsmasq *": [
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"/etc/init.d/https-dns-proxy *": [
|
||||||
|
"exec"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"uci": [
|
||||||
|
"https-dns-proxy"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"write": {
|
"write": {
|
||||||
"uci": [ "https-dns-proxy" ]
|
"uci": [
|
||||||
|
"https-dns-proxy"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue