f9411c7a8489698496810fbd5803d7a4bb5c3510
[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
121 rl = s:taboption("general", Flag, "rebind_localhost",
122         translate("Allow localhost"),
123         translate("Allow upstream responses in the 127.0.0.0/8 range, e.g. for RBL services"))
124
125 rl:depends("rebind_protection", "1")
126
127
128 rd = s:taboption("general", DynamicList, "rebind_domain",
129         translate("Domain whitelist"),
130         translate("List of domains to allow RFC1918 responses for"))
131
132 rd:depends("rebind_protection", "1")
133 rd.datatype = "host"
134 rd.placeholder = "ihost.netflix.com"
135
136
137 pt = s:taboption("advanced", Value, "port",
138         translate("<abbr title=\"Domain Name System\">DNS</abbr> server port"),
139         translate("Listening port for inbound DNS queries"))
140
141 pt.optional = true
142 pt.datatype = "port"
143 pt.placeholder = 53
144
145
146 qp = s:taboption("advanced", Value, "queryport",
147         translate("<abbr title=\"Domain Name System\">DNS</abbr> query port"),
148         translate("Fixed source port for outbound DNS queries"))
149
150 qp.optional = true
151 qp.datatype = "port"
152 qp.placeholder = translate("any")
153
154
155 lm = s:taboption("advanced", Value, "dhcpleasemax",
156         translate("<abbr title=\"maximal\">Max.</abbr> <abbr title=\"Dynamic Host Configuration " ..
157                 "Protocol\">DHCP</abbr> leases"),
158         translate("Maximum allowed number of active DHCP leases"))
159
160 lm.optional = true
161 lm.datatype = "uinteger"
162 lm.placeholder = translate("unlimited")
163
164
165 em = s:taboption("advanced", Value, "ednspacket_max",
166         translate("<abbr title=\"maximal\">Max.</abbr> <abbr title=\"Extension Mechanisms for " ..
167                 "Domain Name System\">EDNS0</abbr> paket size"),
168         translate("Maximum allowed size of EDNS.0 UDP packets"))
169
170 em.optional = true
171 em.datatype = "uinteger"
172 em.placeholder = 1280
173
174
175 cq = s:taboption("advanced", Value, "dnsforwardmax",
176         translate("<abbr title=\"maximal\">Max.</abbr> concurrent queries"),
177         translate("Maximum allowed number of concurrent DNS queries"))
178
179 cq.optional = true
180 cq.datatype = "uinteger"
181 cq.placeholder = 150
182
183
184 s:taboption("tftp", Flag, "enable_tftp",
185         translate("Enable TFTP server")).optional = true
186
187 tr = s:taboption("tftp", Value, "tftp_root",
188         translate("TFTP server root"),
189         translate("Root directory for files served via TFTP"))
190
191 tr.optional = true
192 tr:depends("enable_tftp", "1")
193 tr.placeholder = "/"
194
195
196 db = s:taboption("tftp", Value, "dhcp_boot",
197         translate("Network boot image"),
198         translate("Filename of the boot image advertised to clients"))
199
200 db.optional = true
201 db:depends("enable_tftp", "1")
202 db.placeholder = "pxelinux.0"
203
204
205 return m