]>
git.ipfire.org Git - people/teissler/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' }){
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 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
518 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
520 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
523 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
525 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
527 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
532 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
534 if ( $proxysettings { 'NTLM_DOMAIN' } eq '' )
536 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm domain' };
539 if ( $proxysettings { 'NTLM_PDC' } eq '' )
541 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm pdc' };
544 if (!& General
:: validhostname
( $proxysettings { 'NTLM_PDC' }))
546 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid pdc' };
549 if ((!( $proxysettings { 'NTLM_BDC' } eq '' )) && (!& General
:: validhostname
( $proxysettings { 'NTLM_BDC' })))
551 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid bdc' };
555 $proxysettings { 'NTLM_DOMAIN' } = lc ( $proxysettings { 'NTLM_DOMAIN' });
556 $proxysettings { 'NTLM_PDC' } = lc ( $proxysettings { 'NTLM_PDC' });
557 $proxysettings { 'NTLM_BDC' } = lc ( $proxysettings { 'NTLM_BDC' });
559 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
561 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
563 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
566 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
568 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
571 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
573 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
578 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
581 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
582 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
583 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
584 if (( $proxy1 ne $proxy2 ))
586 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
594 $proxysettings { 'VALID' } = 'no' ; }
596 $proxysettings { 'VALID' } = 'yes' ; }
598 if ( $proxysettings { 'VALID' } eq 'yes' )
602 delete $proxysettings { 'SRC_SUBNETS' };
603 delete $proxysettings { 'SRC_BANNED_IP' };
604 delete $proxysettings { 'SRC_BANNED_MAC' };
605 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
606 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
607 delete $proxysettings { 'DST_NOCACHE' };
608 delete $proxysettings { 'DST_NOAUTH' };
609 delete $proxysettings { 'PORTS_SAFE' };
610 delete $proxysettings { 'PORTS_SSL' };
611 delete $proxysettings { 'MIME_TYPES' };
612 delete $proxysettings { 'NTLM_ALLOW_USERS' };
613 delete $proxysettings { 'NTLM_DENY_USERS' };
614 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
615 delete $proxysettings { 'RADIUS_DENY_USERS' };
616 delete $proxysettings { 'IDENT_HOSTS' };
617 delete $proxysettings { 'IDENT_ALLOW_USERS' };
618 delete $proxysettings { 'IDENT_DENY_USERS' };
620 delete $proxysettings { 'CRE_GROUPS' };
621 delete $proxysettings { 'CRE_SVHOSTS' };
623 delete $proxysettings { 'NCSA_USERNAME' };
624 delete $proxysettings { 'NCSA_GROUP' };
625 delete $proxysettings { 'NCSA_PASS' };
626 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
628 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
629 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
630 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
631 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
632 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
633 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
634 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
636 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
637 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
639 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
641 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
642 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
643 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
644 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
645 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
646 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
647 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
648 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
649 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
654 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
656 system ( '/usr/local/bin/squidctrl' , 'disable' );
657 unlink "${General::swroot}/proxy/enable" ;
658 unlink "${General::swroot}/proxy/transparent" ;
659 unlink "${General::swroot}/proxy/enable_blue" ;
660 unlink "${General::swroot}/proxy/transparent_blue" ;
662 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
663 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
664 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
665 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
666 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
667 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
668 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
669 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
670 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
671 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
673 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
674 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { system ( '/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1' ); }
678 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
680 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
685 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
686 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
687 } elsif (- e
"${General::swroot}/proxy/settings" ) {
688 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
693 $checked { 'ENABLE' }{ 'off' } = '' ;
694 $checked { 'ENABLE' }{ 'on' } = '' ;
695 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
697 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
698 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
699 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
701 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
702 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
703 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
705 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
706 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
707 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
709 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
710 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
711 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
713 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
714 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
715 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
716 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
717 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
718 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
719 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
720 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
721 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
722 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
723 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
724 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
726 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
727 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
728 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
729 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
730 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
731 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
733 $checked { 'LOGGING' }{ 'off' } = '' ;
734 $checked { 'LOGGING' }{ 'on' } = '' ;
735 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
736 $checked { 'CACHEMGR' }{ 'off' } = '' ;
737 $checked { 'CACHEMGR' }{ 'on' } = '' ;
738 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
739 $checked { 'LOGQUERY' }{ 'off' } = '' ;
740 $checked { 'LOGQUERY' }{ 'on' } = '' ;
741 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
742 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
743 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
744 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
746 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
747 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
749 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
750 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
751 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
752 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
753 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
754 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
756 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
757 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
758 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
760 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
761 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
762 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
763 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
764 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
766 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
767 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
768 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
769 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
770 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
771 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
772 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
774 $checked { 'TIME_MON' }{ 'off' } = '' ;
775 $checked { 'TIME_MON' }{ 'on' } = '' ;
776 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
777 $checked { 'TIME_TUE' }{ 'off' } = '' ;
778 $checked { 'TIME_TUE' }{ 'on' } = '' ;
779 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
780 $checked { 'TIME_WED' }{ 'off' } = '' ;
781 $checked { 'TIME_WED' }{ 'on' } = '' ;
782 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
783 $checked { 'TIME_THU' }{ 'off' } = '' ;
784 $checked { 'TIME_THU' }{ 'on' } = '' ;
785 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
786 $checked { 'TIME_FRI' }{ 'off' } = '' ;
787 $checked { 'TIME_FRI' }{ 'on' } = '' ;
788 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
789 $checked { 'TIME_SAT' }{ 'off' } = '' ;
790 $checked { 'TIME_SAT' }{ 'on' } = '' ;
791 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
792 $checked { 'TIME_SUN' }{ 'off' } = '' ;
793 $checked { 'TIME_SUN' }{ 'on' } = '' ;
794 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
796 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
797 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
798 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
799 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
801 $checked { 'THROTTLE_BINARY' }{ 'off' } = '' ;
802 $checked { 'THROTTLE_BINARY' }{ 'on' } = '' ;
803 $checked { 'THROTTLE_BINARY' }{ $proxysettings { 'THROTTLE_BINARY' }} = "checked='checked'" ;
804 $checked { 'THROTTLE_DSKIMG' }{ 'off' } = '' ;
805 $checked { 'THROTTLE_DSKIMG' }{ 'on' } = '' ;
806 $checked { 'THROTTLE_DSKIMG' }{ $proxysettings { 'THROTTLE_DSKIMG' }} = "checked='checked'" ;
807 $checked { 'THROTTLE_MMEDIA' }{ 'off' } = '' ;
808 $checked { 'THROTTLE_MMEDIA' }{ 'on' } = '' ;
809 $checked { 'THROTTLE_MMEDIA' }{ $proxysettings { 'THROTTLE_MMEDIA' }} = "checked='checked'" ;
811 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
812 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
813 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
815 $checked { 'ENABLE_BROWSER_CHECK' }{ 'off' } = '' ;
816 $checked { 'ENABLE_BROWSER_CHECK' }{ 'on' } = '' ;
817 $checked { 'ENABLE_BROWSER_CHECK' }{ $proxysettings { 'ENABLE_BROWSER_CHECK' }} = "checked='checked'" ;
819 foreach ( @useragentlist ) {
820 @useragent = split ( /,/ );
821 $checked { 'UA_' . $useragent [ 0 ]}{ 'off' } = '' ;
822 $checked { 'UA_' . $useragent [ 0 ]}{ 'on' } = '' ;
823 $checked { 'UA_' . $useragent [ 0 ]}{ $proxysettings { 'UA_' . $useragent [ 0 ]}} = "checked='checked'" ;
826 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
827 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
828 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
829 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
830 $checked { 'AUTH_METHOD' }{ 'ntlm' } = '' ;
831 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
832 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
834 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
836 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
837 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
838 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
840 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
841 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
842 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
844 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
846 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
848 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
850 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
851 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
852 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
854 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
855 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
856 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
858 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
859 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
860 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
862 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
863 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
864 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
866 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
867 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
868 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
870 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
871 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
872 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
874 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
875 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
876 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
878 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
879 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
880 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
882 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
883 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
884 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
886 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
887 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
888 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
890 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
891 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
892 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
894 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
896 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
899 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
900 print "<font class='base'> $errormessage </font> \n " ;
904 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
906 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
907 $squidversion [ 0 ] =~ s/^\s+//g ;
908 $squidversion [ 0 ] =~ s/\s+$//g ;
910 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
913 # ===================================================================
915 # ===================================================================
917 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
919 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
921 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
926 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
929 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
930 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
931 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}:</td>
932 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
935 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
936 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
937 <td class='base'> $Lang ::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
938 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
943 if ( $netsettings { 'BLUE_DEV' }) {
944 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
945 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
947 print "<td colspan='2'> </td>" ;
950 <td colspan='2'> </td>
955 if ( $netsettings { 'BLUE_DEV' }) {
956 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
957 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
959 print "<td colspan='2'> </td>" ;
962 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
964 <select name='ERR_LANGUAGE'>
967 foreach (< $errordir /*>) {
969 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
970 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
978 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
979 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
980 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
981 <td class='base'><select name='ERR_DESIGN'>
982 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
983 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
987 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
988 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
995 <tr><td class='base' colspan='4'><b> $Lang ::tr{'advproxy redirector children'}</b></td></tr>
996 <tr><td class='base' > $Lang ::tr{'processes'}<input type='text' name='CHILDREN' value=' $proxysettings {'CHILDREN'}' size='5' /></td>
999 my $count = `ip n| wc -l` ;
1000 if ( $count < 1 ){ $count = 1 ;}
1001 if ( - e
"/usr/bin/squidclamav" ) {
1002 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
1003 if ( ! - e
"/var/run/clamav/clamd.pid" ){
1004 print "<font color='red'>clamav not running</font><br /><br />" ;
1005 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
1008 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
1009 print "+ " . int (( $count **( 1 / 3 )) * 8 );}
1014 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</b><br />" ;
1015 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
1016 print "+ " . int (( $count **( 1 / 3 )) * 6 );
1018 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</b><br />" ;
1019 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1020 print "+ " . int (( $count **( 1 / 3 )) * 5 );
1025 <table width='100%'>
1027 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1030 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1031 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1032 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'} <img src='/blob.gif' alt='*' /></td>
1033 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1036 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1037 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1038 <td class='base'> $Lang ::tr{'advproxy upstream username'}: <img src='/blob.gif' alt='*' /></td>
1039 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1042 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1043 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1044 <td class='base'> $Lang ::tr{'advproxy upstream password'}: <img src='/blob.gif' alt='*' /></td>
1045 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1048 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1049 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1055 <table width='100%'>
1057 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1060 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1061 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1062 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1063 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1068 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1069 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1073 <table width='100%'>
1075 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1078 <td class='base'> $Lang ::tr{'proxy cachemgr'}:</td>
1079 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1080 <td class='base'> $Lang ::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td>
1081 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1084 <td class='base'> $Lang ::tr{'proxy filedescriptors'}:</td>
1085 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1086 <td class='base'> $Lang ::tr{'proxy admin password'}: <img src='/blob.gif' alt='*' /></td>
1087 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1090 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1093 <td class='base'> $Lang ::tr{'advproxy ram cache size'}:</td>
1094 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1095 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}:</td>
1096 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1099 <td class='base'> $Lang ::tr{'advproxy min size'}:</td>
1100 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1101 <td class='base'> $Lang ::tr{'advproxy max size'}:</td>
1102 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1105 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1106 <td class='base'><select name='L1_DIRS'>
1107 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1108 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1109 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1110 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1111 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1113 <td colspan='2' rowspan= '5' valign='top' class='base'>
1114 <table cellspacing='0' cellpadding='0'>
1116 <!-- intentionally left empty -->
1119 <td> $Lang ::tr{'advproxy no cache sites'}: <img src='/blob.gif' alt='*' /></td>
1122 <!-- intentionally left empty -->
1125 <!-- intentionally left empty -->
1128 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1132 print $proxysettings { 'DST_NOCACHE' };
1141 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1142 <td class='base'><select name='MEM_POLICY'>
1143 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1144 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1145 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1146 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1150 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1151 <td class='base'><select name='CACHE_POLICY'>
1152 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1153 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1154 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1155 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1159 <td colspan='2'> </td>
1162 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1163 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1167 <table width='100%'>
1169 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1172 <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
1175 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}:</td>
1176 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}:</td>
1179 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1182 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1186 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1189 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1196 <table width='100%'>
1198 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1201 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1204 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}:</td>
1207 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1211 if (! $proxysettings { 'SRC_SUBNETS' })
1213 print " $green_cidr \n " ;
1214 if ( $netsettings { 'BLUE_DEV' })
1216 print " $blue_cidr \n " ;
1218 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1225 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1226 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1227 print "<td class='base'> $line :</td> \n " ;
1229 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1233 if ( $netsettings { 'BLUE_DEV' }) {
1234 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1235 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1237 print "<td class='base'> $line :</td> \n " ;
1239 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1246 <td colspan='2'> </td>
1249 <td colspan='2'> </td>
1252 <table width='100%'>
1254 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1257 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}: <img src='/blob.gif' alt='*' /></td>
1258 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td>
1261 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1265 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1269 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1273 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1279 <table width='100%'>
1281 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1284 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}: <img src='/blob.gif' alt='*' /></td>
1285 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td>
1288 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1292 print $proxysettings { 'SRC_BANNED_IP' };
1296 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1300 print $proxysettings { 'SRC_BANNED_MAC' };
1311 # -------------------------------------------------------------------
1312 # CRE GUI - optional
1313 # -------------------------------------------------------------------
1315 if (- e
$cre_enabled ) { print <<END
1316 <table width='100%'>
1319 <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>
1322 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1328 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1330 <td class='base'> $Lang ::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td>
1331 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1334 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1335 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td>
1340 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1343 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1347 print $proxysettings { 'CRE_GROUPS' };
1351 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1354 print $proxysettings { 'CRE_SVHOSTS' };
1362 print "</table><hr size='1'>" ;
1366 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1367 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1368 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1373 # -------------------------------------------------------------------
1377 <table width='100%'>
1379 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1381 <table width='100%'>
1383 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1384 <td width='1%'> </td>
1385 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1386 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1387 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1388 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1389 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1390 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1391 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1392 <td width='1%'> </td>
1393 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1394 <td width='1%'> </td>
1395 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1400 <select name='TIME_ACCESS_MODE'>
1401 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1402 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1406 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1407 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1408 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1409 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1410 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1411 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1412 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1415 <select name='TIME_FROM_HOUR'>
1418 for ( $i = 0 ; $i <= 24 ; $i ++) {
1419 $_ = sprintf ( " %02s " , $i );
1420 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1427 <select name='TIME_FROM_MINUTE'>
1430 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1431 $_ = sprintf ( " %02s " , $i );
1432 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1439 <select name='TIME_TO_HOUR'>
1442 for ( $i = 0 ; $i <= 24 ; $i ++) {
1443 $_ = sprintf ( " %02s " , $i );
1444 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1451 <select name='TIME_TO_MINUTE'>
1454 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1455 $_ = sprintf ( " %02s " , $i );
1456 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1464 <table width='100%'>
1466 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1469 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}:</td>
1470 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1471 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}:</td>
1472 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1476 <table width='100%'>
1478 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1481 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1482 <td width='20%' class='base'>
1483 <select name='THROTTLING_GREEN_TOTAL'>
1487 foreach ( @throttle_limits ) {
1488 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1492 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1495 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1496 <td width='30%' class='base'>
1497 <select name='THROTTLING_GREEN_HOST'>
1501 foreach ( @throttle_limits ) {
1502 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1506 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1513 if ( $netsettings { 'BLUE_DEV' }) {
1516 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1518 <select name='THROTTLING_BLUE_TOTAL'>
1522 foreach ( @throttle_limits ) {
1523 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1527 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1530 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1532 <select name='THROTTLING_BLUE_HOST'>
1536 foreach ( @throttle_limits ) {
1537 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1541 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1551 <table width='100%'>
1553 <td colspan='4'><i> $Lang ::tr{'advproxy content based throttling'}:</i></td>
1556 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle binary'}:</td>
1557 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked {'THROTTLE_BINARY'}{'on'} /></td>
1558 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle dskimg'}:</td>
1559 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked {'THROTTLE_DSKIMG'}{'on'} /></td>
1560 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle mmedia'}:</td>
1561 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked {'THROTTLE_MMEDIA'}{'on'} /></td>
1562 <td width='15%'> </td>
1563 <td width='10%'> </td>
1567 <table width='100%'>
1569 <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>
1573 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1576 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td>
1581 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1585 print $proxysettings { 'MIME_TYPES' };
1599 <table width='100%'>
1601 <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>
1605 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ){
1611 if ( @useragentlist ) { print " $Lang ::tr{'advproxy allowed web browsers'}:" ; } else { print " $Lang ::tr{'advproxy no clients defined'}" ; }
1616 <table width='100%'>
1620 for ( $n = 0 ; $n <= @useragentlist ; $n = $n + $i ) {
1621 for ( $i = 0 ; $i <= 3 ; $i ++) {
1622 if ( $i eq 0 ) { print "<tr> \n " ; }
1623 if (( $n + $i ) < @useragentlist ) {
1624 @useragent = split ( /,/ , @useragentlist [ $n + $i ]);
1625 print "<td width='15%'> $useragent [1]:<\/td> \n " ;
1626 print "<td width='10%'><input type='checkbox' name='UA_ $useragent [0]' $checked {'UA_'. $useragent [0]}{'on'} /></td> \n " ;
1628 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1635 <table width='100%'>
1637 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1640 <td class='base'> $Lang ::tr{'advproxy fake useragent'}: <img src='/blob.gif' alt='*' /></td>
1641 <td class='base'> $Lang ::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td>
1644 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='56' /></td>
1645 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='56' /></td>
1653 <table width='100%'>
1655 <td colspan='5'><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1658 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked {'AUTH_METHOD'}{'none'} /> $Lang ::tr{'advproxy AUTH method none'}</td>
1659 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked {'AUTH_METHOD'}{'ncsa'} /> $Lang ::tr{'advproxy AUTH method ncsa'}</td>
1660 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked {'AUTH_METHOD'}{'ident'} /> $Lang ::tr{'advproxy AUTH method ident'}</td>
1661 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked {'AUTH_METHOD'}{'ldap'} /> $Lang ::tr{'advproxy AUTH method ldap'}</td>
1662 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked {'AUTH_METHOD'}{'ntlm'} /> $Lang ::tr{'advproxy AUTH method ntlm'}</td>
1663 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked {'AUTH_METHOD'}{'radius'} /> $Lang ::tr{'advproxy AUTH method radius'}</td>
1669 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1671 <table width='100%'>
1673 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1676 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1679 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1680 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1681 <td colspan='2' rowspan= '6' valign='top' class='base'>
1682 <table cellpadding='0' cellspacing='0'>
1684 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}: <img src='/blob.gif' alt='*' /></td>
1687 <!-- intentionally left empty -->
1690 <!-- intentionally left empty -->
1693 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1696 <!-- intentionally left empty -->
1699 <!-- intentionally left empty -->
1702 <td> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1705 <!-- intentionally left empty -->
1708 <!-- intentionally left empty -->
1711 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1715 print $proxysettings { 'DST_NOAUTH' };
1724 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1725 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1728 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}: <img src='/blob.gif' alt='*' /></td>
1729 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1732 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1733 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1736 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1737 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1740 <td colspan='2'> </td>
1747 # ===================================================================
1748 # NCSA auth settings
1749 # ===================================================================
1751 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1754 <table width='100%'>
1756 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1759 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1760 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1761 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1762 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1765 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1773 # ===================================================================
1774 # IDENTD auth settings
1775 # ===================================================================
1777 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1780 <table width='100%'>
1782 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1785 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1786 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1787 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1788 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1791 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1792 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1797 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1798 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1801 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1804 if (! $proxysettings { 'IDENT_HOSTS' }) {
1805 print " $green_cidr \n " ;
1806 if ( $netsettings { 'BLUE_DEV' }) {
1807 print " $blue_cidr \n " ;
1810 print $proxysettings { 'IDENT_HOSTS' };
1815 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1819 print $proxysettings { 'DST_NOAUTH' };
1826 <table width='100%'>
1828 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1831 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1832 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1833 <td width='25%'> </td>
1834 <td width='30%'> </td>
1837 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1838 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1839 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1840 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1843 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1844 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1847 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1851 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1853 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1855 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1859 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1861 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1868 # ===================================================================
1869 # NTLM auth settings
1870 # ===================================================================
1872 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) {
1875 <table width='100%'>
1877 <td colspan='6'><b> $Lang ::tr{'advproxy NTLM domain settings'}</b></td>
1880 <td class='base'> $Lang ::tr{'advproxy NTLM domain'}:</td>
1881 <td><input type='text' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}' size='15' /></td>
1882 <td class='base'> $Lang ::tr{'advproxy NTLM PDC hostname'}:</td>
1883 <td><input type='text' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}' size='14' /></td>
1884 <td class='base'> $Lang ::tr{'advproxy NTLM BDC hostname'}: <img src='/blob.gif' alt='*' /></td>
1885 <td><input type='text' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}' size='14' /></td>
1889 <table width='100%'>
1891 <td colspan='3'><b> $Lang ::tr{'advproxy NTLM auth mode'}</b></td>
1894 <td width='25%' class='base' width='25%'> $Lang ::tr{'advproxy NTLM use integrated auth'}:</td>
1895 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked {'NTLM_ENABLE_INT_AUTH'}{'on'} /></td>
1900 <table width='100%'>
1902 <td colspan='4'><b> $Lang ::tr{'advproxy NTLM user based access restrictions'}</b></td>
1905 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1906 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked {'NTLM_ENABLE_ACL'}{'on'} /></td>
1907 <td width='25%'> </td>
1908 <td width='30%'> </td>
1911 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked {'NTLM_USER_ACL'}{'positive'} />
1912 $Lang ::tr{'advproxy NTLM use positive access list'}:</td>
1913 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked {'NTLM_USER_ACL'}{'negative'} />
1914 $Lang ::tr{'advproxy NTLM use negative access list'}:</td>
1917 <td colspan='2'> $Lang ::tr{'advproxy NTLM authorized users'}</td>
1918 <td colspan='2'> $Lang ::tr{'advproxy NTLM unauthorized users'}</td>
1921 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1925 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_ALLOW_USERS' }; }
1927 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1929 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
1933 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_DENY_USERS' }; }
1935 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1942 # ===================================================================
1943 # LDAP auth settings
1944 # ===================================================================
1946 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1949 <table width='100%'>
1951 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1954 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1955 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1956 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1957 <td class='base'><select name='LDAP_TYPE'>
1958 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1959 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1960 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1961 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1965 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1966 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1967 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1968 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1972 <table width='100%'>
1974 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1977 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1978 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1979 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1980 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1984 <table width='100%'>
1986 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1989 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}: <img src='/blob.gif' alt='*' /></td>
1990 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1998 # ===================================================================
1999 # RADIUS auth settings
2000 # ===================================================================
2002 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
2005 <table width='100%'>
2007 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
2010 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
2011 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
2012 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
2013 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
2016 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}: <img src='/blob.gif' alt='*' /></td>
2017 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
2018 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
2019 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
2023 <table width='100%'>
2025 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
2028 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
2029 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
2030 <td width='25%'> </td>
2031 <td width='30%'> </td>
2034 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
2035 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
2036 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
2037 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
2040 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
2041 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2044 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2048 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2050 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2052 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2056 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2058 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2065 # ===================================================================
2071 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2073 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2074 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2075 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2076 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2077 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2078 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2079 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2083 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2085 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2086 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2087 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2088 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2089 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2093 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2095 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2096 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2100 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2102 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2103 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2104 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2105 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2106 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2107 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2108 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2112 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2114 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2115 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2116 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2117 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2118 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2119 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2120 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2124 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )) {
2126 <td><input type='hidden' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}'></td>
2127 <td><input type='hidden' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}'></td>
2128 <td><input type='hidden' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}'></td>
2129 <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value=' $proxysettings {'NTLM_ENABLE_INT_AUTH'}'></td>
2130 <td><input type='hidden' name='NTLM_ENABLE_ACL' value=' $proxysettings {'NTLM_ENABLE_ACL'}'></td>
2131 <td><input type='hidden' name='NTLM_USER_ACL' value=' $proxysettings {'NTLM_USER_ACL'}'></td>
2132 <td><input type='hidden' name='NTLM_ALLOW_USERS' value=' $proxysettings {'NTLM_ALLOW_USERS'}'></td>
2133 <td><input type='hidden' name='NTLM_DENY_USERS' value=' $proxysettings {'NTLM_DENY_USERS'}'></td>
2137 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2139 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2140 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2141 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2142 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2143 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2144 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2145 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2146 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2158 <table width='100%'>
2161 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2162 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2163 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2164 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2170 <table width='100%'>
2172 <td><img src='/blob.gif' align='top' alt='*' />
2173 <font class='base'> $Lang ::tr{'this field may be blank'}</font>
2175 <td align='right'> </td>
2182 & Header
:: closebox
();
2186 # ===================================================================
2187 # NCSA user management
2188 # ===================================================================
2190 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2192 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2193 <table width='100%'>
2195 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2198 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2199 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2202 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly " ; }
2205 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2207 <select name='NCSA_GROUP'>
2208 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2209 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2210 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2216 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2217 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2218 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2219 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2226 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2227 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2228 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2231 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2232 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2238 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2243 <table width='100%'>
2245 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2248 <table width='100%' align='center'>
2254 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2255 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2259 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2260 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2264 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2265 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2268 @userlist = sort ( @userlist );
2270 # If the password file contains entries, print entries and action icons
2272 if ( ! - z
" $userdb " ) {
2275 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2276 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2277 <td class='boldbase' colspan='2' align='center'> </td>
2282 foreach $line ( @userlist )
2286 @temp = split ( /:/ , $line );
2287 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2288 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2290 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2292 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2295 <td align='center'> $temp [0]</td>
2299 if ( $temp [ 1 ] eq 'standard' ) {
2300 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2301 } elsif ( $temp [ 1 ] eq 'extended' ) {
2302 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2303 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2304 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2307 <td width='8%' align='center'>
2308 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2309 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2310 <input type='hidden' name='ID' value=' $line ' />
2311 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2315 <td width='8%' align='center'>
2316 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2317 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2318 <input type='hidden' name='ID' value=' $temp [0]' />
2319 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2332 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2333 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2334 <td class='base'> $Lang ::tr{'edit'}</td>
2335 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2336 <td class='base'> $Lang ::tr{'remove'}</td>
2343 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2354 & Header
:: closebox
();
2358 # ===================================================================
2360 & Header
:: closebigbox
();
2362 & Header
:: closepage
();
2364 # -------------------------------------------------------------------
2368 if (- e
" $acl_src_subnets " ) {
2369 open ( FILE
, " $acl_src_subnets " );
2370 delete $proxysettings { 'SRC_SUBNETS' };
2371 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2374 if (- e
" $acl_src_banned_ip " ) {
2375 open ( FILE
, " $acl_src_banned_ip " );
2376 delete $proxysettings { 'SRC_BANNED_IP' };
2377 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2380 if (- e
" $acl_src_banned_mac " ) {
2381 open ( FILE
, " $acl_src_banned_mac " );
2382 delete $proxysettings { 'SRC_BANNED_MAC' };
2383 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2386 if (- e
" $acl_src_unrestricted_ip " ) {
2387 open ( FILE
, " $acl_src_unrestricted_ip " );
2388 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2389 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2392 if (- e
" $acl_src_unrestricted_mac " ) {
2393 open ( FILE
, " $acl_src_unrestricted_mac " );
2394 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2395 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2398 if (- e
" $acl_dst_nocache " ) {
2399 open ( FILE
, " $acl_dst_nocache " );
2400 delete $proxysettings { 'DST_NOCACHE' };
2401 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2404 if (- e
" $acl_dst_noauth " ) {
2405 open ( FILE
, " $acl_dst_noauth " );
2406 delete $proxysettings { 'DST_NOAUTH' };
2407 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2410 if (- e
" $acl_ports_safe " ) {
2411 open ( FILE
, " $acl_ports_safe " );
2412 delete $proxysettings { 'PORTS_SAFE' };
2413 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2416 if (- e
" $acl_ports_ssl " ) {
2417 open ( FILE
, " $acl_ports_ssl " );
2418 delete $proxysettings { 'PORTS_SSL' };
2419 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2422 if (- e
" $mimetypes " ) {
2423 open ( FILE
, " $mimetypes " );
2424 delete $proxysettings { 'MIME_TYPES' };
2425 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2428 if (- e
" $ntlmdir /msntauth.allowusers" ) {
2429 open ( FILE
, " $ntlmdir /msntauth.allowusers" );
2430 delete $proxysettings { 'NTLM_ALLOW_USERS' };
2431 while (< FILE
>) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ };
2434 if (- e
" $ntlmdir /msntauth.denyusers" ) {
2435 open ( FILE
, " $ntlmdir /msntauth.denyusers" );
2436 delete $proxysettings { 'NTLM_DENY_USERS' };
2437 while (< FILE
>) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ };
2440 if (- e
" $raddir /radauth.allowusers" ) {
2441 open ( FILE
, " $raddir /radauth.allowusers" );
2442 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2443 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2446 if (- e
" $raddir /radauth.denyusers" ) {
2447 open ( FILE
, " $raddir /radauth.denyusers" );
2448 delete $proxysettings { 'RADIUS_DENY_USERS' };
2449 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2452 if (- e
" $identdir /identauth.allowusers" ) {
2453 open ( FILE
, " $identdir /identauth.allowusers" );
2454 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2455 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2458 if (- e
" $identdir /identauth.denyusers" ) {
2459 open ( FILE
, " $identdir /identauth.denyusers" );
2460 delete $proxysettings { 'IDENT_DENY_USERS' };
2461 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2464 if (- e
" $identhosts " ) {
2465 open ( FILE
, " $identhosts " );
2466 delete $proxysettings { 'IDENT_HOSTS' };
2467 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2470 if (- e
" $cre_groups " ) {
2471 open ( FILE
, " $cre_groups " );
2472 delete $proxysettings { 'CRE_GROUPS' };
2473 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2476 if (- e
" $cre_svhosts " ) {
2477 open ( FILE
, " $cre_svhosts " );
2478 delete $proxysettings { 'CRE_SVHOSTS' };
2479 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2484 # -------------------------------------------------------------------
2488 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2489 undef $proxysettings { 'PORTS_SAFE' };
2492 s/^\s+//g ; s/\s+$//g ;
2496 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2498 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2499 @templist = split ( /-/ );
2500 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2501 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2505 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2506 undef $proxysettings { 'PORTS_SSL' };
2509 s/^\s+//g ; s/\s+$//g ;
2514 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2515 @templist = split ( /-/ );
2516 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2517 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2521 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2522 undef $proxysettings { 'DST_NOCACHE' };
2526 unless ( /^#/ ) { s/\s+//g ; }
2529 if ( /^\./ ) { $_ = '*' . $_ ; }
2530 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2534 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2535 undef $proxysettings { 'SRC_SUBNETS' };
2538 s/^\s+//g ; s/\s+$//g ;
2541 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2542 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2546 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2547 undef $proxysettings { 'SRC_BANNED_IP' };
2550 s/^\s+//g ; s/\s+$//g ;
2553 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2554 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2558 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2559 undef $proxysettings { 'SRC_BANNED_MAC' };
2562 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2565 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2566 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2570 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2571 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2574 s/^\s+//g ; s/\s+$//g ;
2577 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2578 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2582 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2583 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2586 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2589 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2590 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2594 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2595 undef $proxysettings { 'DST_NOAUTH' };
2599 unless ( /^#/ ) { s/\s+//g ; }
2602 if ( /^\./ ) { $_ = '*' . $_ ; }
2603 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2607 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2609 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2610 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2613 s/^\s+//g ; s/\s+$//g ;
2614 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2616 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2619 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2621 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2622 undef $proxysettings { 'NTLM_DENY_USERS' };
2625 s/^\s+//g ; s/\s+$//g ;
2626 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2628 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2631 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2633 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2634 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2637 s/^\s+//g ; s/\s+$//g ;
2638 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2640 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2643 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2645 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2646 undef $proxysettings { 'IDENT_DENY_USERS' };
2649 s/^\s+//g ; s/\s+$//g ;
2650 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2652 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2655 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2657 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2658 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2661 s/^\s+//g ; s/\s+$//g ;
2662 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2664 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2667 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2669 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2670 undef $proxysettings { 'RADIUS_DENY_USERS' };
2673 s/^\s+//g ; s/\s+$//g ;
2674 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2676 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2679 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2680 undef $proxysettings { 'IDENT_HOSTS' };
2683 s/^\s+//g ; s/\s+$//g ;
2686 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2687 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2691 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2692 undef $proxysettings { 'CRE_SVHOSTS' };
2695 s/^\s+//g ; s/\s+$//g ;
2698 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2699 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2704 # -------------------------------------------------------------------
2708 open ( FILE
, "> $acl_src_subnets " );
2710 if (! $proxysettings { 'SRC_SUBNETS' })
2712 print FILE
" $green_cidr \n " ;
2713 if ( $netsettings { 'BLUE_DEV' })
2715 print FILE
" $blue_cidr \n " ;
2717 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2720 open ( FILE
, "> $acl_src_banned_ip " );
2722 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2725 open ( FILE
, "> $acl_src_banned_mac " );
2727 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2730 open ( FILE
, "> $acl_src_unrestricted_ip " );
2732 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2735 open ( FILE
, "> $acl_src_unrestricted_mac " );
2737 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2740 open ( FILE
, "> $acl_dst_noauth " );
2742 print FILE
$proxysettings { 'DST_NOAUTH' };
2745 open ( FILE
, "> $acl_dst_noauth_net " );
2747 open ( FILE
, "> $acl_dst_noauth_dom " );
2749 open ( FILE
, "> $acl_dst_noauth_url " );
2752 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2760 open ( FILE
, ">> $acl_dst_noauth_dom " );
2765 elsif (& General
:: validipormask
( $_ ))
2767 open ( FILE
, ">> $acl_dst_noauth_net " );
2772 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?/ )
2774 open ( FILE
, ">> $acl_dst_noauth_net " );
2781 open ( FILE
, ">> $acl_dst_noauth_url " );
2783 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2789 open ( FILE
, "> $acl_dst_nocache " );
2791 print FILE
$proxysettings { 'DST_NOCACHE' };
2794 open ( FILE
, "> $acl_dst_nocache_net " );
2796 open ( FILE
, "> $acl_dst_nocache_dom " );
2798 open ( FILE
, "> $acl_dst_nocache_url " );
2801 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2809 open ( FILE
, ">> $acl_dst_nocache_dom " );
2814 elsif (& General
:: validipormask
( $_ ))
2816 open ( FILE
, ">> $acl_dst_nocache_net " );
2821 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?/ )
2823 open ( FILE
, ">> $acl_dst_nocache_net " );
2830 open ( FILE
, ">> $acl_dst_nocache_url " );
2832 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2838 open ( FILE
, "> $acl_ports_safe " );
2840 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2843 open ( FILE
, "> $acl_ports_ssl " );
2845 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2848 open ( FILE
, "> $acl_dst_throttle " );
2850 if ( $proxysettings { 'THROTTLE_BINARY' } eq 'on' )
2852 @temp = split ( /\|/ , $throttle_binary );
2853 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2855 if ( $proxysettings { 'THROTTLE_DSKIMG' } eq 'on' )
2857 @temp = split ( /\|/ , $throttle_dskimg );
2858 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2860 if ( $proxysettings { 'THROTTLE_MMEDIA' } eq 'on' )
2862 @temp = split ( /\|/ , $throttle_mmedia );
2863 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2865 if (- s
$throttled_urls )
2867 open ( URLFILE
, $throttled_urls );
2870 foreach ( @temp ) { print FILE
; }
2874 open ( FILE
, "> $mimetypes " );
2876 print FILE
$proxysettings { 'MIME_TYPES' };
2879 open ( FILE
, "> $ntlmdir /msntauth.allowusers" );
2881 print FILE
$proxysettings { 'NTLM_ALLOW_USERS' };
2884 open ( FILE
, "> $ntlmdir /msntauth.denyusers" );
2886 print FILE
$proxysettings { 'NTLM_DENY_USERS' };
2889 open ( FILE
, "> $raddir /radauth.allowusers" );
2891 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2894 open ( FILE
, "> $raddir /radauth.denyusers" );
2896 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2899 open ( FILE
, "> $identdir /identauth.allowusers" );
2901 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2904 open ( FILE
, "> $identdir /identauth.denyusers" );
2906 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2909 open ( FILE
, "> $identhosts " );
2911 print FILE
$proxysettings { 'IDENT_HOSTS' };
2914 open ( FILE
, "> $cre_groups " );
2916 print FILE
$proxysettings { 'CRE_GROUPS' };
2919 open ( FILE
, "> $cre_svhosts " );
2921 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2925 # -------------------------------------------------------------------
2929 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2931 print FILE
"function FindProxyForURL(url, host) \n " ;
2933 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2937 (isPlainHostName(host)) ||
2938 (dnsDomainIs(host, ". $mainsettings {'DOMAINNAME'}")) ||
2939 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2940 (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
2941 (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
2942 (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
2943 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2951 if ( $proxysettings { 'ENABLE' } eq 'on' )
2953 print FILE
"if ( \n " ;
2954 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2957 if (- e
" $acl_src_subnets " ) {
2958 open ( SUBNETS
, " $acl_src_subnets " );
2959 @templist = < SUBNETS
>;
2965 @temp = split ( /\/ /);
2967 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2968 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2972 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
2982 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2986 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
2988 print FILE
" \n else \n\n " ;
2990 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2994 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
2996 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3005 # -------------------------------------------------------------------
3012 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3013 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3014 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3015 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3017 $delaypools = 1 ; } else { $delaypools = 0 ;
3020 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3022 $authrealm = "IPFire Advanced Proxy Server" ;
3024 $authrealm = $proxysettings { 'AUTH_REALM' };
3027 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3028 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3030 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3032 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3035 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3036 # you make will be overwritten whenever you resave proxy settings using the
3039 # Instead, modify the file ' $acl_include ' and
3040 # then restart the proxy service using the web interface. Changes made to the
3041 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3043 shutdown_lifetime 5 seconds
3048 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3049 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) { print FILE
" transparent" }
3050 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3053 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3054 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3055 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) { print FILE
" transparent" }
3056 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3060 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3064 if (!- z
$acl_dst_nocache_dom ) {
3065 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3066 print FILE
"cache deny no_cache_domains \n " ;
3068 if (!- z
$acl_dst_nocache_net ) {
3069 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3070 print FILE
"cache deny no_cache_ipaddr \n " ;
3072 if (!- z
$acl_dst_nocache_url ) {
3073 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3074 print FILE
"cache deny no_cache_hosts \n " ;
3080 cache_effective_user squid
3081 cache_effective_group squid
3084 pid_filename /var/run/squid.pid
3086 cache_mem $proxysettings {'CACHE_MEM'} MB
3090 if ( $proxysettings { 'CACHE_SIZE' } ne '0' )
3092 print FILE
"cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256 \n\n " ;
3095 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3097 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3099 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3101 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3103 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3105 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3107 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3112 if ( $proxysettings { 'LOGGING' } eq 'on' )
3115 access_log /var/log/squid/access.log
3116 cache_log /var/log/squid/cache.log
3117 cache_store_log none
3120 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"useragent_log \/var\/log\/squid\/user_agent.log \n " ; }
3121 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3124 access_log /dev/null
3126 cache_store_log none
3135 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3137 print FILE
"forwarded_for on \n " ;
3139 print FILE
"forwarded_for off \n " ;
3141 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3143 print FILE
"via on \n " ;
3145 print FILE
"via off \n " ;
3149 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3151 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3153 print FILE
"auth_param basic program $authdir /ncsa_auth $userdb \n " ;
3154 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3155 print FILE
"auth_param basic realm $authrealm \n " ;
3156 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3157 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3160 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3162 print FILE
"auth_param basic utf8 on \n " ;
3163 print FILE
"auth_param basic program $authdir /squid_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3164 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3165 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3166 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3168 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3170 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3172 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3174 print FILE
" -u sAMAccountName -P" ;
3176 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3178 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3180 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3182 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3184 print FILE
" -u cn -P" ;
3186 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3188 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3190 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3192 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3194 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3195 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3196 print FILE
" -u uid -P" ;
3198 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3199 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3200 print FILE
"auth_param basic realm $authrealm \n " ;
3201 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3202 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3205 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
3207 if ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' )
3209 print FILE
"auth_param ntlm program $authdir /ntlm_smb_lm_auth $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_PDC'}" ;
3210 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print FILE
" \n " ; } else { print FILE
" $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_BDC'} \n " ; }
3211 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n " ;
3212 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3214 print FILE
"auth_param basic program $authdir /msnt_auth \n " ;
3215 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3216 print FILE
"auth_param basic realm $authrealm \n " ;
3217 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3218 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3220 open ( MSNTCONF
, "> $ntlmdir /msntauth.conf" );
3222 print MSNTCONF
"server $proxysettings {'NTLM_PDC'}" ;
3223 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print MSNTCONF
" $proxysettings {'NTLM_PDC'}" ; } else { print MSNTCONF
" $proxysettings {'NTLM_BDC'}" ; }
3224 print MSNTCONF
" $proxysettings {'NTLM_DOMAIN'} \n " ;
3225 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3227 if ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' )
3229 print MSNTCONF
"allowusers $ntlmdir /msntauth.allowusers \n " ;
3231 print MSNTCONF
"denyusers $ntlmdir /msntauth.denyusers \n " ;
3238 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3240 print FILE
"auth_param basic program $authdir /squid_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3241 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3242 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3243 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3244 print FILE
"auth_param basic realm $authrealm \n " ;
3245 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3246 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3250 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3251 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) && ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ))
3253 if ((!- z
" $ntlmdir /msntauth.allowusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
3255 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.allowusers \"\n " ;
3257 if ((!- z
" $ntlmdir /msntauth.denyusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
3259 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.denyusers \"\n " ;
3262 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3264 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3266 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3268 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3270 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3273 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3276 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3277 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3279 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3282 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3283 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3284 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3289 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3291 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3293 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3295 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3297 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3299 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3301 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3303 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3306 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3307 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3308 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3312 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3314 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
"acl with_allowed_useragents browser $browser_regexp \n\n " ; }
3316 print FILE
"acl within_timeframe time " ;
3317 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3318 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3319 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3320 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3321 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3322 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3323 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3324 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3325 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3326 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3327 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3329 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3330 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3335 acl localhost src 127.0.0.1/32
3338 open ( PORTS
, " $acl_ports_ssl " );
3343 foreach ( @temp ) { print FILE
"acl SSL_ports port $_ " ; }
3345 open ( PORTS
, " $acl_ports_safe " );
3350 foreach ( @temp ) { print FILE
"acl Safe_ports port $_ " ; }
3354 acl IPFire_http port $http_port
3355 acl IPFire_https port $https_port
3356 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3357 acl IPFire_networks src " $acl_src_subnets "
3358 acl IPFire_servers dst " $acl_src_subnets "
3359 acl IPFire_green_network src $green_cidr
3360 acl IPFire_green_servers dst $green_cidr
3363 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3364 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3365 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3366 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3367 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3368 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3370 acl CONNECT method CONNECT
3374 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3377 #Classroom extensions
3378 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3379 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3382 print FILE
"deny_info " ;
3383 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3385 print FILE
"ERR_ACCESS_DISABLED" ;
3387 print FILE
"ERR_ACCESS_DENIED" ;
3389 print FILE
" IPFire_no_access_ips \n " ;
3390 print FILE
"deny_info " ;
3391 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3393 print FILE
"ERR_ACCESS_DISABLED" ;
3395 print FILE
"ERR_ACCESS_DENIED" ;
3397 print FILE
" IPFire_no_access_mac \n " ;
3400 http_access deny IPFire_no_access_ips
3401 http_access deny IPFire_no_access_mac
3406 #Insert acl file and replace __VAR__ with correct values
3407 my $blue_net = '' ; #BLUE empty by default
3409 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3410 $blue_net = " $blue_cidr " ;
3411 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3413 if (!- z
$acl_include )
3415 open ( ACL
, " $acl_include " );
3416 print FILE
" \n #Start of custom includes \n\n " ;
3418 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3419 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3420 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3421 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3422 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3425 print FILE
" \n #End of custom includes \n " ;
3428 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3432 #local machine, no restriction
3433 http_access allow localhost
3435 #GUI admin if local machine connects
3436 http_access allow IPFire_ips IPFire_networks IPFire_http
3437 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3439 #Deny not web services
3440 http_access deny !Safe_ports
3441 http_access deny CONNECT !SSL_ports
3446 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3448 print FILE
"#Set ident ACLs \n " ;
3449 if (!- z
$identhosts )
3451 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3452 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3453 print FILE
"ident_lookup_access deny all \n " ;
3455 print FILE
"ident_lookup_access allow all \n " ;
3457 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3461 print FILE
"#Set download throttling \n " ;
3463 if ( $netsettings { 'BLUE_DEV' })
3465 print FILE
"delay_pools 2 \n " ;
3467 print FILE
"delay_pools 1 \n " ;
3470 print FILE
"delay_class 1 3 \n " ;
3471 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3473 print FILE
"delay_parameters 1 " ;
3474 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3478 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3480 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3483 print FILE
" -1/-1 " ;
3484 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3488 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3490 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3494 if ( $netsettings { 'BLUE_DEV' })
3496 print FILE
"delay_parameters 2 " ;
3497 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3501 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3503 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3505 print FILE
" -1/-1 " ;
3506 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3510 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3512 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3517 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3518 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3519 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3520 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3522 if ( $netsettings { 'BLUE_DEV' })
3524 print FILE
"delay_access 1 allow IPFire_green_network" ;
3525 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3527 print FILE
"delay_access 1 deny all \n " ;
3529 print FILE
"delay_access 1 allow all" ;
3530 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3534 if ( $netsettings { 'BLUE_DEV' })
3536 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3537 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3538 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3539 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3540 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3541 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3543 print FILE
"delay_access 2 deny all \n " ;
3546 print FILE
"delay_initial_bucket_level 100 \n " ;
3550 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3552 print FILE
"#Prevent internal proxy access to Green \n " ;
3553 print FILE
"http_access deny IPFire_green_servers !IPFire_green_network \n\n " ;
3556 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3558 print FILE
"#Prevent internal proxy access from Blue \n " ;
3559 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3560 print FILE
"http_access deny IPFire_blue_network IPFire_servers \n\n " ;
3564 #Set custom configured ACLs
3567 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3568 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3570 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3572 if (!- z
$acl_src_unrestricted_ip )
3574 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3575 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3576 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3578 if (!- z
$acl_src_unrestricted_mac )
3580 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3581 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3582 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3584 if (!- z
$acl_dst_noauth_net )
3586 print FILE
"http_access allow IPFire_networks" ;
3587 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3588 print FILE
" !within_timeframe" ;
3590 print FILE
" within_timeframe" ; }
3591 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3592 print FILE
" to_ipaddr_without_auth \n " ;
3594 if (!- z
$acl_dst_noauth_dom )
3596 print FILE
"http_access allow IPFire_networks" ;
3597 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3598 print FILE
" !within_timeframe" ;
3600 print FILE
" within_timeframe" ; }
3601 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3602 print FILE
" to_domains_without_auth \n " ;
3604 if (!- z
$acl_dst_noauth_url )
3606 print FILE
"http_access allow IPFire_networks" ;
3607 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3608 print FILE
" !within_timeframe" ;
3610 print FILE
" within_timeframe" ; }
3611 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3612 print FILE
" to_hosts_without_auth \n " ;
3616 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3618 print FILE
"http_access deny !for_inetusers" ;
3619 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3624 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3625 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3626 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3627 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3628 (!- z
" $identdir /identauth.denyusers" )
3631 print FILE
"http_access deny for_acl_users" ;
3632 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3636 if (!- z
$acl_src_unrestricted_ip )
3638 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3639 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3641 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3643 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3645 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3647 print FILE
" for_inetusers" ;
3649 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3651 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3653 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3655 print FILE
" for_acl_users" ;
3657 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3659 print FILE
" !for_acl_users" ;
3661 } else { print FILE
" for_inetusers" ; }
3663 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3665 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3667 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3669 print FILE
" for_acl_users" ;
3671 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3673 print FILE
" !for_acl_users" ;
3675 } else { print FILE
" for_inetusers" ; }
3681 if (!- z
$acl_src_unrestricted_mac )
3683 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3684 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3686 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3688 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3690 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3692 print FILE
" for_inetusers" ;
3694 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3696 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3698 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3700 print FILE
" for_acl_users" ;
3702 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3704 print FILE
" !for_acl_users" ;
3706 } else { print FILE
" for_inetusers" ; }
3708 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3710 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3712 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3714 print FILE
" for_acl_users" ;
3716 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3718 print FILE
" !for_acl_users" ;
3720 } else { print FILE
" for_inetusers" ; }
3726 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3728 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3729 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3734 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3735 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3736 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3737 ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) &&
3738 (!- z
" $ntlmdir /msntauth.denyusers" )
3742 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3743 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3744 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3745 (!- z
" $raddir /radauth.denyusers" )
3749 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3750 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3751 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3752 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3753 (!- z
" $identdir /identauth.denyusers" )
3757 print FILE
"http_access deny for_acl_users" ;
3758 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3762 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3764 print FILE
"http_access allow" ;
3765 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3766 print FILE
" !within_timeframe" ;
3768 print FILE
" within_timeframe" ; }
3769 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3770 print FILE
" !on_ident_aware_hosts \n " ;
3773 print FILE
"http_access allow IPFire_networks" ;
3776 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3777 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3778 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3779 ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) &&
3780 (!- z
" $ntlmdir /msntauth.allowusers" )
3784 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3785 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3786 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3787 (!- z
" $raddir /radauth.allowusers" )
3791 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3792 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3793 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3794 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3795 (!- z
" $identdir /identauth.allowusers" )
3799 print FILE
" for_acl_users" ;
3800 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3801 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3802 print FILE
" for_inetusers" ;
3804 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3806 print FILE
" !concurrent" ;
3808 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3809 print FILE
" !within_timeframe" ;
3811 print FILE
" within_timeframe" ; }
3812 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3815 print FILE
"http_access deny all \n\n " ;
3817 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3818 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3820 print FILE
"#Strip HTTP Header \n " ;
3822 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3824 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3825 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3827 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3829 print FILE
"request_header_access Via deny all \n " ;
3830 print FILE
"reply_header_access Via deny all \n " ;
3832 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3834 print FILE
"request_header_access User-Agent deny all \n " ;
3835 print FILE
"reply_header_access User-Agent deny all \n " ;
3837 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3839 print FILE
"request_header_access Referer deny all \n " ;
3840 print FILE
"reply_header_access Referer deny all \n " ;
3845 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3847 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3849 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3851 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3853 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3859 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3861 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3862 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3863 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3864 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3866 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3868 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3869 print FILE
"http_reply_access allow all \n\n " ;
3872 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3875 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3876 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3880 } else { print FILE
"cache deny all \n\n " ; }
3883 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3886 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3887 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3888 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3889 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3891 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3895 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3897 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3900 print FILE
"visible_hostname" ;
3901 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3903 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3905 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3908 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3909 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3912 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3914 # Write the parent proxy info, if needed.
3915 if ( $remotehost ne '' )
3917 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3919 # Enter authentication for the parent cache. Option format is
3920 # login=user:password ($proxy1='YES')
3921 # login=PASS ($proxy1='PASS')
3922 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3923 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3925 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3926 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3928 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3930 print FILE
" \n always_direct allow IPFire_ips \n " ;
3931 print FILE
"never_direct allow all \n\n " ;
3933 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3935 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3936 print FILE
"url_rewrite_children $proxysettings {'CHILDREN'} \n\n " ;
3939 # Include file with user defined settings.
3940 if (- e
"/etc/squid/squid.conf.local" ) {
3941 print FILE
"include /etc/squid/squid.conf.local \n " ;
3946 # -------------------------------------------------------------------
3950 my ( $str_user , $str_pass , $str_group ) = @_ ;
3951 my @groupmembers =();
3953 if ( $str_pass eq 'lEaVeAlOnE' )
3955 open ( FILE
, " $userdb " );
3956 @groupmembers = < FILE
>;
3958 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3959 & deluser
( $str_user );
3960 open ( FILE
, ">> $userdb " );
3962 print FILE
" $str_user $str_pass " ;
3965 & deluser
( $str_user );
3966 system ( "/usr/sbin/htpasswd -b $userdb $str_user $str_pass " );
3969 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3970 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3971 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3973 print FILE
" $str_user \n " ;
3979 # -------------------------------------------------------------------
3983 my ( $str_user ) = @_ ;
3985 my @groupmembers =();
3988 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
3991 open ( FILE
, " $groupfile " );
3992 @groupmembers = < FILE
>;
3994 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
3995 open ( FILE
, "> $groupfile " );
3997 print FILE
@templist ;
4002 open ( FILE
, " $userdb " );
4003 @groupmembers = < FILE
>;
4005 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4006 open ( FILE
, "> $userdb " );
4008 print FILE
@templist ;
4014 # -------------------------------------------------------------------
4018 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4020 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4021 print FILE
"localhost" ;
4026 # -------------------------------------------------------------------