1 -- Copyright 2008 Steven Barth <steven@midlink.org>
2 -- Copyright 2008-2010 Jo-Philipp Wich <jow@openwrt.org>
3 -- Licensed to the public under the Apache License 2.0.
5 m = Map("tinyproxy", translate("Tinyproxy"),
6 translate("Tinyproxy is a small and fast non-caching HTTP(S)-Proxy"))
8 s = m:section(TypedSection, "tinyproxy", translate("Server Settings"))
11 s:tab("general", translate("General settings"))
12 s:tab("privacy", translate("Privacy settings"))
13 s:tab("filter", translate("Filtering and ACLs"))
14 s:tab("limits", translate("Server limits"))
17 o = s:taboption("general", Flag, "enabled", translate("Enable Tinyproxy server"))
20 function o.write(self, section, value)
22 luci.sys.init.enable("tinyproxy")
24 luci.sys.init.disable("tinyproxy")
27 return Flag.write(self, section, value)
31 o = s:taboption("general", Value, "Port", translate("Listen port"),
32 translate("Specifies the HTTP port Tinyproxy is listening on for requests"))
39 o = s:taboption("general", Value, "Listen", translate("Listen address"),
40 translate("Specifies the addresses Tinyproxy is listening on for requests"))
44 o.placeholder = "0.0.0.0"
47 o = s:taboption("general", Value, "Bind", translate("Bind address"),
48 translate("Specifies the address Tinyproxy binds to for outbound forwarded requests"))
52 o.placeholder = "0.0.0.0"
55 o = s:taboption("general", Value, "DefaultErrorFile", translate("Error page"),
56 translate("HTML template file to serve when HTTP errors occur"))
59 o.default = "/usr/share/tinyproxy/default.html"
62 o = s:taboption("general", Value, "StatFile", translate("Statistics page"),
63 translate("HTML template file to serve for stat host requests"))
66 o.default = "/usr/share/tinyproxy/stats.html"
69 o = s:taboption("general", Flag, "Syslog", translate("Use syslog"),
70 translate("Writes log messages to syslog instead of a log file"))
73 o = s:taboption("general", Value, "LogFile", translate("Log file"),
74 translate("Log file to use for dumping messages"))
76 o.default = "/var/log/tinyproxy.log"
77 o:depends("Syslog", "")
80 o = s:taboption("general", ListValue, "LogLevel", translate("Log level"),
81 translate("Logging verbosity of the Tinyproxy process"))
91 o = s:taboption("general", Value, "User", translate("User"),
92 translate("Specifies the user name the Tinyproxy process is running as"))
97 o = s:taboption("general", Value, "Group", translate("Group"),
98 translate("Specifies the group name the Tinyproxy process is running as"))
100 o.default = "nogroup"
107 o = s:taboption("privacy", Flag, "XTinyproxy", translate("X-Tinyproxy header"),
108 translate("Adds an \"X-Tinyproxy\" HTTP header with the client IP address to forwarded requests"))
111 o = s:taboption("privacy", Value, "ViaProxyName", translate("Via hostname"),
112 translate("Specifies the Tinyproxy hostname to use in the Via HTTP header"))
114 o.placeholder = "tinyproxy"
115 o.datatype = "hostname"
118 s:taboption("privacy", DynamicList, "Anonymous", translate("Header whitelist"),
119 translate("Specifies HTTP header names which are allowed to pass-through, all others are discarded. Leave empty to disable header filtering"))
126 o = s:taboption("filter", DynamicList, "Allow", translate("Allowed clients"),
127 translate("List of IP addresses or ranges which are allowed to use the proxy server"))
129 o.placeholder = "0.0.0.0"
130 o.datatype = "ipaddr"
133 o = s:taboption("filter", DynamicList, "ConnectPort", translate("Allowed connect ports"),
134 translate("List of allowed ports for the CONNECT method. A single value \"0\" allows all ports"))
140 s:taboption("filter", FileUpload, "Filter", translate("Filter file"),
141 translate("Plaintext file with URLs or domains to filter. One entry per line"))
144 s:taboption("filter", Flag, "FilterURLs", translate("Filter by URLs"),
145 translate("By default, filtering is done based on domain names. Enable this to match against URLs instead"))
148 s:taboption("filter", Flag, "FilterExtended", translate("Filter by RegExp"),
149 translate("By default, basic POSIX expressions are used for filtering. Enable this to activate extended regular expressions"))
152 s:taboption("filter", Flag, "FilterCaseSensitive", translate("Filter case-sensitive"),
153 translate("By default, filter strings are treated as case-insensitive. Enable this to make the matching case-sensitive"))
156 s:taboption("filter", Flag, "FilterDefaultDeny", translate("Default deny"),
157 translate("By default, the filter rules act as blacklist. Enable this option to only allow matched URLs or domain names"))
164 o = s:taboption("limits", Value, "Timeout", translate("Connection timeout"),
165 translate("Maximum number of seconds an inactive connection is held open"))
168 o.datatype = "uinteger"
172 o = s:taboption("limits", Value, "MaxClients", translate("Max. clients"),
173 translate("Maximum allowed number of concurrently connected clients"))
175 o.datatype = "uinteger"
179 o = s:taboption("limits", Value, "MinSpareServers", translate("Min. spare servers"),
180 translate("Minimum number of prepared idle processes"))
182 o.datatype = "uinteger"
186 o = s:taboption("limits", Value, "MaxSpareServers", translate("Max. spare servers"),
187 translate("Maximum number of prepared idle processes"))
189 o.datatype = "uinteger"
193 o = s:taboption("limits", Value, "StartServers", translate("Start spare servers"),
194 translate("Number of idle processes to start when launching Tinyproxy"))
196 o.datatype = "uinteger"
200 o = s:taboption("limits", Value, "MaxRequestsPerChild", translate("Max. requests per server"),
201 translate("Maximum allowed number of requests per process. If it is exeeded, the process is restarted. Zero means unlimited."))
203 o.datatype = "uinteger"
211 s = m:section(TypedSection, "upstream", translate("Upstream Proxies"),
212 translate("Upstream proxy rules define proxy servers to use when accessing certain IP addresses or domains."))
218 t = s:option(ListValue, "type", translate("Policy"),
219 translate("<em>Via proxy</em> routes requests to the given target via the specifed upstream proxy, <em>Reject access</em> disables any upstream proxy for the target"))
221 t:value("proxy", translate("Via proxy"))
222 t:value("reject", translate("Reject access"))
225 ta = s:option(Value, "target", translate("Target host"),
226 translate("Can be either an IP address or range, a domain name or \".\" for any host without domain"))
229 ta.placeholder = "0.0.0.0/0"
233 v = s:option(Value, "via", translate("Via proxy"),
234 translate("Specifies the upstream proxy to use for accessing the target host. Format is <code>address:port</code>"))
236 v:depends({type="proxy"})
237 v.placeholder = "10.0.0.1:8080"