]>
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-2012 IPFire Team <info@ipfire.org> #
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 ###############################################################################
22 # (c) 2004-2009 marco.s - http://www.advproxy.net
24 # This code is distributed under the terms of the GPL
26 # $Id: advproxy.cgi,v 3.0.2 2009/02/04 00:00:00 marco.s Exp $
31 # enable only the following on debugging purpose
33 #use CGI::Carp 'fatalsToBrowser';
35 require '/var/ipfire/general-functions.pl' ;
36 require "${General::swroot}/lang.pl" ;
37 require "${General::swroot}/header.pl" ;
39 my @squidversion = `/usr/sbin/squid -v` ;
44 my %mainsettings = ();
45 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
46 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
50 my %filtersettings =();
51 my %xlratorsettings =();
52 my %stdproxysettings =();
58 my @throttle_limits =( 64 , 128 , 256 , 384 , 512 , 768 , 1024 , 1280 , 1536 , 1792 , 2048 , 2560 , 3072 , 3584 , 4096 , 5120 , 6144 , 7168 , 8192 , 10240 , 12288 , 16384 , 20480 );
59 my $throttle_binary = "7z|arj|bin|bz2|cab|exe|gz|lzh|rar|sea|tar|tgz|xz|zip" ;
60 my $throttle_dskimg = "b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi|vmdk" ;
61 my $throttle_mmedia = "aiff?|asf|avi|divx|mov|mp3|mpe?g|ogg|qt|ra?m|ts|vob" ;
63 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 " ;
64 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
69 my $hintcolour = '#FFFFCC' ;
70 my $ncsa_buttontext = '' ;
85 my $browser_regexp = '' ;
89 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
90 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
91 my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm" ;
92 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
93 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
94 my $credir = "${General::swroot}/proxy/advanced/cre" ;
96 my $userdb = " $ncsadir /passwd" ;
97 my $stdgrp = " $ncsadir /standard.grp" ;
98 my $extgrp = " $ncsadir /extended.grp" ;
99 my $disgrp = " $ncsadir /disabled.grp" ;
101 my $browserdb = "${General::swroot}/proxy/advanced/useragents" ;
102 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
103 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
105 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
106 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
107 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
109 my $identhosts = " $identdir /hosts" ;
111 my $authdir = "/usr/lib/squid/" ;
112 my $errordir = "/usr/lib/squid/errors" ;
114 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
115 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
116 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
117 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
118 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
119 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
120 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
121 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
122 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
123 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
124 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
125 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
126 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
127 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
128 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
129 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
130 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
131 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
132 my $acl_include = " $acldir /include.acl" ;
134 my $updaccelversion = 'n/a' ;
135 my $urlfilterversion = 'n/a' ;
137 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
138 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
139 unless (- d
" $ntlmdir " ) { mkdir ( " $ntlmdir " ); }
140 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
141 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
142 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
144 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
145 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
147 unless (- e
$userdb ) { system ( "touch $userdb " ); }
148 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
149 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
150 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
152 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
153 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
154 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
155 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
156 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
157 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
158 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
159 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
160 unless (- e
$acl_dst_noauth_dom ) { system ( "touch $acl_dst_noauth_dom " ); }
161 unless (- e
$acl_dst_noauth_net ) { system ( "touch $acl_dst_noauth_net " ); }
162 unless (- e
$acl_dst_noauth_url ) { system ( "touch $acl_dst_noauth_url " ); }
163 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
164 unless (- e
$acl_dst_nocache_dom ) { system ( "touch $acl_dst_nocache_dom " ); }
165 unless (- e
$acl_dst_nocache_net ) { system ( "touch $acl_dst_nocache_net " ); }
166 unless (- e
$acl_dst_nocache_url ) { system ( "touch $acl_dst_nocache_url " ); }
167 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
168 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
169 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
170 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
172 unless (- e
$browserdb ) { system ( "touch $browserdb " ); }
173 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
175 open FILE
, $browserdb ;
176 @useragentlist = sort { reverse ( substr ( reverse ( substr ( $a , index ( $a , ',' )+ 1 )), index ( reverse ( substr ( $a , index ( $a , ',' ))), ',' )+ 1 )) cmp reverse ( substr ( reverse ( substr ( $b , index ( $b , ',' )+ 1 )), index ( reverse ( substr ( $b , index ( $b , ',' ))), ',' )+ 1 ))} grep ! /(^$)|(^\s*#)/ ,< FILE
>;
179 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
180 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
182 my $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
183 my $blue_cidr = "# Blue not defined" ;
184 if ( $netsettings { 'BLUE_DEV' }) {
185 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
188 & Header
:: showhttpheaders
();
190 $proxysettings { 'ACTION' } = '' ;
191 $proxysettings { 'VALID' } = '' ;
193 $proxysettings { 'ENABLE' } = 'off' ;
194 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
195 $proxysettings { 'TRANSPARENT' } = 'off' ;
196 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
197 $proxysettings { 'PROXY_PORT' } = '800' ;
198 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
199 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
200 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
201 $proxysettings { 'ERR_LANGUAGE' } = 'German' ;
202 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
203 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
204 $proxysettings { 'FORWARD_VIA' } = 'off' ;
205 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
206 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
207 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
208 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
209 $proxysettings { 'UPSTREAM_USER' } = '' ;
210 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
211 $proxysettings { 'LOGGING' } = 'off' ;
212 $proxysettings { 'CACHEMGR' } = 'off' ;
213 $proxysettings { 'LOGQUERY' } = 'off' ;
214 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
215 $proxysettings { 'FILEDESCRIPTORS' } = '4096' ;
216 $proxysettings { 'CACHE_MEM' } = '2' ;
217 $proxysettings { 'CACHE_SIZE' } = '50' ;
218 $proxysettings { 'MAX_SIZE' } = '4096' ;
219 $proxysettings { 'MIN_SIZE' } = '0' ;
220 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
221 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
222 $proxysettings { 'L1_DIRS' } = '16' ;
223 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
224 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
225 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
226 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
227 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
228 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
229 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
230 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
231 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
232 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
233 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
234 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
235 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
236 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
237 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
238 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
239 $proxysettings { 'THROTTLE_BINARY' } = 'off' ;
240 $proxysettings { 'THROTTLE_DSKIMG' } = 'off' ;
241 $proxysettings { 'THROTTLE_MMEDIA' } = 'off' ;
242 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
243 $proxysettings { 'ENABLE_BROWSER_CHECK' } = 'off' ;
244 $proxysettings { 'FAKE_USERAGENT' } = '' ;
245 $proxysettings { 'FAKE_REFERER' } = '' ;
246 $proxysettings { 'AUTH_METHOD' } = 'none' ;
247 $proxysettings { 'AUTH_REALM' } = '' ;
248 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
249 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
250 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
251 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
252 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
253 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
254 $proxysettings { 'NCSA_USERNAME' } = '' ;
255 $proxysettings { 'NCSA_GROUP' } = '' ;
256 $proxysettings { 'NCSA_PASS' } = '' ;
257 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
258 $proxysettings { 'LDAP_BASEDN' } = '' ;
259 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
260 $proxysettings { 'LDAP_SERVER' } = '' ;
261 $proxysettings { 'LDAP_PORT' } = '389' ;
262 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
263 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
264 $proxysettings { 'LDAP_GROUP' } = '' ;
265 $proxysettings { 'NTLM_DOMAIN' } = '' ;
266 $proxysettings { 'NTLM_PDC' } = '' ;
267 $proxysettings { 'NTLM_BDC' } = '' ;
268 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
269 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
270 $proxysettings { 'RADIUS_SERVER' } = '' ;
271 $proxysettings { 'RADIUS_PORT' } = '1812' ;
272 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
273 $proxysettings { 'RADIUS_SECRET' } = '' ;
274 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
275 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
276 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
277 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
278 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
279 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
280 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
281 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
282 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
283 $proxysettings { 'CHILDREN' } = '10' ;
285 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
287 & Header
:: getcgihash
( \
%proxysettings );
289 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
290 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
291 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
292 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
294 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
296 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
299 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
301 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
302 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
303 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
305 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
306 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
308 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
309 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
311 if (! $errormessage ) {
312 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
313 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
315 $proxysettings { 'NCSA_USERNAME' } = '' ;
316 $proxysettings { 'NCSA_GROUP' } = '' ;
317 $proxysettings { 'NCSA_PASS' } = '' ;
318 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
321 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
323 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
324 & deluser
( $proxysettings { 'ID' });
327 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
328 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
329 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
331 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
333 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
334 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
335 @temp = split ( /:/ , $proxysettings { 'ID' });
336 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
337 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
338 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
339 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
342 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
344 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
345 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
346 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
347 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
348 $errormessage = $Lang :: tr
{ 'invalid input' };
351 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
352 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
356 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
358 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
361 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' )) {
362 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
363 if (!(& General
:: validip
( $temp [ 0 ]))) {
364 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
368 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
369 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
371 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
373 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
377 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
378 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 16384 ))
380 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
383 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ) ||
384 ( $proxysettings { 'CACHE_MEM' } < 1 ))
386 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
389 my @free = `/usr/bin/free` ;
390 $free [ 1 ] =~ m/(\d+)/ ;
391 $cachemem = int $1 / 2048 ;
392 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
393 $proxysettings { 'CACHE_MEM' } = $cachemem ;
395 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
397 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
400 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
402 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
405 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
407 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
410 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
412 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
415 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
417 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
420 if (!( $proxysettings { 'CHILDREN' } =~ /^\d+$/ ) || ( $proxysettings { 'CHILDREN' } < 1 ))
422 $errormessage = $Lang :: tr
{ 'advproxy invalid num of children' };
425 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' )
427 $browser_regexp = '' ;
428 foreach ( @useragentlist )
431 @useragent = split ( /,/ );
432 if ( $proxysettings { 'UA_' . $useragent [ 0 ]} eq 'on' ) { $browser_regexp .= " $useragent [2]|" ; }
434 chop ( $browser_regexp );
435 if (! $browser_regexp )
437 $errormessage = $Lang :: tr
{ 'advproxy errmsg no browser' };
441 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
443 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
444 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
445 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
447 if ( $netsettings { 'BLUE_DEV' })
449 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
450 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
452 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
456 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
458 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
463 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
464 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
466 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
469 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
471 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
474 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
476 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
479 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
481 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
484 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
486 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
490 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
492 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
494 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
498 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
500 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
502 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
506 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
508 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
510 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
513 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
515 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
517 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
521 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
523 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
526 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
528 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
530 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
535 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
537 if ( $proxysettings { 'NTLM_DOMAIN' } eq '' )
539 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm domain' };
542 if ( $proxysettings { 'NTLM_PDC' } eq '' )
544 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm pdc' };
547 if (!& General
:: validhostname
( $proxysettings { 'NTLM_PDC' }))
549 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid pdc' };
552 if ((!( $proxysettings { 'NTLM_BDC' } eq '' )) && (!& General
:: validhostname
( $proxysettings { 'NTLM_BDC' })))
554 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid bdc' };
558 $proxysettings { 'NTLM_DOMAIN' } = lc ( $proxysettings { 'NTLM_DOMAIN' });
559 $proxysettings { 'NTLM_PDC' } = lc ( $proxysettings { 'NTLM_PDC' });
560 $proxysettings { 'NTLM_BDC' } = lc ( $proxysettings { 'NTLM_BDC' });
562 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
564 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
566 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
569 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
571 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
574 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
576 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
581 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
584 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
585 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
586 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
587 if (( $proxy1 ne $proxy2 ))
589 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
597 $proxysettings { 'VALID' } = 'no' ; }
599 $proxysettings { 'VALID' } = 'yes' ; }
601 if ( $proxysettings { 'VALID' } eq 'yes' )
605 delete $proxysettings { 'SRC_SUBNETS' };
606 delete $proxysettings { 'SRC_BANNED_IP' };
607 delete $proxysettings { 'SRC_BANNED_MAC' };
608 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
609 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
610 delete $proxysettings { 'DST_NOCACHE' };
611 delete $proxysettings { 'DST_NOAUTH' };
612 delete $proxysettings { 'PORTS_SAFE' };
613 delete $proxysettings { 'PORTS_SSL' };
614 delete $proxysettings { 'MIME_TYPES' };
615 delete $proxysettings { 'NTLM_ALLOW_USERS' };
616 delete $proxysettings { 'NTLM_DENY_USERS' };
617 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
618 delete $proxysettings { 'RADIUS_DENY_USERS' };
619 delete $proxysettings { 'IDENT_HOSTS' };
620 delete $proxysettings { 'IDENT_ALLOW_USERS' };
621 delete $proxysettings { 'IDENT_DENY_USERS' };
623 delete $proxysettings { 'CRE_GROUPS' };
624 delete $proxysettings { 'CRE_SVHOSTS' };
626 delete $proxysettings { 'NCSA_USERNAME' };
627 delete $proxysettings { 'NCSA_GROUP' };
628 delete $proxysettings { 'NCSA_PASS' };
629 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
631 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
632 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
633 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
634 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
635 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
636 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
637 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
639 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
640 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
642 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
644 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
645 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
646 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
647 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
648 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
649 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
650 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
651 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
652 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
657 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
659 system ( '/usr/local/bin/squidctrl' , 'disable' );
660 unlink "${General::swroot}/proxy/enable" ;
661 unlink "${General::swroot}/proxy/transparent" ;
662 unlink "${General::swroot}/proxy/enable_blue" ;
663 unlink "${General::swroot}/proxy/transparent_blue" ;
665 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
666 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
667 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
668 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
669 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
670 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
671 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
672 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
673 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
674 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
676 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
677 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { system ( '/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1' ); }
681 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
683 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
688 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
689 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
690 } elsif (- e
"${General::swroot}/proxy/settings" ) {
691 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
696 $checked { 'ENABLE' }{ 'off' } = '' ;
697 $checked { 'ENABLE' }{ 'on' } = '' ;
698 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
700 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
701 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
702 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
704 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
705 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
706 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
708 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
709 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
710 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
712 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
713 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
714 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
716 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
717 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
718 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
719 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
720 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
721 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
722 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
723 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
724 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
725 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
726 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
727 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
729 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
730 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
731 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
732 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
733 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
734 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
736 $checked { 'LOGGING' }{ 'off' } = '' ;
737 $checked { 'LOGGING' }{ 'on' } = '' ;
738 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
739 $checked { 'CACHEMGR' }{ 'off' } = '' ;
740 $checked { 'CACHEMGR' }{ 'on' } = '' ;
741 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
742 $checked { 'LOGQUERY' }{ 'off' } = '' ;
743 $checked { 'LOGQUERY' }{ 'on' } = '' ;
744 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
745 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
746 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
747 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
749 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
750 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
752 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
753 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
754 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
755 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
756 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
757 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
759 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
760 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
761 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
763 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
764 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
765 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
766 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
767 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
769 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
770 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
771 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
772 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
773 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
774 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
775 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
777 $checked { 'TIME_MON' }{ 'off' } = '' ;
778 $checked { 'TIME_MON' }{ 'on' } = '' ;
779 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
780 $checked { 'TIME_TUE' }{ 'off' } = '' ;
781 $checked { 'TIME_TUE' }{ 'on' } = '' ;
782 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
783 $checked { 'TIME_WED' }{ 'off' } = '' ;
784 $checked { 'TIME_WED' }{ 'on' } = '' ;
785 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
786 $checked { 'TIME_THU' }{ 'off' } = '' ;
787 $checked { 'TIME_THU' }{ 'on' } = '' ;
788 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
789 $checked { 'TIME_FRI' }{ 'off' } = '' ;
790 $checked { 'TIME_FRI' }{ 'on' } = '' ;
791 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
792 $checked { 'TIME_SAT' }{ 'off' } = '' ;
793 $checked { 'TIME_SAT' }{ 'on' } = '' ;
794 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
795 $checked { 'TIME_SUN' }{ 'off' } = '' ;
796 $checked { 'TIME_SUN' }{ 'on' } = '' ;
797 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
799 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
800 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
801 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
802 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
804 $checked { 'THROTTLE_BINARY' }{ 'off' } = '' ;
805 $checked { 'THROTTLE_BINARY' }{ 'on' } = '' ;
806 $checked { 'THROTTLE_BINARY' }{ $proxysettings { 'THROTTLE_BINARY' }} = "checked='checked'" ;
807 $checked { 'THROTTLE_DSKIMG' }{ 'off' } = '' ;
808 $checked { 'THROTTLE_DSKIMG' }{ 'on' } = '' ;
809 $checked { 'THROTTLE_DSKIMG' }{ $proxysettings { 'THROTTLE_DSKIMG' }} = "checked='checked'" ;
810 $checked { 'THROTTLE_MMEDIA' }{ 'off' } = '' ;
811 $checked { 'THROTTLE_MMEDIA' }{ 'on' } = '' ;
812 $checked { 'THROTTLE_MMEDIA' }{ $proxysettings { 'THROTTLE_MMEDIA' }} = "checked='checked'" ;
814 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
815 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
816 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
818 $checked { 'ENABLE_BROWSER_CHECK' }{ 'off' } = '' ;
819 $checked { 'ENABLE_BROWSER_CHECK' }{ 'on' } = '' ;
820 $checked { 'ENABLE_BROWSER_CHECK' }{ $proxysettings { 'ENABLE_BROWSER_CHECK' }} = "checked='checked'" ;
822 foreach ( @useragentlist ) {
823 @useragent = split ( /,/ );
824 $checked { 'UA_' . $useragent [ 0 ]}{ 'off' } = '' ;
825 $checked { 'UA_' . $useragent [ 0 ]}{ 'on' } = '' ;
826 $checked { 'UA_' . $useragent [ 0 ]}{ $proxysettings { 'UA_' . $useragent [ 0 ]}} = "checked='checked'" ;
829 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
830 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
831 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
832 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
833 $checked { 'AUTH_METHOD' }{ 'ntlm' } = '' ;
834 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
835 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
837 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
839 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
840 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
841 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
843 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
844 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
845 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
847 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
849 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
851 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
853 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
854 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
855 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
857 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
858 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
859 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
861 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
862 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
863 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
865 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
866 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
867 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
869 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
870 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
871 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
873 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
874 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
875 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
877 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
878 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
879 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
881 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
882 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
883 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
885 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
886 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
887 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
889 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
890 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
891 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
893 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
894 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
895 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
897 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
899 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
902 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
903 print "<font class='base'> $errormessage </font> \n " ;
907 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
909 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
910 $squidversion [ 0 ] =~ s/^\s+//g ;
911 $squidversion [ 0 ] =~ s/\s+$//g ;
913 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
916 # ===================================================================
918 # ===================================================================
920 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
922 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
924 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
929 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
932 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
933 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
934 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}:</td>
935 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
938 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
939 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
940 <td class='base'> $Lang ::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
941 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
946 if ( $netsettings { 'BLUE_DEV' }) {
947 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
948 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
950 print "<td colspan='2'> </td>" ;
953 <td colspan='2'> </td>
958 if ( $netsettings { 'BLUE_DEV' }) {
959 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
960 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
962 print "<td colspan='2'> </td>" ;
965 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
967 <select name='ERR_LANGUAGE'>
970 foreach (< $errordir /*>) {
972 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
973 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
981 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
982 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
983 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
984 <td class='base'><select name='ERR_DESIGN'>
985 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
986 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
990 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
991 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
998 <tr><td class='base' colspan='4'><b> $Lang ::tr{'advproxy redirector children'}</b></td></tr>
999 <tr><td class='base' > $Lang ::tr{'processes'}<input type='text' name='CHILDREN' value=' $proxysettings {'CHILDREN'}' size='5' /></td>
1002 my $count = `ip n| wc -l` ;
1003 if ( $count < 1 ){ $count = 1 ;}
1004 if ( - e
"/usr/bin/squidclamav" ) {
1005 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
1006 if ( ! - e
"/var/run/clamav/clamd.pid" ){
1007 print "<font color='red'>clamav not running</font><br /><br />" ;
1008 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
1011 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
1012 print "+ " . int (( $count **( 1 / 3 )) * 8 );}
1017 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</b><br />" ;
1018 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
1019 print "+ " . int (( $count **( 1 / 3 )) * 6 );
1021 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</b><br />" ;
1022 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1023 print "+ " . int (( $count **( 1 / 3 )) * 5 );
1028 <table width='100%'>
1030 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1033 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1034 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1035 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'} <img src='/blob.gif' alt='*' /></td>
1036 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1039 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1040 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1041 <td class='base'> $Lang ::tr{'advproxy upstream username'}: <img src='/blob.gif' alt='*' /></td>
1042 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1045 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1046 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1047 <td class='base'> $Lang ::tr{'advproxy upstream password'}: <img src='/blob.gif' alt='*' /></td>
1048 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1051 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1052 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1058 <table width='100%'>
1060 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1063 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1064 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1065 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1066 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1071 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1072 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1076 <table width='100%'>
1078 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1081 <td class='base'> $Lang ::tr{'proxy cachemgr'}:</td>
1082 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1083 <td class='base'> $Lang ::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td>
1084 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1087 <td class='base'> $Lang ::tr{'proxy filedescriptors'}:</td>
1088 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1089 <td class='base'> $Lang ::tr{'proxy admin password'}: <img src='/blob.gif' alt='*' /></td>
1090 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1093 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1096 <td class='base'> $Lang ::tr{'advproxy ram cache size'}:</td>
1097 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1098 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}:</td>
1099 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1102 <td class='base'> $Lang ::tr{'advproxy min size'}:</td>
1103 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1104 <td class='base'> $Lang ::tr{'advproxy max size'}:</td>
1105 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1108 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1109 <td class='base'><select name='L1_DIRS'>
1110 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1111 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1112 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1113 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1114 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1116 <td colspan='2' rowspan= '5' valign='top' class='base'>
1117 <table cellspacing='0' cellpadding='0'>
1119 <!-- intentionally left empty -->
1122 <td> $Lang ::tr{'advproxy no cache sites'}: <img src='/blob.gif' alt='*' /></td>
1125 <!-- intentionally left empty -->
1128 <!-- intentionally left empty -->
1131 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1135 print $proxysettings { 'DST_NOCACHE' };
1144 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1145 <td class='base'><select name='MEM_POLICY'>
1146 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1147 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1148 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1149 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1153 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1154 <td class='base'><select name='CACHE_POLICY'>
1155 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1156 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1157 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1158 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1162 <td colspan='2'> </td>
1165 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1166 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1170 <table width='100%'>
1172 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1175 <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
1178 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}:</td>
1179 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}:</td>
1182 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1185 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1189 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1192 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1199 <table width='100%'>
1201 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1204 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1207 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}:</td>
1210 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1214 if (! $proxysettings { 'SRC_SUBNETS' })
1216 print " $green_cidr \n " ;
1217 if ( $netsettings { 'BLUE_DEV' })
1219 print " $blue_cidr \n " ;
1221 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1228 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1229 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1230 print "<td class='base'> $line :</td> \n " ;
1232 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1236 if ( $netsettings { 'BLUE_DEV' }) {
1237 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1238 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1240 print "<td class='base'> $line :</td> \n " ;
1242 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1249 <td colspan='2'> </td>
1252 <td colspan='2'> </td>
1255 <table width='100%'>
1257 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1260 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}: <img src='/blob.gif' alt='*' /></td>
1261 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td>
1264 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1268 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1272 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1276 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1282 <table width='100%'>
1284 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1287 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}: <img src='/blob.gif' alt='*' /></td>
1288 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td>
1291 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1295 print $proxysettings { 'SRC_BANNED_IP' };
1299 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1303 print $proxysettings { 'SRC_BANNED_MAC' };
1314 # -------------------------------------------------------------------
1315 # CRE GUI - optional
1316 # -------------------------------------------------------------------
1318 if (- e
$cre_enabled ) { print <<END
1319 <table width='100%'>
1322 <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>
1325 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1331 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1333 <td class='base'> $Lang ::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td>
1334 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1337 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1338 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td>
1343 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1346 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1350 print $proxysettings { 'CRE_GROUPS' };
1354 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1357 print $proxysettings { 'CRE_SVHOSTS' };
1365 print "</table><hr size='1'>" ;
1369 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1370 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1371 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1376 # -------------------------------------------------------------------
1380 <table width='100%'>
1382 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1384 <table width='100%'>
1386 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1387 <td width='1%'> </td>
1388 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1389 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1390 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1391 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1392 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1393 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1394 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1395 <td width='1%'> </td>
1396 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1397 <td width='1%'> </td>
1398 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1403 <select name='TIME_ACCESS_MODE'>
1404 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1405 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1409 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1410 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1411 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1412 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1413 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1414 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1415 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1418 <select name='TIME_FROM_HOUR'>
1421 for ( $i = 0 ; $i <= 24 ; $i ++) {
1422 $_ = sprintf ( " %02s " , $i );
1423 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1430 <select name='TIME_FROM_MINUTE'>
1433 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1434 $_ = sprintf ( " %02s " , $i );
1435 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1442 <select name='TIME_TO_HOUR'>
1445 for ( $i = 0 ; $i <= 24 ; $i ++) {
1446 $_ = sprintf ( " %02s " , $i );
1447 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1454 <select name='TIME_TO_MINUTE'>
1457 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1458 $_ = sprintf ( " %02s " , $i );
1459 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1467 <table width='100%'>
1469 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1472 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}:</td>
1473 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1474 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}:</td>
1475 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1479 <table width='100%'>
1481 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1484 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1485 <td width='20%' class='base'>
1486 <select name='THROTTLING_GREEN_TOTAL'>
1490 foreach ( @throttle_limits ) {
1491 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1495 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1498 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1499 <td width='30%' class='base'>
1500 <select name='THROTTLING_GREEN_HOST'>
1504 foreach ( @throttle_limits ) {
1505 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1509 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1516 if ( $netsettings { 'BLUE_DEV' }) {
1519 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1521 <select name='THROTTLING_BLUE_TOTAL'>
1525 foreach ( @throttle_limits ) {
1526 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1530 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1533 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1535 <select name='THROTTLING_BLUE_HOST'>
1539 foreach ( @throttle_limits ) {
1540 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1544 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1554 <table width='100%'>
1556 <td colspan='4'><i> $Lang ::tr{'advproxy content based throttling'}:</i></td>
1559 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle binary'}:</td>
1560 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked {'THROTTLE_BINARY'}{'on'} /></td>
1561 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle dskimg'}:</td>
1562 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked {'THROTTLE_DSKIMG'}{'on'} /></td>
1563 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle mmedia'}:</td>
1564 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked {'THROTTLE_MMEDIA'}{'on'} /></td>
1565 <td width='15%'> </td>
1566 <td width='10%'> </td>
1570 <table width='100%'>
1572 <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>
1576 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1579 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td>
1584 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1588 print $proxysettings { 'MIME_TYPES' };
1602 <table width='100%'>
1604 <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>
1608 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ){
1614 if ( @useragentlist ) { print " $Lang ::tr{'advproxy allowed web browsers'}:" ; } else { print " $Lang ::tr{'advproxy no clients defined'}" ; }
1619 <table width='100%'>
1623 for ( $n = 0 ; $n <= @useragentlist ; $n = $n + $i ) {
1624 for ( $i = 0 ; $i <= 3 ; $i ++) {
1625 if ( $i eq 0 ) { print "<tr> \n " ; }
1626 if (( $n + $i ) < @useragentlist ) {
1627 @useragent = split ( /,/ , @useragentlist [ $n + $i ]);
1628 print "<td width='15%'> $useragent [1]:<\/td> \n " ;
1629 print "<td width='10%'><input type='checkbox' name='UA_ $useragent [0]' $checked {'UA_'. $useragent [0]}{'on'} /></td> \n " ;
1631 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1638 <table width='100%'>
1640 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1643 <td class='base'> $Lang ::tr{'advproxy fake useragent'}: <img src='/blob.gif' alt='*' /></td>
1644 <td class='base'> $Lang ::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td>
1647 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='56' /></td>
1648 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='56' /></td>
1656 <table width='100%'>
1658 <td colspan='5'><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1661 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked {'AUTH_METHOD'}{'none'} /> $Lang ::tr{'advproxy AUTH method none'}</td>
1662 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked {'AUTH_METHOD'}{'ncsa'} /> $Lang ::tr{'advproxy AUTH method ncsa'}</td>
1663 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked {'AUTH_METHOD'}{'ident'} /> $Lang ::tr{'advproxy AUTH method ident'}</td>
1664 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked {'AUTH_METHOD'}{'ldap'} /> $Lang ::tr{'advproxy AUTH method ldap'}</td>
1665 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked {'AUTH_METHOD'}{'ntlm'} /> $Lang ::tr{'advproxy AUTH method ntlm'}</td>
1666 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked {'AUTH_METHOD'}{'radius'} /> $Lang ::tr{'advproxy AUTH method radius'}</td>
1672 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1674 <table width='100%'>
1676 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1679 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1682 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1683 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1684 <td colspan='2' rowspan= '6' valign='top' class='base'>
1685 <table cellpadding='0' cellspacing='0'>
1687 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}: <img src='/blob.gif' alt='*' /></td>
1690 <!-- intentionally left empty -->
1693 <!-- intentionally left empty -->
1696 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1699 <!-- intentionally left empty -->
1702 <!-- intentionally left empty -->
1705 <td> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1708 <!-- intentionally left empty -->
1711 <!-- intentionally left empty -->
1714 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1718 print $proxysettings { 'DST_NOAUTH' };
1727 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1728 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1731 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}: <img src='/blob.gif' alt='*' /></td>
1732 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1735 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1736 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1739 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1740 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1743 <td colspan='2'> </td>
1750 # ===================================================================
1751 # NCSA auth settings
1752 # ===================================================================
1754 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1757 <table width='100%'>
1759 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1762 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1763 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1764 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1765 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1768 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1776 # ===================================================================
1777 # IDENTD auth settings
1778 # ===================================================================
1780 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1783 <table width='100%'>
1785 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1788 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1789 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1790 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1791 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1794 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1795 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1800 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1801 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1804 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1807 if (! $proxysettings { 'IDENT_HOSTS' }) {
1808 print " $green_cidr \n " ;
1809 if ( $netsettings { 'BLUE_DEV' }) {
1810 print " $blue_cidr \n " ;
1813 print $proxysettings { 'IDENT_HOSTS' };
1818 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1822 print $proxysettings { 'DST_NOAUTH' };
1829 <table width='100%'>
1831 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1834 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1835 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1836 <td width='25%'> </td>
1837 <td width='30%'> </td>
1840 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1841 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1842 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1843 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1846 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1847 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1850 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1854 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1856 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1858 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1862 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1864 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1871 # ===================================================================
1872 # NTLM auth settings
1873 # ===================================================================
1875 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) {
1878 <table width='100%'>
1880 <td colspan='6'><b> $Lang ::tr{'advproxy NTLM domain settings'}</b></td>
1883 <td class='base'> $Lang ::tr{'advproxy NTLM domain'}:</td>
1884 <td><input type='text' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}' size='15' /></td>
1885 <td class='base'> $Lang ::tr{'advproxy NTLM PDC hostname'}:</td>
1886 <td><input type='text' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}' size='14' /></td>
1887 <td class='base'> $Lang ::tr{'advproxy NTLM BDC hostname'}: <img src='/blob.gif' alt='*' /></td>
1888 <td><input type='text' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}' size='14' /></td>
1892 <table width='100%'>
1894 <td colspan='3'><b> $Lang ::tr{'advproxy NTLM auth mode'}</b></td>
1897 <td width='25%' class='base' width='25%'> $Lang ::tr{'advproxy NTLM use integrated auth'}:</td>
1898 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked {'NTLM_ENABLE_INT_AUTH'}{'on'} /></td>
1903 <table width='100%'>
1905 <td colspan='4'><b> $Lang ::tr{'advproxy NTLM user based access restrictions'}</b></td>
1908 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1909 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked {'NTLM_ENABLE_ACL'}{'on'} /></td>
1910 <td width='25%'> </td>
1911 <td width='30%'> </td>
1914 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked {'NTLM_USER_ACL'}{'positive'} />
1915 $Lang ::tr{'advproxy NTLM use positive access list'}:</td>
1916 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked {'NTLM_USER_ACL'}{'negative'} />
1917 $Lang ::tr{'advproxy NTLM use negative access list'}:</td>
1920 <td colspan='2'> $Lang ::tr{'advproxy NTLM authorized users'}</td>
1921 <td colspan='2'> $Lang ::tr{'advproxy NTLM unauthorized users'}</td>
1924 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1928 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_ALLOW_USERS' }; }
1930 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1932 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
1936 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_DENY_USERS' }; }
1938 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1945 # ===================================================================
1946 # LDAP auth settings
1947 # ===================================================================
1949 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1952 <table width='100%'>
1954 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1957 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1958 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1959 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1960 <td class='base'><select name='LDAP_TYPE'>
1961 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1962 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1963 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1964 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1968 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1969 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1970 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1971 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1975 <table width='100%'>
1977 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1980 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1981 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1982 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1983 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1987 <table width='100%'>
1989 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1992 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}: <img src='/blob.gif' alt='*' /></td>
1993 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
2001 # ===================================================================
2002 # RADIUS auth settings
2003 # ===================================================================
2005 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
2008 <table width='100%'>
2010 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
2013 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
2014 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
2015 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
2016 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
2019 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}: <img src='/blob.gif' alt='*' /></td>
2020 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
2021 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
2022 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
2026 <table width='100%'>
2028 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
2031 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
2032 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
2033 <td width='25%'> </td>
2034 <td width='30%'> </td>
2037 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
2038 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
2039 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
2040 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
2043 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
2044 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2047 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2051 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2053 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2055 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2059 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2061 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2068 # ===================================================================
2074 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2076 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2077 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2078 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2079 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2080 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2081 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2082 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2086 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2088 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2089 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2090 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2091 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2092 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2096 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2098 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2099 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2103 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2105 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2106 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2107 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2108 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2109 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2110 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2111 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2115 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2117 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2118 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2119 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2120 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2121 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2122 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2123 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2127 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )) {
2129 <td><input type='hidden' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}'></td>
2130 <td><input type='hidden' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}'></td>
2131 <td><input type='hidden' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}'></td>
2132 <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value=' $proxysettings {'NTLM_ENABLE_INT_AUTH'}'></td>
2133 <td><input type='hidden' name='NTLM_ENABLE_ACL' value=' $proxysettings {'NTLM_ENABLE_ACL'}'></td>
2134 <td><input type='hidden' name='NTLM_USER_ACL' value=' $proxysettings {'NTLM_USER_ACL'}'></td>
2135 <td><input type='hidden' name='NTLM_ALLOW_USERS' value=' $proxysettings {'NTLM_ALLOW_USERS'}'></td>
2136 <td><input type='hidden' name='NTLM_DENY_USERS' value=' $proxysettings {'NTLM_DENY_USERS'}'></td>
2140 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2142 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2143 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2144 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2145 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2146 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2147 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2148 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2149 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2161 <table width='100%'>
2164 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2165 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2166 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2167 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2173 <table width='100%'>
2175 <td><img src='/blob.gif' align='top' alt='*' />
2176 <font class='base'> $Lang ::tr{'this field may be blank'}</font>
2178 <td align='right'> </td>
2185 & Header
:: closebox
();
2189 # ===================================================================
2190 # NCSA user management
2191 # ===================================================================
2193 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2195 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2196 <table width='100%'>
2198 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2201 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2202 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2205 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly " ; }
2208 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2210 <select name='NCSA_GROUP'>
2211 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2212 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2213 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2219 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2220 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2221 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2222 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2229 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2230 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2231 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2234 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2235 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2241 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2246 <table width='100%'>
2248 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2251 <table width='100%' align='center'>
2257 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2258 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2262 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2263 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2267 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2268 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2271 @userlist = sort ( @userlist );
2273 # If the password file contains entries, print entries and action icons
2275 if ( ! - z
" $userdb " ) {
2278 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2279 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2280 <td class='boldbase' colspan='2' align='center'> </td>
2285 foreach $line ( @userlist )
2289 @temp = split ( /:/ , $line );
2290 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2291 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2293 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2295 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2298 <td align='center'> $temp [0]</td>
2302 if ( $temp [ 1 ] eq 'standard' ) {
2303 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2304 } elsif ( $temp [ 1 ] eq 'extended' ) {
2305 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2306 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2307 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2310 <td width='8%' align='center'>
2311 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2312 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2313 <input type='hidden' name='ID' value=' $line ' />
2314 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2318 <td width='8%' align='center'>
2319 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2320 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2321 <input type='hidden' name='ID' value=' $temp [0]' />
2322 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2335 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2336 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2337 <td class='base'> $Lang ::tr{'edit'}</td>
2338 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2339 <td class='base'> $Lang ::tr{'remove'}</td>
2346 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2357 & Header
:: closebox
();
2361 # ===================================================================
2363 & Header
:: closebigbox
();
2365 & Header
:: closepage
();
2367 # -------------------------------------------------------------------
2371 if (- e
" $acl_src_subnets " ) {
2372 open ( FILE
, " $acl_src_subnets " );
2373 delete $proxysettings { 'SRC_SUBNETS' };
2374 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2377 if (- e
" $acl_src_banned_ip " ) {
2378 open ( FILE
, " $acl_src_banned_ip " );
2379 delete $proxysettings { 'SRC_BANNED_IP' };
2380 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2383 if (- e
" $acl_src_banned_mac " ) {
2384 open ( FILE
, " $acl_src_banned_mac " );
2385 delete $proxysettings { 'SRC_BANNED_MAC' };
2386 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2389 if (- e
" $acl_src_unrestricted_ip " ) {
2390 open ( FILE
, " $acl_src_unrestricted_ip " );
2391 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2392 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2395 if (- e
" $acl_src_unrestricted_mac " ) {
2396 open ( FILE
, " $acl_src_unrestricted_mac " );
2397 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2398 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2401 if (- e
" $acl_dst_nocache " ) {
2402 open ( FILE
, " $acl_dst_nocache " );
2403 delete $proxysettings { 'DST_NOCACHE' };
2404 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2407 if (- e
" $acl_dst_noauth " ) {
2408 open ( FILE
, " $acl_dst_noauth " );
2409 delete $proxysettings { 'DST_NOAUTH' };
2410 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2413 if (- e
" $acl_ports_safe " ) {
2414 open ( FILE
, " $acl_ports_safe " );
2415 delete $proxysettings { 'PORTS_SAFE' };
2416 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2419 if (- e
" $acl_ports_ssl " ) {
2420 open ( FILE
, " $acl_ports_ssl " );
2421 delete $proxysettings { 'PORTS_SSL' };
2422 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2425 if (- e
" $mimetypes " ) {
2426 open ( FILE
, " $mimetypes " );
2427 delete $proxysettings { 'MIME_TYPES' };
2428 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2431 if (- e
" $ntlmdir /msntauth.allowusers" ) {
2432 open ( FILE
, " $ntlmdir /msntauth.allowusers" );
2433 delete $proxysettings { 'NTLM_ALLOW_USERS' };
2434 while (< FILE
>) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ };
2437 if (- e
" $ntlmdir /msntauth.denyusers" ) {
2438 open ( FILE
, " $ntlmdir /msntauth.denyusers" );
2439 delete $proxysettings { 'NTLM_DENY_USERS' };
2440 while (< FILE
>) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ };
2443 if (- e
" $raddir /radauth.allowusers" ) {
2444 open ( FILE
, " $raddir /radauth.allowusers" );
2445 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2446 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2449 if (- e
" $raddir /radauth.denyusers" ) {
2450 open ( FILE
, " $raddir /radauth.denyusers" );
2451 delete $proxysettings { 'RADIUS_DENY_USERS' };
2452 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2455 if (- e
" $identdir /identauth.allowusers" ) {
2456 open ( FILE
, " $identdir /identauth.allowusers" );
2457 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2458 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2461 if (- e
" $identdir /identauth.denyusers" ) {
2462 open ( FILE
, " $identdir /identauth.denyusers" );
2463 delete $proxysettings { 'IDENT_DENY_USERS' };
2464 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2467 if (- e
" $identhosts " ) {
2468 open ( FILE
, " $identhosts " );
2469 delete $proxysettings { 'IDENT_HOSTS' };
2470 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2473 if (- e
" $cre_groups " ) {
2474 open ( FILE
, " $cre_groups " );
2475 delete $proxysettings { 'CRE_GROUPS' };
2476 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2479 if (- e
" $cre_svhosts " ) {
2480 open ( FILE
, " $cre_svhosts " );
2481 delete $proxysettings { 'CRE_SVHOSTS' };
2482 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2487 # -------------------------------------------------------------------
2491 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2492 undef $proxysettings { 'PORTS_SAFE' };
2495 s/^\s+//g ; s/\s+$//g ;
2499 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2501 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2502 @templist = split ( /-/ );
2503 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2504 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2508 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2509 undef $proxysettings { 'PORTS_SSL' };
2512 s/^\s+//g ; s/\s+$//g ;
2517 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2518 @templist = split ( /-/ );
2519 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2520 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2524 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2525 undef $proxysettings { 'DST_NOCACHE' };
2529 unless ( /^#/ ) { s/\s+//g ; }
2532 if ( /^\./ ) { $_ = '*' . $_ ; }
2533 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2537 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2538 undef $proxysettings { 'SRC_SUBNETS' };
2541 s/^\s+//g ; s/\s+$//g ;
2544 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2545 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2549 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2550 undef $proxysettings { 'SRC_BANNED_IP' };
2553 s/^\s+//g ; s/\s+$//g ;
2556 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2557 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2561 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2562 undef $proxysettings { 'SRC_BANNED_MAC' };
2565 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2568 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2569 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2573 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2574 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2577 s/^\s+//g ; s/\s+$//g ;
2580 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2581 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2585 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2586 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2589 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2592 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2593 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2597 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2598 undef $proxysettings { 'DST_NOAUTH' };
2602 unless ( /^#/ ) { s/\s+//g ; }
2605 if ( /^\./ ) { $_ = '*' . $_ ; }
2606 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2610 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2612 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2613 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2616 s/^\s+//g ; s/\s+$//g ;
2617 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2619 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2622 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2624 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2625 undef $proxysettings { 'NTLM_DENY_USERS' };
2628 s/^\s+//g ; s/\s+$//g ;
2629 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2631 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2634 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2636 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2637 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2640 s/^\s+//g ; s/\s+$//g ;
2641 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2643 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2646 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2648 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2649 undef $proxysettings { 'IDENT_DENY_USERS' };
2652 s/^\s+//g ; s/\s+$//g ;
2653 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2655 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2658 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2660 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2661 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2664 s/^\s+//g ; s/\s+$//g ;
2665 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2667 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2670 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2672 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2673 undef $proxysettings { 'RADIUS_DENY_USERS' };
2676 s/^\s+//g ; s/\s+$//g ;
2677 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2679 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2682 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2683 undef $proxysettings { 'IDENT_HOSTS' };
2686 s/^\s+//g ; s/\s+$//g ;
2689 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2690 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2694 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2695 undef $proxysettings { 'CRE_SVHOSTS' };
2698 s/^\s+//g ; s/\s+$//g ;
2701 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2702 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2707 # -------------------------------------------------------------------
2711 open ( FILE
, "> $acl_src_subnets " );
2713 if (! $proxysettings { 'SRC_SUBNETS' })
2715 print FILE
" $green_cidr \n " ;
2716 if ( $netsettings { 'BLUE_DEV' })
2718 print FILE
" $blue_cidr \n " ;
2720 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2723 open ( FILE
, "> $acl_src_banned_ip " );
2725 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2728 open ( FILE
, "> $acl_src_banned_mac " );
2730 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2733 open ( FILE
, "> $acl_src_unrestricted_ip " );
2735 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2738 open ( FILE
, "> $acl_src_unrestricted_mac " );
2740 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2743 open ( FILE
, "> $acl_dst_noauth " );
2745 print FILE
$proxysettings { 'DST_NOAUTH' };
2748 open ( FILE
, "> $acl_dst_noauth_net " );
2750 open ( FILE
, "> $acl_dst_noauth_dom " );
2752 open ( FILE
, "> $acl_dst_noauth_url " );
2755 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2763 open ( FILE
, ">> $acl_dst_noauth_dom " );
2768 elsif (& General
:: validipormask
( $_ ))
2770 open ( FILE
, ">> $acl_dst_noauth_net " );
2775 elsif ( /\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/ )
2777 open ( FILE
, ">> $acl_dst_noauth_net " );
2784 open ( FILE
, ">> $acl_dst_noauth_url " );
2786 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2792 open ( FILE
, "> $acl_dst_nocache " );
2794 print FILE
$proxysettings { 'DST_NOCACHE' };
2797 open ( FILE
, "> $acl_dst_nocache_net " );
2799 open ( FILE
, "> $acl_dst_nocache_dom " );
2801 open ( FILE
, "> $acl_dst_nocache_url " );
2804 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2812 open ( FILE
, ">> $acl_dst_nocache_dom " );
2817 elsif (& General
:: validipormask
( $_ ))
2819 open ( FILE
, ">> $acl_dst_nocache_net " );
2824 elsif ( /\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/ )
2826 open ( FILE
, ">> $acl_dst_nocache_net " );
2833 open ( FILE
, ">> $acl_dst_nocache_url " );
2835 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2841 open ( FILE
, "> $acl_ports_safe " );
2843 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2846 open ( FILE
, "> $acl_ports_ssl " );
2848 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2851 open ( FILE
, "> $acl_dst_throttle " );
2853 if ( $proxysettings { 'THROTTLE_BINARY' } eq 'on' )
2855 @temp = split ( /\|/ , $throttle_binary );
2856 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2858 if ( $proxysettings { 'THROTTLE_DSKIMG' } eq 'on' )
2860 @temp = split ( /\|/ , $throttle_dskimg );
2861 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2863 if ( $proxysettings { 'THROTTLE_MMEDIA' } eq 'on' )
2865 @temp = split ( /\|/ , $throttle_mmedia );
2866 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2868 if (- s
$throttled_urls )
2870 open ( URLFILE
, $throttled_urls );
2873 foreach ( @temp ) { print FILE
; }
2877 open ( FILE
, "> $mimetypes " );
2879 print FILE
$proxysettings { 'MIME_TYPES' };
2882 open ( FILE
, "> $ntlmdir /msntauth.allowusers" );
2884 print FILE
$proxysettings { 'NTLM_ALLOW_USERS' };
2887 open ( FILE
, "> $ntlmdir /msntauth.denyusers" );
2889 print FILE
$proxysettings { 'NTLM_DENY_USERS' };
2892 open ( FILE
, "> $raddir /radauth.allowusers" );
2894 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2897 open ( FILE
, "> $raddir /radauth.denyusers" );
2899 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2902 open ( FILE
, "> $identdir /identauth.allowusers" );
2904 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2907 open ( FILE
, "> $identdir /identauth.denyusers" );
2909 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2912 open ( FILE
, "> $identhosts " );
2914 print FILE
$proxysettings { 'IDENT_HOSTS' };
2917 open ( FILE
, "> $cre_groups " );
2919 print FILE
$proxysettings { 'CRE_GROUPS' };
2922 open ( FILE
, "> $cre_svhosts " );
2924 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2928 # -------------------------------------------------------------------
2932 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2934 print FILE
"function FindProxyForURL(url, host) \n " ;
2936 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2940 (isPlainHostName(host)) ||
2941 (dnsDomainIs(host, ". $mainsettings {'DOMAINNAME'}")) ||
2942 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2943 (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
2944 (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
2945 (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
2946 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2954 if ( $proxysettings { 'ENABLE' } eq 'on' )
2956 print FILE
"if ( \n " ;
2957 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2960 if (- e
" $acl_src_subnets " ) {
2961 open ( SUBNETS
, " $acl_src_subnets " );
2962 @templist = < SUBNETS
>;
2968 @temp = split ( /\/ /);
2970 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2971 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2975 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
2985 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2989 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
2991 print FILE
" \n else \n\n " ;
2993 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2997 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
2999 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3008 # -------------------------------------------------------------------
3015 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3016 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3017 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3018 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3020 $delaypools = 1 ; } else { $delaypools = 0 ;
3023 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3025 $authrealm = "IPFire Advanced Proxy Server" ;
3027 $authrealm = $proxysettings { 'AUTH_REALM' };
3030 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3031 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3033 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3035 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3038 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3039 # you make will be overwritten whenever you resave proxy settings using the
3042 # Instead, modify the file ' $acl_include ' and
3043 # then restart the proxy service using the web interface. Changes made to the
3044 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3046 shutdown_lifetime 5 seconds
3051 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3052 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) { print FILE
" transparent" }
3053 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3056 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3057 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3058 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) { print FILE
" transparent" }
3059 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3063 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3067 if (!- z
$acl_dst_nocache_dom ) {
3068 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3069 print FILE
"cache deny no_cache_domains \n " ;
3071 if (!- z
$acl_dst_nocache_net ) {
3072 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3073 print FILE
"cache deny no_cache_ipaddr \n " ;
3075 if (!- z
$acl_dst_nocache_url ) {
3076 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3077 print FILE
"cache deny no_cache_hosts \n " ;
3083 cache_effective_user squid
3084 cache_effective_group squid
3087 pid_filename /var/run/squid.pid
3089 cache_mem $proxysettings {'CACHE_MEM'} MB
3092 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3094 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3096 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3098 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3100 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3102 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3104 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3109 if ( $proxysettings { 'CACHE_SIZE' } ne '0' )
3111 print FILE
"cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256 \n\n " ;
3114 if ( $proxysettings { 'LOGGING' } eq 'on' )
3117 access_log /var/log/squid/access.log
3118 cache_log /var/log/squid/cache.log
3119 cache_store_log none
3122 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"useragent_log \/var\/log\/squid\/user_agent.log \n " ; }
3123 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3126 access_log /dev/null
3128 cache_store_log none
3137 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3139 print FILE
"forwarded_for on \n " ;
3141 print FILE
"forwarded_for off \n " ;
3143 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3145 print FILE
"via on \n " ;
3147 print FILE
"via off \n " ;
3151 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3153 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3155 print FILE
"auth_param basic program $authdir /ncsa_auth $userdb \n " ;
3156 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3157 print FILE
"auth_param basic realm $authrealm \n " ;
3158 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3159 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3162 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3164 print FILE
"auth_param basic utf8 on \n " ;
3165 print FILE
"auth_param basic program $authdir /squid_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3166 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3167 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3168 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3170 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3172 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3174 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3176 print FILE
" -u sAMAccountName -P" ;
3178 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3180 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3182 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3184 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3186 print FILE
" -u cn -P" ;
3188 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3190 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3192 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3194 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3196 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3197 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3198 print FILE
" -u uid -P" ;
3200 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3201 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3202 print FILE
"auth_param basic realm $authrealm \n " ;
3203 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3204 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3207 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
3209 if ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' )
3211 print FILE
"auth_param ntlm program $authdir /ntlm_smb_lm_auth $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_PDC'}" ;
3212 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print FILE
" \n " ; } else { print FILE
" $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_BDC'} \n " ; }
3213 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n " ;
3214 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3216 print FILE
"auth_param basic program $authdir /msnt_auth \n " ;
3217 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3218 print FILE
"auth_param basic realm $authrealm \n " ;
3219 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3220 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3222 open ( MSNTCONF
, "> $ntlmdir /msntauth.conf" );
3224 print MSNTCONF
"server $proxysettings {'NTLM_PDC'}" ;
3225 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print MSNTCONF
" $proxysettings {'NTLM_PDC'}" ; } else { print MSNTCONF
" $proxysettings {'NTLM_BDC'}" ; }
3226 print MSNTCONF
" $proxysettings {'NTLM_DOMAIN'} \n " ;
3227 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3229 if ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' )
3231 print MSNTCONF
"allowusers $ntlmdir /msntauth.allowusers \n " ;
3233 print MSNTCONF
"denyusers $ntlmdir /msntauth.denyusers \n " ;
3240 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3242 print FILE
"auth_param basic program $authdir /squid_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3243 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3244 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3245 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3246 print FILE
"auth_param basic realm $authrealm \n " ;
3247 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3248 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3252 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3253 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) && ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ))
3255 if ((!- z
" $ntlmdir /msntauth.allowusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
3257 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.allowusers \"\n " ;
3259 if ((!- z
" $ntlmdir /msntauth.denyusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
3261 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.denyusers \"\n " ;
3264 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3266 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3268 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3270 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3272 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3275 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3278 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3279 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3281 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3284 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3285 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3286 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3291 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3293 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3295 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3297 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3299 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3301 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3303 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3305 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3308 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3309 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3310 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3314 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3316 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
"acl with_allowed_useragents browser $browser_regexp \n\n " ; }
3318 print FILE
"acl within_timeframe time " ;
3319 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3320 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3321 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3322 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3323 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3324 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3325 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3326 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3327 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3328 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3329 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3331 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3332 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3337 acl localhost src 127.0.0.1/32
3340 open ( PORTS
, " $acl_ports_ssl " );
3345 foreach ( @temp ) { print FILE
"acl SSL_ports port $_ " ; }
3347 open ( PORTS
, " $acl_ports_safe " );
3352 foreach ( @temp ) { print FILE
"acl Safe_ports port $_ " ; }
3356 acl IPFire_http port $http_port
3357 acl IPFire_https port $https_port
3358 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3359 acl IPFire_networks src " $acl_src_subnets "
3360 acl IPFire_servers dst " $acl_src_subnets "
3361 acl IPFire_green_network src $green_cidr
3362 acl IPFire_green_servers dst $green_cidr
3365 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3366 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3367 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3368 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3369 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3370 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3372 acl CONNECT method CONNECT
3376 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3379 #Classroom extensions
3380 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3381 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3384 print FILE
"deny_info " ;
3385 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3387 print FILE
"ERR_ACCESS_DISABLED" ;
3389 print FILE
"ERR_ACCESS_DENIED" ;
3391 print FILE
" IPFire_no_access_ips \n " ;
3392 print FILE
"deny_info " ;
3393 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3395 print FILE
"ERR_ACCESS_DISABLED" ;
3397 print FILE
"ERR_ACCESS_DENIED" ;
3399 print FILE
" IPFire_no_access_mac \n " ;
3402 http_access deny IPFire_no_access_ips
3403 http_access deny IPFire_no_access_mac
3408 #Insert acl file and replace __VAR__ with correct values
3409 my $blue_net = '' ; #BLUE empty by default
3411 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3412 $blue_net = " $blue_cidr " ;
3413 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3415 if (!- z
$acl_include )
3417 open ( ACL
, " $acl_include " );
3418 print FILE
" \n #Start of custom includes \n\n " ;
3420 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3421 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3422 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3423 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3424 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3427 print FILE
" \n #End of custom includes \n " ;
3430 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3434 #local machine, no restriction
3435 http_access allow localhost
3437 #GUI admin if local machine connects
3438 http_access allow IPFire_ips IPFire_networks IPFire_http
3439 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3441 #Deny not web services
3442 http_access deny !Safe_ports
3443 http_access deny CONNECT !SSL_ports
3448 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3450 print FILE
"#Set ident ACLs \n " ;
3451 if (!- z
$identhosts )
3453 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3454 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3455 print FILE
"ident_lookup_access deny all \n " ;
3457 print FILE
"ident_lookup_access allow all \n " ;
3459 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3463 print FILE
"#Set download throttling \n " ;
3465 if ( $netsettings { 'BLUE_DEV' })
3467 print FILE
"delay_pools 2 \n " ;
3469 print FILE
"delay_pools 1 \n " ;
3472 print FILE
"delay_class 1 3 \n " ;
3473 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3475 print FILE
"delay_parameters 1 " ;
3476 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3480 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3482 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3485 print FILE
" -1/-1 " ;
3486 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3490 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3492 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3496 if ( $netsettings { 'BLUE_DEV' })
3498 print FILE
"delay_parameters 2 " ;
3499 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3503 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3505 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3507 print FILE
" -1/-1 " ;
3508 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3512 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3514 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3519 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3520 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3521 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3522 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3524 if ( $netsettings { 'BLUE_DEV' })
3526 print FILE
"delay_access 1 allow IPFire_green_network" ;
3527 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3529 print FILE
"delay_access 1 deny all \n " ;
3531 print FILE
"delay_access 1 allow all" ;
3532 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3536 if ( $netsettings { 'BLUE_DEV' })
3538 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3539 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3540 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3541 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3542 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3543 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3545 print FILE
"delay_access 2 deny all \n " ;
3548 print FILE
"delay_initial_bucket_level 100 \n " ;
3552 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3554 print FILE
"#Prevent internal proxy access to Green \n " ;
3555 print FILE
"http_access deny IPFire_green_servers !IPFire_green_network \n\n " ;
3558 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3560 print FILE
"#Prevent internal proxy access from Blue \n " ;
3561 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3562 print FILE
"http_access deny IPFire_blue_network IPFire_servers \n\n " ;
3566 #Set custom configured ACLs
3569 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3570 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3572 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3574 if (!- z
$acl_src_unrestricted_ip )
3576 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3577 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3578 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3580 if (!- z
$acl_src_unrestricted_mac )
3582 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3583 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3584 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3586 if (!- z
$acl_dst_noauth_net )
3588 print FILE
"http_access allow IPFire_networks" ;
3589 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3590 print FILE
" !within_timeframe" ;
3592 print FILE
" within_timeframe" ; }
3593 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3594 print FILE
" to_ipaddr_without_auth \n " ;
3596 if (!- z
$acl_dst_noauth_dom )
3598 print FILE
"http_access allow IPFire_networks" ;
3599 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3600 print FILE
" !within_timeframe" ;
3602 print FILE
" within_timeframe" ; }
3603 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3604 print FILE
" to_domains_without_auth \n " ;
3606 if (!- z
$acl_dst_noauth_url )
3608 print FILE
"http_access allow IPFire_networks" ;
3609 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3610 print FILE
" !within_timeframe" ;
3612 print FILE
" within_timeframe" ; }
3613 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3614 print FILE
" to_hosts_without_auth \n " ;
3618 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3620 print FILE
"http_access deny !for_inetusers" ;
3621 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3626 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3627 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3628 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3629 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3630 (!- z
" $identdir /identauth.denyusers" )
3633 print FILE
"http_access deny for_acl_users" ;
3634 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3638 if (!- z
$acl_src_unrestricted_ip )
3640 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3641 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3643 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3645 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3647 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3649 print FILE
" for_inetusers" ;
3651 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3653 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3655 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3657 print FILE
" for_acl_users" ;
3659 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3661 print FILE
" !for_acl_users" ;
3663 } else { print FILE
" for_inetusers" ; }
3665 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3667 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3669 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3671 print FILE
" for_acl_users" ;
3673 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3675 print FILE
" !for_acl_users" ;
3677 } else { print FILE
" for_inetusers" ; }
3683 if (!- z
$acl_src_unrestricted_mac )
3685 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3686 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3688 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3690 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3692 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3694 print FILE
" for_inetusers" ;
3696 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3698 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3700 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3702 print FILE
" for_acl_users" ;
3704 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3706 print FILE
" !for_acl_users" ;
3708 } else { print FILE
" for_inetusers" ; }
3710 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3712 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3714 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3716 print FILE
" for_acl_users" ;
3718 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3720 print FILE
" !for_acl_users" ;
3722 } else { print FILE
" for_inetusers" ; }
3728 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3730 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3731 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3736 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3737 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3738 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3739 ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) &&
3740 (!- z
" $ntlmdir /msntauth.denyusers" )
3744 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3745 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3746 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3747 (!- z
" $raddir /radauth.denyusers" )
3751 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3752 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3753 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3754 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3755 (!- z
" $identdir /identauth.denyusers" )
3759 print FILE
"http_access deny for_acl_users" ;
3760 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3764 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3766 print FILE
"http_access allow" ;
3767 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3768 print FILE
" !within_timeframe" ;
3770 print FILE
" within_timeframe" ; }
3771 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3772 print FILE
" !on_ident_aware_hosts \n " ;
3775 print FILE
"http_access allow IPFire_networks" ;
3778 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3779 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3780 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3781 ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) &&
3782 (!- z
" $ntlmdir /msntauth.allowusers" )
3786 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3787 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3788 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3789 (!- z
" $raddir /radauth.allowusers" )
3793 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3794 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3795 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3796 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3797 (!- z
" $identdir /identauth.allowusers" )
3801 print FILE
" for_acl_users" ;
3802 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3803 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3804 print FILE
" for_inetusers" ;
3806 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3808 print FILE
" !concurrent" ;
3810 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3811 print FILE
" !within_timeframe" ;
3813 print FILE
" within_timeframe" ; }
3814 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3817 print FILE
"http_access deny all \n\n " ;
3819 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3820 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3822 print FILE
"#Strip HTTP Header \n " ;
3824 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3826 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3827 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3829 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3831 print FILE
"request_header_access Via deny all \n " ;
3832 print FILE
"reply_header_access Via deny all \n " ;
3834 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3836 print FILE
"request_header_access User-Agent deny all \n " ;
3837 print FILE
"reply_header_access User-Agent deny all \n " ;
3839 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3841 print FILE
"request_header_access Referer deny all \n " ;
3842 print FILE
"reply_header_access Referer deny all \n " ;
3847 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3849 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3851 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3853 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3855 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3861 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3863 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3864 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3865 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3866 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3868 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3870 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3871 print FILE
"http_reply_access allow all \n\n " ;
3874 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3877 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3878 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3882 } else { print FILE
"cache deny all \n\n " ; }
3885 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3888 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3889 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3890 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3891 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3893 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3897 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3899 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3902 print FILE
"visible_hostname" ;
3903 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3905 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3907 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3910 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3911 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3914 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3916 # Write the parent proxy info, if needed.
3917 if ( $remotehost ne '' )
3919 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3921 # Enter authentication for the parent cache. Option format is
3922 # login=user:password ($proxy1='YES')
3923 # login=PASS ($proxy1='PASS')
3924 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3925 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3927 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3928 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3930 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3932 print FILE
" \n always_direct allow IPFire_ips \n " ;
3933 print FILE
"never_direct allow all \n\n " ;
3935 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3937 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3938 print FILE
"url_rewrite_children $proxysettings {'CHILDREN'} \n\n " ;
3941 # Include file with user defined settings.
3942 if (- e
"/etc/squid/squid.conf.local" ) {
3943 print FILE
"include /etc/squid/squid.conf.local \n " ;
3948 # -------------------------------------------------------------------
3952 my ( $str_user , $str_pass , $str_group ) = @_ ;
3953 my @groupmembers =();
3955 if ( $str_pass eq 'lEaVeAlOnE' )
3957 open ( FILE
, " $userdb " );
3958 @groupmembers = < FILE
>;
3960 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3961 & deluser
( $str_user );
3962 open ( FILE
, ">> $userdb " );
3964 print FILE
" $str_user $str_pass " ;
3967 & deluser
( $str_user );
3968 system ( "/usr/sbin/htpasswd -b $userdb $str_user $str_pass " );
3971 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3972 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3973 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3975 print FILE
" $str_user \n " ;
3981 # -------------------------------------------------------------------
3985 my ( $str_user ) = @_ ;
3987 my @groupmembers =();
3990 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
3993 open ( FILE
, " $groupfile " );
3994 @groupmembers = < FILE
>;
3996 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
3997 open ( FILE
, "> $groupfile " );
3999 print FILE
@templist ;
4004 open ( FILE
, " $userdb " );
4005 @groupmembers = < FILE
>;
4007 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4008 open ( FILE
, "> $userdb " );
4010 print FILE
@templist ;
4016 # -------------------------------------------------------------------
4020 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4022 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4023 print FILE
"localhost" ;
4028 # -------------------------------------------------------------------