]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
75f535151b1fd240554e5b28b76892ce41434131
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2013 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 $
32 # enable only the following on debugging purpose
34 #use CGI::Carp 'fatalsToBrowser';
36 require '/var/ipfire/general-functions.pl' ;
37 require "${General::swroot}/lang.pl" ;
38 require "${General::swroot}/header.pl" ;
40 my @squidversion = `/usr/sbin/squid -v` ;
45 my %mainsettings = ();
46 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
47 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
51 my %filtersettings =();
52 my %xlratorsettings =();
53 my %stdproxysettings =();
59 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 );
60 my $throttle_binary = "7z|arj|bin|bz2|cab|exe|gz|lzh|rar|sea|tar|tgz|xz|zip" ;
61 my $throttle_dskimg = "b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi|vmdk" ;
62 my $throttle_mmedia = "aiff?|asf|avi|divx|mov|mp3|mpe?g|ogg|qt|ra?m|ts|vob" ;
64 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 " ;
65 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
70 my $hintcolour = '#FFFFCC' ;
71 my $ncsa_buttontext = '' ;
86 my $browser_regexp = '' ;
90 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
91 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
92 my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm" ;
93 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
94 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
95 my $credir = "${General::swroot}/proxy/advanced/cre" ;
97 my $userdb = " $ncsadir /passwd" ;
98 my $stdgrp = " $ncsadir /standard.grp" ;
99 my $extgrp = " $ncsadir /extended.grp" ;
100 my $disgrp = " $ncsadir /disabled.grp" ;
102 my $browserdb = "${General::swroot}/proxy/advanced/useragents" ;
103 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
104 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
106 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
107 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
108 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
110 my $identhosts = " $identdir /hosts" ;
112 my $authdir = "/usr/lib/squid/" ;
113 my $errordir = "/usr/lib/squid/errors" ;
115 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
116 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
117 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
118 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
119 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
120 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
121 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
122 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
123 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
124 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
125 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
126 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
127 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
128 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
129 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
130 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
131 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
132 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
133 my $acl_include = " $acldir /include.acl" ;
135 my $updaccelversion = 'n/a' ;
136 my $urlfilterversion = 'n/a' ;
138 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
139 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
140 unless (- d
" $ntlmdir " ) { mkdir ( " $ntlmdir " ); }
141 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
142 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
143 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
145 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
146 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
148 unless (- e
$userdb ) { system ( "touch $userdb " ); }
149 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
150 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
151 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
153 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
154 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
155 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
156 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
157 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
158 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
159 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
160 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
161 unless (- e
$acl_dst_noauth_dom ) { system ( "touch $acl_dst_noauth_dom " ); }
162 unless (- e
$acl_dst_noauth_net ) { system ( "touch $acl_dst_noauth_net " ); }
163 unless (- e
$acl_dst_noauth_url ) { system ( "touch $acl_dst_noauth_url " ); }
164 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
165 unless (- e
$acl_dst_nocache_dom ) { system ( "touch $acl_dst_nocache_dom " ); }
166 unless (- e
$acl_dst_nocache_net ) { system ( "touch $acl_dst_nocache_net " ); }
167 unless (- e
$acl_dst_nocache_url ) { system ( "touch $acl_dst_nocache_url " ); }
168 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
169 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
170 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
171 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
173 unless (- e
$browserdb ) { system ( "touch $browserdb " ); }
174 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
176 my $HAVE_NTLM_AUTH = (- e
"/usr/bin/ntlm_auth" );
178 open FILE
, $browserdb ;
179 @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
>;
182 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
183 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
185 my $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
187 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
188 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
191 & Header
:: showhttpheaders
();
193 $proxysettings { 'ACTION' } = '' ;
194 $proxysettings { 'VALID' } = '' ;
196 $proxysettings { 'ENABLE' } = 'off' ;
197 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
198 $proxysettings { 'TRANSPARENT' } = 'off' ;
199 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
200 $proxysettings { 'PROXY_PORT' } = '800' ;
201 $proxysettings { 'TRANSPARENT_PORT' } = '3128' ;
202 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
203 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
204 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
205 $proxysettings { 'ERR_LANGUAGE' } = 'German' ;
206 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
207 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
208 $proxysettings { 'FORWARD_VIA' } = 'off' ;
209 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
210 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
211 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
212 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
213 $proxysettings { 'UPSTREAM_USER' } = '' ;
214 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
215 $proxysettings { 'LOGGING' } = 'off' ;
216 $proxysettings { 'CACHEMGR' } = 'off' ;
217 $proxysettings { 'LOGQUERY' } = 'off' ;
218 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
219 $proxysettings { 'FILEDESCRIPTORS' } = '16384' ;
220 $proxysettings { 'CACHE_MEM' } = '2' ;
221 $proxysettings { 'CACHE_SIZE' } = '50' ;
222 $proxysettings { 'MAX_SIZE' } = '4096' ;
223 $proxysettings { 'MIN_SIZE' } = '0' ;
224 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
225 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
226 $proxysettings { 'L1_DIRS' } = '16' ;
227 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
228 $proxysettings { 'CACHE_DIGESTS' } = 'off' ;
229 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
230 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
231 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
232 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
233 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
234 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
235 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
236 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
237 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
238 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
239 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
240 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
241 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
242 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
243 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
244 $proxysettings { 'THROTTLE_BINARY' } = 'off' ;
245 $proxysettings { 'THROTTLE_DSKIMG' } = 'off' ;
246 $proxysettings { 'THROTTLE_MMEDIA' } = 'off' ;
247 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
248 $proxysettings { 'ENABLE_BROWSER_CHECK' } = 'off' ;
249 $proxysettings { 'FAKE_USERAGENT' } = '' ;
250 $proxysettings { 'FAKE_REFERER' } = '' ;
251 $proxysettings { 'AUTH_METHOD' } = 'none' ;
252 $proxysettings { 'AUTH_REALM' } = '' ;
253 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
254 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
255 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
256 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
257 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
258 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
259 $proxysettings { 'NCSA_USERNAME' } = '' ;
260 $proxysettings { 'NCSA_GROUP' } = '' ;
261 $proxysettings { 'NCSA_PASS' } = '' ;
262 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
263 $proxysettings { 'LDAP_BASEDN' } = '' ;
264 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
265 $proxysettings { 'LDAP_SERVER' } = '' ;
266 $proxysettings { 'LDAP_PORT' } = '389' ;
267 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
268 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
269 $proxysettings { 'LDAP_GROUP' } = '' ;
270 $proxysettings { 'NTLM_AUTH_GROUP' } = '' ;
271 $proxysettings { 'NTLM_AUTH_BASIC' } = 'off' ;
272 $proxysettings { 'NTLM_DOMAIN' } = '' ;
273 $proxysettings { 'NTLM_PDC' } = '' ;
274 $proxysettings { 'NTLM_BDC' } = '' ;
275 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
276 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
277 $proxysettings { 'RADIUS_SERVER' } = '' ;
278 $proxysettings { 'RADIUS_PORT' } = '1812' ;
279 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
280 $proxysettings { 'RADIUS_SECRET' } = '' ;
281 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
282 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
283 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
284 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
285 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
286 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
287 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
288 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
289 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
291 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
293 & Header
:: getcgihash
( \
%proxysettings );
295 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
296 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
297 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
298 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
300 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
302 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
305 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
307 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
308 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
309 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
311 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
312 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
314 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
315 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
317 if (! $errormessage ) {
318 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
319 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
321 $proxysettings { 'NCSA_USERNAME' } = '' ;
322 $proxysettings { 'NCSA_GROUP' } = '' ;
323 $proxysettings { 'NCSA_PASS' } = '' ;
324 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
327 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
329 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
330 & deluser
( $proxysettings { 'ID' });
333 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
334 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
335 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
337 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
339 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
340 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
341 @temp = split ( /:/ , $proxysettings { 'ID' });
342 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
343 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
344 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
345 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
348 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
350 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
351 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
352 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
353 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
354 $errormessage = $Lang :: tr
{ 'invalid input' };
357 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
358 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
362 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
364 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
367 if (!(& General
:: validport
( $proxysettings { 'TRANSPARENT_PORT' })))
369 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
372 if ( $proxysettings { 'PROXY_PORT' } eq $proxysettings { 'TRANSPARENT_PORT' }) {
373 $errormessage = $Lang :: tr
{ 'advproxy errmsg proxy ports equal' };
376 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
378 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
379 if (!(& General
:: validip
( $temp [ 0 ])))
381 if (!(& General
:: validdomainname
( $temp [ 0 ])))
383 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
388 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
389 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
391 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
393 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
397 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
398 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 1048576 ))
400 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
403 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ))
405 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
408 my @free = `/usr/bin/free` ;
409 $free [ 1 ] =~ m/(\d+)/ ;
410 $cachemem = int $1 / 2048 ;
411 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
412 $proxysettings { 'CACHE_MEM' } = $cachemem ;
414 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
416 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
419 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
421 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
424 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
426 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
429 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
431 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
434 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
436 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
439 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' )
441 $browser_regexp = '' ;
442 foreach ( @useragentlist )
445 @useragent = split ( /,/ );
446 if ( $proxysettings { 'UA_' . $useragent [ 0 ]} eq 'on' ) { $browser_regexp .= " $useragent [2]|" ; }
448 chop ( $browser_regexp );
449 if (! $browser_regexp )
451 $errormessage = $Lang :: tr
{ 'advproxy errmsg no browser' };
455 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
457 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
458 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
459 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
461 if ( $netsettings { 'BLUE_DEV' })
463 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
464 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
466 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
470 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
472 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
477 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
478 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
480 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
483 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
485 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
488 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
490 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
493 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
495 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
498 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
500 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
504 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
506 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
508 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
512 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
514 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
516 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
520 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
522 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
524 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
527 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
529 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
531 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
535 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
537 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
540 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
542 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
544 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
549 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
551 if ( $proxysettings { 'NTLM_DOMAIN' } eq '' )
553 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm domain' };
556 if ( $proxysettings { 'NTLM_PDC' } eq '' )
558 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm pdc' };
561 if (!& General
:: validhostname
( $proxysettings { 'NTLM_PDC' }))
563 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid pdc' };
566 if ((!( $proxysettings { 'NTLM_BDC' } eq '' )) && (!& General
:: validhostname
( $proxysettings { 'NTLM_BDC' })))
568 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid bdc' };
572 $proxysettings { 'NTLM_DOMAIN' } = lc ( $proxysettings { 'NTLM_DOMAIN' });
573 $proxysettings { 'NTLM_PDC' } = lc ( $proxysettings { 'NTLM_PDC' });
574 $proxysettings { 'NTLM_BDC' } = lc ( $proxysettings { 'NTLM_BDC' });
576 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
578 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
580 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
583 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
585 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
588 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
590 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
595 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
598 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
599 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
600 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
601 if (( $proxy1 ne $proxy2 ))
603 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
611 $proxysettings { 'VALID' } = 'no' ; }
613 $proxysettings { 'VALID' } = 'yes' ; }
615 if ( $proxysettings { 'VALID' } eq 'yes' )
619 delete $proxysettings { 'SRC_SUBNETS' };
620 delete $proxysettings { 'SRC_BANNED_IP' };
621 delete $proxysettings { 'SRC_BANNED_MAC' };
622 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
623 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
624 delete $proxysettings { 'DST_NOCACHE' };
625 delete $proxysettings { 'DST_NOAUTH' };
626 delete $proxysettings { 'PORTS_SAFE' };
627 delete $proxysettings { 'PORTS_SSL' };
628 delete $proxysettings { 'MIME_TYPES' };
629 delete $proxysettings { 'NTLM_ALLOW_USERS' };
630 delete $proxysettings { 'NTLM_DENY_USERS' };
631 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
632 delete $proxysettings { 'RADIUS_DENY_USERS' };
633 delete $proxysettings { 'IDENT_HOSTS' };
634 delete $proxysettings { 'IDENT_ALLOW_USERS' };
635 delete $proxysettings { 'IDENT_DENY_USERS' };
637 delete $proxysettings { 'CRE_GROUPS' };
638 delete $proxysettings { 'CRE_SVHOSTS' };
640 delete $proxysettings { 'NCSA_USERNAME' };
641 delete $proxysettings { 'NCSA_GROUP' };
642 delete $proxysettings { 'NCSA_PASS' };
643 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
645 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
646 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
647 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
648 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
649 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
650 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
651 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
653 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
654 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
656 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
658 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
659 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
660 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
661 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
662 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
663 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
664 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
665 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
666 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
671 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
673 system ( '/usr/local/bin/squidctrl' , 'disable' );
674 unlink "${General::swroot}/proxy/enable" ;
675 unlink "${General::swroot}/proxy/transparent" ;
676 unlink "${General::swroot}/proxy/enable_blue" ;
677 unlink "${General::swroot}/proxy/transparent_blue" ;
679 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
680 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
681 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
682 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
683 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
684 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
685 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
686 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
687 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
688 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
690 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
691 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { system ( '/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1' ); }
695 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
697 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
702 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
703 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
704 } elsif (- e
"${General::swroot}/proxy/settings" ) {
705 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
710 # ------------------------------------------------------------------
712 # Hook to regenerate the configuration files, if cgi got called from command line.
713 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
718 # -------------------------------------------------------------------
720 $checked { 'ENABLE' }{ 'off' } = '' ;
721 $checked { 'ENABLE' }{ 'on' } = '' ;
722 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
724 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
725 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
726 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
728 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
729 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
730 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
732 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
733 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
734 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
736 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
737 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
738 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
740 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
741 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
742 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
743 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
744 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
745 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
746 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
747 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
748 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
749 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
750 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
751 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
753 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
754 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
755 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
756 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
757 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
758 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
759 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
760 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
761 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
763 $checked { 'LOGGING' }{ 'off' } = '' ;
764 $checked { 'LOGGING' }{ 'on' } = '' ;
765 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
766 $checked { 'CACHEMGR' }{ 'off' } = '' ;
767 $checked { 'CACHEMGR' }{ 'on' } = '' ;
768 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
769 $checked { 'LOGQUERY' }{ 'off' } = '' ;
770 $checked { 'LOGQUERY' }{ 'on' } = '' ;
771 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
772 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
773 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
774 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
776 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
777 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
779 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
780 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
781 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
782 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
783 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
784 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
786 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
787 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
788 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
790 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
791 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
792 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
793 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
794 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
796 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
797 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
798 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
799 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
800 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
801 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
802 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
804 $checked { 'TIME_MON' }{ 'off' } = '' ;
805 $checked { 'TIME_MON' }{ 'on' } = '' ;
806 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
807 $checked { 'TIME_TUE' }{ 'off' } = '' ;
808 $checked { 'TIME_TUE' }{ 'on' } = '' ;
809 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
810 $checked { 'TIME_WED' }{ 'off' } = '' ;
811 $checked { 'TIME_WED' }{ 'on' } = '' ;
812 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
813 $checked { 'TIME_THU' }{ 'off' } = '' ;
814 $checked { 'TIME_THU' }{ 'on' } = '' ;
815 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
816 $checked { 'TIME_FRI' }{ 'off' } = '' ;
817 $checked { 'TIME_FRI' }{ 'on' } = '' ;
818 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
819 $checked { 'TIME_SAT' }{ 'off' } = '' ;
820 $checked { 'TIME_SAT' }{ 'on' } = '' ;
821 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
822 $checked { 'TIME_SUN' }{ 'off' } = '' ;
823 $checked { 'TIME_SUN' }{ 'on' } = '' ;
824 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
826 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
827 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
828 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
829 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
831 $checked { 'THROTTLE_BINARY' }{ 'off' } = '' ;
832 $checked { 'THROTTLE_BINARY' }{ 'on' } = '' ;
833 $checked { 'THROTTLE_BINARY' }{ $proxysettings { 'THROTTLE_BINARY' }} = "checked='checked'" ;
834 $checked { 'THROTTLE_DSKIMG' }{ 'off' } = '' ;
835 $checked { 'THROTTLE_DSKIMG' }{ 'on' } = '' ;
836 $checked { 'THROTTLE_DSKIMG' }{ $proxysettings { 'THROTTLE_DSKIMG' }} = "checked='checked'" ;
837 $checked { 'THROTTLE_MMEDIA' }{ 'off' } = '' ;
838 $checked { 'THROTTLE_MMEDIA' }{ 'on' } = '' ;
839 $checked { 'THROTTLE_MMEDIA' }{ $proxysettings { 'THROTTLE_MMEDIA' }} = "checked='checked'" ;
841 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
842 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
843 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
845 $checked { 'ENABLE_BROWSER_CHECK' }{ 'off' } = '' ;
846 $checked { 'ENABLE_BROWSER_CHECK' }{ 'on' } = '' ;
847 $checked { 'ENABLE_BROWSER_CHECK' }{ $proxysettings { 'ENABLE_BROWSER_CHECK' }} = "checked='checked'" ;
849 foreach ( @useragentlist ) {
850 @useragent = split ( /,/ );
851 $checked { 'UA_' . $useragent [ 0 ]}{ 'off' } = '' ;
852 $checked { 'UA_' . $useragent [ 0 ]}{ 'on' } = '' ;
853 $checked { 'UA_' . $useragent [ 0 ]}{ $proxysettings { 'UA_' . $useragent [ 0 ]}} = "checked='checked'" ;
856 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
857 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
858 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
859 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
860 $checked { 'AUTH_METHOD' }{ 'ntlm' } = '' ;
861 $checked { 'AUTH_METHOD' }{ 'ntlm-auth' } = '' ;
862 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
863 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
865 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
867 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
868 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
869 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
871 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
872 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
873 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
875 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
877 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
879 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
881 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
882 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
883 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
885 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
886 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
887 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
889 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
890 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
891 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
893 $checked { 'NTLM_AUTH_BASIC' }{ 'on' } = '' ;
894 $checked { 'NTLM_AUTH_BASIC' }{ 'off' } = '' ;
895 $checked { 'NTLM_AUTH_BASIC' }{ $proxysettings { 'NTLM_AUTH_BASIC' }} = "checked='checked'" ;
897 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
898 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
899 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
901 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
902 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
903 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
905 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
906 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
907 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
909 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
910 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
911 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
913 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
914 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
915 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
917 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
918 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
919 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
921 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
922 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
923 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
925 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
926 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
927 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
929 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
931 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
934 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
935 print "<font class='base'> $errormessage </font> \n " ;
939 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
941 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
942 $squidversion [ 0 ] =~ s/^\s+//g ;
943 $squidversion [ 0 ] =~ s/\s+$//g ;
945 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
948 # ===================================================================
950 # ===================================================================
952 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
954 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
956 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
961 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
964 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
965 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
966 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td>
967 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
970 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
971 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
972 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td>
973 <td width='30%'><input type='text' name='TRANSPARENT_PORT' value=' $proxysettings {'TRANSPARENT_PORT'}' size='5' /></td>
978 if ( $netsettings { 'BLUE_DEV' }) {
979 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
980 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
982 print "<td colspan='2'> </td>" ;
985 <td class='base'> $Lang ::tr{'advproxy visible hostname'}:</td>
986 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
991 if ( $netsettings { 'BLUE_DEV' }) {
992 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
993 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
995 print "<td colspan='2'> </td>" ;
998 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
1000 <select name='ERR_LANGUAGE'>
1003 foreach (< $errordir /*>) {
1005 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
1006 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
1014 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
1015 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
1016 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
1017 <td class='base'><select name='ERR_DESIGN'>
1018 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
1019 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
1023 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
1024 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
1030 <table width='100%'>
1033 if ( - e
"/usr/bin/squidclamav" ) {
1034 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
1035 if ( ! - e
"/var/run/clamav/clamd.pid" ){
1036 print "<font color='red'>clamav not running</font><br /><br />" ;
1037 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
1040 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
1046 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</a></b><br />" ;
1047 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
1049 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</a></b><br />" ;
1050 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1055 <table width='100%'>
1057 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1060 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1061 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1062 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}:</td>
1063 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1066 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1067 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1068 <td class='base'> $Lang ::tr{'advproxy upstream username'}:</td>
1069 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1072 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1073 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1074 <td class='base'> $Lang ::tr{'advproxy upstream password'}:</td>
1075 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1078 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1079 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1085 <table width='100%'>
1087 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1090 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1091 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1092 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1093 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1098 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1099 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1103 <table width='100%'>
1105 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1108 <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'> $Lang ::tr{'proxy cachemgr'}:</td>
1109 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1110 <td class='base'> $Lang ::tr{'advproxy admin mail'}:</td>
1111 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1114 <td class='base'> $Lang ::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td>
1115 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1116 <td class='base'> $Lang ::tr{'proxy admin password'}:</td>
1117 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1120 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1123 <td class='base'> $Lang ::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td>
1124 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1125 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td>
1126 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1129 <td class='base'> $Lang ::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td>
1130 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1131 <td class='base'> $Lang ::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td>
1132 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1135 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1136 <td class='base'><select name='L1_DIRS'>
1137 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1138 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1139 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1140 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1141 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1143 <td colspan='2' rowspan= '5' valign='top' class='base'>
1144 <table cellspacing='0' cellpadding='0'>
1146 <!-- intentionally left empty -->
1149 <td> $Lang ::tr{'advproxy no cache sites'}:</td>
1152 <!-- intentionally left empty -->
1155 <!-- intentionally left empty -->
1158 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1162 print $proxysettings { 'DST_NOCACHE' };
1171 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1172 <td class='base'><select name='MEM_POLICY'>
1173 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1174 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1175 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1176 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1180 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1181 <td class='base'><select name='CACHE_POLICY'>
1182 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1183 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1184 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1185 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1189 <td colspan='2'> </td>
1192 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1193 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1196 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1197 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1201 <table width='100%'>
1203 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1206 <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
1209 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td>
1210 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td>
1213 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1216 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1220 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1223 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1230 <table width='100%'>
1232 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1235 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1238 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td>
1241 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1245 if (! $proxysettings { 'SRC_SUBNETS' })
1247 print " $green_cidr \n " ;
1248 if ( $netsettings { 'BLUE_DEV' })
1250 print " $blue_cidr \n " ;
1252 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1259 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1260 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1261 print "<td class='base'> $line :</td> \n " ;
1263 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1267 if ( $netsettings { 'BLUE_DEV' }) {
1268 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1269 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1271 print "<td class='base'> $line :</td> \n " ;
1273 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1280 <td colspan='2'> </td>
1283 <td colspan='2'> </td>
1286 <table width='100%'>
1288 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1291 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}:</td>
1292 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}:</td>
1295 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1299 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1303 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1307 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1313 <table width='100%'>
1315 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1318 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}:</td>
1319 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}:</td>
1322 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1326 print $proxysettings { 'SRC_BANNED_IP' };
1330 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1334 print $proxysettings { 'SRC_BANNED_MAC' };
1345 # -------------------------------------------------------------------
1346 # CRE GUI - optional
1347 # -------------------------------------------------------------------
1349 if (- e
$cre_enabled ) { print <<END
1350 <table width='100%'>
1353 <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>
1356 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1362 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1364 <td class='base'> $Lang ::tr{'advproxy supervisor password'}:</td>
1365 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1368 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1369 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}:</td>
1374 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1377 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1381 print $proxysettings { 'CRE_GROUPS' };
1385 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1388 print $proxysettings { 'CRE_SVHOSTS' };
1396 print "</table><hr size='1'>" ;
1400 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1401 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1402 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1407 # -------------------------------------------------------------------
1411 <table width='100%'>
1413 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1415 <table width='100%'>
1417 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1418 <td width='1%'> </td>
1419 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1420 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1421 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1422 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1423 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1424 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1425 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1426 <td width='1%'> </td>
1427 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1428 <td width='1%'> </td>
1429 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1434 <select name='TIME_ACCESS_MODE'>
1435 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1436 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1440 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1441 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1442 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1443 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1444 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1445 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1446 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1449 <select name='TIME_FROM_HOUR'>
1452 for ( $i = 0 ; $i <= 24 ; $i ++) {
1453 $_ = sprintf ( " %02s " , $i );
1454 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1461 <select name='TIME_FROM_MINUTE'>
1464 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1465 $_ = sprintf ( " %02s " , $i );
1466 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1473 <select name='TIME_TO_HOUR'>
1476 for ( $i = 0 ; $i <= 24 ; $i ++) {
1477 $_ = sprintf ( " %02s " , $i );
1478 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1485 <select name='TIME_TO_MINUTE'>
1488 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1489 $_ = sprintf ( " %02s " , $i );
1490 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1498 <table width='100%'>
1500 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1503 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td>
1504 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1505 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td>
1506 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1510 <table width='100%'>
1512 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1515 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1516 <td width='20%' class='base'>
1517 <select name='THROTTLING_GREEN_TOTAL'>
1521 foreach ( @throttle_limits ) {
1522 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1526 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1529 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1530 <td width='30%' class='base'>
1531 <select name='THROTTLING_GREEN_HOST'>
1535 foreach ( @throttle_limits ) {
1536 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1540 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1547 if ( $netsettings { 'BLUE_DEV' }) {
1550 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1552 <select name='THROTTLING_BLUE_TOTAL'>
1556 foreach ( @throttle_limits ) {
1557 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1561 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1564 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1566 <select name='THROTTLING_BLUE_HOST'>
1570 foreach ( @throttle_limits ) {
1571 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1575 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1585 <table width='100%'>
1587 <td colspan='4'><i> $Lang ::tr{'advproxy content based throttling'}:</i></td>
1590 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle binary'}:</td>
1591 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked {'THROTTLE_BINARY'}{'on'} /></td>
1592 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle dskimg'}:</td>
1593 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked {'THROTTLE_DSKIMG'}{'on'} /></td>
1594 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle mmedia'}:</td>
1595 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked {'THROTTLE_MMEDIA'}{'on'} /></td>
1596 <td width='15%'> </td>
1597 <td width='10%'> </td>
1601 <table width='100%'>
1603 <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>
1607 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1610 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}:</td>
1615 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1619 print $proxysettings { 'MIME_TYPES' };
1633 <table width='100%'>
1635 <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>
1639 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ){
1645 if ( @useragentlist ) { print " $Lang ::tr{'advproxy allowed web browsers'}:" ; } else { print " $Lang ::tr{'advproxy no clients defined'}" ; }
1650 <table width='100%'>
1654 for ( $n = 0 ; $n <= @useragentlist ; $n = $n + $i ) {
1655 for ( $i = 0 ; $i <= 3 ; $i ++) {
1656 if ( $i eq 0 ) { print "<tr> \n " ; }
1657 if (( $n + $i ) < @useragentlist ) {
1658 @useragent = split ( /,/ , @useragentlist [ $n + $i ]);
1659 print "<td width='15%'> $useragent [1]:<\/td> \n " ;
1660 print "<td width='10%'><input type='checkbox' name='UA_ $useragent [0]' $checked {'UA_'. $useragent [0]}{'on'} /></td> \n " ;
1662 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1669 <table width='100%'>
1671 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1674 <td class='base'> $Lang ::tr{'advproxy fake useragent'}:</td>
1675 <td class='base'> $Lang ::tr{'advproxy fake referer'}:</td>
1678 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='40%' /></td>
1679 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='40%' /></td>
1686 my $auth_columns = 5 ;
1687 if ( $HAVE_NTLM_AUTH ) {
1690 my $auth_column_width = 100 / $auth_columns ;
1693 <table width='100%'>
1695 <td colspan=' $auth_columns '><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1698 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked {'AUTH_METHOD'}{'none'} /> $Lang ::tr{'advproxy AUTH method none'}</td>
1699 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked {'AUTH_METHOD'}{'ncsa'} /> $Lang ::tr{'advproxy AUTH method ncsa'}</td>
1700 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked {'AUTH_METHOD'}{'ident'} /> $Lang ::tr{'advproxy AUTH method ident'}</td>
1701 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked {'AUTH_METHOD'}{'ldap'} /> $Lang ::tr{'advproxy AUTH method ldap'}</td>
1702 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked {'AUTH_METHOD'}{'ntlm'} /> $Lang ::tr{'advproxy AUTH method ntlm'}</td>
1705 if ( $HAVE_NTLM_AUTH ) {
1707 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm-auth' $checked {'AUTH_METHOD'}{'ntlm-auth'} /> $Lang ::tr{'advproxy AUTH method ntlm auth'}</td>
1712 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked {'AUTH_METHOD'}{'radius'} /> $Lang ::tr{'advproxy AUTH method radius'}</td>
1718 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1720 <table width='100%'>
1722 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1725 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1728 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1729 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1730 <td colspan='2' rowspan= '6' valign='top' class='base'>
1731 <table cellpadding='0' cellspacing='0'>
1733 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}:</td>
1736 <!-- intentionally left empty -->
1739 <!-- intentionally left empty -->
1742 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1745 <!-- intentionally left empty -->
1748 <!-- intentionally left empty -->
1751 <td> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1754 <!-- intentionally left empty -->
1757 <!-- intentionally left empty -->
1760 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1764 print $proxysettings { 'DST_NOAUTH' };
1773 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1774 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1777 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}:</td>
1778 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1781 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1782 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1785 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1786 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1789 <td colspan='2'> </td>
1796 # ===================================================================
1797 # NCSA auth settings
1798 # ===================================================================
1800 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1803 <table width='100%'>
1805 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1808 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1809 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1810 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1811 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1814 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1822 # ===================================================================
1823 # IDENTD auth settings
1824 # ===================================================================
1826 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1829 <table width='100%'>
1831 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1834 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1835 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1836 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1837 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1840 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1841 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1846 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1847 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1850 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1853 if (! $proxysettings { 'IDENT_HOSTS' }) {
1854 print " $green_cidr \n " ;
1855 if ( $netsettings { 'BLUE_DEV' }) {
1856 print " $blue_cidr \n " ;
1859 print $proxysettings { 'IDENT_HOSTS' };
1864 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1868 print $proxysettings { 'DST_NOAUTH' };
1875 <table width='100%'>
1877 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1880 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1881 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1882 <td width='25%'> </td>
1883 <td width='30%'> </td>
1886 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1887 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1888 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1889 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1892 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1893 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1896 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1900 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1902 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1904 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1908 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1910 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1917 # ===================================================================
1918 # NTLM auth settings
1919 # ===================================================================
1921 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) {
1924 <table width='100%'>
1926 <td colspan='6'><b> $Lang ::tr{'advproxy NTLM domain settings'}</b></td>
1929 <td class='base'> $Lang ::tr{'advproxy NTLM domain'}:</td>
1930 <td><input type='text' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}' size='15' /></td>
1931 <td class='base'> $Lang ::tr{'advproxy NTLM PDC hostname'}:</td>
1932 <td><input type='text' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}' size='14' /></td>
1933 <td class='base'> $Lang ::tr{'advproxy NTLM BDC hostname'}:</td>
1934 <td><input type='text' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}' size='14' /></td>
1938 <table width='100%'>
1940 <td colspan='3'><b> $Lang ::tr{'advproxy NTLM auth mode'}</b></td>
1943 <td width='25%' class='base' width='25%'> $Lang ::tr{'advproxy NTLM use integrated auth'}:</td>
1944 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked {'NTLM_ENABLE_INT_AUTH'}{'on'} /></td>
1949 <table width='100%'>
1951 <td colspan='4'><b> $Lang ::tr{'advproxy NTLM user based access restrictions'}</b></td>
1954 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1955 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked {'NTLM_ENABLE_ACL'}{'on'} /></td>
1956 <td width='25%'> </td>
1957 <td width='30%'> </td>
1960 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked {'NTLM_USER_ACL'}{'positive'} />
1961 $Lang ::tr{'advproxy NTLM use positive access list'}:</td>
1962 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked {'NTLM_USER_ACL'}{'negative'} />
1963 $Lang ::tr{'advproxy NTLM use negative access list'}:</td>
1966 <td colspan='2'> $Lang ::tr{'advproxy NTLM authorized users'}</td>
1967 <td colspan='2'> $Lang ::tr{'advproxy NTLM unauthorized users'}</td>
1970 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1974 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_ALLOW_USERS' }; }
1976 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1978 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
1982 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_DENY_USERS' }; }
1984 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1991 # ===================================================================
1992 # NTLM-AUTH settings
1993 # ===================================================================
1995 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' ) {
1998 <table width='100%'>
1999 <td width='20%' class='base'> $Lang ::tr{'advproxy basic authentication'}:</td>
2000 <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked {'NTLM_AUTH_BASIC'}{'on'} /></td>
2001 <td colspan='2'> </td>
2006 <table width='100%'>
2008 <td colspan='4'><b> $Lang ::tr{'advproxy group access control'}</b></td>
2011 <td width='20%' class='base'> $Lang ::tr{'advproxy group required'}:</td>
2012 <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value=' $proxysettings {'NTLM_AUTH_GROUP'}' size='37' /></td>
2020 # ===================================================================
2021 # LDAP auth settings
2022 # ===================================================================
2024 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
2027 <table width='100%'>
2029 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
2032 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
2033 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
2034 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
2035 <td class='base'><select name='LDAP_TYPE'>
2036 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
2037 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
2038 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
2039 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
2043 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
2044 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
2045 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
2046 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
2050 <table width='100%'>
2052 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
2055 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
2056 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
2057 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
2058 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
2062 <table width='100%'>
2064 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
2067 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}:</td>
2068 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
2076 # ===================================================================
2077 # RADIUS auth settings
2078 # ===================================================================
2080 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
2083 <table width='100%'>
2085 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
2088 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
2089 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
2090 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
2091 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
2094 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}:</td>
2095 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
2096 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
2097 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
2101 <table width='100%'>
2103 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
2106 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
2107 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
2108 <td width='25%'> </td>
2109 <td width='30%'> </td>
2112 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
2113 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
2114 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
2115 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
2118 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
2119 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2122 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2126 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2128 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2130 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2134 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2136 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2143 # ===================================================================
2149 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2151 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2152 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2153 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2154 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2155 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2156 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2157 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2161 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2163 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2164 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2165 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2166 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2167 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2171 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2173 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2174 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2178 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2180 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2181 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2182 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2183 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2184 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2185 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2186 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2190 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2192 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2193 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2194 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2195 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2196 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2197 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2198 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2202 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )) {
2204 <td><input type='hidden' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}'></td>
2205 <td><input type='hidden' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}'></td>
2206 <td><input type='hidden' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}'></td>
2207 <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value=' $proxysettings {'NTLM_ENABLE_INT_AUTH'}'></td>
2208 <td><input type='hidden' name='NTLM_ENABLE_ACL' value=' $proxysettings {'NTLM_ENABLE_ACL'}'></td>
2209 <td><input type='hidden' name='NTLM_USER_ACL' value=' $proxysettings {'NTLM_USER_ACL'}'></td>
2210 <td><input type='hidden' name='NTLM_ALLOW_USERS' value=' $proxysettings {'NTLM_ALLOW_USERS'}'></td>
2211 <td><input type='hidden' name='NTLM_DENY_USERS' value=' $proxysettings {'NTLM_DENY_USERS'}'></td>
2215 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2217 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2218 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2219 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2220 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2221 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2222 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2223 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2224 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2236 <table width='100%'>
2239 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2240 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2241 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2242 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2248 <table width='100%'>
2250 <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'> $Lang ::tr{'required field'}</font></td>
2251 <td align='right'> </td>
2258 & Header
:: closebox
();
2262 # ===================================================================
2263 # NCSA user management
2264 # ===================================================================
2266 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2268 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2269 <table width='100%'>
2271 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2274 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2275 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2278 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly='readonly' " ; }
2281 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2283 <select name='NCSA_GROUP'>
2284 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2285 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2286 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2292 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2293 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2294 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2295 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2302 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2303 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2304 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2307 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2308 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2314 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2319 <table width='100%'>
2321 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2324 <table width='100%' align='center'>
2330 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2331 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2335 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2336 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2340 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2341 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2344 @userlist = sort ( @userlist );
2346 # If the password file contains entries, print entries and action icons
2348 if ( ! - z
" $userdb " ) {
2351 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2352 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2353 <td class='boldbase' colspan='2' align='center'> </td>
2358 foreach $line ( @userlist )
2362 @temp = split ( /:/ , $line );
2363 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2364 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2366 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2368 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2371 <td align='center'> $temp [0]</td>
2375 if ( $temp [ 1 ] eq 'standard' ) {
2376 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2377 } elsif ( $temp [ 1 ] eq 'extended' ) {
2378 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2379 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2380 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2383 <td width='8%' align='center'>
2384 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2385 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2386 <input type='hidden' name='ID' value=' $line ' />
2387 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2391 <td width='8%' align='center'>
2392 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2393 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2394 <input type='hidden' name='ID' value=' $temp [0]' />
2395 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2408 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2409 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2410 <td class='base'> $Lang ::tr{'edit'}</td>
2411 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2412 <td class='base'> $Lang ::tr{'remove'}</td>
2419 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2430 & Header
:: closebox
();
2434 # ===================================================================
2436 & Header
:: closebigbox
();
2438 & Header
:: closepage
();
2440 # -------------------------------------------------------------------
2444 if (- e
" $acl_src_subnets " ) {
2445 open ( FILE
, " $acl_src_subnets " );
2446 delete $proxysettings { 'SRC_SUBNETS' };
2447 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2450 if (- e
" $acl_src_banned_ip " ) {
2451 open ( FILE
, " $acl_src_banned_ip " );
2452 delete $proxysettings { 'SRC_BANNED_IP' };
2453 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2456 if (- e
" $acl_src_banned_mac " ) {
2457 open ( FILE
, " $acl_src_banned_mac " );
2458 delete $proxysettings { 'SRC_BANNED_MAC' };
2459 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2462 if (- e
" $acl_src_unrestricted_ip " ) {
2463 open ( FILE
, " $acl_src_unrestricted_ip " );
2464 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2465 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2468 if (- e
" $acl_src_unrestricted_mac " ) {
2469 open ( FILE
, " $acl_src_unrestricted_mac " );
2470 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2471 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2474 if (- e
" $acl_dst_nocache " ) {
2475 open ( FILE
, " $acl_dst_nocache " );
2476 delete $proxysettings { 'DST_NOCACHE' };
2477 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2480 if (- e
" $acl_dst_noauth " ) {
2481 open ( FILE
, " $acl_dst_noauth " );
2482 delete $proxysettings { 'DST_NOAUTH' };
2483 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2486 if (- e
" $acl_ports_safe " ) {
2487 open ( FILE
, " $acl_ports_safe " );
2488 delete $proxysettings { 'PORTS_SAFE' };
2489 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2492 if (- e
" $acl_ports_ssl " ) {
2493 open ( FILE
, " $acl_ports_ssl " );
2494 delete $proxysettings { 'PORTS_SSL' };
2495 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2498 if (- e
" $mimetypes " ) {
2499 open ( FILE
, " $mimetypes " );
2500 delete $proxysettings { 'MIME_TYPES' };
2501 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2504 if (- e
" $ntlmdir /msntauth.allowusers" ) {
2505 open ( FILE
, " $ntlmdir /msntauth.allowusers" );
2506 delete $proxysettings { 'NTLM_ALLOW_USERS' };
2507 while (< FILE
>) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ };
2510 if (- e
" $ntlmdir /msntauth.denyusers" ) {
2511 open ( FILE
, " $ntlmdir /msntauth.denyusers" );
2512 delete $proxysettings { 'NTLM_DENY_USERS' };
2513 while (< FILE
>) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ };
2516 if (- e
" $raddir /radauth.allowusers" ) {
2517 open ( FILE
, " $raddir /radauth.allowusers" );
2518 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2519 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2522 if (- e
" $raddir /radauth.denyusers" ) {
2523 open ( FILE
, " $raddir /radauth.denyusers" );
2524 delete $proxysettings { 'RADIUS_DENY_USERS' };
2525 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2528 if (- e
" $identdir /identauth.allowusers" ) {
2529 open ( FILE
, " $identdir /identauth.allowusers" );
2530 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2531 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2534 if (- e
" $identdir /identauth.denyusers" ) {
2535 open ( FILE
, " $identdir /identauth.denyusers" );
2536 delete $proxysettings { 'IDENT_DENY_USERS' };
2537 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2540 if (- e
" $identhosts " ) {
2541 open ( FILE
, " $identhosts " );
2542 delete $proxysettings { 'IDENT_HOSTS' };
2543 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2546 if (- e
" $cre_groups " ) {
2547 open ( FILE
, " $cre_groups " );
2548 delete $proxysettings { 'CRE_GROUPS' };
2549 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2552 if (- e
" $cre_svhosts " ) {
2553 open ( FILE
, " $cre_svhosts " );
2554 delete $proxysettings { 'CRE_SVHOSTS' };
2555 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2560 # -------------------------------------------------------------------
2564 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2565 undef $proxysettings { 'PORTS_SAFE' };
2568 s/^\s+//g ; s/\s+$//g ;
2572 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2574 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2575 @templist = split ( /-/ );
2576 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2577 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2581 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2582 undef $proxysettings { 'PORTS_SSL' };
2585 s/^\s+//g ; s/\s+$//g ;
2590 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2591 @templist = split ( /-/ );
2592 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2593 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2597 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2598 undef $proxysettings { 'DST_NOCACHE' };
2602 unless ( /^#/ ) { s/\s+//g ; }
2605 if ( /^\./ ) { $_ = '*' . $_ ; }
2606 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2610 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2611 undef $proxysettings { 'SRC_SUBNETS' };
2614 s/^\s+//g ; s/\s+$//g ;
2617 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2618 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2622 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2623 undef $proxysettings { 'SRC_BANNED_IP' };
2626 s/^\s+//g ; s/\s+$//g ;
2629 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2630 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2634 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2635 undef $proxysettings { 'SRC_BANNED_MAC' };
2638 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2641 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2642 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2646 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2647 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2650 s/^\s+//g ; s/\s+$//g ;
2653 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2654 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2658 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2659 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2662 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2665 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2666 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2670 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2671 undef $proxysettings { 'DST_NOAUTH' };
2675 unless ( /^#/ ) { s/\s+//g ; }
2678 if ( /^\./ ) { $_ = '*' . $_ ; }
2679 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2683 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2685 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2686 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2689 s/^\s+//g ; s/\s+$//g ;
2690 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2692 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2695 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2697 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2698 undef $proxysettings { 'NTLM_DENY_USERS' };
2701 s/^\s+//g ; s/\s+$//g ;
2702 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2704 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2707 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2709 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2710 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2713 s/^\s+//g ; s/\s+$//g ;
2714 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2716 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2719 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2721 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2722 undef $proxysettings { 'IDENT_DENY_USERS' };
2725 s/^\s+//g ; s/\s+$//g ;
2726 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2728 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2731 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2733 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2734 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2737 s/^\s+//g ; s/\s+$//g ;
2738 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2740 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2743 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2745 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2746 undef $proxysettings { 'RADIUS_DENY_USERS' };
2749 s/^\s+//g ; s/\s+$//g ;
2750 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2752 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2755 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2756 undef $proxysettings { 'IDENT_HOSTS' };
2759 s/^\s+//g ; s/\s+$//g ;
2762 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2763 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2767 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2768 undef $proxysettings { 'CRE_SVHOSTS' };
2771 s/^\s+//g ; s/\s+$//g ;
2774 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2775 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2780 # -------------------------------------------------------------------
2784 open ( FILE
, "> $acl_src_subnets " );
2786 if (! $proxysettings { 'SRC_SUBNETS' })
2788 print FILE
" $green_cidr \n " ;
2789 if ( $netsettings { 'BLUE_DEV' })
2791 print FILE
" $blue_cidr \n " ;
2793 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2796 open ( FILE
, "> $acl_src_banned_ip " );
2798 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2801 open ( FILE
, "> $acl_src_banned_mac " );
2803 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2806 open ( FILE
, "> $acl_src_unrestricted_ip " );
2808 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2811 open ( FILE
, "> $acl_src_unrestricted_mac " );
2813 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2816 open ( FILE
, "> $acl_dst_noauth " );
2818 print FILE
$proxysettings { 'DST_NOAUTH' };
2821 open ( FILE
, "> $acl_dst_noauth_net " );
2823 open ( FILE
, "> $acl_dst_noauth_dom " );
2825 open ( FILE
, "> $acl_dst_noauth_url " );
2828 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2836 open ( FILE
, ">> $acl_dst_noauth_dom " );
2841 elsif (& General
:: validipormask
( $_ ))
2843 open ( FILE
, ">> $acl_dst_noauth_net " );
2848 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?/ )
2850 open ( FILE
, ">> $acl_dst_noauth_net " );
2857 open ( FILE
, ">> $acl_dst_noauth_url " );
2859 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2865 open ( FILE
, "> $acl_dst_nocache " );
2867 print FILE
$proxysettings { 'DST_NOCACHE' };
2870 open ( FILE
, "> $acl_dst_nocache_net " );
2872 open ( FILE
, "> $acl_dst_nocache_dom " );
2874 open ( FILE
, "> $acl_dst_nocache_url " );
2877 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2885 open ( FILE
, ">> $acl_dst_nocache_dom " );
2890 elsif (& General
:: validipormask
( $_ ))
2892 open ( FILE
, ">> $acl_dst_nocache_net " );
2897 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?/ )
2899 open ( FILE
, ">> $acl_dst_nocache_net " );
2906 open ( FILE
, ">> $acl_dst_nocache_url " );
2908 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2914 open ( FILE
, "> $acl_ports_safe " );
2916 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2919 open ( FILE
, "> $acl_ports_ssl " );
2921 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2924 open ( FILE
, "> $acl_dst_throttle " );
2926 if ( $proxysettings { 'THROTTLE_BINARY' } eq 'on' )
2928 @temp = split ( /\|/ , $throttle_binary );
2929 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2931 if ( $proxysettings { 'THROTTLE_DSKIMG' } eq 'on' )
2933 @temp = split ( /\|/ , $throttle_dskimg );
2934 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2936 if ( $proxysettings { 'THROTTLE_MMEDIA' } eq 'on' )
2938 @temp = split ( /\|/ , $throttle_mmedia );
2939 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2941 if (- s
$throttled_urls )
2943 open ( URLFILE
, $throttled_urls );
2946 foreach ( @temp ) { print FILE
; }
2950 open ( FILE
, "> $mimetypes " );
2952 print FILE
$proxysettings { 'MIME_TYPES' };
2955 open ( FILE
, "> $ntlmdir /msntauth.allowusers" );
2957 print FILE
$proxysettings { 'NTLM_ALLOW_USERS' };
2960 open ( FILE
, "> $ntlmdir /msntauth.denyusers" );
2962 print FILE
$proxysettings { 'NTLM_DENY_USERS' };
2965 open ( FILE
, "> $raddir /radauth.allowusers" );
2967 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2970 open ( FILE
, "> $raddir /radauth.denyusers" );
2972 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2975 open ( FILE
, "> $identdir /identauth.allowusers" );
2977 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2980 open ( FILE
, "> $identdir /identauth.denyusers" );
2982 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2985 open ( FILE
, "> $identhosts " );
2987 print FILE
$proxysettings { 'IDENT_HOSTS' };
2990 open ( FILE
, "> $cre_groups " );
2992 print FILE
$proxysettings { 'CRE_GROUPS' };
2995 open ( FILE
, "> $cre_svhosts " );
2997 print FILE
$proxysettings { 'CRE_SVHOSTS' };
3001 # -------------------------------------------------------------------
3005 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
3007 print FILE
"function FindProxyForURL(url, host) \n " ;
3009 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
3013 (isPlainHostName(host)) ||
3014 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
3018 if ( $netsettings { 'GREEN_DEV' }) {
3019 print FILE
" (isInNet(host, \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" )) || \n " ;
3022 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
3023 print FILE
" (isInNet(host, \" $netsettings {'BLUE_NETADDRESS'} \" , \" $netsettings {'BLUE_NETMASK'} \" )) || \n " ;
3026 if (& Header
:: orange_used
() && $netsettings { 'ORANGE_DEV' }) {
3027 print FILE
" (isInNet(host, \" $netsettings {'ORANGE_NETADDRESS'} \" , \" $netsettings {'ORANGE_NETMASK'} \" )) || \n " ;
3031 (isInNet(host, "169.254.0.0", "255.255.0.0"))
3039 if ( $proxysettings { 'ENABLE' } eq 'on' )
3041 print FILE
"if ( \n " ;
3042 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
3045 if (- e
" $acl_src_subnets " ) {
3046 open ( SUBNETS
, " $acl_src_subnets " );
3047 @templist = < SUBNETS
>;
3053 @temp = split ( /\/ /);
3055 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
3056 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
3060 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
3068 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3072 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
3074 print FILE
" \n else \n\n " ;
3076 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
3080 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
3082 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3091 # -------------------------------------------------------------------
3098 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3099 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3100 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3101 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3103 $delaypools = 1 ; } else { $delaypools = 0 ;
3106 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3108 $authrealm = "IPFire Advanced Proxy Server" ;
3110 $authrealm = $proxysettings { 'AUTH_REALM' };
3113 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3114 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3116 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3118 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3121 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3122 # you make will be overwritten whenever you resave proxy settings using the
3125 # Instead, modify the file ' $acl_include ' and
3126 # then restart the proxy service using the web interface. Changes made to the
3127 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3129 shutdown_lifetime 5 seconds
3135 # Include file with user defined settings.
3136 if (- e
"/etc/squid/squid.conf.pre.local" ) {
3137 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
3140 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3141 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3144 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) {
3145 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3146 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3150 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3151 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3152 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3155 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) {
3156 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3157 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3162 if (( $proxysettings { 'CACHE_SIZE' } > 0 ) || ( $proxysettings { 'CACHE_MEM' } > 0 ))
3166 if (!- z
$acl_dst_nocache_dom ) {
3167 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3168 print FILE
"cache deny no_cache_domains \n " ;
3170 if (!- z
$acl_dst_nocache_net ) {
3171 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3172 print FILE
"cache deny no_cache_ipaddr \n " ;
3174 if (!- z
$acl_dst_nocache_url ) {
3175 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3176 print FILE
"cache deny no_cache_hosts \n " ;
3182 cache_effective_user squid
3185 pid_filename /var/run/squid.pid
3187 cache_mem $proxysettings {'CACHE_MEM'} MB
3190 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3192 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3193 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
3195 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3197 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3199 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3201 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3203 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3208 open ( PORTS
, " $acl_ports_ssl " );
3209 my @ssl_ports = < PORTS
>;
3213 foreach ( @ssl_ports ) {
3214 print FILE
"acl SSL_ports port $_ " ;
3218 open ( PORTS
, " $acl_ports_safe " );
3219 my @safe_ports = < PORTS
>;
3223 foreach ( @safe_ports ) {
3224 print FILE
"acl Safe_ports port $_ " ;
3230 acl IPFire_http port $http_port
3231 acl IPFire_https port $https_port
3232 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3233 acl IPFire_networks src " $acl_src_subnets "
3234 acl IPFire_servers dst " $acl_src_subnets "
3235 acl IPFire_green_network src $green_cidr
3236 acl IPFire_green_servers dst $green_cidr
3239 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3240 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3241 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3242 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3243 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3244 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3246 acl CONNECT method CONNECT
3250 if ( $proxysettings { 'CACHE_SIZE' } > 0 ) {
3252 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3253 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3255 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
3259 if ( $proxysettings { 'CACHE_MEM' } > 0 ) {
3260 # always 2% of CACHE_MEM defined as max object size
3261 print FILE
"maximum_object_size_in_memory " . int ( $proxysettings { 'CACHE_MEM' } * 1024 * 0.02 ) . " KB \n\n " ;
3263 print FILE
"cache deny all \n\n " ;
3268 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3272 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3273 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3274 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3275 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3277 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3281 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3283 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3286 if ( $proxysettings { 'LOGGING' } eq 'on' )
3289 access_log stdio:/var/log/squid/access.log
3290 cache_log /var/log/squid/cache.log
3291 cache_store_log none
3294 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"access_log stdio:\/var\/log\/squid\/user_agent.log useragent \n " ; }
3295 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3298 access_log /dev/null
3300 cache_store_log none
3309 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3311 print FILE
"forwarded_for on \n " ;
3313 print FILE
"forwarded_for off \n " ;
3315 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3317 print FILE
"via on \n " ;
3319 print FILE
"via off \n " ;
3323 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3325 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3327 print FILE
"auth_param basic program $authdir /basic_ncsa_auth $userdb \n " ;
3328 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3329 print FILE
"auth_param basic realm $authrealm \n " ;
3330 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3331 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3334 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3336 print FILE
"auth_param basic utf8 on \n " ;
3337 print FILE
"auth_param basic program $authdir /basic_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3338 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3339 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3340 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3342 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3344 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3346 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3348 print FILE
" -u sAMAccountName -P" ;
3350 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3352 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3354 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3356 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3358 print FILE
" -u cn -P" ;
3360 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3362 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3364 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3366 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3368 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3369 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3370 print FILE
" -u uid -P" ;
3372 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3373 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3374 print FILE
"auth_param basic realm $authrealm \n " ;
3375 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3376 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3379 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
3381 if ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' )
3383 print FILE
"auth_param ntlm program $authdir /ntlm_smb_lm_auth $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_PDC'}" ;
3384 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print FILE
" \n " ; } else { print FILE
" $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_BDC'} \n " ; }
3385 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n " ;
3386 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3388 print FILE
"auth_param basic program $authdir /basic_msnt_auth \n " ;
3389 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3390 print FILE
"auth_param basic realm $authrealm \n " ;
3391 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3392 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3394 open ( MSNTCONF
, "> $ntlmdir /msntauth.conf" );
3396 print MSNTCONF
"server $proxysettings {'NTLM_PDC'}" ;
3397 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print MSNTCONF
" $proxysettings {'NTLM_PDC'}" ; } else { print MSNTCONF
" $proxysettings {'NTLM_BDC'}" ; }
3398 print MSNTCONF
" $proxysettings {'NTLM_DOMAIN'} \n " ;
3399 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3401 if ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' )
3403 print MSNTCONF
"allowusers $ntlmdir /msntauth.allowusers \n " ;
3405 print MSNTCONF
"denyusers $ntlmdir /msntauth.denyusers \n " ;
3412 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' )
3414 print FILE
"auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" ;
3415 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3416 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3417 $ntlm_auth_group =~ s/\\/\+/ ;
3419 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3423 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n\n " ;
3425 # BASIC authentication
3426 if ( $proxysettings { 'NTLM_AUTH_BASIC' } eq "on" ) {
3427 print FILE
"auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic" ;
3428 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3429 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3430 $ntlm_auth_group =~ s/\\/\+/ ;
3432 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3435 print FILE
"auth_param basic children 10 \n " ;
3436 print FILE
"auth_param basic realm IPFire Web Proxy Server \n " ;
3437 print FILE
"auth_param basic credentialsttl 2 hours \n\n " ;
3441 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3443 print FILE
"auth_param basic program $authdir /basic_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3444 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3445 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3446 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3447 print FILE
"auth_param basic realm $authrealm \n " ;
3448 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3449 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3453 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3454 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) && ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ))
3456 if ((!- z
" $ntlmdir /msntauth.allowusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
3458 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.allowusers \"\n " ;
3460 if ((!- z
" $ntlmdir /msntauth.denyusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
3462 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.denyusers \"\n " ;
3465 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3467 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3469 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3471 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3473 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3476 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3479 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3480 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3482 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3485 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3486 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3487 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3492 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3494 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3496 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3498 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3500 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3502 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3504 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3506 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3509 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3510 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3511 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3515 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3517 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
"acl with_allowed_useragents browser $browser_regexp \n\n " ; }
3519 print FILE
"acl within_timeframe time " ;
3520 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3521 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3522 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3523 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3524 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3525 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3526 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3527 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3528 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3529 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3530 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3532 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3533 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3536 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3539 #Classroom extensions
3540 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3541 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3544 print FILE
"deny_info " ;
3545 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3547 print FILE
"ERR_ACCESS_DISABLED" ;
3549 print FILE
"ERR_ACCESS_DENIED" ;
3551 print FILE
" IPFire_no_access_ips \n " ;
3552 print FILE
"deny_info " ;
3553 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3555 print FILE
"ERR_ACCESS_DISABLED" ;
3557 print FILE
"ERR_ACCESS_DENIED" ;
3559 print FILE
" IPFire_no_access_mac \n " ;
3562 http_access deny IPFire_no_access_ips
3563 http_access deny IPFire_no_access_mac
3568 #Insert acl file and replace __VAR__ with correct values
3569 my $blue_net = '' ; #BLUE empty by default
3571 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3572 $blue_net = " $blue_cidr " ;
3573 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3575 if (!- z
$acl_include )
3577 open ( ACL
, " $acl_include " );
3578 print FILE
" \n #Start of custom includes \n\n " ;
3580 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3581 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3582 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3583 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3584 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3587 print FILE
" \n #End of custom includes \n " ;
3590 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3592 # Check if squidclamav is enabled.
3593 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3594 print FILE
" \n #Settings for squidclamav: \n " ;
3595 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} \n " ;
3596 print FILE
"acl purge method PURGE \n " ;
3597 print FILE
"http_access deny to_localhost \n " ;
3598 print FILE
"http_access allow localhost \n " ;
3599 print FILE
"http_access allow purge localhost \n " ;
3600 print FILE
"http_access deny purge \n " ;
3601 print FILE
"url_rewrite_access deny localhost \n " ;
3606 #local machine, no restriction
3607 http_access allow localhost
3609 #GUI admin if local machine connects
3610 http_access allow IPFire_ips IPFire_networks IPFire_http
3611 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3613 #Deny not web services
3617 print FILE
"http_access deny !Safe_ports \n " ;
3621 print FILE
"http_access deny CONNECT !SSL_ports \n " ;
3624 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3626 print FILE
"#Set ident ACLs \n " ;
3627 if (!- z
$identhosts )
3629 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3630 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3631 print FILE
"ident_lookup_access deny all \n " ;
3633 print FILE
"ident_lookup_access allow all \n " ;
3635 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3639 print FILE
"#Set download throttling \n " ;
3641 if ( $netsettings { 'BLUE_DEV' })
3643 print FILE
"delay_pools 2 \n " ;
3645 print FILE
"delay_pools 1 \n " ;
3648 print FILE
"delay_class 1 3 \n " ;
3649 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3651 print FILE
"delay_parameters 1 " ;
3652 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3656 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3658 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3661 print FILE
" -1/-1 " ;
3662 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3666 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3668 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3672 if ( $netsettings { 'BLUE_DEV' })
3674 print FILE
"delay_parameters 2 " ;
3675 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3679 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3681 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3683 print FILE
" -1/-1 " ;
3684 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3688 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3690 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3695 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3696 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3697 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3698 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3700 if ( $netsettings { 'BLUE_DEV' })
3702 print FILE
"delay_access 1 allow IPFire_green_network" ;
3703 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3705 print FILE
"delay_access 1 deny all \n " ;
3707 print FILE
"delay_access 1 allow all" ;
3708 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3712 if ( $netsettings { 'BLUE_DEV' })
3714 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3715 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3716 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3717 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3718 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3719 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3721 print FILE
"delay_access 2 deny all \n " ;
3724 print FILE
"delay_initial_bucket_level 100 \n " ;
3728 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3730 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3731 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3734 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3736 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3737 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3738 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3742 #Set custom configured ACLs
3745 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3746 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3748 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3750 if (!- z
$acl_src_unrestricted_ip )
3752 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3753 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3754 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3756 if (!- z
$acl_src_unrestricted_mac )
3758 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3759 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3760 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3762 if (!- z
$acl_dst_noauth_net )
3764 print FILE
"http_access allow IPFire_networks" ;
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
" to_ipaddr_without_auth \n " ;
3772 if (!- z
$acl_dst_noauth_dom )
3774 print FILE
"http_access allow IPFire_networks" ;
3775 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3776 print FILE
" !within_timeframe" ;
3778 print FILE
" within_timeframe" ; }
3779 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3780 print FILE
" to_domains_without_auth \n " ;
3782 if (!- z
$acl_dst_noauth_url )
3784 print FILE
"http_access allow IPFire_networks" ;
3785 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3786 print FILE
" !within_timeframe" ;
3788 print FILE
" within_timeframe" ; }
3789 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3790 print FILE
" to_hosts_without_auth \n " ;
3794 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3796 print FILE
"http_access deny !for_inetusers" ;
3797 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3802 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3803 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3804 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3805 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3806 (!- z
" $identdir /identauth.denyusers" )
3809 print FILE
"http_access deny for_acl_users" ;
3810 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3814 if (!- z
$acl_src_unrestricted_ip )
3816 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3817 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3819 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3821 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3823 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3825 print FILE
" for_inetusers" ;
3827 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3829 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3831 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3833 print FILE
" for_acl_users" ;
3835 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3837 print FILE
" !for_acl_users" ;
3839 } else { print FILE
" for_inetusers" ; }
3841 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3843 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3845 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3847 print FILE
" for_acl_users" ;
3849 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3851 print FILE
" !for_acl_users" ;
3853 } else { print FILE
" for_inetusers" ; }
3859 if (!- z
$acl_src_unrestricted_mac )
3861 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3862 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3864 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3866 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3868 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3870 print FILE
" for_inetusers" ;
3872 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3874 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3876 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3878 print FILE
" for_acl_users" ;
3880 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3882 print FILE
" !for_acl_users" ;
3884 } else { print FILE
" for_inetusers" ; }
3886 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3888 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3890 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3892 print FILE
" for_acl_users" ;
3894 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3896 print FILE
" !for_acl_users" ;
3898 } else { print FILE
" for_inetusers" ; }
3904 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3906 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3907 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3912 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3913 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3914 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3915 ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) &&
3916 (!- z
" $ntlmdir /msntauth.denyusers" )
3920 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3921 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3922 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3923 (!- z
" $raddir /radauth.denyusers" )
3927 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3928 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3929 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3930 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3931 (!- z
" $identdir /identauth.denyusers" )
3935 print FILE
"http_access deny for_acl_users" ;
3936 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3940 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3942 print FILE
"http_access allow" ;
3943 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3944 print FILE
" !within_timeframe" ;
3946 print FILE
" within_timeframe" ; }
3947 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3948 print FILE
" !on_ident_aware_hosts \n " ;
3951 print FILE
"http_access allow IPFire_networks" ;
3954 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3955 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3956 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3957 ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) &&
3958 (!- z
" $ntlmdir /msntauth.allowusers" )
3962 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3963 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3964 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3965 (!- z
" $raddir /radauth.allowusers" )
3969 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3970 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3971 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3972 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3973 (!- z
" $identdir /identauth.allowusers" )
3977 print FILE
" for_acl_users" ;
3978 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3979 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3980 print FILE
" for_inetusers" ;
3982 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3984 print FILE
" !concurrent" ;
3986 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3987 print FILE
" !within_timeframe" ;
3989 print FILE
" within_timeframe" ; }
3990 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3993 print FILE
"http_access deny all \n\n " ;
3995 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3996 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3998 print FILE
"#Strip HTTP Header \n " ;
4000 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
4002 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
4003 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
4005 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
4007 print FILE
"request_header_access Via deny all \n " ;
4008 print FILE
"reply_header_access Via deny all \n " ;
4010 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
4012 print FILE
"request_header_access User-Agent deny all \n " ;
4013 print FILE
"reply_header_access User-Agent deny all \n " ;
4015 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
4017 print FILE
"request_header_access Referer deny all \n " ;
4018 print FILE
"reply_header_access Referer deny all \n " ;
4023 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
4025 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
4027 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
4029 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
4031 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
4037 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
4039 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
4040 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
4041 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
4042 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
4044 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
4046 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
4047 print FILE
"http_reply_access allow all \n\n " ;
4050 print FILE
"visible_hostname" ;
4051 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
4053 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
4055 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
4058 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
4059 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
4062 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
4064 # Write the parent proxy info, if needed.
4065 if ( $remotehost ne '' )
4067 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
4069 # Enter authentication for the parent cache. Option format is
4070 # login=user:password ($proxy1='YES')
4071 # login=PASS ($proxy1='PASS')
4072 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
4073 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
4075 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
4076 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
4078 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
4080 print FILE
" \n always_direct allow IPFire_ips \n " ;
4081 print FILE
"never_direct allow all \n\n " ;
4083 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
4085 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
4086 print FILE
"url_rewrite_children " , & General
:: number_cpu_cores
();
4087 print FILE
" startup=" , & General
:: number_cpu_cores
();
4088 print FILE
" idle=" , & General
:: number_cpu_cores
();
4089 print FILE
" queue-size=" , & General
:: number_cpu_cores
() * 32 , " \n\n " ;
4092 # Include file with user defined settings.
4093 if (- e
"/etc/squid/squid.conf.local" ) {
4094 print FILE
"include /etc/squid/squid.conf.local \n " ;
4098 # Proxy settings for squidclamav - if installed.
4100 # Check if squidclamav is enabled.
4101 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
4103 my $configfile = '/etc/squidclamav.conf' ;
4105 my $data = & General
:: read_file_utf8
( $configfile );
4106 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
4107 & General
:: write_file_utf8
( $configfile , $data );
4111 # -------------------------------------------------------------------
4115 my ( $str_user , $str_pass , $str_group ) = @_ ;
4116 my @groupmembers =();
4118 if ( $str_pass eq 'lEaVeAlOnE' )
4120 open ( FILE
, " $userdb " );
4121 @groupmembers = < FILE
>;
4123 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
4124 & deluser
( $str_user );
4125 open ( FILE
, ">> $userdb " );
4127 print FILE
" $str_user $str_pass " ;
4130 & deluser
( $str_user );
4132 my $htpasswd = new Apache
:: Htpasswd
( " $userdb " );
4133 $htpasswd -> htpasswd ( $str_user , $str_pass );
4136 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
4137 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
4138 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
4140 print FILE
" $str_user \n " ;
4146 # -------------------------------------------------------------------
4150 my ( $str_user ) = @_ ;
4152 my @groupmembers =();
4155 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
4158 open ( FILE
, " $groupfile " );
4159 @groupmembers = < FILE
>;
4161 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
4162 open ( FILE
, "> $groupfile " );
4164 print FILE
@templist ;
4169 open ( FILE
, " $userdb " );
4170 @groupmembers = < FILE
>;
4172 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4173 open ( FILE
, "> $userdb " );
4175 print FILE
@templist ;
4181 # -------------------------------------------------------------------
4185 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4187 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4188 print FILE
"localhost" ;
4193 # -------------------------------------------------------------------