diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2016-12-05 13:31:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-05 13:31:00 +0200 |
commit | a9d74a6729d398d57447268f2b440444da43d805 (patch) | |
tree | fce45e8efb89221d68f0112864606a01f4bc82c8 /applications | |
parent | 5127dd6a2d032ffe8b52419f45e0e73746661132 (diff) | |
parent | 3580eddcfa0718002a3dab535a34839dbffcb3a1 (diff) |
Merge pull request #864 from EricLuehrsen/unbound_uci
Unbound: Basic LuCI to go with recent Unbound UCI enhancements
Diffstat (limited to 'applications')
-rw-r--r-- | applications/luci-app-unbound/Makefile | 14 | ||||
-rw-r--r-- | applications/luci-app-unbound/luasrc/controller/unbound.lua | 17 | ||||
-rw-r--r-- | applications/luci-app-unbound/luasrc/model/cbi/unbound.lua | 123 |
3 files changed, 154 insertions, 0 deletions
diff --git a/applications/luci-app-unbound/Makefile b/applications/luci-app-unbound/Makefile new file mode 100644 index 0000000000..6d953e13b2 --- /dev/null +++ b/applications/luci-app-unbound/Makefile @@ -0,0 +1,14 @@ +# +# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org> +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Unbound Recursive DNS Resolver Configuration +LUCI_DEPENDS:=+unbound + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/applications/luci-app-unbound/luasrc/controller/unbound.lua b/applications/luci-app-unbound/luasrc/controller/unbound.lua new file mode 100644 index 0000000000..0a5abc5a5e --- /dev/null +++ b/applications/luci-app-unbound/luasrc/controller/unbound.lua @@ -0,0 +1,17 @@ +-- Copyright 2008 Steven Barth <steven@midlink.org> +-- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.unbound", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/unbound") then + return + end + + local page + + page = entry({"admin", "services", "unbound"}, cbi("unbound"), _("Recursive DNS")) + page.dependent = true +end + diff --git a/applications/luci-app-unbound/luasrc/model/cbi/unbound.lua b/applications/luci-app-unbound/luasrc/model/cbi/unbound.lua new file mode 100644 index 0000000000..22f020021c --- /dev/null +++ b/applications/luci-app-unbound/luasrc/model/cbi/unbound.lua @@ -0,0 +1,123 @@ +-- Copyright 2008 Steven Barth <steven@midlink.org> +-- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com> +-- Licensed to the public under the Apache License 2.0. + +m = Map("unbound", translate("Recursive DNS"), + translate("Unbound is a validating, recursive, and caching DNS resolver.")) + +s = m:section(TypedSection, "unbound", translate("Unbound Settings")) +s.addremove = false +s.anonymous = true + +s:tab("service", translate("Unbound Service")) +s:tab("resource", translate("Unbound Resources")) +s:tab("dnsmasq", translate("Dnsmasq Link")) + +--Enable Unbound + +e = s:taboption("service", Flag, "enabled", translate("Enable Unbound:"), + translate("Enable the initialization scripts for Unbound")) +e.rmempty = false + +function e.cfgvalue(self, section) + return luci.sys.init.enabled("unbound") and self.enabled or self.disabled +end + +function e.write(self, section, value) + if value == "1" then + luci.sys.init.enable("unbound") + luci.sys.call("/etc/init.d/unbound start >/dev/null") + else + luci.sys.call("/etc/init.d/unbound stop >/dev/null") + luci.sys.init.disable("unbound") + end + + return Flag.write(self, section, value) +end + +--Service Tab + +mcf = s:taboption("service", Flag, "manual_conf", translate("Manual Conf:"), + translate("Skip UCI and use /etc/unbound/unbound.conf")) +mcf.rmempty = false + +lsv = s:taboption("service", Flag, "localservice", translate("Local Service:"), + translate("Accept queries only from local subnets")) +lsv.rmempty = false + +qry = s:taboption("service", Flag, "query_minimize", translate("Query Minimize:"), + translate("Break down query components for small added privacy")) +qry.rmempty = false + +rlh = s:taboption("service", Flag, "rebind_localhost", translate("Block Localhost Rebind:"), + translate("Prevent upstream response of 127.0.0.0/8")) +rlh.rmempty = false + +rpv = s:taboption("service", Flag, "rebind_protection", translate("Block Private Rebind:"), + translate("Prevent upstream response of RFC1918 ranges")) +rpv.rmempty = false + +vld = s:taboption("service", Flag, "validator", translate("Enable DNSSEC:"), + translate("Enable the DNSSEC validator module")) +vld.rmempty = false + +nvd = s:taboption("service", Flag, "validator_ntp", translate("DNSSEC NTP Fix:"), + translate("Break the loop where DNSSEC needs NTP and NTP needs DNS")) +nvd.rmempty = false + +eds = s:taboption("service", Value, "edns_size", translate("EDNS Size:"), + translate("Limit extended DNS packet size")) +eds.datatype = "and(uinteger,min(512),max(4096))" +eds.rmempty = false + +prt = s:taboption("service", Value, "listen_port", translate("Listening Port:"), + translate("Choose Unbounds listening port")) +prt.datatype = "port" +prt.rmempty = false + +tlm = s:taboption("service", Value, "ttl_min", translate("TTL Minimum:"), + translate("Prevent excessively short cache periods")) +tlm.datatype = "and(uinteger,min(0),max(600))" +tlm.rmempty = false + +--Resource Tuning Tab + +rsn = s:taboption("resource", ListValue, "recursion", translate("Recursion Strength:"), + translate("Recursion activity affects memory growth and CPU load")) +rsn:value("aggressive", translate("Aggressive")) +rsn:value("default", translate("Default")) +rsn:value("passive", translate("Passive")) +rsn.rmempty = false + +rsc = s:taboption("resource", ListValue, "resource", translate("Memory Resource:"), + translate("Use menu System/Processes to observe any memory growth")) +rsc:value("large", translate("Large")) +rsc:value("medium", translate("Medium")) +rsc:value("small", translate("Small")) +rsc:value("tiny", translate("Tiny")) +rsc.rmempty = false + +age = s:taboption("resource", Value, "root_age", translate("Root DSKEY Age:"), + translate("Limit days between RFC5011 to reduce flash writes")) +age.datatype = "and(uinteger,min(1),max(99))" +age:value("14", "14") +age:value("28", "28 ("..translate("default")..")") +age:value("45", "45") +age:value("90", "90") +age:value("99", "99 ("..translate("never")..")") + +--Dnsmasq Link Tab + +dld = s:taboption("dnsmasq", Flag, "dnsmasq_link_dns", translate("Link dnsmasq:"), + translate("Forward queries to dnsmasq for local clients")) +dld.rmempty = false + +dgn = s:taboption("dnsmasq", Flag, "dnsmsaq_gate_name", translate("Local Gateway Name:"), + translate("Also query dnsmasq for this hosts outbound gateway")) +dgn.rmempty = false + +--TODO: Read only repective dnsmasq options and inform user of link requirements. +--TODO: dnsmasq needs to not reference resolve-file and get off port 53. + +return m + |