unbound.lua 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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.
  5. m = Map("unbound", translate("Recursive DNS"),
  6. translate("Unbound is a validating, recursive, and caching DNS resolver."))
  7. s1 = m:section(TypedSection, "unbound")
  8. s1.addremove = false
  9. s1.anonymous = true
  10. s1:tab("service", translate("Basic Settings"))
  11. s1:tab("advanced", translate("Advanced Settings"))
  12. s1:tab("resource", translate("Resource Settings"))
  13. --LuCI or Not
  14. ena = s1:taboption("service", Flag, "enabled", translate("Enable Unbound:"),
  15. translate("Enable the initialization scripts for Unbound"))
  16. ena.rmempty = false
  17. mcf = s1:taboption("service", Flag, "manual_conf", translate("Manual Conf:"),
  18. translate("Skip UCI and use /etc/unbound/unbound.conf"))
  19. mcf.rmempty = false
  20. function ena.cfgvalue(self, section)
  21. return luci.sys.init.enabled("unbound") and self.enabled or self.disabled
  22. end
  23. function ena.write(self, section, value)
  24. if value == "1" then
  25. luci.sys.init.enable("unbound")
  26. luci.sys.call("/etc/init.d/unbound start >/dev/null")
  27. else
  28. luci.sys.call("/etc/init.d/unbound stop >/dev/null")
  29. luci.sys.init.disable("unbound")
  30. end
  31. return Flag.write(self, section, value)
  32. end
  33. --Basic Tab
  34. lsv = s1:taboption("service", Flag, "localservice", translate("Local Service:"),
  35. translate("Accept queries only from local subnets"))
  36. lsv.rmempty = false
  37. rlh = s1:taboption("service", Flag, "rebind_localhost", translate("Block Localhost Rebind:"),
  38. translate("Prevent upstream response of 127.0.0.0/8"))
  39. rlh.rmempty = false
  40. rpv = s1:taboption("service", Flag, "rebind_protection", translate("Block Private Rebind:"),
  41. translate("Prevent upstream response of RFC1918 ranges"))
  42. rpv.rmempty = false
  43. vld = s1:taboption("service", Flag, "validator", translate("Enable DNSSEC:"),
  44. translate("Enable the DNSSEC validator module"))
  45. vld.rmempty = false
  46. nvd = s1:taboption("service", Flag, "validator_ntp", translate("DNSSEC NTP Fix:"),
  47. translate("Break the loop where DNSSEC needs NTP and NTP needs DNS"))
  48. nvd.rmempty = false
  49. nvd:depends({ validator = true })
  50. eds = s1:taboption("service", Value, "edns_size", translate("EDNS Size:"),
  51. translate("Limit extended DNS packet size"))
  52. eds.datatype = "and(uinteger,min(512),max(4096))"
  53. eds.rmempty = false
  54. prt = s1:taboption("service", Value, "listen_port", translate("Listening Port:"),
  55. translate("Choose Unbounds listening port"))
  56. prt.datatype = "port"
  57. prt.rmempty = false
  58. tlm = s1:taboption("service", Value, "ttl_min", translate("TTL Minimum:"),
  59. translate("Prevent excessively short cache periods"))
  60. tlm.datatype = "and(uinteger,min(0),max(600))"
  61. tlm.rmempty = false
  62. --Advanced Tab
  63. ctl = s1:taboption("advanced", Flag, "unbound_control", translate("Unbound Control App:"),
  64. translate("Enable unecrypted localhost access for unbound-control"))
  65. ctl.rmempty = false
  66. dlk = s1:taboption("advanced", ListValue, "dhcp_link", translate("DHCP Link:"),
  67. translate("Link to supported programs to load DHCP into DNS"))
  68. dlk:value("none", translate("No Link"))
  69. dlk:value("dnsmasq", "dnsmasq")
  70. dlk:value("odhcpd", "odhcpd")
  71. dlk.rmempty = false
  72. dom = s1:taboption("advanced", Value, "domain", translate("Local Domain:"),
  73. translate("Domain suffix for this router and DHCP clients"))
  74. dom.placeholder = "lan"
  75. dom:depends({ dhcp_link = "none" })
  76. dom:depends({ dhcp_link = "odhcpd" })
  77. dty = s1:taboption("advanced", ListValue, "domain_type", translate("Local Domain Type:"),
  78. translate("How to treat queries of this local domain"))
  79. dty:value("deny", translate("Ignored"))
  80. dty:value("refuse", translate("Refused"))
  81. dty:value("static", translate("Only Local"))
  82. dty:value("transparent", translate("Also Forwarded"))
  83. dty:depends({ dhcp_link = "none" })
  84. dty:depends({ dhcp_link = "odhcpd" })
  85. lfq = s1:taboption("advanced", ListValue, "add_local_fqdn", translate("LAN DNS:"),
  86. translate("How to enter the LAN or local network router in DNS"))
  87. lfq:value("0", translate("No DNS"))
  88. lfq:value("1", translate("Hostname, Primary Address"))
  89. lfq:value("2", translate("Hostname, All Addresses"))
  90. lfq:value("3", translate("Host FQDN, All Addresses"))
  91. lfq:value("4", translate("Interface FQDN, All Addresses"))
  92. lfq:depends({ dhcp_link = "none" })
  93. lfq:depends({ dhcp_link = "odhcpd" })
  94. wfq = s1:taboption("advanced", ListValue, "add_wan_fqdn", translate("WAN DNS:"),
  95. translate("Override the WAN side router entry in DNS"))
  96. wfq:value("0", translate("Upstream"))
  97. wfq:value("1", translate("Hostname, Primary Address"))
  98. wfq:value("2", translate("Hostname, All Addresses"))
  99. wfq:value("3", translate("Host FQDN, All Addresses"))
  100. wfq:value("4", translate("Interface FQDN, All Addresses"))
  101. wfq:depends({ dhcp_link = "none" })
  102. wfq:depends({ dhcp_link = "odhcpd" })
  103. ctl = s1:taboption("advanced", Flag, "dhcp4_slaac6", translate("DHCPv4 to SLAAC:"),
  104. translate("Use DHCPv4 MAC to discover IP6 hosts SLAAC (EUI64)"))
  105. ctl.rmempty = false
  106. d64 = s1:taboption("advanced", Flag, "dns64", translate("Enable DNS64:"),
  107. translate("Enable the DNS64 module"))
  108. d64.rmempty = false
  109. pfx = s1:taboption("advanced", Value, "dns64_prefix", translate("DNS64 Prefix:"),
  110. translate("Prefix for generated DNS64 addresses"))
  111. pfx.datatype = "ip6addr"
  112. pfx.placeholder = "64:ff9b::/96"
  113. pfx.optional = true
  114. pfx:depends({ dns64 = true })
  115. qry = s1:taboption("advanced", Flag, "query_minimize", translate("Query Minimize:"),
  116. translate("Break down query components for limited added privacy"))
  117. qry.rmempty = false
  118. qrs = s1:taboption("advanced", Flag, "query_min_strict", translate("Strict Minimize:"),
  119. translate("Strict version of 'query minimize' but it can break DNS"))
  120. qrs.rmempty = false
  121. qrs:depends({ query_minimize = true })
  122. --TODO: dnsmasq needs to not reference resolve-file and get off port 53.
  123. --Resource Tuning Tab
  124. pro = s1:taboption("resource", ListValue, "protocol", translate("Recursion Protocol:"),
  125. translate("Chose the protocol recursion queries leave on"))
  126. pro:value("mixed", translate("IP4 and IP6"))
  127. pro:value("ip6_prefer", translate("IP6 Preferred"))
  128. pro:value("ip4_only", translate("IP4 Only"))
  129. pro:value("ip6_only", translate("IP6 Only"))
  130. pro.rmempty = false
  131. rsn = s1:taboption("resource", ListValue, "recursion", translate("Recursion Strength:"),
  132. translate("Recursion activity affects memory growth and CPU load"))
  133. rsn:value("aggressive", translate("Aggressive"))
  134. rsn:value("default", translate("Default"))
  135. rsn:value("passive", translate("Passive"))
  136. rsn.rmempty = false
  137. rsc = s1:taboption("resource", ListValue, "resource", translate("Memory Resource:"),
  138. translate("Use menu System/Processes to observe any memory growth"))
  139. rsc:value("large", translate("Large"))
  140. rsc:value("medium", translate("Medium"))
  141. rsc:value("small", translate("Small"))
  142. rsc:value("tiny", translate("Tiny"))
  143. rsc.rmempty = false
  144. ag2 = s1:taboption("resource", Value, "root_age", translate("Root DSKEY Age:"),
  145. translate("Limit days between RFC5011 to reduce flash writes"))
  146. ag2.datatype = "and(uinteger,min(1),max(99))"
  147. ag2:value("14", "14")
  148. ag2:value("28", "28 ("..translate("default")..")")
  149. ag2:value("45", "45")
  150. ag2:value("90", "90")
  151. ag2:value("99", "99 ("..translate("never")..")")
  152. return m