1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
3 -- Copyright 2016 Dan Luedtke <mail@danrl.com>
4 -- Licensed to the public under the Apache License 2.0.
6 m = Map("unbound", translate("Recursive DNS"),
7 translate("Unbound is a validating, recursive, and caching DNS resolver."))
9 s1 = m:section(TypedSection, "unbound")
12 s1:tab("service", translate("Basic Settings"))
13 s1:tab("advanced", translate("Advanced Settings"))
14 s1:tab("resource", translate("Resource Settings"))
18 ena = s1:taboption("service", Flag, "enabled", translate("Enable Unbound:"),
19 translate("Enable the initialization scripts for Unbound"))
22 mcf = s1:taboption("service", Flag, "manual_conf", translate("Manual Conf:"),
23 translate("Skip UCI and use /etc/unbound/unbound.conf"))
26 function ena.cfgvalue(self, section)
27 return luci.sys.init.enabled("unbound") and self.enabled or self.disabled
30 function ena.write(self, section, value)
32 luci.sys.init.enable("unbound")
33 luci.sys.call("/etc/init.d/unbound start >/dev/null")
35 luci.sys.call("/etc/init.d/unbound stop >/dev/null")
36 luci.sys.init.disable("unbound")
39 return Flag.write(self, section, value)
44 lsv = s1:taboption("service", Flag, "localservice", translate("Local Service:"),
45 translate("Accept queries only from local subnets"))
48 rlh = s1:taboption("service", Flag, "rebind_localhost", translate("Block Localhost Rebind:"),
49 translate("Prevent upstream response of 127.0.0.0/8"))
52 rpv = s1:taboption("service", Flag, "rebind_protection", translate("Block Private Rebind:"),
53 translate("Prevent upstream response of RFC1918 ranges"))
56 vld = s1:taboption("service", Flag, "validator", translate("Enable DNSSEC:"),
57 translate("Enable the DNSSEC validator module"))
60 nvd = s1:taboption("service", Flag, "validator_ntp", translate("DNSSEC NTP Fix:"),
61 translate("Break the loop where DNSSEC needs NTP and NTP needs DNS"))
63 nvd:depends({ validator = true })
65 eds = s1:taboption("service", Value, "edns_size", translate("EDNS Size:"),
66 translate("Limit extended DNS packet size"))
67 eds.datatype = "and(uinteger,min(512),max(4096))"
70 prt = s1:taboption("service", Value, "listen_port", translate("Listening Port:"),
71 translate("Choose Unbounds listening port"))
75 tlm = s1:taboption("service", Value, "ttl_min", translate("TTL Minimum:"),
76 translate("Prevent excessively short cache periods"))
77 tlm.datatype = "and(uinteger,min(0),max(600))"
82 ctl = s1:taboption("advanced", Flag, "unbound_control", translate("Unbound Control App:"),
83 translate("Enable unecrypted localhost access for unbound-control"))
86 dlk = s1:taboption("advanced", ListValue, "dhcp_link", translate("DHCP Link:"),
87 translate("Link to supported programs to load DHCP into DNS"))
88 dlk:value("none", translate("No Link"))
89 dlk:value("dnsmasq", "dnsmasq")
90 dlk:value("odhcpd", "odhcpd")
93 dom = s1:taboption("advanced", Value, "domain", translate("Local Domain:"),
94 translate("Domain suffix for this router and DHCP clients"))
95 dom.placeholder = "lan"
96 dom:depends({ dhcp_link = "none" })
97 dom:depends({ dhcp_link = "odhcpd" })
99 dty = s1:taboption("advanced", ListValue, "domain_type", translate("Local Domain Type:"),
100 translate("How to treat queries of this local domain"))
101 dty:value("deny", translate("Ignored"))
102 dty:value("refuse", translate("Refused"))
103 dty:value("static", translate("Only Local"))
104 dty:value("transparent", translate("Also Forwarded"))
105 dty:depends({ dhcp_link = "none" })
106 dty:depends({ dhcp_link = "odhcpd" })
108 lfq = s1:taboption("advanced", ListValue, "add_local_fqdn", translate("LAN DNS:"),
109 translate("How to enter the LAN or local network router in DNS"))
110 lfq:value("0", translate("No DNS"))
111 lfq:value("1", translate("Hostname, Primary Address"))
112 lfq:value("2", translate("Hostname, All Addresses"))
113 lfq:value("3", translate("Host FQDN, All Addresses"))
114 lfq:value("4", translate("Interface FQDN, All Addresses"))
115 lfq:depends({ dhcp_link = "none" })
116 lfq:depends({ dhcp_link = "odhcpd" })
118 wfq = s1:taboption("advanced", ListValue, "add_wan_fqdn", translate("WAN DNS:"),
119 translate("Override the WAN side router entry in DNS"))
120 wfq:value("0", translate("Upstream"))
121 wfq:value("1", translate("Hostname, Primary Address"))
122 wfq:value("2", translate("Hostname, All Addresses"))
123 wfq:value("3", translate("Host FQDN, All Addresses"))
124 wfq:value("4", translate("Interface FQDN, All Addresses"))
125 wfq:depends({ dhcp_link = "none" })
126 wfq:depends({ dhcp_link = "odhcpd" })
128 ctl = s1:taboption("advanced", Flag, "dhcp4_slaac6", translate("DHCPv4 to SLAAC:"),
129 translate("Use DHCPv4 MAC to discover IP6 hosts SLAAC (EUI64)"))
132 d64 = s1:taboption("advanced", Flag, "dns64", translate("Enable DNS64:"),
133 translate("Enable the DNS64 module"))
136 pfx = s1:taboption("advanced", Value, "dns64_prefix", translate("DNS64 Prefix:"),
137 translate("Prefix for generated DNS64 addresses"))
138 pfx.datatype = "ip6addr"
139 pfx.placeholder = "64:ff9b::/96"
141 pfx:depends({ dns64 = true })
143 qry = s1:taboption("advanced", Flag, "query_minimize", translate("Query Minimize:"),
144 translate("Break down query components for limited added privacy"))
147 qrs = s1:taboption("advanced", Flag, "query_min_strict", translate("Strict Minimize:"),
148 translate("Strict version of 'query minimize' but it can break DNS"))
150 qrs:depends({ query_minimize = true })
152 --TODO: dnsmasq needs to not reference resolve-file and get off port 53.
154 --Resource Tuning Tab
156 pro = s1:taboption("resource", ListValue, "protocol", translate("Recursion Protocol:"),
157 translate("Chose the protocol recursion queries leave on"))
158 pro:value("mixed", translate("IP4 and IP6"))
159 pro:value("ip6_prefer", translate("IP6 Preferred"))
160 pro:value("ip4_only", translate("IP4 Only"))
161 pro:value("ip6_only", translate("IP6 Only"))
164 rsn = s1:taboption("resource", ListValue, "recursion", translate("Recursion Strength:"),
165 translate("Recursion activity affects memory growth and CPU load"))
166 rsn:value("aggressive", translate("Aggressive"))
167 rsn:value("default", translate("Default"))
168 rsn:value("passive", translate("Passive"))
171 rsc = s1:taboption("resource", ListValue, "resource", translate("Memory Resource:"),
172 translate("Use menu System/Processes to observe any memory growth"))
173 rsc:value("large", translate("Large"))
174 rsc:value("medium", translate("Medium"))
175 rsc:value("small", translate("Small"))
176 rsc:value("tiny", translate("Tiny"))
179 ag2 = s1:taboption("resource", Value, "root_age", translate("Root DSKEY Age:"),
180 translate("Limit days between RFC5011 to reduce flash writes"))
181 ag2.datatype = "and(uinteger,min(1),max(99))"
182 ag2:value("14", "14")
183 ag2:value("28", "28 ("..translate("default")..")")
184 ag2:value("45", "45")
185 ag2:value("90", "90")
186 ag2:value("99", "99 ("..translate("never")..")")