"Update Booster" fertiggestellt und getestet.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / proxy.cgi
1 #!/usr/bin/perl
2 #
3 # (c) 2004-2007 marco.s - http://www.advproxy.net
4 #
5 # This code is distributed under the terms of the GPL
6 #
7 # $Id: advproxy.cgi,v 2.1.0 2007/03/06 00:00:00 marco.s Exp $
8 #
9
10 use strict;
11
12 # enable only the following on debugging purpose
13 use warnings;
14 use CGI::Carp 'fatalsToBrowser';
15
16 require '/var/ipfire/general-functions.pl';
17 require "${General::swroot}/lang.pl";
18 require "${General::swroot}/header.pl";
19
20 my @squidversion = `/usr/sbin/squid -v`;
21 my $http_port='81';
22 my $https_port='444';
23
24 my %proxysettings=();
25 my %netsettings=();
26 my %filtersettings=();
27 my %xlratorsettings=();
28 my %stdproxysettings=();
29 my %mainsettings=();
30
31 my %checked=();
32 my %selected=();
33
34 my @throttle_limits=(64,128,256,384,512,1024,2048,3072,5120);
35 my $throttle_binary="bin|cab|exe|gz|rar|sea|tar|tgz|zip";
36 my $throttle_dskimg="b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi";
37 my $throttle_mmedia="aiff?|asf|avi|divx|mov|mp3|mpe?g|qt|ra?m";
38
39 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";
40 my $def_ports_ssl="443 # https\n563 # snews\n";
41
42 my @useragent=();
43 my @useragentlist=();
44
45 my $hintcolour='#FFFFCC';
46 my $ncsa_buttontext='';
47 my $language='';
48 my $i=0;
49 my $n=0;
50 my $id=0;
51 my $line='';
52 my $user='';
53 my @userlist=();
54 my @grouplist=();
55 my @temp=();
56 my @templist=();
57
58 my $cachemem=0;
59 my $proxy1='';
60 my $proxy2='';
61 my $replybodymaxsize=0;
62 my $browser_regexp='';
63 my $needhup = 0;
64 my $errormessage='';
65
66 my $acldir = "${General::swroot}/proxy/advanced/acls";
67 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa";
68 my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm";
69 my $raddir = "${General::swroot}/proxy/advanced/radius";
70 my $identdir = "${General::swroot}/proxy/advanced/ident";
71 my $credir = "${General::swroot}/proxy/advanced/cre";
72
73 my $userdb = "$ncsadir/passwd";
74 my $stdgrp = "$ncsadir/standard.grp";
75 my $extgrp = "$ncsadir/extended.grp";
76 my $disgrp = "$ncsadir/disabled.grp";
77
78 my $browserdb = "${General::swroot}/proxy/advanced/useragents";
79 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes";
80 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle";
81
82 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable";
83 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms";
84 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors";
85
86 my $identhosts = "$identdir/hosts";
87
88 my $authdir = "/usr/lib/squid/auth";
89 my $errordir = "/usr/lib/squid/errors";
90
91 my $acl_src_subnets = "$acldir/src_subnets.acl";
92 my $acl_src_banned_ip = "$acldir/src_banned_ip.acl";
93 my $acl_src_banned_mac = "$acldir/src_banned_mac.acl";
94 my $acl_src_unrestricted_ip = "$acldir/src_unrestricted_ip.acl";
95 my $acl_src_unrestricted_mac = "$acldir/src_unrestricted_mac.acl";
96 my $acl_src_noaccess_ip = "$acldir/src_noaccess_ip.acl";
97 my $acl_src_noaccess_mac = "$acldir/src_noaccess_mac.acl";
98 my $acl_dst_nocache = "$acldir/dst_nocache.acl";
99 my $acl_dst_noauth = "$acldir/dst_noauth.acl";
100 my $acl_dst_throttle = "$acldir/dst_throttle.acl";
101 my $acl_ports_safe = "$acldir/ports_safe.acl";
102 my $acl_ports_ssl = "$acldir/ports_ssl.acl";
103 my $acl_include = "$acldir/include.acl";
104
105 my $updaccelversion = 'n/a';
106 my $urlfilterversion = 'n/a';
107
108 unless (-d "$acldir") { mkdir("$acldir"); }
109 unless (-d "$ncsadir") { mkdir("$ncsadir"); }
110 unless (-d "$ntlmdir") { mkdir("$ntlmdir"); }
111 unless (-d "$raddir") { mkdir("$raddir"); }
112 unless (-d "$identdir") { mkdir("$identdir"); }
113 unless (-d "$credir") { mkdir("$credir"); }
114
115 unless (-e $cre_groups) { system("touch $cre_groups"); }
116 unless (-e $cre_svhosts) { system("touch $cre_svhosts"); }
117
118 unless (-e $userdb) { system("touch $userdb"); }
119 unless (-e $stdgrp) { system("touch $stdgrp"); }
120 unless (-e $extgrp) { system("touch $extgrp"); }
121 unless (-e $disgrp) { system("touch $disgrp"); }
122
123 unless (-e $acl_src_subnets) { system("touch $acl_src_subnets"); }
124 unless (-e $acl_src_banned_ip) { system("touch $acl_src_banned_ip"); }
125 unless (-e $acl_src_banned_mac) { system("touch $acl_src_banned_mac"); }
126 unless (-e $acl_src_unrestricted_ip) { system("touch $acl_src_unrestricted_ip"); }
127 unless (-e $acl_src_unrestricted_mac) { system("touch $acl_src_unrestricted_mac"); }
128 unless (-e $acl_src_noaccess_ip) { system("touch $acl_src_noaccess_ip"); }
129 unless (-e $acl_src_noaccess_mac) { system("touch $acl_src_noaccess_mac"); }
130 unless (-e $acl_dst_nocache) { system("touch $acl_dst_nocache"); }
131 unless (-e $acl_dst_noauth) { system("touch $acl_dst_noauth"); }
132 unless (-e $acl_dst_throttle) { system("touch $acl_dst_throttle"); }
133 unless (-e $acl_ports_safe) { system("touch $acl_ports_safe"); }
134 unless (-e $acl_ports_ssl) { system("touch $acl_ports_ssl"); }
135 unless (-e $acl_include) { system("touch $acl_include"); }
136
137 unless (-e $browserdb) { system("touch $browserdb"); }
138 unless (-e $mimetypes) { system("touch $mimetypes"); }
139
140 open FILE, $browserdb;
141 @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>;
142 close(FILE);
143
144 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
145 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
146
147 $filtersettings{'CHILDREN'} = '5';
148 if (-e "${General::swroot}/urlfilter/settings") {
149 &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings);
150 }
151
152 $xlratorsettings{'CHILDREN'} = '5';
153 if (-e "${General::swroot}/updatexlrator/settings") {
154 &General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
155 }
156
157 &Header::showhttpheaders();
158
159 $proxysettings{'ACTION'} = '';
160 $proxysettings{'VALID'} = '';
161
162 $proxysettings{'ENABLE'} = 'off';
163 $proxysettings{'ENABLE_BLUE'} = 'off';
164 $proxysettings{'TRANSPARENT'} = 'off';
165 $proxysettings{'TRANSPARENT_BLUE'} = 'off';
166 $proxysettings{'PROXY_PORT'} = '800';
167 $proxysettings{'VISIBLE_HOSTNAME'} = '';
168 $proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
169 $proxysettings{'ERR_LANGUAGE'} = 'English';
170 $proxysettings{'ERR_DESIGN'} = 'IPCop';
171 $proxysettings{'SUPPRESS_VERSION'} = 'off';
172 $proxysettings{'FORWARD_VIA'} = 'off';
173 $proxysettings{'FORWARD_IPADDRESS'} = 'off';
174 $proxysettings{'FORWARD_USERNAME'} = 'off';
175 $proxysettings{'NO_CONNECTION_AUTH'} = 'off';
176 $proxysettings{'UPSTREAM_PROXY'} = '';
177 $proxysettings{'UPSTREAM_USER'} = '';
178 $proxysettings{'UPSTREAM_PASSWORD'} = '';
179 $proxysettings{'LOGGING'} = 'off';
180 $proxysettings{'LOGQUERY'} = 'off';
181 $proxysettings{'LOGUSERAGENT'} = 'off';
182 $proxysettings{'CACHE_MEM'} = '2';
183 $proxysettings{'CACHE_SIZE'} = '50';
184 $proxysettings{'MAX_SIZE'} = '4096';
185 $proxysettings{'MIN_SIZE'} = '0';
186 $proxysettings{'MEM_POLICY'} = 'LRU';
187 $proxysettings{'CACHE_POLICY'} = 'LRU';
188 $proxysettings{'L1_DIRS'} = '16';
189 $proxysettings{'OFFLINE_MODE'} = 'off';
190 $proxysettings{'CLASSROOM_EXT'} = 'off';
191 $proxysettings{'SUPERVISOR_PASSWORD'} = '';
192 $proxysettings{'NO_PROXY_LOCAL'} = 'off';
193 $proxysettings{'NO_PROXY_LOCAL_BLUE'} = 'off';
194 $proxysettings{'TIME_ACCESS_MODE'} = 'allow';
195 $proxysettings{'TIME_FROM_HOUR'} = '00';
196 $proxysettings{'TIME_FROM_MINUTE'} = '00';
197 $proxysettings{'TIME_TO_HOUR'} = '24';
198 $proxysettings{'TIME_TO_MINUTE'} = '00';
199 $proxysettings{'MAX_OUTGOING_SIZE'} = '0';
200 $proxysettings{'MAX_INCOMING_SIZE'} = '0';
201 $proxysettings{'THROTTLING_GREEN_TOTAL'} = 'unlimited';
202 $proxysettings{'THROTTLING_GREEN_HOST'} = 'unlimited';
203 $proxysettings{'THROTTLING_BLUE_TOTAL'} = 'unlimited';
204 $proxysettings{'THROTTLING_BLUE_HOST'} = 'unlimited';
205 $proxysettings{'THROTTLE_BINARY'} = 'off';
206 $proxysettings{'THROTTLE_DSKIMG'} = 'off';
207 $proxysettings{'THROTTLE_MMEDIA'} = 'off';
208 $proxysettings{'ENABLE_MIME_FILTER'} = 'off';
209 $proxysettings{'ENABLE_BROWSER_CHECK'} = 'off';
210 $proxysettings{'FAKE_USERAGENT'} = '';
211 $proxysettings{'FAKE_REFERER'} = '';
212 $proxysettings{'AUTH_METHOD'} = 'none';
213 $proxysettings{'AUTH_REALM'} = '';
214 $proxysettings{'AUTH_MAX_USERIP'} = '';
215 $proxysettings{'AUTH_CACHE_TTL'} = '60';
216 $proxysettings{'AUTH_IPCACHE_TTL'} = '0';
217 $proxysettings{'AUTH_CHILDREN'} = '5';
218 $proxysettings{'NCSA_MIN_PASS_LEN'} = '6';
219 $proxysettings{'NCSA_BYPASS_REDIR'} = 'off';
220 $proxysettings{'NCSA_USERNAME'} = '';
221 $proxysettings{'NCSA_GROUP'} = '';
222 $proxysettings{'NCSA_PASS'} = '';
223 $proxysettings{'NCSA_PASS_CONFIRM'} = '';
224 $proxysettings{'LDAP_BASEDN'} = '';
225 $proxysettings{'LDAP_TYPE'} = 'ADS';
226 $proxysettings{'LDAP_SERVER'} = '';
227 $proxysettings{'LDAP_PORT'} = '389';
228 $proxysettings{'LDAP_BINDDN_USER'} = '';
229 $proxysettings{'LDAP_BINDDN_PASS'} = '';
230 $proxysettings{'LDAP_GROUP'} = '';
231 $proxysettings{'NTLM_DOMAIN'} = '';
232 $proxysettings{'NTLM_PDC'} = '';
233 $proxysettings{'NTLM_BDC'} = '';
234 $proxysettings{'NTLM_ENABLE_ACL'} = 'off';
235 $proxysettings{'NTLM_USER_ACL'} = 'positive';
236 $proxysettings{'RADIUS_SERVER'} = '';
237 $proxysettings{'RADIUS_PORT'} = '1812';
238 $proxysettings{'RADIUS_IDENTIFIER'} = '';
239 $proxysettings{'RADIUS_SECRET'} = '';
240 $proxysettings{'RADIUS_ENABLE_ACL'} = 'off';
241 $proxysettings{'RADIUS_USER_ACL'} = 'positive';
242 $proxysettings{'IDENT_REQUIRED'} = 'off';
243 $proxysettings{'IDENT_TIMEOUT'} = '10';
244 $proxysettings{'IDENT_ENABLE_ACL'} = 'off';
245 $proxysettings{'IDENT_USER_ACL'} = 'positive';
246 $proxysettings{'ENABLE_FILTER'} = 'off';
247 $proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
248
249 $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'};
250
251 &Header::getcgihash(\%proxysettings);
252
253 if ($proxysettings{'THROTTLING_GREEN_TOTAL'} eq 0) {$proxysettings{'THROTTLING_GREEN_TOTAL'} = 'unlimited';}
254 if ($proxysettings{'THROTTLING_GREEN_HOST'} eq 0) {$proxysettings{'THROTTLING_GREEN_HOST'} = 'unlimited';}
255 if ($proxysettings{'THROTTLING_BLUE_TOTAL'} eq 0) {$proxysettings{'THROTTLING_BLUE_TOTAL'} = 'unlimited';}
256 if ($proxysettings{'THROTTLING_BLUE_HOST'} eq 0) {$proxysettings{'THROTTLING_BLUE_HOST'} = 'unlimited';}
257
258 if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy NCSA user management'})
259 {
260 $proxysettings{'NCSA_EDIT_MODE'} = 'yes';
261 }
262
263 if ($proxysettings{'ACTION'} eq $Lang::tr{'add'})
264 {
265 $proxysettings{'NCSA_EDIT_MODE'} = 'yes';
266 if (length($proxysettings{'NCSA_PASS'}) < $proxysettings{'NCSA_MIN_PASS_LEN'}) {
267 $errormessage = $Lang::tr{'advproxy errmsg password length 1'}.$proxysettings{'NCSA_MIN_PASS_LEN'}.$Lang::tr{'advproxy errmsg password length 2'};
268 }
269 if (!($proxysettings{'NCSA_PASS'} eq $proxysettings{'NCSA_PASS_CONFIRM'})) {
270 $errormessage = $Lang::tr{'advproxy errmsg passwords different'};
271 }
272 if ($proxysettings{'NCSA_USERNAME'} eq '') {
273 $errormessage = $Lang::tr{'advproxy errmsg no username'};
274 }
275 if (!$errormessage) {
276 $proxysettings{'NCSA_USERNAME'} =~ tr/A-Z/a-z/;
277 &adduser($proxysettings{'NCSA_USERNAME'}, $proxysettings{'NCSA_PASS'}, $proxysettings{'NCSA_GROUP'});
278 }
279 $proxysettings{'NCSA_USERNAME'} = '';
280 $proxysettings{'NCSA_GROUP'} = '';
281 $proxysettings{'NCSA_PASS'} = '';
282 $proxysettings{'NCSA_PASS_CONFIRM'} = '';
283 }
284
285 if ($proxysettings{'ACTION'} eq $Lang::tr{'remove'})
286 {
287 $proxysettings{'NCSA_EDIT_MODE'} = 'yes';
288 &deluser($proxysettings{'ID'});
289 }
290
291 $checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
292 $checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
293 $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
294
295 if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'})
296 {
297 $proxysettings{'NCSA_EDIT_MODE'} = 'yes';
298 $ncsa_buttontext = $Lang::tr{'advproxy NCSA update user'};
299 @temp = split(/:/,$proxysettings{'ID'});
300 $proxysettings{'NCSA_USERNAME'} = $temp[0];
301 $proxysettings{'NCSA_GROUP'} = $temp[1];
302 $proxysettings{'NCSA_PASS'} = "lEaVeAlOnE";
303 $proxysettings{'NCSA_PASS_CONFIRM'} = $proxysettings{'NCSA_PASS'};
304 }
305
306 if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}))
307 {
308 if ($proxysettings{'ENABLE'} !~ /^(on|off)$/ ||
309 $proxysettings{'TRANSPARENT'} !~ /^(on|off)$/ ||
310 $proxysettings{'ENABLE_BLUE'} !~ /^(on|off)$/ ||
311 $proxysettings{'TRANSPARENT_BLUE'} !~ /^(on|off)$/ ) {
312 $errormessage = $Lang::tr{'invalid input'};
313 goto ERROR;
314 }
315 if (!(&General::validport($proxysettings{'PROXY_PORT'})))
316 {
317 $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'};
318 goto ERROR;
319 }
320 if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) ||
321 ($proxysettings{'CACHE_SIZE'} < 10))
322 {
323 $errormessage = $Lang::tr{'advproxy errmsg hdd cache size'};
324 goto ERROR;
325 }
326 if (!($proxysettings{'CACHE_MEM'} =~ /^\d+/) ||
327 ($proxysettings{'CACHE_MEM'} < 1))
328 {
329 $errormessage = $Lang::tr{'advproxy errmsg mem cache size'};
330 goto ERROR;
331 }
332 my @free = `/usr/bin/free`;
333 $free[1] =~ m/(\d+)/;
334 $cachemem = int $1 / 2048;
335 if ($proxysettings{'CACHE_MEM'} > $cachemem) {
336 $proxysettings{'CACHE_MEM'} = $cachemem;
337 }
338 if (!($proxysettings{'MAX_SIZE'} =~ /^\d+/))
339 {
340 $errormessage = $Lang::tr{'invalid maximum object size'};
341 goto ERROR;
342 }
343 if (!($proxysettings{'MIN_SIZE'} =~ /^\d+/))
344 {
345 $errormessage = $Lang::tr{'invalid minimum object size'};
346 goto ERROR;
347 }
348 if (!($proxysettings{'MAX_OUTGOING_SIZE'} =~ /^\d+/))
349 {
350 $errormessage = $Lang::tr{'invalid maximum outgoing size'};
351 goto ERROR;
352 }
353 if (!($proxysettings{'TIME_TO_HOUR'}.$proxysettings{'TIME_TO_MINUTE'} gt $proxysettings{'TIME_FROM_HOUR'}.$proxysettings{'TIME_FROM_MINUTE'}))
354 {
355 $errormessage = $Lang::tr{'advproxy errmsg time restriction'};
356 goto ERROR;
357 }
358 if (!($proxysettings{'MAX_INCOMING_SIZE'} =~ /^\d+/))
359 {
360 $errormessage = $Lang::tr{'invalid maximum incoming size'};
361 goto ERROR;
362 }
363 if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on')
364 {
365 $browser_regexp = '';
366 foreach (@useragentlist)
367 {
368 chomp;
369 @useragent = split(/,/);
370 if ($proxysettings{'UA_'.@useragent[0]} eq 'on') { $browser_regexp .= "@useragent[2]|"; }
371 }
372 chop($browser_regexp);
373 if (!$browser_regexp)
374 {
375 $errormessage = $Lang::tr{'advproxy errmsg no browser'};
376 goto ERROR;
377 }
378 }
379 if (!($proxysettings{'AUTH_METHOD'} eq 'none'))
380 {
381 unless (($proxysettings{'AUTH_METHOD'} eq 'ident') &&
382 ($proxysettings{'IDENT_REQUIRED'} eq 'off') &&
383 ($proxysettings{'IDENT_ENABLE_ACL'} eq 'off'))
384 {
385 if ($netsettings{'BLUE_DEV'})
386 {
387 if ((($proxysettings{'ENABLE'} eq 'off') || ($proxysettings{'TRANSPARENT'} eq 'on')) &&
388 (($proxysettings{'ENABLE_BLUE'} eq 'off') || ($proxysettings{'TRANSPARENT_BLUE'} eq 'on')))
389 {
390 $errormessage = $Lang::tr{'advproxy errmsg non-transparent proxy required'};
391 goto ERROR;
392 }
393 } else {
394 if (($proxysettings{'ENABLE'} eq 'off') || ($proxysettings{'TRANSPARENT'} eq 'on'))
395 {
396 $errormessage = $Lang::tr{'advproxy errmsg non-transparent proxy required'};
397 goto ERROR;
398 }
399 }
400 }
401 if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) &&
402 ((!($proxysettings{'AUTH_MAX_USERIP'} =~ /^\d+/)) || ($proxysettings{'AUTH_MAX_USERIP'} < 1) || ($proxysettings{'AUTH_MAX_USERIP'} > 255)))
403 {
404 $errormessage = $Lang::tr{'advproxy errmsg max userip'};
405 goto ERROR;
406 }
407 if (!($proxysettings{'AUTH_CACHE_TTL'} =~ /^\d+/))
408 {
409 $errormessage = $Lang::tr{'advproxy errmsg auth cache ttl'};
410 goto ERROR;
411 }
412 if (!($proxysettings{'AUTH_IPCACHE_TTL'} =~ /^\d+/))
413 {
414 $errormessage = $Lang::tr{'advproxy errmsg auth ipcache ttl'};
415 goto ERROR;
416 }
417 if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) && ($proxysettings{'AUTH_IPCACHE_TTL'} eq '0'))
418 {
419 $errormessage = $Lang::tr{'advproxy errmsg auth ipcache may not be null'};
420 goto ERROR;
421 }
422 if ((!($proxysettings{'AUTH_CHILDREN'} =~ /^\d+/)) || ($proxysettings{'AUTH_CHILDREN'} < 1) || ($proxysettings{'AUTH_CHILDREN'} > 255))
423 {
424 $errormessage = $Lang::tr{'advproxy errmsg auth children'};
425 goto ERROR;
426 }
427 }
428 if ($proxysettings{'AUTH_METHOD'} eq 'ncsa')
429 {
430 if ((!($proxysettings{'NCSA_MIN_PASS_LEN'} =~ /^\d+/)) || ($proxysettings{'NCSA_MIN_PASS_LEN'} < 1) || ($proxysettings{'NCSA_MIN_PASS_LEN'} > 255))
431 {
432 $errormessage = $Lang::tr{'advproxy errmsg password length'};
433 goto ERROR;
434 }
435 }
436 if ($proxysettings{'AUTH_METHOD'} eq 'ident')
437 {
438 if ((!($proxysettings{'IDENT_TIMEOUT'} =~ /^\d+/)) || ($proxysettings{'IDENT_TIMEOUT'} < 1))
439 {
440 $errormessage = $Lang::tr{'advproxy errmsg ident timeout'};
441 goto ERROR;
442 }
443 }
444 if ($proxysettings{'AUTH_METHOD'} eq 'ldap')
445 {
446 if ($proxysettings{'LDAP_BASEDN'} eq '')
447 {
448 $errormessage = $Lang::tr{'advproxy errmsg ldap base dn'};
449 goto ERROR;
450 }
451 if (!&General::validip($proxysettings{'LDAP_SERVER'}))
452 {
453 $errormessage = $Lang::tr{'advproxy errmsg ldap server'};
454 goto ERROR;
455 }
456 if (!&General::validport($proxysettings{'LDAP_PORT'}))
457 {
458 $errormessage = $Lang::tr{'advproxy errmsg ldap port'};
459 goto ERROR;
460 }
461 if (($proxysettings{'LDAP_TYPE'} eq 'ADS') || ($proxysettings{'LDAP_TYPE'} eq 'NDS'))
462 {
463 if (($proxysettings{'LDAP_BINDDN_USER'} eq '') || ($proxysettings{'LDAP_BINDDN_PASS'} eq ''))
464 {
465 $errormessage = $Lang::tr{'advproxy errmsg ldap bind dn'};
466 goto ERROR;
467 }
468 }
469 }
470 if ($proxysettings{'AUTH_METHOD'} eq 'ntlm')
471 {
472 if ($proxysettings{'NTLM_DOMAIN'} eq '')
473 {
474 $errormessage = $Lang::tr{'advproxy errmsg ntlm domain'};
475 goto ERROR;
476 }
477 if ($proxysettings{'NTLM_PDC'} eq '')
478 {
479 $errormessage = $Lang::tr{'advproxy errmsg ntlm pdc'};
480 goto ERROR;
481 }
482 if (!&General::validhostname($proxysettings{'NTLM_PDC'}))
483 {
484 $errormessage = $Lang::tr{'advproxy errmsg invalid pdc'};
485 goto ERROR;
486 }
487 if ((!($proxysettings{'NTLM_BDC'} eq '')) && (!&General::validhostname($proxysettings{'NTLM_BDC'})))
488 {
489 $errormessage = $Lang::tr{'advproxy errmsg invalid bdc'};
490 goto ERROR;
491 }
492 }
493 if ($proxysettings{'AUTH_METHOD'} eq 'radius')
494 {
495 if (!&General::validip($proxysettings{'RADIUS_SERVER'}))
496 {
497 $errormessage = $Lang::tr{'advproxy errmsg radius server'};
498 goto ERROR;
499 }
500 if (!&General::validport($proxysettings{'RADIUS_PORT'}))
501 {
502 $errormessage = $Lang::tr{'advproxy errmsg radius port'};
503 goto ERROR;
504 }
505 if ($proxysettings{'RADIUS_SECRET'} eq '')
506 {
507 $errormessage = $Lang::tr{'advproxy errmsg radius secret'};
508 goto ERROR;
509 }
510 }
511
512 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
513 $proxy1 = 'YES';
514 $proxy2 = 'YES';
515 if (($proxysettings{'UPSTREAM_USER'} eq '')) {$proxy1 = '';}
516 if (($proxysettings{'UPSTREAM_PASSWORD'} eq '')) {$proxy2 = '';}
517 if ($proxysettings{'UPSTREAM_USER'} eq 'PASS') {$proxy1=$proxy2='PASS'; $proxysettings{'UPSTREAM_PASSWORD'} = '';}
518 if (($proxy1 ne $proxy2))
519 {
520 $errormessage = $Lang::tr{'advproxy errmsg invalid upstream proxy username or password setting'};
521 goto ERROR;
522 }
523
524 ERROR:
525 &check_acls;
526
527 if ($errormessage) {
528 $proxysettings{'VALID'} = 'no'; }
529 else {
530 $proxysettings{'VALID'} = 'yes'; }
531
532 if ($proxysettings{'VALID'} eq 'yes')
533 {
534 &write_acls;
535
536 delete $proxysettings{'SRC_SUBNETS'};
537 delete $proxysettings{'SRC_BANNED_IP'};
538 delete $proxysettings{'SRC_BANNED_MAC'};
539 delete $proxysettings{'SRC_UNRESTRICTED_IP'};
540 delete $proxysettings{'SRC_UNRESTRICTED_MAC'};
541 delete $proxysettings{'DST_NOCACHE'};
542 delete $proxysettings{'DST_NOAUTH'};
543 delete $proxysettings{'PORTS_SAFE'};
544 delete $proxysettings{'PORTS_SSL'};
545 delete $proxysettings{'MIME_TYPES'};
546 delete $proxysettings{'NTLM_ALLOW_USERS'};
547 delete $proxysettings{'NTLM_DENY_USERS'};
548 delete $proxysettings{'RADIUS_ALLOW_USERS'};
549 delete $proxysettings{'RADIUS_DENY_USERS'};
550 delete $proxysettings{'IDENT_HOSTS'};
551 delete $proxysettings{'IDENT_ALLOW_USERS'};
552 delete $proxysettings{'IDENT_DENY_USERS'};
553
554 delete $proxysettings{'CRE_GROUPS'};
555 delete $proxysettings{'CRE_SVHOSTS'};
556
557 delete $proxysettings{'NCSA_USERNAME'};
558 delete $proxysettings{'NCSA_GROUP'};
559 delete $proxysettings{'NCSA_PASS'};
560 delete $proxysettings{'NCSA_PASS_CONFIRM'};
561
562 $proxysettings{'TIME_MON'} = 'off' unless exists $proxysettings{'TIME_MON'};
563 $proxysettings{'TIME_TUE'} = 'off' unless exists $proxysettings{'TIME_TUE'};
564 $proxysettings{'TIME_WED'} = 'off' unless exists $proxysettings{'TIME_WED'};
565 $proxysettings{'TIME_THU'} = 'off' unless exists $proxysettings{'TIME_THU'};
566 $proxysettings{'TIME_FRI'} = 'off' unless exists $proxysettings{'TIME_FRI'};
567 $proxysettings{'TIME_SAT'} = 'off' unless exists $proxysettings{'TIME_SAT'};
568 $proxysettings{'TIME_SUN'} = 'off' unless exists $proxysettings{'TIME_SUN'};
569
570 $proxysettings{'AUTH_ALWAYS_REQUIRED'} = 'off' unless exists $proxysettings{'AUTH_ALWAYS_REQUIRED'};
571 $proxysettings{'NTLM_ENABLE_INT_AUTH'} = 'off' unless exists $proxysettings{'NTLM_ENABLE_INT_AUTH'};
572
573 &General::writehash("${General::swroot}/proxy/advanced/settings", \%proxysettings);
574
575 if (-e "${General::swroot}/proxy/settings") { &General::readhash("${General::swroot}/proxy/settings", \%stdproxysettings); }
576 $stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'};
577 $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'};
578 $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'};
579 &General::writehash("${General::swroot}/proxy/settings", \%stdproxysettings);
580
581 &writeconfig;
582 &writepacfile;
583
584 unlink "${General::swroot}/proxy/enable";
585 unlink "${General::swroot}/proxy/transparent";
586 unlink "${General::swroot}/proxy/enable_blue";
587 unlink "${General::swroot}/proxy/transparent_blue";
588
589 if ($proxysettings{'ENABLE'} eq 'on') {
590 system ('/usr/bin/touch', "${General::swroot}/proxy/enable"); }
591 if ($proxysettings{'TRANSPARENT'} eq 'on') {
592 system ('/usr/bin/touch', "${General::swroot}/proxy/transparent"); }
593 if ($proxysettings{'ENABLE_BLUE'} eq 'on') {
594 system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue"); }
595 if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') {
596 system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); }
597
598 if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/restartsquid'); }
599 }
600 }
601
602 if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy clear cache'})
603 {
604 system('/usr/local/bin/restartsquid','-f');
605 }
606
607 if (!$errormessage)
608 {
609 if (-e "${General::swroot}/proxy/advanced/settings") {
610 &General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings);
611 } elsif (-e "${General::swroot}/proxy/settings") {
612 &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
613 }
614 &read_acls;
615 }
616
617 $checked{'ENABLE'}{'off'} = '';
618 $checked{'ENABLE'}{'on'} = '';
619 $checked{'ENABLE'}{$proxysettings{'ENABLE'}} = "checked='checked'";
620
621 $checked{'TRANSPARENT'}{'off'} = '';
622 $checked{'TRANSPARENT'}{'on'} = '';
623 $checked{'TRANSPARENT'}{$proxysettings{'TRANSPARENT'}} = "checked='checked'";
624
625 $checked{'ENABLE_BLUE'}{'off'} = '';
626 $checked{'ENABLE_BLUE'}{'on'} = '';
627 $checked{'ENABLE_BLUE'}{$proxysettings{'ENABLE_BLUE'}} = "checked='checked'";
628
629 $checked{'TRANSPARENT_BLUE'}{'off'} = '';
630 $checked{'TRANSPARENT_BLUE'}{'on'} = '';
631 $checked{'TRANSPARENT_BLUE'}{$proxysettings{'TRANSPARENT_BLUE'}} = "checked='checked'";
632
633 $checked{'SUPPRESS_VERSION'}{'off'} = '';
634 $checked{'SUPPRESS_VERSION'}{'on'} = '';
635 $checked{'SUPPRESS_VERSION'}{$proxysettings{'SUPPRESS_VERSION'}} = "checked='checked'";
636
637 $checked{'FORWARD_IPADDRESS'}{'off'} = '';
638 $checked{'FORWARD_IPADDRESS'}{'on'} = '';
639 $checked{'FORWARD_IPADDRESS'}{$proxysettings{'FORWARD_IPADDRESS'}} = "checked='checked'";
640 $checked{'FORWARD_USERNAME'}{'off'} = '';
641 $checked{'FORWARD_USERNAME'}{'on'} = '';
642 $checked{'FORWARD_USERNAME'}{$proxysettings{'FORWARD_USERNAME'}} = "checked='checked'";
643 $checked{'FORWARD_VIA'}{'off'} = '';
644 $checked{'FORWARD_VIA'}{'on'} = '';
645 $checked{'FORWARD_VIA'}{$proxysettings{'FORWARD_VIA'}} = "checked='checked'";
646 $checked{'NO_CONNECTION_AUTH'}{'off'} = '';
647 $checked{'NO_CONNECTION_AUTH'}{'on'} = '';
648 $checked{'NO_CONNECTION_AUTH'}{$proxysettings{'NO_CONNECTION_AUTH'}} = "checked='checked'";
649
650 $selected{'MEM_POLICY'}{$proxysettings{'MEM_POLICY'}} = "selected='selected'";
651 $selected{'CACHE_POLICY'}{$proxysettings{'CACHE_POLICY'}} = "selected='selected'";
652 $selected{'L1_DIRS'}{$proxysettings{'L1_DIRS'}} = "selected='selected'";
653 $checked{'OFFLINE_MODE'}{'off'} = '';
654 $checked{'OFFLINE_MODE'}{'on'} = '';
655 $checked{'OFFLINE_MODE'}{$proxysettings{'OFFLINE_MODE'}} = "checked='checked'";
656
657 $checked{'LOGGING'}{'off'} = '';
658 $checked{'LOGGING'}{'on'} = '';
659 $checked{'LOGGING'}{$proxysettings{'LOGGING'}} = "checked='checked'";
660 $checked{'LOGQUERY'}{'off'} = '';
661 $checked{'LOGQUERY'}{'on'} = '';
662 $checked{'LOGQUERY'}{$proxysettings{'LOGQUERY'}} = "checked='checked'";
663 $checked{'LOGUSERAGENT'}{'off'} = '';
664 $checked{'LOGUSERAGENT'}{'on'} = '';
665 $checked{'LOGUSERAGENT'}{$proxysettings{'LOGUSERAGENT'}} = "checked='checked'";
666
667 $selected{'ERR_LANGUAGE'}{$proxysettings{'ERR_LANGUAGE'}} = "selected='selected'";
668 $selected{'ERR_DESIGN'}{$proxysettings{'ERR_DESIGN'}} = "selected='selected'";
669
670 $checked{'NO_PROXY_LOCAL'}{'off'} = '';
671 $checked{'NO_PROXY_LOCAL'}{'on'} = '';
672 $checked{'NO_PROXY_LOCAL'}{$proxysettings{'NO_PROXY_LOCAL'}} = "checked='checked'";
673 $checked{'NO_PROXY_LOCAL_BLUE'}{'off'} = '';
674 $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} = '';
675 $checked{'NO_PROXY_LOCAL_BLUE'}{$proxysettings{'NO_PROXY_LOCAL_BLUE'}} = "checked='checked'";
676
677 $checked{'CLASSROOM_EXT'}{'off'} = '';
678 $checked{'CLASSROOM_EXT'}{'on'} = '';
679 $checked{'CLASSROOM_EXT'}{$proxysettings{'CLASSROOM_EXT'}} = "checked='checked'";
680
681 $selected{'TIME_ACCESS_MODE'}{$proxysettings{'TIME_ACCESS_MODE'}} = "selected='selected'";
682 $selected{'TIME_FROM_HOUR'}{$proxysettings{'TIME_FROM_HOUR'}} = "selected='selected'";
683 $selected{'TIME_FROM_MINUTE'}{$proxysettings{'TIME_FROM_MINUTE'}} = "selected='selected'";
684 $selected{'TIME_TO_HOUR'}{$proxysettings{'TIME_TO_HOUR'}} = "selected='selected'";
685 $selected{'TIME_TO_MINUTE'}{$proxysettings{'TIME_TO_MINUTE'}} = "selected='selected'";
686
687 $proxysettings{'TIME_MON'} = 'on' unless exists $proxysettings{'TIME_MON'};
688 $proxysettings{'TIME_TUE'} = 'on' unless exists $proxysettings{'TIME_TUE'};
689 $proxysettings{'TIME_WED'} = 'on' unless exists $proxysettings{'TIME_WED'};
690 $proxysettings{'TIME_THU'} = 'on' unless exists $proxysettings{'TIME_THU'};
691 $proxysettings{'TIME_FRI'} = 'on' unless exists $proxysettings{'TIME_FRI'};
692 $proxysettings{'TIME_SAT'} = 'on' unless exists $proxysettings{'TIME_SAT'};
693 $proxysettings{'TIME_SUN'} = 'on' unless exists $proxysettings{'TIME_SUN'};
694
695 $checked{'TIME_MON'}{'off'} = '';
696 $checked{'TIME_MON'}{'on'} = '';
697 $checked{'TIME_MON'}{$proxysettings{'TIME_MON'}} = "checked='checked'";
698 $checked{'TIME_TUE'}{'off'} = '';
699 $checked{'TIME_TUE'}{'on'} = '';
700 $checked{'TIME_TUE'}{$proxysettings{'TIME_TUE'}} = "checked='checked'";
701 $checked{'TIME_WED'}{'off'} = '';
702 $checked{'TIME_WED'}{'on'} = '';
703 $checked{'TIME_WED'}{$proxysettings{'TIME_WED'}} = "checked='checked'";
704 $checked{'TIME_THU'}{'off'} = '';
705 $checked{'TIME_THU'}{'on'} = '';
706 $checked{'TIME_THU'}{$proxysettings{'TIME_THU'}} = "checked='checked'";
707 $checked{'TIME_FRI'}{'off'} = '';
708 $checked{'TIME_FRI'}{'on'} = '';
709 $checked{'TIME_FRI'}{$proxysettings{'TIME_FRI'}} = "checked='checked'";
710 $checked{'TIME_SAT'}{'off'} = '';
711 $checked{'TIME_SAT'}{'on'} = '';
712 $checked{'TIME_SAT'}{$proxysettings{'TIME_SAT'}} = "checked='checked'";
713 $checked{'TIME_SUN'}{'off'} = '';
714 $checked{'TIME_SUN'}{'on'} = '';
715 $checked{'TIME_SUN'}{$proxysettings{'TIME_SUN'}} = "checked='checked'";
716
717 $selected{'THROTTLING_GREEN_TOTAL'}{$proxysettings{'THROTTLING_GREEN_TOTAL'}} = "selected='selected'";
718 $selected{'THROTTLING_GREEN_HOST'}{$proxysettings{'THROTTLING_GREEN_HOST'}} = "selected='selected'";
719 $selected{'THROTTLING_BLUE_TOTAL'}{$proxysettings{'THROTTLING_BLUE_TOTAL'}} = "selected='selected'";
720 $selected{'THROTTLING_BLUE_HOST'}{$proxysettings{'THROTTLING_BLUE_HOST'}} = "selected='selected'";
721
722 $checked{'THROTTLE_BINARY'}{'off'} = '';
723 $checked{'THROTTLE_BINARY'}{'on'} = '';
724 $checked{'THROTTLE_BINARY'}{$proxysettings{'THROTTLE_BINARY'}} = "checked='checked'";
725 $checked{'THROTTLE_DSKIMG'}{'off'} = '';
726 $checked{'THROTTLE_DSKIMG'}{'on'} = '';
727 $checked{'THROTTLE_DSKIMG'}{$proxysettings{'THROTTLE_DSKIMG'}} = "checked='checked'";
728 $checked{'THROTTLE_MMEDIA'}{'off'} = '';
729 $checked{'THROTTLE_MMEDIA'}{'on'} = '';
730 $checked{'THROTTLE_MMEDIA'}{$proxysettings{'THROTTLE_MMEDIA'}} = "checked='checked'";
731
732 $checked{'ENABLE_MIME_FILTER'}{'off'} = '';
733 $checked{'ENABLE_MIME_FILTER'}{'on'} = '';
734 $checked{'ENABLE_MIME_FILTER'}{$proxysettings{'ENABLE_MIME_FILTER'}} = "checked='checked'";
735
736 $checked{'ENABLE_BROWSER_CHECK'}{'off'} = '';
737 $checked{'ENABLE_BROWSER_CHECK'}{'on'} = '';
738 $checked{'ENABLE_BROWSER_CHECK'}{$proxysettings{'ENABLE_BROWSER_CHECK'}} = "checked='checked'";
739
740 foreach (@useragentlist) {
741 @useragent = split(/,/);
742 $checked{'UA_'.@useragent[0]}{'off'} = '';
743 $checked{'UA_'.@useragent[0]}{'on'} = '';
744 $checked{'UA_'.@useragent[0]}{$proxysettings{'UA_'.@useragent[0]}} = "checked='checked'";
745 }
746
747 $checked{'AUTH_METHOD'}{'none'} = '';
748 $checked{'AUTH_METHOD'}{'ncsa'} = '';
749 $checked{'AUTH_METHOD'}{'ident'} = '';
750 $checked{'AUTH_METHOD'}{'ldap'} = '';
751 $checked{'AUTH_METHOD'}{'ntlm'} = '';
752 $checked{'AUTH_METHOD'}{'radius'} = '';
753 $checked{'AUTH_METHOD'}{$proxysettings{'AUTH_METHOD'}} = "checked='checked'";
754
755 $proxysettings{'AUTH_ALWAYS_REQUIRED'} = 'on' unless exists $proxysettings{'AUTH_ALWAYS_REQUIRED'};
756
757 $checked{'AUTH_ALWAYS_REQUIRED'}{'off'} = '';
758 $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} = '';
759 $checked{'AUTH_ALWAYS_REQUIRED'}{$proxysettings{'AUTH_ALWAYS_REQUIRED'}} = "checked='checked'";
760
761 $checked{'NCSA_BYPASS_REDIR'}{'off'} = '';
762 $checked{'NCSA_BYPASS_REDIR'}{'on'} = '';
763 $checked{'NCSA_BYPASS_REDIR'}{$proxysettings{'NCSA_BYPASS_REDIR'}} = "checked='checked'";
764
765 $selected{'NCSA_GROUP'}{$proxysettings{'NCSA_GROUP'}} = "selected='selected'";
766
767 $selected{'LDAP_TYPE'}{$proxysettings{'LDAP_TYPE'}} = "selected='selected'";
768
769 $proxysettings{'NTLM_ENABLE_INT_AUTH'} = 'on' unless exists $proxysettings{'NTLM_ENABLE_INT_AUTH'};
770
771 $checked{'NTLM_ENABLE_INT_AUTH'}{'off'} = '';
772 $checked{'NTLM_ENABLE_INT_AUTH'}{'on'} = '';
773 $checked{'NTLM_ENABLE_INT_AUTH'}{$proxysettings{'NTLM_ENABLE_INT_AUTH'}} = "checked='checked'";
774
775 $checked{'NTLM_ENABLE_ACL'}{'off'} = '';
776 $checked{'NTLM_ENABLE_ACL'}{'on'} = '';
777 $checked{'NTLM_ENABLE_ACL'}{$proxysettings{'NTLM_ENABLE_ACL'}} = "checked='checked'";
778
779 $checked{'NTLM_USER_ACL'}{'positive'} = '';
780 $checked{'NTLM_USER_ACL'}{'negative'} = '';
781 $checked{'NTLM_USER_ACL'}{$proxysettings{'NTLM_USER_ACL'}} = "checked='checked'";
782
783 $checked{'RADIUS_ENABLE_ACL'}{'off'} = '';
784 $checked{'RADIUS_ENABLE_ACL'}{'on'} = '';
785 $checked{'RADIUS_ENABLE_ACL'}{$proxysettings{'RADIUS_ENABLE_ACL'}} = "checked='checked'";
786
787 $checked{'RADIUS_USER_ACL'}{'positive'} = '';
788 $checked{'RADIUS_USER_ACL'}{'negative'} = '';
789 $checked{'RADIUS_USER_ACL'}{$proxysettings{'RADIUS_USER_ACL'}} = "checked='checked'";
790
791 $checked{'IDENT_REQUIRED'}{'off'} = '';
792 $checked{'IDENT_REQUIRED'}{'on'} = '';
793 $checked{'IDENT_REQUIRED'}{$proxysettings{'IDENT_REQUIRED'}} = "checked='checked'";
794
795 $checked{'IDENT_ENABLE_ACL'}{'off'} = '';
796 $checked{'IDENT_ENABLE_ACL'}{'on'} = '';
797 $checked{'IDENT_ENABLE_ACL'}{$proxysettings{'IDENT_ENABLE_ACL'}} = "checked='checked'";
798
799 $checked{'IDENT_USER_ACL'}{'positive'} = '';
800 $checked{'IDENT_USER_ACL'}{'negative'} = '';
801 $checked{'IDENT_USER_ACL'}{$proxysettings{'IDENT_USER_ACL'}} = "checked='checked'";
802
803 $checked{'ENABLE_FILTER'}{'off'} = '';
804 $checked{'ENABLE_FILTER'}{'on'} = '';
805 $checked{'ENABLE_FILTER'}{$proxysettings{'ENABLE_FILTER'}} = "checked='checked'";
806
807 $checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
808 $checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
809 $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
810
811 &Header::openpage($Lang::tr{'advproxy advanced web proxy configuration'}, 1, '');
812
813 &Header::openbigbox('100%', 'left', '', $errormessage);
814
815 if ($errormessage) {
816 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
817 print "<font class='base'>$errormessage&nbsp;</font>\n";
818 &Header::closebox();
819 }
820
821 if ($squidversion[0] =~ /^Squid\sCache:\sVersion\s/i)
822 {
823 $squidversion[0] =~ s/^Squid\sCache:\sVersion//i;
824 $squidversion[0] =~ s/^\s+//g;
825 $squidversion[0] =~ s/\s+$//g;
826 } else {
827 $squidversion[0] = $Lang::tr{'advproxy unknown'};
828 }
829
830 # ===================================================================
831 # Main settings
832 # ===================================================================
833
834 unless ($proxysettings{'NCSA_EDIT_MODE'} eq 'yes') {
835
836 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
837
838 &Header::openbox('100%', 'left', "$Lang::tr{'advproxy advanced web proxy'}");
839
840 print <<END
841 <table width='100%'>
842 <tr>
843 <td colspan='4' class='base'><b>$Lang::tr{'advproxy common settings'}</b></td>
844 </tr>
845 <tr>
846 <td width='25%' class='base'>$Lang::tr{'advproxy enabled on'} <font color="$Header::colourgreen">Green</font>:</td>
847 <td width='20%'><input type='checkbox' name='ENABLE' $checked{'ENABLE'}{'on'} /></td>
848 <td width='25%' class='base'>$Lang::tr{'advproxy proxy port'}:</td>
849 <td width='30%'><input type='text' name='PROXY_PORT' value='$proxysettings{'PROXY_PORT'}' size='5' /></td>
850 </tr>
851 <tr>
852 <td class='base'>$Lang::tr{'advproxy transparent on'} <font color="$Header::colourgreen">Green</font>:</td>
853 <td><input type='checkbox' name='TRANSPARENT' $checked{'TRANSPARENT'}{'on'} /></td>
854 <td class='base'>$Lang::tr{'advproxy visible hostname'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
855 <td><input type='text' name='VISIBLE_HOSTNAME' value='$proxysettings{'VISIBLE_HOSTNAME'}' /></td>
856 </tr>
857 <tr>
858 END
859 ;
860 if ($netsettings{'BLUE_DEV'}) {
861 print "<td class='base'>$Lang::tr{'advproxy enabled on'} <font color='$Header::colourblue'>Blue</font>:</td>";
862 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked{'ENABLE_BLUE'}{'on'} /></td>";
863 } else {
864 print "<td colspan='2'>&nbsp;</td>";
865 }
866 print <<END
867 <td class='base'>$Lang::tr{'advproxy admin mail'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
868 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value='$proxysettings{'ADMIN_MAIL_ADDRESS'}' /></td>
869 </tr>
870 <tr>
871 END
872 ;
873 if ($netsettings{'BLUE_DEV'}) {
874 print "<td class='base'>$Lang::tr{'advproxy transparent on'} <font color='$Header::colourblue'>Blue</font>:</td>";
875 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked{'TRANSPARENT_BLUE'}{'on'} /></td>";
876 } else {
877 print "<td colspan='2'>&nbsp;</td>";
878 }
879 print <<END
880 <td class='base'>$Lang::tr{'advproxy error language'}:</td>
881 <td class='base'>
882 <select name='ERR_LANGUAGE'>
883 END
884 ;
885 foreach (<$errordir/*>) {
886 if (-d) {
887 $language = substr($_,rindex($_,"/")+1);
888 print "<option value='$language' $selected{'ERR_LANGUAGE'}{$language}>$language</option>\n";
889 }
890 }
891 print <<END
892 </select>
893 </td>
894 </tr>
895 <tr>
896 <td class='base'>$Lang::tr{'advproxy suppress version'}:</td>
897 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked{'SUPPRESS_VERSION'}{'on'} /></td>
898 <td class='base'>$Lang::tr{'advproxy error design'}:</td>
899 <td class='base'><select name='ERR_DESIGN'>
900 <option value='ipcop' $selected{'ERR_DESIGN'}{'ipcop'}>IPCop</option>
901 <option value='squid' $selected{'ERR_DESIGN'}{'squid'}>$Lang::tr{'advproxy standard'}</option>
902 </select></td>
903 </tr>
904 <tr>
905 <td class='base'>$Lang::tr{'advproxy squid version'}:</td>
906 <td class='base'>&nbsp;[<font color='$Header::colourred'> $squidversion[0] </font>]</td>
907 <td>&nbsp;</td>
908 <td>&nbsp;</td>
909 </tr>
910 </table>
911 <hr size='1'>
912 <table width='100%'>
913 <tr>
914 <td colspan='4' class='base'><b>$Lang::tr{'advproxy upstream proxy'}</b></td>
915 </tr>
916 <tr>
917 <td width='25%' class='base'>$Lang::tr{'advproxy via forwarding'}:</td>
918 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td>
919 <td width='25%' class='base'>$Lang::tr{'advproxy upstream proxy host:port'}&nbsp;<img src='/blob.gif' alt='*' /></td>
920 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td>
921 </tr>
922 <tr>
923 <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td>
924 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td>
925 <td class='base'>$Lang::tr{'advproxy upstream username'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
926 <td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td>
927 </tr>
928 <tr>
929 <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td>
930 <td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} /></td>
931 <td class='base'>$Lang::tr{'advproxy upstream password'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
932 <td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td>
933 </tr>
934 <tr>
935 <td class='base'>$Lang::tr{'advproxy no connection auth'}:</td>
936 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td>
937 <td>&nbsp;</td>
938 <td>&nbsp;</td>
939 </tr>
940 </table>
941 <hr size='1'>
942 <table width='100%'>
943 <tr>
944 <td colspan='4' class='base'><b>$Lang::tr{'advproxy log settings'}</b></td>
945 </tr>
946 <tr>
947 <td width='25%' class='base'>$Lang::tr{'advproxy log enabled'}:</td>
948 <td width='20%'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
949 <td width='25%'class='base'>$Lang::tr{'advproxy log query'}:</td>
950 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td>
951 </tr>
952 <tr>
953 <td>&nbsp;</td>
954 <td>&nbsp;</td>
955 <td class='base'>$Lang::tr{'advproxy log useragent'}:</td>
956 <td><input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td>
957 </tr>
958 </table>
959 <hr size='1'>
960 <table width='100%'>
961 <tr>
962 <td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td>
963 </tr>
964 <tr>
965 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
966 </tr>
967 <tr>
968 <td class='base'>$Lang::tr{'advproxy ram cache size'}:</td>
969 <td><input type='text' name='CACHE_MEM' value='$proxysettings{'CACHE_MEM'}' size='5' /></td>
970 <td class='base'>$Lang::tr{'advproxy hdd cache size'}:</td>
971 <td><input type='text' name='CACHE_SIZE' value='$proxysettings{'CACHE_SIZE'}' size='5' /></td>
972 </tr>
973 <tr>
974 <td class='base'>$Lang::tr{'advproxy min size'}:</td>
975 <td><input type='text' name='MIN_SIZE' value='$proxysettings{'MIN_SIZE'}' size='5' /></td>
976 <td class='base'>$Lang::tr{'advproxy max size'}:</td>
977 <td><input type='text' name='MAX_SIZE' value='$proxysettings{'MAX_SIZE'}' size='5' /></td>
978 </tr>
979 <tr>
980 <td class='base'>$Lang::tr{'advproxy number of L1 dirs'}:</td>
981 <td class='base'><select name='L1_DIRS'>
982 <option value='16' $selected{'L1_DIRS'}{'16'}>16</option>
983 <option value='32' $selected{'L1_DIRS'}{'32'}>32</option>
984 <option value='64' $selected{'L1_DIRS'}{'64'}>64</option>
985 <option value='128' $selected{'L1_DIRS'}{'128'}>128</option>
986 <option value='256' $selected{'L1_DIRS'}{'256'}>256</option>
987 </select></td>
988 <td colspan='2' rowspan= '5' valign='top' class='base'>
989 <table cellspacing='0' cellpadding='0'>
990 <tr>
991 <!-- intentionally left empty -->
992 </tr>
993 <tr>
994 <td>$Lang::tr{'advproxy no cache sites'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
995 </tr>
996 <tr>
997 <!-- intentionally left empty -->
998 </tr>
999 <tr>
1000 <!-- intentionally left empty -->
1001 </tr>
1002 <tr>
1003 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1004 END
1005 ;
1006
1007 print $proxysettings{'DST_NOCACHE'};
1008
1009 print <<END
1010 </textarea></td>
1011 </tr>
1012 </table>
1013 </td>
1014 </tr>
1015 <tr>
1016 <td class='base'>$Lang::tr{'advproxy memory replacement policy'}:</td>
1017 <td class='base'><select name='MEM_POLICY'>
1018 <option value='LRU' $selected{'MEM_POLICY'}{'LRU'}>LRU</option>
1019 <option value='heap LFUDA' $selected{'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1020 <option value='heap GDSF' $selected{'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1021 <option value='heap LRU' $selected{'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1022 </select></td>
1023 </tr>
1024 <tr>
1025 <td class='base'>$Lang::tr{'advproxy cache replacement policy'}:</td>
1026 <td class='base'><select name='CACHE_POLICY'>
1027 <option value='LRU' $selected{'CACHE_POLICY'}{'LRU'}>LRU</option>
1028 <option value='heap LFUDA' $selected{'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1029 <option value='heap GDSF' $selected{'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1030 <option value='heap LRU' $selected{'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1031 </select></td>
1032 </tr>
1033 <tr>
1034 <td colspan='2'>&nbsp;</td>
1035 </tr>
1036 <tr>
1037 <td class='base'>$Lang::tr{'advproxy offline mode'}:</td>
1038 <td><input type='checkbox' name='OFFLINE_MODE' $checked{'OFFLINE_MODE'}{'on'} /></td>
1039 </tr>
1040 </table>
1041 <hr size='1'>
1042 <table width='100%'>
1043 <tr>
1044 <td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td>
1045 </tr>
1046 <tr>
1047 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1048 </tr>
1049 <tr>
1050 <td colspan='2' class='base'>$Lang::tr{'advproxy standard ports'}:</td>
1051 <td colspan='2' class='base'>$Lang::tr{'advproxy ssl ports'}:</td>
1052 </tr>
1053 <tr>
1054 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1055 END
1056 ;
1057 if (!$proxysettings{'PORTS_SAFE'}) { print $def_ports_safe; } else { print $proxysettings{'PORTS_SAFE'}; }
1058
1059 print <<END
1060 </textarea></td>
1061 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1062 END
1063 ;
1064 if (!$proxysettings{'PORTS_SSL'}) { print $def_ports_ssl; } else { print $proxysettings{'PORTS_SSL'}; }
1065
1066 print <<END
1067 </textarea></td>
1068 </tr>
1069 </table>
1070 <hr size='1'>
1071 <table width='100%'>
1072 <tr>
1073 <td colspan='4'><b>$Lang::tr{'advproxy network based access'}</b></td>
1074 </tr>
1075 <tr>
1076 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1077 </tr>
1078 <tr>
1079 <td colspan='4' class='base'>$Lang::tr{'advproxy allowed subnets'}:</td>
1080 </tr>
1081 <tr>
1082 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='6' wrap='off'>
1083 END
1084 ;
1085
1086 if (!$proxysettings{'SRC_SUBNETS'})
1087 {
1088 print "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n";
1089 if ($netsettings{'BLUE_DEV'})
1090 {
1091 print "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n";
1092 }
1093 } else { print $proxysettings{'SRC_SUBNETS'}; }
1094
1095 print <<END
1096 </textarea></td>
1097 END
1098 ;
1099
1100 $line = $Lang::tr{'advproxy no internal proxy on green'};
1101 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/font>/i;
1102 print "<td class='base'>$line:</td>\n";
1103 print <<END
1104 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked{'NO_PROXY_LOCAL'}{'on'} /></td>
1105 </tr>
1106 END
1107 ;
1108 if ($netsettings{'BLUE_DEV'}) {
1109 $line = $Lang::tr{'advproxy no internal proxy on blue'};
1110 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/font>/i;
1111 print "<tr>\n";
1112 print "<td class='base'>$line:</td>\n";
1113 print <<END
1114 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1115 </tr>
1116 END
1117 ;
1118 }
1119 print <<END
1120 <tr>
1121 <td colspan='2'>&nbsp;</td>
1122 </tr>
1123 <tr>
1124 <td colspan='2'>&nbsp;</td>
1125 </tr>
1126 </table>
1127 <table width='100%'>
1128 <tr>
1129 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1130 </tr>
1131 <tr>
1132 <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted ip clients'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1133 <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted mac clients'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1134 </tr>
1135 <tr>
1136 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='6' wrap='off'>
1137 END
1138 ;
1139
1140 print $proxysettings{'SRC_UNRESTRICTED_IP'};
1141
1142 print <<END
1143 </textarea></td>
1144 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='6' wrap='off'>
1145 END
1146 ;
1147
1148 print $proxysettings{'SRC_UNRESTRICTED_MAC'};
1149
1150 print <<END
1151 </textarea></td>
1152 </tr>
1153 </table>
1154 <table width='100%'>
1155 <tr>
1156 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1157 </tr>
1158 <tr>
1159 <td colspan='2' class='base'>$Lang::tr{'advproxy banned ip clients'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1160 <td colspan='2' class='base'>$Lang::tr{'advproxy banned mac clients'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1161 </tr>
1162 <tr>
1163 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='6' wrap='off'>
1164 END
1165 ;
1166
1167 print $proxysettings{'SRC_BANNED_IP'};
1168
1169 print <<END
1170 </textarea></td>
1171 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='6' wrap='off'>
1172 END
1173 ;
1174
1175 print $proxysettings{'SRC_BANNED_MAC'};
1176
1177 print <<END
1178 </textarea></td>
1179 </tr>
1180 </table>
1181
1182 <hr size='1'>
1183
1184 END
1185 ;
1186 # -------------------------------------------------------------------
1187 # CRE GUI - optional
1188 # -------------------------------------------------------------------
1189
1190 if (-e $cre_enabled) { print <<END
1191 <table width='100%'>
1192
1193 <tr>
1194 <td colspan='4'><b>$Lang::tr{'advproxy classroom extensions'}</b></td>
1195 </tr>
1196 <tr>
1197 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1198 </tr>
1199 <tr>
1200 <td class='base'>$Lang::tr{'advproxy enabled'}:</td>
1201 <td><input type='checkbox' name='CLASSROOM_EXT' $checked{'CLASSROOM_EXT'}{'on'} /></td>
1202 <td class='base'>$Lang::tr{'advproxy supervisor password'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1203 <td><input type='password' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' size='12' /></td>
1204 </tr>
1205 <tr>
1206 <td colspan='2' class='base'>$Lang::tr{'advproxy cre group definitions'}:</td>
1207 <td colspan='2' class='base'>$Lang::tr{'advproxy cre supervisors'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1208 </tr>
1209 <tr>
1210 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1211 END
1212 ;
1213
1214 print $proxysettings{'CRE_GROUPS'};
1215
1216 print <<END
1217 </textarea></td>
1218 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1219 END
1220 ;
1221 print $proxysettings{'CRE_SVHOSTS'};
1222
1223 print <<END
1224 </textarea></td>
1225 </tr>
1226
1227 </table>
1228
1229 <hr size='1'>
1230 END
1231 ;
1232 } else {
1233 print <<END
1234 <input type='hidden' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' />
1235 <input type='hidden' name='CRE_GROUPS' value='$proxysettings{'CRE_GROUPS'}' />
1236 <input type='hidden' name='CRE_SVHOSTS' value='$proxysettings{'CRE_SVHOSTS'}' />
1237 END
1238 ;
1239 }
1240
1241 # -------------------------------------------------------------------
1242
1243 print <<END
1244
1245 <table width='100%'>
1246 <tr>
1247 <td colspan='4'><b>$Lang::tr{'advproxy time restrictions'}</b></td>
1248 </tr>
1249 <table width='100%'>
1250 <tr>
1251 <td width='2%'>$Lang::tr{'advproxy access'}</td>
1252 <td width='1%'>&nbsp;</td>
1253 <td width='2%' align='center'>$Lang::tr{'advproxy monday'}</td>
1254 <td width='2%' align='center'>$Lang::tr{'advproxy tuesday'}</td>
1255 <td width='2%' align='center'>$Lang::tr{'advproxy wednesday'}</td>
1256 <td width='2%' align='center'>$Lang::tr{'advproxy thursday'}</td>
1257 <td width='2%' align='center'>$Lang::tr{'advproxy friday'}</td>
1258 <td width='2%' align='center'>$Lang::tr{'advproxy saturday'}</td>
1259 <td width='2%' align='center'>$Lang::tr{'advproxy sunday'}</td>
1260 <td width='1%'>&nbsp;&nbsp;</td>
1261 <td width='7%' colspan=3>$Lang::tr{'advproxy from'}</td>
1262 <td width='1%'>&nbsp;</td>
1263 <td width='7%' colspan=3>$Lang::tr{'advproxy to'}</td>
1264 <td>&nbsp;</td>
1265 </tr>
1266 <tr>
1267 <td class='base'>
1268 <select name='TIME_ACCESS_MODE'>
1269 <option value='allow' $selected{'TIME_ACCESS_MODE'}{'allow'}>$Lang::tr{'advproxy mode allow'}</option>
1270 <option value='deny' $selected{'TIME_ACCESS_MODE'}{'deny'}>$Lang::tr{'advproxy mode deny'}</option>
1271 </select>
1272 </td>
1273 <td>&nbsp;</td>
1274 <td class='base'><input type='checkbox' name='TIME_MON' $checked{'TIME_MON'}{'on'} /></td>
1275 <td class='base'><input type='checkbox' name='TIME_TUE' $checked{'TIME_TUE'}{'on'} /></td>
1276 <td class='base'><input type='checkbox' name='TIME_WED' $checked{'TIME_WED'}{'on'} /></td>
1277 <td class='base'><input type='checkbox' name='TIME_THU' $checked{'TIME_THU'}{'on'} /></td>
1278 <td class='base'><input type='checkbox' name='TIME_FRI' $checked{'TIME_FRI'}{'on'} /></td>
1279 <td class='base'><input type='checkbox' name='TIME_SAT' $checked{'TIME_SAT'}{'on'} /></td>
1280 <td class='base'><input type='checkbox' name='TIME_SUN' $checked{'TIME_SUN'}{'on'} /></td>
1281 <td>&nbsp;</td>
1282 <td class='base'>
1283 <select name='TIME_FROM_HOUR'>
1284 END
1285 ;
1286 for ($i=0;$i<=24;$i++) {
1287 $_ = sprintf("%02s",$i);
1288 print "<option $selected{'TIME_FROM_HOUR'}{$_}>$_</option>\n";
1289 }
1290 print <<END
1291 </select>
1292 </td>
1293 <td>:</td>
1294 <td class='base'>
1295 <select name='TIME_FROM_MINUTE'>
1296 END
1297 ;
1298 for ($i=0;$i<=45;$i+=15) {
1299 $_ = sprintf("%02s",$i);
1300 print "<option $selected{'TIME_FROM_MINUTE'}{$_}>$_</option>\n";
1301 }
1302 print <<END
1303 </select>
1304 <td> - </td>
1305 </td>
1306 <td class='base'>
1307 <select name='TIME_TO_HOUR'>
1308 END
1309 ;
1310 for ($i=0;$i<=24;$i++) {
1311 $_ = sprintf("%02s",$i);
1312 print "<option $selected{'TIME_TO_HOUR'}{$_}>$_</option>\n";
1313 }
1314 print <<END
1315 </select>
1316 </td>
1317 <td>:</td>
1318 <td class='base'>
1319 <select name='TIME_TO_MINUTE'>
1320 END
1321 ;
1322 for ($i=0;$i<=45;$i+=15) {
1323 $_ = sprintf("%02s",$i);
1324 print "<option $selected{'TIME_TO_MINUTE'}{$_}>$_</option>\n";
1325 }
1326 print <<END
1327 </select>
1328 </td>
1329 </tr>
1330 </table>
1331 <hr size='1'>
1332 <table width='100%'>
1333 <tr>
1334 <td colspan='4'><b>$Lang::tr{'advproxy transfer limits'}</b></td>
1335 </tr>
1336 <tr>
1337 <td width='25%' class='base'>$Lang::tr{'advproxy max download size'}:</td>
1338 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value='$proxysettings{'MAX_INCOMING_SIZE'}' size='5' /></td>
1339 <td width='25%' class='base'>$Lang::tr{'advproxy max upload size'}:</td>
1340 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value='$proxysettings{'MAX_OUTGOING_SIZE'}' size='5' /></td>
1341 </tr>
1342 </table>
1343 <hr size='1'>
1344 <table width='100%'>
1345 <tr>
1346 <td colspan='4'><b>$Lang::tr{'advproxy download throttling'}</b></td>
1347 </tr>
1348 <tr>
1349 <td width='25%' class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourgreen">Green</font>:</td>
1350 <td width='20%' class='base'>
1351 <select name='THROTTLING_GREEN_TOTAL'>
1352 END
1353 ;
1354
1355 foreach (@throttle_limits) {
1356 print "\t<option value='$_' $selected{'THROTTLING_GREEN_TOTAL'}{$_}>$_ kBit/s</option>\n";
1357 }
1358
1359 print <<END
1360 <option value='0' $selected{'THROTTLING_GREEN_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n";
1361 </select>
1362 </td>
1363 <td width='25%' class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourgreen">Green</font>:</td>
1364 <td width='30%' class='base'>
1365 <select name='THROTTLING_GREEN_HOST'>
1366 END
1367 ;
1368
1369 foreach (@throttle_limits) {
1370 print "\t<option value='$_' $selected{'THROTTLING_GREEN_HOST'}{$_}>$_ kBit/s</option>\n";
1371 }
1372
1373 print <<END
1374 <option value='0' $selected{'THROTTLING_GREEN_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n";
1375 </select>
1376 </td>
1377 </tr>
1378 END
1379 ;
1380
1381 if ($netsettings{'BLUE_DEV'}) {
1382 print <<END
1383 <tr>
1384 <td class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourblue">Blue</font>:</td>
1385 <td class='base'>
1386 <select name='THROTTLING_BLUE_TOTAL'>
1387 END
1388 ;
1389
1390 foreach (@throttle_limits) {
1391 print "\t<option value='$_' $selected{'THROTTLING_BLUE_TOTAL'}{$_}>$_ kBit/s</option>\n";
1392 }
1393
1394 print <<END
1395 <option value='0' $selected{'THROTTLING_BLUE_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n";
1396 </select>
1397 </td>
1398 <td class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourblue">Blue</font>:</td>
1399 <td class='base'>
1400 <select name='THROTTLING_BLUE_HOST'>
1401 END
1402 ;
1403
1404 foreach (@throttle_limits) {
1405 print "\t<option value='$_' $selected{'THROTTLING_BLUE_HOST'}{$_}>$_ kBit/s</option>\n";
1406 }
1407
1408 print <<END
1409 <option value='0' $selected{'THROTTLING_BLUE_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n";
1410 </select>
1411 </td>
1412 </tr>
1413 END
1414 ;
1415 }
1416
1417 print <<END
1418 </table>
1419 <table width='100%'>
1420 <tr>
1421 <td colspan='4'><i>$Lang::tr{'advproxy content based throttling'}:</i></td>
1422 </tr>
1423 <tr>
1424 <td width='15%' class='base'>$Lang::tr{'advproxy throttle binary'}:</td>
1425 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked{'THROTTLE_BINARY'}{'on'} /></td>
1426 <td width='15%' class='base'>$Lang::tr{'advproxy throttle dskimg'}:</td>
1427 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked{'THROTTLE_DSKIMG'}{'on'} /></td>
1428 <td width='15%' class='base'>$Lang::tr{'advproxy throttle mmedia'}:</td>
1429 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked{'THROTTLE_MMEDIA'}{'on'} /></td>
1430 <td width='15%'>&nbsp;</td>
1431 <td width='10%'>&nbsp;</td>
1432 </tr>
1433 </table>
1434 <hr size='1'>
1435 <table width='100%'>
1436 <tr>
1437 <td colspan='4'><b>$Lang::tr{'advproxy MIME filter'}</b></td>
1438 </tr>
1439 <tr>
1440 <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td>
1441 <td width='20%'><input type='checkbox' name='ENABLE_MIME_FILTER' $checked{'ENABLE_MIME_FILTER'}{'on'} /></td>
1442 </tr>
1443 <tr>
1444 <td colspan='2' class='base'>$Lang::tr{'advproxy MIME block types'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1445 <td>&nbsp;</td>
1446 <td>&nbsp;</td>
1447 </tr>
1448 <tr>
1449 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1450 END
1451 ;
1452
1453 print $proxysettings{'MIME_TYPES'};
1454
1455 print <<END
1456 </textarea></td>
1457 <td>&nbsp;</td>
1458 <td>&nbsp;</td>
1459 </tr>
1460 </table>
1461 <hr size='1'>
1462 <table width='100%'>
1463 <tr>
1464 <td colspan='4'><b>$Lang::tr{'advproxy web browser'}</b></td>
1465 </tr>
1466 <tr>
1467 <td width='25%' class='base'>$Lang::tr{'advproxy UA enable filter'}:</td>
1468 <td width='20%'><input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td>
1469 <td>&nbsp;</td>
1470 <td>&nbsp;</td>
1471 </tr>
1472 <tr>
1473 <td colspan='4'><i>
1474 END
1475 ;
1476 if (@useragentlist) { print "$Lang::tr{'advproxy allowed web browsers'}:"; } else { print "$Lang::tr{'advproxy no clients defined'}"; }
1477 print <<END
1478 </i></td>
1479 </tr>
1480 </table>
1481 <table width='100%'>
1482 END
1483 ;
1484
1485 for ($n=0; $n<=@useragentlist; $n = $n + $i) {
1486 for ($i=0; $i<=3; $i++) {
1487 if ($i eq 0) { print "<tr>\n"; }
1488 if (($n+$i) < @useragentlist) {
1489 @useragent = split(/,/,@useragentlist[$n+$i]);
1490 print "<td width='15%'>@useragent[1]:<\/td>\n";
1491 print "<td width='10%'><input type='checkbox' name='UA_@useragent[0]' $checked{'UA_'.@useragent[0]}{'on'} /></td>\n";
1492 }
1493 if ($i eq 3) { print "<\/tr>\n"; }
1494 }
1495 }
1496
1497 print <<END
1498 </table>
1499 <hr size='1'>
1500 <table width='100%'>
1501 <tr>
1502 <td><b>$Lang::tr{'advproxy privacy'}</b></td>
1503 </tr>
1504 <tr>
1505 <td class='base'>$Lang::tr{'advproxy fake useragent'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1506 </tr>
1507 <tr>
1508 <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td>
1509 </tr>
1510 <tr>
1511 <td class='base'>$Lang::tr{'advproxy fake referer'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1512 </tr>
1513 <tr>
1514 <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='56' /></td>
1515 </tr>
1516 </table>
1517 <hr size='1'>
1518 END
1519 ;
1520
1521 print <<END
1522 <table width='100%'>
1523 <tr>
1524 <td class='base' colspan='4'><b>$Lang::tr{'advproxy url filter'}</b></td>
1525 </tr>
1526 <tr>
1527 <td class='base' width='25%'>$Lang::tr{'advproxy enabled'}:</td>
1528 <td class='base' width='20%'><input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
1529 <td>&nbsp;</td>
1530 <td>&nbsp;</td>
1531 </tr>
1532 </table>
1533 <hr size='1'>
1534
1535 <table width='100%'>
1536 <tr>
1537 <td class='base' colspan='4'><b>$Lang::tr{'advproxy update accelerator'}</b></td>
1538 </tr>
1539 <tr>
1540 <td class='base' width='25%'>$Lang::tr{'advproxy enabled'}:</td>
1541 <td class='base' width='20%'><input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td>
1542 <td>&nbsp;</td>
1543 <td>&nbsp;</td>
1544 </tr>
1545 </table>
1546 <hr size='1'>
1547
1548 <table width='100%'>
1549 <tr>
1550 <td colspan='5'><b>$Lang::tr{'advproxy AUTH method'}</b></td>
1551 </tr>
1552 <tr>
1553 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked{'AUTH_METHOD'}{'none'} />$Lang::tr{'advproxy AUTH method none'}</td>
1554 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked{'AUTH_METHOD'}{'ncsa'} />$Lang::tr{'advproxy AUTH method ncsa'}</td>
1555 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked{'AUTH_METHOD'}{'ident'} />$Lang::tr{'advproxy AUTH method ident'}</td>
1556 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked{'AUTH_METHOD'}{'ldap'} />$Lang::tr{'advproxy AUTH method ldap'}</td>
1557 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked{'AUTH_METHOD'}{'ntlm'} />$Lang::tr{'advproxy AUTH method ntlm'}</td>
1558 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked{'AUTH_METHOD'}{'radius'} />$Lang::tr{'advproxy AUTH method radius'}</td>
1559 </tr>
1560 </table>
1561 END
1562 ;
1563
1564 if (!($proxysettings{'AUTH_METHOD'} eq 'none')) { if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { print <<END
1565 <hr size='1'>
1566 <table width='100%'>
1567 <tr>
1568 <td colspan='4'><b>$Lang::tr{'advproxy AUTH global settings'}</b></td>
1569 </tr>
1570 <tr>
1571 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1572 </tr>
1573 <tr>
1574 <td class='base'>$Lang::tr{'advproxy AUTH number of auth processes'}:</td>
1575 <td><input type='text' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}' size='5' /></td>
1576 <td colspan='2' rowspan= '6' valign='top' class='base'>
1577 <table cellpadding='0' cellspacing='0'>
1578 <tr>
1579 <td class='base'>$Lang::tr{'advproxy AUTH realm'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1580 </tr>
1581 <tr>
1582 <!-- intentionally left empty -->
1583 </tr>
1584 <tr>
1585 <!-- intentionally left empty -->
1586 </tr>
1587 <tr>
1588 <td><input type='text' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}' size='40' /></td>
1589 </tr>
1590 <tr>
1591 <!-- intentionally left empty -->
1592 </tr>
1593 <tr>
1594 <!-- intentionally left empty -->
1595 </tr>
1596 <tr>
1597 <td>$Lang::tr{'advproxy AUTH no auth'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1598 </tr>
1599 <tr>
1600 <!-- intentionally left empty -->
1601 </tr>
1602 <tr>
1603 <!-- intentionally left empty -->
1604 </tr>
1605 <tr>
1606 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1607 END
1608 ;
1609
1610 print $proxysettings{'DST_NOAUTH'};
1611
1612 print <<END
1613 </textarea></td>
1614 </tr>
1615 </table>
1616 </td>
1617 </tr>
1618 <tr>
1619 <td class='base'>$Lang::tr{'advproxy AUTH auth cache TTL'}:</td>
1620 <td><input type='text' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td>
1621 </tr>
1622 <tr>
1623 <td class='base'>$Lang::tr{'advproxy AUTH limit of IP addresses'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1624 <td><input type='text' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td>
1625 </tr>
1626 <tr>
1627 <td class='base'>$Lang::tr{'advproxy AUTH user IP cache TTL'}:</td>
1628 <td><input type='text' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td>
1629 </tr>
1630 <tr>
1631 <td class='base'>$Lang::tr{'advproxy AUTH always required'}:</td>
1632 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1633 </tr>
1634 <tr>
1635 <td colspan='2'>&nbsp;</td>
1636 </tr>
1637 </table>
1638 END
1639 ;
1640 }
1641
1642 # ===================================================================
1643 # NCSA auth settings
1644 # ===================================================================
1645
1646 if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') {
1647 print <<END
1648 <hr size='1'>
1649 <table width='100%'>
1650 <tr>
1651 <td colspan='4'><b>$Lang::tr{'advproxy NCSA auth'}</b></td>
1652 </tr>
1653 <tr>
1654 <td width='25%' class='base'>$Lang::tr{'advproxy NCSA min password length'}:</td>
1655 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1656 <td width='25%' class='base'>$Lang::tr{'advproxy NCSA redirector bypass'} \'$Lang::tr{'advproxy NCSA grp extended'}\':</td>
1657 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked{'NCSA_BYPASS_REDIR'}{'on'} /></td>
1658 </tr>
1659 <tr>
1660 <td colspan='2'><br>&nbsp;<input type='submit' name='ACTION' value='$Lang::tr{'advproxy NCSA user management'}'></td>
1661 <td>&nbsp;</td>
1662 <td>&nbsp;</td>
1663 </tr>
1664 </table>
1665 END
1666 ; }
1667
1668 # ===================================================================
1669 # IDENTD auth settings
1670 # ===================================================================
1671
1672 if ($proxysettings{'AUTH_METHOD'} eq 'ident') {
1673 print <<END
1674 <hr size ='1'>
1675 <table width='100%'>
1676 <tr>
1677 <td colspan='4'><b>$Lang::tr{'advproxy IDENT identd settings'}</b></td>
1678 </tr>
1679 <tr>
1680 <td width='25%' class='base'>$Lang::tr{'advproxy IDENT required'}:</td>
1681 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked{'IDENT_REQUIRED'}{'on'} /></td>
1682 <td width='25%' class='base'>$Lang::tr{'advproxy AUTH always required'}:</td>
1683 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1684 </tr>
1685 <tr>
1686 <td class='base'>$Lang::tr{'advproxy IDENT timeout'}:</td>
1687 <td><input type='text' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}' size='5' /></td>
1688 <td>&nbsp;</td>
1689 <td>&nbsp;</td>
1690 </tr>
1691 <tr>
1692 <td colspan='2' class='base'>$Lang::tr{'advproxy IDENT aware hosts'}:</td>
1693 <td colspan='2' class='base'>$Lang::tr{'advproxy AUTH no auth'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1694 </tr>
1695 <tr>
1696 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1697 END
1698 ;
1699 if (!$proxysettings{'IDENT_HOSTS'}) {
1700 print "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n";
1701 if ($netsettings{'BLUE_DEV'}) {
1702 print "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n";
1703 }
1704 } else {
1705 print $proxysettings{'IDENT_HOSTS'};
1706 }
1707
1708 print <<END
1709 </textarea></td>
1710 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1711 END
1712 ;
1713
1714 print $proxysettings{'DST_NOAUTH'};
1715
1716 print <<END
1717 </textarea></td>
1718 </tr>
1719 </table>
1720 <hr size ='1'>
1721 <table width='100%'>
1722 <tr>
1723 <td colspan='4'><b>$Lang::tr{'advproxy IDENT user based access restrictions'}</b></td>
1724 </tr>
1725 <tr>
1726 <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td>
1727 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked{'IDENT_ENABLE_ACL'}{'on'} /></td>
1728 <td width='25%'>&nbsp;</td>
1729 <td width='30%'>&nbsp;</td>
1730 </tr>
1731 <tr>
1732 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked{'IDENT_USER_ACL'}{'positive'} />
1733 $Lang::tr{'advproxy IDENT use positive access list'}:</td>
1734 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked{'IDENT_USER_ACL'}{'negative'} />
1735 $Lang::tr{'advproxy IDENT use negative access list'}:</td>
1736 </tr>
1737 <tr>
1738 <td colspan='2'>$Lang::tr{'advproxy IDENT authorized users'}</td>
1739 <td colspan='2'>$Lang::tr{'advproxy IDENT unauthorized users'}</td>
1740 </tr>
1741 <tr>
1742 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1743 END
1744 ; }
1745
1746 if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_ALLOW_USERS'}; }
1747
1748 if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END
1749 </textarea></td>
1750 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1751 END
1752 ; }
1753
1754 if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_DENY_USERS'}; }
1755
1756 if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END
1757 </textarea></td>
1758 </tr>
1759 </table>
1760 END
1761 ; }
1762
1763 # ===================================================================
1764 # NTLM auth settings
1765 # ===================================================================
1766
1767 if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') {
1768 print <<END
1769 <hr size='1'>
1770 <table width='100%'>
1771 <tr>
1772 <td colspan='6'><b>$Lang::tr{'advproxy NTLM domain settings'}</b></td>
1773 </tr>
1774 <tr>
1775 <td class='base'>$Lang::tr{'advproxy NTLM domain'}:</td>
1776 <td><input type='text' name='NTLM_DOMAIN' value='$proxysettings{'NTLM_DOMAIN'}' size='15' /></td>
1777 <td class='base'>$Lang::tr{'advproxy NTLM PDC hostname'}:</td>
1778 <td><input type='text' name='NTLM_PDC' value='$proxysettings{'NTLM_PDC'}' size='14' /></td>
1779 <td class='base'>$Lang::tr{'advproxy NTLM BDC hostname'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1780 <td><input type='text' name='NTLM_BDC' value='$proxysettings{'NTLM_BDC'}' size='14' /></td>
1781 </tr>
1782 </table>
1783 <hr size ='1'>
1784 <table width='100%'>
1785 <tr>
1786 <td colspan='3'><b>$Lang::tr{'advproxy NTLM auth mode'}</b></td>
1787 </tr>
1788 <tr>
1789 <td width='25%' class='base' width='25%'>$Lang::tr{'advproxy NTLM use integrated auth'}:</td>
1790 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked{'NTLM_ENABLE_INT_AUTH'}{'on'} /></td>
1791 <td>&nbsp;</td>
1792 </tr>
1793 </table>
1794 <hr size ='1'>
1795 <table width='100%'>
1796 <tr>
1797 <td colspan='4'><b>$Lang::tr{'advproxy NTLM user based access restrictions'}</b></td>
1798 </tr>
1799 <tr>
1800 <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td>
1801 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked{'NTLM_ENABLE_ACL'}{'on'} /></td>
1802 <td width='25%'>&nbsp;</td>
1803 <td width='30%'>&nbsp;</td>
1804 </tr>
1805 <tr>
1806 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked{'NTLM_USER_ACL'}{'positive'} />
1807 $Lang::tr{'advproxy NTLM use positive access list'}:</td>
1808 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked{'NTLM_USER_ACL'}{'negative'} />
1809 $Lang::tr{'advproxy NTLM use negative access list'}:</td>
1810 </tr>
1811 <tr>
1812 <td colspan='2'>$Lang::tr{'advproxy NTLM authorized users'}</td>
1813 <td colspan='2'>$Lang::tr{'advproxy NTLM unauthorized users'}</td>
1814 </tr>
1815 <tr>
1816 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1817 END
1818 ; }
1819
1820 if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_ALLOW_USERS'}; }
1821
1822 if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END
1823 </textarea></td>
1824 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
1825 END
1826 ; }
1827
1828 if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_DENY_USERS'}; }
1829
1830 if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END
1831 </textarea></td>
1832 </tr>
1833 </table>
1834 END
1835 ; }
1836
1837 # ===================================================================
1838 # LDAP auth settings
1839 # ===================================================================
1840
1841 if ($proxysettings{'AUTH_METHOD'} eq 'ldap') {
1842 print <<END
1843 <hr size='1'>
1844 <table width='100%'>
1845 <tr>
1846 <td colspan='4'><b>$Lang::tr{'advproxy LDAP common settings'}</b></td>
1847 </tr>
1848 <tr>
1849 <td class='base'>$Lang::tr{'advproxy LDAP basedn'}:</td>
1850 <td><input type='text' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}' size='37' /></td>
1851 <td class='base'>$Lang::tr{'advproxy LDAP type'}:</td>
1852 <td class='base'><select name='LDAP_TYPE'>
1853 <option value='ADS' $selected{'LDAP_TYPE'}{'ADS'}>$Lang::tr{'advproxy LDAP ADS'}</option>
1854 <option value='NDS' $selected{'LDAP_TYPE'}{'NDS'}>$Lang::tr{'advproxy LDAP NDS'}</option>
1855 <option value='V2' $selected{'LDAP_TYPE'}{'V2'}>$Lang::tr{'advproxy LDAP V2'}</option>
1856 <option value='V3' $selected{'LDAP_TYPE'}{'V3'}>$Lang::tr{'advproxy LDAP V3'}</option>
1857 </select></td>
1858 </tr>
1859 <tr>
1860 <td width='20%' class='base'>$Lang::tr{'advproxy LDAP server'}:</td>
1861 <td width='40%'><input type='text' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}' size='14' /></td>
1862 <td width='20%' class='base'>$Lang::tr{'advproxy LDAP port'}:</td>
1863 <td><input type='text' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}' size='3' /></td>
1864 </tr>
1865 </table>
1866 <hr size ='1'>
1867 <table width='100%'>
1868 <tr>
1869 <td colspan='4'><b>$Lang::tr{'advproxy LDAP binddn settings'}</b></td>
1870 </tr>
1871 <tr>
1872 <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn username'}:</td>
1873 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}' size='37' /></td>
1874 <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn password'}:</td>
1875 <td><input type='password' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}' size='14' /></td>
1876 </tr>
1877 </table>
1878 <hr size ='1'>
1879 <table width='100%'>
1880 <tr>
1881 <td colspan='4'><b>$Lang::tr{'advproxy LDAP group access control'}</b></td>
1882 </tr>
1883 <tr>
1884 <td width='20%' class='base'>$Lang::tr{'advproxy LDAP group required'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1885 <td width='40%'><input type='text' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}' size='37' /></td>
1886 <td>&nbsp;</td>
1887 <td>&nbsp;</td>
1888 </tr>
1889 </table>
1890 END
1891 ; }
1892
1893 # ===================================================================
1894 # RADIUS auth settings
1895 # ===================================================================
1896
1897 if ($proxysettings{'AUTH_METHOD'} eq 'radius') {
1898 print <<END
1899 <hr size='1'>
1900 <table width='100%'>
1901 <tr>
1902 <td colspan='4'><b>$Lang::tr{'advproxy RADIUS radius settings'}</b></td>
1903 </tr>
1904 <tr>
1905 <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS server'}:</td>
1906 <td width='20%'><input type='text' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}' size='14' /></td>
1907 <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS port'}:</td>
1908 <td width='30%'><input type='text' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}' size='3' /></td>
1909 </tr>
1910 <tr>
1911 <td class='base'>$Lang::tr{'advproxy RADIUS identifier'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1912 <td><input type='text' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}' size='14' /></td>
1913 <td class='base'>$Lang::tr{'advproxy RADIUS secret'}:</td>
1914 <td><input type='password' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}' size='14' /></td>
1915 </tr>
1916 </table>
1917 <hr size ='1'>
1918 <table width='100%'>
1919 <tr>
1920 <td colspan='4'><b>$Lang::tr{'advproxy RADIUS user based access restrictions'}</b></td>
1921 </tr>
1922 <tr>
1923 <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td>
1924 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked{'RADIUS_ENABLE_ACL'}{'on'} /></td>
1925 <td width='25%'>&nbsp;</td>
1926 <td width='30%'>&nbsp;</td>
1927 </tr>
1928 <tr>
1929 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked{'RADIUS_USER_ACL'}{'positive'} />
1930 $Lang::tr{'advproxy RADIUS use positive access list'}:</td>
1931 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked{'RADIUS_USER_ACL'}{'negative'} />
1932 $Lang::tr{'advproxy RADIUS use negative access list'}:</td>
1933 </tr>
1934 <tr>
1935 <td colspan='2'>$Lang::tr{'advproxy RADIUS authorized users'}</td>
1936 <td colspan='2'>$Lang::tr{'advproxy RADIUS unauthorized users'}</td>
1937 </tr>
1938 <tr>
1939 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1940 END
1941 ; }
1942
1943 if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_ALLOW_USERS'}; }
1944
1945 if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END
1946 </textarea></td>
1947 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
1948 END
1949 ; }
1950
1951 if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_DENY_USERS'}; }
1952
1953 if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END
1954 </textarea></td>
1955 </tr>
1956 </table>
1957 END
1958 ; }
1959
1960 # ===================================================================
1961
1962 }
1963
1964 print "<table>\n";
1965
1966 if ($proxysettings{'AUTH_METHOD'} eq 'none') {
1967 print <<END
1968 <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td>
1969 <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td>
1970 <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td>
1971 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td>
1972 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value='$proxysettings{'AUTH_ALWAYS_REQUIRED'}'></td>
1973 <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td>
1974 <td><input type='hidden' name='DST_NOAUTH' value='$proxysettings{'DST_NOAUTH'}'></td>
1975 END
1976 ; }
1977
1978 if ($proxysettings{'AUTH_METHOD'} eq 'ident') {
1979 print <<END
1980 <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td>
1981 <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td>
1982 <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td>
1983 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td>
1984 <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td>
1985 END
1986 ; }
1987
1988 if (!($proxysettings{'AUTH_METHOD'} eq 'ncsa')) {
1989 print <<END
1990 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td>
1991 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value='$proxysettings{'NCSA_BYPASS_REDIR'}'></td>
1992 END
1993 ; }
1994
1995 if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) {
1996 print <<END
1997 <td><input type='hidden' name='IDENT_REQUIRED' value='$proxysettings{'IDENT_REQUIRED'}'></td>
1998 <td><input type='hidden' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}'></td>
1999 <td><input type='hidden' name='IDENT_HOSTS' value='$proxysettings{'IDENT_HOSTS'}'></td>
2000 <td><input type='hidden' name='IDENT_ENABLE_ACL' value='$proxysettings{'IDENT_ENABLE_ACL'}'></td>
2001 <td><input type='hidden' name='IDENT_USER_ACL' value='$proxysettings{'IDENT_USER_ACL'}'></td>
2002 <td><input type='hidden' name='IDENT_ALLOW_USERS' value='$proxysettings{'IDENT_ALLOW_USERS'}'></td>
2003 <td><input type='hidden' name='IDENT_DENY_USERS' value='$proxysettings{'IDENT_DENY_USERS'}'></td>
2004 END
2005 ; }
2006
2007 if (!($proxysettings{'AUTH_METHOD'} eq 'ldap')) {
2008 print <<END
2009 <td><input type='hidden' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}'></td>
2010 <td><input type='hidden' name='LDAP_TYPE' value='$proxysettings{'LDAP_TYPE'}'></td>
2011 <td><input type='hidden' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}'></td>
2012 <td><input type='hidden' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}'></td>
2013 <td><input type='hidden' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}'></td>
2014 <td><input type='hidden' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}'></td>
2015 <td><input type='hidden' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}'></td>
2016 END
2017 ; }
2018
2019 if (!($proxysettings{'AUTH_METHOD'} eq 'ntlm')) {
2020 print <<END
2021 <td><input type='hidden' name='NTLM_DOMAIN' value='$proxysettings{'NTLM_DOMAIN'}'></td>
2022 <td><input type='hidden' name='NTLM_PDC' value='$proxysettings{'NTLM_PDC'}'></td>
2023 <td><input type='hidden' name='NTLM_BDC' value='$proxysettings{'NTLM_BDC'}'></td>
2024 <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value='$proxysettings{'NTLM_ENABLE_INT_AUTH'}'></td>
2025 <td><input type='hidden' name='NTLM_ENABLE_ACL' value='$proxysettings{'NTLM_ENABLE_ACL'}'></td>
2026 <td><input type='hidden' name='NTLM_USER_ACL' value='$proxysettings{'NTLM_USER_ACL'}'></td>
2027 <td><input type='hidden' name='NTLM_ALLOW_USERS' value='$proxysettings{'NTLM_ALLOW_USERS'}'></td>
2028 <td><input type='hidden' name='NTLM_DENY_USERS' value='$proxysettings{'NTLM_DENY_USERS'}'></td>
2029 END
2030 ; }
2031
2032 if (!($proxysettings{'AUTH_METHOD'} eq 'radius')) {
2033 print <<END
2034 <td><input type='hidden' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}'></td>
2035 <td><input type='hidden' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}'></td>
2036 <td><input type='hidden' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}'></td>
2037 <td><input type='hidden' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}'></td>
2038 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value='$proxysettings{'RADIUS_ENABLE_ACL'}'></td>
2039 <td><input type='hidden' name='RADIUS_USER_ACL' value='$proxysettings{'RADIUS_USER_ACL'}'></td>
2040 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value='$proxysettings{'RADIUS_ALLOW_USERS'}'></td>
2041 <td><input type='hidden' name='RADIUS_DENY_USERS' value='$proxysettings{'RADIUS_DENY_USERS'}'></td>
2042 END
2043 ; }
2044
2045 print "</table>\n";
2046
2047 print <<END
2048 <hr size='1'>
2049 END
2050 ;
2051
2052 print <<END
2053 <table width='100%'>
2054 <tr>
2055 <td>&nbsp;</td>
2056 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
2057 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy save and restart'}' /></td>
2058 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy clear cache'}' /></td>
2059 <td>&nbsp;</td>
2060 </tr>
2061
2062 </table>
2063 <br />
2064 <table width='100%'>
2065 <tr>
2066 <td><img src='/blob.gif' align='top' alt='*' />&nbsp;
2067 <font class='base'>$Lang::tr{'this field may be blank'}</font>
2068 </td>
2069 <td align='right'>&nbsp;</td>
2070 </tr>
2071 </table>
2072 </form>
2073 END
2074 ;
2075
2076 &Header::closebox();
2077
2078 } else {
2079
2080 # ===================================================================
2081 # NCSA user management
2082 # ===================================================================
2083
2084 &Header::openbox('100%', 'left', "$Lang::tr{'advproxy NCSA auth'}");
2085 print <<END
2086 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
2087 <table width='100%'>
2088 <tr>
2089 <td colspan='4'><b>$Lang::tr{'advproxy NCSA user management'}</b></td>
2090 </tr>
2091 <tr>
2092 <td width='25%' class='base'>$Lang::tr{'advproxy NCSA username'}:</td>
2093 <td width='25%'><input type='text' name='NCSA_USERNAME' value='$proxysettings{'NCSA_USERNAME'}' size='12'
2094 END
2095 ;
2096 if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly "; }
2097 print <<END
2098 /></td>
2099 <td width='25%' class='base'>$Lang::tr{'advproxy NCSA group'}:</td>
2100 <td class='base'>
2101 <select name='NCSA_GROUP'>
2102 <option value='standard' $selected{'NCSA_GROUP'}{'standard'}>$Lang::tr{'advproxy NCSA grp standard'}</option>
2103 <option value='extended' $selected{'NCSA_GROUP'}{'extended'}>$Lang::tr{'advproxy NCSA grp extended'}</option>
2104 <option value='disabled' $selected{'NCSA_GROUP'}{'disabled'}>$Lang::tr{'advproxy NCSA grp disabled'}</option>
2105 </select>
2106 </td>
2107
2108 </tr>
2109 <tr>
2110 <td class='base'>$Lang::tr{'advproxy NCSA password'}:</td>
2111 <td><input type='password' name='NCSA_PASS' value='$proxysettings{'NCSA_PASS'}' size='14' /></td>
2112 <td class='base'>$Lang::tr{'advproxy NCSA password confirm'}:</td>
2113 <td><input type='password' name='NCSA_PASS_CONFIRM' value='$proxysettings{'NCSA_PASS_CONFIRM'}' size='14' /></td>
2114 </tr>
2115 </table>
2116 <br>
2117 <table>
2118 <tr>
2119 <td>&nbsp;</td>
2120 <td><input type='submit' name='SUBMIT' value='$ncsa_buttontext' /></td>
2121 <td><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /></td>
2122 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td>
2123 END
2124 ;
2125 if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) {
2126 print "<td><input type='reset' name='ACTION' value='$Lang::tr{'advproxy reset'}' /></td>\n";
2127 }
2128
2129 print <<END
2130 <td>&nbsp;</td>
2131 <td>&nbsp;</td>
2132 <td><input type='button' name='return2main' value='$Lang::tr{'advproxy back to main page'}' onClick='self.location.href="$ENV{'SCRIPT_NAME'}"'></td>
2133 </tr>
2134 </table>
2135 </form>
2136 <hr size='1'>
2137 <table width='100%'>
2138 <tr>
2139 <td><b>$Lang::tr{'advproxy NCSA user accounts'}:</b></td>
2140 </tr>
2141 </table>
2142 <table width='100%' align='center'>
2143 END
2144 ;
2145
2146 if (-e $extgrp)
2147 {
2148 open(FILE, $extgrp); @grouplist = <FILE>; close(FILE);
2149 foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":extended"); }
2150 }
2151 if (-e $stdgrp)
2152 {
2153 open(FILE, $stdgrp); @grouplist = <FILE>; close(FILE);
2154 foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":standard"); }
2155 }
2156 if (-e $disgrp)
2157 {
2158 open(FILE, $disgrp); @grouplist = <FILE>; close(FILE);
2159 foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":disabled"); }
2160 }
2161
2162 @userlist = sort(@userlist);
2163
2164 # If the password file contains entries, print entries and action icons
2165
2166 if (! -z "$userdb") {
2167 print <<END
2168 <tr>
2169 <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA username'}</i></b></td>
2170 <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA group membership'}</i></b></td>
2171 <td class='boldbase' colspan='2' align='center'>&nbsp;</td>
2172 </tr>
2173 END
2174 ;
2175 $id = 0;
2176 foreach $line (@userlist)
2177 {
2178 $id++;
2179 chomp($line);
2180 @temp = split(/:/,$line);
2181 if($proxysettings{'ACTION'} eq $Lang::tr{'edit'} && $proxysettings{'ID'} eq $line) {
2182 print "<tr bgcolor='$Header::colouryellow'>\n"; }
2183 elsif ($id % 2) {
2184 print "<tr bgcolor='$Header::table1colour'>\n"; }
2185 else {
2186 print "<tr bgcolor='$Header::table2colour'>\n"; }
2187
2188 print <<END
2189 <td align='center'>$temp[0]</td>
2190 <td align='center'>
2191 END
2192 ;
2193 if ($temp[1] eq 'standard') {
2194 print $Lang::tr{'advproxy NCSA grp standard'};
2195 } elsif ($temp[1] eq 'extended') {
2196 print $Lang::tr{'advproxy NCSA grp extended'};
2197 } elsif ($temp[1] eq 'disabled') {
2198 print $Lang::tr{'advproxy NCSA grp disabled'}; }
2199 print <<END
2200 </td>
2201 <td width='8%' align='center'>
2202 <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
2203 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' title='$Lang::tr{'edit'}' alt='$Lang::tr{'edit'}' />
2204 <input type='hidden' name='ID' value='$line' />
2205 <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
2206 </form>
2207 </td>
2208
2209 <td width='8%' align='center'>
2210 <form method='post' name='frmb$id' action='$ENV{'SCRIPT_NAME'}'>
2211 <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' title='$Lang::tr{'remove'}' alt='$Lang::tr{'remove'}' />
2212 <input type='hidden' name='ID' value='$temp[0]' />
2213 <input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' />
2214 </form>
2215 </td>
2216 </tr>
2217 END
2218 ;
2219 }
2220
2221 print <<END
2222 </table>
2223 <br>
2224 <table>
2225 <tr>
2226 <td class='boldbase'>&nbsp; <b>$Lang::tr{'legend'}:</b></td>
2227 <td>&nbsp; &nbsp; <img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
2228 <td class='base'>$Lang::tr{'edit'}</td>
2229 <td>&nbsp; &nbsp; <img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td>
2230 <td class='base'>$Lang::tr{'remove'}</td>
2231 </tr>
2232 END
2233 ;
2234 } else {
2235 print <<END
2236 <tr>
2237 <td><i>$Lang::tr{'advproxy NCSA no accounts'}</i></td>
2238 </tr>
2239 END
2240 ;
2241 }
2242
2243 print <<END
2244 </table>
2245 END
2246 ;
2247
2248 &Header::closebox();
2249
2250 }
2251
2252 # ===================================================================
2253
2254 &Header::closebigbox();
2255
2256 &Header::closepage();
2257
2258 # -------------------------------------------------------------------
2259
2260 sub read_acls
2261 {
2262 if (-e "$acl_src_subnets") {
2263 open(FILE,"$acl_src_subnets");
2264 delete $proxysettings{'SRC_SUBNETS'};
2265 while (<FILE>) { $proxysettings{'SRC_SUBNETS'} .= $_ };
2266 close(FILE);
2267 }
2268 if (-e "$acl_src_banned_ip") {
2269 open(FILE,"$acl_src_banned_ip");
2270 delete $proxysettings{'SRC_BANNED_IP'};
2271 while (<FILE>) { $proxysettings{'SRC_BANNED_IP'} .= $_ };
2272 close(FILE);
2273 }
2274 if (-e "$acl_src_banned_mac") {
2275 open(FILE,"$acl_src_banned_mac");
2276 delete $proxysettings{'SRC_BANNED_MAC'};
2277 while (<FILE>) { $proxysettings{'SRC_BANNED_MAC'} .= $_ };
2278 close(FILE);
2279 }
2280 if (-e "$acl_src_unrestricted_ip") {
2281 open(FILE,"$acl_src_unrestricted_ip");
2282 delete $proxysettings{'SRC_UNRESTRICTED_IP'};
2283 while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_ };
2284 close(FILE);
2285 }
2286 if (-e "$acl_src_unrestricted_mac") {
2287 open(FILE,"$acl_src_unrestricted_mac");
2288 delete $proxysettings{'SRC_UNRESTRICTED_MAC'};
2289 while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_ };
2290 close(FILE);
2291 }
2292 if (-e "$acl_dst_nocache") {
2293 open(FILE,"$acl_dst_nocache");
2294 delete $proxysettings{'DST_NOCACHE'};
2295 while (<FILE>) { $proxysettings{'DST_NOCACHE'} .= $_ };
2296 close(FILE);
2297 }
2298 if (-e "$acl_dst_noauth") {
2299 open(FILE,"$acl_dst_noauth");
2300 delete $proxysettings{'DST_NOAUTH'};
2301 while (<FILE>) { $proxysettings{'DST_NOAUTH'} .= $_ };
2302 close(FILE);
2303 }
2304 if (-e "$acl_ports_safe") {
2305 open(FILE,"$acl_ports_safe");
2306 delete $proxysettings{'PORTS_SAFE'};
2307 while (<FILE>) { $proxysettings{'PORTS_SAFE'} .= $_ };
2308 close(FILE);
2309 }
2310 if (-e "$acl_ports_ssl") {
2311 open(FILE,"$acl_ports_ssl");
2312 delete $proxysettings{'PORTS_SSL'};
2313 while (<FILE>) { $proxysettings{'PORTS_SSL'} .= $_ };
2314 close(FILE);
2315 }
2316 if (-e "$mimetypes") {
2317 open(FILE,"$mimetypes");
2318 delete $proxysettings{'MIME_TYPES'};
2319 while (<FILE>) { $proxysettings{'MIME_TYPES'} .= $_ };
2320 close(FILE);
2321 }
2322 if (-e "$ntlmdir/msntauth.allowusers") {
2323 open(FILE,"$ntlmdir/msntauth.allowusers");
2324 delete $proxysettings{'NTLM_ALLOW_USERS'};
2325 while (<FILE>) { $proxysettings{'NTLM_ALLOW_USERS'} .= $_ };
2326 close(FILE);
2327 }
2328 if (-e "$ntlmdir/msntauth.denyusers") {
2329 open(FILE,"$ntlmdir/msntauth.denyusers");
2330 delete $proxysettings{'NTLM_DENY_USERS'};
2331 while (<FILE>) { $proxysettings{'NTLM_DENY_USERS'} .= $_ };
2332 close(FILE);
2333 }
2334 if (-e "$raddir/radauth.allowusers") {
2335 open(FILE,"$raddir/radauth.allowusers");
2336 delete $proxysettings{'RADIUS_ALLOW_USERS'};
2337 while (<FILE>) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_ };
2338 close(FILE);
2339 }
2340 if (-e "$raddir/radauth.denyusers") {
2341 open(FILE,"$raddir/radauth.denyusers");
2342 delete $proxysettings{'RADIUS_DENY_USERS'};
2343 while (<FILE>) { $proxysettings{'RADIUS_DENY_USERS'} .= $_ };
2344 close(FILE);
2345 }
2346 if (-e "$identdir/identauth.allowusers") {
2347 open(FILE,"$identdir/identauth.allowusers");
2348 delete $proxysettings{'IDENT_ALLOW_USERS'};
2349 while (<FILE>) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_ };
2350 close(FILE);
2351 }
2352 if (-e "$identdir/identauth.denyusers") {
2353 open(FILE,"$identdir/identauth.denyusers");
2354 delete $proxysettings{'IDENT_DENY_USERS'};
2355 while (<FILE>) { $proxysettings{'IDENT_DENY_USERS'} .= $_ };
2356 close(FILE);
2357 }
2358 if (-e "$identhosts") {
2359 open(FILE,"$identhosts");
2360 delete $proxysettings{'IDENT_HOSTS'};
2361 while (<FILE>) { $proxysettings{'IDENT_HOSTS'} .= $_ };
2362 close(FILE);
2363 }
2364 if (-e "$cre_groups") {
2365 open(FILE,"$cre_groups");
2366 delete $proxysettings{'CRE_GROUPS'};
2367 while (<FILE>) { $proxysettings{'CRE_GROUPS'} .= $_ };
2368 close(FILE);
2369 }
2370 if (-e "$cre_svhosts") {
2371 open(FILE,"$cre_svhosts");
2372 delete $proxysettings{'CRE_SVHOSTS'};
2373 while (<FILE>) { $proxysettings{'CRE_SVHOSTS'} .= $_ };
2374 close(FILE);
2375 }
2376 }
2377
2378 # -------------------------------------------------------------------
2379
2380 sub check_acls
2381 {
2382 @temp = split(/\n/,$proxysettings{'PORTS_SAFE'});
2383 undef $proxysettings{'PORTS_SAFE'};
2384 foreach (@temp)
2385 {
2386 s/^\s+//g; s/\s+$//g;
2387 if ($_)
2388 {
2389 $line = $_;
2390 if (/^[^#]+\s+#\sSquids\sport/) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/; $line=$_; }
2391 s/#.*//g; s/\s+//g;
2392 if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; }
2393 @templist = split(/-/);
2394 foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } }
2395 $proxysettings{'PORTS_SAFE'} .= $line."\n";
2396 }
2397 }
2398
2399 @temp = split(/\n/,$proxysettings{'PORTS_SSL'});
2400 undef $proxysettings{'PORTS_SSL'};
2401 foreach (@temp)
2402 {
2403 s/^\s+//g; s/\s+$//g;
2404 if ($_)
2405 {
2406 $line = $_;
2407 s/#.*//g; s/\s+//g;
2408 if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; }
2409 @templist = split(/-/);
2410 foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } }
2411 $proxysettings{'PORTS_SSL'} .= $line."\n";
2412 }
2413 }
2414
2415 @temp = split(/\n/,$proxysettings{'DST_NOCACHE'});
2416 undef $proxysettings{'DST_NOCACHE'};
2417 foreach (@temp)
2418 {
2419 s/^\s+//g; s/\s+$//g;
2420 if ($_)
2421 {
2422 unless (/^\./) { $_ = '.'.$_; }
2423 $proxysettings{'DST_NOCACHE'} .= $_."\n";
2424 }
2425 }
2426
2427 @temp = split(/\n/,$proxysettings{'SRC_SUBNETS'});
2428 undef $proxysettings{'SRC_SUBNETS'};
2429 foreach (@temp)
2430 {
2431 s/^\s+//g; s/\s+$//g;
2432 if ($_)
2433 {
2434 unless (&General::validipandmask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; }
2435 $proxysettings{'SRC_SUBNETS'} .= $_."\n";
2436 }
2437 }
2438
2439 @temp = split(/\n/,$proxysettings{'SRC_BANNED_IP'});
2440 undef $proxysettings{'SRC_BANNED_IP'};
2441 foreach (@temp)
2442 {
2443 s/^\s+//g; s/\s+$//g;
2444 if ($_)
2445 {
2446 unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; }
2447 $proxysettings{'SRC_BANNED_IP'} .= $_."\n";
2448 }
2449 }
2450
2451 @temp = split(/\n/,$proxysettings{'SRC_BANNED_MAC'});
2452 undef $proxysettings{'SRC_BANNED_MAC'};
2453 foreach (@temp)
2454 {
2455 s/^\s+//g; s/\s+$//g; s/-/:/g;
2456 if ($_)
2457 {
2458 unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; }
2459 $proxysettings{'SRC_BANNED_MAC'} .= $_."\n";
2460 }
2461 }
2462
2463 @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_IP'});
2464 undef $proxysettings{'SRC_UNRESTRICTED_IP'};
2465 foreach (@temp)
2466 {
2467 s/^\s+//g; s/\s+$//g;
2468 if ($_)
2469 {
2470 unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; }
2471 $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_."\n";
2472 }
2473 }
2474
2475 @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_MAC'});
2476 undef $proxysettings{'SRC_UNRESTRICTED_MAC'};
2477 foreach (@temp)
2478 {
2479 s/^\s+//g; s/\s+$//g; s/-/:/g;
2480 if ($_)
2481 {
2482 unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; }
2483 $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_."\n";
2484 }
2485 }
2486
2487 @temp = split(/\n/,$proxysettings{'DST_NOAUTH'});
2488 undef $proxysettings{'DST_NOAUTH'};
2489 foreach (@temp)
2490 {
2491 s/^\s+//g; s/\s+$//g;
2492 if ($_)
2493 {
2494 unless (/^\./) { $_ = '.'.$_; }
2495 $proxysettings{'DST_NOAUTH'} .= $_."\n";
2496 }
2497 }
2498
2499 if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'positive'))
2500 {
2501 @temp = split(/\n/,$proxysettings{'NTLM_ALLOW_USERS'});
2502 undef $proxysettings{'NTLM_ALLOW_USERS'};
2503 foreach (@temp)
2504 {
2505 s/^\s+//g; s/\s+$//g;
2506 if ($_) { $proxysettings{'NTLM_ALLOW_USERS'} .= $_."\n"; }
2507 }
2508 if ($proxysettings{'NTLM_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; }
2509 }
2510
2511 if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'negative'))
2512 {
2513 @temp = split(/\n/,$proxysettings{'NTLM_DENY_USERS'});
2514 undef $proxysettings{'NTLM_DENY_USERS'};
2515 foreach (@temp)
2516 {
2517 s/^\s+//g; s/\s+$//g;
2518 if ($_) { $proxysettings{'NTLM_DENY_USERS'} .= $_."\n"; }
2519 }
2520 if ($proxysettings{'NTLM_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; }
2521 }
2522
2523 if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'positive'))
2524 {
2525 @temp = split(/\n/,$proxysettings{'IDENT_ALLOW_USERS'});
2526 undef $proxysettings{'IDENT_ALLOW_USERS'};
2527 foreach (@temp)
2528 {
2529 s/^\s+//g; s/\s+$//g;
2530 if ($_) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_."\n"; }
2531 }
2532 if ($proxysettings{'IDENT_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; }
2533 }
2534
2535 if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'negative'))
2536 {
2537 @temp = split(/\n/,$proxysettings{'IDENT_DENY_USERS'});
2538 undef $proxysettings{'IDENT_DENY_USERS'};
2539 foreach (@temp)
2540 {
2541 s/^\s+//g; s/\s+$//g;
2542 if ($_) { $proxysettings{'IDENT_DENY_USERS'} .= $_."\n"; }
2543 }
2544 if ($proxysettings{'IDENT_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; }
2545 }
2546
2547 if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive'))
2548 {
2549 @temp = split(/\n/,$proxysettings{'RADIUS_ALLOW_USERS'});
2550 undef $proxysettings{'RADIUS_ALLOW_USERS'};
2551 foreach (@temp)
2552 {
2553 s/^\s+//g; s/\s+$//g;
2554 if ($_) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_."\n"; }
2555 }
2556 if ($proxysettings{'RADIUS_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; }
2557 }
2558
2559 if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative'))
2560 {
2561 @temp = split(/\n/,$proxysettings{'RADIUS_DENY_USERS'});
2562 undef $proxysettings{'RADIUS_DENY_USERS'};
2563 foreach (@temp)
2564 {
2565 s/^\s+//g; s/\s+$//g;
2566 if ($_) { $proxysettings{'RADIUS_DENY_USERS'} .= $_."\n"; }
2567 }
2568 if ($proxysettings{'RADIUS_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; }
2569 }
2570
2571 @temp = split(/\n/,$proxysettings{'IDENT_HOSTS'});
2572 undef $proxysettings{'IDENT_HOSTS'};
2573 foreach (@temp)
2574 {
2575 s/^\s+//g; s/\s+$//g;
2576 if ($_)
2577 {
2578 unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; }
2579 $proxysettings{'IDENT_HOSTS'} .= $_."\n";
2580 }
2581 }
2582
2583 @temp = split(/\n/,$proxysettings{'CRE_SVHOSTS'});
2584 undef $proxysettings{'CRE_SVHOSTS'};
2585 foreach (@temp)
2586 {
2587 s/^\s+//g; s/\s+$//g;
2588 if ($_)
2589 {
2590 unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; }
2591 $proxysettings{'CRE_SVHOSTS'} .= $_."\n";
2592 }
2593 }
2594 }
2595
2596 # -------------------------------------------------------------------
2597
2598 sub write_acls
2599 {
2600 open(FILE, ">$acl_src_subnets");
2601 flock(FILE, 2);
2602 if (!$proxysettings{'SRC_SUBNETS'})
2603 {
2604 print FILE "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n";
2605 if ($netsettings{'BLUE_DEV'})
2606 {
2607 print FILE "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n";
2608 }
2609 } else { print FILE $proxysettings{'SRC_SUBNETS'}; }
2610 close(FILE);
2611
2612 open(FILE, ">$acl_src_banned_ip");
2613 flock(FILE, 2);
2614 print FILE $proxysettings{'SRC_BANNED_IP'};
2615 close(FILE);
2616
2617 open(FILE, ">$acl_src_banned_mac");
2618 flock(FILE, 2);
2619 print FILE $proxysettings{'SRC_BANNED_MAC'};
2620 close(FILE);
2621
2622 open(FILE, ">$acl_src_unrestricted_ip");
2623 flock(FILE, 2);
2624 print FILE $proxysettings{'SRC_UNRESTRICTED_IP'};
2625 close(FILE);
2626
2627 open(FILE, ">$acl_src_unrestricted_mac");
2628 flock(FILE, 2);
2629 print FILE $proxysettings{'SRC_UNRESTRICTED_MAC'};
2630 close(FILE);
2631
2632 open(FILE, ">$acl_dst_nocache");
2633 flock(FILE, 2);
2634 print FILE $proxysettings{'DST_NOCACHE'};
2635 close(FILE);
2636
2637 open(FILE, ">$acl_dst_noauth");
2638 flock(FILE, 2);
2639 print FILE $proxysettings{'DST_NOAUTH'};
2640 close(FILE);
2641
2642 open(FILE, ">$acl_ports_safe");
2643 flock(FILE, 2);
2644 if (!$proxysettings{'PORTS_SAFE'}) { print FILE $def_ports_safe; } else { print FILE $proxysettings{'PORTS_SAFE'}; }
2645 close(FILE);
2646
2647 open(FILE, ">$acl_ports_ssl");
2648 flock(FILE, 2);
2649 if (!$proxysettings{'PORTS_SSL'}) { print FILE $def_ports_ssl; } else { print FILE $proxysettings{'PORTS_SSL'}; }
2650 close(FILE);
2651
2652 open(FILE, ">$acl_dst_throttle");
2653 flock(FILE, 2);
2654 if ($proxysettings{'THROTTLE_BINARY'} eq 'on')
2655 {
2656 @temp = split(/\|/,$throttle_binary);
2657 foreach (@temp) { print FILE "\\.$_\$\n"; }
2658 }
2659 if ($proxysettings{'THROTTLE_DSKIMG'} eq 'on')
2660 {
2661 @temp = split(/\|/,$throttle_dskimg);
2662 foreach (@temp) { print FILE "\\.$_\$\n"; }
2663 }
2664 if ($proxysettings{'THROTTLE_MMEDIA'} eq 'on')
2665 {
2666 @temp = split(/\|/,$throttle_mmedia);
2667 foreach (@temp) { print FILE "\\.$_\$\n"; }
2668 }
2669 if (-s $throttled_urls)
2670 {
2671 open(URLFILE, $throttled_urls);
2672 @temp = <URLFILE>;
2673 close(URLFILE);
2674 foreach (@temp) { print FILE; }
2675 }
2676 close(FILE);
2677
2678 open(FILE, ">$mimetypes");
2679 flock(FILE, 2);
2680 print FILE $proxysettings{'MIME_TYPES'};
2681 close(FILE);
2682
2683 open(FILE, ">$ntlmdir/msntauth.allowusers");
2684 flock(FILE, 2);
2685 print FILE $proxysettings{'NTLM_ALLOW_USERS'};
2686 close(FILE);
2687
2688 open(FILE, ">$ntlmdir/msntauth.denyusers");
2689 flock(FILE, 2);
2690 print FILE $proxysettings{'NTLM_DENY_USERS'};
2691 close(FILE);
2692
2693 open(FILE, ">$raddir/radauth.allowusers");