]>
Commit | Line | Data |
---|---|---|
ac1cfefa | 1 | #!/usr/bin/perl |
70df8302 MT |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
37273bc6 | 5 | # Copyright (C) 2009 Michael Tremer & Christian Schmidt # |
70df8302 MT |
6 | # # |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
488d1b7c | 21 | # |
37273bc6 | 22 | # (c) 2004-2009 marco.s - http://www.advproxy.net |
488d1b7c CS |
23 | # |
24 | # This code is distributed under the terms of the GPL | |
25 | # | |
37273bc6 | 26 | # $Id: advproxy.cgi,v 3.0.2 2009/02/04 00:00:00 marco.s Exp $ |
488d1b7c | 27 | # |
ac1cfefa MT |
28 | |
29 | use strict; | |
30 | ||
31 | # enable only the following on debugging purpose | |
cb5e9c6c CS |
32 | #use warnings; |
33 | #use CGI::Carp 'fatalsToBrowser'; | |
ac1cfefa | 34 | |
ed38f89d | 35 | require '/var/ipfire/general-functions.pl'; |
ac1cfefa MT |
36 | require "${General::swroot}/lang.pl"; |
37 | require "${General::swroot}/header.pl"; | |
38 | ||
363fb6af MT |
39 | my @squidversion = `/usr/sbin/squid -v`; |
40 | my $http_port='81'; | |
41 | my $https_port='444'; | |
42 | ||
18322edf CS |
43 | my %color = (); |
44 | my %mainsettings = (); | |
45 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
46 | &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); | |
47 | ||
ac1cfefa MT |
48 | my %proxysettings=(); |
49 | my %netsettings=(); | |
ed38f89d | 50 | my %filtersettings=(); |
9fb25b1c | 51 | my %xlratorsettings=(); |
ed38f89d | 52 | my %stdproxysettings=(); |
ac1cfefa | 53 | my %mainsettings=(); |
ed38f89d MT |
54 | |
55 | my %checked=(); | |
56 | my %selected=(); | |
57 | ||
58 | my @throttle_limits=(64,128,256,384,512,1024,2048,3072,5120); | |
59 | my $throttle_binary="bin|cab|exe|gz|rar|sea|tar|tgz|zip"; | |
60 | my $throttle_dskimg="b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi"; | |
61 | my $throttle_mmedia="aiff?|asf|avi|divx|mov|mp3|mpe?g|qt|ra?m"; | |
62 | ||
363fb6af MT |
63 | my $def_ports_safe="80 # http\n21 # ftp\n443 # https\n563 # snews\n70 # gopher\n210 # wais\n1025-65535 # unregistered ports\n280 # http-mgmt\n488 # gss-http\n591 # filemaker\n777 # multiling http\n800 # Squids port (for icons)\n"; |
64 | my $def_ports_ssl="443 # https\n563 # snews\n"; | |
65 | ||
ed38f89d MT |
66 | my @useragent=(); |
67 | my @useragentlist=(); | |
68 | ||
69 | my $hintcolour='#FFFFCC'; | |
70 | my $ncsa_buttontext=''; | |
71 | my $language=''; | |
72 | my $i=0; | |
73 | my $n=0; | |
74 | my $id=0; | |
75 | my $line=''; | |
76 | my $user=''; | |
77 | my @userlist=(); | |
78 | my @grouplist=(); | |
79 | my @temp=(); | |
80 | my @templist=(); | |
81 | ||
82 | my $cachemem=0; | |
83 | my $proxy1=''; | |
84 | my $proxy2=''; | |
85 | my $replybodymaxsize=0; | |
86 | my $browser_regexp=''; | |
87 | my $needhup = 0; | |
88 | my $errormessage=''; | |
89 | ||
90 | my $acldir = "${General::swroot}/proxy/advanced/acls"; | |
91 | my $ncsadir = "${General::swroot}/proxy/advanced/ncsa"; | |
92 | my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm"; | |
93 | my $raddir = "${General::swroot}/proxy/advanced/radius"; | |
94 | my $identdir = "${General::swroot}/proxy/advanced/ident"; | |
95 | my $credir = "${General::swroot}/proxy/advanced/cre"; | |
96 | ||
97 | my $userdb = "$ncsadir/passwd"; | |
98 | my $stdgrp = "$ncsadir/standard.grp"; | |
99 | my $extgrp = "$ncsadir/extended.grp"; | |
100 | my $disgrp = "$ncsadir/disabled.grp"; | |
101 | ||
102 | my $browserdb = "${General::swroot}/proxy/advanced/useragents"; | |
103 | my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes"; | |
104 | my $throttled_urls = "${General::swroot}/proxy/advanced/throttle"; | |
105 | ||
106 | my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable"; | |
107 | my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms"; | |
108 | my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors"; | |
109 | ||
110 | my $identhosts = "$identdir/hosts"; | |
111 | ||
8c55860f | 112 | my $authdir = "/usr/lib/squid/"; |
f1baee3e | 113 | my $errordir = "/usr/lib/squid/errors"; |
ed38f89d MT |
114 | |
115 | my $acl_src_subnets = "$acldir/src_subnets.acl"; | |
116 | my $acl_src_banned_ip = "$acldir/src_banned_ip.acl"; | |
117 | my $acl_src_banned_mac = "$acldir/src_banned_mac.acl"; | |
118 | my $acl_src_unrestricted_ip = "$acldir/src_unrestricted_ip.acl"; | |
119 | my $acl_src_unrestricted_mac = "$acldir/src_unrestricted_mac.acl"; | |
120 | my $acl_src_noaccess_ip = "$acldir/src_noaccess_ip.acl"; | |
121 | my $acl_src_noaccess_mac = "$acldir/src_noaccess_mac.acl"; | |
ed38f89d | 122 | my $acl_dst_noauth = "$acldir/dst_noauth.acl"; |
488d1b7c CS |
123 | my $acl_dst_noauth_dom = "$acldir/dst_noauth_dom.acl"; |
124 | my $acl_dst_noauth_net = "$acldir/dst_noauth_net.acl"; | |
125 | my $acl_dst_noauth_url = "$acldir/dst_noauth_url.acl"; | |
126 | my $acl_dst_nocache = "$acldir/dst_nocache.acl"; | |
127 | my $acl_dst_nocache_dom = "$acldir/dst_nocache_dom.acl"; | |
128 | my $acl_dst_nocache_net = "$acldir/dst_nocache_net.acl"; | |
129 | my $acl_dst_nocache_url = "$acldir/dst_nocache_url.acl"; | |
ed38f89d | 130 | my $acl_dst_throttle = "$acldir/dst_throttle.acl"; |
363fb6af MT |
131 | my $acl_ports_safe = "$acldir/ports_safe.acl"; |
132 | my $acl_ports_ssl = "$acldir/ports_ssl.acl"; | |
ed38f89d MT |
133 | my $acl_include = "$acldir/include.acl"; |
134 | ||
363fb6af MT |
135 | my $updaccelversion = 'n/a'; |
136 | my $urlfilterversion = 'n/a'; | |
137 | ||
ed38f89d MT |
138 | unless (-d "$acldir") { mkdir("$acldir"); } |
139 | unless (-d "$ncsadir") { mkdir("$ncsadir"); } | |
140 | unless (-d "$ntlmdir") { mkdir("$ntlmdir"); } | |
141 | unless (-d "$raddir") { mkdir("$raddir"); } | |
142 | unless (-d "$identdir") { mkdir("$identdir"); } | |
143 | unless (-d "$credir") { mkdir("$credir"); } | |
144 | ||
145 | unless (-e $cre_groups) { system("touch $cre_groups"); } | |
146 | unless (-e $cre_svhosts) { system("touch $cre_svhosts"); } | |
147 | ||
148 | unless (-e $userdb) { system("touch $userdb"); } | |
149 | unless (-e $stdgrp) { system("touch $stdgrp"); } | |
150 | unless (-e $extgrp) { system("touch $extgrp"); } | |
151 | unless (-e $disgrp) { system("touch $disgrp"); } | |
152 | ||
153 | unless (-e $acl_src_subnets) { system("touch $acl_src_subnets"); } | |
154 | unless (-e $acl_src_banned_ip) { system("touch $acl_src_banned_ip"); } | |
155 | unless (-e $acl_src_banned_mac) { system("touch $acl_src_banned_mac"); } | |
156 | unless (-e $acl_src_unrestricted_ip) { system("touch $acl_src_unrestricted_ip"); } | |
157 | unless (-e $acl_src_unrestricted_mac) { system("touch $acl_src_unrestricted_mac"); } | |
158 | unless (-e $acl_src_noaccess_ip) { system("touch $acl_src_noaccess_ip"); } | |
159 | unless (-e $acl_src_noaccess_mac) { system("touch $acl_src_noaccess_mac"); } | |
488d1b7c CS |
160 | unless (-e $acl_dst_noauth) { system("touch $acl_dst_noauth"); } |
161 | unless (-e $acl_dst_noauth_dom) { system("touch $acl_dst_noauth_dom"); } | |
162 | unless (-e $acl_dst_noauth_net) { system("touch $acl_dst_noauth_net"); } | |
163 | unless (-e $acl_dst_noauth_url) { system("touch $acl_dst_noauth_url"); } | |
164 | unless (-e $acl_dst_nocache) { system("touch $acl_dst_nocache"); } | |
165 | unless (-e $acl_dst_nocache_dom) { system("touch $acl_dst_nocache_dom"); } | |
166 | unless (-e $acl_dst_nocache_net) { system("touch $acl_dst_nocache_net"); } | |
167 | unless (-e $acl_dst_nocache_url) { system("touch $acl_dst_nocache_url"); } | |
ed38f89d | 168 | unless (-e $acl_dst_throttle) { system("touch $acl_dst_throttle"); } |
363fb6af MT |
169 | unless (-e $acl_ports_safe) { system("touch $acl_ports_safe"); } |
170 | unless (-e $acl_ports_ssl) { system("touch $acl_ports_ssl"); } | |
ed38f89d MT |
171 | unless (-e $acl_include) { system("touch $acl_include"); } |
172 | ||
173 | unless (-e $browserdb) { system("touch $browserdb"); } | |
174 | unless (-e $mimetypes) { system("touch $mimetypes"); } | |
175 | ||
176 | open FILE, $browserdb; | |
177 | @useragentlist = sort { reverse(substr(reverse(substr($a,index($a,',')+1)),index(reverse(substr($a,index($a,','))),',')+1)) cmp reverse(substr(reverse(substr($b,index($b,',')+1)),index(reverse(substr($b,index($b,','))),',')+1))} grep !/(^$)|(^\s*#)/,<FILE>; | |
178 | close(FILE); | |
ac1cfefa MT |
179 | |
180 | &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); | |
181 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
182 | ||
183 | &Header::showhttpheaders(); | |
184 | ||
185 | $proxysettings{'ACTION'} = ''; | |
186 | $proxysettings{'VALID'} = ''; | |
187 | ||
ac1cfefa MT |
188 | $proxysettings{'ENABLE'} = 'off'; |
189 | $proxysettings{'ENABLE_BLUE'} = 'off'; | |
ac1cfefa MT |
190 | $proxysettings{'TRANSPARENT'} = 'off'; |
191 | $proxysettings{'TRANSPARENT_BLUE'} = 'off'; | |
ed38f89d MT |
192 | $proxysettings{'PROXY_PORT'} = '800'; |
193 | $proxysettings{'VISIBLE_HOSTNAME'} = ''; | |
194 | $proxysettings{'ADMIN_MAIL_ADDRESS'} = ''; | |
fe1656d2 | 195 | $proxysettings{'ADMIN_PASSWORD'} = ''; |
0d948999 CS |
196 | $proxysettings{'ERR_LANGUAGE'} = 'German'; |
197 | $proxysettings{'ERR_DESIGN'} = 'ipfire'; | |
363fb6af | 198 | $proxysettings{'SUPPRESS_VERSION'} = 'off'; |
ed38f89d MT |
199 | $proxysettings{'FORWARD_VIA'} = 'off'; |
200 | $proxysettings{'FORWARD_IPADDRESS'} = 'off'; | |
201 | $proxysettings{'FORWARD_USERNAME'} = 'off'; | |
363fb6af | 202 | $proxysettings{'NO_CONNECTION_AUTH'} = 'off'; |
ed38f89d MT |
203 | $proxysettings{'UPSTREAM_PROXY'} = ''; |
204 | $proxysettings{'UPSTREAM_USER'} = ''; | |
205 | $proxysettings{'UPSTREAM_PASSWORD'} = ''; | |
206 | $proxysettings{'LOGGING'} = 'off'; | |
fe1656d2 | 207 | $proxysettings{'CACHEMGR'} = 'off'; |
ed38f89d MT |
208 | $proxysettings{'LOGQUERY'} = 'off'; |
209 | $proxysettings{'LOGUSERAGENT'} = 'off'; | |
fe1656d2 | 210 | $proxysettings{'FILEDESCRIPTORS'} = '4096'; |
ed38f89d MT |
211 | $proxysettings{'CACHE_MEM'} = '2'; |
212 | $proxysettings{'CACHE_SIZE'} = '50'; | |
ac1cfefa MT |
213 | $proxysettings{'MAX_SIZE'} = '4096'; |
214 | $proxysettings{'MIN_SIZE'} = '0'; | |
ed38f89d MT |
215 | $proxysettings{'MEM_POLICY'} = 'LRU'; |
216 | $proxysettings{'CACHE_POLICY'} = 'LRU'; | |
217 | $proxysettings{'L1_DIRS'} = '16'; | |
218 | $proxysettings{'OFFLINE_MODE'} = 'off'; | |
219 | $proxysettings{'CLASSROOM_EXT'} = 'off'; | |
220 | $proxysettings{'SUPERVISOR_PASSWORD'} = ''; | |
9fb25b1c MT |
221 | $proxysettings{'NO_PROXY_LOCAL'} = 'off'; |
222 | $proxysettings{'NO_PROXY_LOCAL_BLUE'} = 'off'; | |
ed38f89d MT |
223 | $proxysettings{'TIME_ACCESS_MODE'} = 'allow'; |
224 | $proxysettings{'TIME_FROM_HOUR'} = '00'; | |
225 | $proxysettings{'TIME_FROM_MINUTE'} = '00'; | |
226 | $proxysettings{'TIME_TO_HOUR'} = '24'; | |
227 | $proxysettings{'TIME_TO_MINUTE'} = '00'; | |
ac1cfefa MT |
228 | $proxysettings{'MAX_OUTGOING_SIZE'} = '0'; |
229 | $proxysettings{'MAX_INCOMING_SIZE'} = '0'; | |
ed38f89d MT |
230 | $proxysettings{'THROTTLING_GREEN_TOTAL'} = 'unlimited'; |
231 | $proxysettings{'THROTTLING_GREEN_HOST'} = 'unlimited'; | |
232 | $proxysettings{'THROTTLING_BLUE_TOTAL'} = 'unlimited'; | |
233 | $proxysettings{'THROTTLING_BLUE_HOST'} = 'unlimited'; | |
234 | $proxysettings{'THROTTLE_BINARY'} = 'off'; | |
235 | $proxysettings{'THROTTLE_DSKIMG'} = 'off'; | |
236 | $proxysettings{'THROTTLE_MMEDIA'} = 'off'; | |
237 | $proxysettings{'ENABLE_MIME_FILTER'} = 'off'; | |
238 | $proxysettings{'ENABLE_BROWSER_CHECK'} = 'off'; | |
239 | $proxysettings{'FAKE_USERAGENT'} = ''; | |
240 | $proxysettings{'FAKE_REFERER'} = ''; | |
241 | $proxysettings{'AUTH_METHOD'} = 'none'; | |
242 | $proxysettings{'AUTH_REALM'} = ''; | |
243 | $proxysettings{'AUTH_MAX_USERIP'} = ''; | |
244 | $proxysettings{'AUTH_CACHE_TTL'} = '60'; | |
245 | $proxysettings{'AUTH_IPCACHE_TTL'} = '0'; | |
246 | $proxysettings{'AUTH_CHILDREN'} = '5'; | |
247 | $proxysettings{'NCSA_MIN_PASS_LEN'} = '6'; | |
248 | $proxysettings{'NCSA_BYPASS_REDIR'} = 'off'; | |
249 | $proxysettings{'NCSA_USERNAME'} = ''; | |
250 | $proxysettings{'NCSA_GROUP'} = ''; | |
251 | $proxysettings{'NCSA_PASS'} = ''; | |
252 | $proxysettings{'NCSA_PASS_CONFIRM'} = ''; | |
253 | $proxysettings{'LDAP_BASEDN'} = ''; | |
254 | $proxysettings{'LDAP_TYPE'} = 'ADS'; | |
255 | $proxysettings{'LDAP_SERVER'} = ''; | |
256 | $proxysettings{'LDAP_PORT'} = '389'; | |
257 | $proxysettings{'LDAP_BINDDN_USER'} = ''; | |
258 | $proxysettings{'LDAP_BINDDN_PASS'} = ''; | |
259 | $proxysettings{'LDAP_GROUP'} = ''; | |
260 | $proxysettings{'NTLM_DOMAIN'} = ''; | |
261 | $proxysettings{'NTLM_PDC'} = ''; | |
262 | $proxysettings{'NTLM_BDC'} = ''; | |
263 | $proxysettings{'NTLM_ENABLE_ACL'} = 'off'; | |
264 | $proxysettings{'NTLM_USER_ACL'} = 'positive'; | |
265 | $proxysettings{'RADIUS_SERVER'} = ''; | |
363fb6af | 266 | $proxysettings{'RADIUS_PORT'} = '1812'; |
ed38f89d MT |
267 | $proxysettings{'RADIUS_IDENTIFIER'} = ''; |
268 | $proxysettings{'RADIUS_SECRET'} = ''; | |
269 | $proxysettings{'RADIUS_ENABLE_ACL'} = 'off'; | |
270 | $proxysettings{'RADIUS_USER_ACL'} = 'positive'; | |
271 | $proxysettings{'IDENT_REQUIRED'} = 'off'; | |
272 | $proxysettings{'IDENT_TIMEOUT'} = '10'; | |
273 | $proxysettings{'IDENT_ENABLE_ACL'} = 'off'; | |
274 | $proxysettings{'IDENT_USER_ACL'} = 'positive'; | |
9fb25b1c MT |
275 | $proxysettings{'ENABLE_FILTER'} = 'off'; |
276 | $proxysettings{'ENABLE_UPDXLRATOR'} = 'off'; | |
d12aede7 | 277 | $proxysettings{'ENABLE_CLAMAV'} = 'off'; |
28c9dec6 | 278 | $proxysettings{'CHILDREN'} = '10'; |
ed38f89d MT |
279 | |
280 | $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'}; | |
ac1cfefa MT |
281 | |
282 | &Header::getcgihash(\%proxysettings); | |
283 | ||
ed38f89d MT |
284 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} eq 0) {$proxysettings{'THROTTLING_GREEN_TOTAL'} = 'unlimited';} |
285 | if ($proxysettings{'THROTTLING_GREEN_HOST'} eq 0) {$proxysettings{'THROTTLING_GREEN_HOST'} = 'unlimited';} | |
286 | if ($proxysettings{'THROTTLING_BLUE_TOTAL'} eq 0) {$proxysettings{'THROTTLING_BLUE_TOTAL'} = 'unlimited';} | |
287 | if ($proxysettings{'THROTTLING_BLUE_HOST'} eq 0) {$proxysettings{'THROTTLING_BLUE_HOST'} = 'unlimited';} | |
ac1cfefa | 288 | |
ed38f89d | 289 | if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy NCSA user management'}) |
ac1cfefa | 290 | { |
ed38f89d MT |
291 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; |
292 | } | |
293 | ||
294 | if ($proxysettings{'ACTION'} eq $Lang::tr{'add'}) | |
295 | { | |
296 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; | |
297 | if (length($proxysettings{'NCSA_PASS'}) < $proxysettings{'NCSA_MIN_PASS_LEN'}) { | |
298 | $errormessage = $Lang::tr{'advproxy errmsg password length 1'}.$proxysettings{'NCSA_MIN_PASS_LEN'}.$Lang::tr{'advproxy errmsg password length 2'}; | |
299 | } | |
300 | if (!($proxysettings{'NCSA_PASS'} eq $proxysettings{'NCSA_PASS_CONFIRM'})) { | |
301 | $errormessage = $Lang::tr{'advproxy errmsg passwords different'}; | |
302 | } | |
303 | if ($proxysettings{'NCSA_USERNAME'} eq '') { | |
304 | $errormessage = $Lang::tr{'advproxy errmsg no username'}; | |
305 | } | |
306 | if (!$errormessage) { | |
307 | $proxysettings{'NCSA_USERNAME'} =~ tr/A-Z/a-z/; | |
308 | &adduser($proxysettings{'NCSA_USERNAME'}, $proxysettings{'NCSA_PASS'}, $proxysettings{'NCSA_GROUP'}); | |
309 | } | |
310 | $proxysettings{'NCSA_USERNAME'} = ''; | |
311 | $proxysettings{'NCSA_GROUP'} = ''; | |
312 | $proxysettings{'NCSA_PASS'} = ''; | |
313 | $proxysettings{'NCSA_PASS_CONFIRM'} = ''; | |
314 | } | |
ac1cfefa | 315 | |
ed38f89d MT |
316 | if ($proxysettings{'ACTION'} eq $Lang::tr{'remove'}) |
317 | { | |
318 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; | |
319 | &deluser($proxysettings{'ID'}); | |
320 | } | |
321 | ||
9fb25b1c MT |
322 | $checked{'ENABLE_UPDXLRATOR'}{'off'} = ''; |
323 | $checked{'ENABLE_UPDXLRATOR'}{'on'} = ''; | |
324 | $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'"; | |
325 | ||
ed38f89d MT |
326 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) |
327 | { | |
328 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; | |
329 | $ncsa_buttontext = $Lang::tr{'advproxy NCSA update user'}; | |
330 | @temp = split(/:/,$proxysettings{'ID'}); | |
331 | $proxysettings{'NCSA_USERNAME'} = $temp[0]; | |
332 | $proxysettings{'NCSA_GROUP'} = $temp[1]; | |
333 | $proxysettings{'NCSA_PASS'} = "lEaVeAlOnE"; | |
334 | $proxysettings{'NCSA_PASS_CONFIRM'} = $proxysettings{'NCSA_PASS'}; | |
335 | } | |
336 | ||
fe1656d2 | 337 | if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'})) |
28c9dec6 CS |
338 | { |
339 | if ($proxysettings{'ENABLE'} !~ /^(on|off)$/ || | |
340 | $proxysettings{'TRANSPARENT'} !~ /^(on|off)$/ || | |
341 | $proxysettings{'ENABLE_BLUE'} !~ /^(on|off)$/ || | |
ac1cfefa MT |
342 | $proxysettings{'TRANSPARENT_BLUE'} !~ /^(on|off)$/ ) { |
343 | $errormessage = $Lang::tr{'invalid input'}; | |
344 | goto ERROR; | |
28c9dec6 | 345 | } |
f2fdd0c1 | 346 | if (!(&General::validport($proxysettings{'PROXY_PORT'}))) |
363fb6af MT |
347 | { |
348 | $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'}; | |
349 | goto ERROR; | |
350 | } | |
ac1cfefa MT |
351 | if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) || |
352 | ($proxysettings{'CACHE_SIZE'} < 10)) | |
353 | { | |
488d1b7c CS |
354 | if (!($proxysettings{'CACHE_SIZE'} eq '0')) |
355 | { | |
356 | $errormessage = $Lang::tr{'advproxy errmsg hdd cache size'}; | |
357 | goto ERROR; | |
358 | } | |
ed38f89d | 359 | } |
fe1656d2 CS |
360 | if (!($proxysettings{'FILEDESCRIPTORS'} =~ /^\d+/) || |
361 | ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 16384)) | |
362 | { | |
363 | $errormessage = $Lang::tr{'proxy errmsg filedescriptors'}; | |
364 | goto ERROR; | |
365 | } | |
ed38f89d MT |
366 | if (!($proxysettings{'CACHE_MEM'} =~ /^\d+/) || |
367 | ($proxysettings{'CACHE_MEM'} < 1)) | |
368 | { | |
369 | $errormessage = $Lang::tr{'advproxy errmsg mem cache size'}; | |
ac1cfefa | 370 | goto ERROR; |
28c9dec6 | 371 | } |
ed38f89d MT |
372 | my @free = `/usr/bin/free`; |
373 | $free[1] =~ m/(\d+)/; | |
374 | $cachemem = int $1 / 2048; | |
375 | if ($proxysettings{'CACHE_MEM'} > $cachemem) { | |
376 | $proxysettings{'CACHE_MEM'} = $cachemem; | |
377 | } | |
ac1cfefa MT |
378 | if (!($proxysettings{'MAX_SIZE'} =~ /^\d+/)) |
379 | { | |
380 | $errormessage = $Lang::tr{'invalid maximum object size'}; | |
381 | goto ERROR; | |
382 | } | |
383 | if (!($proxysettings{'MIN_SIZE'} =~ /^\d+/)) | |
384 | { | |
385 | $errormessage = $Lang::tr{'invalid minimum object size'}; | |
386 | goto ERROR; | |
387 | } | |
388 | if (!($proxysettings{'MAX_OUTGOING_SIZE'} =~ /^\d+/)) | |
389 | { | |
390 | $errormessage = $Lang::tr{'invalid maximum outgoing size'}; | |
391 | goto ERROR; | |
392 | } | |
ed38f89d MT |
393 | if (!($proxysettings{'TIME_TO_HOUR'}.$proxysettings{'TIME_TO_MINUTE'} gt $proxysettings{'TIME_FROM_HOUR'}.$proxysettings{'TIME_FROM_MINUTE'})) |
394 | { | |
395 | $errormessage = $Lang::tr{'advproxy errmsg time restriction'}; | |
396 | goto ERROR; | |
397 | } | |
ac1cfefa MT |
398 | if (!($proxysettings{'MAX_INCOMING_SIZE'} =~ /^\d+/)) |
399 | { | |
400 | $errormessage = $Lang::tr{'invalid maximum incoming size'}; | |
401 | goto ERROR; | |
62459123 CS |
402 | } |
403 | if (!($proxysettings{'CHILDREN'} =~ /^\d+$/) || ($proxysettings{'CHILDREN'} < 1)) | |
404 | { | |
405 | $errormessage = $Lang::tr{'advproxy invalid num of children'}; | |
406 | goto ERROR; | |
ac1cfefa | 407 | } |
ed38f89d | 408 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') |
ac1cfefa | 409 | { |
ed38f89d MT |
410 | $browser_regexp = ''; |
411 | foreach (@useragentlist) | |
412 | { | |
413 | chomp; | |
414 | @useragent = split(/,/); | |
4e17adad | 415 | if ($proxysettings{'UA_'.$useragent[0]} eq 'on') { $browser_regexp .= "$useragent[2]|"; } |
ed38f89d MT |
416 | } |
417 | chop($browser_regexp); | |
418 | if (!$browser_regexp) | |
419 | { | |
420 | $errormessage = $Lang::tr{'advproxy errmsg no browser'}; | |
421 | goto ERROR; | |
422 | } | |
423 | } | |
424 | if (!($proxysettings{'AUTH_METHOD'} eq 'none')) | |
425 | { | |
363fb6af | 426 | unless (($proxysettings{'AUTH_METHOD'} eq 'ident') && |
ed38f89d MT |
427 | ($proxysettings{'IDENT_REQUIRED'} eq 'off') && |
428 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'off')) | |
429 | { | |
430 | if ($netsettings{'BLUE_DEV'}) | |
363fb6af | 431 | { |
ed38f89d MT |
432 | if ((($proxysettings{'ENABLE'} eq 'off') || ($proxysettings{'TRANSPARENT'} eq 'on')) && |
433 | (($proxysettings{'ENABLE_BLUE'} eq 'off') || ($proxysettings{'TRANSPARENT_BLUE'} eq 'on'))) | |
434 | { | |
435 | $errormessage = $Lang::tr{'advproxy errmsg non-transparent proxy required'}; | |
436 | goto ERROR; | |
437 | } | |
438 | } else { | |
439 | if (($proxysettings{'ENABLE'} eq 'off') || ($proxysettings{'TRANSPARENT'} eq 'on')) | |
440 | { | |
441 | $errormessage = $Lang::tr{'advproxy errmsg non-transparent proxy required'}; | |
442 | goto ERROR; | |
443 | } | |
444 | } | |
445 | } | |
28c9dec6 CS |
446 | if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) && |
447 | ((!($proxysettings{'AUTH_MAX_USERIP'} =~ /^\d+/)) || ($proxysettings{'AUTH_MAX_USERIP'} < 1) || ($proxysettings{'AUTH_MAX_USERIP'} > 255))) | |
ed38f89d MT |
448 | { |
449 | $errormessage = $Lang::tr{'advproxy errmsg max userip'}; | |
450 | goto ERROR; | |
451 | } | |
452 | if (!($proxysettings{'AUTH_CACHE_TTL'} =~ /^\d+/)) | |
453 | { | |
454 | $errormessage = $Lang::tr{'advproxy errmsg auth cache ttl'}; | |
455 | goto ERROR; | |
456 | } | |
457 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} =~ /^\d+/)) | |
458 | { | |
459 | $errormessage = $Lang::tr{'advproxy errmsg auth ipcache ttl'}; | |
460 | goto ERROR; | |
461 | } | |
462 | if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) && ($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) | |
463 | { | |
464 | $errormessage = $Lang::tr{'advproxy errmsg auth ipcache may not be null'}; | |
465 | goto ERROR; | |
466 | } | |
467 | if ((!($proxysettings{'AUTH_CHILDREN'} =~ /^\d+/)) || ($proxysettings{'AUTH_CHILDREN'} < 1) || ($proxysettings{'AUTH_CHILDREN'} > 255)) | |
468 | { | |
469 | $errormessage = $Lang::tr{'advproxy errmsg auth children'}; | |
470 | goto ERROR; | |
471 | } | |
472 | } | |
473 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
474 | { | |
475 | if ((!($proxysettings{'NCSA_MIN_PASS_LEN'} =~ /^\d+/)) || ($proxysettings{'NCSA_MIN_PASS_LEN'} < 1) || ($proxysettings{'NCSA_MIN_PASS_LEN'} > 255)) | |
476 | { | |
477 | $errormessage = $Lang::tr{'advproxy errmsg password length'}; | |
478 | goto ERROR; | |
479 | } | |
480 | } | |
481 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
482 | { | |
483 | if ((!($proxysettings{'IDENT_TIMEOUT'} =~ /^\d+/)) || ($proxysettings{'IDENT_TIMEOUT'} < 1)) | |
484 | { | |
485 | $errormessage = $Lang::tr{'advproxy errmsg ident timeout'}; | |
486 | goto ERROR; | |
487 | } | |
488 | } | |
489 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') | |
490 | { | |
491 | if ($proxysettings{'LDAP_BASEDN'} eq '') | |
492 | { | |
493 | $errormessage = $Lang::tr{'advproxy errmsg ldap base dn'}; | |
494 | goto ERROR; | |
495 | } | |
496 | if (!&General::validip($proxysettings{'LDAP_SERVER'})) | |
497 | { | |
498 | $errormessage = $Lang::tr{'advproxy errmsg ldap server'}; | |
499 | goto ERROR; | |
500 | } | |
501 | if (!&General::validport($proxysettings{'LDAP_PORT'})) | |
502 | { | |
503 | $errormessage = $Lang::tr{'advproxy errmsg ldap port'}; | |
504 | goto ERROR; | |
505 | } | |
506 | if (($proxysettings{'LDAP_TYPE'} eq 'ADS') || ($proxysettings{'LDAP_TYPE'} eq 'NDS')) | |
507 | { | |
508 | if (($proxysettings{'LDAP_BINDDN_USER'} eq '') || ($proxysettings{'LDAP_BINDDN_PASS'} eq '')) | |
509 | { | |
510 | $errormessage = $Lang::tr{'advproxy errmsg ldap bind dn'}; | |
511 | goto ERROR; | |
512 | } | |
513 | } | |
514 | } | |
515 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') | |
516 | { | |
517 | if ($proxysettings{'NTLM_DOMAIN'} eq '') | |
518 | { | |
519 | $errormessage = $Lang::tr{'advproxy errmsg ntlm domain'}; | |
520 | goto ERROR; | |
521 | } | |
522 | if ($proxysettings{'NTLM_PDC'} eq '') | |
523 | { | |
524 | $errormessage = $Lang::tr{'advproxy errmsg ntlm pdc'}; | |
525 | goto ERROR; | |
526 | } | |
527 | if (!&General::validhostname($proxysettings{'NTLM_PDC'})) | |
528 | { | |
529 | $errormessage = $Lang::tr{'advproxy errmsg invalid pdc'}; | |
530 | goto ERROR; | |
531 | } | |
532 | if ((!($proxysettings{'NTLM_BDC'} eq '')) && (!&General::validhostname($proxysettings{'NTLM_BDC'}))) | |
533 | { | |
534 | $errormessage = $Lang::tr{'advproxy errmsg invalid bdc'}; | |
535 | goto ERROR; | |
536 | } | |
488d1b7c CS |
537 | |
538 | $proxysettings{'NTLM_DOMAIN'} = lc($proxysettings{'NTLM_DOMAIN'}); | |
539 | $proxysettings{'NTLM_PDC'} = lc($proxysettings{'NTLM_PDC'}); | |
540 | $proxysettings{'NTLM_BDC'} = lc($proxysettings{'NTLM_BDC'}); | |
ed38f89d MT |
541 | } |
542 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') | |
543 | { | |
544 | if (!&General::validip($proxysettings{'RADIUS_SERVER'})) | |
545 | { | |
546 | $errormessage = $Lang::tr{'advproxy errmsg radius server'}; | |
547 | goto ERROR; | |
548 | } | |
549 | if (!&General::validport($proxysettings{'RADIUS_PORT'})) | |
550 | { | |
551 | $errormessage = $Lang::tr{'advproxy errmsg radius port'}; | |
552 | goto ERROR; | |
553 | } | |
554 | if ($proxysettings{'RADIUS_SECRET'} eq '') | |
555 | { | |
556 | $errormessage = $Lang::tr{'advproxy errmsg radius secret'}; | |
557 | goto ERROR; | |
558 | } | |
ac1cfefa MT |
559 | } |
560 | ||
363fb6af MT |
561 | # Quick parent proxy error checking of username and password info. If username password don't both exist give an error. |
562 | $proxy1 = 'YES'; | |
563 | $proxy2 = 'YES'; | |
564 | if (($proxysettings{'UPSTREAM_USER'} eq '')) {$proxy1 = '';} | |
565 | if (($proxysettings{'UPSTREAM_PASSWORD'} eq '')) {$proxy2 = '';} | |
566 | if ($proxysettings{'UPSTREAM_USER'} eq 'PASS') {$proxy1=$proxy2='PASS'; $proxysettings{'UPSTREAM_PASSWORD'} = '';} | |
567 | if (($proxy1 ne $proxy2)) | |
568 | { | |
569 | $errormessage = $Lang::tr{'advproxy errmsg invalid upstream proxy username or password setting'}; | |
570 | goto ERROR; | |
571 | } | |
ac1cfefa | 572 | |
ed38f89d MT |
573 | ERROR: |
574 | &check_acls; | |
ac1cfefa | 575 | |
ed38f89d MT |
576 | if ($errormessage) { |
577 | $proxysettings{'VALID'} = 'no'; } | |
578 | else { | |
363fb6af | 579 | $proxysettings{'VALID'} = 'yes'; } |
ac1cfefa | 580 | |
ed38f89d | 581 | if ($proxysettings{'VALID'} eq 'yes') |
ac1cfefa | 582 | { |
ed38f89d | 583 | &write_acls; |
ac1cfefa | 584 | |
ed38f89d MT |
585 | delete $proxysettings{'SRC_SUBNETS'}; |
586 | delete $proxysettings{'SRC_BANNED_IP'}; | |
587 | delete $proxysettings{'SRC_BANNED_MAC'}; | |
588 | delete $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
589 | delete $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
590 | delete $proxysettings{'DST_NOCACHE'}; | |
591 | delete $proxysettings{'DST_NOAUTH'}; | |
363fb6af MT |
592 | delete $proxysettings{'PORTS_SAFE'}; |
593 | delete $proxysettings{'PORTS_SSL'}; | |
ed38f89d MT |
594 | delete $proxysettings{'MIME_TYPES'}; |
595 | delete $proxysettings{'NTLM_ALLOW_USERS'}; | |
596 | delete $proxysettings{'NTLM_DENY_USERS'}; | |
597 | delete $proxysettings{'RADIUS_ALLOW_USERS'}; | |
598 | delete $proxysettings{'RADIUS_DENY_USERS'}; | |
599 | delete $proxysettings{'IDENT_HOSTS'}; | |
600 | delete $proxysettings{'IDENT_ALLOW_USERS'}; | |
601 | delete $proxysettings{'IDENT_DENY_USERS'}; | |
ac1cfefa | 602 | |
ed38f89d MT |
603 | delete $proxysettings{'CRE_GROUPS'}; |
604 | delete $proxysettings{'CRE_SVHOSTS'}; | |
ac1cfefa | 605 | |
ed38f89d MT |
606 | delete $proxysettings{'NCSA_USERNAME'}; |
607 | delete $proxysettings{'NCSA_GROUP'}; | |
608 | delete $proxysettings{'NCSA_PASS'}; | |
609 | delete $proxysettings{'NCSA_PASS_CONFIRM'}; | |
ac1cfefa | 610 | |
ed38f89d MT |
611 | $proxysettings{'TIME_MON'} = 'off' unless exists $proxysettings{'TIME_MON'}; |
612 | $proxysettings{'TIME_TUE'} = 'off' unless exists $proxysettings{'TIME_TUE'}; | |
613 | $proxysettings{'TIME_WED'} = 'off' unless exists $proxysettings{'TIME_WED'}; | |
614 | $proxysettings{'TIME_THU'} = 'off' unless exists $proxysettings{'TIME_THU'}; | |
615 | $proxysettings{'TIME_FRI'} = 'off' unless exists $proxysettings{'TIME_FRI'}; | |
616 | $proxysettings{'TIME_SAT'} = 'off' unless exists $proxysettings{'TIME_SAT'}; | |
617 | $proxysettings{'TIME_SUN'} = 'off' unless exists $proxysettings{'TIME_SUN'}; | |
ac1cfefa | 618 | |
ed38f89d MT |
619 | $proxysettings{'AUTH_ALWAYS_REQUIRED'} = 'off' unless exists $proxysettings{'AUTH_ALWAYS_REQUIRED'}; |
620 | $proxysettings{'NTLM_ENABLE_INT_AUTH'} = 'off' unless exists $proxysettings{'NTLM_ENABLE_INT_AUTH'}; | |
ac1cfefa | 621 | |
ed38f89d | 622 | &General::writehash("${General::swroot}/proxy/advanced/settings", \%proxysettings); |
ac1cfefa | 623 | |
363fb6af MT |
624 | if (-e "${General::swroot}/proxy/settings") { &General::readhash("${General::swroot}/proxy/settings", \%stdproxysettings); } |
625 | $stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'}; | |
488d1b7c CS |
626 | $stdproxysettings{'UPSTREAM_PROXY'} = $proxysettings{'UPSTREAM_PROXY'}; |
627 | $stdproxysettings{'UPSTREAM_USER'} = $proxysettings{'UPSTREAM_USER'}; | |
628 | $stdproxysettings{'UPSTREAM_PASSWORD'} = $proxysettings{'UPSTREAM_PASSWORD'}; | |
9fb25b1c MT |
629 | $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'}; |
630 | $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'}; | |
d12aede7 | 631 | $stdproxysettings{'ENABLE_CLAMAV'} = $proxysettings{'ENABLE_CLAMAV'}; |
363fb6af | 632 | &General::writehash("${General::swroot}/proxy/settings", \%stdproxysettings); |
ac1cfefa | 633 | |
ed38f89d MT |
634 | &writeconfig; |
635 | &writepacfile; | |
636 | ||
fe1656d2 CS |
637 | if ($proxysettings{'CACHEMGR'} eq 'on'){&writecachemgr;} |
638 | ||
d56fc335 | 639 | system ('/usr/local/bin/squidctrl', 'disable'); |
ed38f89d MT |
640 | unlink "${General::swroot}/proxy/enable"; |
641 | unlink "${General::swroot}/proxy/transparent"; | |
642 | unlink "${General::swroot}/proxy/enable_blue"; | |
643 | unlink "${General::swroot}/proxy/transparent_blue"; | |
ac1cfefa | 644 | |
ac1cfefa | 645 | if ($proxysettings{'ENABLE'} eq 'on') { |
d56fc335 MT |
646 | system ('/usr/bin/touch', "${General::swroot}/proxy/enable"); |
647 | system ('/usr/local/bin/squidctrl', 'enable'); } | |
6c689591 | 648 | if ($proxysettings{'TRANSPARENT'} eq 'on' && $proxysettings{'ENABLE'} eq 'on') { |
9833e7d8 | 649 | system ('/usr/bin/touch', "${General::swroot}/proxy/transparent"); } |
ac1cfefa | 650 | if ($proxysettings{'ENABLE_BLUE'} eq 'on') { |
d56fc335 MT |
651 | system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue"); |
652 | system ('/usr/local/bin/squidctrl', 'enable'); } | |
6c689591 | 653 | if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on' && $proxysettings{'ENABLE_BLUE'} eq 'on') { |
9833e7d8 | 654 | system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); } |
ed38f89d | 655 | |
d56fc335 | 656 | if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/squidctrl restart >/dev/null 2>&1'); } |
fe1656d2 CS |
657 | if ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'}) { system('/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1'); } |
658 | } | |
ac1cfefa MT |
659 | } |
660 | ||
363fb6af | 661 | if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy clear cache'}) |
ac1cfefa | 662 | { |
d56fc335 | 663 | system('/usr/local/bin/squidctrl flush >/dev/null 2>&1'); |
ac1cfefa MT |
664 | } |
665 | ||
ed38f89d MT |
666 | if (!$errormessage) |
667 | { | |
668 | if (-e "${General::swroot}/proxy/advanced/settings") { | |
669 | &General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings); | |
670 | } elsif (-e "${General::swroot}/proxy/settings") { | |
671 | &General::readhash("${General::swroot}/proxy/settings", \%proxysettings); | |
672 | } | |
673 | &read_acls; | |
674 | } | |
ac1cfefa MT |
675 | |
676 | $checked{'ENABLE'}{'off'} = ''; | |
677 | $checked{'ENABLE'}{'on'} = ''; | |
678 | $checked{'ENABLE'}{$proxysettings{'ENABLE'}} = "checked='checked'"; | |
679 | ||
680 | $checked{'TRANSPARENT'}{'off'} = ''; | |
681 | $checked{'TRANSPARENT'}{'on'} = ''; | |
682 | $checked{'TRANSPARENT'}{$proxysettings{'TRANSPARENT'}} = "checked='checked'"; | |
683 | ||
684 | $checked{'ENABLE_BLUE'}{'off'} = ''; | |
685 | $checked{'ENABLE_BLUE'}{'on'} = ''; | |
686 | $checked{'ENABLE_BLUE'}{$proxysettings{'ENABLE_BLUE'}} = "checked='checked'"; | |
687 | ||
688 | $checked{'TRANSPARENT_BLUE'}{'off'} = ''; | |
689 | $checked{'TRANSPARENT_BLUE'}{'on'} = ''; | |
690 | $checked{'TRANSPARENT_BLUE'}{$proxysettings{'TRANSPARENT_BLUE'}} = "checked='checked'"; | |
691 | ||
363fb6af MT |
692 | $checked{'SUPPRESS_VERSION'}{'off'} = ''; |
693 | $checked{'SUPPRESS_VERSION'}{'on'} = ''; | |
694 | $checked{'SUPPRESS_VERSION'}{$proxysettings{'SUPPRESS_VERSION'}} = "checked='checked'"; | |
695 | ||
ed38f89d MT |
696 | $checked{'FORWARD_IPADDRESS'}{'off'} = ''; |
697 | $checked{'FORWARD_IPADDRESS'}{'on'} = ''; | |
698 | $checked{'FORWARD_IPADDRESS'}{$proxysettings{'FORWARD_IPADDRESS'}} = "checked='checked'"; | |
699 | $checked{'FORWARD_USERNAME'}{'off'} = ''; | |
700 | $checked{'FORWARD_USERNAME'}{'on'} = ''; | |
701 | $checked{'FORWARD_USERNAME'}{$proxysettings{'FORWARD_USERNAME'}} = "checked='checked'"; | |
702 | $checked{'FORWARD_VIA'}{'off'} = ''; | |
703 | $checked{'FORWARD_VIA'}{'on'} = ''; | |
704 | $checked{'FORWARD_VIA'}{$proxysettings{'FORWARD_VIA'}} = "checked='checked'"; | |
363fb6af MT |
705 | $checked{'NO_CONNECTION_AUTH'}{'off'} = ''; |
706 | $checked{'NO_CONNECTION_AUTH'}{'on'} = ''; | |
707 | $checked{'NO_CONNECTION_AUTH'}{$proxysettings{'NO_CONNECTION_AUTH'}} = "checked='checked'"; | |
ed38f89d MT |
708 | |
709 | $selected{'MEM_POLICY'}{$proxysettings{'MEM_POLICY'}} = "selected='selected'"; | |
710 | $selected{'CACHE_POLICY'}{$proxysettings{'CACHE_POLICY'}} = "selected='selected'"; | |
711 | $selected{'L1_DIRS'}{$proxysettings{'L1_DIRS'}} = "selected='selected'"; | |
712 | $checked{'OFFLINE_MODE'}{'off'} = ''; | |
713 | $checked{'OFFLINE_MODE'}{'on'} = ''; | |
714 | $checked{'OFFLINE_MODE'}{$proxysettings{'OFFLINE_MODE'}} = "checked='checked'"; | |
715 | ||
ac1cfefa MT |
716 | $checked{'LOGGING'}{'off'} = ''; |
717 | $checked{'LOGGING'}{'on'} = ''; | |
718 | $checked{'LOGGING'}{$proxysettings{'LOGGING'}} = "checked='checked'"; | |
fe1656d2 CS |
719 | $checked{'CACHEMGR'}{'off'} = ''; |
720 | $checked{'CACHEMGR'}{'on'} = ''; | |
721 | $checked{'CACHEMGR'}{$proxysettings{'CACHEMGR'}} = "checked='checked'"; | |
ed38f89d MT |
722 | $checked{'LOGQUERY'}{'off'} = ''; |
723 | $checked{'LOGQUERY'}{'on'} = ''; | |
724 | $checked{'LOGQUERY'}{$proxysettings{'LOGQUERY'}} = "checked='checked'"; | |
725 | $checked{'LOGUSERAGENT'}{'off'} = ''; | |
726 | $checked{'LOGUSERAGENT'}{'on'} = ''; | |
727 | $checked{'LOGUSERAGENT'}{$proxysettings{'LOGUSERAGENT'}} = "checked='checked'"; | |
728 | ||
729 | $selected{'ERR_LANGUAGE'}{$proxysettings{'ERR_LANGUAGE'}} = "selected='selected'"; | |
363fb6af | 730 | $selected{'ERR_DESIGN'}{$proxysettings{'ERR_DESIGN'}} = "selected='selected'"; |
ed38f89d | 731 | |
9fb25b1c MT |
732 | $checked{'NO_PROXY_LOCAL'}{'off'} = ''; |
733 | $checked{'NO_PROXY_LOCAL'}{'on'} = ''; | |
734 | $checked{'NO_PROXY_LOCAL'}{$proxysettings{'NO_PROXY_LOCAL'}} = "checked='checked'"; | |
735 | $checked{'NO_PROXY_LOCAL_BLUE'}{'off'} = ''; | |
736 | $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} = ''; | |
737 | $checked{'NO_PROXY_LOCAL_BLUE'}{$proxysettings{'NO_PROXY_LOCAL_BLUE'}} = "checked='checked'"; | |
738 | ||
ed38f89d MT |
739 | $checked{'CLASSROOM_EXT'}{'off'} = ''; |
740 | $checked{'CLASSROOM_EXT'}{'on'} = ''; | |
741 | $checked{'CLASSROOM_EXT'}{$proxysettings{'CLASSROOM_EXT'}} = "checked='checked'"; | |
742 | ||
743 | $selected{'TIME_ACCESS_MODE'}{$proxysettings{'TIME_ACCESS_MODE'}} = "selected='selected'"; | |
744 | $selected{'TIME_FROM_HOUR'}{$proxysettings{'TIME_FROM_HOUR'}} = "selected='selected'"; | |
745 | $selected{'TIME_FROM_MINUTE'}{$proxysettings{'TIME_FROM_MINUTE'}} = "selected='selected'"; | |
746 | $selected{'TIME_TO_HOUR'}{$proxysettings{'TIME_TO_HOUR'}} = "selected='selected'"; | |
747 | $selected{'TIME_TO_MINUTE'}{$proxysettings{'TIME_TO_MINUTE'}} = "selected='selected'"; | |
748 | ||
749 | $proxysettings{'TIME_MON'} = 'on' unless exists $proxysettings{'TIME_MON'}; | |
750 | $proxysettings{'TIME_TUE'} = 'on' unless exists $proxysettings{'TIME_TUE'}; | |
751 | $proxysettings{'TIME_WED'} = 'on' unless exists $proxysettings{'TIME_WED'}; | |
752 | $proxysettings{'TIME_THU'} = 'on' unless exists $proxysettings{'TIME_THU'}; | |
753 | $proxysettings{'TIME_FRI'} = 'on' unless exists $proxysettings{'TIME_FRI'}; | |
754 | $proxysettings{'TIME_SAT'} = 'on' unless exists $proxysettings{'TIME_SAT'}; | |
755 | $proxysettings{'TIME_SUN'} = 'on' unless exists $proxysettings{'TIME_SUN'}; | |
756 | ||
757 | $checked{'TIME_MON'}{'off'} = ''; | |
758 | $checked{'TIME_MON'}{'on'} = ''; | |
759 | $checked{'TIME_MON'}{$proxysettings{'TIME_MON'}} = "checked='checked'"; | |
760 | $checked{'TIME_TUE'}{'off'} = ''; | |
761 | $checked{'TIME_TUE'}{'on'} = ''; | |
762 | $checked{'TIME_TUE'}{$proxysettings{'TIME_TUE'}} = "checked='checked'"; | |
763 | $checked{'TIME_WED'}{'off'} = ''; | |
764 | $checked{'TIME_WED'}{'on'} = ''; | |
765 | $checked{'TIME_WED'}{$proxysettings{'TIME_WED'}} = "checked='checked'"; | |
766 | $checked{'TIME_THU'}{'off'} = ''; | |
767 | $checked{'TIME_THU'}{'on'} = ''; | |
768 | $checked{'TIME_THU'}{$proxysettings{'TIME_THU'}} = "checked='checked'"; | |
769 | $checked{'TIME_FRI'}{'off'} = ''; | |
770 | $checked{'TIME_FRI'}{'on'} = ''; | |
771 | $checked{'TIME_FRI'}{$proxysettings{'TIME_FRI'}} = "checked='checked'"; | |
772 | $checked{'TIME_SAT'}{'off'} = ''; | |
773 | $checked{'TIME_SAT'}{'on'} = ''; | |
774 | $checked{'TIME_SAT'}{$proxysettings{'TIME_SAT'}} = "checked='checked'"; | |
775 | $checked{'TIME_SUN'}{'off'} = ''; | |
776 | $checked{'TIME_SUN'}{'on'} = ''; | |
777 | $checked{'TIME_SUN'}{$proxysettings{'TIME_SUN'}} = "checked='checked'"; | |
778 | ||
779 | $selected{'THROTTLING_GREEN_TOTAL'}{$proxysettings{'THROTTLING_GREEN_TOTAL'}} = "selected='selected'"; | |
780 | $selected{'THROTTLING_GREEN_HOST'}{$proxysettings{'THROTTLING_GREEN_HOST'}} = "selected='selected'"; | |
781 | $selected{'THROTTLING_BLUE_TOTAL'}{$proxysettings{'THROTTLING_BLUE_TOTAL'}} = "selected='selected'"; | |
782 | $selected{'THROTTLING_BLUE_HOST'}{$proxysettings{'THROTTLING_BLUE_HOST'}} = "selected='selected'"; | |
783 | ||
784 | $checked{'THROTTLE_BINARY'}{'off'} = ''; | |
785 | $checked{'THROTTLE_BINARY'}{'on'} = ''; | |
786 | $checked{'THROTTLE_BINARY'}{$proxysettings{'THROTTLE_BINARY'}} = "checked='checked'"; | |
787 | $checked{'THROTTLE_DSKIMG'}{'off'} = ''; | |
788 | $checked{'THROTTLE_DSKIMG'}{'on'} = ''; | |
789 | $checked{'THROTTLE_DSKIMG'}{$proxysettings{'THROTTLE_DSKIMG'}} = "checked='checked'"; | |
790 | $checked{'THROTTLE_MMEDIA'}{'off'} = ''; | |
791 | $checked{'THROTTLE_MMEDIA'}{'on'} = ''; | |
792 | $checked{'THROTTLE_MMEDIA'}{$proxysettings{'THROTTLE_MMEDIA'}} = "checked='checked'"; | |
793 | ||
794 | $checked{'ENABLE_MIME_FILTER'}{'off'} = ''; | |
795 | $checked{'ENABLE_MIME_FILTER'}{'on'} = ''; | |
796 | $checked{'ENABLE_MIME_FILTER'}{$proxysettings{'ENABLE_MIME_FILTER'}} = "checked='checked'"; | |
797 | ||
798 | $checked{'ENABLE_BROWSER_CHECK'}{'off'} = ''; | |
799 | $checked{'ENABLE_BROWSER_CHECK'}{'on'} = ''; | |
800 | $checked{'ENABLE_BROWSER_CHECK'}{$proxysettings{'ENABLE_BROWSER_CHECK'}} = "checked='checked'"; | |
801 | ||
802 | foreach (@useragentlist) { | |
803 | @useragent = split(/,/); | |
4e17adad CS |
804 | $checked{'UA_'.$useragent[0]}{'off'} = ''; |
805 | $checked{'UA_'.$useragent[0]}{'on'} = ''; | |
806 | $checked{'UA_'.$useragent[0]}{$proxysettings{'UA_'.$useragent[0]}} = "checked='checked'"; | |
ed38f89d MT |
807 | } |
808 | ||
809 | $checked{'AUTH_METHOD'}{'none'} = ''; | |
810 | $checked{'AUTH_METHOD'}{'ncsa'} = ''; | |
811 | $checked{'AUTH_METHOD'}{'ident'} = ''; | |
812 | $checked{'AUTH_METHOD'}{'ldap'} = ''; | |
813 | $checked{'AUTH_METHOD'}{'ntlm'} = ''; | |
814 | $checked{'AUTH_METHOD'}{'radius'} = ''; | |
815 | $checked{'AUTH_METHOD'}{$proxysettings{'AUTH_METHOD'}} = "checked='checked'"; | |
ac1cfefa | 816 | |
ed38f89d MT |
817 | $proxysettings{'AUTH_ALWAYS_REQUIRED'} = 'on' unless exists $proxysettings{'AUTH_ALWAYS_REQUIRED'}; |
818 | ||
819 | $checked{'AUTH_ALWAYS_REQUIRED'}{'off'} = ''; | |
820 | $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} = ''; | |
821 | $checked{'AUTH_ALWAYS_REQUIRED'}{$proxysettings{'AUTH_ALWAYS_REQUIRED'}} = "checked='checked'"; | |
822 | ||
823 | $checked{'NCSA_BYPASS_REDIR'}{'off'} = ''; | |
824 | $checked{'NCSA_BYPASS_REDIR'}{'on'} = ''; | |
825 | $checked{'NCSA_BYPASS_REDIR'}{$proxysettings{'NCSA_BYPASS_REDIR'}} = "checked='checked'"; | |
826 | ||
827 | $selected{'NCSA_GROUP'}{$proxysettings{'NCSA_GROUP'}} = "selected='selected'"; | |
828 | ||
829 | $selected{'LDAP_TYPE'}{$proxysettings{'LDAP_TYPE'}} = "selected='selected'"; | |
830 | ||
831 | $proxysettings{'NTLM_ENABLE_INT_AUTH'} = 'on' unless exists $proxysettings{'NTLM_ENABLE_INT_AUTH'}; | |
832 | ||
833 | $checked{'NTLM_ENABLE_INT_AUTH'}{'off'} = ''; | |
834 | $checked{'NTLM_ENABLE_INT_AUTH'}{'on'} = ''; | |
835 | $checked{'NTLM_ENABLE_INT_AUTH'}{$proxysettings{'NTLM_ENABLE_INT_AUTH'}} = "checked='checked'"; | |
836 | ||
837 | $checked{'NTLM_ENABLE_ACL'}{'off'} = ''; | |
838 | $checked{'NTLM_ENABLE_ACL'}{'on'} = ''; | |
839 | $checked{'NTLM_ENABLE_ACL'}{$proxysettings{'NTLM_ENABLE_ACL'}} = "checked='checked'"; | |
840 | ||
841 | $checked{'NTLM_USER_ACL'}{'positive'} = ''; | |
842 | $checked{'NTLM_USER_ACL'}{'negative'} = ''; | |
843 | $checked{'NTLM_USER_ACL'}{$proxysettings{'NTLM_USER_ACL'}} = "checked='checked'"; | |
844 | ||
845 | $checked{'RADIUS_ENABLE_ACL'}{'off'} = ''; | |
846 | $checked{'RADIUS_ENABLE_ACL'}{'on'} = ''; | |
847 | $checked{'RADIUS_ENABLE_ACL'}{$proxysettings{'RADIUS_ENABLE_ACL'}} = "checked='checked'"; | |
848 | ||
849 | $checked{'RADIUS_USER_ACL'}{'positive'} = ''; | |
850 | $checked{'RADIUS_USER_ACL'}{'negative'} = ''; | |
851 | $checked{'RADIUS_USER_ACL'}{$proxysettings{'RADIUS_USER_ACL'}} = "checked='checked'"; | |
852 | ||
853 | $checked{'IDENT_REQUIRED'}{'off'} = ''; | |
854 | $checked{'IDENT_REQUIRED'}{'on'} = ''; | |
855 | $checked{'IDENT_REQUIRED'}{$proxysettings{'IDENT_REQUIRED'}} = "checked='checked'"; | |
856 | ||
857 | $checked{'IDENT_ENABLE_ACL'}{'off'} = ''; | |
858 | $checked{'IDENT_ENABLE_ACL'}{'on'} = ''; | |
859 | $checked{'IDENT_ENABLE_ACL'}{$proxysettings{'IDENT_ENABLE_ACL'}} = "checked='checked'"; | |
860 | ||
861 | $checked{'IDENT_USER_ACL'}{'positive'} = ''; | |
862 | $checked{'IDENT_USER_ACL'}{'negative'} = ''; | |
863 | $checked{'IDENT_USER_ACL'}{$proxysettings{'IDENT_USER_ACL'}} = "checked='checked'"; | |
864 | ||
9fb25b1c MT |
865 | $checked{'ENABLE_FILTER'}{'off'} = ''; |
866 | $checked{'ENABLE_FILTER'}{'on'} = ''; | |
867 | $checked{'ENABLE_FILTER'}{$proxysettings{'ENABLE_FILTER'}} = "checked='checked'"; | |
ed38f89d | 868 | |
9fb25b1c MT |
869 | $checked{'ENABLE_UPDXLRATOR'}{'off'} = ''; |
870 | $checked{'ENABLE_UPDXLRATOR'}{'on'} = ''; | |
871 | $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'"; | |
ed38f89d | 872 | |
d12aede7 CS |
873 | $checked{'ENABLE_CLAMAV'}{'off'} = ''; |
874 | $checked{'ENABLE_CLAMAV'}{'on'} = ''; | |
875 | $checked{'ENABLE_CLAMAV'}{$proxysettings{'ENABLE_CLAMAV'}} = "checked='checked'"; | |
876 | ||
ed38f89d | 877 | &Header::openpage($Lang::tr{'advproxy advanced web proxy configuration'}, 1, ''); |
ac1cfefa MT |
878 | |
879 | &Header::openbigbox('100%', 'left', '', $errormessage); | |
880 | ||
881 | if ($errormessage) { | |
882 | &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); | |
883 | print "<font class='base'>$errormessage </font>\n"; | |
884 | &Header::closebox(); | |
885 | } | |
886 | ||
363fb6af MT |
887 | if ($squidversion[0] =~ /^Squid\sCache:\sVersion\s/i) |
888 | { | |
889 | $squidversion[0] =~ s/^Squid\sCache:\sVersion//i; | |
890 | $squidversion[0] =~ s/^\s+//g; | |
891 | $squidversion[0] =~ s/\s+$//g; | |
892 | } else { | |
893 | $squidversion[0] = $Lang::tr{'advproxy unknown'}; | |
894 | } | |
895 | ||
ed38f89d MT |
896 | # =================================================================== |
897 | # Main settings | |
898 | # =================================================================== | |
899 | ||
900 | unless ($proxysettings{'NCSA_EDIT_MODE'} eq 'yes') { | |
901 | ||
ac1cfefa MT |
902 | print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n"; |
903 | ||
ed38f89d MT |
904 | &Header::openbox('100%', 'left', "$Lang::tr{'advproxy advanced web proxy'}"); |
905 | ||
ac1cfefa MT |
906 | print <<END |
907 | <table width='100%'> | |
908 | <tr> | |
ed38f89d MT |
909 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy common settings'}</b></td> |
910 | </tr> | |
911 | <tr> | |
912 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled on'} <font color="$Header::colourgreen">Green</font>:</td> | |
913 | <td width='20%'><input type='checkbox' name='ENABLE' $checked{'ENABLE'}{'on'} /></td> | |
914 | <td width='25%' class='base'>$Lang::tr{'advproxy proxy port'}:</td> | |
915 | <td width='30%'><input type='text' name='PROXY_PORT' value='$proxysettings{'PROXY_PORT'}' size='5' /></td> | |
ac1cfefa MT |
916 | </tr> |
917 | <tr> | |
ed38f89d | 918 | <td class='base'>$Lang::tr{'advproxy transparent on'} <font color="$Header::colourgreen">Green</font>:</td> |
ac1cfefa | 919 | <td><input type='checkbox' name='TRANSPARENT' $checked{'TRANSPARENT'}{'on'} /></td> |
ed38f89d MT |
920 | <td class='base'>$Lang::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td> |
921 | <td><input type='text' name='VISIBLE_HOSTNAME' value='$proxysettings{'VISIBLE_HOSTNAME'}' /></td> | |
ac1cfefa MT |
922 | </tr> |
923 | <tr> | |
924 | END | |
925 | ; | |
926 | if ($netsettings{'BLUE_DEV'}) { | |
ed38f89d | 927 | print "<td class='base'>$Lang::tr{'advproxy enabled on'} <font color='$Header::colourblue'>Blue</font>:</td>"; |
ac1cfefa MT |
928 | print "<td><input type='checkbox' name='ENABLE_BLUE' $checked{'ENABLE_BLUE'}{'on'} /></td>"; |
929 | } else { | |
930 | print "<td colspan='2'> </td>"; | |
931 | } | |
932 | print <<END | |
fe1656d2 | 933 | <td colspan='2'> </td> |
ac1cfefa MT |
934 | </tr> |
935 | <tr> | |
936 | END | |
937 | ; | |
938 | if ($netsettings{'BLUE_DEV'}) { | |
ed38f89d | 939 | print "<td class='base'>$Lang::tr{'advproxy transparent on'} <font color='$Header::colourblue'>Blue</font>:</td>"; |
ac1cfefa MT |
940 | print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked{'TRANSPARENT_BLUE'}{'on'} /></td>"; |
941 | } else { | |
942 | print "<td colspan='2'> </td>"; | |
943 | } | |
944 | print <<END | |
ed38f89d MT |
945 | <td class='base'>$Lang::tr{'advproxy error language'}:</td> |
946 | <td class='base'> | |
947 | <select name='ERR_LANGUAGE'> | |
948 | END | |
949 | ; | |
363fb6af | 950 | foreach (<$errordir/*>) { |
ed38f89d MT |
951 | if (-d) { |
952 | $language = substr($_,rindex($_,"/")+1); | |
953 | print "<option value='$language' $selected{'ERR_LANGUAGE'}{$language}>$language</option>\n"; | |
954 | } | |
955 | } | |
956 | print <<END | |
957 | </select> | |
958 | </td> | |
959 | </tr> | |
10e4f239 | 960 | <tr> |
363fb6af MT |
961 | <td class='base'>$Lang::tr{'advproxy suppress version'}:</td> |
962 | <td><input type='checkbox' name='SUPPRESS_VERSION' $checked{'SUPPRESS_VERSION'}{'on'} /></td> | |
963 | <td class='base'>$Lang::tr{'advproxy error design'}:</td> | |
964 | <td class='base'><select name='ERR_DESIGN'> | |
0d948999 | 965 | <option value='ipfire' $selected{'ERR_DESIGN'}{'ipfire'}>IPFire</option> |
363fb6af MT |
966 | <option value='squid' $selected{'ERR_DESIGN'}{'squid'}>$Lang::tr{'advproxy standard'}</option> |
967 | </select></td> | |
10e4f239 MT |
968 | </tr> |
969 | <tr> | |
363fb6af MT |
970 | <td class='base'>$Lang::tr{'advproxy squid version'}:</td> |
971 | <td class='base'> [<font color='$Header::colourred'> $squidversion[0] </font>]</td> | |
972 | <td> </td> | |
973 | <td> </td> | |
10e4f239 | 974 | </tr> |
ed38f89d MT |
975 | </table> |
976 | <hr size='1'> | |
977 | <table width='100%'> | |
01212e04 CS |
978 | <tr><td class='base' colspan='4'><b>$Lang::tr{'advproxy redirector children'}</b></td></tr> |
979 | <tr><td class='base' >$Lang::tr{'processes'}<input type='text' name='CHILDREN' value='$proxysettings{'CHILDREN'}' size='5' /></td> | |
d12aede7 CS |
980 | END |
981 | ; | |
01212e04 CS |
982 | my $count = `arp -a | wc -l`; |
983 | if ( $count < 1 ){$count = 1;} | |
d12aede7 | 984 | if ( -e "/usr/bin/squidclamav" ) { |
01212e04 CS |
985 | print "<td class='base'><b>".$Lang::tr{'advproxy squidclamav'}."</b><br />"; |
986 | print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'}." /><br />"; | |
28c9dec6 | 987 | print "+ ".int(( $count**(1/3)) * 8); |
01212e04 CS |
988 | print "</td>"; |
989 | } else { | |
990 | print "<td></td>"; | |
d12aede7 | 991 | } |
01212e04 CS |
992 | print "<td class='base'><b>".$Lang::tr{'advproxy url filter'}."</b><br />"; |
993 | print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'}." /><br />"; | |
28c9dec6 | 994 | print "+ ".int(($count**(1/3)) * 6); |
01212e04 CS |
995 | print "</td>"; |
996 | print "<td class='base'><b>".$Lang::tr{'advproxy update accelerator'}."</b><br />"; | |
997 | print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'}." /><br />"; | |
28c9dec6 | 998 | print "+ ".int(($count**(1/3)) * 5); |
01212e04 | 999 | print "</td></tr>"; |
d12aede7 | 1000 | print <<END |
9141bd34 CS |
1001 | </table> |
1002 | <hr size='1'> | |
1003 | <table width='100%'> | |
ed38f89d MT |
1004 | <tr> |
1005 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy upstream proxy'}</b></td> | |
1006 | </tr> | |
1007 | <tr> | |
488d1b7c CS |
1008 | <td width='25%' class='base'>$Lang::tr{'advproxy via forwarding'}:</td> |
1009 | <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td> | |
1010 | <td width='25%' class='base'>$Lang::tr{'advproxy upstream proxy host:port'} <img src='/blob.gif' alt='*' /></td> | |
1011 | <td width='30%'><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td> | |
ed38f89d MT |
1012 | </tr> |
1013 | <tr> | |
488d1b7c CS |
1014 | <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td> |
1015 | <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td> | |
1016 | <td class='base'>$Lang::tr{'advproxy upstream username'}: <img src='/blob.gif' alt='*' /></td> | |
1017 | <td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td> | |
ac1cfefa | 1018 | </tr> |
ac1cfefa | 1019 | <tr> |
488d1b7c CS |
1020 | <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td> |
1021 | <td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} /></td> | |
1022 | <td class='base'>$Lang::tr{'advproxy upstream password'}: <img src='/blob.gif' alt='*' /></td> | |
1023 | <td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td> | |
ed38f89d | 1024 | </tr> |
363fb6af | 1025 | <tr> |
488d1b7c CS |
1026 | <td class='base'>$Lang::tr{'advproxy no connection auth'}:</td> |
1027 | <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td> | |
1028 | <td> </td> | |
1029 | <td> </td> | |
363fb6af | 1030 | </tr> |
ed38f89d MT |
1031 | </table> |
1032 | <hr size='1'> | |
1033 | <table width='100%'> | |
1034 | <tr> | |
1035 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy log settings'}</b></td> | |
1036 | </tr> | |
1037 | <tr> | |
488d1b7c CS |
1038 | <td width='25%' class='base'>$Lang::tr{'advproxy log enabled'}:</td> |
1039 | <td width='20%'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td> | |
1040 | <td width='25%'class='base'>$Lang::tr{'advproxy log query'}:</td> | |
1041 | <td width='30%'><input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td> | |
1042 | </tr> | |
1043 | <tr> | |
1044 | <td> </td> | |
1045 | <td> </td> | |
1046 | <td class='base'>$Lang::tr{'advproxy log useragent'}:</td> | |
1047 | <td><input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td> | |
ed38f89d MT |
1048 | </tr> |
1049 | </table> | |
1050 | <hr size='1'> | |
1051 | <table width='100%'> | |
1052 | <tr> | |
1053 | <td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td> | |
1054 | </tr> | |
fe1656d2 CS |
1055 | <tr> |
1056 | <td class='base'>$Lang::tr{'proxy cachemgr'}:</td> | |
1057 | <td><input type='checkbox' name='CACHEMGR' $checked{'CACHEMGR'}{'on'} /></td> | |
1058 | <td class='base'>$Lang::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td> | |
1059 | <td><input type='text' name='ADMIN_MAIL_ADDRESS' value='$proxysettings{'ADMIN_MAIL_ADDRESS'}' /></td> | |
1060 | </tr> | |
1061 | <tr> | |
1062 | <td class='base'>$Lang::tr{'proxy filedescriptors'}:</td> | |
1063 | <td><input type='text' name='FILEDESCRIPTORS' value='$proxysettings{'FILEDESCRIPTORS'}' size='5' /></td> | |
1064 | <td class='base'>$Lang::tr{'proxy admin password'}: <img src='/blob.gif' alt='*' /></td> | |
1065 | <td><input type='text' name='ADMIN_PASSWORD' value='$proxysettings{'ADMIN_PASSWORD'}' /></td> | |
1066 | </tr> | |
ed38f89d | 1067 | <tr> |
488d1b7c | 1068 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> |
ac1cfefa MT |
1069 | </tr> |
1070 | <tr> | |
ed38f89d MT |
1071 | <td class='base'>$Lang::tr{'advproxy ram cache size'}:</td> |
1072 | <td><input type='text' name='CACHE_MEM' value='$proxysettings{'CACHE_MEM'}' size='5' /></td> | |
1073 | <td class='base'>$Lang::tr{'advproxy hdd cache size'}:</td> | |
ac1cfefa MT |
1074 | <td><input type='text' name='CACHE_SIZE' value='$proxysettings{'CACHE_SIZE'}' size='5' /></td> |
1075 | </tr> | |
1076 | <tr> | |
ed38f89d | 1077 | <td class='base'>$Lang::tr{'advproxy min size'}:</td> |
ac1cfefa | 1078 | <td><input type='text' name='MIN_SIZE' value='$proxysettings{'MIN_SIZE'}' size='5' /></td> |
ed38f89d | 1079 | <td class='base'>$Lang::tr{'advproxy max size'}:</td> |
ac1cfefa MT |
1080 | <td><input type='text' name='MAX_SIZE' value='$proxysettings{'MAX_SIZE'}' size='5' /></td> |
1081 | </tr> | |
1082 | <tr> | |
ed38f89d | 1083 | <td class='base'>$Lang::tr{'advproxy number of L1 dirs'}:</td> |
363fb6af MT |
1084 | <td class='base'><select name='L1_DIRS'> |
1085 | <option value='16' $selected{'L1_DIRS'}{'16'}>16</option> | |
1086 | <option value='32' $selected{'L1_DIRS'}{'32'}>32</option> | |
1087 | <option value='64' $selected{'L1_DIRS'}{'64'}>64</option> | |
1088 | <option value='128' $selected{'L1_DIRS'}{'128'}>128</option> | |
1089 | <option value='256' $selected{'L1_DIRS'}{'256'}>256</option> | |
1090 | </select></td> | |
ed38f89d | 1091 | <td colspan='2' rowspan= '5' valign='top' class='base'> |
363fb6af | 1092 | <table cellspacing='0' cellpadding='0'> |
ed38f89d MT |
1093 | <tr> |
1094 | <!-- intentionally left empty --> | |
1095 | </tr> | |
1096 | <tr> | |
1097 | <td>$Lang::tr{'advproxy no cache sites'}: <img src='/blob.gif' alt='*' /></td> | |
1098 | </tr> | |
1099 | <tr> | |
1100 | <!-- intentionally left empty --> | |
1101 | </tr> | |
1102 | <tr> | |
1103 | <!-- intentionally left empty --> | |
1104 | </tr> | |
1105 | <tr> | |
488d1b7c | 1106 | <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1107 | END |
1108 | ; | |
1109 | ||
1110 | print $proxysettings{'DST_NOCACHE'}; | |
1111 | ||
1112 | print <<END | |
1113 | </textarea></td> | |
1114 | </tr> | |
1115 | </table> | |
1116 | </td> | |
1117 | </tr> | |
1118 | <tr> | |
363fb6af MT |
1119 | <td class='base'>$Lang::tr{'advproxy memory replacement policy'}:</td> |
1120 | <td class='base'><select name='MEM_POLICY'> | |
1121 | <option value='LRU' $selected{'MEM_POLICY'}{'LRU'}>LRU</option> | |
1122 | <option value='heap LFUDA' $selected{'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option> | |
1123 | <option value='heap GDSF' $selected{'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option> | |
1124 | <option value='heap LRU' $selected{'MEM_POLICY'}{'heap LRU'}>heap LRU</option> | |
1125 | </select></td> | |
ed38f89d MT |
1126 | </tr> |
1127 | <tr> | |
363fb6af MT |
1128 | <td class='base'>$Lang::tr{'advproxy cache replacement policy'}:</td> |
1129 | <td class='base'><select name='CACHE_POLICY'> | |
1130 | <option value='LRU' $selected{'CACHE_POLICY'}{'LRU'}>LRU</option> | |
1131 | <option value='heap LFUDA' $selected{'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option> | |
1132 | <option value='heap GDSF' $selected{'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option> | |
1133 | <option value='heap LRU' $selected{'CACHE_POLICY'}{'heap LRU'}>heap LRU</option> | |
1134 | </select></td> | |
ed38f89d MT |
1135 | </tr> |
1136 | <tr> | |
1137 | <td colspan='2'> </td> | |
1138 | </tr> | |
1139 | <tr> | |
363fb6af | 1140 | <td class='base'>$Lang::tr{'advproxy offline mode'}:</td> |
ed38f89d MT |
1141 | <td><input type='checkbox' name='OFFLINE_MODE' $checked{'OFFLINE_MODE'}{'on'} /></td> |
1142 | </tr> | |
1143 | </table> | |
1144 | <hr size='1'> | |
1145 | <table width='100%'> | |
363fb6af MT |
1146 | <tr> |
1147 | <td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td> | |
1148 | </tr> | |
1149 | <tr> | |
9141bd34 | 1150 | <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td> |
363fb6af MT |
1151 | </tr> |
1152 | <tr> | |
1153 | <td colspan='2' class='base'>$Lang::tr{'advproxy standard ports'}:</td> | |
1154 | <td colspan='2' class='base'>$Lang::tr{'advproxy ssl ports'}:</td> | |
1155 | </tr> | |
1156 | <tr> | |
1157 | <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'> | |
1158 | END | |
1159 | ; | |
1160 | if (!$proxysettings{'PORTS_SAFE'}) { print $def_ports_safe; } else { print $proxysettings{'PORTS_SAFE'}; } | |
1161 | ||
1162 | print <<END | |
1163 | </textarea></td> | |
1164 | <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'> | |
1165 | END | |
1166 | ; | |
1167 | if (!$proxysettings{'PORTS_SSL'}) { print $def_ports_ssl; } else { print $proxysettings{'PORTS_SSL'}; } | |
1168 | ||
1169 | print <<END | |
1170 | </textarea></td> | |
1171 | </tr> | |
1172 | </table> | |
1173 | <hr size='1'> | |
1174 | <table width='100%'> | |
ed38f89d MT |
1175 | <tr> |
1176 | <td colspan='4'><b>$Lang::tr{'advproxy network based access'}</b></td> | |
1177 | </tr> | |
1178 | <tr> | |
1179 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1180 | </tr> | |
1181 | <tr> | |
9fb25b1c | 1182 | <td colspan='4' class='base'>$Lang::tr{'advproxy allowed subnets'}:</td> |
ed38f89d MT |
1183 | </tr> |
1184 | <tr> | |
9141bd34 | 1185 | <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1186 | END |
1187 | ; | |
1188 | ||
363fb6af MT |
1189 | if (!$proxysettings{'SRC_SUBNETS'}) |
1190 | { | |
ed38f89d | 1191 | print "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n"; |
363fb6af MT |
1192 | if ($netsettings{'BLUE_DEV'}) |
1193 | { | |
1194 | print "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n"; | |
ed38f89d | 1195 | } |
363fb6af | 1196 | } else { print $proxysettings{'SRC_SUBNETS'}; } |
ed38f89d MT |
1197 | |
1198 | print <<END | |
1199 | </textarea></td> | |
9fb25b1c MT |
1200 | END |
1201 | ; | |
1202 | ||
1203 | $line = $Lang::tr{'advproxy no internal proxy on green'}; | |
1204 | $line =~ s/Green/<font color="$Header::colourgreen">Green<\/font>/i; | |
1205 | print "<td class='base'>$line:</td>\n"; | |
1206 | print <<END | |
1207 | <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked{'NO_PROXY_LOCAL'}{'on'} /></td> | |
1208 | </tr> | |
1209 | END | |
1210 | ; | |
1211 | if ($netsettings{'BLUE_DEV'}) { | |
1212 | $line = $Lang::tr{'advproxy no internal proxy on blue'}; | |
1213 | $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/font>/i; | |
1214 | print "<tr>\n"; | |
1215 | print "<td class='base'>$line:</td>\n"; | |
1216 | print <<END | |
1217 | <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} /></td> | |
1218 | </tr> | |
1219 | END | |
1220 | ; | |
1221 | } | |
1222 | print <<END | |
1223 | <tr> | |
1224 | <td colspan='2'> </td> | |
1225 | </tr> | |
1226 | <tr> | |
ed38f89d MT |
1227 | <td colspan='2'> </td> |
1228 | </tr> | |
1229 | </table> | |
1230 | <table width='100%'> | |
1231 | <tr> | |
1232 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1233 | </tr> | |
1234 | <tr> | |
1235 | <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted ip clients'}: <img src='/blob.gif' alt='*' /></td> | |
1236 | <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td> | |
1237 | </tr> | |
1238 | <tr> | |
9141bd34 | 1239 | <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1240 | END |
1241 | ; | |
1242 | ||
1243 | print $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
1244 | ||
1245 | print <<END | |
1246 | </textarea></td> | |
9141bd34 | 1247 | <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1248 | END |
1249 | ; | |
1250 | ||
1251 | print $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
1252 | ||
1253 | print <<END | |
1254 | </textarea></td> | |
1255 | </tr> | |
1256 | </table> | |
1257 | <table width='100%'> | |
1258 | <tr> | |
1259 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1260 | </tr> | |
1261 | <tr> | |
1262 | <td colspan='2' class='base'>$Lang::tr{'advproxy banned ip clients'}: <img src='/blob.gif' alt='*' /></td> | |
1263 | <td colspan='2' class='base'>$Lang::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td> | |
1264 | </tr> | |
1265 | <tr> | |
9141bd34 | 1266 | <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1267 | END |
1268 | ; | |
1269 | ||
1270 | print $proxysettings{'SRC_BANNED_IP'}; | |
1271 | ||
1272 | print <<END | |
1273 | </textarea></td> | |
9141bd34 | 1274 | <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1275 | END |
1276 | ; | |
1277 | ||
1278 | print $proxysettings{'SRC_BANNED_MAC'}; | |
1279 | ||
1280 | print <<END | |
1281 | </textarea></td> | |
1282 | </tr> | |
1283 | </table> | |
1284 | ||
1285 | <hr size='1'> | |
1286 | ||
1287 | END | |
1288 | ; | |
1289 | # ------------------------------------------------------------------- | |
1290 | # CRE GUI - optional | |
1291 | # ------------------------------------------------------------------- | |
1292 | ||
1293 | if (-e $cre_enabled) { print <<END | |
1294 | <table width='100%'> | |
1295 | ||
1296 | <tr> | |
9141bd34 | 1297 | <td colspan='4'><b>$Lang::tr{'advproxy classroom extensions'}</b> $Lang::tr{'advproxy enabled'}:<input type='checkbox' name='CLASSROOM_EXT' $checked{'CLASSROOM_EXT'}{'on'} /></td> |
ed38f89d MT |
1298 | </tr> |
1299 | <tr> | |
1300 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1301 | </tr> | |
1302 | <tr> | |
9141bd34 CS |
1303 | |
1304 | END | |
1305 | ; | |
1306 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){ | |
1307 | print <<END | |
ed38f89d MT |
1308 | <td class='base'>$Lang::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td> |
1309 | <td><input type='password' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' size='12' /></td> | |
1310 | </tr> | |
1311 | <tr> | |
1312 | <td colspan='2' class='base'>$Lang::tr{'advproxy cre group definitions'}:</td> | |
1313 | <td colspan='2' class='base'>$Lang::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td> | |
9141bd34 CS |
1314 | END |
1315 | ; | |
1316 | } | |
1317 | print "</tr>"; | |
1318 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){ | |
1319 | print <<END | |
ed38f89d MT |
1320 | <tr> |
1321 | <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'> | |
1322 | END | |
1323 | ; | |
1324 | ||
1325 | print $proxysettings{'CRE_GROUPS'}; | |
1326 | ||
1327 | print <<END | |
1328 | </textarea></td> | |
1329 | <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'> | |
1330 | END | |
1331 | ; | |
1332 | print $proxysettings{'CRE_SVHOSTS'}; | |
1333 | ||
1334 | print <<END | |
1335 | </textarea></td> | |
1336 | </tr> | |
ed38f89d MT |
1337 | END |
1338 | ; | |
9141bd34 CS |
1339 | } |
1340 | print "</table><hr size='1'>"; | |
1341 | ||
ed38f89d MT |
1342 | } else { |
1343 | print <<END | |
1344 | <input type='hidden' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' /> | |
1345 | <input type='hidden' name='CRE_GROUPS' value='$proxysettings{'CRE_GROUPS'}' /> | |
1346 | <input type='hidden' name='CRE_SVHOSTS' value='$proxysettings{'CRE_SVHOSTS'}' /> | |
1347 | END | |
1348 | ; | |
1349 | } | |
363fb6af | 1350 | |
ed38f89d MT |
1351 | # ------------------------------------------------------------------- |
1352 | ||
28c9dec6 | 1353 | print <<END |
ed38f89d MT |
1354 | |
1355 | <table width='100%'> | |
1356 | <tr> | |
363fb6af | 1357 | <td colspan='4'><b>$Lang::tr{'advproxy time restrictions'}</b></td> |
ed38f89d MT |
1358 | </tr> |
1359 | <table width='100%'> | |
1360 | <tr> | |
1361 | <td width='2%'>$Lang::tr{'advproxy access'}</td> | |
1362 | <td width='1%'> </td> | |
1363 | <td width='2%' align='center'>$Lang::tr{'advproxy monday'}</td> | |
1364 | <td width='2%' align='center'>$Lang::tr{'advproxy tuesday'}</td> | |
1365 | <td width='2%' align='center'>$Lang::tr{'advproxy wednesday'}</td> | |
1366 | <td width='2%' align='center'>$Lang::tr{'advproxy thursday'}</td> | |
1367 | <td width='2%' align='center'>$Lang::tr{'advproxy friday'}</td> | |
1368 | <td width='2%' align='center'>$Lang::tr{'advproxy saturday'}</td> | |
1369 | <td width='2%' align='center'>$Lang::tr{'advproxy sunday'}</td> | |
1370 | <td width='1%'> </td> | |
1371 | <td width='7%' colspan=3>$Lang::tr{'advproxy from'}</td> | |
1372 | <td width='1%'> </td> | |
1373 | <td width='7%' colspan=3>$Lang::tr{'advproxy to'}</td> | |
1374 | <td> </td> | |
1375 | </tr> | |
1376 | <tr> | |
1377 | <td class='base'> | |
1378 | <select name='TIME_ACCESS_MODE'> | |
1379 | <option value='allow' $selected{'TIME_ACCESS_MODE'}{'allow'}>$Lang::tr{'advproxy mode allow'}</option> | |
1380 | <option value='deny' $selected{'TIME_ACCESS_MODE'}{'deny'}>$Lang::tr{'advproxy mode deny'}</option> | |
1381 | </select> | |
1382 | </td> | |
1383 | <td> </td> | |
1384 | <td class='base'><input type='checkbox' name='TIME_MON' $checked{'TIME_MON'}{'on'} /></td> | |
1385 | <td class='base'><input type='checkbox' name='TIME_TUE' $checked{'TIME_TUE'}{'on'} /></td> | |
1386 | <td class='base'><input type='checkbox' name='TIME_WED' $checked{'TIME_WED'}{'on'} /></td> | |
1387 | <td class='base'><input type='checkbox' name='TIME_THU' $checked{'TIME_THU'}{'on'} /></td> | |
1388 | <td class='base'><input type='checkbox' name='TIME_FRI' $checked{'TIME_FRI'}{'on'} /></td> | |
1389 | <td class='base'><input type='checkbox' name='TIME_SAT' $checked{'TIME_SAT'}{'on'} /></td> | |
1390 | <td class='base'><input type='checkbox' name='TIME_SUN' $checked{'TIME_SUN'}{'on'} /></td> | |
1391 | <td> </td> | |
1392 | <td class='base'> | |
1393 | <select name='TIME_FROM_HOUR'> | |
1394 | END | |
1395 | ; | |
1396 | for ($i=0;$i<=24;$i++) { | |
1397 | $_ = sprintf("%02s",$i); | |
1398 | print "<option $selected{'TIME_FROM_HOUR'}{$_}>$_</option>\n"; | |
1399 | } | |
1400 | print <<END | |
1401 | </select> | |
1402 | </td> | |
1403 | <td>:</td> | |
1404 | <td class='base'> | |
1405 | <select name='TIME_FROM_MINUTE'> | |
1406 | END | |
1407 | ; | |
1408 | for ($i=0;$i<=45;$i+=15) { | |
1409 | $_ = sprintf("%02s",$i); | |
1410 | print "<option $selected{'TIME_FROM_MINUTE'}{$_}>$_</option>\n"; | |
1411 | } | |
1412 | print <<END | |
1413 | </select> | |
1414 | <td> - </td> | |
1415 | </td> | |
1416 | <td class='base'> | |
1417 | <select name='TIME_TO_HOUR'> | |
1418 | END | |
1419 | ; | |
1420 | for ($i=0;$i<=24;$i++) { | |
1421 | $_ = sprintf("%02s",$i); | |
1422 | print "<option $selected{'TIME_TO_HOUR'}{$_}>$_</option>\n"; | |
1423 | } | |
1424 | print <<END | |
1425 | </select> | |
1426 | </td> | |
1427 | <td>:</td> | |
1428 | <td class='base'> | |
1429 | <select name='TIME_TO_MINUTE'> | |
1430 | END | |
1431 | ; | |
1432 | for ($i=0;$i<=45;$i+=15) { | |
1433 | $_ = sprintf("%02s",$i); | |
1434 | print "<option $selected{'TIME_TO_MINUTE'}{$_}>$_</option>\n"; | |
1435 | } | |
1436 | print <<END | |
1437 | </select> | |
1438 | </td> | |
1439 | </tr> | |
1440 | </table> | |
1441 | <hr size='1'> | |
1442 | <table width='100%'> | |
1443 | <tr> | |
1444 | <td colspan='4'><b>$Lang::tr{'advproxy transfer limits'}</b></td> | |
ac1cfefa MT |
1445 | </tr> |
1446 | <tr> | |
ed38f89d MT |
1447 | <td width='25%' class='base'>$Lang::tr{'advproxy max download size'}:</td> |
1448 | <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value='$proxysettings{'MAX_INCOMING_SIZE'}' size='5' /></td> | |
1449 | <td width='25%' class='base'>$Lang::tr{'advproxy max upload size'}:</td> | |
1450 | <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value='$proxysettings{'MAX_OUTGOING_SIZE'}' size='5' /></td> | |
ac1cfefa MT |
1451 | </tr> |
1452 | </table> | |
ed38f89d | 1453 | <hr size='1'> |
ac1cfefa | 1454 | <table width='100%'> |
ac1cfefa | 1455 | <tr> |
ed38f89d MT |
1456 | <td colspan='4'><b>$Lang::tr{'advproxy download throttling'}</b></td> |
1457 | </tr> | |
1458 | <tr> | |
1459 | <td width='25%' class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourgreen">Green</font>:</td> | |
1460 | <td width='20%' class='base'> | |
1461 | <select name='THROTTLING_GREEN_TOTAL'> | |
1462 | END | |
1463 | ; | |
1464 | ||
1465 | foreach (@throttle_limits) { | |
1466 | print "\t<option value='$_' $selected{'THROTTLING_GREEN_TOTAL'}{$_}>$_ kBit/s</option>\n"; | |
1467 | } | |
1468 | ||
1469 | print <<END | |
1470 | <option value='0' $selected{'THROTTLING_GREEN_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1471 | </select> | |
1472 | </td> | |
1473 | <td width='25%' class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourgreen">Green</font>:</td> | |
1474 | <td width='30%' class='base'> | |
1475 | <select name='THROTTLING_GREEN_HOST'> | |
1476 | END | |
1477 | ; | |
1478 | ||
1479 | foreach (@throttle_limits) { | |
1480 | print "\t<option value='$_' $selected{'THROTTLING_GREEN_HOST'}{$_}>$_ kBit/s</option>\n"; | |
1481 | } | |
1482 | ||
1483 | print <<END | |
1484 | <option value='0' $selected{'THROTTLING_GREEN_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1485 | </select> | |
1486 | </td> | |
1487 | </tr> | |
1488 | END | |
1489 | ; | |
1490 | ||
1491 | if ($netsettings{'BLUE_DEV'}) { | |
1492 | print <<END | |
1493 | <tr> | |
1494 | <td class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourblue">Blue</font>:</td> | |
1495 | <td class='base'> | |
1496 | <select name='THROTTLING_BLUE_TOTAL'> | |
1497 | END | |
1498 | ; | |
1499 | ||
1500 | foreach (@throttle_limits) { | |
1501 | print "\t<option value='$_' $selected{'THROTTLING_BLUE_TOTAL'}{$_}>$_ kBit/s</option>\n"; | |
1502 | } | |
1503 | ||
1504 | print <<END | |
1505 | <option value='0' $selected{'THROTTLING_BLUE_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1506 | </select> | |
1507 | </td> | |
1508 | <td class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourblue">Blue</font>:</td> | |
1509 | <td class='base'> | |
1510 | <select name='THROTTLING_BLUE_HOST'> | |
1511 | END | |
1512 | ; | |
1513 | ||
1514 | foreach (@throttle_limits) { | |
1515 | print "\t<option value='$_' $selected{'THROTTLING_BLUE_HOST'}{$_}>$_ kBit/s</option>\n"; | |
1516 | } | |
1517 | ||
1518 | print <<END | |
1519 | <option value='0' $selected{'THROTTLING_BLUE_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1520 | </select> | |
ac1cfefa | 1521 | </td> |
ac1cfefa | 1522 | </tr> |
ed38f89d MT |
1523 | END |
1524 | ; | |
1525 | } | |
ac1cfefa | 1526 | |
ed38f89d MT |
1527 | print <<END |
1528 | </table> | |
1529 | <table width='100%'> | |
1530 | <tr> | |
1531 | <td colspan='4'><i>$Lang::tr{'advproxy content based throttling'}:</i></td> | |
1532 | </tr> | |
1533 | <tr> | |
1534 | <td width='15%' class='base'>$Lang::tr{'advproxy throttle binary'}:</td> | |
1535 | <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked{'THROTTLE_BINARY'}{'on'} /></td> | |
1536 | <td width='15%' class='base'>$Lang::tr{'advproxy throttle dskimg'}:</td> | |
1537 | <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked{'THROTTLE_DSKIMG'}{'on'} /></td> | |
1538 | <td width='15%' class='base'>$Lang::tr{'advproxy throttle mmedia'}:</td> | |
1539 | <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked{'THROTTLE_MMEDIA'}{'on'} /></td> | |
363fb6af MT |
1540 | <td width='15%'> </td> |
1541 | <td width='10%'> </td> | |
28c9dec6 | 1542 | </tr> |
ac1cfefa | 1543 | </table> |
ed38f89d MT |
1544 | <hr size='1'> |
1545 | <table width='100%'> | |
1546 | <tr> | |
9141bd34 | 1547 | <td colspan='4'><b>$Lang::tr{'advproxy MIME filter'}</b> $Lang::tr{'advproxy enabled'}:<input type='checkbox' name='ENABLE_MIME_FILTER' $checked{'ENABLE_MIME_FILTER'}{'on'} /></td> |
ed38f89d | 1548 | </tr> |
9141bd34 CS |
1549 | END |
1550 | ; | |
1551 | if ( $proxysettings{'ENABLE_MIME_FILTER'} eq 'on' ){ | |
1552 | print <<END | |
ed38f89d MT |
1553 | <tr> |
1554 | <td colspan='2' class='base'>$Lang::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td> | |
363fb6af MT |
1555 | <td> </td> |
1556 | <td> </td> | |
ed38f89d MT |
1557 | </tr> |
1558 | <tr> | |
1559 | <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'> | |
ac1cfefa MT |
1560 | END |
1561 | ; | |
ac1cfefa | 1562 | |
ed38f89d | 1563 | print $proxysettings{'MIME_TYPES'}; |
ac1cfefa | 1564 | |
ed38f89d MT |
1565 | print <<END |
1566 | </textarea></td> | |
363fb6af MT |
1567 | <td> </td> |
1568 | <td> </td> | |
ed38f89d | 1569 | </tr> |
9141bd34 CS |
1570 | END |
1571 | ; | |
1572 | } | |
1573 | print <<END | |
ed38f89d | 1574 | </table> |
9141bd34 | 1575 | |
ed38f89d MT |
1576 | <hr size='1'> |
1577 | <table width='100%'> | |
1578 | <tr> | |
9141bd34 | 1579 | <td colspan='4'><b>$Lang::tr{'advproxy web browser'}</b> $Lang::tr{'advproxy UA enable filter'}:<input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td> |
ed38f89d | 1580 | </tr> |
9141bd34 CS |
1581 | END |
1582 | ; | |
1583 | if ( $proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on' ){ | |
1584 | print <<END | |
ed38f89d MT |
1585 | <tr> |
1586 | <td colspan='4'><i> | |
1587 | END | |
1588 | ; | |
1589 | if (@useragentlist) { print "$Lang::tr{'advproxy allowed web browsers'}:"; } else { print "$Lang::tr{'advproxy no clients defined'}"; } | |
1590 | print <<END | |
1591 | </i></td> | |
1592 | </tr> | |
1593 | </table> | |
1594 | <table width='100%'> | |
1595 | END | |
1596 | ; | |
ac1cfefa | 1597 | |
ed38f89d MT |
1598 | for ($n=0; $n<=@useragentlist; $n = $n + $i) { |
1599 | for ($i=0; $i<=3; $i++) { | |
1600 | if ($i eq 0) { print "<tr>\n"; } | |
1601 | if (($n+$i) < @useragentlist) { | |
1602 | @useragent = split(/,/,@useragentlist[$n+$i]); | |
4e17adad CS |
1603 | print "<td width='15%'>$useragent[1]:<\/td>\n"; |
1604 | print "<td width='10%'><input type='checkbox' name='UA_$useragent[0]' $checked{'UA_'.$useragent[0]}{'on'} /></td>\n"; | |
ed38f89d MT |
1605 | } |
1606 | if ($i eq 3) { print "<\/tr>\n"; } | |
1607 | } | |
1608 | } | |
9141bd34 | 1609 | } |
ed38f89d MT |
1610 | print <<END |
1611 | </table> | |
1612 | <hr size='1'> | |
1613 | <table width='100%'> | |
1614 | <tr> | |
1615 | <td><b>$Lang::tr{'advproxy privacy'}</b></td> | |
1616 | </tr> | |
1617 | <tr> | |
1618 | <td class='base'>$Lang::tr{'advproxy fake useragent'}: <img src='/blob.gif' alt='*' /></td> | |
ed38f89d MT |
1619 | <td class='base'>$Lang::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td> |
1620 | </tr> | |
1621 | <tr> | |
9141bd34 | 1622 | <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td> |
ed38f89d MT |
1623 | <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='56' /></td> |
1624 | </tr> | |
1625 | </table> | |
1626 | <hr size='1'> | |
1627 | END | |
1628 | ; | |
1629 | ||
9fb25b1c | 1630 | print <<END |
ed38f89d MT |
1631 | <table width='100%'> |
1632 | <tr> | |
363fb6af | 1633 | <td colspan='5'><b>$Lang::tr{'advproxy AUTH method'}</b></td> |
ed38f89d MT |
1634 | </tr> |
1635 | <tr> | |
1636 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked{'AUTH_METHOD'}{'none'} />$Lang::tr{'advproxy AUTH method none'}</td> | |
1637 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked{'AUTH_METHOD'}{'ncsa'} />$Lang::tr{'advproxy AUTH method ncsa'}</td> | |
1638 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked{'AUTH_METHOD'}{'ident'} />$Lang::tr{'advproxy AUTH method ident'}</td> | |
1639 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked{'AUTH_METHOD'}{'ldap'} />$Lang::tr{'advproxy AUTH method ldap'}</td> | |
1640 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked{'AUTH_METHOD'}{'ntlm'} />$Lang::tr{'advproxy AUTH method ntlm'}</td> | |
1641 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked{'AUTH_METHOD'}{'radius'} />$Lang::tr{'advproxy AUTH method radius'}</td> | |
1642 | </tr> | |
1643 | </table> | |
1644 | END | |
1645 | ; | |
1646 | ||
1647 | if (!($proxysettings{'AUTH_METHOD'} eq 'none')) { if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { print <<END | |
1648 | <hr size='1'> | |
1649 | <table width='100%'> | |
1650 | <tr> | |
363fb6af | 1651 | <td colspan='4'><b>$Lang::tr{'advproxy AUTH global settings'}</b></td> |
ed38f89d MT |
1652 | </tr> |
1653 | <tr> | |
1654 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1655 | </tr> | |
1656 | <tr> | |
1657 | <td class='base'>$Lang::tr{'advproxy AUTH number of auth processes'}:</td> | |
1658 | <td><input type='text' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}' size='5' /></td> | |
1659 | <td colspan='2' rowspan= '6' valign='top' class='base'> | |
1660 | <table cellpadding='0' cellspacing='0'> | |
1661 | <tr> | |
1662 | <td class='base'>$Lang::tr{'advproxy AUTH realm'}: <img src='/blob.gif' alt='*' /></td> | |
1663 | </tr> | |
1664 | <tr> | |
1665 | <!-- intentionally left empty --> | |
1666 | </tr> | |
1667 | <tr> | |
1668 | <!-- intentionally left empty --> | |
1669 | </tr> | |
1670 | <tr> | |
1671 | <td><input type='text' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}' size='40' /></td> | |
1672 | </tr> | |
1673 | <tr> | |
1674 | <!-- intentionally left empty --> | |
1675 | </tr> | |
1676 | <tr> | |
1677 | <!-- intentionally left empty --> | |
1678 | </tr> | |
1679 | <tr> | |
1680 | <td>$Lang::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td> | |
1681 | </tr> | |
1682 | <tr> | |
1683 | <!-- intentionally left empty --> | |
1684 | </tr> | |
1685 | <tr> | |
1686 | <!-- intentionally left empty --> | |
1687 | </tr> | |
1688 | <tr> | |
1689 | <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'> | |
1690 | END | |
1691 | ; | |
1692 | ||
1693 | print $proxysettings{'DST_NOAUTH'}; | |
1694 | ||
1695 | print <<END | |
1696 | </textarea></td> | |
1697 | </tr> | |
1698 | </table> | |
1699 | </td> | |
1700 | </tr> | |
1701 | <tr> | |
1702 | <td class='base'>$Lang::tr{'advproxy AUTH auth cache TTL'}:</td> | |
1703 | <td><input type='text' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
1704 | </tr> | |
1705 | <tr> | |
1706 | <td class='base'>$Lang::tr{'advproxy AUTH limit of IP addresses'}: <img src='/blob.gif' alt='*' /></td> | |
1707 | <td><input type='text' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
1708 | </tr> | |
1709 | <tr> | |
1710 | <td class='base'>$Lang::tr{'advproxy AUTH user IP cache TTL'}:</td> | |
1711 | <td><input type='text' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td> | |
1712 | </tr> | |
1713 | <tr> | |
363fb6af MT |
1714 | <td class='base'>$Lang::tr{'advproxy AUTH always required'}:</td> |
1715 | <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td> | |
ed38f89d MT |
1716 | </tr> |
1717 | <tr> | |
1718 | <td colspan='2'> </td> | |
1719 | </tr> | |
1720 | </table> | |
1721 | END | |
1722 | ; | |
1723 | } | |
1724 | ||
1725 | # =================================================================== | |
1726 | # NCSA auth settings | |
1727 | # =================================================================== | |
1728 | ||
1729 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') { | |
1730 | print <<END | |
1731 | <hr size='1'> | |
1732 | <table width='100%'> | |
1733 | <tr> | |
1734 | <td colspan='4'><b>$Lang::tr{'advproxy NCSA auth'}</b></td> | |
1735 | </tr> | |
1736 | <tr> | |
1737 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA min password length'}:</td> | |
1738 | <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}' size='5' /></td> | |
1739 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA redirector bypass'} \'$Lang::tr{'advproxy NCSA grp extended'}\':</td> | |
363fb6af | 1740 | <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked{'NCSA_BYPASS_REDIR'}{'on'} /></td> |
ed38f89d MT |
1741 | </tr> |
1742 | <tr> | |
1743 | <td colspan='2'><br> <input type='submit' name='ACTION' value='$Lang::tr{'advproxy NCSA user management'}'></td> | |
1744 | <td> </td> | |
1745 | <td> </td> | |
1746 | </tr> | |
1747 | </table> | |
1748 | END | |
1749 | ; } | |
1750 | ||
1751 | # =================================================================== | |
1752 | # IDENTD auth settings | |
1753 | # =================================================================== | |
1754 | ||
1755 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { | |
1756 | print <<END | |
1757 | <hr size ='1'> | |
1758 | <table width='100%'> | |
1759 | <tr> | |
1760 | <td colspan='4'><b>$Lang::tr{'advproxy IDENT identd settings'}</b></td> | |
1761 | </tr> | |
1762 | <tr> | |
1763 | <td width='25%' class='base'>$Lang::tr{'advproxy IDENT required'}:</td> | |
363fb6af MT |
1764 | <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked{'IDENT_REQUIRED'}{'on'} /></td> |
1765 | <td width='25%' class='base'>$Lang::tr{'advproxy AUTH always required'}:</td> | |
1766 | <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td> | |
ed38f89d MT |
1767 | </tr> |
1768 | <tr> | |
1769 | <td class='base'>$Lang::tr{'advproxy IDENT timeout'}:</td> | |
1770 | <td><input type='text' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}' size='5' /></td> | |
1771 | <td> </td> | |
1772 | <td> </td> | |
1773 | </tr> | |
1774 | <tr> | |
1775 | <td colspan='2' class='base'>$Lang::tr{'advproxy IDENT aware hosts'}:</td> | |
1776 | <td colspan='2' class='base'>$Lang::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td> | |
1777 | </tr> | |
1778 | <tr> | |
1779 | <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'> | |
1780 | END | |
1781 | ; | |
1782 | if (!$proxysettings{'IDENT_HOSTS'}) { | |
1783 | print "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n"; | |
1784 | if ($netsettings{'BLUE_DEV'}) { | |
1785 | print "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n"; | |
1786 | } | |
1787 | } else { | |
1788 | print $proxysettings{'IDENT_HOSTS'}; | |
1789 | } | |
1790 | ||
1791 | print <<END | |
1792 | </textarea></td> | |
1793 | <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'> | |
1794 | END | |
1795 | ; | |
1796 | ||
1797 | print $proxysettings{'DST_NOAUTH'}; | |
1798 | ||
1799 | print <<END | |
1800 | </textarea></td> | |
1801 | </tr> | |
1802 | </table> | |
1803 | <hr size ='1'> | |
1804 | <table width='100%'> | |
1805 | <tr> | |
1806 | <td colspan='4'><b>$Lang::tr{'advproxy IDENT user based access restrictions'}</b></td> | |
1807 | </tr> | |
1808 | <tr> | |
1809 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
1810 | <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked{'IDENT_ENABLE_ACL'}{'on'} /></td> | |
1811 | <td width='25%'> </td> | |
1812 | <td width='30%'> </td> | |
1813 | </tr> | |
1814 | <tr> | |
1815 | <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked{'IDENT_USER_ACL'}{'positive'} /> | |
1816 | $Lang::tr{'advproxy IDENT use positive access list'}:</td> | |
1817 | <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked{'IDENT_USER_ACL'}{'negative'} /> | |
1818 | $Lang::tr{'advproxy IDENT use negative access list'}:</td> | |
1819 | </tr> | |
1820 | <tr> | |
1821 | <td colspan='2'>$Lang::tr{'advproxy IDENT authorized users'}</td> | |
1822 | <td colspan='2'>$Lang::tr{'advproxy IDENT unauthorized users'}</td> | |
1823 | </tr> | |
1824 | <tr> | |
363fb6af | 1825 | <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1826 | END |
1827 | ; } | |
1828 | ||
1829 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_ALLOW_USERS'}; } | |
1830 | ||
1831 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END | |
1832 | </textarea></td> | |
363fb6af | 1833 | <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1834 | END |
1835 | ; } | |
1836 | ||
1837 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_DENY_USERS'}; } | |
1838 | ||
1839 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END | |
1840 | </textarea></td> | |
1841 | </tr> | |
1842 | </table> | |
1843 | END | |
1844 | ; } | |
1845 | ||
1846 | # =================================================================== | |
1847 | # NTLM auth settings | |
1848 | # =================================================================== | |
1849 | ||
1850 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { | |
1851 | print <<END | |
1852 | <hr size='1'> | |
1853 | <table width='100%'> | |
1854 | <tr> | |
1855 | <td colspan='6'><b>$Lang::tr{'advproxy NTLM domain settings'}</b></td> | |
1856 | </tr> | |
1857 | <tr> | |
1858 | <td class='base'>$Lang::tr{'advproxy NTLM domain'}:</td> | |
1859 | <td><input type='text' name='NTLM_DOMAIN' value='$proxysettings{'NTLM_DOMAIN'}' size='15' /></td> | |
1860 | <td class='base'>$Lang::tr{'advproxy NTLM PDC hostname'}:</td> | |
1861 | <td><input type='text' name='NTLM_PDC' value='$proxysettings{'NTLM_PDC'}' size='14' /></td> | |
1862 | <td class='base'>$Lang::tr{'advproxy NTLM BDC hostname'}: <img src='/blob.gif' alt='*' /></td> | |
1863 | <td><input type='text' name='NTLM_BDC' value='$proxysettings{'NTLM_BDC'}' size='14' /></td> | |
1864 | </tr> | |
1865 | </table> | |
1866 | <hr size ='1'> | |
1867 | <table width='100%'> | |
1868 | <tr> | |
1869 | <td colspan='3'><b>$Lang::tr{'advproxy NTLM auth mode'}</b></td> | |
1870 | </tr> | |
1871 | <tr> | |
1872 | <td width='25%' class='base' width='25%'>$Lang::tr{'advproxy NTLM use integrated auth'}:</td> | |
1873 | <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked{'NTLM_ENABLE_INT_AUTH'}{'on'} /></td> | |
1874 | <td> </td> | |
1875 | </tr> | |
1876 | </table> | |
1877 | <hr size ='1'> | |
1878 | <table width='100%'> | |
1879 | <tr> | |
1880 | <td colspan='4'><b>$Lang::tr{'advproxy NTLM user based access restrictions'}</b></td> | |
1881 | </tr> | |
1882 | <tr> | |
1883 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
1884 | <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked{'NTLM_ENABLE_ACL'}{'on'} /></td> | |
1885 | <td width='25%'> </td> | |
1886 | <td width='30%'> </td> | |
1887 | </tr> | |
1888 | <tr> | |
1889 | <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked{'NTLM_USER_ACL'}{'positive'} /> | |
1890 | $Lang::tr{'advproxy NTLM use positive access list'}:</td> | |
1891 | <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked{'NTLM_USER_ACL'}{'negative'} /> | |
1892 | $Lang::tr{'advproxy NTLM use negative access list'}:</td> | |
1893 | </tr> | |
1894 | <tr> | |
1895 | <td colspan='2'>$Lang::tr{'advproxy NTLM authorized users'}</td> | |
1896 | <td colspan='2'>$Lang::tr{'advproxy NTLM unauthorized users'}</td> | |
1897 | </tr> | |
1898 | <tr> | |
363fb6af | 1899 | <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1900 | END |
1901 | ; } | |
1902 | ||
1903 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_ALLOW_USERS'}; } | |
1904 | ||
1905 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END | |
1906 | </textarea></td> | |
363fb6af | 1907 | <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1908 | END |
1909 | ; } | |
1910 | ||
1911 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_DENY_USERS'}; } | |
1912 | ||
1913 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END | |
1914 | </textarea></td> | |
1915 | </tr> | |
1916 | </table> | |
1917 | END | |
1918 | ; } | |
1919 | ||
1920 | # =================================================================== | |
1921 | # LDAP auth settings | |
1922 | # =================================================================== | |
1923 | ||
1924 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') { | |
1925 | print <<END | |
1926 | <hr size='1'> | |
1927 | <table width='100%'> | |
1928 | <tr> | |
1929 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP common settings'}</b></td> | |
1930 | </tr> | |
1931 | <tr> | |
1932 | <td class='base'>$Lang::tr{'advproxy LDAP basedn'}:</td> | |
1933 | <td><input type='text' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}' size='37' /></td> | |
1934 | <td class='base'>$Lang::tr{'advproxy LDAP type'}:</td> | |
1935 | <td class='base'><select name='LDAP_TYPE'> | |
1936 | <option value='ADS' $selected{'LDAP_TYPE'}{'ADS'}>$Lang::tr{'advproxy LDAP ADS'}</option> | |
1937 | <option value='NDS' $selected{'LDAP_TYPE'}{'NDS'}>$Lang::tr{'advproxy LDAP NDS'}</option> | |
1938 | <option value='V2' $selected{'LDAP_TYPE'}{'V2'}>$Lang::tr{'advproxy LDAP V2'}</option> | |
1939 | <option value='V3' $selected{'LDAP_TYPE'}{'V3'}>$Lang::tr{'advproxy LDAP V3'}</option> | |
1940 | </select></td> | |
1941 | </tr> | |
1942 | <tr> | |
1943 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP server'}:</td> | |
1944 | <td width='40%'><input type='text' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}' size='14' /></td> | |
1945 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP port'}:</td> | |
1946 | <td><input type='text' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}' size='3' /></td> | |
1947 | </tr> | |
1948 | </table> | |
1949 | <hr size ='1'> | |
1950 | <table width='100%'> | |
1951 | <tr> | |
1952 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP binddn settings'}</b></td> | |
1953 | </tr> | |
1954 | <tr> | |
1955 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn username'}:</td> | |
1956 | <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}' size='37' /></td> | |
1957 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn password'}:</td> | |
1958 | <td><input type='password' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}' size='14' /></td> | |
1959 | </tr> | |
1960 | </table> | |
1961 | <hr size ='1'> | |
1962 | <table width='100%'> | |
1963 | <tr> | |
1964 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP group access control'}</b></td> | |
1965 | </tr> | |
1966 | <tr> | |
1967 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP group required'}: <img src='/blob.gif' alt='*' /></td> | |
1968 | <td width='40%'><input type='text' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}' size='37' /></td> | |
1969 | <td> </td> | |
1970 | <td> </td> | |
1971 | </tr> | |
1972 | </table> | |
1973 | END | |
1974 | ; } | |
1975 | ||
1976 | # =================================================================== | |
1977 | # RADIUS auth settings | |
1978 | # =================================================================== | |
1979 | ||
1980 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { | |
1981 | print <<END | |
1982 | <hr size='1'> | |
1983 | <table width='100%'> | |
1984 | <tr> | |
1985 | <td colspan='4'><b>$Lang::tr{'advproxy RADIUS radius settings'}</b></td> | |
1986 | </tr> | |
1987 | <tr> | |
1988 | <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS server'}:</td> | |
1989 | <td width='20%'><input type='text' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}' size='14' /></td> | |
1990 | <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS port'}:</td> | |
1991 | <td width='30%'><input type='text' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}' size='3' /></td> | |
1992 | </tr> | |
1993 | <tr> | |
1994 | <td class='base'>$Lang::tr{'advproxy RADIUS identifier'}: <img src='/blob.gif' alt='*' /></td> | |
1995 | <td><input type='text' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}' size='14' /></td> | |
1996 | <td class='base'>$Lang::tr{'advproxy RADIUS secret'}:</td> | |
1997 | <td><input type='password' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}' size='14' /></td> | |
1998 | </tr> | |
1999 | </table> | |
2000 | <hr size ='1'> | |
2001 | <table width='100%'> | |
2002 | <tr> | |
2003 | <td colspan='4'><b>$Lang::tr{'advproxy RADIUS user based access restrictions'}</b></td> | |
2004 | </tr> | |
2005 | <tr> | |
2006 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
2007 | <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked{'RADIUS_ENABLE_ACL'}{'on'} /></td> | |
2008 | <td width='25%'> </td> | |
2009 | <td width='30%'> </td> | |
2010 | </tr> | |
2011 | <tr> | |
2012 | <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked{'RADIUS_USER_ACL'}{'positive'} /> | |
2013 | $Lang::tr{'advproxy RADIUS use positive access list'}:</td> | |
2014 | <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked{'RADIUS_USER_ACL'}{'negative'} /> | |
2015 | $Lang::tr{'advproxy RADIUS use negative access list'}:</td> | |
2016 | </tr> | |
2017 | <tr> | |
2018 | <td colspan='2'>$Lang::tr{'advproxy RADIUS authorized users'}</td> | |
2019 | <td colspan='2'>$Lang::tr{'advproxy RADIUS unauthorized users'}</td> | |
2020 | </tr> | |
2021 | <tr> | |
363fb6af | 2022 | <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
2023 | END |
2024 | ; } | |
2025 | ||
2026 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_ALLOW_USERS'}; } | |
2027 | ||
2028 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END | |
2029 | </textarea></td> | |
363fb6af | 2030 | <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
2031 | END |
2032 | ; } | |
2033 | ||
2034 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_DENY_USERS'}; } | |
2035 | ||
2036 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END | |
2037 | </textarea></td> | |
2038 | </tr> | |
2039 | </table> | |
2040 | END | |
2041 | ; } | |
2042 | ||
2043 | # =================================================================== | |
2044 | ||
2045 | } | |
2046 | ||
2047 | print "<table>\n"; | |
2048 | ||
2049 | if ($proxysettings{'AUTH_METHOD'} eq 'none') { | |
2050 | print <<END | |
2051 | <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td> | |
2052 | <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
2053 | <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
2054 | <td><input type='hidden' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td> | |
2055 | <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value='$proxysettings{'AUTH_ALWAYS_REQUIRED'}'></td> | |
2056 | <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td> | |
2057 | <td><input type='hidden' name='DST_NOAUTH' value='$proxysettings{'DST_NOAUTH'}'></td> | |
2058 | END | |
2059 | ; } | |
2060 | ||
2061 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { | |
2062 | print <<END | |
2063 | <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td> | |
2064 | <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
2065 | <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
2066 | <td><input type='hidden' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td> | |
2067 | <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td> | |
2068 | END | |
2069 | ; } | |
2070 | ||
2071 | if (!($proxysettings{'AUTH_METHOD'} eq 'ncsa')) { | |
2072 | print <<END | |
2073 | <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td> | |
2074 | <td><input type='hidden' name='NCSA_BYPASS_REDIR' value='$proxysettings{'NCSA_BYPASS_REDIR'}'></td> | |
2075 | END | |
2076 | ; } | |
2077 | ||
2078 | if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { | |
2079 | print <<END | |
2080 | <td><input type='hidden' name='IDENT_REQUIRED' value='$proxysettings{'IDENT_REQUIRED'}'></td> | |
2081 | <td><input type='hidden' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}'></td> | |
2082 | <td><input type='hidden' name='IDENT_HOSTS' value='$proxysettings{'IDENT_HOSTS'}'></td> | |
2083 | <td><input type='hidden' name='IDENT_ENABLE_ACL' value='$proxysettings{'IDENT_ENABLE_ACL'}'></td> | |
2084 | <td><input type='hidden' name='IDENT_USER_ACL' value='$proxysettings{'IDENT_USER_ACL'}'></td> | |
2085 | <td><input type='hidden' name='IDENT_ALLOW_USERS' value='$proxysettings{'IDENT_ALLOW_USERS'}'></td> | |
2086 | <td><input type='hidden' name='IDENT_DENY_USERS' value='$proxysettings{'IDENT_DENY_USERS'}'></td> | |
2087 | END | |
2088 | ; } | |
2089 | ||
2090 | if (!($proxysettings{'AUTH_METHOD'} eq 'ldap')) { | |
2091 | print <<END | |
2092 | <td><input type='hidden' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}'></td> | |
2093 | <td><input type='hidden' name='LDAP_TYPE' value='$proxysettings{'LDAP_TYPE'}'></td> | |
2094 | <td><input type='hidden' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}'></td> | |
2095 | <td><input type='hidden' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}'></td> | |
2096 | <td><input type='hidden' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}'></td> | |
2097 | <td><input type='hidden' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}'></td> | |
2098 | <td><input type='hidden' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}'></td> | |
2099 | END | |
2100 | ; } | |
2101 | ||
2102 | if (!($proxysettings{'AUTH_METHOD'} eq 'ntlm')) { | |
2103 | print <<END | |
2104 | <td><input type='hidden' name='NTLM_DOMAIN' value='$proxysettings{'NTLM_DOMAIN'}'></td> | |
2105 | <td><input type='hidden' name='NTLM_PDC' value='$proxysettings{'NTLM_PDC'}'></td> | |
2106 | <td><input type='hidden' name='NTLM_BDC' value='$proxysettings{'NTLM_BDC'}'></td> | |
2107 | <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value='$proxysettings{'NTLM_ENABLE_INT_AUTH'}'></td> | |
2108 | <td><input type='hidden' name='NTLM_ENABLE_ACL' value='$proxysettings{'NTLM_ENABLE_ACL'}'></td> | |
2109 | <td><input type='hidden' name='NTLM_USER_ACL' value='$proxysettings{'NTLM_USER_ACL'}'></td> | |
2110 | <td><input type='hidden' name='NTLM_ALLOW_USERS' value='$proxysettings{'NTLM_ALLOW_USERS'}'></td> | |
2111 | <td><input type='hidden' name='NTLM_DENY_USERS' value='$proxysettings{'NTLM_DENY_USERS'}'></td> | |
2112 | END | |
2113 | ; } | |
2114 | ||
2115 | if (!($proxysettings{'AUTH_METHOD'} eq 'radius')) { | |
2116 | print <<END | |
2117 | <td><input type='hidden' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}'></td> | |
2118 | <td><input type='hidden' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}'></td> | |
2119 | <td><input type='hidden' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}'></td> | |
2120 | <td><input type='hidden' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}'></td> | |
2121 | <td><input type='hidden' name='RADIUS_ENABLE_ACL' value='$proxysettings{'RADIUS_ENABLE_ACL'}'></td> | |
2122 | <td><input type='hidden' name='RADIUS_USER_ACL' value='$proxysettings{'RADIUS_USER_ACL'}'></td> | |
2123 | <td><input type='hidden' name='RADIUS_ALLOW_USERS' value='$proxysettings{'RADIUS_ALLOW_USERS'}'></td> | |
2124 | <td><input type='hidden' name='RADIUS_DENY_USERS' value='$proxysettings{'RADIUS_DENY_USERS'}'></td> | |
2125 | END | |
2126 | ; } | |
2127 | ||
2128 | print "</table>\n"; | |
2129 | ||
2130 | print <<END | |
2131 | <hr size='1'> | |
2132 | END | |
2133 | ; | |
2134 | ||
2135 | print <<END | |
2136 | <table width='100%'> | |
2137 | <tr> | |
363fb6af | 2138 | <td> </td> |
ed38f89d | 2139 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td> |
fe1656d2 | 2140 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'proxy reconfigure'}' /></td> |
ed38f89d | 2141 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy save and restart'}' /></td> |
363fb6af MT |
2142 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy clear cache'}' /></td> |
2143 | <td> </td> | |
ed38f89d MT |
2144 | </tr> |
2145 | ||
2146 | </table> | |
2147 | <br /> | |
2148 | <table width='100%'> | |
2149 | <tr> | |
2150 | <td><img src='/blob.gif' align='top' alt='*' /> | |
2151 | <font class='base'>$Lang::tr{'this field may be blank'}</font> | |
2152 | </td> | |
363fb6af | 2153 | <td align='right'> </td> |
ed38f89d MT |
2154 | </tr> |
2155 | </table> | |
2156 | </form> | |
2157 | END | |
2158 | ; | |
2159 | ||
2160 | &Header::closebox(); | |
2161 | ||
2162 | } else { | |
2163 | ||
2164 | # =================================================================== | |
2165 | # NCSA user management | |
2166 | # =================================================================== | |
2167 | ||
2168 | &Header::openbox('100%', 'left', "$Lang::tr{'advproxy NCSA auth'}"); | |
2169 | print <<END | |
2170 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
2171 | <table width='100%'> | |
2172 | <tr> | |
363fb6af | 2173 | <td colspan='4'><b>$Lang::tr{'advproxy NCSA user management'}</b></td> |
ed38f89d MT |
2174 | </tr> |
2175 | <tr> | |
2176 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA username'}:</td> | |
2177 | <td width='25%'><input type='text' name='NCSA_USERNAME' value='$proxysettings{'NCSA_USERNAME'}' size='12' | |
2178 | END | |
2179 | ; | |
2180 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly "; } | |
2181 | print <<END | |
2182 | /></td> | |
2183 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA group'}:</td> | |
2184 | <td class='base'> | |
2185 | <select name='NCSA_GROUP'> | |
2186 | <option value='standard' $selected{'NCSA_GROUP'}{'standard'}>$Lang::tr{'advproxy NCSA grp standard'}</option> | |
2187 | <option value='extended' $selected{'NCSA_GROUP'}{'extended'}>$Lang::tr{'advproxy NCSA grp extended'}</option> | |
2188 | <option value='disabled' $selected{'NCSA_GROUP'}{'disabled'}>$Lang::tr{'advproxy NCSA grp disabled'}</option> | |
2189 | </select> | |
2190 | </td> | |
2191 | ||
2192 | </tr> | |
2193 | <tr> | |
2194 | <td class='base'>$Lang::tr{'advproxy NCSA password'}:</td> | |
2195 | <td><input type='password' name='NCSA_PASS' value='$proxysettings{'NCSA_PASS'}' size='14' /></td> | |
2196 | <td class='base'>$Lang::tr{'advproxy NCSA password confirm'}:</td> | |
2197 | <td><input type='password' name='NCSA_PASS_CONFIRM' value='$proxysettings{'NCSA_PASS_CONFIRM'}' size='14' /></td> | |
2198 | </tr> | |
2199 | </table> | |
2200 | <br> | |
2201 | <table> | |
2202 | <tr> | |
2203 | <td> </td> | |
2204 | <td><input type='submit' name='SUBMIT' value='$ncsa_buttontext' /></td> | |
2205 | <td><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /></td> | |
2206 | <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td> | |
2207 | END | |
2208 | ; | |
2209 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { | |
2210 | print "<td><input type='reset' name='ACTION' value='$Lang::tr{'advproxy reset'}' /></td>\n"; | |
2211 | } | |
2212 | ||
2213 | print <<END | |
2214 | <td> </td> | |
2215 | <td> </td> | |
2216 | <td><input type='button' name='return2main' value='$Lang::tr{'advproxy back to main page'}' onClick='self.location.href="$ENV{'SCRIPT_NAME'}"'></td> | |
2217 | </tr> | |
2218 | </table> | |
2219 | </form> | |
2220 | <hr size='1'> | |
2221 | <table width='100%'> | |
2222 | <tr> | |
363fb6af | 2223 | <td><b>$Lang::tr{'advproxy NCSA user accounts'}:</b></td> |
ed38f89d MT |
2224 | </tr> |
2225 | </table> | |
2226 | <table width='100%' align='center'> | |
2227 | END | |
2228 | ; | |
2229 | ||
2230 | if (-e $extgrp) | |
2231 | { | |
2232 | open(FILE, $extgrp); @grouplist = <FILE>; close(FILE); | |
2233 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":extended"); } | |
2234 | } | |
2235 | if (-e $stdgrp) | |
2236 | { | |
2237 | open(FILE, $stdgrp); @grouplist = <FILE>; close(FILE); | |
2238 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":standard"); } | |
2239 | } | |
2240 | if (-e $disgrp) | |
2241 | { | |
2242 | open(FILE, $disgrp); @grouplist = <FILE>; close(FILE); | |
2243 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":disabled"); } | |
2244 | } | |
2245 | ||
2246 | @userlist = sort(@userlist); | |
2247 | ||
2248 | # If the password file contains entries, print entries and action icons | |
2249 | ||
488d1b7c | 2250 | if ( ! -z "$userdb" ) { |
ed38f89d MT |
2251 | print <<END |
2252 | <tr> | |
2253 | <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA username'}</i></b></td> | |
2254 | <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA group membership'}</i></b></td> | |
2255 | <td class='boldbase' colspan='2' align='center'> </td> | |
2256 | </tr> | |
2257 | END | |
2258 | ; | |
2259 | $id = 0; | |
2260 | foreach $line (@userlist) | |
2261 | { | |
2262 | $id++; | |
2263 | chomp($line); | |
2264 | @temp = split(/:/,$line); | |
2265 | if($proxysettings{'ACTION'} eq $Lang::tr{'edit'} && $proxysettings{'ID'} eq $line) { | |
2266 | print "<tr bgcolor='$Header::colouryellow'>\n"; } | |
2267 | elsif ($id % 2) { | |
4e17adad | 2268 | print "<tr bgcolor='$color{'color20'}'>\n"; } |
ed38f89d | 2269 | else { |
4e17adad | 2270 | print "<tr bgcolor='$color{'color22'}'>\n"; } |
ed38f89d MT |
2271 | |
2272 | print <<END | |
2273 | <td align='center'>$temp[0]</td> | |
2274 | <td align='center'> | |
2275 | END | |
2276 | ; | |
2277 | if ($temp[1] eq 'standard') { | |
2278 | print $Lang::tr{'advproxy NCSA grp standard'}; | |
2279 | } elsif ($temp[1] eq 'extended') { | |
2280 | print $Lang::tr{'advproxy NCSA grp extended'}; | |
2281 | } elsif ($temp[1] eq 'disabled') { | |
2282 | print $Lang::tr{'advproxy NCSA grp disabled'}; } | |
2283 | print <<END | |
2284 | </td> | |
2285 | <td width='8%' align='center'> | |
2286 | <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'> | |
2287 | <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' title='$Lang::tr{'edit'}' alt='$Lang::tr{'edit'}' /> | |
2288 | <input type='hidden' name='ID' value='$line' /> | |
2289 | <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' /> | |
2290 | </form> | |
2291 | </td> | |
2292 | ||
2293 | <td width='8%' align='center'> | |
2294 | <form method='post' name='frmb$id' action='$ENV{'SCRIPT_NAME'}'> | |
2295 | <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' title='$Lang::tr{'remove'}' alt='$Lang::tr{'remove'}' /> | |
2296 | <input type='hidden' name='ID' value='$temp[0]' /> | |
2297 | <input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' /> | |
2298 | </form> | |
2299 | </td> | |
2300 | </tr> | |
2301 | END | |
2302 | ; | |
2303 | } | |
2304 | ||
2305 | print <<END | |
2306 | </table> | |
2307 | <br> | |
9fb25b1c | 2308 | <table> |
ed38f89d MT |
2309 | <tr> |
2310 | <td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td> | |
2311 | <td> <img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td> | |
2312 | <td class='base'>$Lang::tr{'edit'}</td> | |
2313 | <td> <img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td> | |
2314 | <td class='base'>$Lang::tr{'remove'}</td> | |
2315 | </tr> | |
2316 | END | |
2317 | ; | |
2318 | } else { | |
2319 | print <<END | |
2320 | <tr> | |
363fb6af | 2321 | <td><i>$Lang::tr{'advproxy NCSA no accounts'}</i></td> |
ed38f89d MT |
2322 | </tr> |
2323 | END | |
2324 | ; | |
2325 | } | |
2326 | ||
2327 | print <<END | |
2328 | </table> | |
2329 | END | |
2330 | ; | |
2331 | ||
2332 | &Header::closebox(); | |
2333 | ||
2334 | } | |
2335 | ||
2336 | # =================================================================== | |
2337 | ||
2338 | &Header::closebigbox(); | |
2339 | ||
2340 | &Header::closepage(); | |
2341 | ||
2342 | # ------------------------------------------------------------------- | |
2343 | ||
2344 | sub read_acls | |
2345 | { | |
2346 | if (-e "$acl_src_subnets") { | |
2347 | open(FILE,"$acl_src_subnets"); | |
2348 | delete $proxysettings{'SRC_SUBNETS'}; | |
2349 | while (<FILE>) { $proxysettings{'SRC_SUBNETS'} .= $_ }; | |
2350 | close(FILE); | |
2351 | } | |
2352 | if (-e "$acl_src_banned_ip") { | |
2353 | open(FILE,"$acl_src_banned_ip"); | |
2354 | delete $proxysettings{'SRC_BANNED_IP'}; | |
2355 | while (<FILE>) { $proxysettings{'SRC_BANNED_IP'} .= $_ }; | |
2356 | close(FILE); | |
2357 | } | |
2358 | if (-e "$acl_src_banned_mac") { | |
2359 | open(FILE,"$acl_src_banned_mac"); | |
2360 | delete $proxysettings{'SRC_BANNED_MAC'}; | |
2361 | while (<FILE>) { $proxysettings{'SRC_BANNED_MAC'} .= $_ }; | |
2362 | close(FILE); | |
2363 | } | |
2364 | if (-e "$acl_src_unrestricted_ip") { | |
2365 | open(FILE,"$acl_src_unrestricted_ip"); | |
2366 | delete $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2367 | while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_ }; | |
2368 | close(FILE); | |
2369 | } | |
2370 | if (-e "$acl_src_unrestricted_mac") { | |
2371 | open(FILE,"$acl_src_unrestricted_mac"); | |
2372 | delete $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2373 | while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_ }; | |
2374 | close(FILE); | |
2375 | } | |
2376 | if (-e "$acl_dst_nocache") { | |
2377 | open(FILE,"$acl_dst_nocache"); | |
2378 | delete $proxysettings{'DST_NOCACHE'}; | |
2379 | while (<FILE>) { $proxysettings{'DST_NOCACHE'} .= $_ }; | |
2380 | close(FILE); | |
2381 | } | |
2382 | if (-e "$acl_dst_noauth") { | |
2383 | open(FILE,"$acl_dst_noauth"); | |
2384 | delete $proxysettings{'DST_NOAUTH'}; | |
2385 | while (<FILE>) { $proxysettings{'DST_NOAUTH'} .= $_ }; | |
2386 | close(FILE); | |
2387 | } | |
363fb6af MT |
2388 | if (-e "$acl_ports_safe") { |
2389 | open(FILE,"$acl_ports_safe"); | |
2390 | delete $proxysettings{'PORTS_SAFE'}; | |
2391 | while (<FILE>) { $proxysettings{'PORTS_SAFE'} .= $_ }; | |
2392 | close(FILE); | |
2393 | } | |
2394 | if (-e "$acl_ports_ssl") { | |
2395 | open(FILE,"$acl_ports_ssl"); | |
2396 | delete $proxysettings{'PORTS_SSL'}; | |
2397 | while (<FILE>) { $proxysettings{'PORTS_SSL'} .= $_ }; | |
2398 | close(FILE); | |
2399 | } | |
ed38f89d MT |
2400 | if (-e "$mimetypes") { |
2401 | open(FILE,"$mimetypes"); | |
2402 | delete $proxysettings{'MIME_TYPES'}; | |
2403 | while (<FILE>) { $proxysettings{'MIME_TYPES'} .= $_ }; | |
2404 | close(FILE); | |
2405 | } | |
2406 | if (-e "$ntlmdir/msntauth.allowusers") { | |
2407 | open(FILE,"$ntlmdir/msntauth.allowusers"); | |
2408 | delete $proxysettings{'NTLM_ALLOW_USERS'}; | |
2409 | while (<FILE>) { $proxysettings{'NTLM_ALLOW_USERS'} .= $_ }; | |
2410 | close(FILE); | |
2411 | } | |
2412 | if (-e "$ntlmdir/msntauth.denyusers") { | |
2413 | open(FILE,"$ntlmdir/msntauth.denyusers"); | |
2414 | delete $proxysettings{'NTLM_DENY_USERS'}; | |
2415 | while (<FILE>) { $proxysettings{'NTLM_DENY_USERS'} .= $_ }; | |
2416 | close(FILE); | |
2417 | } | |
2418 | if (-e "$raddir/radauth.allowusers") { | |
2419 | open(FILE,"$raddir/radauth.allowusers"); | |
2420 | delete $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2421 | while (<FILE>) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_ }; | |
2422 | close(FILE); | |
2423 | } | |
2424 | if (-e "$raddir/radauth.denyusers") { | |
2425 | open(FILE,"$raddir/radauth.denyusers"); | |
2426 | delete $proxysettings{'RADIUS_DENY_USERS'}; | |
2427 | while (<FILE>) { $proxysettings{'RADIUS_DENY_USERS'} .= $_ }; | |
2428 | close(FILE); | |
2429 | } | |
2430 | if (-e "$identdir/identauth.allowusers") { | |
2431 | open(FILE,"$identdir/identauth.allowusers"); | |
2432 | delete $proxysettings{'IDENT_ALLOW_USERS'}; | |
2433 | while (<FILE>) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_ }; | |
2434 | close(FILE); | |
2435 | } | |
2436 | if (-e "$identdir/identauth.denyusers") { | |
2437 | open(FILE,"$identdir/identauth.denyusers"); | |
2438 | delete $proxysettings{'IDENT_DENY_USERS'}; | |
2439 | while (<FILE>) { $proxysettings{'IDENT_DENY_USERS'} .= $_ }; | |
2440 | close(FILE); | |
2441 | } | |
2442 | if (-e "$identhosts") { | |
2443 | open(FILE,"$identhosts"); | |
2444 | delete $proxysettings{'IDENT_HOSTS'}; | |
2445 | while (<FILE>) { $proxysettings{'IDENT_HOSTS'} .= $_ }; | |
2446 | close(FILE); | |
2447 | } | |
2448 | if (-e "$cre_groups") { | |
2449 | open(FILE,"$cre_groups"); | |
2450 | delete $proxysettings{'CRE_GROUPS'}; | |
2451 | while (<FILE>) { $proxysettings{'CRE_GROUPS'} .= $_ }; | |
2452 | close(FILE); | |
2453 | } | |
2454 | if (-e "$cre_svhosts") { | |
2455 | open(FILE,"$cre_svhosts"); | |
2456 | delete $proxysettings{'CRE_SVHOSTS'}; | |
2457 | while (<FILE>) { $proxysettings{'CRE_SVHOSTS'} .= $_ }; | |
2458 | close(FILE); | |
2459 | } | |
2460 | } | |
2461 | ||
2462 | # ------------------------------------------------------------------- | |
2463 | ||
2464 | sub check_acls | |
2465 | { | |
363fb6af MT |
2466 | @temp = split(/\n/,$proxysettings{'PORTS_SAFE'}); |
2467 | undef $proxysettings{'PORTS_SAFE'}; | |
2468 | foreach (@temp) | |
2469 | { | |
2470 | s/^\s+//g; s/\s+$//g; | |
2471 | if ($_) | |
2472 | { | |
2473 | $line = $_; | |
2474 | if (/^[^#]+\s+#\sSquids\sport/) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/; $line=$_; } | |
2475 | s/#.*//g; s/\s+//g; | |
2476 | if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } | |
2477 | @templist = split(/-/); | |
2478 | foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } } | |
2479 | $proxysettings{'PORTS_SAFE'} .= $line."\n"; | |
2480 | } | |
2481 | } | |
2482 | ||
2483 | @temp = split(/\n/,$proxysettings{'PORTS_SSL'}); | |
2484 | undef $proxysettings{'PORTS_SSL'}; | |
2485 | foreach (@temp) | |
2486 | { | |
2487 | s/^\s+//g; s/\s+$//g; | |
2488 | if ($_) | |
2489 | { | |
2490 | $line = $_; | |
2491 | s/#.*//g; s/\s+//g; | |
2492 | if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } | |
2493 | @templist = split(/-/); | |
2494 | foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } } | |
2495 | $proxysettings{'PORTS_SSL'} .= $line."\n"; | |
2496 | } | |
2497 | } | |
2498 | ||
2499 | @temp = split(/\n/,$proxysettings{'DST_NOCACHE'}); | |
2500 | undef $proxysettings{'DST_NOCACHE'}; | |
2501 | foreach (@temp) | |
2502 | { | |
488d1b7c CS |
2503 | s/^\s+//g; |
2504 | unless (/^#/) { s/\s+//g; } | |
363fb6af MT |
2505 | if ($_) |
2506 | { | |
488d1b7c | 2507 | if (/^\./) { $_ = '*'.$_; } |
363fb6af MT |
2508 | $proxysettings{'DST_NOCACHE'} .= $_."\n"; |
2509 | } | |
2510 | } | |
2511 | ||
ed38f89d MT |
2512 | @temp = split(/\n/,$proxysettings{'SRC_SUBNETS'}); |
2513 | undef $proxysettings{'SRC_SUBNETS'}; | |
2514 | foreach (@temp) | |
2515 | { | |
2516 | s/^\s+//g; s/\s+$//g; | |
2517 | if ($_) | |
2518 | { | |
2519 | unless (&General::validipandmask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2520 | $proxysettings{'SRC_SUBNETS'} .= $_."\n"; | |
2521 | } | |
2522 | } | |
2523 | ||
2524 | @temp = split(/\n/,$proxysettings{'SRC_BANNED_IP'}); | |
2525 | undef $proxysettings{'SRC_BANNED_IP'}; | |
2526 | foreach (@temp) | |
2527 | { | |
2528 | s/^\s+//g; s/\s+$//g; | |
2529 | if ($_) | |
2530 | { | |
2531 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2532 | $proxysettings{'SRC_BANNED_IP'} .= $_."\n"; | |
2533 | } | |
2534 | } | |
2535 | ||
2536 | @temp = split(/\n/,$proxysettings{'SRC_BANNED_MAC'}); | |
2537 | undef $proxysettings{'SRC_BANNED_MAC'}; | |
2538 | foreach (@temp) | |
2539 | { | |
2540 | s/^\s+//g; s/\s+$//g; s/-/:/g; | |
2541 | if ($_) | |
2542 | { | |
2543 | unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; } | |
2544 | $proxysettings{'SRC_BANNED_MAC'} .= $_."\n"; | |
2545 | } | |
2546 | } | |
2547 | ||
2548 | @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_IP'}); | |
2549 | undef $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2550 | foreach (@temp) | |
2551 | { | |
2552 | s/^\s+//g; s/\s+$//g; | |
2553 | if ($_) | |
2554 | { | |
2555 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2556 | $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_."\n"; | |
2557 | } | |
2558 | } | |
2559 | ||
2560 | @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_MAC'}); | |
2561 | undef $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2562 | foreach (@temp) | |
2563 | { | |
2564 | s/^\s+//g; s/\s+$//g; s/-/:/g; | |
2565 | if ($_) | |
2566 | { | |
2567 | unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; } | |
2568 | $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_."\n"; | |
2569 | } | |
2570 | } | |
2571 | ||
363fb6af | 2572 | @temp = split(/\n/,$proxysettings{'DST_NOAUTH'}); |
37273bc6 | 2573 | undef $proxysettings{'DST_NOAUTH'}; |
363fb6af MT |
2574 | foreach (@temp) |
2575 | { | |
488d1b7c CS |
2576 | s/^\s+//g; |
2577 | unless (/^#/) { s/\s+//g; } | |
363fb6af MT |
2578 | if ($_) |
2579 | { | |
488d1b7c | 2580 | if (/^\./) { $_ = '*'.$_; } |
363fb6af MT |
2581 | $proxysettings{'DST_NOAUTH'} .= $_."\n"; |
2582 | } | |
2583 | } | |
2584 | ||
ed38f89d MT |
2585 | if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'positive')) |
2586 | { | |
2587 | @temp = split(/\n/,$proxysettings{'NTLM_ALLOW_USERS'}); | |
2588 | undef $proxysettings{'NTLM_ALLOW_USERS'}; | |
2589 | foreach (@temp) | |
2590 | { | |
2591 | s/^\s+//g; s/\s+$//g; | |
2592 | if ($_) { $proxysettings{'NTLM_ALLOW_USERS'} .= $_."\n"; } | |
2593 | } | |
2594 | if ($proxysettings{'NTLM_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2595 | } | |
2596 | ||
2597 | if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'negative')) | |
2598 | { | |
2599 | @temp = split(/\n/,$proxysettings{'NTLM_DENY_USERS'}); | |
2600 | undef $proxysettings{'NTLM_DENY_USERS'}; | |
2601 | foreach (@temp) | |
2602 | { | |
2603 | s/^\s+//g; s/\s+$//g; | |
2604 | if ($_) { $proxysettings{'NTLM_DENY_USERS'} .= $_."\n"; } | |
2605 | } | |
2606 | if ($proxysettings{'NTLM_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2607 | } | |
2608 | ||
2609 | if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'positive')) | |
2610 | { | |
2611 | @temp = split(/\n/,$proxysettings{'IDENT_ALLOW_USERS'}); | |
2612 | undef $proxysettings{'IDENT_ALLOW_USERS'}; | |
2613 | foreach (@temp) | |
2614 | { | |
2615 | s/^\s+//g; s/\s+$//g; | |
2616 | if ($_) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_."\n"; } | |
2617 | } | |
2618 | if ($proxysettings{'IDENT_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2619 | } | |
2620 | ||
2621 | if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'negative')) | |
2622 | { | |
2623 | @temp = split(/\n/,$proxysettings{'IDENT_DENY_USERS'}); | |
2624 | undef $proxysettings{'IDENT_DENY_USERS'}; | |
2625 | foreach (@temp) | |
2626 | { | |
2627 | s/^\s+//g; s/\s+$//g; | |
2628 | if ($_) { $proxysettings{'IDENT_DENY_USERS'} .= $_."\n"; } | |
2629 | } | |
2630 | if ($proxysettings{'IDENT_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2631 | } | |
2632 | ||
2633 | if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive')) | |
2634 | { | |
2635 | @temp = split(/\n/,$proxysettings{'RADIUS_ALLOW_USERS'}); | |
2636 | undef $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2637 | foreach (@temp) | |
2638 | { | |
2639 | s/^\s+//g; s/\s+$//g; | |
2640 | if ($_) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_."\n"; } | |
2641 | } | |
2642 | if ($proxysettings{'RADIUS_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2643 | } | |
2644 | ||
2645 | if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative')) | |
2646 | { | |
2647 | @temp = split(/\n/,$proxysettings{'RADIUS_DENY_USERS'}); | |
2648 | undef $proxysettings{'RADIUS_DENY_USERS'}; | |
2649 | foreach (@temp) | |
2650 | { | |
2651 | s/^\s+//g; s/\s+$//g; | |
2652 | if ($_) { $proxysettings{'RADIUS_DENY_USERS'} .= $_."\n"; } | |
2653 | } | |
2654 | if ($proxysettings{'RADIUS_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2655 | } | |
2656 | ||
2657 | @temp = split(/\n/,$proxysettings{'IDENT_HOSTS'}); | |
2658 | undef $proxysettings{'IDENT_HOSTS'}; | |
2659 | foreach (@temp) | |
2660 | { | |
2661 | s/^\s+//g; s/\s+$//g; | |
2662 | if ($_) | |
2663 | { | |
2664 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2665 | $proxysettings{'IDENT_HOSTS'} .= $_."\n"; | |
2666 | } | |
2667 | } | |
2668 | ||
2669 | @temp = split(/\n/,$proxysettings{'CRE_SVHOSTS'}); | |
2670 | undef $proxysettings{'CRE_SVHOSTS'}; | |
2671 | foreach (@temp) | |
2672 | { | |
2673 | s/^\s+//g; s/\s+$//g; | |
2674 | if ($_) | |
2675 | { | |
2676 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2677 | $proxysettings{'CRE_SVHOSTS'} .= $_."\n"; | |
2678 | } | |
2679 | } | |
2680 | } | |
2681 | ||
ed38f89d MT |
2682 | # ------------------------------------------------------------------- |
2683 | ||
2684 | sub write_acls | |
2685 | { | |
2686 | open(FILE, ">$acl_src_subnets"); | |
2687 | flock(FILE, 2); | |
363fb6af MT |
2688 | if (!$proxysettings{'SRC_SUBNETS'}) |
2689 | { | |
2690 | print FILE "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n"; | |
2691 | if ($netsettings{'BLUE_DEV'}) | |
2692 | { | |
2693 | print FILE "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n"; | |
2694 | } | |
2695 | } else { print FILE $proxysettings{'SRC_SUBNETS'}; } | |
ed38f89d MT |
2696 | close(FILE); |
2697 | ||
2698 | open(FILE, ">$acl_src_banned_ip"); | |
2699 | flock(FILE, 2); | |
2700 | print FILE $proxysettings{'SRC_BANNED_IP'}; | |
2701 | close(FILE); | |
2702 | ||
2703 | open(FILE, ">$acl_src_banned_mac"); | |
2704 | flock(FILE, 2); | |
2705 | print FILE $proxysettings{'SRC_BANNED_MAC'}; | |
2706 | close(FILE); | |
2707 | ||
2708 | open(FILE, ">$acl_src_unrestricted_ip"); | |
2709 | flock(FILE, 2); | |
2710 | print FILE $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2711 | close(FILE); | |
2712 | ||
2713 | open(FILE, ">$acl_src_unrestricted_mac"); | |
2714 | flock(FILE, 2); | |
2715 | print FILE $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2716 | close(FILE); | |
2717 | ||
488d1b7c CS |
2718 | open(FILE, ">$acl_dst_noauth"); |
2719 | flock(FILE, 2); | |
2720 | print FILE $proxysettings{'DST_NOAUTH'}; | |
2721 | close(FILE); | |
2722 | ||
2723 | open(FILE, ">$acl_dst_noauth_net"); | |
2724 | close(FILE); | |
2725 | open(FILE, ">$acl_dst_noauth_dom"); | |
2726 | close(FILE); | |
2727 | open(FILE, ">$acl_dst_noauth_url"); | |
2728 | close(FILE); | |
2729 | ||
2730 | @temp = split(/\n/,$proxysettings{'DST_NOAUTH'}); | |
2731 | foreach(@temp) | |
2732 | { | |
2733 | unless (/^#/) | |
2734 | { | |
2735 | if (/^\*\.\w/) | |
2736 | { | |
2737 | s/^\*//; | |
2738 | open(FILE, ">>$acl_dst_noauth_dom"); | |
2739 | flock(FILE, 2); | |
2740 | print FILE "$_\n"; | |
2741 | close(FILE); | |
2742 | } | |
2743 | elsif (&General::validipormask($_)) | |
2744 | { | |
2745 | open(FILE, ">>$acl_dst_noauth_net"); | |
2746 | flock(FILE, 2); | |
2747 | print FILE "$_\n"; | |
2748 | close(FILE); | |
2749 | } | |
2750 | elsif (/\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/) | |
2751 | { | |
2752 | open(FILE, ">>$acl_dst_noauth_net"); | |
2753 | flock(FILE, 2); | |
2754 | print FILE "$_\n"; | |
2755 | close(FILE); | |
2756 | } | |
2757 | else | |
2758 | { | |
2759 | open(FILE, ">>$acl_dst_noauth_url"); | |
2760 | flock(FILE, 2); | |
2761 | if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; } | |
2762 | close(FILE); | |
2763 | } | |
2764 | } | |
2765 | } | |
2766 | ||
ed38f89d MT |
2767 | open(FILE, ">$acl_dst_nocache"); |
2768 | flock(FILE, 2); | |
2769 | print FILE $proxysettings{'DST_NOCACHE'}; | |
2770 | close(FILE); | |
2771 | ||
488d1b7c CS |
2772 | open(FILE, ">$acl_dst_nocache_net"); |
2773 | close(FILE); | |
2774 | open(FILE, ">$acl_dst_nocache_dom"); | |
2775 | close(FILE); | |
2776 | open(FILE, ">$acl_dst_nocache_url"); | |
ed38f89d MT |
2777 | close(FILE); |
2778 | ||
488d1b7c CS |
2779 | @temp = split(/\n/,$proxysettings{'DST_NOCACHE'}); |
2780 | foreach(@temp) | |
2781 | { | |
2782 | unless (/^#/) | |
2783 | { | |
2784 | if (/^\*\.\w/) | |
2785 | { | |
2786 | s/^\*//; | |
2787 | open(FILE, ">>$acl_dst_nocache_dom"); | |
2788 | flock(FILE, 2); | |
2789 | print FILE "$_\n"; | |
2790 | close(FILE); | |
2791 | } | |
2792 | elsif (&General::validipormask($_)) | |
2793 | { | |
2794 | open(FILE, ">>$acl_dst_nocache_net"); | |
2795 | flock(FILE, 2); | |
2796 | print FILE "$_\n"; | |
2797 | close(FILE); | |
2798 | } | |
2799 | elsif (/\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/) | |
2800 | { | |
2801 | open(FILE, ">>$acl_dst_nocache_net"); | |
2802 | flock(FILE, 2); | |
2803 | print FILE "$_\n"; | |
2804 | close(FILE); | |
2805 | } | |
2806 | else | |
2807 | { | |
2808 | open(FILE, ">>$acl_dst_nocache_url"); | |
2809 | flock(FILE, 2); | |
2810 | if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; } | |
2811 | close(FILE); | |
2812 | } | |
2813 | } | |
2814 | } | |
2815 | ||
363fb6af MT |
2816 | open(FILE, ">$acl_ports_safe"); |
2817 | flock(FILE, 2); | |
2818 | if (!$proxysettings{'PORTS_SAFE'}) { print FILE $def_ports_safe; } else { print FILE $proxysettings{'PORTS_SAFE'}; } | |
2819 | close(FILE); | |
2820 | ||
2821 | open(FILE, ">$acl_ports_ssl"); | |
2822 | flock(FILE, 2); | |
2823 | if (!$proxysettings{'PORTS_SSL'}) { print FILE $def_ports_ssl; } else { print FILE $proxysettings{'PORTS_SSL'}; } | |
2824 | close(FILE); | |
2825 | ||
ed38f89d MT |
2826 | open(FILE, ">$acl_dst_throttle"); |
2827 | flock(FILE, 2); | |
2828 | if ($proxysettings{'THROTTLE_BINARY'} eq 'on') | |
2829 | { | |
2830 | @temp = split(/\|/,$throttle_binary); | |
363fb6af | 2831 | foreach (@temp) { print FILE "\\.$_\$\n"; } |
ed38f89d MT |
2832 | } |
2833 | if ($proxysettings{'THROTTLE_DSKIMG'} eq 'on') | |
2834 | { | |
2835 | @temp = split(/\|/,$throttle_dskimg); | |
363fb6af | 2836 | foreach (@temp) { print FILE "\\.$_\$\n"; } |
ed38f89d MT |
2837 | } |
2838 | if ($proxysettings{'THROTTLE_MMEDIA'} eq 'on') | |
2839 | { | |
2840 | @temp = split(/\|/,$throttle_mmedia); | |
363fb6af | 2841 | foreach (@temp) { print FILE "\\.$_\$\n"; } |
ed38f89d MT |
2842 | } |
2843 | if (-s $throttled_urls) | |
2844 | { | |
2845 | open(URLFILE, $throttled_urls); | |
2846 | @temp = <URLFILE>; | |
2847 | close(URLFILE); | |
363fb6af | 2848 | foreach (@temp) { print FILE; } |
ed38f89d MT |
2849 | } |
2850 | close(FILE); | |
2851 | ||
2852 | open(FILE, ">$mimetypes"); | |
2853 | flock(FILE, 2); | |
2854 | print FILE $proxysettings{'MIME_TYPES'}; | |
2855 | close(FILE); | |
2856 | ||
2857 | open(FILE, ">$ntlmdir/msntauth.allowusers"); | |
2858 | flock(FILE, 2); | |
2859 | print FILE $proxysettings{'NTLM_ALLOW_USERS'}; | |
2860 | close(FILE); | |
2861 | ||
2862 | open(FILE, ">$ntlmdir/msntauth.denyusers"); | |
2863 | flock(FILE, 2); | |
2864 | print FILE $proxysettings{'NTLM_DENY_USERS'}; | |
2865 | close(FILE); | |
2866 | ||
2867 | open(FILE, ">$raddir/radauth.allowusers"); | |
2868 | flock(FILE, 2); | |
2869 | print FILE $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2870 | close(FILE); | |
2871 | ||
2872 | open(FILE, ">$raddir/radauth.denyusers"); | |
2873 | flock(FILE, 2); | |
2874 | print FILE $proxysettings{'RADIUS_DENY_USERS'}; | |
2875 | close(FILE); | |
2876 | ||
2877 | open(FILE, ">$identdir/identauth.allowusers"); | |
2878 | flock(FILE, 2); | |
2879 | print FILE $proxysettings{'IDENT_ALLOW_USERS'}; | |
2880 | close(FILE); | |
2881 | ||
2882 | open(FILE, ">$identdir/identauth.denyusers"); | |
2883 | flock(FILE, 2); | |
2884 | print FILE $proxysettings{'IDENT_DENY_USERS'}; | |
2885 | close(FILE); | |
2886 | ||
2887 | open(FILE, ">$identhosts"); | |
2888 | flock(FILE, 2); | |
2889 | print FILE $proxysettings{'IDENT_HOSTS'}; | |
2890 | close(FILE); | |
2891 | ||
2892 | open(FILE, ">$cre_groups"); | |
2893 | flock(FILE, 2); | |
2894 | print FILE $proxysettings{'CRE_GROUPS'}; | |
2895 | close(FILE); | |
2896 | ||
2897 | open(FILE, ">$cre_svhosts"); | |
2898 | flock(FILE, 2); | |
2899 | print FILE $proxysettings{'CRE_SVHOSTS'}; | |
2900 | close(FILE); | |
2901 | } | |
2902 | ||
2903 | # ------------------------------------------------------------------- | |
2904 | ||
2905 | sub writepacfile | |
2906 | { | |
22527178 | 2907 | open(FILE, ">/srv/web/ipfire/html/proxy.pac"); |
ed38f89d MT |
2908 | flock(FILE, 2); |
2909 | print FILE "function FindProxyForURL(url, host)\n"; | |
2910 | print FILE "{\n"; | |
2911 | if (($proxysettings{'ENABLE'} eq 'on') || ($proxysettings{'ENABLE_BLUE'} eq 'on')) | |
2912 | { | |
2913 | print FILE <<END | |
2914 | if ( | |
2915 | (isPlainHostName(host)) || | |
2916 | (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) || | |
2917 | (isInNet(host, "10.0.0.0", "255.0.0.0")) || | |
2918 | (isInNet(host, "172.16.0.0", "255.240.0.0")) || | |
488d1b7c CS |
2919 | (isInNet(host, "192.168.0.0", "255.255.0.0")) || |
2920 | (isInNet(host, "169.254.0.0", "255.255.0.0")) | |
ed38f89d MT |
2921 | ) |
2922 | return "DIRECT"; | |
2923 | ||
2924 | else | |
2925 | ||
2926 | END | |
2927 | ; | |
2928 | if ($proxysettings{'ENABLE'} eq 'on') | |
2929 | { | |
268292e7 CS |
2930 | print FILE "if (\n"; |
2931 | print FILE " (isInNet(myIpAddress(), \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\"))"; | |
2932 | ||
2933 | undef @templist; | |
2934 | if (-e "$acl_src_subnets") { | |
2935 | open(SUBNETS,"$acl_src_subnets"); | |
2936 | @templist = <SUBNETS>; | |
2937 | close(SUBNETS); | |
2938 | } | |
2939 | ||
2940 | foreach (@templist) | |
2941 | { | |
2942 | @temp = split(/\//); | |
2943 | if ( | |
28c9dec6 | 2944 | ($temp[0] ne $netsettings{'GREEN_NETADDRESS'}) && ($temp[1] ne $netsettings{'GREEN_NETMASK'}) && |
268292e7 CS |
2945 | ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'}) |
2946 | ) | |
2947 | { | |
2948 | chomp $temp[1]; | |
2949 | print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))"; | |
2950 | } | |
2951 | } | |
2952 | ||
2953 | print FILE "\n"; | |
2954 | ||
ed38f89d | 2955 | print FILE <<END |
268292e7 CS |
2956 | |
2957 | ||
ed38f89d MT |
2958 | ) |
2959 | return "PROXY $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; | |
2960 | END | |
2961 | ; | |
2962 | } | |
2963 | if (($proxysettings{'ENABLE'} eq 'on') && ($proxysettings{'ENABLE_BLUE'} eq 'on') && ($netsettings{'BLUE_DEV'})) | |
2964 | { | |
2965 | print FILE "\n else\n\n"; | |
2966 | } | |
2967 | if (($netsettings{'BLUE_DEV'}) && ($proxysettings{'ENABLE_BLUE'} eq 'on')) | |
2968 | { | |
2969 | print FILE <<END | |
2970 | if ( | |
2971 | (isInNet(myIpAddress(), "$netsettings{'BLUE_NETADDRESS'}", "$netsettings{'BLUE_NETMASK'}")) | |
2972 | ) | |
2973 | return "PROXY $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; | |
2974 | END | |
2975 | ; | |
2976 | } | |
2977 | } | |
2978 | print FILE "}\n"; | |
2979 | close(FILE); | |
2980 | } | |
2981 | ||
2982 | # ------------------------------------------------------------------- | |
2983 | ||
2984 | sub writeconfig | |
2985 | { | |
2986 | my $authrealm; | |
2987 | my $delaypools; | |
2988 | ||
363fb6af | 2989 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} + |
ed38f89d MT |
2990 | $proxysettings{'THROTTLING_GREEN_HOST'} + |
2991 | $proxysettings{'THROTTLING_BLUE_TOTAL'} + | |
2992 | $proxysettings{'THROTTLING_BLUE_HOST'} gt 0) | |
2993 | { | |
2994 | $delaypools = 1; } else { $delaypools = 0; | |
2995 | } | |
2996 | ||
2997 | if ($proxysettings{'AUTH_REALM'} eq '') | |
2998 | { | |
d12aede7 | 2999 | $authrealm = "IPFire Advanced Proxy Server"; |
ed38f89d MT |
3000 | } else { |
3001 | $authrealm = $proxysettings{'AUTH_REALM'}; | |
3002 | } | |
3003 | ||
3004 | $_ = $proxysettings{'UPSTREAM_PROXY'}; | |
3005 | my ($remotehost, $remoteport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/); | |
3006 | ||
3007 | if ($remoteport eq '') { $remoteport = 80; } | |
3008 | ||
3009 | open(FILE, ">${General::swroot}/proxy/squid.conf"); | |
3010 | flock(FILE, 2); | |
3011 | print FILE <<END | |
363fb6af MT |
3012 | # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes |
3013 | # you make will be overwritten whenever you resave proxy settings using the | |
3014 | # web interface! | |
3015 | # | |
3016 | # Instead, modify the file '$acl_include' and | |
3017 | # then restart the proxy service using the web interface. Changes made to the | |
3018 | # 'include.acl' file will propagate to the 'squid.conf' file at that time. | |
3019 | ||
ed38f89d MT |
3020 | shutdown_lifetime 5 seconds |
3021 | icp_port 0 | |
3022 | ||
ed38f89d MT |
3023 | END |
3024 | ; | |
363fb6af MT |
3025 | print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; |
3026 | if ($proxysettings{'TRANSPARENT'} eq 'on') { print FILE " transparent" } | |
3027 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } | |
3028 | print FILE "\n"; | |
3029 | ||
ed38f89d | 3030 | if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') { |
363fb6af MT |
3031 | print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; |
3032 | if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { print FILE " transparent" } | |
3033 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } | |
3034 | print FILE "\n"; | |
ed38f89d MT |
3035 | } |
3036 | ||
488d1b7c CS |
3037 | if ($proxysettings{'CACHE_SIZE'} > 0) |
3038 | { | |
3039 | print FILE "\n"; | |
ed38f89d | 3040 | |
488d1b7c CS |
3041 | if (!-z $acl_dst_nocache_dom) { |
3042 | print FILE "acl no_cache_domains dstdomain \"$acl_dst_nocache_dom\"\n"; | |
3043 | print FILE "cache deny no_cache_domains\n"; | |
3044 | } | |
3045 | if (!-z $acl_dst_nocache_net) { | |
37273bc6 | 3046 | print FILE "acl no_cache_ipaddr dst \"$acl_dst_nocache_net\"\n"; |
488d1b7c CS |
3047 | print FILE "cache deny no_cache_ipaddr\n"; |
3048 | } | |
3049 | if (!-z $acl_dst_nocache_url) { | |
3050 | print FILE "acl no_cache_hosts url_regex -i \"$acl_dst_nocache_url\"\n"; | |
3051 | print FILE "cache deny no_cache_hosts\n"; | |
3052 | } | |
ed38f89d MT |
3053 | } |
3054 | ||
3055 | print FILE <<END | |
3056 | ||
3057 | cache_effective_user squid | |
3058 | cache_effective_group squid | |
363fb6af | 3059 | umask 022 |
ed38f89d MT |
3060 | |
3061 | pid_filename /var/run/squid.pid | |
3062 | ||
3063 | cache_mem $proxysettings{'CACHE_MEM'} MB | |
ed38f89d MT |
3064 | END |
3065 | ; | |
3066 | ||
488d1b7c CS |
3067 | if ($proxysettings{'CACHE_SIZE'} eq '0') |
3068 | { | |
3069 | print FILE "cache_dir null /var/tmp\n\n"; | |
3070 | } else { | |
3071 | print FILE "cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256\n\n"; | |
3072 | } | |
3073 | ||
0d948999 | 3074 | if (($proxysettings{'ERR_DESIGN'} eq 'ipfire' )) |
363fb6af | 3075 | { |
0d948999 | 3076 | print FILE "error_directory $errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}\n\n"; |
363fb6af MT |
3077 | } else { |
3078 | print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n"; | |
3079 | } | |
3080 | ||
ed38f89d MT |
3081 | if ($proxysettings{'OFFLINE_MODE'} eq 'on') { print FILE "offline_mode on\n\n"; } |
3082 | ||
3083 | if ((!($proxysettings{'MEM_POLICY'} eq 'LRU')) || (!($proxysettings{'CACHE_POLICY'} eq 'LRU'))) | |
3084 | { | |
3085 | if (!($proxysettings{'MEM_POLICY'} eq 'LRU')) | |
3086 | { | |
3087 | print FILE "memory_replacement_policy $proxysettings{'MEM_POLICY'}\n"; | |
3088 | } | |
3089 | if (!($proxysettings{'CACHE_POLICY'} eq 'LRU')) | |
3090 | { | |
3091 | print FILE "cache_replacement_policy $proxysettings{'CACHE_POLICY'}\n"; | |
3092 | } | |
3093 | print FILE "\n"; | |
3094 | } | |
3095 | ||
3096 | if ($proxysettings{'LOGGING'} eq 'on') | |
3097 | { | |
363fb6af MT |
3098 | print FILE <<END |
3099 | access_log /var/log/squid/access.log | |
ed38f89d MT |
3100 | cache_log /var/log/squid/cache.log |
3101 | cache_store_log none | |
3102 | END | |
3103 | ; | |
3104 | if ($proxysettings{'LOGUSERAGENT'} eq 'on') { print FILE "useragent_log \/var\/log\/squid\/user_agent.log\n"; } | |
3105 | if ($proxysettings{'LOGQUERY'} eq 'on') { print FILE "\nstrip_query_terms off\n"; } | |
3106 | } else { | |
3107 | print FILE <<END | |
363fb6af | 3108 | access_log /dev/null |
ed38f89d MT |
3109 | cache_log /dev/null |
3110 | cache_store_log none | |
3111 | END | |
3112 | ;} | |
3113 | print FILE <<END | |
3114 | ||
3115 | log_mime_hdrs off | |
3116 | END | |
3117 | ; | |
3118 | ||
3119 | if ($proxysettings{'FORWARD_IPADDRESS'} eq 'on') | |
3120 | { | |
363fb6af | 3121 | print FILE "forwarded_for on\n"; |
ed38f89d | 3122 | } else { |
363fb6af | 3123 | print FILE "forwarded_for off\n"; |
ed38f89d | 3124 | } |
363fb6af MT |
3125 | if ($proxysettings{'FORWARD_VIA'} eq 'on') |
3126 | { | |
3127 | print FILE "via on\n"; | |
3128 | } else { | |
3129 | print FILE "via off\n"; | |
3130 | } | |
3131 | print FILE "\n"; | |
ed38f89d MT |
3132 | |
3133 | if ((!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) | |
3134 | { | |
3135 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3136 | { | |
363fb6af | 3137 | print FILE "auth_param basic program $authdir/ncsa_auth $userdb\n"; |
ed38f89d MT |
3138 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; |
3139 | print FILE "auth_param basic realm $authrealm\n"; | |
3140 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
3141 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
3142 | } | |
3143 | ||
3144 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') | |
3145 | { | |
363fb6af | 3146 | print FILE "auth_param basic program $authdir/squid_ldap_auth -b \"$proxysettings{'LDAP_BASEDN'}\""; |
ed38f89d MT |
3147 | if (!($proxysettings{'LDAP_BINDDN_USER'} eq '')) { print FILE " -D \"$proxysettings{'LDAP_BINDDN_USER'}\""; } |
3148 | if (!($proxysettings{'LDAP_BINDDN_PASS'} eq '')) { print FILE " -w $proxysettings{'LDAP_BINDDN_PASS'}"; } | |
3149 | if ($proxysettings{'LDAP_TYPE'} eq 'ADS') | |
3150 | { | |
3151 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
3152 | { | |
3153 | print FILE " -f \"(\&(objectClass=person)(sAMAccountName=\%s))\""; | |
3154 | } else { | |
3155 | print FILE " -f \"(\&(\&(objectClass=person)(sAMAccountName=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\""; | |
3156 | } | |
3157 | print FILE " -u sAMAccountName -P"; | |
3158 | } | |
3159 | if ($proxysettings{'LDAP_TYPE'} eq 'NDS') | |
3160 | { | |
3161 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
3162 | { | |
3163 | print FILE " -f \"(\&(objectClass=person)(cn=\%s))\""; | |
3164 | } else { | |
3165 | print FILE " -f \"(\&(\&(objectClass=person)(cn=\%s))(groupMembership=$proxysettings{'LDAP_GROUP'}))\""; | |
3166 | } | |
3167 | print FILE " -u cn -P"; | |
3168 | } | |
3169 | if (($proxysettings{'LDAP_TYPE'} eq 'V2') || ($proxysettings{'LDAP_TYPE'} eq 'V3')) | |
3170 | { | |
3171 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
3172 | { | |
3173 | print FILE " -f \"(\&(objectClass=person)(uid=\%s))\""; | |
3174 | } else { | |
3175 | print FILE " -f \"(\&(\&(objectClass=person)(uid=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\""; | |
3176 | } | |
3177 | if ($proxysettings{'LDAP_TYPE'} eq 'V2') { print FILE " -v 2"; } | |
3178 | if ($proxysettings{'LDAP_TYPE'} eq 'V3') { print FILE " -v 3"; } | |
3179 | print FILE " -u uid -P"; | |
3180 | } | |
3181 | print FILE " $proxysettings{'LDAP_SERVER'}:$proxysettings{'LDAP_PORT'}\n"; | |
3182 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; | |
3183 | print FILE "auth_param basic realm $authrealm\n"; | |
3184 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
3185 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
3186 | } | |
3187 | ||
3188 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') | |
3189 | { | |
3190 | if ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') | |
3191 | { | |
363fb6af | 3192 | print FILE "auth_param ntlm program $authdir/ntlm_auth $proxysettings{'NTLM_DOMAIN'}/$proxysettings{'NTLM_PDC'}"; |
ed38f89d MT |
3193 | if ($proxysettings{'NTLM_BDC'} eq '') { print FILE "\n"; } else { print FILE " $proxysettings{'NTLM_DOMAIN'}/$proxysettings{'NTLM_BDC'}\n"; } |
3194 | print FILE "auth_param ntlm children $proxysettings{'AUTH_CHILDREN'}\n"; | |
ed38f89d MT |
3195 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } |
3196 | } else { | |
363fb6af | 3197 | print FILE "auth_param basic program $authdir/msnt_auth\n"; |
ed38f89d MT |
3198 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; |
3199 | print FILE "auth_param basic realm $authrealm\n"; | |
3200 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
3201 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
3202 | ||
3203 | open(MSNTCONF, ">$ntlmdir/msntauth.conf"); | |
3204 | flock(MSNTCONF,2); | |
3205 | print MSNTCONF "server $proxysettings{'NTLM_PDC'}"; | |
3206 | if ($proxysettings{'NTLM_BDC'} eq '') { print MSNTCONF " $proxysettings{'NTLM_PDC'}"; } else { print MSNTCONF " $proxysettings{'NTLM_BDC'}"; } | |
3207 | print MSNTCONF " $proxysettings{'NTLM_DOMAIN'}\n"; | |
3208 | if ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') | |
3209 | { | |
3210 | if ($proxysettings{'NTLM_USER_ACL'} eq 'positive') | |
3211 | { | |
3212 | print MSNTCONF "allowusers $ntlmdir/msntauth.allowusers\n"; | |
3213 | } else { | |
3214 | print MSNTCONF "denyusers $ntlmdir/msntauth.denyusers\n"; | |
28c9dec6 | 3215 | } |
ed38f89d MT |
3216 | } |
3217 | close(MSNTCONF); | |
3218 | } | |
3219 | } | |
3220 | ||
3221 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') | |
3222 | { | |
363fb6af | 3223 | print FILE "auth_param basic program $authdir/squid_radius_auth -h $proxysettings{'RADIUS_SERVER'} -p $proxysettings{'RADIUS_PORT'} "; |
ed38f89d MT |
3224 | if (!($proxysettings{'RADIUS_IDENTIFIER'} eq '')) { print FILE "-i $proxysettings{'RADIUS_IDENTIFIER'} "; } |
3225 | print FILE "-w $proxysettings{'RADIUS_SECRET'}\n"; | |
3226 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; | |
3227 | print FILE "auth_param basic realm $authrealm\n"; | |
3228 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
3229 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
3230 | } | |
3231 | ||
3232 | print FILE "\n"; | |
3233 | print FILE "acl for_inetusers proxy_auth REQUIRED\n"; | |
3234 | if (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') && ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on')) | |
3235 | { | |
3236 | if ((!-z "$ntlmdir/msntauth.allowusers") && ($proxysettings{'NTLM_USER_ACL'} eq 'positive')) | |
3237 | { | |
3238 | print FILE "acl for_acl_users proxy_auth \"$ntlmdir/msntauth.allowusers\"\n"; | |
3239 | } | |
3240 | if ((!-z "$ntlmdir/msntauth.denyusers") && ($proxysettings{'NTLM_USER_ACL'} eq 'negative')) | |
3241 | { | |
3242 | print FILE "acl for_acl_users proxy_auth \"$ntlmdir/msntauth.denyusers\"\n"; | |
3243 | } | |
3244 | } | |
3245 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) | |
3246 | { | |
3247 | if ((!-z "$raddir/radauth.allowusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive')) | |
3248 | { | |
3249 | print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.allowusers\"\n"; | |
3250 | } | |
3251 | if ((!-z "$raddir/radauth.denyusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative')) | |
3252 | { | |
3253 | print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.denyusers\"\n"; | |
3254 | } | |
3255 | } | |
3256 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3257 | { | |
3258 | print FILE "\n"; | |
3259 | if (!-z $extgrp) { print FILE "acl for_extended_users proxy_auth \"$extgrp\"\n"; } | |
3260 | if (!-z $disgrp) { print FILE "acl for_disabled_users proxy_auth \"$disgrp\"\n"; } | |
3261 | } | |
3262 | if (!($proxysettings{'AUTH_MAX_USERIP'} eq '')) { print FILE "\nacl concurrent max_user_ip -s $proxysettings{'AUTH_MAX_USERIP'}\n"; } | |
3263 | print FILE "\n"; | |
3264 | ||
488d1b7c CS |
3265 | if (!-z $acl_dst_noauth_net) { print FILE "acl to_ipaddr_without_auth dst \"$acl_dst_noauth_net\"\n"; } |
3266 | if (!-z $acl_dst_noauth_dom) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth_dom\"\n"; } | |
3267 | if (!-z $acl_dst_noauth_url) { print FILE "acl to_hosts_without_auth url_regex -i \"$acl_dst_noauth_url\"\n"; } | |
363fb6af | 3268 | print FILE "\n"; |
488d1b7c | 3269 | |
ed38f89d MT |
3270 | } |
3271 | ||
3272 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
3273 | { | |
3274 | if ($proxysettings{'IDENT_REQUIRED'} eq 'on') | |
3275 | { | |
3276 | print FILE "acl for_inetusers ident REQUIRED\n"; | |
3277 | } | |
3278 | if ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') | |
3279 | { | |
3280 | if ((!-z "$identdir/identauth.allowusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'positive')) | |
3281 | { | |
3282 | print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.allowusers\"\n\n"; | |
3283 | } | |
3284 | if ((!-z "$identdir/identauth.denyusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'negative')) | |
3285 | { | |
3286 | print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.denyusers\"\n\n"; | |
3287 | } | |
3288 | } | |
488d1b7c CS |
3289 | if (!-z $acl_dst_noauth_net) { print FILE "acl to_ipaddr_without_auth dst \"$acl_dst_noauth_net\"\n"; } |
3290 | if (!-z $acl_dst_noauth_dom) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth_dom\"\n"; } | |
3291 | if (!-z $acl_dst_noauth_url) { print FILE "acl to_hosts_without_auth url_regex -i \"$acl_dst_noauth_url\"\n"; } | |
363fb6af | 3292 | print FILE "\n"; |
ed38f89d MT |
3293 | } |
3294 | ||
3295 | if (($delaypools) && (!-z $acl_dst_throttle)) { print FILE "acl for_throttled_urls url_regex -i \"$acl_dst_throttle\"\n\n"; } | |
3296 | ||
3297 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE "acl with_allowed_useragents browser $browser_regexp\n\n"; } | |
3298 | ||
28c9dec6 | 3299 | print FILE "acl within_timeframe time "; |
ed38f89d MT |
3300 | if ($proxysettings{'TIME_MON'} eq 'on') { print FILE "M"; } |
3301 | if ($proxysettings{'TIME_TUE'} eq 'on') { print FILE "T"; } | |
3302 | if ($proxysettings{'TIME_WED'} eq 'on') { print FILE "W"; } | |
3303 | if ($proxysettings{'TIME_THU'} eq 'on') { print FILE "H"; } | |
3304 | if ($proxysettings{'TIME_FRI'} eq 'on') { print FILE "F"; } | |
3305 | if ($proxysettings{'TIME_SAT'} eq 'on') { print FILE "A"; } | |
3306 | if ($proxysettings{'TIME_SUN'} eq 'on') { print FILE "S"; } | |
363fb6af MT |
3307 | print FILE " $proxysettings{'TIME_FROM_HOUR'}:"; |
3308 | print FILE "$proxysettings{'TIME_FROM_MINUTE'}-"; | |
3309 | print FILE "$proxysettings{'TIME_TO_HOUR'}:"; | |
3310 | print FILE "$proxysettings{'TIME_TO_MINUTE'}\n\n"; | |
ed38f89d MT |
3311 | |
3312 | if ((!-z $mimetypes) && ($proxysettings{'ENABLE_MIME_FILTER'} eq 'on')) { | |
3313 | print FILE "acl blocked_mimetypes rep_mime_type \"$mimetypes\"\n\n"; | |
3314 | } | |
3315 | ||
3316 | print FILE <<END | |
3317 | acl all src 0.0.0.0/0.0.0.0 | |
3318 | acl localhost src 127.0.0.1/255.255.255.255 | |
363fb6af MT |
3319 | END |
3320 | ; | |
3321 | open (PORTS,"$acl_ports_ssl"); | |
3322 | @temp = <PORTS>; | |
3323 | close PORTS; | |
3324 | if (@temp) | |
3325 | { | |
3326 | foreach (@temp) { print FILE "acl SSL_ports port $_"; } | |
3327 | } | |
3328 | open (PORTS,"$acl_ports_safe"); | |
3329 | @temp = <PORTS>; | |
3330 | close PORTS; | |
3331 | if (@temp) | |
3332 | { | |
3333 | foreach (@temp) { print FILE "acl Safe_ports port $_"; } | |
3334 | } | |
3335 | print FILE <<END | |
3336 | ||
488d1b7c CS |
3337 | acl IPFire_http port $http_port |
3338 | acl IPFire_https port $https_port | |
3339 | acl IPFire_ips dst $netsettings{'GREEN_ADDRESS'} | |
3340 | acl IPFire_networks src "$acl_src_subnets" | |
3341 | acl IPFire_servers dst "$acl_src_subnets" | |
3342 | acl IPFire_green_network src $netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'} | |
3343 | acl IPFire_green_servers dst $netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'} | |
ed38f89d MT |
3344 | END |
3345 | ; | |
488d1b7c CS |
3346 | if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPFire_blue_network src $netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}\n"; } |
3347 | if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPFire_blue_servers dst $netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}\n"; } | |
3348 | if (!-z $acl_src_banned_ip) { print FILE "acl IPFire_banned_ips src \"$acl_src_banned_ip\"\n"; } | |
3349 | if (!-z $acl_src_banned_mac) { print FILE "acl IPFire_banned_mac arp \"$acl_src_banned_mac\"\n"; } | |
3350 | if (!-z $acl_src_unrestricted_ip) { print FILE "acl IPFire_unrestricted_ips src \"$acl_src_unrestricted_ip\"\n"; } | |
3351 | if (!-z $acl_src_unrestricted_mac) { print FILE "acl IPFire_unrestricted_mac arp \"$acl_src_unrestricted_mac\"\n"; } | |
ed38f89d MT |
3352 | print FILE <<END |
3353 | acl CONNECT method CONNECT | |
3354 | END | |
3355 | ; | |
3356 | ||
3357 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on') { | |
3358 | print FILE <<END | |
3359 | ||
3360 | #Classroom extensions | |
488d1b7c CS |
3361 | acl IPFire_no_access_ips src "$acl_src_noaccess_ip" |
3362 | acl IPFire_no_access_mac arp "$acl_src_noaccess_mac" | |
ed38f89d MT |
3363 | END |
3364 | ; | |
3365 | print FILE "deny_info "; | |
0d948999 | 3366 | if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) || |
363fb6af MT |
3367 | (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED"))) |
3368 | { | |
3369 | print FILE "ERR_ACCESS_DISABLED"; | |
3370 | } else { | |
3371 | print FILE "ERR_ACCESS_DENIED"; | |
3372 | } | |
488d1b7c | 3373 | print FILE " IPFire_no_access_ips\n"; |
ed38f89d | 3374 | print FILE "deny_info "; |
0d948999 | 3375 | if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) || |
363fb6af MT |
3376 | (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED"))) |
3377 | { | |
3378 | print FILE "ERR_ACCESS_DISABLED"; | |
3379 | } else { | |
3380 | print FILE "ERR_ACCESS_DENIED"; | |
3381 | } | |
488d1b7c | 3382 | print FILE " IPFire_no_access_mac\n"; |
ed38f89d MT |
3383 | |
3384 | print FILE <<END | |
488d1b7c CS |
3385 | http_access deny IPFire_no_access_ips |
3386 | http_access deny IPFire_no_access_mac | |
ed38f89d MT |
3387 | END |
3388 | ; | |
3389 | } | |
3390 | ||
363fb6af MT |
3391 | #Insert acl file and replace __VAR__ with correct values |
3392 | my $blue_net = ''; #BLUE empty by default | |
3393 | my $blue_ip = ''; | |
3394 | if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') { | |
3395 | $blue_net = "$netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}"; | |
3396 | $blue_ip = "$netsettings{'BLUE_ADDRESS'}"; | |
3397 | } | |
3398 | if (!-z $acl_include) | |
ed38f89d MT |
3399 | { |
3400 | open (ACL, "$acl_include"); | |
488d1b7c | 3401 | print FILE "\n#Start of custom includes\n\n"; |
ed38f89d MT |
3402 | while (<ACL>) { |
3403 | $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/; | |
3404 | $_ =~ s/__GREEN_NET__/$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}/; | |
3405 | $_ =~ s/__BLUE_IP__/$blue_ip/; | |
3406 | $_ =~ s/__BLUE_NET__/$blue_net/; | |
363fb6af | 3407 | $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/; |
ed38f89d MT |
3408 | print FILE $_; |
3409 | } | |
488d1b7c | 3410 | print FILE "\n#End of custom includes\n"; |
ed38f89d MT |
3411 | close (ACL); |
3412 | } | |
3413 | if ((!-z $extgrp) && ($proxysettings{'AUTH_METHOD'} eq 'ncsa') && ($proxysettings{'NCSA_BYPASS_REDIR'} eq 'on')) { print FILE "\nredirector_access deny for_extended_users\n"; } | |
3414 | print FILE <<END | |
3415 | ||
3416 | #Access to squid: | |
3417 | #local machine, no restriction | |
3418 | http_access allow localhost | |
3419 | ||
3420 | #GUI admin if local machine connects | |
488d1b7c CS |
3421 | http_access allow IPFire_ips IPFire_networks IPFire_http |
3422 | http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https | |
ed38f89d MT |
3423 | |
3424 | #Deny not web services | |
3425 | http_access deny !Safe_ports | |
3426 | http_access deny CONNECT !SSL_ports | |
3427 | ||
3428 | END | |
3429 | ; | |
3430 | ||
3431 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
3432 | { | |
3433 | print FILE "#Set ident ACLs\n"; | |
3434 | if (!-z $identhosts) | |
3435 | { | |
3436 | print FILE "acl on_ident_aware_hosts src \"$identhosts\"\n"; | |
3437 | print FILE "ident_lookup_access allow on_ident_aware_hosts\n"; | |
3438 | print FILE "ident_lookup_access deny all\n"; | |
3439 | } else { | |
3440 | print FILE "ident_lookup_access allow all\n"; | |
3441 | } | |
3442 | print FILE "ident_timeout $proxysettings{'IDENT_TIMEOUT'} seconds\n\n"; | |
3443 | } | |
3444 | ||
3445 | if ($delaypools) { | |
3446 | print FILE "#Set download throttling\n"; | |
3447 | ||
3448 | if ($netsettings{'BLUE_DEV'}) | |
3449 | { | |
3450 | print FILE "delay_pools 2\n"; | |
3451 | } else { | |
3452 | print FILE "delay_pools 1\n"; | |
3453 | } | |
3454 | ||
3455 | print FILE "delay_class 1 3\n"; | |
3456 | if ($netsettings{'BLUE_DEV'}) { print FILE "delay_class 2 3\n"; } | |
3457 | ||
3458 | print FILE "delay_parameters 1 "; | |
3459 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} eq 'unlimited') | |
3460 | { | |
3461 | print FILE "-1/-1"; | |
3462 | } else { | |
3463 | print FILE $proxysettings{'THROTTLING_GREEN_TOTAL'} * 125; | |
3464 | print FILE "/"; | |
3465 | print FILE $proxysettings{'THROTTLING_GREEN_TOTAL'} * 250; | |
3466 | } | |
3467 | ||
3468 | print FILE " -1/-1 "; | |
3469 | if ($proxysettings{'THROTTLING_GREEN_HOST'} eq 'unlimited') | |
3470 | { | |
3471 | print FILE "-1/-1"; | |
3472 | } else { | |
3473 | print FILE $proxysettings{'THROTTLING_GREEN_HOST'} * 125; | |
3474 | print FILE "/"; | |
3475 | print FILE $proxysettings{'THROTTLING_GREEN_HOST'} * 250; | |
3476 | } | |
3477 | print FILE "\n"; | |
3478 | ||
3479 | if ($netsettings{'BLUE_DEV'}) | |
3480 | { | |
3481 | print FILE "delay_parameters 2 "; | |
3482 | if ($proxysettings{'THROTTLING_BLUE_TOTAL'} eq 'unlimited') | |
3483 | { | |
3484 | print FILE "-1/-1"; | |
3485 | } else { | |
3486 | print FILE $proxysettings{'THROTTLING_BLUE_TOTAL'} * 125; | |
3487 | print FILE "/"; | |
3488 | print FILE $proxysettings{'THROTTLING_BLUE_TOTAL'} * 250; | |
3489 | } | |
3490 | print FILE " -1/-1 "; | |
3491 | if ($proxysettings{'THROTTLING_BLUE_HOST'} eq 'unlimited') | |
3492 | { | |
3493 | print FILE "-1/-1"; | |
3494 | } else { | |
3495 | print FILE $proxysettings{'THROTTLING_BLUE_HOST'} * 125; | |
3496 | print FILE "/"; | |
3497 | print FILE $proxysettings{'THROTTLING_BLUE_HOST'} * 250; | |
3498 | } | |
3499 | print FILE "\n"; | |
3500 | } | |
3501 | ||
488d1b7c CS |
3502 | print FILE "delay_access 1 deny IPFire_ips\n"; |
3503 | if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 1 deny IPFire_unrestricted_ips\n"; } | |
3504 | if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 1 deny IPFire_unrestricted_mac\n"; } | |
ed38f89d MT |
3505 | if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 1 deny for_extended_users\n"; } |
3506 | ||
3507 | if ($netsettings{'BLUE_DEV'}) | |
3508 | { | |
488d1b7c | 3509 | print FILE "delay_access 1 allow IPFire_green_network"; |
363fb6af | 3510 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3511 | print FILE "\n"; |
3512 | print FILE "delay_access 1 deny all\n"; | |
3513 | } else { | |
3514 | print FILE "delay_access 1 allow all"; | |
363fb6af | 3515 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3516 | print FILE "\n"; |
3517 | } | |
3518 | ||
3519 | if ($netsettings{'BLUE_DEV'}) | |
3520 | { | |
488d1b7c CS |
3521 | print FILE "delay_access 2 deny IPFire_ips\n"; |
3522 | if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 2 deny IPFire_unrestricted_ips\n"; } | |
3523 | if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 2 deny IPFire_unrestricted_mac\n"; } | |
ed38f89d | 3524 | if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 2 deny for_extended_users\n"; } |
488d1b7c | 3525 | print FILE "delay_access 2 allow IPFire_blue_network"; |
363fb6af | 3526 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3527 | print FILE "\n"; |
3528 | print FILE "delay_access 2 deny all\n"; | |
3529 | } | |
3530 | ||
28c9dec6 | 3531 | print FILE "delay_initial_bucket_level 100\n"; |
ed38f89d MT |
3532 | print FILE "\n"; |
3533 | } | |
9fb25b1c MT |
3534 | |
3535 | if ($proxysettings{'NO_PROXY_LOCAL'} eq 'on') | |
3536 | { | |
3537 | print FILE "#Prevent internal proxy access to Green\n"; | |
488d1b7c | 3538 | print FILE "http_access deny IPFire_green_servers !IPFire_green_network\n\n"; |
9fb25b1c MT |
3539 | } |
3540 | ||
3541 | if ($proxysettings{'NO_PROXY_LOCAL_BLUE'} eq 'on') | |
3542 | { | |
3543 | print FILE "#Prevent internal proxy access from Blue\n"; | |
488d1b7c CS |
3544 | print FILE "http_access allow IPFire_blue_network IPFire_blue_servers\n"; |
3545 | print FILE "http_access deny IPFire_blue_network IPFire_servers\n\n"; | |
9fb25b1c MT |
3546 | } |
3547 | ||
ed38f89d MT |
3548 | print FILE <<END |
3549 | #Set custom configured ACLs | |
3550 | END | |
3551 | ; | |
488d1b7c CS |
3552 | if (!-z $acl_src_banned_ip) { print FILE "http_access deny IPFire_banned_ips\n"; } |
3553 | if (!-z $acl_src_banned_mac) { print FILE "http_access deny IPFire_banned_mac\n"; } | |
ed38f89d MT |
3554 | |
3555 | if ((!-z $acl_dst_noauth) && (!($proxysettings{'AUTH_METHOD'} eq 'none'))) | |
3556 | { | |
3557 | if (!-z $acl_src_unrestricted_ip) | |
3558 | { | |
488d1b7c CS |
3559 | if (!-z $acl_dst_noauth_net) { print FILE "http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth\n"; } |
3560 | if (!-z $acl_dst_noauth_dom) { print FILE "http_access allow IPFire_unrestricted_ips to_domains_without_auth\n"; } | |
3561 | if (!-z $acl_dst_noauth_url) { print FILE "http_access allow IPFire_unrestricted_ips to_hosts_without_auth\n"; } | |
ed38f89d MT |
3562 | } |
3563 | if (!-z $acl_src_unrestricted_mac) | |
3564 | { | |
488d1b7c CS |
3565 | if (!-z $acl_dst_noauth_net) { print FILE "http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth\n"; } |
3566 | if (!-z $acl_dst_noauth_dom) { print FILE "http_access allow IPFire_unrestricted_mac to_domains_without_auth\n"; } | |
3567 | if (!-z $acl_dst_noauth_url) { print FILE "http_access allow IPFire_unrestricted_mac to_hosts_without_auth\n"; } | |
3568 | } | |
3569 | if (!-z $acl_dst_noauth_net) | |
3570 | { | |
3571 | print FILE "http_access allow IPFire_networks"; | |
3572 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3573 | print FILE " !within_timeframe"; | |
3574 | } else { | |
3575 | print FILE " within_timeframe"; } | |
3576 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3577 | print FILE " to_ipaddr_without_auth\n"; | |
3578 | } | |
3579 | if (!-z $acl_dst_noauth_dom) | |
3580 | { | |
3581 | print FILE "http_access allow IPFire_networks"; | |
3582 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3583 | print FILE " !within_timeframe"; | |
3584 | } else { | |
3585 | print FILE " within_timeframe"; } | |
3586 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3587 | print FILE " to_domains_without_auth\n"; | |
3588 | } | |
3589 | if (!-z $acl_dst_noauth_url) | |
3590 | { | |
3591 | print FILE "http_access allow IPFire_networks"; | |
3592 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3593 | print FILE " !within_timeframe"; | |
3594 | } else { | |
3595 | print FILE " within_timeframe"; } | |
3596 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3597 | print FILE " to_hosts_without_auth\n"; | |
ed38f89d | 3598 | } |
ed38f89d MT |
3599 | } |
3600 | ||
3601 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on') && ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on')) | |
3602 | { | |
3603 | print FILE "http_access deny !for_inetusers"; | |
3604 | if (!-z $identhosts) { print FILE " on_ident_aware_hosts"; } | |
3605 | print FILE "\n"; | |
3606 | } | |
3607 | ||
3608 | if ( | |
3609 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3610 | ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') && | |
3611 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3612 | ($proxysettings{'IDENT_USER_ACL'} eq 'negative') && | |
3613 | (!-z "$identdir/identauth.denyusers") | |
3614 | ) | |
3615 | { | |
3616 | print FILE "http_access deny for_acl_users"; | |
3617 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && (!-z "$identdir/hosts")) { print FILE " on_ident_aware_hosts"; } | |
3618 | print FILE "\n"; | |
3619 | } | |
3620 | ||
3621 | if (!-z $acl_src_unrestricted_ip) | |
3622 | { | |
488d1b7c | 3623 | print FILE "http_access allow IPFire_unrestricted_ips"; |
ed38f89d MT |
3624 | if ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') |
3625 | { | |
3626 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3627 | { | |
3628 | if (!-z $disgrp) { print FILE " !for_disabled_users"; } else { print FILE " for_inetusers"; } | |
3629 | } | |
3630 | if (($proxysettings{'AUTH_METHOD'} eq 'ldap') || (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'off')) || ($proxysettings{'AUTH_METHOD'} eq 'radius')) | |
3631 | { | |
3632 | print FILE " for_inetusers"; | |
3633 | } | |
3634 | if (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on')) | |
3635 | { | |
3636 | if ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') | |
28c9dec6 | 3637 | { |
ed38f89d MT |
3638 | if (($proxysettings{'NTLM_USER_ACL'} eq 'positive') && (!-z "$ntlmdir/msntauth.allowusers")) |
3639 | { | |
3640 | print FILE " for_acl_users"; | |
3641 | } | |
3642 | if (($proxysettings{'NTLM_USER_ACL'} eq 'negative') && (!-z "$ntlmdir/msntauth.denyusers")) | |
3643 | { | |
3644 | print FILE " !for_acl_users"; | |
3645 | } | |
3646 | } else { print FILE " for_inetusers"; } | |
3647 | } | |
3648 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) | |
363fb6af | 3649 | { |
ed38f89d | 3650 | if ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') |
363fb6af | 3651 | { |
ed38f89d MT |
3652 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && (!-z "$raddir/radauth.allowusers")) |
3653 | { | |
3654 | print FILE " for_acl_users"; | |
3655 | } | |
3656 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && (!-z "$raddir/radauth.denyusers")) | |
3657 | { | |
3658 | print FILE " !for_acl_users"; | |
3659 | } | |
3660 | } else { print FILE " for_inetusers"; } | |
3661 | } | |
3662 | } | |
3663 | print FILE "\n"; | |
3664 | } | |
3665 | ||
3666 | if (!-z $acl_src_unrestricted_mac) | |
3667 | { | |
488d1b7c | 3668 | print FILE "http_access allow IPFire_unrestricted_mac"; |
ed38f89d MT |
3669 | if ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') |
3670 | { | |
3671 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3672 | { | |
3673 | if (!-z $disgrp) { print FILE " !for_disabled_users"; } else { print FILE " for_inetusers"; } | |
3674 | } | |
3675 | if (($proxysettings{'AUTH_METHOD'} eq 'ldap') || (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'off')) || ($proxysettings{'AUTH_METHOD'} eq 'radius')) | |
3676 | { | |
3677 | print FILE " for_inetusers"; | |
3678 | } | |
3679 | if (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on')) | |
3680 | { | |
3681 | if ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') | |
28c9dec6 | 3682 | { |
ed38f89d MT |
3683 | if (($proxysettings{'NTLM_USER_ACL'} eq 'positive') && (!-z "$ntlmdir/msntauth.allowusers")) |
3684 | { | |
3685 | print FILE " for_acl_users"; | |
3686 | } | |
3687 | if (($proxysettings{'NTLM_USER_ACL'} eq 'negative') && (!-z "$ntlmdir/msntauth.denyusers")) | |
3688 | { | |
3689 | print FILE " !for_acl_users"; | |
3690 | } | |
3691 | } else { print FILE " for_inetusers"; } | |
3692 | } | |
3693 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) | |
363fb6af | 3694 | { |
ed38f89d | 3695 | if ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') |
363fb6af | 3696 | { |
ed38f89d MT |
3697 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && (!-z "$raddir/radauth.allowusers")) |
3698 | { | |
3699 | print FILE " for_acl_users"; | |
3700 | } | |
3701 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && (!-z "$raddir/radauth.denyusers")) | |
3702 | { | |
3703 | print FILE " !for_acl_users"; | |
3704 | } | |
3705 | } else { print FILE " for_inetusers"; } | |
3706 | } | |
3707 | } | |
3708 | print FILE "\n"; | |
3709 | } | |
3710 | ||
3711 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3712 | { | |
3713 | if (!-z $disgrp) { print FILE "http_access deny for_disabled_users\n"; } | |
488d1b7c | 3714 | if (!-z $extgrp) { print FILE "http_access allow IPFire_networks for_extended_users\n"; } |
ed38f89d MT |
3715 | } |
3716 | ||
3717 | if ( | |
3718 | ( | |
3719 | ($proxysettings{'AUTH_METHOD'} eq 'ntlm') && | |
3720 | ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') && | |
3721 | ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && | |
3722 | ($proxysettings{'NTLM_USER_ACL'} eq 'negative') && | |
3723 | (!-z "$ntlmdir/msntauth.denyusers") | |
3724 | ) | |
3725 | || | |
3726 | ( | |
3727 | ($proxysettings{'AUTH_METHOD'} eq 'radius') && | |
3728 | ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && | |
3729 | ($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && | |
3730 | (!-z "$raddir/radauth.denyusers") | |
3731 | ) | |
3732 | || | |
3733 | ( | |
3734 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3735 | ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'off') && | |
3736 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3737 | ($proxysettings{'IDENT_USER_ACL'} eq 'negative') && | |
3738 | (!-z "$identdir/identauth.denyusers") | |
3739 | ) | |
3740 | ) | |
3741 | { | |
3742 | print FILE "http_access deny for_acl_users"; | |
3743 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && (!-z "$identdir/hosts")) { print FILE " on_ident_aware_hosts"; } | |
3744 | print FILE "\n"; | |
3745 | } | |
3746 | ||
3747 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on') && (!-z "$identhosts")) | |
3748 | { | |
3749 | print FILE "http_access allow"; | |
3750 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3751 | print FILE " !within_timeframe"; | |
3752 | } else { | |
3753 | print FILE " within_timeframe"; } | |
3754 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3755 | print FILE " !on_ident_aware_hosts\n"; | |
3756 | } | |
3757 | ||
488d1b7c | 3758 | print FILE "http_access allow IPFire_networks"; |
ed38f89d MT |
3759 | if ( |
3760 | ( | |
3761 | ($proxysettings{'AUTH_METHOD'} eq 'ntlm') && | |
3762 | ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') && | |
3763 | ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && | |
3764 | ($proxysettings{'NTLM_USER_ACL'} eq 'positive') && | |
3765 | (!-z "$ntlmdir/msntauth.allowusers") | |
3766 | ) | |
3767 | || | |
3768 | ( | |
3769 | ($proxysettings{'AUTH_METHOD'} eq 'radius') && | |
3770 | ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && | |
3771 | ($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && | |
3772 | (!-z "$raddir/radauth.allowusers") | |
3773 | ) | |
3774 | || | |
3775 | ( | |
3776 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3777 | ($proxysettings{'IDENT_REQUIRED'} eq 'on') && | |
3778 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3779 | ($proxysettings{'IDENT_USER_ACL'} eq 'positive') && | |
3780 | (!-z "$identdir/identauth.allowusers") | |
3781 | ) | |
3782 | ) | |
3783 | { | |
3784 | print FILE " for_acl_users"; | |
3785 | } elsif (((!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) || | |
3786 | (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on'))) { | |
3787 | print FILE " for_inetusers"; | |
3788 | } | |
3789 | if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) && (!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) | |
3790 | { | |
3791 | print FILE " !concurrent"; | |
3792 | } | |
3793 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3794 | print FILE " !within_timeframe"; | |
3795 | } else { | |
3796 | print FILE " within_timeframe"; } | |
3797 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3798 | print FILE "\n"; | |
3799 | ||
3800 | print FILE "http_access deny all\n\n"; | |
3801 | ||
3802 | if (($proxysettings{'FORWARD_IPADDRESS'} eq 'off') || ($proxysettings{'FORWARD_VIA'} eq 'off') || | |
3803 | (!($proxysettings{'FAKE_USERAGENT'} eq '')) || (!($proxysettings{'FAKE_REFERER'} eq ''))) | |
3804 | { | |
3805 | print FILE "#Strip HTTP Header\n"; | |
3806 | ||
3807 | if ($proxysettings{'FORWARD_IPADDRESS'} eq 'off') | |
3808 | { | |
3809 | print FILE "header_access X-Forwarded-For deny all\n"; | |
3810 | } | |
3811 | if ($proxysettings{'FORWARD_VIA'} eq 'off') | |
3812 | { | |
3813 | print FILE "header_access Via deny all\n"; | |
3814 | } | |
3815 | if (!($proxysettings{'FAKE_USERAGENT'} eq '')) | |
3816 | { | |
3817 | print FILE "header_access User-Agent deny all\n"; | |
3818 | } | |
3819 | if (!($proxysettings{'FAKE_REFERER'} eq '')) | |
3820 | { | |
3821 | print FILE "header_access Referer deny all\n"; | |
3822 | } | |
3823 | ||
3824 | print FILE "\n"; | |
3825 | ||
3826 | if ((!($proxysettings{'FAKE_USERAGENT'} eq '')) || (!($proxysettings{'FAKE_REFERER'} eq ''))) | |
3827 | { | |
3828 | if (!($proxysettings{'FAKE_USERAGENT'} eq '')) | |
3829 | { | |
3830 | print FILE "header_replace User-Agent $proxysettings{'FAKE_USERAGENT'}\n"; | |
3831 | } | |
3832 | if (!($proxysettings{'FAKE_REFERER'} eq '')) | |
3833 | { | |
3834 | print FILE "header_replace Referer $proxysettings{'FAKE_REFERER'}\n"; | |
3835 | } | |
3836 | print FILE "\n"; | |
3837 | } | |
3838 | } | |
3839 | ||
363fb6af MT |
3840 | if ($proxysettings{'SUPPRESS_VERSION'} eq 'on') { print FILE "httpd_suppress_version_string on\n\n" } |
3841 | ||
ed38f89d | 3842 | if ((!-z $mimetypes) && ($proxysettings{'ENABLE_MIME_FILTER'} eq 'on')) { |
488d1b7c CS |
3843 | if (!-z $acl_src_unrestricted_ip) { print FILE "http_reply_access allow IPFire_unrestricted_ips\n"; } |
3844 | if (!-z $acl_src_unrestricted_mac) { print FILE "http_reply_access allow IPFire_unrestricted_mac\n"; } | |
ed38f89d MT |
3845 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') |
3846 | { | |
3847 | if (!-z $extgrp) { print FILE "http_reply_access allow for_extended_users\n"; } | |
3848 | } | |
3849 | print FILE "http_reply_access deny blocked_mimetypes\n"; | |
3850 | print FILE "http_reply_access allow all\n\n"; | |
3851 | } | |
3852 | ||
488d1b7c CS |
3853 | if ($proxysettings{'CACHE_SIZE'} > 0) |
3854 | { | |
3855 | print FILE <<END | |
ed38f89d MT |
3856 | maximum_object_size $proxysettings{'MAX_SIZE'} KB |
3857 | minimum_object_size $proxysettings{'MIN_SIZE'} KB | |
3858 | ||
488d1b7c CS |
3859 | END |
3860 | ; | |
3861 | } else { print FILE "cache deny all\n\n"; } | |
3862 | ||
3863 | print FILE <<END | |
ed38f89d MT |
3864 | request_body_max_size $proxysettings{'MAX_OUTGOING_SIZE'} KB |
3865 | END | |
3866 | ; | |
3867 | $replybodymaxsize = 1024 * $proxysettings{'MAX_INCOMING_SIZE'}; | |
3868 | if ($proxysettings{'MAX_INCOMING_SIZE'} > 0) { | |
37273bc6 CS |
3869 | if (!-z $acl_src_unrestricted_ip) { print FILE "reply_body_max_size 0 deny IPFire_unrestricted_ips\n"; } |
3870 | if (!-z $acl_src_unrestricted_mac) { print FILE "reply_body_max_size 0 deny IPFire_unrestricted_mac\n"; } | |
ed38f89d MT |
3871 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') |
3872 | { | |
37273bc6 | 3873 | if (!-z $extgrp) { print FILE "reply_body_max_size 0 deny for_extended_users\n"; } |
ed38f89d MT |
3874 | } |
3875 | } | |
37273bc6 | 3876 | print FILE "reply_body_max_size $replybodymaxsize deny all\n\n"; |
ed38f89d MT |
3877 | |
3878 | print FILE "visible_hostname"; | |
3879 | if ($proxysettings{'VISIBLE_HOSTNAME'} eq '') | |
3880 | { | |
3881 | print FILE " $mainsettings{'HOSTNAME'}.$mainsettings{'DOMAINNAME'}\n\n"; | |
3882 | } else { | |
3883 | print FILE " $proxysettings{'VISIBLE_HOSTNAME'}\n\n"; | |
3884 | } | |
3885 | ||
fe1656d2 CS |
3886 | if (!($proxysettings{'ADMIN_MAIL_ADDRESS'} eq '')) { print FILE "cache_mgr $proxysettings{'ADMIN_MAIL_ADDRESS'}\n"; } |
3887 | if (!($proxysettings{'ADMIN_PASSWORD'} eq '')) { print FILE "cachemgr_passwd $proxysettings{'ADMIN_PASSWORD'} all\n"; } | |
3888 | print FILE "\n"; | |
3889 | ||
3890 | print FILE "max_filedescriptors $proxysettings{'FILEDESCRIPTORS'}\n\n"; | |
ed38f89d MT |
3891 | |
3892 | # Write the parent proxy info, if needed. | |
3893 | if ($remotehost ne '') | |
3894 | { | |
ed38f89d | 3895 | print FILE "cache_peer $remotehost parent $remoteport 3130 default no-query"; |
363fb6af MT |
3896 | |
3897 | # Enter authentication for the parent cache. Option format is | |
3898 | # login=user:password ($proxy1='YES') | |
3899 | # login=PASS ($proxy1='PASS') | |
3900 | # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on') | |
3901 | if (($proxy1 eq 'YES') || ($proxy1 eq 'PASS')) | |
3902 | { | |
3903 | print FILE " login=$proxysettings{'UPSTREAM_USER'}"; | |
3904 | if ($proxy1 eq 'YES') { print FILE ":$proxysettings{'UPSTREAM_PASSWORD'}"; } | |
ed38f89d | 3905 | } |
363fb6af MT |
3906 | elsif ($proxysettings{'FORWARD_USERNAME'} eq 'on') { print FILE " login=*:password"; } |
3907 | ||
488d1b7c CS |
3908 | print FILE "\nalways_direct allow IPFire_ips\n"; |
3909 | print FILE "never_direct allow all\n\n"; | |
ed38f89d | 3910 | } |
3900a6c7 | 3911 | if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on')) |
363fb6af MT |
3912 | { |
3913 | print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n"; | |
62459123 | 3914 | print FILE "url_rewrite_children $proxysettings{'CHILDREN'}\n\n"; |
ed38f89d | 3915 | } |
ed38f89d MT |
3916 | close FILE; |
3917 | } | |
3918 | ||
3919 | # ------------------------------------------------------------------- | |
3920 | ||
3921 | sub adduser | |
3922 | { | |
3923 | my ($str_user, $str_pass, $str_group) = @_; | |
3924 | my @groupmembers=(); | |
3925 | ||
3926 | if ($str_pass eq 'lEaVeAlOnE') | |
3927 | { | |
3928 | open(FILE, "$userdb"); | |
3929 | @groupmembers = <FILE>; | |
3930 | close(FILE); | |
3931 | foreach $line (@groupmembers) { if ($line =~ /^$str_user:/i) { $str_pass = substr($line,index($line,":")); } } | |
3932 | &deluser($str_user); | |
3933 | open(FILE, ">>$userdb"); | |
3934 | flock FILE,2; | |
3935 | print FILE "$str_user$str_pass"; | |
3936 | close(FILE); | |
3937 | } else { | |
3938 | &deluser($str_user); | |
d12aede7 | 3939 | system("/usr/sbin/htpasswd -b $userdb $str_user $str_pass"); |
ed38f89d MT |
3940 | } |
3941 | ||
3942 | if ($str_group eq 'standard') { open(FILE, ">>$stdgrp"); | |
3943 | } elsif ($str_group eq 'extended') { open(FILE, ">>$extgrp"); | |
3944 | } elsif ($str_group eq 'disabled') { open(FILE, ">>$disgrp"); } | |
3945 | flock FILE, 2; | |
3946 | print FILE "$str_user\n"; | |
3947 | close(FILE); | |
3948 | ||
3949 | return; | |
3950 | } | |
3951 | ||
3952 | # ------------------------------------------------------------------- | |
3953 | ||
3954 | sub deluser | |
3955 | { | |
3956 | my ($str_user) = @_; | |
3957 | my $groupfile=''; | |
3958 | my @groupmembers=(); | |
3959 | my @templist=(); | |
3960 | ||
3961 | foreach $groupfile ($stdgrp, $extgrp, $disgrp) | |
3962 | { | |
3963 | undef @templist; | |
3964 | open(FILE, "$groupfile"); | |
3965 | @groupmembers = <FILE>; | |
3966 | close(FILE); | |
3967 | foreach $line (@groupmembers) { if (!($line =~ /^$str_user$/i)) { push(@templist, $line); } } | |
3968 | open(FILE, ">$groupfile"); | |
3969 | flock FILE, 2; | |
3970 | print FILE @templist; | |
3971 | close(FILE); | |
3972 | } | |
3973 | ||
3974 | undef @templist; | |
3975 | open(FILE, "$userdb"); | |
3976 | @groupmembers = <FILE>; | |
3977 | close(FILE); | |
3978 | foreach $line (@groupmembers) { if (!($line =~ /^$str_user:/i)) { push(@templist, $line); } } | |
3979 | open(FILE, ">$userdb"); | |
3980 | flock FILE, 2; | |
3981 | print FILE @templist; | |
3982 | close(FILE); | |
3983 | ||
3984 | return; | |
3985 | } | |
ac1cfefa | 3986 | |
ed38f89d | 3987 | # ------------------------------------------------------------------- |
fe1656d2 CS |
3988 | |
3989 | sub writecachemgr | |
3990 | { | |
3991 | open(FILE, ">${General::swroot}/proxy/cachemgr.conf"); | |
3992 | flock(FILE, 2); | |
3993 | print FILE "$netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}\n"; | |
3994 | print FILE "localhost"; | |
d9f2cfa4 | 3995 | close(FILE); |
fe1656d2 CS |
3996 | return; |
3997 | } | |
3998 | ||
3999 | # ------------------------------------------------------------------- |