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