]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
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. #
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. #
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/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl' ;
29 require "${General::swroot}/lang.pl" ;
30 require "${General::swroot}/header.pl" ;
32 my @squidversion = `/usr/sbin/squid -v` ;
37 my %mainsettings = ();
38 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
39 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
43 my %filtersettings =();
44 my %xlratorsettings =();
45 my %stdproxysettings =();
51 my @throttle_limits =( 64 , 128 , 256 , 384 , 512 , 1024 , 2048 , 3072 , 5120 );
52 my $throttle_binary = "bin|cab|exe|gz|rar|sea|tar|tgz|zip" ;
53 my $throttle_dskimg = "b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi" ;
54 my $throttle_mmedia = "aiff?|asf|avi|divx|mov|mp3|mpe?g|qt|ra?m" ;
56 my $def_ports_safe = "80 # http \n 21 # ftp \n 443 # https \n 563 # snews \n 70 # gopher \n 210 # wais \n 1025-65535 # unregistered ports \n 280 # http-mgmt \n 488 # gss-http \n 591 # filemaker \n 777 # multiling http \n 800 # Squids port (for icons) \n " ;
57 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
62 my $hintcolour = '#FFFFCC' ;
63 my $ncsa_buttontext = '' ;
78 my $replybodymaxsize = 0 ;
79 my $browser_regexp = '' ;
83 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
84 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
85 my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm" ;
86 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
87 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
88 my $credir = "${General::swroot}/proxy/advanced/cre" ;
90 my $userdb = " $ncsadir /passwd" ;
91 my $stdgrp = " $ncsadir /standard.grp" ;
92 my $extgrp = " $ncsadir /extended.grp" ;
93 my $disgrp = " $ncsadir /disabled.grp" ;
95 my $browserdb = "${General::swroot}/proxy/advanced/useragents" ;
96 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
97 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
99 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
100 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
101 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
103 my $identhosts = " $identdir /hosts" ;
105 my $authdir = "/usr/lib/squid/" ;
106 my $errordir = "/usr/lib/squid/errors" ;
108 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
109 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
110 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
111 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
112 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
113 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
114 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
115 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
116 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
117 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
118 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
119 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
120 my $acl_include = " $acldir /include.acl" ;
122 my $updaccelversion = 'n/a' ;
123 my $urlfilterversion = 'n/a' ;
125 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
126 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
127 unless (- d
" $ntlmdir " ) { mkdir ( " $ntlmdir " ); }
128 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
129 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
130 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
132 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
133 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
135 unless (- e
$userdb ) { system ( "touch $userdb " ); }
136 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
137 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
138 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
140 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
141 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
142 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
143 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
144 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
145 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
146 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
147 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
148 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
149 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
150 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
151 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
152 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
154 unless (- e
$browserdb ) { system ( "touch $browserdb " ); }
155 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
157 open FILE
, $browserdb ;
158 @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
>;
161 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
162 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
164 $filtersettings { 'CHILDREN' } = '5' ;
165 if (- e
"${General::swroot}/urlfilter/settings" ) {
166 & General
:: readhash
( "${General::swroot}/urlfilter/settings" , \
%filtersettings );
169 $xlratorsettings { 'CHILDREN' } = '5' ;
170 if (- e
"${General::swroot}/updatexlrator/settings" ) {
171 & General
:: readhash
( "${General::swroot}/updatexlrator/settings" , \
%xlratorsettings );
174 & Header
:: showhttpheaders
();
176 $proxysettings { 'ACTION' } = '' ;
177 $proxysettings { 'VALID' } = '' ;
179 $proxysettings { 'ENABLE' } = 'off' ;
180 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
181 $proxysettings { 'TRANSPARENT' } = 'off' ;
182 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
183 $proxysettings { 'PROXY_PORT' } = '800' ;
184 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
185 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
186 $proxysettings { 'ERR_LANGUAGE' } = 'German' ;
187 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
188 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
189 $proxysettings { 'FORWARD_VIA' } = 'off' ;
190 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
191 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
192 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
193 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
194 $proxysettings { 'UPSTREAM_USER' } = '' ;
195 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
196 $proxysettings { 'LOGGING' } = 'off' ;
197 $proxysettings { 'LOGQUERY' } = 'off' ;
198 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
199 $proxysettings { 'CACHE_MEM' } = '2' ;
200 $proxysettings { 'CACHE_SIZE' } = '50' ;
201 $proxysettings { 'MAX_SIZE' } = '4096' ;
202 $proxysettings { 'MIN_SIZE' } = '0' ;
203 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
204 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
205 $proxysettings { 'L1_DIRS' } = '16' ;
206 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
207 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
208 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
209 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
210 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
211 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
212 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
213 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
214 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
215 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
216 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
217 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
218 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
219 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
220 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
221 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
222 $proxysettings { 'THROTTLE_BINARY' } = 'off' ;
223 $proxysettings { 'THROTTLE_DSKIMG' } = 'off' ;
224 $proxysettings { 'THROTTLE_MMEDIA' } = 'off' ;
225 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
226 $proxysettings { 'ENABLE_BROWSER_CHECK' } = 'off' ;
227 $proxysettings { 'FAKE_USERAGENT' } = '' ;
228 $proxysettings { 'FAKE_REFERER' } = '' ;
229 $proxysettings { 'AUTH_METHOD' } = 'none' ;
230 $proxysettings { 'AUTH_REALM' } = '' ;
231 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
232 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
233 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
234 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
235 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
236 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
237 $proxysettings { 'NCSA_USERNAME' } = '' ;
238 $proxysettings { 'NCSA_GROUP' } = '' ;
239 $proxysettings { 'NCSA_PASS' } = '' ;
240 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
241 $proxysettings { 'LDAP_BASEDN' } = '' ;
242 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
243 $proxysettings { 'LDAP_SERVER' } = '' ;
244 $proxysettings { 'LDAP_PORT' } = '389' ;
245 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
246 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
247 $proxysettings { 'LDAP_GROUP' } = '' ;
248 $proxysettings { 'NTLM_DOMAIN' } = '' ;
249 $proxysettings { 'NTLM_PDC' } = '' ;
250 $proxysettings { 'NTLM_BDC' } = '' ;
251 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
252 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
253 $proxysettings { 'RADIUS_SERVER' } = '' ;
254 $proxysettings { 'RADIUS_PORT' } = '1812' ;
255 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
256 $proxysettings { 'RADIUS_SECRET' } = '' ;
257 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
258 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
259 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
260 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
261 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
262 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
263 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
264 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
265 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
267 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
269 & Header
:: getcgihash
( \
%proxysettings );
271 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
272 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
273 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
274 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
276 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
278 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
281 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
283 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
284 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
285 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
287 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
288 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
290 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
291 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
293 if (! $errormessage ) {
294 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
295 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
297 $proxysettings { 'NCSA_USERNAME' } = '' ;
298 $proxysettings { 'NCSA_GROUP' } = '' ;
299 $proxysettings { 'NCSA_PASS' } = '' ;
300 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
303 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
305 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
306 & deluser
( $proxysettings { 'ID' });
309 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
310 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
311 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
313 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
315 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
316 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
317 @temp = split ( /:/ , $proxysettings { 'ID' });
318 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
319 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
320 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
321 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
324 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }))
326 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
327 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
328 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
329 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
330 $errormessage = $Lang :: tr
{ 'invalid input' };
333 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
335 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
338 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
339 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
341 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
344 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ) ||
345 ( $proxysettings { 'CACHE_MEM' } < 1 ))
347 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
350 my @free = `/usr/bin/free` ;
351 $free [ 1 ] =~ m/(\d+)/ ;
352 $cachemem = int $1 / 2048 ;
353 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
354 $proxysettings { 'CACHE_MEM' } = $cachemem ;
356 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
358 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
361 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
363 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
366 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
368 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
371 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
373 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
376 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
378 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
381 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' )
383 $browser_regexp = '' ;
384 foreach ( @useragentlist )
387 @useragent = split ( /,/ );
388 if ( $proxysettings { 'UA_' . $useragent [ 0 ]} eq 'on' ) { $browser_regexp .= " $useragent [2]|" ; }
390 chop ( $browser_regexp );
391 if (! $browser_regexp )
393 $errormessage = $Lang :: tr
{ 'advproxy errmsg no browser' };
397 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
399 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
400 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
401 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
403 if ( $netsettings { 'BLUE_DEV' })
405 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
406 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
408 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
412 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
414 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
419 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
420 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
422 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
425 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
427 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
430 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
432 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
435 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
437 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
440 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
442 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
446 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
448 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
450 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
454 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
456 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
458 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
462 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
464 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
466 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
469 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
471 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
474 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
476 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
479 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
481 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
483 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
488 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
490 if ( $proxysettings { 'NTLM_DOMAIN' } eq '' )
492 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm domain' };
495 if ( $proxysettings { 'NTLM_PDC' } eq '' )
497 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm pdc' };
500 if (!& General
:: validhostname
( $proxysettings { 'NTLM_PDC' }))
502 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid pdc' };
505 if ((!( $proxysettings { 'NTLM_BDC' } eq '' )) && (!& General
:: validhostname
( $proxysettings { 'NTLM_BDC' })))
507 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid bdc' };
511 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
513 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
515 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
518 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
520 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
523 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
525 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
530 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
533 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
534 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
535 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
536 if (( $proxy1 ne $proxy2 ))
538 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
546 $proxysettings { 'VALID' } = 'no' ; }
548 $proxysettings { 'VALID' } = 'yes' ; }
550 if ( $proxysettings { 'VALID' } eq 'yes' )
554 delete $proxysettings { 'SRC_SUBNETS' };
555 delete $proxysettings { 'SRC_BANNED_IP' };
556 delete $proxysettings { 'SRC_BANNED_MAC' };
557 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
558 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
559 delete $proxysettings { 'DST_NOCACHE' };
560 delete $proxysettings { 'DST_NOAUTH' };
561 delete $proxysettings { 'PORTS_SAFE' };
562 delete $proxysettings { 'PORTS_SSL' };
563 delete $proxysettings { 'MIME_TYPES' };
564 delete $proxysettings { 'NTLM_ALLOW_USERS' };
565 delete $proxysettings { 'NTLM_DENY_USERS' };
566 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
567 delete $proxysettings { 'RADIUS_DENY_USERS' };
568 delete $proxysettings { 'IDENT_HOSTS' };
569 delete $proxysettings { 'IDENT_ALLOW_USERS' };
570 delete $proxysettings { 'IDENT_DENY_USERS' };
572 delete $proxysettings { 'CRE_GROUPS' };
573 delete $proxysettings { 'CRE_SVHOSTS' };
575 delete $proxysettings { 'NCSA_USERNAME' };
576 delete $proxysettings { 'NCSA_GROUP' };
577 delete $proxysettings { 'NCSA_PASS' };
578 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
580 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
581 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
582 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
583 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
584 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
585 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
586 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
588 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
589 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
591 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
593 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
594 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
595 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
596 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
597 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
598 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
603 system ( '/usr/local/bin/squidctrl' , 'disable' );
604 unlink "${General::swroot}/proxy/enable" ;
605 unlink "${General::swroot}/proxy/transparent" ;
606 unlink "${General::swroot}/proxy/enable_blue" ;
607 unlink "${General::swroot}/proxy/transparent_blue" ;
609 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
610 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
611 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
612 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
613 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
614 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
615 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
616 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
617 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
618 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
620 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
624 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
626 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
631 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
632 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
633 } elsif (- e
"${General::swroot}/proxy/settings" ) {
634 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
639 $checked { 'ENABLE' }{ 'off' } = '' ;
640 $checked { 'ENABLE' }{ 'on' } = '' ;
641 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
643 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
644 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
645 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
647 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
648 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
649 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
651 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
652 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
653 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
655 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
656 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
657 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
659 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
660 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
661 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
662 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
663 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
664 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
665 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
666 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
667 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
668 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
669 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
670 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
672 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
673 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
674 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
675 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
676 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
677 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
679 $checked { 'LOGGING' }{ 'off' } = '' ;
680 $checked { 'LOGGING' }{ 'on' } = '' ;
681 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
682 $checked { 'LOGQUERY' }{ 'off' } = '' ;
683 $checked { 'LOGQUERY' }{ 'on' } = '' ;
684 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
685 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
686 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
687 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
689 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
690 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
692 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
693 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
694 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
695 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
696 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
697 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
699 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
700 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
701 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
703 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
704 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
705 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
706 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
707 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
709 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
710 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
711 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
712 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
713 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
714 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
715 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
717 $checked { 'TIME_MON' }{ 'off' } = '' ;
718 $checked { 'TIME_MON' }{ 'on' } = '' ;
719 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
720 $checked { 'TIME_TUE' }{ 'off' } = '' ;
721 $checked { 'TIME_TUE' }{ 'on' } = '' ;
722 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
723 $checked { 'TIME_WED' }{ 'off' } = '' ;
724 $checked { 'TIME_WED' }{ 'on' } = '' ;
725 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
726 $checked { 'TIME_THU' }{ 'off' } = '' ;
727 $checked { 'TIME_THU' }{ 'on' } = '' ;
728 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
729 $checked { 'TIME_FRI' }{ 'off' } = '' ;
730 $checked { 'TIME_FRI' }{ 'on' } = '' ;
731 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
732 $checked { 'TIME_SAT' }{ 'off' } = '' ;
733 $checked { 'TIME_SAT' }{ 'on' } = '' ;
734 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
735 $checked { 'TIME_SUN' }{ 'off' } = '' ;
736 $checked { 'TIME_SUN' }{ 'on' } = '' ;
737 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
739 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
740 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
741 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
742 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
744 $checked { 'THROTTLE_BINARY' }{ 'off' } = '' ;
745 $checked { 'THROTTLE_BINARY' }{ 'on' } = '' ;
746 $checked { 'THROTTLE_BINARY' }{ $proxysettings { 'THROTTLE_BINARY' }} = "checked='checked'" ;
747 $checked { 'THROTTLE_DSKIMG' }{ 'off' } = '' ;
748 $checked { 'THROTTLE_DSKIMG' }{ 'on' } = '' ;
749 $checked { 'THROTTLE_DSKIMG' }{ $proxysettings { 'THROTTLE_DSKIMG' }} = "checked='checked'" ;
750 $checked { 'THROTTLE_MMEDIA' }{ 'off' } = '' ;
751 $checked { 'THROTTLE_MMEDIA' }{ 'on' } = '' ;
752 $checked { 'THROTTLE_MMEDIA' }{ $proxysettings { 'THROTTLE_MMEDIA' }} = "checked='checked'" ;
754 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
755 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
756 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
758 $checked { 'ENABLE_BROWSER_CHECK' }{ 'off' } = '' ;
759 $checked { 'ENABLE_BROWSER_CHECK' }{ 'on' } = '' ;
760 $checked { 'ENABLE_BROWSER_CHECK' }{ $proxysettings { 'ENABLE_BROWSER_CHECK' }} = "checked='checked'" ;
762 foreach ( @useragentlist ) {
763 @useragent = split ( /,/ );
764 $checked { 'UA_' . $useragent [ 0 ]}{ 'off' } = '' ;
765 $checked { 'UA_' . $useragent [ 0 ]}{ 'on' } = '' ;
766 $checked { 'UA_' . $useragent [ 0 ]}{ $proxysettings { 'UA_' . $useragent [ 0 ]}} = "checked='checked'" ;
769 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
770 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
771 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
772 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
773 $checked { 'AUTH_METHOD' }{ 'ntlm' } = '' ;
774 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
775 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
777 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
779 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
780 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
781 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
783 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
784 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
785 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
787 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
789 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
791 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
793 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
794 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
795 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
797 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
798 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
799 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
801 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
802 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
803 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
805 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
806 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
807 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
809 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
810 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
811 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
813 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
814 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
815 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
817 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
818 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
819 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
821 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
822 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
823 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
825 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
826 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
827 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
829 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
830 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
831 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
833 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
834 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
835 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
837 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
839 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
842 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
843 print "<font class='base'> $errormessage </font> \n " ;
847 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
849 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
850 $squidversion [ 0 ] =~ s/^\s+//g ;
851 $squidversion [ 0 ] =~ s/\s+$//g ;
853 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
856 # ===================================================================
858 # ===================================================================
860 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
862 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
864 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
869 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
872 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
873 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
874 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}:</td>
875 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
878 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
879 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
880 <td class='base'> $Lang ::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
881 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
886 if ( $netsettings { 'BLUE_DEV' }) {
887 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
888 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
890 print "<td colspan='2'> </td>" ;
893 <td class='base'> $Lang ::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td>
894 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
899 if ( $netsettings { 'BLUE_DEV' }) {
900 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
901 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
903 print "<td colspan='2'> </td>" ;
906 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
908 <select name='ERR_LANGUAGE'>
911 foreach (< $errordir /*>) {
913 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
914 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
922 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
923 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
924 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
925 <td class='base'><select name='ERR_DESIGN'>
926 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
927 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
931 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
932 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
941 if ( - e
"/usr/bin/squidclamav" ) {
942 print "<td class='base' width='33%'><b> $Lang ::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>" ;
943 print "<td class='base' width='33%'><b> $Lang ::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td>" ;
944 print "<td class='base' width='33%'><b> $Lang ::tr{'advproxy squidclamav'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_CLAMAV' $checked{'ENABLE_CLAMAV'}{'on'} /></td>" ;
948 print "<td class='base' width='50%'><b> $Lang ::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>" ;
949 print "<td class='base' width='50%'><b> $Lang ::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td>" ;
957 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
960 <td class='base'> $Lang ::tr{'advproxy via forwarding'}:</td><td><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td>
961 <td class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
964 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td><td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td>
965 <td class='base'> $Lang ::tr{'advproxy upstream username'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
968 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td><td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} />
969 <td class='base'> $Lang ::tr{'advproxy upstream password'}:<img src='/blob.gif' alt='*' /></td><td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
972 <td class='base' colspan='4'> $Lang ::tr{'advproxy no connection auth'}:<input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td>
978 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
981 <td class='base'> $Lang ::tr{'advproxy log enabled'}:<input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
982 <td class='base'> $Lang ::tr{'advproxy log query'}:<input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td>
983 <td class='base'> $Lang ::tr{'advproxy log useragent'}:<input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td>
989 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
992 <td width='35%'></td><td width='15%'></td><td width='35%'></td><td width='15%'></td>
995 <td class='base'> $Lang ::tr{'advproxy ram cache size'}:</td>
996 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
997 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}:</td>
998 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1001 <td class='base'> $Lang ::tr{'advproxy min size'}:</td>
1002 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1003 <td class='base'> $Lang ::tr{'advproxy max size'}:</td>
1004 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1007 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1008 <td class='base'><select name='L1_DIRS'>
1009 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1010 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1011 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1012 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1013 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1015 <td colspan='2' rowspan= '5' valign='top' class='base'>
1016 <table cellspacing='0' cellpadding='0'>
1018 <!-- intentionally left empty -->
1021 <td> $Lang ::tr{'advproxy no cache sites'}: <img src='/blob.gif' alt='*' /></td>
1024 <!-- intentionally left empty -->
1027 <!-- intentionally left empty -->
1030 <td align=center><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1034 print $proxysettings { 'DST_NOCACHE' };
1043 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1044 <td class='base'><select name='MEM_POLICY'>
1045 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1046 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1047 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1048 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1052 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1053 <td class='base'><select name='CACHE_POLICY'>
1054 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1055 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1056 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1057 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1061 <td colspan='2'> </td>
1064 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1065 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1069 <table width='100%'>
1071 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1074 <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
1077 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}:</td>
1078 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}:</td>
1081 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1084 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1088 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1091 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1098 <table width='100%'>
1100 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1103 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1106 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}:</td>
1109 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1113 if (! $proxysettings { 'SRC_SUBNETS' })
1115 print " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'} \n " ;
1116 if ( $netsettings { 'BLUE_DEV' })
1118 print " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'} \n " ;
1120 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1127 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1128 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1129 print "<td class='base'> $line :</td> \n " ;
1131 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1135 if ( $netsettings { 'BLUE_DEV' }) {
1136 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1137 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1139 print "<td class='base'> $line :</td> \n " ;
1141 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1148 <td colspan='2'> </td>
1151 <td colspan='2'> </td>
1154 <table width='100%'>
1156 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1159 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}: <img src='/blob.gif' alt='*' /></td>
1160 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td>
1163 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1167 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1171 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1175 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1181 <table width='100%'>
1183 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1186 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}: <img src='/blob.gif' alt='*' /></td>
1187 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td>
1190 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1194 print $proxysettings { 'SRC_BANNED_IP' };
1198 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1202 print $proxysettings { 'SRC_BANNED_MAC' };
1213 # -------------------------------------------------------------------
1214 # CRE GUI - optional
1215 # -------------------------------------------------------------------
1217 if (- e
$cre_enabled ) { print <<END
1218 <table width='100%'>
1221 <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>
1224 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1230 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1232 <td class='base'> $Lang ::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td>
1233 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1236 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1237 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td>
1242 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1245 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1249 print $proxysettings { 'CRE_GROUPS' };
1253 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1256 print $proxysettings { 'CRE_SVHOSTS' };
1264 print "</table><hr size='1'>" ;
1268 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1269 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1270 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1275 # -------------------------------------------------------------------
1279 <table width='100%'>
1281 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1283 <table width='100%'>
1285 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1286 <td width='1%'> </td>
1287 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1288 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1289 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1290 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1291 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1292 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1293 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1294 <td width='1%'> </td>
1295 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1296 <td width='1%'> </td>
1297 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1302 <select name='TIME_ACCESS_MODE'>
1303 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1304 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1308 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1309 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1310 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1311 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1312 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1313 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1314 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1317 <select name='TIME_FROM_HOUR'>
1320 for ( $i = 0 ; $i <= 24 ; $i ++) {
1321 $_ = sprintf ( " %02s " , $i );
1322 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1329 <select name='TIME_FROM_MINUTE'>
1332 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1333 $_ = sprintf ( " %02s " , $i );
1334 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1341 <select name='TIME_TO_HOUR'>
1344 for ( $i = 0 ; $i <= 24 ; $i ++) {
1345 $_ = sprintf ( " %02s " , $i );
1346 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1353 <select name='TIME_TO_MINUTE'>
1356 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1357 $_ = sprintf ( " %02s " , $i );
1358 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1366 <table width='100%'>
1368 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1371 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}:</td>
1372 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1373 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}:</td>
1374 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1378 <table width='100%'>
1380 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1383 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1384 <td width='20%' class='base'>
1385 <select name='THROTTLING_GREEN_TOTAL'>
1389 foreach ( @throttle_limits ) {
1390 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1394 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1397 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1398 <td width='30%' class='base'>
1399 <select name='THROTTLING_GREEN_HOST'>
1403 foreach ( @throttle_limits ) {
1404 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1408 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1415 if ( $netsettings { 'BLUE_DEV' }) {
1418 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1420 <select name='THROTTLING_BLUE_TOTAL'>
1424 foreach ( @throttle_limits ) {
1425 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1429 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1432 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1434 <select name='THROTTLING_BLUE_HOST'>
1438 foreach ( @throttle_limits ) {
1439 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1443 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1453 <table width='100%'>
1455 <td colspan='4'><i> $Lang ::tr{'advproxy content based throttling'}:</i></td>
1458 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle binary'}:</td>
1459 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked {'THROTTLE_BINARY'}{'on'} /></td>
1460 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle dskimg'}:</td>
1461 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked {'THROTTLE_DSKIMG'}{'on'} /></td>
1462 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle mmedia'}:</td>
1463 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked {'THROTTLE_MMEDIA'}{'on'} /></td>
1464 <td width='15%'> </td>
1465 <td width='10%'> </td>
1469 <table width='100%'>
1471 <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>
1475 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1478 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td>
1483 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1487 print $proxysettings { 'MIME_TYPES' };
1501 <table width='100%'>
1503 <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>
1507 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ){
1513 if ( @useragentlist ) { print " $Lang ::tr{'advproxy allowed web browsers'}:" ; } else { print " $Lang ::tr{'advproxy no clients defined'}" ; }
1518 <table width='100%'>
1522 for ( $n = 0 ; $n <= @useragentlist ; $n = $n + $i ) {
1523 for ( $i = 0 ; $i <= 3 ; $i ++) {
1524 if ( $i eq 0 ) { print "<tr> \n " ; }
1525 if (( $n + $i ) < @useragentlist ) {
1526 @useragent = split ( /,/ , @useragentlist [ $n + $i ]);
1527 print "<td width='15%'> $useragent [1]:<\/td> \n " ;
1528 print "<td width='10%'><input type='checkbox' name='UA_ $useragent [0]' $checked {'UA_'. $useragent [0]}{'on'} /></td> \n " ;
1530 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1537 <table width='100%'>
1539 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1542 <td class='base'> $Lang ::tr{'advproxy fake useragent'}: <img src='/blob.gif' alt='*' /></td>
1543 <td class='base'> $Lang ::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td>
1546 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='56' /></td>
1547 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='56' /></td>
1555 <table width='100%'>
1557 <td colspan='5'><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1560 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked {'AUTH_METHOD'}{'none'} /> $Lang ::tr{'advproxy AUTH method none'}</td>
1561 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked {'AUTH_METHOD'}{'ncsa'} /> $Lang ::tr{'advproxy AUTH method ncsa'}</td>
1562 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked {'AUTH_METHOD'}{'ident'} /> $Lang ::tr{'advproxy AUTH method ident'}</td>
1563 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked {'AUTH_METHOD'}{'ldap'} /> $Lang ::tr{'advproxy AUTH method ldap'}</td>
1564 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked {'AUTH_METHOD'}{'ntlm'} /> $Lang ::tr{'advproxy AUTH method ntlm'}</td>
1565 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked {'AUTH_METHOD'}{'radius'} /> $Lang ::tr{'advproxy AUTH method radius'}</td>
1571 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1573 <table width='100%'>
1575 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1578 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1581 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1582 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1583 <td colspan='2' rowspan= '6' valign='top' class='base'>
1584 <table cellpadding='0' cellspacing='0'>
1586 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}: <img src='/blob.gif' alt='*' /></td>
1589 <!-- intentionally left empty -->
1592 <!-- intentionally left empty -->
1595 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1598 <!-- intentionally left empty -->
1601 <!-- intentionally left empty -->
1604 <td> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1607 <!-- intentionally left empty -->
1610 <!-- intentionally left empty -->
1613 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1617 print $proxysettings { 'DST_NOAUTH' };
1626 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1627 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1630 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}: <img src='/blob.gif' alt='*' /></td>
1631 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1634 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1635 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1638 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1639 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1642 <td colspan='2'> </td>
1649 # ===================================================================
1650 # NCSA auth settings
1651 # ===================================================================
1653 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1656 <table width='100%'>
1658 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1661 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1662 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1663 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1664 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1667 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1675 # ===================================================================
1676 # IDENTD auth settings
1677 # ===================================================================
1679 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1682 <table width='100%'>
1684 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1687 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1688 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1689 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1690 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1693 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1694 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1699 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1700 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1703 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1706 if (! $proxysettings { 'IDENT_HOSTS' }) {
1707 print " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'} \n " ;
1708 if ( $netsettings { 'BLUE_DEV' }) {
1709 print " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'} \n " ;
1712 print $proxysettings { 'IDENT_HOSTS' };
1717 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1721 print $proxysettings { 'DST_NOAUTH' };
1728 <table width='100%'>
1730 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1733 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1734 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1735 <td width='25%'> </td>
1736 <td width='30%'> </td>
1739 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1740 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1741 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1742 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1745 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1746 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1749 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1753 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1755 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1757 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1761 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1763 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1770 # ===================================================================
1771 # NTLM auth settings
1772 # ===================================================================
1774 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) {
1777 <table width='100%'>
1779 <td colspan='6'><b> $Lang ::tr{'advproxy NTLM domain settings'}</b></td>
1782 <td class='base'> $Lang ::tr{'advproxy NTLM domain'}:</td>
1783 <td><input type='text' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}' size='15' /></td>
1784 <td class='base'> $Lang ::tr{'advproxy NTLM PDC hostname'}:</td>
1785 <td><input type='text' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}' size='14' /></td>
1786 <td class='base'> $Lang ::tr{'advproxy NTLM BDC hostname'}: <img src='/blob.gif' alt='*' /></td>
1787 <td><input type='text' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}' size='14' /></td>
1791 <table width='100%'>
1793 <td colspan='3'><b> $Lang ::tr{'advproxy NTLM auth mode'}</b></td>
1796 <td width='25%' class='base' width='25%'> $Lang ::tr{'advproxy NTLM use integrated auth'}:</td>
1797 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked {'NTLM_ENABLE_INT_AUTH'}{'on'} /></td>
1802 <table width='100%'>
1804 <td colspan='4'><b> $Lang ::tr{'advproxy NTLM user based access restrictions'}</b></td>
1807 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1808 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked {'NTLM_ENABLE_ACL'}{'on'} /></td>
1809 <td width='25%'> </td>
1810 <td width='30%'> </td>
1813 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked {'NTLM_USER_ACL'}{'positive'} />
1814 $Lang ::tr{'advproxy NTLM use positive access list'}:</td>
1815 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked {'NTLM_USER_ACL'}{'negative'} />
1816 $Lang ::tr{'advproxy NTLM use negative access list'}:</td>
1819 <td colspan='2'> $Lang ::tr{'advproxy NTLM authorized users'}</td>
1820 <td colspan='2'> $Lang ::tr{'advproxy NTLM unauthorized users'}</td>
1823 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1827 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_ALLOW_USERS' }; }
1829 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1831 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
1835 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_DENY_USERS' }; }
1837 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1844 # ===================================================================
1845 # LDAP auth settings
1846 # ===================================================================
1848 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1851 <table width='100%'>
1853 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1856 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1857 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1858 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1859 <td class='base'><select name='LDAP_TYPE'>
1860 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1861 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1862 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1863 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1867 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1868 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1869 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1870 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1874 <table width='100%'>
1876 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1879 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1880 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1881 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1882 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1886 <table width='100%'>
1888 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1891 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}: <img src='/blob.gif' alt='*' /></td>
1892 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1900 # ===================================================================
1901 # RADIUS auth settings
1902 # ===================================================================
1904 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
1907 <table width='100%'>
1909 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
1912 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
1913 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
1914 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
1915 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
1918 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}: <img src='/blob.gif' alt='*' /></td>
1919 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
1920 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
1921 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
1925 <table width='100%'>
1927 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
1930 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1931 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
1932 <td width='25%'> </td>
1933 <td width='30%'> </td>
1936 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
1937 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
1938 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
1939 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
1942 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
1943 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
1946 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1950 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
1952 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
1954 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
1958 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
1960 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
1967 # ===================================================================
1973 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
1975 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
1976 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1977 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1978 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1979 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
1980 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
1981 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
1985 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1987 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
1988 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1989 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1990 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1991 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
1995 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
1997 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
1998 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2002 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2004 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2005 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2006 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2007 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2008 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2009 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2010 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2014 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2016 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2017 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2018 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2019 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2020 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2021 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2022 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2026 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )) {
2028 <td><input type='hidden' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}'></td>
2029 <td><input type='hidden' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}'></td>
2030 <td><input type='hidden' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}'></td>
2031 <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value=' $proxysettings {'NTLM_ENABLE_INT_AUTH'}'></td>
2032 <td><input type='hidden' name='NTLM_ENABLE_ACL' value=' $proxysettings {'NTLM_ENABLE_ACL'}'></td>
2033 <td><input type='hidden' name='NTLM_USER_ACL' value=' $proxysettings {'NTLM_USER_ACL'}'></td>
2034 <td><input type='hidden' name='NTLM_ALLOW_USERS' value=' $proxysettings {'NTLM_ALLOW_USERS'}'></td>
2035 <td><input type='hidden' name='NTLM_DENY_USERS' value=' $proxysettings {'NTLM_DENY_USERS'}'></td>
2039 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2041 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2042 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2043 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2044 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2045 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2046 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2047 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2048 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2060 <table width='100%'>
2063 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2064 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2065 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2071 <table width='100%'>
2073 <td><img src='/blob.gif' align='top' alt='*' />
2074 <font class='base'> $Lang ::tr{'this field may be blank'}</font>
2076 <td align='right'> </td>
2083 & Header
:: closebox
();
2087 # ===================================================================
2088 # NCSA user management
2089 # ===================================================================
2091 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2093 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2094 <table width='100%'>
2096 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2099 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2100 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2103 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly " ; }
2106 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2108 <select name='NCSA_GROUP'>
2109 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2110 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2111 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2117 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2118 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2119 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2120 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2127 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2128 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2129 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2132 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2133 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2139 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2144 <table width='100%'>
2146 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2149 <table width='100%' align='center'>
2155 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2156 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2160 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2161 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2165 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2166 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2169 @userlist = sort ( @userlist );
2171 # If the password file contains entries, print entries and action icons
2173 if ( $userdb ne "" ) {
2176 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2177 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2178 <td class='boldbase' colspan='2' align='center'> </td>
2183 foreach $line ( @userlist )
2187 @temp = split ( /:/ , $line );
2188 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2189 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2191 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2193 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2196 <td align='center'> $temp [0]</td>
2200 if ( $temp [ 1 ] eq 'standard' ) {
2201 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2202 } elsif ( $temp [ 1 ] eq 'extended' ) {
2203 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2204 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2205 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2208 <td width='8%' align='center'>
2209 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2210 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2211 <input type='hidden' name='ID' value=' $line ' />
2212 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2216 <td width='8%' align='center'>
2217 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2218 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2219 <input type='hidden' name='ID' value=' $temp [0]' />
2220 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2233 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2234 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2235 <td class='base'> $Lang ::tr{'edit'}</td>
2236 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2237 <td class='base'> $Lang ::tr{'remove'}</td>
2244 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2255 & Header
:: closebox
();
2259 # ===================================================================
2261 & Header
:: closebigbox
();
2263 & Header
:: closepage
();
2265 # -------------------------------------------------------------------
2269 if (- e
" $acl_src_subnets " ) {
2270 open ( FILE
, " $acl_src_subnets " );
2271 delete $proxysettings { 'SRC_SUBNETS' };
2272 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2275 if (- e
" $acl_src_banned_ip " ) {
2276 open ( FILE
, " $acl_src_banned_ip " );
2277 delete $proxysettings { 'SRC_BANNED_IP' };
2278 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2281 if (- e
" $acl_src_banned_mac " ) {
2282 open ( FILE
, " $acl_src_banned_mac " );
2283 delete $proxysettings { 'SRC_BANNED_MAC' };
2284 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2287 if (- e
" $acl_src_unrestricted_ip " ) {
2288 open ( FILE
, " $acl_src_unrestricted_ip " );
2289 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2290 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2293 if (- e
" $acl_src_unrestricted_mac " ) {
2294 open ( FILE
, " $acl_src_unrestricted_mac " );
2295 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2296 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2299 if (- e
" $acl_dst_nocache " ) {
2300 open ( FILE
, " $acl_dst_nocache " );
2301 delete $proxysettings { 'DST_NOCACHE' };
2302 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2305 if (- e
" $acl_dst_noauth " ) {
2306 open ( FILE
, " $acl_dst_noauth " );
2307 delete $proxysettings { 'DST_NOAUTH' };
2308 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2311 if (- e
" $acl_ports_safe " ) {
2312 open ( FILE
, " $acl_ports_safe " );
2313 delete $proxysettings { 'PORTS_SAFE' };
2314 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2317 if (- e
" $acl_ports_ssl " ) {
2318 open ( FILE
, " $acl_ports_ssl " );
2319 delete $proxysettings { 'PORTS_SSL' };
2320 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2323 if (- e
" $mimetypes " ) {
2324 open ( FILE
, " $mimetypes " );
2325 delete $proxysettings { 'MIME_TYPES' };
2326 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2329 if (- e
" $ntlmdir /msntauth.allowusers" ) {
2330 open ( FILE
, " $ntlmdir /msntauth.allowusers" );
2331 delete $proxysettings { 'NTLM_ALLOW_USERS' };
2332 while (< FILE
>) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ };
2335 if (- e
" $ntlmdir /msntauth.denyusers" ) {
2336 open ( FILE
, " $ntlmdir /msntauth.denyusers" );
2337 delete $proxysettings { 'NTLM_DENY_USERS' };
2338 while (< FILE
>) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ };
2341 if (- e
" $raddir /radauth.allowusers" ) {
2342 open ( FILE
, " $raddir /radauth.allowusers" );
2343 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2344 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2347 if (- e
" $raddir /radauth.denyusers" ) {
2348 open ( FILE
, " $raddir /radauth.denyusers" );
2349 delete $proxysettings { 'RADIUS_DENY_USERS' };
2350 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2353 if (- e
" $identdir /identauth.allowusers" ) {
2354 open ( FILE
, " $identdir /identauth.allowusers" );
2355 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2356 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2359 if (- e
" $identdir /identauth.denyusers" ) {
2360 open ( FILE
, " $identdir /identauth.denyusers" );
2361 delete $proxysettings { 'IDENT_DENY_USERS' };
2362 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2365 if (- e
" $identhosts " ) {
2366 open ( FILE
, " $identhosts " );
2367 delete $proxysettings { 'IDENT_HOSTS' };
2368 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2371 if (- e
" $cre_groups " ) {
2372 open ( FILE
, " $cre_groups " );
2373 delete $proxysettings { 'CRE_GROUPS' };
2374 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2377 if (- e
" $cre_svhosts " ) {
2378 open ( FILE
, " $cre_svhosts " );
2379 delete $proxysettings { 'CRE_SVHOSTS' };
2380 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2385 # -------------------------------------------------------------------
2389 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2390 undef $proxysettings { 'PORTS_SAFE' };
2393 s/^\s+//g ; s/\s+$//g ;
2397 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2399 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2400 @templist = split ( /-/ );
2401 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2402 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2406 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2407 undef $proxysettings { 'PORTS_SSL' };
2410 s/^\s+//g ; s/\s+$//g ;
2415 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2416 @templist = split ( /-/ );
2417 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2418 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2422 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2423 undef $proxysettings { 'DST_NOCACHE' };
2426 s/^\s+//g ; s/\s+$//g ;
2429 unless ( /^\./ ) { $_ = '.' . $_ ; }
2430 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2434 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2435 undef $proxysettings { 'SRC_SUBNETS' };
2438 s/^\s+//g ; s/\s+$//g ;
2441 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2442 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2446 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2447 undef $proxysettings { 'SRC_BANNED_IP' };
2450 s/^\s+//g ; s/\s+$//g ;
2453 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2454 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2458 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2459 undef $proxysettings { 'SRC_BANNED_MAC' };
2462 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2465 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2466 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2470 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2471 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2474 s/^\s+//g ; s/\s+$//g ;
2477 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2478 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2482 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2483 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2486 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2489 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2490 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2494 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2495 undef $proxysettings { 'DST_NOAUTH' };
2498 s/^\s+//g ; s/\s+$//g ;
2501 unless ( /^\./ ) { $_ = '.' . $_ ; }
2502 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2506 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2508 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2509 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2512 s/^\s+//g ; s/\s+$//g ;
2513 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2515 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2518 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2520 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2521 undef $proxysettings { 'NTLM_DENY_USERS' };
2524 s/^\s+//g ; s/\s+$//g ;
2525 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2527 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2530 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2532 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2533 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2536 s/^\s+//g ; s/\s+$//g ;
2537 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2539 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2542 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2544 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2545 undef $proxysettings { 'IDENT_DENY_USERS' };
2548 s/^\s+//g ; s/\s+$//g ;
2549 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2551 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2554 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2556 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2557 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2560 s/^\s+//g ; s/\s+$//g ;
2561 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2563 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2566 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2568 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2569 undef $proxysettings { 'RADIUS_DENY_USERS' };
2572 s/^\s+//g ; s/\s+$//g ;
2573 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2575 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2578 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2579 undef $proxysettings { 'IDENT_HOSTS' };
2582 s/^\s+//g ; s/\s+$//g ;
2585 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2586 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2590 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2591 undef $proxysettings { 'CRE_SVHOSTS' };
2594 s/^\s+//g ; s/\s+$//g ;
2597 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2598 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2603 # -------------------------------------------------------------------
2607 open ( FILE
, "> $acl_src_subnets " );
2609 if (! $proxysettings { 'SRC_SUBNETS' })
2611 print FILE
" $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'} \n " ;
2612 if ( $netsettings { 'BLUE_DEV' })
2614 print FILE
" $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'} \n " ;
2616 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2619 open ( FILE
, "> $acl_src_banned_ip " );
2621 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2624 open ( FILE
, "> $acl_src_banned_mac " );
2626 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2629 open ( FILE
, "> $acl_src_unrestricted_ip " );
2631 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2634 open ( FILE
, "> $acl_src_unrestricted_mac " );
2636 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2639 open ( FILE
, "> $acl_dst_nocache " );
2641 print FILE
$proxysettings { 'DST_NOCACHE' };
2644 open ( FILE
, "> $acl_dst_noauth " );
2646 print FILE
$proxysettings { 'DST_NOAUTH' };
2649 open ( FILE
, "> $acl_ports_safe " );
2651 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2654 open ( FILE
, "> $acl_ports_ssl " );
2656 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2659 open ( FILE
, "> $acl_dst_throttle " );
2661 if ( $proxysettings { 'THROTTLE_BINARY' } eq 'on' )
2663 @temp = split ( /\|/ , $throttle_binary );
2664 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2666 if ( $proxysettings { 'THROTTLE_DSKIMG' } eq 'on' )
2668 @temp = split ( /\|/ , $throttle_dskimg );
2669 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2671 if ( $proxysettings { 'THROTTLE_MMEDIA' } eq 'on' )
2673 @temp = split ( /\|/ , $throttle_mmedia );
2674 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2676 if (- s
$throttled_urls )
2678 open ( URLFILE
, $throttled_urls );
2681 foreach ( @temp ) { print FILE
; }
2685 open ( FILE
, "> $mimetypes " );
2687 print FILE
$proxysettings { 'MIME_TYPES' };
2690 open ( FILE
, "> $ntlmdir /msntauth.allowusers" );
2692 print FILE
$proxysettings { 'NTLM_ALLOW_USERS' };
2695 open ( FILE
, "> $ntlmdir /msntauth.denyusers" );
2697 print FILE
$proxysettings { 'NTLM_DENY_USERS' };
2700 open ( FILE
, "> $raddir /radauth.allowusers" );
2702 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2705 open ( FILE
, "> $raddir /radauth.denyusers" );
2707 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2710 open ( FILE
, "> $identdir /identauth.allowusers" );
2712 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2715 open ( FILE
, "> $identdir /identauth.denyusers" );
2717 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2720 open ( FILE
, "> $identhosts " );
2722 print FILE
$proxysettings { 'IDENT_HOSTS' };
2725 open ( FILE
, "> $cre_groups " );
2727 print FILE
$proxysettings { 'CRE_GROUPS' };
2730 open ( FILE
, "> $cre_svhosts " );
2732 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2736 # -------------------------------------------------------------------
2740 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2742 print FILE
"function FindProxyForURL(url, host) \n " ;
2744 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2748 (isPlainHostName(host)) ||
2749 (dnsDomainIs(host, ". $mainsettings {'DOMAINNAME'}")) ||
2750 (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
2751 (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
2752 (isInNet(host, "169.254.0.0", "255.255.0.0")) ||
2753 (isInNet(host, "192.168.0.0", "255.255.0.0"))
2761 if ( $proxysettings { 'ENABLE' } eq 'on' )
2763 print FILE
"if ( \n " ;
2764 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2767 if (- e
" $acl_src_subnets " ) {
2768 open ( SUBNETS
, " $acl_src_subnets " );
2769 @templist = < SUBNETS
>;
2775 @temp = split ( /\/ /);
2777 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2778 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2782 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
2792 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2796 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
2798 print FILE
" \n else \n\n " ;
2800 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2804 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
2806 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2815 # -------------------------------------------------------------------
2822 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
2823 $proxysettings { 'THROTTLING_GREEN_HOST' } +
2824 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
2825 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
2827 $delaypools = 1 ; } else { $delaypools = 0 ;
2830 if ( $proxysettings { 'AUTH_REALM' } eq '' )
2832 $authrealm = "IPFire Advanced Proxy Server" ;
2834 $authrealm = $proxysettings { 'AUTH_REALM' };
2837 $_ = $proxysettings { 'UPSTREAM_PROXY' };
2838 my ( $remotehost , $remoteport ) = ( /^(?:[a-zA-Z ]+\:\/ \
/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/ .* ?
) ?
$/);
2840 if ( $remoteport eq '' ) { $remoteport = 80 ; }
2842 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
2845 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
2846 # you make will be overwritten whenever you resave proxy settings using the
2849 # Instead, modify the file ' $acl_include ' and
2850 # then restart the proxy service using the web interface. Changes made to the
2851 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
2853 shutdown_lifetime 5 seconds
2858 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2859 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) { print FILE
" transparent" }
2860 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2863 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
2864 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2865 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) { print FILE
" transparent" }
2866 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2872 acl QUERY urlpath_regex cgi-bin \\ ?
2876 if (!- z
$acl_dst_nocache ) {
2877 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache \"\n " ;
2878 print FILE
"cache deny no_cache_domains \n " ;
2883 cache_effective_user squid
2884 cache_effective_group squid
2887 pid_filename /var/run/squid.pid
2889 cache_mem $proxysettings {'CACHE_MEM'} MB
2890 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
2895 if (( $proxysettings { 'ERR_DESIGN' } eq 'ipfire' ))
2897 print FILE
"error_directory $errordir .ipfire/ $proxysettings {'ERR_LANGUAGE'} \n\n " ;
2899 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
2902 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
2904 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
2906 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
2908 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
2910 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
2912 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
2917 if ( $proxysettings { 'LOGGING' } eq 'on' )
2920 access_log /var/log/squid/access.log
2921 cache_log /var/log/squid/cache.log
2922 cache_store_log none
2925 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"useragent_log \/var\/log\/squid\/user_agent.log \n " ; }
2926 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
2929 access_log /dev/null
2931 cache_store_log none
2940 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
2942 print FILE
"forwarded_for on \n " ;
2944 print FILE
"forwarded_for off \n " ;
2946 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
2948 print FILE
"via on \n " ;
2950 print FILE
"via off \n " ;
2954 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
2956 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
2958 print FILE
"auth_param basic program $authdir /ncsa_auth $userdb \n " ;
2959 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
2960 print FILE
"auth_param basic realm $authrealm \n " ;
2961 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
2962 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
2965 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
2967 print FILE
"auth_param basic program $authdir /squid_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
2968 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
2969 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
2970 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
2972 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
2974 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
2976 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
2978 print FILE
" -u sAMAccountName -P" ;
2980 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
2982 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
2984 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
2986 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
2988 print FILE
" -u cn -P" ;
2990 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
2992 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
2994 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
2996 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
2998 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
2999 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3000 print FILE
" -u uid -P" ;
3002 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3003 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3004 print FILE
"auth_param basic realm $authrealm \n " ;
3005 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3006 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3009 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
3011 if ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' )
3013 print FILE
"auth_param ntlm program $authdir /ntlm_auth $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_PDC'}" ;
3014 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print FILE
" \n " ; } else { print FILE
" $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_BDC'} \n " ; }
3015 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n " ;
3016 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3018 print FILE
"auth_param basic program $authdir /msnt_auth \n " ;
3019 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3020 print FILE
"auth_param basic realm $authrealm \n " ;
3021 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3022 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3024 open ( MSNTCONF
, "> $ntlmdir /msntauth.conf" );
3026 print MSNTCONF
"server $proxysettings {'NTLM_PDC'}" ;
3027 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print MSNTCONF
" $proxysettings {'NTLM_PDC'}" ; } else { print MSNTCONF
" $proxysettings {'NTLM_BDC'}" ; }
3028 print MSNTCONF
" $proxysettings {'NTLM_DOMAIN'} \n " ;
3029 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3031 if ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' )
3033 print MSNTCONF
"allowusers $ntlmdir /msntauth.allowusers \n " ;
3035 print MSNTCONF
"denyusers $ntlmdir /msntauth.denyusers \n " ;
3042 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3044 print FILE
"auth_param basic program $authdir /squid_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3045 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3046 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3047 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3048 print FILE
"auth_param basic realm $authrealm \n " ;
3049 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3050 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3054 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3055 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) && ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ))
3057 if ((!- z
" $ntlmdir /msntauth.allowusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
3059 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.allowusers \"\n " ;
3061 if ((!- z
" $ntlmdir /msntauth.denyusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
3063 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.denyusers \"\n " ;
3066 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3068 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3070 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3072 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3074 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3077 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3080 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3081 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3083 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3086 if (!- z
$acl_dst_noauth ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth \"\n " ; }
3090 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3092 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3094 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3096 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3098 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3100 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3102 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3104 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3107 if (!- z
$acl_dst_noauth ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth \"\n " ; }
3111 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3113 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
"acl with_allowed_useragents browser $browser_regexp \n\n " ; }
3115 print FILE
"acl within_timeframe time " ;
3116 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3117 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3118 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3119 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3120 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3121 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3122 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3123 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3124 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3125 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3126 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3128 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3129 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3133 acl all src 0.0.0.0/0.0.0.0
3134 acl localhost src 127.0.0.1/255.255.255.255
3137 open ( PORTS
, " $acl_ports_ssl " );
3142 foreach ( @temp ) { print FILE
"acl SSL_ports port $_ " ; }
3144 open ( PORTS
, " $acl_ports_safe " );
3149 foreach ( @temp ) { print FILE
"acl Safe_ports port $_ " ; }
3153 acl IPCop_http port $http_port
3154 acl IPCop_https port $https_port
3155 acl IPCop_ips dst $netsettings {'GREEN_ADDRESS'}
3156 acl IPCop_networks src " $acl_src_subnets "
3157 acl IPCop_servers dst " $acl_src_subnets "
3158 acl IPCop_green_network src $netsettings {'GREEN_NETADDRESS'}/ $netsettings {'GREEN_NETMASK'}
3159 acl IPCop_green_servers dst $netsettings {'GREEN_NETADDRESS'}/ $netsettings {'GREEN_NETMASK'}
3162 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPCop_blue_network src $netsettings {'BLUE_NETADDRESS'}/ $netsettings {'BLUE_NETMASK'} \n " ; }
3163 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPCop_blue_servers dst $netsettings {'BLUE_NETADDRESS'}/ $netsettings {'BLUE_NETMASK'} \n " ; }
3164 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPCop_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3165 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPCop_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3166 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPCop_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3167 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPCop_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3169 acl CONNECT method CONNECT
3173 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3176 #Classroom extensions
3177 acl IPCop_no_access_ips src " $acl_src_noaccess_ip "
3178 acl IPCop_no_access_mac arp " $acl_src_noaccess_mac "
3181 print FILE
"deny_info " ;
3182 if ((( $proxysettings { 'ERR_DESIGN' } eq 'ipfire' ) && (- e
" $errordir .ipfire/ $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )) ||
3183 (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )))
3185 print FILE
"ERR_ACCESS_DISABLED" ;
3187 print FILE
"ERR_ACCESS_DENIED" ;
3189 print FILE
" IPCop_no_access_ips \n " ;
3190 print FILE
"deny_info " ;
3191 if ((( $proxysettings { 'ERR_DESIGN' } eq 'ipfire' ) && (- e
" $errordir .ipfire/ $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )) ||
3192 (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )))
3194 print FILE
"ERR_ACCESS_DISABLED" ;
3196 print FILE
"ERR_ACCESS_DENIED" ;
3198 print FILE
" IPCop_no_access_mac \n " ;
3201 http_access deny IPCop_no_access_ips
3202 http_access deny IPCop_no_access_mac
3207 #Insert acl file and replace __VAR__ with correct values
3208 my $blue_net = '' ; #BLUE empty by default
3210 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3211 $blue_net = " $netsettings {'BLUE_NETADDRESS'}/ $netsettings {'BLUE_NETMASK'}" ;
3212 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3214 if (!- z
$acl_include )
3216 open ( ACL
, " $acl_include " );
3217 print FILE
" \n #Start of custom includes \n " ;
3219 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3220 $_ =~ s/__GREEN_NET__/$netsettings{'GREEN_NETADDRESS'}\/ $netsettings { 'GREEN_NETMASK' }/;
3221 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3222 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3223 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3226 print FILE
"#End of custom includes \n " ;
3229 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3233 #local machine, no restriction
3234 http_access allow localhost
3236 #GUI admin if local machine connects
3237 http_access allow IPCop_ips IPCop_networks IPCop_http
3238 http_access allow CONNECT IPCop_ips IPCop_networks IPCop_https
3240 #Deny not web services
3241 http_access deny !Safe_ports
3242 http_access deny CONNECT !SSL_ports
3247 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3249 print FILE
"#Set ident ACLs \n " ;
3250 if (!- z
$identhosts )
3252 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3253 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3254 print FILE
"ident_lookup_access deny all \n " ;
3256 print FILE
"ident_lookup_access allow all \n " ;
3258 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3262 print FILE
"#Set download throttling \n " ;
3264 if ( $netsettings { 'BLUE_DEV' })
3266 print FILE
"delay_pools 2 \n " ;
3268 print FILE
"delay_pools 1 \n " ;
3271 print FILE
"delay_class 1 3 \n " ;
3272 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3274 print FILE
"delay_parameters 1 " ;
3275 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3279 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3281 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3284 print FILE
" -1/-1 " ;
3285 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3289 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3291 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3295 if ( $netsettings { 'BLUE_DEV' })
3297 print FILE
"delay_parameters 2 " ;
3298 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3302 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3304 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3306 print FILE
" -1/-1 " ;
3307 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3311 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3313 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3318 print FILE
"delay_access 1 deny IPCop_ips \n " ;
3319 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPCop_unrestricted_ips \n " ; }
3320 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPCop_unrestricted_mac \n " ; }
3321 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3323 if ( $netsettings { 'BLUE_DEV' })
3325 print FILE
"delay_access 1 allow IPCop_green_network" ;
3326 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3328 print FILE
"delay_access 1 deny all \n " ;
3330 print FILE
"delay_access 1 allow all" ;
3331 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3335 if ( $netsettings { 'BLUE_DEV' })
3337 print FILE
"delay_access 2 deny IPCop_ips \n " ;
3338 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPCop_unrestricted_ips \n " ; }
3339 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPCop_unrestricted_mac \n " ; }
3340 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3341 print FILE
"delay_access 2 allow IPCop_blue_network" ;
3342 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3344 print FILE
"delay_access 2 deny all \n " ;
3347 print FILE
"delay_initial_bucket_level 100 \n " ;
3351 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3353 print FILE
"#Prevent internal proxy access to Green \n " ;
3354 print FILE
"http_access deny IPCop_green_servers !IPCop_green_network \n\n " ;
3357 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3359 print FILE
"#Prevent internal proxy access from Blue \n " ;
3360 print FILE
"http_access allow IPCop_blue_network IPCop_blue_servers \n " ;
3361 print FILE
"http_access deny IPCop_blue_network IPCop_servers \n\n " ;
3365 #Set custom configured ACLs
3368 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPCop_banned_ips \n " ; }
3369 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPCop_banned_mac \n " ; }
3371 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3373 if (!- z
$acl_src_unrestricted_ip )
3375 print FILE
"http_access allow IPCop_unrestricted_ips to_domains_without_auth \n " ;
3377 if (!- z
$acl_src_unrestricted_mac )
3379 print FILE
"http_access allow IPCop_unrestricted_mac to_domains_without_auth \n " ;
3381 print FILE
"http_access allow IPCop_networks" ;
3382 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3383 print FILE
" !within_timeframe" ;
3385 print FILE
" within_timeframe" ; }
3386 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3387 print FILE
" to_domains_without_auth \n " ;
3390 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3392 print FILE
"http_access deny !for_inetusers" ;
3393 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3398 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3399 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3400 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3401 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3402 (!- z
" $identdir /identauth.denyusers" )
3405 print FILE
"http_access deny for_acl_users" ;
3406 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3410 if (!- z
$acl_src_unrestricted_ip )
3412 print FILE
"http_access allow IPCop_unrestricted_ips" ;
3413 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3415 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3417 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3419 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3421 print FILE
" for_inetusers" ;
3423 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3425 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3427 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3429 print FILE
" for_acl_users" ;
3431 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3433 print FILE
" !for_acl_users" ;
3435 } else { print FILE
" for_inetusers" ; }
3437 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3439 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3441 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3443 print FILE
" for_acl_users" ;
3445 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3447 print FILE
" !for_acl_users" ;
3449 } else { print FILE
" for_inetusers" ; }
3455 if (!- z
$acl_src_unrestricted_mac )
3457 print FILE
"http_access allow IPCop_unrestricted_mac" ;
3458 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3460 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3462 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3464 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3466 print FILE
" for_inetusers" ;
3468 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3470 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3472 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3474 print FILE
" for_acl_users" ;
3476 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3478 print FILE
" !for_acl_users" ;
3480 } else { print FILE
" for_inetusers" ; }
3482 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3484 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3486 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3488 print FILE
" for_acl_users" ;
3490 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3492 print FILE
" !for_acl_users" ;
3494 } else { print FILE
" for_inetusers" ; }
3500 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3502 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3503 if (!- z
$extgrp ) { print FILE
"http_access allow IPCop_networks for_extended_users \n " ; }
3508 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3509 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3510 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3511 ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) &&
3512 (!- z
" $ntlmdir /msntauth.denyusers" )
3516 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3517 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3518 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3519 (!- z
" $raddir /radauth.denyusers" )
3523 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3524 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3525 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3526 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3527 (!- z
" $identdir /identauth.denyusers" )
3531 print FILE
"http_access deny for_acl_users" ;
3532 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3536 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3538 print FILE
"http_access allow" ;
3539 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3540 print FILE
" !within_timeframe" ;
3542 print FILE
" within_timeframe" ; }
3543 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3544 print FILE
" !on_ident_aware_hosts \n " ;
3547 print FILE
"http_access allow IPCop_networks" ;
3550 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3551 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3552 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3553 ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) &&
3554 (!- z
" $ntlmdir /msntauth.allowusers" )
3558 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3559 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3560 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3561 (!- z
" $raddir /radauth.allowusers" )
3565 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3566 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3567 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3568 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3569 (!- z
" $identdir /identauth.allowusers" )
3573 print FILE
" for_acl_users" ;
3574 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3575 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3576 print FILE
" for_inetusers" ;
3578 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3580 print FILE
" !concurrent" ;
3582 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3583 print FILE
" !within_timeframe" ;
3585 print FILE
" within_timeframe" ; }
3586 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3589 print FILE
"http_access deny all \n\n " ;
3591 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3592 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3594 print FILE
"#Strip HTTP Header \n " ;
3596 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3598 print FILE
"header_access X-Forwarded-For deny all \n " ;
3600 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3602 print FILE
"header_access Via deny all \n " ;
3604 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3606 print FILE
"header_access User-Agent deny all \n " ;
3608 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3610 print FILE
"header_access Referer deny all \n " ;
3615 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3617 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3619 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3621 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3623 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3629 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3631 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3632 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPCop_unrestricted_ips \n " ; }
3633 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPCop_unrestricted_mac \n " ; }
3634 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3636 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3638 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3639 print FILE
"http_reply_access allow all \n\n " ;
3643 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3644 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3646 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3649 $replybodymaxsize = 1024 * $proxysettings { 'MAX_INCOMING_SIZE' };
3650 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3651 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size 0 allow IPCop_unrestricted_ips \n " ; }
3652 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size 0 allow IPCop_unrestricted_mac \n " ; }
3653 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3655 if (!- z
$extgrp ) { print FILE
"reply_body_max_size 0 allow for_extended_users \n " ; }
3658 print FILE
"reply_body_max_size $replybodymaxsize allow all \n\n " ;
3660 print FILE
"visible_hostname" ;
3661 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3663 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3665 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3668 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n\n " ; }
3670 # Write the parent proxy info, if needed.
3671 if ( $remotehost ne '' )
3673 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3675 # Enter authentication for the parent cache. Option format is
3676 # login=user:password ($proxy1='YES')
3677 # login=PASS ($proxy1='PASS')
3678 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3679 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3681 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3682 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3684 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3686 print FILE
" \n never_direct allow all \n\n " ;
3688 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) && ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ))
3690 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3691 if ( $filtersettings { 'CHILDREN' } > $xlratorsettings { 'CHILDREN' })
3693 print FILE
"url_rewrite_children $filtersettings {'CHILDREN'} \n\n " ;
3695 print FILE
"url_rewrite_children $xlratorsettings {'CHILDREN'} \n\n " ;
3700 if ( $proxysettings { 'ENABLE_FILTER' } eq 'on' )
3703 url_rewrite_program /usr/sbin/redirect_wrapper
3704 url_rewrite_children $filtersettings {'CHILDREN'}
3709 if ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' )
3712 url_rewrite_program /usr/sbin/redirect_wrapper
3713 url_rewrite_children $xlratorsettings {'CHILDREN'}
3722 # -------------------------------------------------------------------
3726 my ( $str_user , $str_pass , $str_group ) = @_ ;
3727 my @groupmembers =();
3729 if ( $str_pass eq 'lEaVeAlOnE' )
3731 open ( FILE
, " $userdb " );
3732 @groupmembers = < FILE
>;
3734 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3735 & deluser
( $str_user );
3736 open ( FILE
, ">> $userdb " );
3738 print FILE
" $str_user $str_pass " ;
3741 & deluser
( $str_user );
3742 system ( "/usr/sbin/htpasswd -b $userdb $str_user $str_pass " );
3745 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3746 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3747 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3749 print FILE
" $str_user \n " ;
3755 # -------------------------------------------------------------------
3759 my ( $str_user ) = @_ ;
3761 my @groupmembers =();
3764 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
3767 open ( FILE
, " $groupfile " );
3768 @groupmembers = < FILE
>;
3770 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
3771 open ( FILE
, "> $groupfile " );
3773 print FILE
@templist ;
3778 open ( FILE
, " $userdb " );
3779 @groupmembers = < FILE
>;
3781 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
3782 open ( FILE
, "> $userdb " );
3784 print FILE
@templist ;
3790 # -------------------------------------------------------------------