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