unbound.lua 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. s = m:section(TypedSection, "unbound", translate("Unbound Settings"))
  8. s.addremove = false
  9. s.anonymous = true
  10. s:tab("service", translate("Unbound Service"))
  11. s:tab("resource", translate("Unbound Resources"))
  12. s:tab("dnsmasq", translate("Dnsmasq Link"))
  13. --Enable Unbound
  14. e = s:taboption("service", Flag, "enabled", translate("Enable Unbound:"),
  15. translate("Enable the initialization scripts for Unbound"))
  16. e.rmempty = false
  17. function e.cfgvalue(self, section)
  18. return luci.sys.init.enabled("unbound") and self.enabled or self.disabled
  19. end
  20. function e.write(self, section, value)
  21. if value == "1" then
  22. luci.sys.init.enable("unbound")
  23. luci.sys.call("/etc/init.d/unbound start >/dev/null")
  24. else
  25. luci.sys.call("/etc/init.d/unbound stop >/dev/null")
  26. luci.sys.init.disable("unbound")
  27. end
  28. return Flag.write(self, section, value)
  29. end
  30. --Service Tab
  31. mcf = s:taboption("service", Flag, "manual_conf", translate("Manual Conf:"),
  32. translate("Skip UCI and use /etc/unbound/unbound.conf"))
  33. mcf.rmempty = false
  34. lsv = s:taboption("service", Flag, "localservice", translate("Local Service:"),
  35. translate("Accept queries only from local subnets"))
  36. lsv.rmempty = false
  37. qry = s:taboption("service", Flag, "query_minimize", translate("Query Minimize:"),
  38. translate("Break down query components for small added privacy"))
  39. qry.rmempty = false
  40. rlh = s:taboption("service", Flag, "rebind_localhost", translate("Block Localhost Rebind:"),
  41. translate("Prevent upstream response of 127.0.0.0/8"))
  42. rlh.rmempty = false
  43. rpv = s:taboption("service", Flag, "rebind_protection", translate("Block Private Rebind:"),
  44. translate("Prevent upstream response of RFC1918 ranges"))
  45. rpv.rmempty = false
  46. vld = s:taboption("service", Flag, "validator", translate("Enable DNSSEC:"),
  47. translate("Enable the DNSSEC validator module"))
  48. vld.rmempty = false
  49. nvd = s:taboption("service", Flag, "validator_ntp", translate("DNSSEC NTP Fix:"),
  50. translate("Break the loop where DNSSEC needs NTP and NTP needs DNS"))
  51. nvd.rmempty = false
  52. eds = s:taboption("service", Value, "edns_size", translate("EDNS Size:"),
  53. translate("Limit extended DNS packet size"))
  54. eds.datatype = "and(uinteger,min(512),max(4096))"
  55. eds.rmempty = false
  56. prt = s:taboption("service", Value, "listen_port", translate("Listening Port:"),
  57. translate("Choose Unbounds listening port"))
  58. prt.datatype = "port"
  59. prt.rmempty = false
  60. tlm = s:taboption("service", Value, "ttl_min", translate("TTL Minimum:"),
  61. translate("Prevent excessively short cache periods"))
  62. tlm.datatype = "and(uinteger,min(0),max(600))"
  63. tlm.rmempty = false
  64. d64 = s:taboption("service", Flag, "dns64", translate("Enable DNS64:"),
  65. translate("Enable the DNS64 module"))
  66. d64.rmempty = false
  67. pfx = s:taboption("service", Value, "dns64_prefix", translate("DNS64 Prefix:"),
  68. translate("Prefix for generated DNS64 addresses"))
  69. pfx.datatype = "ip6addr"
  70. pfx.placeholder = "64:ff9b::/96"
  71. pfx.optional = true
  72. pfx:depends({ dns64 = "1" })
  73. --Resource Tuning Tab
  74. rsn = s:taboption("resource", ListValue, "recursion", translate("Recursion Strength:"),
  75. translate("Recursion activity affects memory growth and CPU load"))
  76. rsn:value("aggressive", translate("Aggressive"))
  77. rsn:value("default", translate("Default"))
  78. rsn:value("passive", translate("Passive"))
  79. rsn.rmempty = false
  80. rsc = s:taboption("resource", ListValue, "resource", translate("Memory Resource:"),
  81. translate("Use menu System/Processes to observe any memory growth"))
  82. rsc:value("large", translate("Large"))
  83. rsc:value("medium", translate("Medium"))
  84. rsc:value("small", translate("Small"))
  85. rsc:value("tiny", translate("Tiny"))
  86. rsc.rmempty = false
  87. age = s:taboption("resource", Value, "root_age", translate("Root DSKEY Age:"),
  88. translate("Limit days between RFC5011 to reduce flash writes"))
  89. age.datatype = "and(uinteger,min(1),max(99))"
  90. age:value("14", "14")
  91. age:value("28", "28 ("..translate("default")..")")
  92. age:value("45", "45")
  93. age:value("90", "90")
  94. age:value("99", "99 ("..translate("never")..")")
  95. --Dnsmasq Link Tab
  96. dld = s:taboption("dnsmasq", Flag, "dnsmasq_link_dns", translate("Link dnsmasq:"),
  97. translate("Forward queries to dnsmasq for local clients"))
  98. dld.rmempty = false
  99. dgn = s:taboption("dnsmasq", Flag, "dnsmsaq_gate_name", translate("Local Gateway Name:"),
  100. translate("Also query dnsmasq for this hosts outbound gateway"))
  101. dgn.rmempty = false
  102. --TODO: Read only repective dnsmasq options and inform user of link requirements.
  103. --TODO: dnsmasq needs to not reference resolve-file and get off port 53.
  104. return m