modules/admin-full: fix disabling of rebind protection in dnsmasq config
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_services / dnsmasq.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 m = Map("dhcp", "Dnsmasq",
15 translate("Dnsmasq is a combined <abbr title=\"Dynamic Host Configuration Protocol" ..
16 "\">DHCP</abbr>-Server and <abbr title=\"Domain Name System\">DNS</abbr>-" ..
17 "Forwarder for <abbr title=\"Network Address Translation\">NAT</abbr> " ..
18 "firewalls"))
19
20 s = m:section(TypedSection, "dnsmasq", translate("Settings"))
21 s.anonymous = true
22 s.addremove = false
23
24 s:tab("general", translate("General Settings"))
25 s:tab("files", translate("Resolv and Hosts Files"))
26 s:tab("tftp", translate("TFTP Settings"))
27 s:tab("advanced", translate("Advanced Settings"))
28
29 s:taboption("general", Flag, "domainneeded",
30 translate("Domain required"),
31 translate("Don't forward <abbr title=\"Domain Name System\">DNS</abbr>-Requests without " ..
32 "<abbr title=\"Domain Name System\">DNS</abbr>-Name"))
33
34 s:taboption("general", Flag, "authoritative",
35 translate("Authoritative"),
36 translate("This is the only <abbr title=\"Dynamic Host Configuration Protocol\">DHCP</" ..
37 "abbr> in the local network"))
38
39
40 s:taboption("files", Flag, "readethers",
41 translate("Use <code>/etc/ethers</code>"),
42 translate("Read <code>/etc/ethers</code> to configure the <abbr title=\"Dynamic Host " ..
43 "Configuration Protocol\">DHCP</abbr>-Server"))
44
45 s:taboption("files", Value, "leasefile",
46 translate("Leasefile"),
47 translate("file where given <abbr title=\"Dynamic Host Configuration Protocol\">DHCP</" ..
48 "abbr>-leases will be stored"))
49
50 s:taboption("files", Flag, "noresolv",
51 translate("Ignore resolve file")).optional = true
52
53 rf = s:taboption("files", Value, "resolvfile",
54 translate("Resolve file"),
55 translate("local <abbr title=\"Domain Name System\">DNS</abbr> file"))
56
57 rf:depends("noresolv", "")
58 rf.optional = true
59
60
61 s:taboption("files", Flag, "nohosts",
62 translate("Ignore Hosts files")).optional = true
63
64 hf = s:taboption("files", DynamicList, "addnhosts",
65 translate("Additional Hosts files"))
66
67 hf:depends("nohosts", "")
68 hf.optional = true
69
70
71 s:taboption("advanced", Flag, "boguspriv",
72 translate("Filter private"),
73 translate("Do not forward reverse lookups for local networks"))
74
75 s:taboption("advanced", Flag, "filterwin2k",
76 translate("Filter useless"),
77 translate("Do not forward requests that cannot be answered by public name servers"))
78
79 s:taboption("advanced", Flag, "localise_queries",
80 translate("Localise queries"),
81 translate("Localise hostname depending on the requesting subnet if multiple IPs are available"))
82
83 s:taboption("general", Value, "local",
84 translate("Local server"),
85 translate("Local domain specification. Names matching this domain are never forwared and resolved from DHCP or hosts files only"))
86
87 s:taboption("general", Value, "domain",
88 translate("Local domain"),
89 translate("Local domain suffix appended to DHCP names and hosts file entries"))
90
91 s:taboption("advanced", Flag, "expandhosts",
92 translate("Expand hosts"),
93 translate("Add local domain suffix to names served from hosts files"))
94
95 s:taboption("advanced", Flag, "nonegcache",
96 translate("No negative cache"),
97 translate("Do not cache negative replies, e.g. for not existing domains"))
98
99 s:taboption("advanced", Flag, "strictorder",
100 translate("Strict order"),
101 translate("<abbr title=\"Domain Name System\">DNS</abbr> servers will be queried in the " ..
102 "order of the resolvfile")).optional = true
103
104 s:taboption("general", Flag, "logqueries",
105 translate("Log queries"),
106 translate("Write received DNS requests to syslog")).optional = true
107
108 df = s:taboption("general", DynamicList, "server", translate("DNS forwardings"),
109 translate("List of <abbr title=\"Domain Name System\">DNS</abbr> " ..
110 "servers to forward requests to"))
111
112 df.optional = true
113 df.placeholder = "/example.org/10.1.2.3"
114
115
116 rp = s:taboption("general", Flag, "rebind_protection",
117 translate("Rebind protection"),
118 translate("Discard upstream RFC1918 responses"))
119
120 rp.rmempty = false
121
122
123 rl = s:taboption("general", Flag, "rebind_localhost",
124 translate("Allow localhost"),
125 translate("Allow upstream responses in the 127.0.0.0/8 range, e.g. for RBL services"))
126
127 rl:depends("rebind_protection", "1")
128
129
130 rd = s:taboption("general", DynamicList, "rebind_domain",
131 translate("Domain whitelist"),
132 translate("List of domains to allow RFC1918 responses for"))
133
134 rd:depends("rebind_protection", "1")
135 rd.datatype = "host"
136 rd.placeholder = "ihost.netflix.com"
137
138
139 pt = s:taboption("advanced", Value, "port",
140 translate("<abbr title=\"Domain Name System\">DNS</abbr> server port"),
141 translate("Listening port for inbound DNS queries"))
142
143 pt.optional = true
144 pt.datatype = "port"
145 pt.placeholder = 53
146
147
148 qp = s:taboption("advanced", Value, "queryport",
149 translate("<abbr title=\"Domain Name System\">DNS</abbr> query port"),
150 translate("Fixed source port for outbound DNS queries"))
151
152 qp.optional = true
153 qp.datatype = "port"
154 qp.placeholder = translate("any")
155
156
157 lm = s:taboption("advanced", Value, "dhcpleasemax",
158 translate("<abbr title=\"maximal\">Max.</abbr> <abbr title=\"Dynamic Host Configuration " ..
159 "Protocol\">DHCP</abbr> leases"),
160 translate("Maximum allowed number of active DHCP leases"))
161
162 lm.optional = true
163 lm.datatype = "uinteger"
164 lm.placeholder = translate("unlimited")
165
166
167 em = s:taboption("advanced", Value, "ednspacket_max",
168 translate("<abbr title=\"maximal\">Max.</abbr> <abbr title=\"Extension Mechanisms for " ..
169 "Domain Name System\">EDNS0</abbr> paket size"),
170 translate("Maximum allowed size of EDNS.0 UDP packets"))
171
172 em.optional = true
173 em.datatype = "uinteger"
174 em.placeholder = 1280
175
176
177 cq = s:taboption("advanced", Value, "dnsforwardmax",
178 translate("<abbr title=\"maximal\">Max.</abbr> concurrent queries"),
179 translate("Maximum allowed number of concurrent DNS queries"))
180
181 cq.optional = true
182 cq.datatype = "uinteger"
183 cq.placeholder = 150
184
185
186 s:taboption("tftp", Flag, "enable_tftp",
187 translate("Enable TFTP server")).optional = true
188
189 tr = s:taboption("tftp", Value, "tftp_root",
190 translate("TFTP server root"),
191 translate("Root directory for files served via TFTP"))
192
193 tr.optional = true
194 tr:depends("enable_tftp", "1")
195 tr.placeholder = "/"
196
197
198 db = s:taboption("tftp", Value, "dhcp_boot",
199 translate("Network boot image"),
200 translate("Filename of the boot image advertised to clients"))
201
202 db.optional = true
203 db:depends("enable_tftp", "1")
204 db.placeholder = "pxelinux.0"
205
206
207 return m