proxy.cgi: fix filename of ntlm authenticator.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / proxy.cgi
CommitLineData
ac1cfefa 1#!/usr/bin/perl
70df8302
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
73c7eff8 5# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
70df8302
MT
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
488d1b7c 21#
37273bc6 22# (c) 2004-2009 marco.s - http://www.advproxy.net
488d1b7c
CS
23#
24# This code is distributed under the terms of the GPL
25#
37273bc6 26# $Id: advproxy.cgi,v 3.0.2 2009/02/04 00:00:00 marco.s Exp $
488d1b7c 27#
ac1cfefa
MT
28
29use strict;
30
31# enable only the following on debugging purpose
cb5e9c6c
CS
32#use warnings;
33#use CGI::Carp 'fatalsToBrowser';
ac1cfefa 34
ed38f89d 35require '/var/ipfire/general-functions.pl';
ac1cfefa
MT
36require "${General::swroot}/lang.pl";
37require "${General::swroot}/header.pl";
38
363fb6af
MT
39my @squidversion = `/usr/sbin/squid -v`;
40my $http_port='81';
41my $https_port='444';
42
18322edf
CS
43my %color = ();
44my %mainsettings = ();
45&General::readhash("${General::swroot}/main/settings", \%mainsettings);
46&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
47
ac1cfefa
MT
48my %proxysettings=();
49my %netsettings=();
ed38f89d 50my %filtersettings=();
9fb25b1c 51my %xlratorsettings=();
ed38f89d 52my %stdproxysettings=();
ac1cfefa 53my %mainsettings=();
ed38f89d
MT
54
55my %checked=();
56my %selected=();
57
58my @throttle_limits=(64,128,256,384,512,1024,2048,3072,5120);
59my $throttle_binary="bin|cab|exe|gz|rar|sea|tar|tgz|zip";
60my $throttle_dskimg="b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi";
61my $throttle_mmedia="aiff?|asf|avi|divx|mov|mp3|mpe?g|qt|ra?m";
62
363fb6af
MT
63my $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";
64my $def_ports_ssl="443 # https\n563 # snews\n";
65
ed38f89d
MT
66my @useragent=();
67my @useragentlist=();
68
69my $hintcolour='#FFFFCC';
70my $ncsa_buttontext='';
71my $language='';
72my $i=0;
73my $n=0;
74my $id=0;
75my $line='';
76my $user='';
77my @userlist=();
78my @grouplist=();
79my @temp=();
80my @templist=();
81
82my $cachemem=0;
83my $proxy1='';
84my $proxy2='';
ed38f89d
MT
85my $browser_regexp='';
86my $needhup = 0;
87my $errormessage='';
88
89my $acldir = "${General::swroot}/proxy/advanced/acls";
90my $ncsadir = "${General::swroot}/proxy/advanced/ncsa";
91my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm";
92my $raddir = "${General::swroot}/proxy/advanced/radius";
93my $identdir = "${General::swroot}/proxy/advanced/ident";
94my $credir = "${General::swroot}/proxy/advanced/cre";
95
96my $userdb = "$ncsadir/passwd";
97my $stdgrp = "$ncsadir/standard.grp";
98my $extgrp = "$ncsadir/extended.grp";
99my $disgrp = "$ncsadir/disabled.grp";
100
101my $browserdb = "${General::swroot}/proxy/advanced/useragents";
102my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes";
103my $throttled_urls = "${General::swroot}/proxy/advanced/throttle";
104
105my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable";
106my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms";
107my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors";
108
109my $identhosts = "$identdir/hosts";
110
8c55860f 111my $authdir = "/usr/lib/squid/";
f1baee3e 112my $errordir = "/usr/lib/squid/errors";
ed38f89d
MT
113
114my $acl_src_subnets = "$acldir/src_subnets.acl";
115my $acl_src_banned_ip = "$acldir/src_banned_ip.acl";
116my $acl_src_banned_mac = "$acldir/src_banned_mac.acl";
117my $acl_src_unrestricted_ip = "$acldir/src_unrestricted_ip.acl";
118my $acl_src_unrestricted_mac = "$acldir/src_unrestricted_mac.acl";
119my $acl_src_noaccess_ip = "$acldir/src_noaccess_ip.acl";
120my $acl_src_noaccess_mac = "$acldir/src_noaccess_mac.acl";
ed38f89d 121my $acl_dst_noauth = "$acldir/dst_noauth.acl";
488d1b7c
CS
122my $acl_dst_noauth_dom = "$acldir/dst_noauth_dom.acl";
123my $acl_dst_noauth_net = "$acldir/dst_noauth_net.acl";
124my $acl_dst_noauth_url = "$acldir/dst_noauth_url.acl";
125my $acl_dst_nocache = "$acldir/dst_nocache.acl";
126my $acl_dst_nocache_dom = "$acldir/dst_nocache_dom.acl";
127my $acl_dst_nocache_net = "$acldir/dst_nocache_net.acl";
128my $acl_dst_nocache_url = "$acldir/dst_nocache_url.acl";
ed38f89d 129my $acl_dst_throttle = "$acldir/dst_throttle.acl";
363fb6af
MT
130my $acl_ports_safe = "$acldir/ports_safe.acl";
131my $acl_ports_ssl = "$acldir/ports_ssl.acl";
ed38f89d
MT
132my $acl_include = "$acldir/include.acl";
133
363fb6af
MT
134my $updaccelversion = 'n/a';
135my $urlfilterversion = 'n/a';
136
ed38f89d
MT
137unless (-d "$acldir") { mkdir("$acldir"); }
138unless (-d "$ncsadir") { mkdir("$ncsadir"); }
139unless (-d "$ntlmdir") { mkdir("$ntlmdir"); }
140unless (-d "$raddir") { mkdir("$raddir"); }
141unless (-d "$identdir") { mkdir("$identdir"); }
142unless (-d "$credir") { mkdir("$credir"); }
143
144unless (-e $cre_groups) { system("touch $cre_groups"); }
145unless (-e $cre_svhosts) { system("touch $cre_svhosts"); }
146
147unless (-e $userdb) { system("touch $userdb"); }
148unless (-e $stdgrp) { system("touch $stdgrp"); }
149unless (-e $extgrp) { system("touch $extgrp"); }
150unless (-e $disgrp) { system("touch $disgrp"); }
151
152unless (-e $acl_src_subnets) { system("touch $acl_src_subnets"); }
153unless (-e $acl_src_banned_ip) { system("touch $acl_src_banned_ip"); }
154unless (-e $acl_src_banned_mac) { system("touch $acl_src_banned_mac"); }
155unless (-e $acl_src_unrestricted_ip) { system("touch $acl_src_unrestricted_ip"); }
156unless (-e $acl_src_unrestricted_mac) { system("touch $acl_src_unrestricted_mac"); }
157unless (-e $acl_src_noaccess_ip) { system("touch $acl_src_noaccess_ip"); }
158unless (-e $acl_src_noaccess_mac) { system("touch $acl_src_noaccess_mac"); }
488d1b7c
CS
159unless (-e $acl_dst_noauth) { system("touch $acl_dst_noauth"); }
160unless (-e $acl_dst_noauth_dom) { system("touch $acl_dst_noauth_dom"); }
161unless (-e $acl_dst_noauth_net) { system("touch $acl_dst_noauth_net"); }
162unless (-e $acl_dst_noauth_url) { system("touch $acl_dst_noauth_url"); }
163unless (-e $acl_dst_nocache) { system("touch $acl_dst_nocache"); }
164unless (-e $acl_dst_nocache_dom) { system("touch $acl_dst_nocache_dom"); }
165unless (-e $acl_dst_nocache_net) { system("touch $acl_dst_nocache_net"); }
166unless (-e $acl_dst_nocache_url) { system("touch $acl_dst_nocache_url"); }
ed38f89d 167unless (-e $acl_dst_throttle) { system("touch $acl_dst_throttle"); }
363fb6af
MT
168unless (-e $acl_ports_safe) { system("touch $acl_ports_safe"); }
169unless (-e $acl_ports_ssl) { system("touch $acl_ports_ssl"); }
ed38f89d
MT
170unless (-e $acl_include) { system("touch $acl_include"); }
171
172unless (-e $browserdb) { system("touch $browserdb"); }
173unless (-e $mimetypes) { system("touch $mimetypes"); }
174
175open 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>;
177close(FILE);
ac1cfefa
MT
178
179&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
180&General::readhash("${General::swroot}/main/settings", \%mainsettings);
181
f09a0af5
AF
182my $green_cidr = &General::ipcidr("$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}");
183my $blue_cidr = "# Blue not defined";
184if ($netsettings{'BLUE_DEV'}) {
185 $blue_cidr = &General::ipcidr("$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}");
186}
187
ac1cfefa
MT
188&Header::showhttpheaders();
189
190$proxysettings{'ACTION'} = '';
191$proxysettings{'VALID'} = '';
192
ac1cfefa
MT
193$proxysettings{'ENABLE'} = 'off';
194$proxysettings{'ENABLE_BLUE'} = 'off';
ac1cfefa
MT
195$proxysettings{'TRANSPARENT'} = 'off';
196$proxysettings{'TRANSPARENT_BLUE'} = 'off';
ed38f89d
MT
197$proxysettings{'PROXY_PORT'} = '800';
198$proxysettings{'VISIBLE_HOSTNAME'} = '';
199$proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
fe1656d2 200$proxysettings{'ADMIN_PASSWORD'} = '';
0d948999
CS
201$proxysettings{'ERR_LANGUAGE'} = 'German';
202$proxysettings{'ERR_DESIGN'} = 'ipfire';
363fb6af 203$proxysettings{'SUPPRESS_VERSION'} = 'off';
ed38f89d
MT
204$proxysettings{'FORWARD_VIA'} = 'off';
205$proxysettings{'FORWARD_IPADDRESS'} = 'off';
206$proxysettings{'FORWARD_USERNAME'} = 'off';
363fb6af 207$proxysettings{'NO_CONNECTION_AUTH'} = 'off';
ed38f89d
MT
208$proxysettings{'UPSTREAM_PROXY'} = '';
209$proxysettings{'UPSTREAM_USER'} = '';
210$proxysettings{'UPSTREAM_PASSWORD'} = '';
211$proxysettings{'LOGGING'} = 'off';
fe1656d2 212$proxysettings{'CACHEMGR'} = 'off';
ed38f89d
MT
213$proxysettings{'LOGQUERY'} = 'off';
214$proxysettings{'LOGUSERAGENT'} = 'off';
fe1656d2 215$proxysettings{'FILEDESCRIPTORS'} = '4096';
ed38f89d
MT
216$proxysettings{'CACHE_MEM'} = '2';
217$proxysettings{'CACHE_SIZE'} = '50';
ac1cfefa
MT
218$proxysettings{'MAX_SIZE'} = '4096';
219$proxysettings{'MIN_SIZE'} = '0';
ed38f89d
MT
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'} = '';
9fb25b1c
MT
226$proxysettings{'NO_PROXY_LOCAL'} = 'off';
227$proxysettings{'NO_PROXY_LOCAL_BLUE'} = 'off';
ed38f89d
MT
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';
ac1cfefa
MT
233$proxysettings{'MAX_OUTGOING_SIZE'} = '0';
234$proxysettings{'MAX_INCOMING_SIZE'} = '0';
ed38f89d
MT
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'} = '';
363fb6af 271$proxysettings{'RADIUS_PORT'} = '1812';
ed38f89d
MT
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';
9fb25b1c
MT
280$proxysettings{'ENABLE_FILTER'} = 'off';
281$proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
d12aede7 282$proxysettings{'ENABLE_CLAMAV'} = 'off';
28c9dec6 283$proxysettings{'CHILDREN'} = '10';
ed38f89d
MT
284
285$ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'};
ac1cfefa
MT
286
287&Header::getcgihash(\%proxysettings);
288
ed38f89d
MT
289if ($proxysettings{'THROTTLING_GREEN_TOTAL'} eq 0) {$proxysettings{'THROTTLING_GREEN_TOTAL'} = 'unlimited';}
290if ($proxysettings{'THROTTLING_GREEN_HOST'} eq 0) {$proxysettings{'THROTTLING_GREEN_HOST'} = 'unlimited';}
291if ($proxysettings{'THROTTLING_BLUE_TOTAL'} eq 0) {$proxysettings{'THROTTLING_BLUE_TOTAL'} = 'unlimited';}
292if ($proxysettings{'THROTTLING_BLUE_HOST'} eq 0) {$proxysettings{'THROTTLING_BLUE_HOST'} = 'unlimited';}
ac1cfefa 293
ed38f89d 294if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy NCSA user management'})
ac1cfefa 295{
ed38f89d
MT
296 $proxysettings{'NCSA_EDIT_MODE'} = 'yes';
297}
298
299if ($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}
ac1cfefa 320
ed38f89d
MT
321if ($proxysettings{'ACTION'} eq $Lang::tr{'remove'})
322{
323 $proxysettings{'NCSA_EDIT_MODE'} = 'yes';
324 &deluser($proxysettings{'ID'});
325}
326
9fb25b1c
MT
327$checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
328$checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
329$checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
330
ed38f89d
MT
331if ($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
fe1656d2 342if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'}))
28c9dec6
CS
343{
344 if ($proxysettings{'ENABLE'} !~ /^(on|off)$/ ||
345 $proxysettings{'TRANSPARENT'} !~ /^(on|off)$/ ||
346 $proxysettings{'ENABLE_BLUE'} !~ /^(on|off)$/ ||
ac1cfefa
MT
347 $proxysettings{'TRANSPARENT_BLUE'} !~ /^(on|off)$/ ) {
348 $errormessage = $Lang::tr{'invalid input'};
349 goto ERROR;
28c9dec6 350 }
f2fdd0c1 351 if (!(&General::validport($proxysettings{'PROXY_PORT'})))
363fb6af
MT
352 {
353 $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'};
354 goto ERROR;
355 }
ac1cfefa
MT
356 if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) ||
357 ($proxysettings{'CACHE_SIZE'} < 10))
358 {
488d1b7c
CS
359 if (!($proxysettings{'CACHE_SIZE'} eq '0'))
360 {
361 $errormessage = $Lang::tr{'advproxy errmsg hdd cache size'};
362 goto ERROR;
363 }
ed38f89d 364 }
fe1656d2
CS
365 if (!($proxysettings{'FILEDESCRIPTORS'} =~ /^\d+/) ||
366 ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 16384))
367 {
368 $errormessage = $Lang::tr{'proxy errmsg filedescriptors'};
369 goto ERROR;
370 }
ed38f89d
MT
371 if (!($proxysettings{'CACHE_MEM'} =~ /^\d+/) ||
372 ($proxysettings{'CACHE_MEM'} < 1))
373 {
374 $errormessage = $Lang::tr{'advproxy errmsg mem cache size'};
ac1cfefa 375 goto ERROR;
28c9dec6 376 }
ed38f89d
MT
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 }
ac1cfefa
MT
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 }
ed38f89d
MT
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 }
ac1cfefa
MT
403 if (!($proxysettings{'MAX_INCOMING_SIZE'} =~ /^\d+/))
404 {
405 $errormessage = $Lang::tr{'invalid maximum incoming size'};
406 goto ERROR;
62459123
CS
407 }
408 if (!($proxysettings{'CHILDREN'} =~ /^\d+$/) || ($proxysettings{'CHILDREN'} < 1))
409 {
410 $errormessage = $Lang::tr{'advproxy invalid num of children'};
411 goto ERROR;
ac1cfefa 412 }
ed38f89d 413 if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on')
ac1cfefa 414 {
ed38f89d
MT
415 $browser_regexp = '';
416 foreach (@useragentlist)
417 {
418 chomp;
419 @useragent = split(/,/);
4e17adad 420 if ($proxysettings{'UA_'.$useragent[0]} eq 'on') { $browser_regexp .= "$useragent[2]|"; }
ed38f89d
MT
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 {
363fb6af 431 unless (($proxysettings{'AUTH_METHOD'} eq 'ident') &&
ed38f89d
MT
432 ($proxysettings{'IDENT_REQUIRED'} eq 'off') &&
433 ($proxysettings{'IDENT_ENABLE_ACL'} eq 'off'))
434 {
435 if ($netsettings{'BLUE_DEV'})
363fb6af 436 {
ed38f89d
MT
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 }
28c9dec6
CS
451 if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) &&
452 ((!($proxysettings{'AUTH_MAX_USERIP'} =~ /^\d+/)) || ($proxysettings{'AUTH_MAX_USERIP'} < 1) || ($proxysettings{'AUTH_MAX_USERIP'} > 255)))
ed38f89d
MT
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 }
488d1b7c
CS
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'});
ed38f89d
MT
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 }
ac1cfefa
MT
564 }
565
363fb6af
MT
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 }
ac1cfefa 577
ed38f89d
MT
578ERROR:
579 &check_acls;
ac1cfefa 580
ed38f89d
MT
581 if ($errormessage) {
582 $proxysettings{'VALID'} = 'no'; }
583 else {
363fb6af 584 $proxysettings{'VALID'} = 'yes'; }
ac1cfefa 585
ed38f89d 586 if ($proxysettings{'VALID'} eq 'yes')
ac1cfefa 587 {
ed38f89d 588 &write_acls;
ac1cfefa 589
ed38f89d
MT
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'};
363fb6af
MT
597 delete $proxysettings{'PORTS_SAFE'};
598 delete $proxysettings{'PORTS_SSL'};
ed38f89d
MT
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'};
ac1cfefa 607
ed38f89d
MT
608 delete $proxysettings{'CRE_GROUPS'};
609 delete $proxysettings{'CRE_SVHOSTS'};
ac1cfefa 610
ed38f89d
MT
611 delete $proxysettings{'NCSA_USERNAME'};
612 delete $proxysettings{'NCSA_GROUP'};
613 delete $proxysettings{'NCSA_PASS'};
614 delete $proxysettings{'NCSA_PASS_CONFIRM'};
ac1cfefa 615
ed38f89d
MT
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'};
ac1cfefa 623
ed38f89d
MT
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'};
ac1cfefa 626
ed38f89d 627 &General::writehash("${General::swroot}/proxy/advanced/settings", \%proxysettings);
ac1cfefa 628
363fb6af
MT
629 if (-e "${General::swroot}/proxy/settings") { &General::readhash("${General::swroot}/proxy/settings", \%stdproxysettings); }
630 $stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'};
488d1b7c
CS
631 $stdproxysettings{'UPSTREAM_PROXY'} = $proxysettings{'UPSTREAM_PROXY'};
632 $stdproxysettings{'UPSTREAM_USER'} = $proxysettings{'UPSTREAM_USER'};
633 $stdproxysettings{'UPSTREAM_PASSWORD'} = $proxysettings{'UPSTREAM_PASSWORD'};
9fb25b1c
MT
634 $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'};
635 $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'};
d12aede7 636 $stdproxysettings{'ENABLE_CLAMAV'} = $proxysettings{'ENABLE_CLAMAV'};
363fb6af 637 &General::writehash("${General::swroot}/proxy/settings", \%stdproxysettings);
ac1cfefa 638
ed38f89d
MT
639 &writeconfig;
640 &writepacfile;
641
fe1656d2
CS
642 if ($proxysettings{'CACHEMGR'} eq 'on'){&writecachemgr;}
643
d56fc335 644 system ('/usr/local/bin/squidctrl', 'disable');
ed38f89d
MT
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";
ac1cfefa 649
ac1cfefa 650 if ($proxysettings{'ENABLE'} eq 'on') {
d56fc335
MT
651 system ('/usr/bin/touch', "${General::swroot}/proxy/enable");
652 system ('/usr/local/bin/squidctrl', 'enable'); }
6c689591 653 if ($proxysettings{'TRANSPARENT'} eq 'on' && $proxysettings{'ENABLE'} eq 'on') {
9833e7d8 654 system ('/usr/bin/touch', "${General::swroot}/proxy/transparent"); }
ac1cfefa 655 if ($proxysettings{'ENABLE_BLUE'} eq 'on') {
d56fc335
MT
656 system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue");
657 system ('/usr/local/bin/squidctrl', 'enable'); }
6c689591 658 if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on' && $proxysettings{'ENABLE_BLUE'} eq 'on') {
9833e7d8 659 system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); }
ed38f89d 660
d56fc335 661 if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/squidctrl restart >/dev/null 2>&1'); }
fe1656d2
CS
662 if ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'}) { system('/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1'); }
663 }
ac1cfefa
MT
664}
665
363fb6af 666if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy clear cache'})
ac1cfefa 667{
d56fc335 668 system('/usr/local/bin/squidctrl flush >/dev/null 2>&1');
ac1cfefa
MT
669}
670
ed38f89d
MT
671if (!$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}
ac1cfefa
MT
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
363fb6af
MT
697$checked{'SUPPRESS_VERSION'}{'off'} = '';
698$checked{'SUPPRESS_VERSION'}{'on'} = '';
699$checked{'SUPPRESS_VERSION'}{$proxysettings{'SUPPRESS_VERSION'}} = "checked='checked'";
700
ed38f89d
MT
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'";
363fb6af
MT
710$checked{'NO_CONNECTION_AUTH'}{'off'} = '';
711$checked{'NO_CONNECTION_AUTH'}{'on'} = '';
712$checked{'NO_CONNECTION_AUTH'}{$proxysettings{'NO_CONNECTION_AUTH'}} = "checked='checked'";
ed38f89d
MT
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
ac1cfefa
MT
721$checked{'LOGGING'}{'off'} = '';
722$checked{'LOGGING'}{'on'} = '';
723$checked{'LOGGING'}{$proxysettings{'LOGGING'}} = "checked='checked'";
fe1656d2
CS
724$checked{'CACHEMGR'}{'off'} = '';
725$checked{'CACHEMGR'}{'on'} = '';
726$checked{'CACHEMGR'}{$proxysettings{'CACHEMGR'}} = "checked='checked'";
ed38f89d
MT
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'";
363fb6af 735$selected{'ERR_DESIGN'}{$proxysettings{'ERR_DESIGN'}} = "selected='selected'";
ed38f89d 736
9fb25b1c
MT
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
ed38f89d
MT
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
807foreach (@useragentlist) {
808 @useragent = split(/,/);
4e17adad
CS
809 $checked{'UA_'.$useragent[0]}{'off'} = '';
810 $checked{'UA_'.$useragent[0]}{'on'} = '';
811 $checked{'UA_'.$useragent[0]}{$proxysettings{'UA_'.$useragent[0]}} = "checked='checked'";
ed38f89d
MT
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'";
ac1cfefa 821
ed38f89d
MT
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
9fb25b1c
MT
870$checked{'ENABLE_FILTER'}{'off'} = '';
871$checked{'ENABLE_FILTER'}{'on'} = '';
872$checked{'ENABLE_FILTER'}{$proxysettings{'ENABLE_FILTER'}} = "checked='checked'";
ed38f89d 873
9fb25b1c
MT
874$checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
875$checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
876$checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
ed38f89d 877
d12aede7
CS
878$checked{'ENABLE_CLAMAV'}{'off'} = '';
879$checked{'ENABLE_CLAMAV'}{'on'} = '';
880$checked{'ENABLE_CLAMAV'}{$proxysettings{'ENABLE_CLAMAV'}} = "checked='checked'";
881
ed38f89d 882&Header::openpage($Lang::tr{'advproxy advanced web proxy configuration'}, 1, '');
ac1cfefa
MT
883
884&Header::openbigbox('100%', 'left', '', $errormessage);
885
886if ($errormessage) {
887 &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
888 print "<font class='base'>$errormessage&nbsp;</font>\n";
889 &Header::closebox();
890}
891
363fb6af
MT
892if ($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
ed38f89d
MT
901# ===================================================================
902# Main settings
903# ===================================================================
904
905unless ($proxysettings{'NCSA_EDIT_MODE'} eq 'yes') {
906
ac1cfefa
MT
907print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
908
ed38f89d
MT
909&Header::openbox('100%', 'left', "$Lang::tr{'advproxy advanced web proxy'}");
910
ac1cfefa
MT
911print <<END
912<table width='100%'>
913<tr>
ed38f89d
MT
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>
ac1cfefa
MT
921</tr>
922<tr>
ed38f89d 923 <td class='base'>$Lang::tr{'advproxy transparent on'} <font color="$Header::colourgreen">Green</font>:</td>
ac1cfefa 924 <td><input type='checkbox' name='TRANSPARENT' $checked{'TRANSPARENT'}{'on'} /></td>
ed38f89d
MT
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>
ac1cfefa
MT
927</tr>
928<tr>
929END
930;
931if ($netsettings{'BLUE_DEV'}) {
ed38f89d 932 print "<td class='base'>$Lang::tr{'advproxy enabled on'} <font color='$Header::colourblue'>Blue</font>:</td>";
ac1cfefa
MT
933 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked{'ENABLE_BLUE'}{'on'} /></td>";
934} else {
935 print "<td colspan='2'>&nbsp;</td>";
936}
937print <<END
fe1656d2 938 <td colspan='2'>&nbsp;</td>
ac1cfefa
MT
939</tr>
940<tr>
941END
942;
943if ($netsettings{'BLUE_DEV'}) {
ed38f89d 944 print "<td class='base'>$Lang::tr{'advproxy transparent on'} <font color='$Header::colourblue'>Blue</font>:</td>";
ac1cfefa
MT
945 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked{'TRANSPARENT_BLUE'}{'on'} /></td>";
946} else {
947 print "<td colspan='2'>&nbsp;</td>";
948}
949print <<END
ed38f89d
MT
950 <td class='base'>$Lang::tr{'advproxy error language'}:</td>
951 <td class='base'>
952 <select name='ERR_LANGUAGE'>
953END
954;
363fb6af 955 foreach (<$errordir/*>) {
ed38f89d
MT
956 if (-d) {
957 $language = substr($_,rindex($_,"/")+1);
958 print "<option value='$language' $selected{'ERR_LANGUAGE'}{$language}>$language</option>\n";
959 }
960 }
961print <<END
962 </select>
963 </td>
964</tr>
10e4f239 965<tr>
363fb6af
MT
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'>
0d948999 970 <option value='ipfire' $selected{'ERR_DESIGN'}{'ipfire'}>IPFire</option>
363fb6af
MT
971 <option value='squid' $selected{'ERR_DESIGN'}{'squid'}>$Lang::tr{'advproxy standard'}</option>
972 </select></td>
10e4f239
MT
973</tr>
974<tr>
363fb6af
MT
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>
10e4f239 979</tr>
ed38f89d
MT
980</table>
981<hr size='1'>
982<table width='100%'>
01212e04
CS
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>
d12aede7
CS
985END
986;
01212e04
CS
987my $count = `arp -a | wc -l`;
988if ( $count < 1 ){$count = 1;}
d12aede7 989if ( -e "/usr/bin/squidclamav" ) {
01212e04 990 print "<td class='base'><b>".$Lang::tr{'advproxy squidclamav'}."</b><br />";
bd027d94
CS
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);}
01212e04
CS
998 print "</td>";
999} else {
1000 print "<td></td>";
d12aede7 1001}
01212e04
CS
1002print "<td class='base'><b>".$Lang::tr{'advproxy url filter'}."</b><br />";
1003print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'}." /><br />";
28c9dec6 1004print "+ ".int(($count**(1/3)) * 6);
01212e04
CS
1005print "</td>";
1006print "<td class='base'><b>".$Lang::tr{'advproxy update accelerator'}."</b><br />";
1007print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'}." /><br />";
28c9dec6 1008print "+ ".int(($count**(1/3)) * 5);
01212e04 1009print "</td></tr>";
d12aede7 1010print <<END
9141bd34
CS
1011</table>
1012<hr size='1'>
1013<table width='100%'>
ed38f89d
MT
1014<tr>
1015 <td colspan='4' class='base'><b>$Lang::tr{'advproxy upstream proxy'}</b></td>
1016</tr>
1017<tr>
488d1b7c
CS
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>
ed38f89d
MT
1022</tr>
1023<tr>
488d1b7c
CS
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>
ac1cfefa 1028</tr>
ac1cfefa 1029<tr>
488d1b7c
CS
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>
ed38f89d 1034</tr>
363fb6af 1035<tr>
488d1b7c
CS
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>
363fb6af 1040</tr>
ed38f89d
MT
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>
488d1b7c
CS
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>
ed38f89d
MT
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>
fe1656d2
CS
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>
ed38f89d 1077<tr>
488d1b7c 1078 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
ac1cfefa
MT
1079</tr>
1080<tr>
ed38f89d
MT
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>
ac1cfefa
MT
1084 <td><input type='text' name='CACHE_SIZE' value='$proxysettings{'CACHE_SIZE'}' size='5' /></td>
1085</tr>
1086<tr>
ed38f89d 1087 <td class='base'>$Lang::tr{'advproxy min size'}:</td>
ac1cfefa 1088 <td><input type='text' name='MIN_SIZE' value='$proxysettings{'MIN_SIZE'}' size='5' /></td>
ed38f89d 1089 <td class='base'>$Lang::tr{'advproxy max size'}:</td>
ac1cfefa
MT
1090 <td><input type='text' name='MAX_SIZE' value='$proxysettings{'MAX_SIZE'}' size='5' /></td>
1091</tr>
1092<tr>
ed38f89d 1093 <td class='base'>$Lang::tr{'advproxy number of L1 dirs'}:</td>
363fb6af
MT
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>
ed38f89d 1101 <td colspan='2' rowspan= '5' valign='top' class='base'>
363fb6af 1102 <table cellspacing='0' cellpadding='0'>
ed38f89d
MT
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>
488d1b7c 1116 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
ed38f89d
MT
1117END
1118;
1119
1120print $proxysettings{'DST_NOCACHE'};
1121
1122print <<END
1123</textarea></td>
1124 </tr>
1125 </table>
1126 </td>
1127</tr>
1128<tr>
363fb6af
MT
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>
ed38f89d
MT
1136</tr>
1137<tr>
363fb6af
MT
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>
ed38f89d
MT
1145</tr>
1146<tr>
1147 <td colspan='2'>&nbsp;</td>
1148</tr>
1149<tr>
363fb6af 1150 <td class='base'>$Lang::tr{'advproxy offline mode'}:</td>
ed38f89d
MT
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%'>
363fb6af
MT
1156<tr>
1157 <td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td>
1158</tr>
1159<tr>
9141bd34 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>
363fb6af
MT
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'>
1168END
1169;
1170 if (!$proxysettings{'PORTS_SAFE'}) { print $def_ports_safe; } else { print $proxysettings{'PORTS_SAFE'}; }
1171
1172print <<END
1173</textarea></td>
1174 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1175END
1176;
1177 if (!$proxysettings{'PORTS_SSL'}) { print $def_ports_ssl; } else { print $proxysettings{'PORTS_SSL'}; }
1178
1179print <<END
1180</textarea></td>
1181</tr>
1182</table>
1183<hr size='1'>
1184<table width='100%'>
ed38f89d
MT
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>
9fb25b1c 1192 <td colspan='4' class='base'>$Lang::tr{'advproxy allowed subnets'}:</td>
ed38f89d
MT
1193</tr>
1194<tr>
9141bd34 1195 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
ed38f89d
MT
1196END
1197;
1198
363fb6af
MT
1199if (!$proxysettings{'SRC_SUBNETS'})
1200{
f09a0af5 1201 print "$green_cidr\n";
363fb6af
MT
1202 if ($netsettings{'BLUE_DEV'})
1203 {
f09a0af5 1204 print "$blue_cidr\n";
ed38f89d 1205 }
363fb6af 1206} else { print $proxysettings{'SRC_SUBNETS'}; }
ed38f89d
MT
1207
1208print <<END
1209</textarea></td>
9fb25b1c
MT
1210END
1211;
1212
1213$line = $Lang::tr{'advproxy no internal proxy on green'};
1214$line =~ s/Green/<font color="$Header::colourgreen">Green<\/font>/i;
1215print "<td class='base'>$line:</td>\n";
1216print <<END
1217 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked{'NO_PROXY_LOCAL'}{'on'} /></td>
1218</tr>
1219END
1220;
1221if ($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>
1229END
1230;
1231}
1232print <<END
1233<tr>
1234 <td colspan='2'>&nbsp;</td>
1235</tr>
1236<tr>
ed38f89d
MT
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>
9141bd34 1249 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
ed38f89d
MT
1250END
1251;
1252
1253 print $proxysettings{'SRC_UNRESTRICTED_IP'};
1254
1255print <<END
1256</textarea></td>
9141bd34 1257 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
ed38f89d
MT
1258END
1259;
1260
1261print $proxysettings{'SRC_UNRESTRICTED_MAC'};
1262
1263print <<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>
9141bd34 1276 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
ed38f89d
MT
1277END
1278;
1279
1280 print $proxysettings{'SRC_BANNED_IP'};
1281
1282print <<END
1283</textarea></td>
9141bd34 1284 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
ed38f89d
MT
1285END
1286;
1287
1288print $proxysettings{'SRC_BANNED_MAC'};
1289
1290print <<END
1291</textarea></td>
1292</tr>
1293</table>
1294
1295<hr size='1'>
1296
1297END
1298;
1299# -------------------------------------------------------------------
1300# CRE GUI - optional
1301# -------------------------------------------------------------------
1302
1303if (-e $cre_enabled) { print <<END
1304<table width='100%'>
1305
1306<tr>
9141bd34 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>
ed38f89d
MT
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>
9141bd34
CS
1313
1314END
1315;
1316if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){
1317print <<END
ed38f89d
MT
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>
9141bd34
CS
1324END
1325;
1326}
1327print "</tr>";
1328if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){
1329print <<END
ed38f89d
MT
1330<tr>
1331 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1332END
1333;
1334
1335 print $proxysettings{'CRE_GROUPS'};
1336
1337print <<END
1338</textarea></td>
1339 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1340END
1341;
1342 print $proxysettings{'CRE_SVHOSTS'};
1343
1344print <<END
1345</textarea></td>
1346</tr>
ed38f89d
MT
1347END
1348;
9141bd34
CS
1349}
1350print "</table><hr size='1'>";
1351
ed38f89d
MT
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'}' />
1357END
1358;
1359}
363fb6af 1360
ed38f89d
MT
1361# -------------------------------------------------------------------
1362
28c9dec6 1363print <<END
ed38f89d
MT
1364
1365<table width='100%'>
1366<tr>
363fb6af 1367 <td colspan='4'><b>$Lang::tr{'advproxy time restrictions'}</b></td>
ed38f89d
MT
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'>
1404END
1405;
1406for ($i=0;$i<=24;$i++) {
1407 $_ = sprintf("%02s",$i);
1408 print "<option $selected{'TIME_FROM_HOUR'}{$_}>$_</option>\n";
1409}
1410print <<END
1411 </select>
1412 </td>
1413 <td>:</td>
1414 <td class='base'>
1415 <select name='TIME_FROM_MINUTE'>
1416END
1417;
1418for ($i=0;$i<=45;$i+=15) {
1419 $_ = sprintf("%02s",$i);
1420 print "<option $selected{'TIME_FROM_MINUTE'}{$_}>$_</option>\n";
1421}
1422print <<END
1423 </select>
1424 <td> - </td>
1425 </td>
1426 <td class='base'>
1427 <select name='TIME_TO_HOUR'>
1428END
1429;
1430for ($i=0;$i<=24;$i++) {
1431 $_ = sprintf("%02s",$i);
1432 print "<option $selected{'TIME_TO_HOUR'}{$_}>$_</option>\n";
1433}
1434print <<END
1435 </select>
1436 </td>
1437 <td>:</td>
1438 <td class='base'>
1439 <select name='TIME_TO_MINUTE'>
1440END
1441;
1442for ($i=0;$i<=45;$i+=15) {
1443 $_ = sprintf("%02s",$i);
1444 print "<option $selected{'TIME_TO_MINUTE'}{$_}>$_</option>\n";
1445}
1446print <<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>
ac1cfefa
MT
1455</tr>
1456<tr>
ed38f89d
MT
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>
ac1cfefa
MT
1461</tr>
1462</table>
ed38f89d 1463<hr size='1'>
ac1cfefa 1464<table width='100%'>
ac1cfefa 1465<tr>
ed38f89d
MT
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'>
1472END
1473;
1474
1475foreach (@throttle_limits) {
1476 print "\t<option value='$_' $selected{'THROTTLING_GREEN_TOTAL'}{$_}>$_ kBit/s</option>\n";
1477}
1478
1479print <<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'>
1486END
1487;
1488
1489foreach (@throttle_limits) {
1490 print "\t<option value='$_' $selected{'THROTTLING_GREEN_HOST'}{$_}>$_ kBit/s</option>\n";
1491}
1492
1493print <<END
1494 <option value='0' $selected{'THROTTLING_GREEN_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n";
1495 </select>
1496 </td>
1497</tr>
1498END
1499;
1500
1501if ($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'>
1507END
1508;
1509
1510foreach (@throttle_limits) {
1511 print "\t<option value='$_' $selected{'THROTTLING_BLUE_TOTAL'}{$_}>$_ kBit/s</option>\n";
1512}
1513
1514print <<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'>
1521END
1522;
1523
1524foreach (@throttle_limits) {
1525 print "\t<option value='$_' $selected{'THROTTLING_BLUE_HOST'}{$_}>$_ kBit/s</option>\n";
1526}
1527
1528print <<END
1529 <option value='0' $selected{'THROTTLING_BLUE_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n";
1530 </select>
ac1cfefa 1531 </td>
ac1cfefa 1532</tr>
ed38f89d
MT
1533END
1534;
1535}
ac1cfefa 1536
ed38f89d
MT
1537print <<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>
363fb6af
MT
1550 <td width='15%'>&nbsp;</td>
1551 <td width='10%'>&nbsp;</td>
28c9dec6 1552</tr>
ac1cfefa 1553</table>
ed38f89d
MT
1554<hr size='1'>
1555<table width='100%'>
1556<tr>
9141bd34 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>
ed38f89d 1558</tr>
9141bd34
CS
1559END
1560;
1561if ( $proxysettings{'ENABLE_MIME_FILTER'} eq 'on' ){
1562print <<END
ed38f89d
MT
1563<tr>
1564 <td colspan='2' class='base'>$Lang::tr{'advproxy MIME block types'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
363fb6af
MT
1565 <td>&nbsp;</td>
1566 <td>&nbsp;</td>
ed38f89d
MT
1567</tr>
1568<tr>
1569 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
ac1cfefa
MT
1570END
1571;
ac1cfefa 1572
ed38f89d 1573print $proxysettings{'MIME_TYPES'};
ac1cfefa 1574
ed38f89d
MT
1575print <<END
1576</textarea></td>
363fb6af
MT
1577 <td>&nbsp;</td>
1578 <td>&nbsp;</td>
ed38f89d 1579</tr>
9141bd34
CS
1580END
1581;
1582}
1583print <<END
ed38f89d 1584</table>
9141bd34 1585
ed38f89d
MT
1586<hr size='1'>
1587<table width='100%'>
1588<tr>
9141bd34 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>
ed38f89d 1590</tr>
9141bd34
CS
1591END
1592;
1593if ( $proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on' ){
1594print <<END
ed38f89d
MT
1595<tr>
1596 <td colspan='4'><i>
1597END
1598;
1599if (@useragentlist) { print "$Lang::tr{'advproxy allowed web browsers'}:"; } else { print "$Lang::tr{'advproxy no clients defined'}"; }
1600print <<END
1601</i></td>
1602</tr>
1603</table>
1604<table width='100%'>
1605END
1606;
ac1cfefa 1607
ed38f89d
MT
1608for ($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]);
4e17adad
CS
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";
ed38f89d
MT
1615 }
1616 if ($i eq 3) { print "<\/tr>\n"; }
1617 }
1618}
9141bd34 1619}
ed38f89d
MT
1620print <<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>
ed38f89d
MT
1629 <td class='base'>$Lang::tr{'advproxy fake referer'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
1630</tr>
1631<tr>
9141bd34 1632 <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td>
ed38f89d
MT
1633 <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='56' /></td>
1634</tr>
1635</table>
1636<hr size='1'>
1637END
1638;
1639
9fb25b1c 1640print <<END
ed38f89d
MT
1641<table width='100%'>
1642<tr>
363fb6af 1643 <td colspan='5'><b>$Lang::tr{'advproxy AUTH method'}</b></td>
ed38f89d
MT
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>
1654END
1655;
1656
1657if (!($proxysettings{'AUTH_METHOD'} eq 'none')) { if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { print <<END
1658<hr size='1'>
1659<table width='100%'>
1660<tr>
363fb6af 1661 <td colspan='4'><b>$Lang::tr{'advproxy AUTH global settings'}</b></td>
ed38f89d
MT
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'>
1700END
1701;
1702
1703print $proxysettings{'DST_NOAUTH'};
1704
1705print <<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>
363fb6af
MT
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>
ed38f89d
MT
1726</tr>
1727<tr>
1728 <td colspan='2'>&nbsp;</td>
1729</tr>
1730</table>
1731END
1732;
1733}
1734
1735# ===================================================================
1736# NCSA auth settings
1737# ===================================================================
1738
1739if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') {
1740print <<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>
363fb6af 1750 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked{'NCSA_BYPASS_REDIR'}{'on'} /></td>
ed38f89d
MT
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>
1758END
1759; }
1760
1761# ===================================================================
1762# IDENTD auth settings
1763# ===================================================================
1764
1765if ($proxysettings{'AUTH_METHOD'} eq 'ident') {
1766print <<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>
363fb6af
MT
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>
ed38f89d
MT
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'>
1790END
1791;
1792if (!$proxysettings{'IDENT_HOSTS'}) {
f09a0af5 1793 print "$green_cidr\n";
ed38f89d 1794 if ($netsettings{'BLUE_DEV'}) {
f09a0af5 1795 print "$blue_cidr\n";
ed38f89d
MT
1796 }
1797} else {
1798 print $proxysettings{'IDENT_HOSTS'};
1799}
1800
1801print <<END
1802</textarea></td>
1803 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1804END
1805;
1806
1807print $proxysettings{'DST_NOAUTH'};
1808
1809print <<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>
363fb6af 1835 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
ed38f89d
MT
1836END
1837; }
1838
1839if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_ALLOW_USERS'}; }
1840
1841if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END
1842</textarea></td>
363fb6af 1843 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
ed38f89d
MT
1844END
1845; }
1846
1847if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_DENY_USERS'}; }
1848
1849if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END
1850</textarea></td>
1851</tr>
1852</table>
1853END
1854; }
1855
1856# ===================================================================
1857# NTLM auth settings
1858# ===================================================================
1859
1860if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') {
1861print <<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>
363fb6af 1909 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
ed38f89d
MT
1910END
1911; }
1912
1913if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_ALLOW_USERS'}; }
1914
1915if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END
1916</textarea></td>
363fb6af 1917 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
ed38f89d
MT
1918END
1919; }
1920
1921if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_DENY_USERS'}; }
1922
1923if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END
1924</textarea></td>
1925</tr>
1926</table>
1927END
1928; }
1929
1930# ===================================================================
1931# LDAP auth settings
1932# ===================================================================
1933
1934if ($proxysettings{'AUTH_METHOD'} eq 'ldap') {
1935print <<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>
1983END
1984; }
1985
1986# ===================================================================
1987# RADIUS auth settings
1988# ===================================================================
1989
1990if ($proxysettings{'AUTH_METHOD'} eq 'radius') {
1991print <<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>
363fb6af 2032 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
ed38f89d
MT
2033END
2034; }
2035
2036if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_ALLOW_USERS'}; }
2037
2038if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END
2039</textarea></td>
363fb6af 2040 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
ed38f89d
MT
2041END
2042; }
2043
2044if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_DENY_USERS'}; }
2045
2046if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END
2047</textarea></td>
2048</tr>
2049</table>
2050END
2051; }
2052
2053# ===================================================================
2054
2055}
2056
2057print "<table>\n";
2058
2059if ($proxysettings{'AUTH_METHOD'} eq 'none') {
2060print <<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>
2068END
2069; }
2070
2071if ($proxysettings{'AUTH_METHOD'} eq 'ident') {
2072print <<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>
2078END
2079; }
2080
2081if (!($proxysettings{'AUTH_METHOD'} eq 'ncsa')) {
2082print <<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>
2085END
2086; }
2087
2088if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) {
2089print <<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>
2097END
2098; }
2099
2100if (!($proxysettings{'AUTH_METHOD'} eq 'ldap')) {
2101print <<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>
2109END
2110; }
2111
2112if (!($proxysettings{'AUTH_METHOD'} eq 'ntlm')) {
2113print <<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>
2122END
2123; }
2124
2125if (!($proxysettings{'AUTH_METHOD'} eq 'radius')) {
2126print <<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>
2135END
2136; }
2137
2138print "</table>\n";
2139
2140print <<END
2141<hr size='1'>
2142END
2143;
2144
2145print <<END
2146<table width='100%'>
2147<tr>
363fb6af 2148 <td>&nbsp;</td>
ed38f89d 2149 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
fe1656d2 2150 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'proxy reconfigure'}' /></td>
ed38f89d 2151 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy save and restart'}' /></td>
363fb6af
MT
2152 <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy clear cache'}' /></td>
2153 <td>&nbsp;</td>
ed38f89d
MT
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>
363fb6af 2163 <td align='right'>&nbsp;</td>
ed38f89d
MT
2164</tr>
2165</table>
2166</form>
2167END
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'}");
2179print <<END
2180<form method='post' action='$ENV{'SCRIPT_NAME'}'>
2181<table width='100%'>
2182<tr>
363fb6af 2183 <td colspan='4'><b>$Lang::tr{'advproxy NCSA user management'}</b></td>
ed38f89d
MT
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'
2188END
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>
2217END
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
2223print <<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>
363fb6af 2233 <td><b>$Lang::tr{'advproxy NCSA user accounts'}:</b></td>
ed38f89d
MT
2234</tr>
2235</table>
2236<table width='100%' align='center'>
2237END
2238;
2239
2240if (-e $extgrp)
2241{
2242 open(FILE, $extgrp); @grouplist = <FILE>; close(FILE);
2243 foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":extended"); }
2244}
2245if (-e $stdgrp)
2246{
2247 open(FILE, $stdgrp); @grouplist = <FILE>; close(FILE);
2248 foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":standard"); }
2249}
2250if (-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
488d1b7c 2260if ( ! -z "$userdb" ) {
ed38f89d
MT
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>
2267END
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) {
4e17adad 2278 print "<tr bgcolor='$color{'color20'}'>\n"; }
ed38f89d 2279 else {
4e17adad 2280 print "<tr bgcolor='$color{'color22'}'>\n"; }
ed38f89d
MT
2281
2282 print <<END
2283 <td align='center'>$temp[0]</td>
2284 <td align='center'>
2285END
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>
2311END
2312;
2313 }
2314
2315print <<END
2316</table>
2317<br>
9fb25b1c 2318<table>
ed38f89d
MT
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>
2326END
2327;
2328} else {
2329 print <<END
2330 <tr>
363fb6af 2331 <td><i>$Lang::tr{'advproxy NCSA no accounts'}</i></td>
ed38f89d
MT
2332 </tr>
2333END
2334;
2335}
2336
2337print <<END
2338</table>
2339END
2340;
2341
2342&Header::closebox();
2343
2344}
2345
2346# ===================================================================
2347
2348&Header::closebigbox();
2349
2350&Header::closepage();
2351
2352# -------------------------------------------------------------------
2353
2354sub 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 }
363fb6af
MT
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 }
ed38f89d
MT
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
2474sub check_acls
2475{
363fb6af
MT
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 {
488d1b7c
CS
2513 s/^\s+//g;
2514 unless (/^#/) { s/\s+//g; }
363fb6af
MT
2515 if ($_)
2516 {
488d1b7c 2517 if (/^\./) { $_ = '*'.$_; }
363fb6af
MT
2518 $proxysettings{'DST_NOCACHE'} .= $_."\n";
2519 }
2520 }
2521
ed38f89d
MT
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
363fb6af 2582 @temp = split(/\n/,$proxysettings{'DST_NOAUTH'});
37273bc6 2583 undef $proxysettings{'DST_NOAUTH'};
363fb6af
MT
2584 foreach (@temp)
2585 {
488d1b7c
CS
2586 s/^\s+//g;
2587 unless (/^#/) { s/\s+//g; }
363fb6af
MT
2588 if ($_)
2589 {
488d1b7c 2590 if (/^\./) { $_ = '*'.$_; }
363fb6af
MT
2591 $proxysettings{'DST_NOAUTH'} .= $_."\n";
2592 }
2593 }
2594
ed38f89d
MT
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 ($_)
2673 {
2674 unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; }
2675 $proxysettings{'IDENT_HOSTS'} .= $_."\n";
2676 }
2677 }
2678
2679 @temp = split(/\n/,$proxysettings{'CRE_SVHOSTS'});
2680 undef $proxysettings{'CRE_SVHOSTS'};
2681 foreach (@temp)
2682 {
2683 s/^\s+//g; s/\s+$//g;
2684 if ($_)
2685 {
2686 unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; }
2687 $proxysettings{'CRE_SVHOSTS'} .= $_."\n";
2688 }
2689 }
2690}
2691
ed38f89d
MT
2692# -------------------------------------------------------------------
2693
2694sub write_acls
2695{
2696 open(FILE, ">$acl_src_subnets");
2697 flock(FILE, 2);
363fb6af
MT
2698 if (!$proxysettings{'SRC_SUBNETS'})
2699 {
f09a0af5 2700 print FILE "$green_cidr\n";
363fb6af
MT
2701 if ($netsettings{'BLUE_DEV'})
2702 {
f09a0af5 2703 print FILE "$blue_cidr\n";
363fb6af
MT
2704 }
2705 } else { print FILE $proxysettings{'SRC_SUBNETS'}; }
ed38f89d
MT
2706 close(FILE);
2707
2708 open(FILE, ">$acl_src_banned_ip");
2709 flock(FILE, 2);
2710 print FILE $proxysettings{'SRC_BANNED_IP'};
2711 close(FILE);
2712
2713 open(FILE, ">$acl_src_banned_mac");
2714 flock(FILE, 2);
2715 print FILE $proxysettings{'SRC_BANNED_MAC'};
2716 close(FILE);
2717
2718 open(FILE, ">$acl_src_unrestricted_ip");
2719 flock(FILE, 2);
2720 print FILE $proxysettings{'SRC_UNRESTRICTED_IP'};
2721 close(FILE);
2722
2723 open(FILE, ">$acl_src_unrestricted_mac");
2724 flock(FILE, 2);
2725 print FILE $proxysettings{'SRC_UNRESTRICTED_MAC'};
2726 close(FILE);
2727
488d1b7c
CS
2728 open(FILE, ">$acl_dst_noauth");
2729 flock(FILE, 2);
2730 print FILE $proxysettings{'DST_NOAUTH'};
2731 close(FILE);
2732
2733 open(FILE, ">$acl_dst_noauth_net");
2734 close(FILE);
2735 open(FILE, ">$acl_dst_noauth_dom");
2736 close(FILE);
2737 open(FILE, ">$acl_dst_noauth_url");
2738 close(FILE);
2739
2740 @temp = split(/\n/,$proxysettings{'DST_NOAUTH'});
2741 foreach(@temp)
2742 {
2743 unless (/^#/)
2744 {
2745 if (/^\*\.\w/)
2746 {
2747 s/^\*//;
2748 open(FILE, ">>$acl_dst_noauth_dom");
2749 flock(FILE, 2);
2750 print FILE "$_\n";
2751 close(FILE);
2752 }
2753 elsif (&General::validipormask($_))
2754 {
2755 open(FILE, ">>$acl_dst_noauth_net");
2756 flock(FILE, 2);
2757 print FILE "$_\n";
2758 close(FILE);
2759 }
2760 elsif (/\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/)
2761 {
2762 open(FILE, ">>$acl_dst_noauth_net");
2763 flock(FILE, 2);
2764 print FILE "$_\n";
2765 close(FILE);
2766 }
2767 else
2768 {
2769 open(FILE, ">>$acl_dst_noauth_url");
2770 flock(FILE, 2);
2771 if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; }
2772 close(FILE);
2773 }
2774 }
2775 }
2776
ed38f89d
MT
2777 open(FILE, ">$acl_dst_nocache");
2778 flock(FILE, 2);
2779 print FILE $proxysettings{'DST_NOCACHE'};
2780 close(FILE);
2781
488d1b7c
CS
2782 open(FILE, ">$acl_dst_nocache_net");
2783 close(FILE);
2784 open(FILE, ">$acl_dst_nocache_dom");
2785 close(FILE);
2786 open(FILE, ">$acl_dst_nocache_url");
ed38f89d
MT
2787 close(FILE);
2788
488d1b7c
CS
2789 @temp = split(/\n/,$proxysettings{'DST_NOCACHE'});
2790 foreach(@temp)
2791 {
2792 unless (/^#/)
2793 {
2794 if (/^\*\.\w/)
2795 {
2796 s/^\*//;
2797 open(FILE, ">>$acl_dst_nocache_dom");
2798 flock(FILE, 2);
2799 print FILE "$_\n";
2800 close(FILE);
2801 }
2802 elsif (&General::validipormask($_))
2803 {
2804 open(FILE, ">>$acl_dst_nocache_net");
2805 flock(FILE, 2);
2806 print FILE "$_\n";
2807 close(FILE);
2808 }
2809 elsif (/\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/)
2810 {
2811 open(FILE, ">>$acl_dst_nocache_net");
2812 flock(FILE, 2);
2813 print FILE "$_\n";
2814 close(FILE);
2815 }
2816 else
2817 {
2818 open(FILE, ">>$acl_dst_nocache_url");
2819 flock(FILE, 2);
2820 if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; }
2821 close(FILE);
2822 }
2823 }
2824 }
2825
363fb6af
MT
2826 open(FILE, ">$acl_ports_safe");
2827 flock(FILE, 2);
2828 if (!$proxysettings{'PORTS_SAFE'}) { print FILE $def_ports_safe; } else { print FILE $proxysettings{'PORTS_SAFE'}; }
2829 close(FILE);
2830
2831 open(FILE, ">$acl_ports_ssl");
2832 flock(FILE, 2);
2833 if (!$proxysettings{'PORTS_SSL'}) { print FILE $def_ports_ssl; } else { print FILE $proxysettings{'PORTS_SSL'}; }
2834 close(FILE);
2835
ed38f89d
MT
2836 open(FILE, ">$acl_dst_throttle");
2837 flock(FILE, 2);
2838 if ($proxysettings{'THROTTLE_BINARY'} eq 'on')
2839 {
2840 @temp = split(/\|/,$throttle_binary);
363fb6af 2841 foreach (@temp) { print FILE "\\.$_\$\n"; }
ed38f89d
MT
2842 }
2843 if ($proxysettings{'THROTTLE_DSKIMG'} eq 'on')
2844 {
2845 @temp = split(/\|/,$throttle_dskimg);
363fb6af 2846 foreach (@temp) { print FILE "\\.$_\$\n"; }
ed38f89d
MT
2847 }
2848 if ($proxysettings{'THROTTLE_MMEDIA'} eq 'on')
2849 {
2850 @temp = split(/\|/,$throttle_mmedia);
363fb6af 2851 foreach (@temp) { print FILE "\\.$_\$\n"; }
ed38f89d
MT
2852 }
2853 if (-s $throttled_urls)
2854 {
2855 open(URLFILE, $throttled_urls);
2856 @temp = <URLFILE>;
2857 close(URLFILE);
363fb6af 2858 foreach (@temp) { print FILE; }
ed38f89d
MT
2859 }
2860 close(FILE);
2861
2862 open(FILE, ">$mimetypes");
2863 flock(FILE, 2);
2864 print FILE $proxysettings{'MIME_TYPES'};
2865 close(FILE);
2866
2867 open(FILE, ">$ntlmdir/msntauth.allowusers");
2868 flock(FILE, 2);
2869 print FILE $proxysettings{'NTLM_ALLOW_USERS'};
2870 close(FILE);
2871
2872 open(FILE, ">$ntlmdir/msntauth.denyusers");
2873 flock(FILE, 2);
2874 print FILE $proxysettings{'NTLM_DENY_USERS'};
2875 close(FILE);
2876
2877 open(FILE, ">$raddir/radauth.allowusers");
2878 flock(FILE, 2);
2879 print FILE $proxysettings{'RADIUS_ALLOW_USERS'};
2880 close(FILE);
2881
2882 open(FILE, ">$raddir/radauth.denyusers");
2883 flock(FILE, 2);
2884 print FILE $proxysettings{'RADIUS_DENY_USERS'};
2885 close(FILE);
2886
2887 open(FILE, ">$identdir/identauth.allowusers");
2888 flock(FILE, 2);
2889 print FILE $proxysettings{'IDENT_ALLOW_USERS'};
2890 close(FILE);
2891
2892 open(FILE, ">$identdir/identauth.denyusers");
2893 flock(FILE, 2);
2894 print FILE $proxysettings{'IDENT_DENY_USERS'};
2895 close(FILE);
2896
2897 open(FILE, ">$identhosts");
2898 flock(FILE, 2);
2899 print FILE $proxysettings{'IDENT_HOSTS'};
2900 close(FILE);
2901
2902 open(FILE, ">$cre_groups");
2903 flock(FILE, 2);
2904 print FILE $proxysettings{'CRE_GROUPS'};
2905 close(FILE);
2906
2907 open(FILE, ">$cre_svhosts");
2908 flock(FILE, 2);
2909 print FILE $proxysettings{'CRE_SVHOSTS'};
2910 close(FILE);
2911}
2912
2913# -------------------------------------------------------------------
2914
2915sub writepacfile
2916{
22527178 2917 open(FILE, ">/srv/web/ipfire/html/proxy.pac");
ed38f89d
MT
2918 flock(FILE, 2);
2919 print FILE "function FindProxyForURL(url, host)\n";
2920 print FILE "{\n";
2921 if (($proxysettings{'ENABLE'} eq 'on') || ($proxysettings{'ENABLE_BLUE'} eq 'on'))
2922 {
2923 print FILE <<END
2924if (
2925 (isPlainHostName(host)) ||
2926 (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) ||
2927 (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
2928 (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
488d1b7c
CS
2929 (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
2930 (isInNet(host, "169.254.0.0", "255.255.0.0"))
ed38f89d
MT
2931 )
2932 return "DIRECT";
2933
2934 else
2935
2936END
2937;
2938 if ($proxysettings{'ENABLE'} eq 'on')
2939 {
268292e7
CS
2940 print FILE "if (\n";
2941 print FILE " (isInNet(myIpAddress(), \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\"))";
2942
2943 undef @templist;
2944 if (-e "$acl_src_subnets") {
2945 open(SUBNETS,"$acl_src_subnets");
2946 @templist = <SUBNETS>;
2947 close(SUBNETS);
2948 }
2949
2950 foreach (@templist)
2951 {
2952 @temp = split(/\//);
2953 if (
28c9dec6 2954 ($temp[0] ne $netsettings{'GREEN_NETADDRESS'}) && ($temp[1] ne $netsettings{'GREEN_NETMASK'}) &&
268292e7
CS
2955 ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'})
2956 )
2957 {
2958 chomp $temp[1];
2959 print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))";
2960 }
2961 }
2962
2963 print FILE "\n";
2964
ed38f89d 2965 print FILE <<END
268292e7
CS
2966
2967
ed38f89d
MT
2968 )
2969 return "PROXY $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
2970END
2971;
2972 }
2973 if (($proxysettings{'ENABLE'} eq 'on') && ($proxysettings{'ENABLE_BLUE'} eq 'on') && ($netsettings{'BLUE_DEV'}))
2974 {
2975 print FILE "\n else\n\n";
2976 }
2977 if (($netsettings{'BLUE_DEV'}) && ($proxysettings{'ENABLE_BLUE'} eq 'on'))
2978 {
2979 print FILE <<END
2980if (
2981 (isInNet(myIpAddress(), "$netsettings{'BLUE_NETADDRESS'}", "$netsettings{'BLUE_NETMASK'}"))
2982 )
2983 return "PROXY $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
2984END
2985;
2986 }
2987 }
2988 print FILE "}\n";
2989 close(FILE);
2990}
2991
2992# -------------------------------------------------------------------
2993
2994sub writeconfig
2995{
2996 my $authrealm;
2997 my $delaypools;
2998
363fb6af 2999 if ($proxysettings{'THROTTLING_GREEN_TOTAL'} +
ed38f89d
MT
3000 $proxysettings{'THROTTLING_GREEN_HOST'} +
3001 $proxysettings{'THROTTLING_BLUE_TOTAL'} +
3002 $proxysettings{'THROTTLING_BLUE_HOST'} gt 0)
3003 {
3004 $delaypools = 1; } else { $delaypools = 0;
3005 }
3006
3007 if ($proxysettings{'AUTH_REALM'} eq '')
3008 {
d12aede7 3009 $authrealm = "IPFire Advanced Proxy Server";
ed38f89d
MT
3010 } else {
3011 $authrealm = $proxysettings{'AUTH_REALM'};
3012 }
3013
3014 $_ = $proxysettings{'UPSTREAM_PROXY'};
3015 my ($remotehost, $remoteport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
3016
3017 if ($remoteport eq '') { $remoteport = 80; }
3018
3019 open(FILE, ">${General::swroot}/proxy/squid.conf");
3020 flock(FILE, 2);
3021 print FILE <<END
363fb6af
MT
3022# Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3023# you make will be overwritten whenever you resave proxy settings using the
3024# web interface!
3025#
3026# Instead, modify the file '$acl_include' and
3027# then restart the proxy service using the web interface. Changes made to the
3028# 'include.acl' file will propagate to the 'squid.conf' file at that time.
3029
ed38f89d
MT
3030shutdown_lifetime 5 seconds
3031icp_port 0
3032
ed38f89d
MT
3033END
3034 ;
363fb6af
MT
3035 print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
3036 if ($proxysettings{'TRANSPARENT'} eq 'on') { print FILE " transparent" }
3037 if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
3038 print FILE "\n";
3039
ed38f89d 3040 if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') {
363fb6af
MT
3041 print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
3042 if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { print FILE " transparent" }
3043 if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
3044 print FILE "\n";
ed38f89d
MT
3045 }
3046
488d1b7c
CS
3047 if ($proxysettings{'CACHE_SIZE'} > 0)
3048 {
3049 print FILE "\n";
ed38f89d 3050
488d1b7c
CS
3051 if (!-z $acl_dst_nocache_dom) {
3052 print FILE "acl no_cache_domains dstdomain \"$acl_dst_nocache_dom\"\n";
3053 print FILE "cache deny no_cache_domains\n";
3054 }
3055 if (!-z $acl_dst_nocache_net) {
37273bc6 3056 print FILE "acl no_cache_ipaddr dst \"$acl_dst_nocache_net\"\n";
488d1b7c
CS
3057 print FILE "cache deny no_cache_ipaddr\n";
3058 }
3059 if (!-z $acl_dst_nocache_url) {
3060 print FILE "acl no_cache_hosts url_regex -i \"$acl_dst_nocache_url\"\n";
3061 print FILE "cache deny no_cache_hosts\n";
3062 }
ed38f89d
MT
3063 }
3064
3065 print FILE <<END
3066
3067cache_effective_user squid
3068cache_effective_group squid
363fb6af 3069umask 022
ed38f89d
MT
3070
3071pid_filename /var/run/squid.pid
3072
3073cache_mem $proxysettings{'CACHE_MEM'} MB
ed38f89d
MT
3074END
3075 ;
3076
e07587fc 3077 if ($proxysettings{'CACHE_SIZE'} ne '0')
488d1b7c 3078 {
488d1b7c
CS
3079 print FILE "cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256\n\n";
3080 }
3081
ab4a5a35 3082 print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n";
363fb6af 3083
ed38f89d
MT
3084 if ($proxysettings{'OFFLINE_MODE'} eq 'on') { print FILE "offline_mode on\n\n"; }
3085
3086 if ((!($proxysettings{'MEM_POLICY'} eq 'LRU')) || (!($proxysettings{'CACHE_POLICY'} eq 'LRU')))
3087 {
3088 if (!($proxysettings{'MEM_POLICY'} eq 'LRU'))
3089 {
3090 print FILE "memory_replacement_policy $proxysettings{'MEM_POLICY'}\n";
3091 }
3092 if (!($proxysettings{'CACHE_POLICY'} eq 'LRU'))
3093 {
3094 print FILE "cache_replacement_policy $proxysettings{'CACHE_POLICY'}\n";
3095 }
3096 print FILE "\n";
3097 }
3098
3099 if ($proxysettings{'LOGGING'} eq 'on')
3100 {
363fb6af
MT
3101 print FILE <<END
3102access_log /var/log/squid/access.log
ed38f89d
MT
3103cache_log /var/log/squid/cache.log
3104cache_store_log none
3105END
3106 ;
3107 if ($proxysettings{'LOGUSERAGENT'} eq 'on') { print FILE "useragent_log \/var\/log\/squid\/user_agent.log\n"; }
3108 if ($proxysettings{'LOGQUERY'} eq 'on') { print FILE "\nstrip_query_terms off\n"; }
3109 } else {
3110 print FILE <<END
363fb6af 3111access_log /dev/null
ed38f89d
MT
3112cache_log /dev/null
3113cache_store_log none
3114END
3115 ;}
3116 print FILE <<END
3117
3118log_mime_hdrs off
3119END
3120 ;
3121
3122 if ($proxysettings{'FORWARD_IPADDRESS'} eq 'on')
3123 {
363fb6af 3124 print FILE "forwarded_for on\n";
ed38f89d 3125 } else {
363fb6af 3126 print FILE "forwarded_for off\n";
ed38f89d 3127 }
363fb6af
MT
3128 if ($proxysettings{'FORWARD_VIA'} eq 'on')
3129 {
3130 print FILE "via on\n";
3131 } else {
3132 print FILE "via off\n";
3133 }
3134 print FILE "\n";
ed38f89d
MT
3135
3136 if ((!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident')))
3137 {
3138 if ($proxysettings{'AUTH_METHOD'} eq 'ncsa')
3139 {
363fb6af 3140 print FILE "auth_param basic program $authdir/ncsa_auth $userdb\n";
ed38f89d
MT
3141 print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n";
3142 print FILE "auth_param basic realm $authrealm\n";
3143 print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n";
3144 if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; }
3145 }
3146
3147 if ($proxysettings{'AUTH_METHOD'} eq 'ldap')
3148 {
363fb6af 3149 print FILE "auth_param basic program $authdir/squid_ldap_auth -b \"$proxysettings{'LDAP_BASEDN'}\"";
ed38f89d
MT
3150 if (!($proxysettings{'LDAP_BINDDN_USER'} eq '')) { print FILE " -D \"$proxysettings{'LDAP_BINDDN_USER'}\""; }
3151 if (!($proxysettings{'LDAP_BINDDN_PASS'} eq '')) { print FILE " -w $proxysettings{'LDAP_BINDDN_PASS'}"; }
3152 if ($proxysettings{'LDAP_TYPE'} eq 'ADS')
3153 {
3154 if ($proxysettings{'LDAP_GROUP'} eq '')
3155 {
3156 print FILE " -f \"(\&(objectClass=person)(sAMAccountName=\%s))\"";
3157 } else {
3158 print FILE " -f \"(\&(\&(objectClass=person)(sAMAccountName=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\"";
3159 }
3160 print FILE " -u sAMAccountName -P";
3161 }
3162 if ($proxysettings{'LDAP_TYPE'} eq 'NDS')
3163 {
3164 if ($proxysettings{'LDAP_GROUP'} eq '')
3165 {
3166 print FILE " -f \"(\&(objectClass=person)(cn=\%s))\"";
3167 } else {
3168 print FILE " -f \"(\&(\&(objectClass=person)(cn=\%s))(groupMembership=$proxysettings{'LDAP_GROUP'}))\"";
3169 }
3170 print FILE " -u cn -P";
3171 }
3172 if (($proxysettings{'LDAP_TYPE'} eq 'V2') || ($proxysettings{'LDAP_TYPE'} eq 'V3'))
3173 {
3174 if ($proxysettings{'LDAP_GROUP'} eq '')
3175 {
3176 print FILE " -f \"(\&(objectClass=person)(uid=\%s))\"";
3177 } else {
3178 print FILE " -f \"(\&(\&(objectClass=person)(uid=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\"";
3179 }
3180 if ($proxysettings{'LDAP_TYPE'} eq 'V2') { print FILE " -v 2"; }
3181 if ($proxysettings{'LDAP_TYPE'} eq 'V3') { print FILE " -v 3"; }
3182 print FILE " -u uid -P";
3183 }
3184 print FILE " $proxysettings{'LDAP_SERVER'}:$proxysettings{'LDAP_PORT'}\n";
3185 print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n";
3186 print FILE "auth_param basic realm $authrealm\n";
3187 print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n";
3188 if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; }
3189 }
3190
3191 if ($proxysettings{'AUTH_METHOD'} eq 'ntlm')
3192 {
3193 if ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on')
3194 {
bbb7dc04 3195 print FILE "auth_param ntlm program $authdir/ntlm_smb_lm_auth $proxysettings{'NTLM_DOMAIN'}/$proxysettings{'NTLM_PDC'}";
ed38f89d
MT
3196 if ($proxysettings{'NTLM_BDC'} eq '') { print FILE "\n"; } else { print FILE " $proxysettings{'NTLM_DOMAIN'}/$proxysettings{'NTLM_BDC'}\n"; }
3197 print FILE "auth_param ntlm children $proxysettings{'AUTH_CHILDREN'}\n";
ed38f89d
MT
3198 if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; }
3199 } else {
363fb6af 3200 print FILE "auth_param basic program $authdir/msnt_auth\n";
ed38f89d
MT
3201 print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n";
3202 print FILE "auth_param basic realm $authrealm\n";
3203 print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n";
3204 if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; }
3205
3206 open(MSNTCONF, ">$ntlmdir/msntauth.conf");
3207 flock(MSNTCONF,2);
3208 print MSNTCONF "server $proxysettings{'NTLM_PDC'}";
3209 if ($proxysettings{'NTLM_BDC'} eq '') { print MSNTCONF " $proxysettings{'NTLM_PDC'}"; } else { print MSNTCONF " $proxysettings{'NTLM_BDC'}"; }
3210 print MSNTCONF " $proxysettings{'NTLM_DOMAIN'}\n";
3211 if ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on')
3212 {
3213 if ($proxysettings{'NTLM_USER_ACL'} eq 'positive')
3214 {
3215 print MSNTCONF "allowusers $ntlmdir/msntauth.allowusers\n";
3216 } else {
3217 print MSNTCONF "denyusers $ntlmdir/msntauth.denyusers\n";
28c9dec6 3218 }
ed38f89d
MT
3219 }
3220 close(MSNTCONF);
3221 }
3222 }
3223
3224 if ($proxysettings{'AUTH_METHOD'} eq 'radius')
3225 {
363fb6af 3226 print FILE "auth_param basic program $authdir/squid_radius_auth -h $proxysettings{'RADIUS_SERVER'} -p $proxysettings{'RADIUS_PORT'} ";
ed38f89d
MT
3227 if (!($proxysettings{'RADIUS_IDENTIFIER'} eq '')) { print FILE "-i $proxysettings{'RADIUS_IDENTIFIER'} "; }
3228 print FILE "-w $proxysettings{'RADIUS_SECRET'}\n";
3229 print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n";
3230 print FILE "auth_param basic realm $authrealm\n";
3231 print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n";
3232 if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; }
3233 }
3234
3235 print FILE "\n";
3236 print FILE "acl for_inetusers proxy_auth REQUIRED\n";
3237 if (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') && ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on'))
3238 {
3239 if ((!-z "$ntlmdir/msntauth.allowusers") && ($proxysettings{'NTLM_USER_ACL'} eq 'positive'))
3240 {
3241 print FILE "acl for_acl_users proxy_auth \"$ntlmdir/msntauth.allowusers\"\n";
3242 }
3243 if ((!-z "$ntlmdir/msntauth.denyusers") && ($proxysettings{'NTLM_USER_ACL'} eq 'negative'))
3244 {
3245 print FILE "acl for_acl_users proxy_auth \"$ntlmdir/msntauth.denyusers\"\n";
3246 }
3247 }
3248 if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on'))
3249 {
3250 if ((!-z "$raddir/radauth.allowusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive'))
3251 {
3252 print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.allowusers\"\n";
3253 }
3254 if ((!-z "$raddir/radauth.denyusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative'))
3255 {
3256 print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.denyusers\"\n";
3257 }
3258 }
3259 if ($proxysettings{'AUTH_METHOD'} eq 'ncsa')
3260 {
3261 print FILE "\n";
3262 if (!-z $extgrp) { print FILE "acl for_extended_users proxy_auth \"$extgrp\"\n"; }
3263 if (!-z $disgrp) { print FILE "acl for_disabled_users proxy_auth \"$disgrp\"\n"; }
3264 }
3265 if (!($proxysettings{'AUTH_MAX_USERIP'} eq '')) { print FILE "\nacl concurrent max_user_ip -s $proxysettings{'AUTH_MAX_USERIP'}\n"; }
3266 print FILE "\n";
3267
488d1b7c
CS
3268 if (!-z $acl_dst_noauth_net) { print FILE "acl to_ipaddr_without_auth dst \"$acl_dst_noauth_net\"\n"; }
3269 if (!-z $acl_dst_noauth_dom) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth_dom\"\n"; }
3270 if (!-z $acl_dst_noauth_url) { print FILE "acl to_hosts_without_auth url_regex -i \"$acl_dst_noauth_url\"\n"; }
363fb6af 3271 print FILE "\n";
488d1b7c 3272
ed38f89d
MT
3273 }
3274
3275 if ($proxysettings{'AUTH_METHOD'} eq 'ident')
3276 {
3277 if ($proxysettings{'IDENT_REQUIRED'} eq 'on')
3278 {
3279 print FILE "acl for_inetusers ident REQUIRED\n";
3280 }
3281 if ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on')
3282 {
3283 if ((!-z "$identdir/identauth.allowusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'positive'))
3284 {
3285 print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.allowusers\"\n\n";
3286 }
3287 if ((!-z "$identdir/identauth.denyusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'negative'))
3288 {
3289 print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.denyusers\"\n\n";
3290 }
3291 }
488d1b7c
CS
3292 if (!-z $acl_dst_noauth_net) { print FILE "acl to_ipaddr_without_auth dst \"$acl_dst_noauth_net\"\n"; }
3293 if (!-z $acl_dst_noauth_dom) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth_dom\"\n"; }
3294 if (!-z $acl_dst_noauth_url) { print FILE "acl to_hosts_without_auth url_regex -i \"$acl_dst_noauth_url\"\n"; }
363fb6af 3295 print FILE "\n";
ed38f89d
MT
3296 }
3297
3298 if (($delaypools) && (!-z $acl_dst_throttle)) { print FILE "acl for_throttled_urls url_regex -i \"$acl_dst_throttle\"\n\n"; }
3299
3300 if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE "acl with_allowed_useragents browser $browser_regexp\n\n"; }
3301
28c9dec6 3302 print FILE "acl within_timeframe time ";
ed38f89d
MT
3303 if ($proxysettings{'TIME_MON'} eq 'on') { print FILE "M"; }
3304 if ($proxysettings{'TIME_TUE'} eq 'on') { print FILE "T"; }
3305 if ($proxysettings{'TIME_WED'} eq 'on') { print FILE "W"; }
3306 if ($proxysettings{'TIME_THU'} eq 'on') { print FILE "H"; }
3307 if ($proxysettings{'TIME_FRI'} eq 'on') { print FILE "F"; }
3308 if ($proxysettings{'TIME_SAT'} eq 'on') { print FILE "A"; }
3309 if ($proxysettings{'TIME_SUN'} eq 'on') { print FILE "S"; }
363fb6af
MT
3310 print FILE " $proxysettings{'TIME_FROM_HOUR'}:";
3311 print FILE "$proxysettings{'TIME_FROM_MINUTE'}-";
3312 print FILE "$proxysettings{'TIME_TO_HOUR'}:";
3313 print FILE "$proxysettings{'TIME_TO_MINUTE'}\n\n";
ed38f89d
MT
3314
3315 if ((!-z $mimetypes) && ($proxysettings{'ENABLE_MIME_FILTER'} eq 'on')) {
3316 print FILE "acl blocked_mimetypes rep_mime_type \"$mimetypes\"\n\n";
3317 }
3318
3319 print FILE <<END
f09a0af5
AF
3320#acl all src all
3321acl localhost src 127.0.0.1/32
363fb6af
MT
3322END
3323;
3324open (PORTS,"$acl_ports_ssl");
3325@temp = <PORTS>;
3326close PORTS;
3327if (@temp)
3328{
3329 foreach (@temp) { print FILE "acl SSL_ports port $_"; }
3330}
3331open (PORTS,"$acl_ports_safe");
3332@temp = <PORTS>;
3333close PORTS;
3334if (@temp)
3335{
3336 foreach (@temp) { print FILE "acl Safe_ports port $_"; }
3337}
3338 print FILE <<END
3339
488d1b7c
CS
3340acl IPFire_http port $http_port
3341acl IPFire_https port $https_port
3342acl IPFire_ips dst $netsettings{'GREEN_ADDRESS'}
3343acl IPFire_networks src "$acl_src_subnets"
3344acl IPFire_servers dst "$acl_src_subnets"