]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
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 , 512 , 1024 , 1536 , 2048 , 3072 , 4096 , 5120 , 6144 , 7168 , 8192 , 10240 , 16384 , 20480 , 51200 , 102400 );
61 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 " ;
62 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
64 my $hintcolour = '#FFFFCC' ;
65 my $ncsa_buttontext = '' ;
80 my $browser_regexp = '' ;
84 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
85 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
86 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
87 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
88 my $credir = "${General::swroot}/proxy/advanced/cre" ;
90 my $userdb = " $ncsadir /passwd" ;
91 my $stdgrp = " $ncsadir /standard.grp" ;
92 my $extgrp = " $ncsadir /extended.grp" ;
93 my $disgrp = " $ncsadir /disabled.grp" ;
95 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
96 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
98 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
99 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
100 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
102 my $identhosts = " $identdir /hosts" ;
104 my $authdir = "/usr/lib/squid" ;
105 my $errordir = "/usr/lib/squid/errors" ;
107 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
108 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
109 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
110 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
111 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
112 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
113 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
114 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
115 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
116 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
117 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
118 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
119 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
120 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
121 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
122 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
123 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
124 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
125 my $acl_include = " $acldir /include.acl" ;
127 my $acl_dst_noproxy_url = " $acldir /dst_noproxy_url.acl" ;
128 my $acl_dst_noproxy_ip = " $acldir /dst_noproxy_ip.acl" ;
130 my $updaccelversion = 'n/a' ;
131 my $urlfilterversion = 'n/a' ;
133 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
134 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
135 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
136 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
137 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
139 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
140 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
142 unless (- e
$userdb ) { system ( "touch $userdb " ); }
143 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
144 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
145 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
147 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
148 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
149 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
150 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
151 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
152 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
153 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
154 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
155 unless (- e
$acl_dst_noauth_dom ) { system ( "touch $acl_dst_noauth_dom " ); }
156 unless (- e
$acl_dst_noauth_net ) { system ( "touch $acl_dst_noauth_net " ); }
157 unless (- e
$acl_dst_noauth_url ) { system ( "touch $acl_dst_noauth_url " ); }
158 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
159 unless (- e
$acl_dst_nocache_dom ) { system ( "touch $acl_dst_nocache_dom " ); }
160 unless (- e
$acl_dst_nocache_net ) { system ( "touch $acl_dst_nocache_net " ); }
161 unless (- e
$acl_dst_nocache_url ) { system ( "touch $acl_dst_nocache_url " ); }
162 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
163 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
164 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
165 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
167 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
169 my $HAVE_NTLM_AUTH = (- e
"/usr/bin/ntlm_auth" );
171 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
172 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
174 my $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
176 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
177 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
180 & Header
:: showhttpheaders
();
182 $proxysettings { 'ACTION' } = '' ;
183 $proxysettings { 'VALID' } = '' ;
185 $proxysettings { 'ENABLE' } = 'off' ;
186 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
187 $proxysettings { 'TRANSPARENT' } = 'off' ;
188 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
189 $proxysettings { 'PROXY_PORT' } = '800' ;
190 $proxysettings { 'TRANSPARENT_PORT' } = '3128' ;
191 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
192 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
193 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
194 $proxysettings { 'ERR_LANGUAGE' } = 'en' ;
195 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
196 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
197 $proxysettings { 'FORWARD_VIA' } = 'off' ;
198 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
199 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
200 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
201 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
202 $proxysettings { 'UPSTREAM_USER' } = '' ;
203 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
204 $proxysettings { 'LOGGING' } = 'off' ;
205 $proxysettings { 'CACHEMGR' } = 'off' ;
206 $proxysettings { 'LOGQUERY' } = 'off' ;
207 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
208 $proxysettings { 'FILEDESCRIPTORS' } = '16384' ;
209 $proxysettings { 'CACHE_MEM' } = '128' ;
210 $proxysettings { 'CACHE_SIZE' } = '0' ;
211 $proxysettings { 'MAX_SIZE' } = '4096' ;
212 $proxysettings { 'MIN_SIZE' } = '0' ;
213 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
214 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
215 $proxysettings { 'L1_DIRS' } = '16' ;
216 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
217 $proxysettings { 'CACHE_DIGESTS' } = 'off' ;
218 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
219 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
220 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
221 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
222 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
223 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
224 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
225 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
226 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
227 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
228 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
229 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
230 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
231 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
232 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
233 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
234 $proxysettings { 'FAKE_USERAGENT' } = '' ;
235 $proxysettings { 'FAKE_REFERER' } = '' ;
236 $proxysettings { 'AUTH_METHOD' } = 'none' ;
237 $proxysettings { 'AUTH_REALM' } = '' ;
238 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
239 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
240 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
241 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
242 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
243 $proxysettings { 'NCSA_USERNAME' } = '' ;
244 $proxysettings { 'NCSA_GROUP' } = '' ;
245 $proxysettings { 'NCSA_PASS' } = '' ;
246 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
247 $proxysettings { 'LDAP_BASEDN' } = '' ;
248 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
249 $proxysettings { 'LDAP_SERVER' } = '' ;
250 $proxysettings { 'LDAP_PORT' } = '389' ;
251 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
252 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
253 $proxysettings { 'LDAP_GROUP' } = '' ;
254 $proxysettings { 'NTLM_AUTH_GROUP' } = '' ;
255 $proxysettings { 'NTLM_AUTH_BASIC' } = 'off' ;
256 $proxysettings { 'NTLM_DOMAIN' } = '' ;
257 $proxysettings { 'NTLM_PDC' } = '' ;
258 $proxysettings { 'NTLM_BDC' } = '' ;
259 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
260 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
261 $proxysettings { 'RADIUS_SERVER' } = '' ;
262 $proxysettings { 'RADIUS_PORT' } = '1812' ;
263 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
264 $proxysettings { 'RADIUS_SECRET' } = '' ;
265 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
266 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
267 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
268 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
269 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
270 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
271 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
272 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
273 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
275 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
277 & Header
:: getcgihash
( \
%proxysettings );
279 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
280 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
281 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
282 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
284 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
286 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
289 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
291 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
292 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
293 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
295 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
296 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
298 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
299 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
301 if (! $errormessage ) {
302 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
303 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
305 $proxysettings { 'NCSA_USERNAME' } = '' ;
306 $proxysettings { 'NCSA_GROUP' } = '' ;
307 $proxysettings { 'NCSA_PASS' } = '' ;
308 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
311 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
313 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
314 & deluser
( $proxysettings { 'ID' });
317 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
318 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
319 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
321 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
323 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
324 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
325 @temp = split ( /:/ , $proxysettings { 'ID' });
326 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
327 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
328 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
329 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
332 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
334 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
335 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
336 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
337 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
338 $errormessage = $Lang :: tr
{ 'invalid input' };
341 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
342 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
346 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
348 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
351 if (!(& General
:: validport
( $proxysettings { 'TRANSPARENT_PORT' })))
353 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
356 if ( $proxysettings { 'PROXY_PORT' } eq $proxysettings { 'TRANSPARENT_PORT' }) {
357 $errormessage = $Lang :: tr
{ 'advproxy errmsg proxy ports equal' };
360 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
362 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
363 if (!(& General
:: validip
( $temp [ 0 ])))
365 if (!(& General
:: validdomainname
( $temp [ 0 ])))
367 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
372 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
373 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
375 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
377 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
381 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
382 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 1048576 ))
384 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
387 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ))
389 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
392 my @free = `/usr/bin/free` ;
393 $free [ 1 ] =~ m/(\d+)/ ;
394 $cachemem = int $1 / 2048 ;
395 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
396 $proxysettings { 'CACHE_MEM' } = $cachemem ;
398 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
400 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
403 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
405 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
408 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
410 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
413 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
415 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
418 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
420 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
423 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
425 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
426 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
427 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
429 if ( $netsettings { 'BLUE_DEV' })
431 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
432 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
434 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
438 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
440 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
445 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
447 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
450 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
451 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
453 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
456 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' ))
458 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
461 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
463 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
467 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
469 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
471 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
475 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
477 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
479 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
483 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
485 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
487 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
490 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
492 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
494 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
498 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
500 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
503 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
505 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
507 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
512 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
514 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
516 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
519 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
521 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
524 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
526 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
531 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
534 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
535 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
536 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
537 if (( $proxy1 ne $proxy2 ))
539 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
547 $proxysettings { 'VALID' } = 'no' ; }
549 $proxysettings { 'VALID' } = 'yes' ; }
551 if ( $proxysettings { 'VALID' } eq 'yes' )
555 delete $proxysettings { 'SRC_SUBNETS' };
556 delete $proxysettings { 'SRC_BANNED_IP' };
557 delete $proxysettings { 'SRC_BANNED_MAC' };
558 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
559 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
560 delete $proxysettings { 'DST_NOCACHE' };
561 delete $proxysettings { 'DST_NOAUTH' };
562 delete $proxysettings { 'PORTS_SAFE' };
563 delete $proxysettings { 'PORTS_SSL' };
564 delete $proxysettings { 'MIME_TYPES' };
565 delete $proxysettings { 'NTLM_ALLOW_USERS' };
566 delete $proxysettings { 'NTLM_DENY_USERS' };
567 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
568 delete $proxysettings { 'RADIUS_DENY_USERS' };
569 delete $proxysettings { 'IDENT_HOSTS' };
570 delete $proxysettings { 'IDENT_ALLOW_USERS' };
571 delete $proxysettings { 'IDENT_DENY_USERS' };
573 delete $proxysettings { 'CRE_GROUPS' };
574 delete $proxysettings { 'CRE_SVHOSTS' };
576 delete $proxysettings { 'NCSA_USERNAME' };
577 delete $proxysettings { 'NCSA_GROUP' };
578 delete $proxysettings { 'NCSA_PASS' };
579 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
581 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
582 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
583 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
584 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
585 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
586 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
587 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
589 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
590 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
592 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
594 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
595 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
596 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
597 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
598 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
599 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
600 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
601 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
602 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
607 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
609 system ( '/usr/local/bin/squidctrl' , 'disable' );
610 unlink "${General::swroot}/proxy/enable" ;
611 unlink "${General::swroot}/proxy/transparent" ;
612 unlink "${General::swroot}/proxy/enable_blue" ;
613 unlink "${General::swroot}/proxy/transparent_blue" ;
615 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
616 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
617 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
618 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
619 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
620 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
621 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
622 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
623 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
624 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
626 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
627 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { system ( '/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1' ); }
631 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
633 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
638 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
639 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
640 } elsif (- e
"${General::swroot}/proxy/settings" ) {
641 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
646 # ------------------------------------------------------------------
648 # Hook to regenerate the configuration files, if cgi got called from command line.
649 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
654 # -------------------------------------------------------------------
656 $checked { 'ENABLE' }{ 'off' } = '' ;
657 $checked { 'ENABLE' }{ 'on' } = '' ;
658 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
660 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
661 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
662 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
664 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
665 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
666 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
668 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
669 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
670 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
672 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
673 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
674 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
676 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
677 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
678 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
679 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
680 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
681 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
682 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
683 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
684 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
685 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
686 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
687 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
689 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
690 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
691 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
692 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
693 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
694 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
695 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
696 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
697 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
699 $checked { 'LOGGING' }{ 'off' } = '' ;
700 $checked { 'LOGGING' }{ 'on' } = '' ;
701 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
702 $checked { 'CACHEMGR' }{ 'off' } = '' ;
703 $checked { 'CACHEMGR' }{ 'on' } = '' ;
704 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
705 $checked { 'LOGQUERY' }{ 'off' } = '' ;
706 $checked { 'LOGQUERY' }{ 'on' } = '' ;
707 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
708 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
709 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
710 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
712 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
713 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
715 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
716 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
717 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
718 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
719 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
720 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
722 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
723 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
724 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
726 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
727 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
728 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
729 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
730 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
732 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
733 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
734 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
735 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
736 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
737 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
738 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
740 $checked { 'TIME_MON' }{ 'off' } = '' ;
741 $checked { 'TIME_MON' }{ 'on' } = '' ;
742 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
743 $checked { 'TIME_TUE' }{ 'off' } = '' ;
744 $checked { 'TIME_TUE' }{ 'on' } = '' ;
745 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
746 $checked { 'TIME_WED' }{ 'off' } = '' ;
747 $checked { 'TIME_WED' }{ 'on' } = '' ;
748 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
749 $checked { 'TIME_THU' }{ 'off' } = '' ;
750 $checked { 'TIME_THU' }{ 'on' } = '' ;
751 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
752 $checked { 'TIME_FRI' }{ 'off' } = '' ;
753 $checked { 'TIME_FRI' }{ 'on' } = '' ;
754 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
755 $checked { 'TIME_SAT' }{ 'off' } = '' ;
756 $checked { 'TIME_SAT' }{ 'on' } = '' ;
757 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
758 $checked { 'TIME_SUN' }{ 'off' } = '' ;
759 $checked { 'TIME_SUN' }{ 'on' } = '' ;
760 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
762 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
763 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
764 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
765 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
767 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
768 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
769 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
771 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
772 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
773 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
774 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
775 $checked { 'AUTH_METHOD' }{ 'ntlm-auth' } = '' ;
776 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
777 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
779 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
781 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
782 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
783 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
785 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
786 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
787 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
789 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
791 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
793 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
795 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
796 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
797 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
799 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
800 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
801 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
803 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
804 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
805 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
807 $checked { 'NTLM_AUTH_BASIC' }{ 'on' } = '' ;
808 $checked { 'NTLM_AUTH_BASIC' }{ 'off' } = '' ;
809 $checked { 'NTLM_AUTH_BASIC' }{ $proxysettings { 'NTLM_AUTH_BASIC' }} = "checked='checked'" ;
811 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
812 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
813 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
815 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
816 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
817 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
819 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
820 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
821 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
823 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
824 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
825 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
827 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
828 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
829 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
831 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
832 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
833 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
835 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
836 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
837 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
839 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
840 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
841 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
843 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
845 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
848 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
849 print "<font class='base'> $errormessage </font> \n " ;
853 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
855 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
856 $squidversion [ 0 ] =~ s/^\s+//g ;
857 $squidversion [ 0 ] =~ s/\s+$//g ;
859 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
862 # ===================================================================
864 # ===================================================================
866 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
868 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
870 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
875 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
878 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
879 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
880 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td>
881 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
884 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
885 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
886 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td>
887 <td width='30%'><input type='text' name='TRANSPARENT_PORT' value=' $proxysettings {'TRANSPARENT_PORT'}' size='5' /></td>
892 if ( $netsettings { 'BLUE_DEV' }) {
893 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
894 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
896 print "<td colspan='2'> </td>" ;
899 <td class='base'> $Lang ::tr{'advproxy visible hostname'}:</td>
900 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
905 if ( $netsettings { 'BLUE_DEV' }) {
906 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
907 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
909 print "<td colspan='2'> </td>" ;
912 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
914 <select name='ERR_LANGUAGE'>
917 foreach (< $errordir /*>) {
919 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
920 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
928 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
929 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
930 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
931 <td class='base'><select name='ERR_DESIGN'>
932 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
933 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
937 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
938 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
947 if ( - e
"/usr/bin/squidclamav" ) {
948 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
949 if ( ! - e
"/var/run/clamav/clamd.pid" ){
950 print "<font color='red'>clamav not running</font><br /><br />" ;
951 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
954 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
960 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</a></b><br />" ;
961 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
963 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</a></b><br />" ;
964 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
971 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
974 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
975 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
976 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}:</td>
977 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
980 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
981 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
982 <td class='base'> $Lang ::tr{'advproxy upstream username'}:</td>
983 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
986 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
987 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
988 <td class='base'> $Lang ::tr{'advproxy upstream password'}:</td>
989 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
992 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
993 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1001 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1004 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1005 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1006 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1007 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1012 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1013 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1017 <table width='100%'>
1019 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1022 <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'> $Lang ::tr{'proxy cachemgr'}:</td>
1023 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1024 <td class='base'> $Lang ::tr{'advproxy admin mail'}:</td>
1025 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1028 <td class='base'> $Lang ::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td>
1029 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1030 <td class='base'> $Lang ::tr{'proxy admin password'}:</td>
1031 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1034 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1037 <td class='base'> $Lang ::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td>
1038 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1039 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td>
1040 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1043 <td class='base'> $Lang ::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td>
1044 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1045 <td class='base'> $Lang ::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td>
1046 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1049 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1050 <td class='base'><select name='L1_DIRS'>
1051 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1052 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1053 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1054 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1055 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1057 <td colspan='2' rowspan= '5' valign='top' class='base'>
1058 <table cellspacing='0' cellpadding='0'>
1060 <!-- intentionally left empty -->
1063 <td> $Lang ::tr{'advproxy no cache sites'}:</td>
1066 <!-- intentionally left empty -->
1069 <!-- intentionally left empty -->
1072 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1076 print $proxysettings { 'DST_NOCACHE' };
1085 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1086 <td class='base'><select name='MEM_POLICY'>
1087 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1088 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1089 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1090 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1094 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1095 <td class='base'><select name='CACHE_POLICY'>
1096 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1097 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1098 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1099 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1103 <td colspan='2'> </td>
1106 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1107 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1110 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1111 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1115 <table width='100%'>
1117 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1120 <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
1123 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td>
1124 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td>
1127 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1130 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1134 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1137 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1144 <table width='100%'>
1146 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1149 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1152 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td>
1155 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1159 if (! $proxysettings { 'SRC_SUBNETS' })
1161 print " $green_cidr \n " ;
1162 if ( $netsettings { 'BLUE_DEV' })
1164 print " $blue_cidr \n " ;
1166 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1173 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1174 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1175 print "<td class='base'> $line :</td> \n " ;
1177 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1181 if ( $netsettings { 'BLUE_DEV' }) {
1182 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1183 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1185 print "<td class='base'> $line :</td> \n " ;
1187 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1194 <td colspan='2'> </td>
1197 <td colspan='2'> </td>
1200 <table width='100%'>
1202 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1205 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}:</td>
1206 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}:</td>
1209 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1213 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1217 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1221 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1227 <table width='100%'>
1229 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1232 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}:</td>
1233 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}:</td>
1236 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1240 print $proxysettings { 'SRC_BANNED_IP' };
1244 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1248 print $proxysettings { 'SRC_BANNED_MAC' };
1259 # -------------------------------------------------------------------
1260 # CRE GUI - optional
1261 # -------------------------------------------------------------------
1263 if (- e
$cre_enabled ) { print <<END
1264 <table width='100%'>
1267 <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>
1270 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1276 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1278 <td class='base'> $Lang ::tr{'advproxy supervisor password'}:</td>
1279 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1282 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1283 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}:</td>
1288 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1291 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1295 print $proxysettings { 'CRE_GROUPS' };
1299 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1302 print $proxysettings { 'CRE_SVHOSTS' };
1310 print "</table><hr size='1'>" ;
1314 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1315 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1316 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1321 # -------------------------------------------------------------------
1325 <table width='100%'>
1327 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1329 <table width='100%'>
1331 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1332 <td width='1%'> </td>
1333 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1334 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1335 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1336 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1337 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1338 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1339 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1340 <td width='1%'> </td>
1341 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1342 <td width='1%'> </td>
1343 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1348 <select name='TIME_ACCESS_MODE'>
1349 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1350 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1354 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1355 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1356 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1357 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1358 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1359 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1360 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1363 <select name='TIME_FROM_HOUR'>
1366 for ( $i = 0 ; $i <= 24 ; $i ++) {
1367 $_ = sprintf ( " %02s " , $i );
1368 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1375 <select name='TIME_FROM_MINUTE'>
1378 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1379 $_ = sprintf ( " %02s " , $i );
1380 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1387 <select name='TIME_TO_HOUR'>
1390 for ( $i = 0 ; $i <= 24 ; $i ++) {
1391 $_ = sprintf ( " %02s " , $i );
1392 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1399 <select name='TIME_TO_MINUTE'>
1402 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1403 $_ = sprintf ( " %02s " , $i );
1404 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1412 <table width='100%'>
1414 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1417 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td>
1418 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1419 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td>
1420 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1424 <table width='100%'>
1426 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1429 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1430 <td width='20%' class='base'>
1431 <select name='THROTTLING_GREEN_TOTAL'>
1435 foreach ( @throttle_limits ) {
1437 my $unit = "kbit/s" ;
1444 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $val $unit </option> \n " ;
1448 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1451 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1452 <td width='30%' class='base'>
1453 <select name='THROTTLING_GREEN_HOST'>
1457 foreach ( @throttle_limits ) {
1458 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1462 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1469 if ( $netsettings { 'BLUE_DEV' }) {
1472 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1474 <select name='THROTTLING_BLUE_TOTAL'>
1478 foreach ( @throttle_limits ) {
1479 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1483 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1486 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1488 <select name='THROTTLING_BLUE_HOST'>
1492 foreach ( @throttle_limits ) {
1493 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1497 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1508 <table width='100%'>
1510 <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>
1514 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1517 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}:</td>
1522 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1526 print $proxysettings { 'MIME_TYPES' };
1541 <table width='100%'>
1543 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1546 <td class='base'> $Lang ::tr{'advproxy fake useragent'}:</td>
1547 <td class='base'> $Lang ::tr{'advproxy fake referer'}:</td>
1550 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='40%' /></td>
1551 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='40%' /></td>
1558 my $auth_columns = 5 ;
1559 if ( $HAVE_NTLM_AUTH ) {
1562 my $auth_column_width = 100 / $auth_columns ;
1565 <table width='100%'>
1567 <td colspan=' $auth_columns '><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1570 <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>
1571 <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>
1572 <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>
1573 <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>
1576 if ( $HAVE_NTLM_AUTH ) {
1578 <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>
1583 <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>
1589 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1591 <table width='100%'>
1593 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1596 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1599 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1600 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1601 <td colspan='2' rowspan= '6' valign='top' class='base'>
1602 <table cellpadding='0' cellspacing='0'>
1604 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}:</td>
1607 <!-- intentionally left empty -->
1610 <!-- intentionally left empty -->
1613 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1616 <!-- intentionally left empty -->
1619 <!-- intentionally left empty -->
1622 <td> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1625 <!-- intentionally left empty -->
1628 <!-- intentionally left empty -->
1631 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1635 print $proxysettings { 'DST_NOAUTH' };
1644 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1645 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1648 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}:</td>
1649 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1652 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1653 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1656 <td colspan='2'> </td>
1663 # ===================================================================
1664 # NCSA auth settings
1665 # ===================================================================
1667 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1670 <table width='100%'>
1672 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1675 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1676 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1677 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1678 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1681 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1689 # ===================================================================
1690 # IDENTD auth settings
1691 # ===================================================================
1693 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1696 <table width='100%'>
1698 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1701 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1702 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1703 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1704 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1707 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1708 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1713 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1714 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1717 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1720 if (! $proxysettings { 'IDENT_HOSTS' }) {
1721 print " $green_cidr \n " ;
1722 if ( $netsettings { 'BLUE_DEV' }) {
1723 print " $blue_cidr \n " ;
1726 print $proxysettings { 'IDENT_HOSTS' };
1731 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1735 print $proxysettings { 'DST_NOAUTH' };
1742 <table width='100%'>
1744 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1747 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1748 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1749 <td width='25%'> </td>
1750 <td width='30%'> </td>
1753 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1754 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1755 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1756 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1759 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1760 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1763 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1767 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1769 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1771 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1775 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1777 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1784 # ===================================================================
1785 # NTLM-AUTH settings
1786 # ===================================================================
1788 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' ) {
1791 <table width='100%'>
1792 <td width='20%' class='base'> $Lang ::tr{'advproxy basic authentication'}:</td>
1793 <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked {'NTLM_AUTH_BASIC'}{'on'} /></td>
1794 <td colspan='2'> </td>
1799 <table width='100%'>
1801 <td colspan='4'><b> $Lang ::tr{'advproxy group access control'}</b></td>
1804 <td width='20%' class='base'> $Lang ::tr{'advproxy group required'}:</td>
1805 <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value=' $proxysettings {'NTLM_AUTH_GROUP'}' size='37' /></td>
1813 # ===================================================================
1814 # LDAP auth settings
1815 # ===================================================================
1817 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1820 <table width='100%'>
1822 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1825 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1826 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1827 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1828 <td class='base'><select name='LDAP_TYPE'>
1829 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1830 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1831 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1832 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1836 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1837 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1838 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1839 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1843 <table width='100%'>
1845 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1848 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1849 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1850 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1851 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1855 <table width='100%'>
1857 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1860 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}:</td>
1861 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1869 # ===================================================================
1870 # RADIUS auth settings
1871 # ===================================================================
1873 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
1876 <table width='100%'>
1878 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
1881 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
1882 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
1883 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
1884 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
1887 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}:</td>
1888 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
1889 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
1890 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
1894 <table width='100%'>
1896 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
1899 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1900 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
1901 <td width='25%'> </td>
1902 <td width='30%'> </td>
1905 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
1906 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
1907 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
1908 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
1911 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
1912 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
1915 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1919 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
1921 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
1923 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
1927 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
1929 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
1936 # ===================================================================
1942 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
1944 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
1945 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1946 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1947 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
1948 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
1949 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
1953 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1955 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
1956 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1957 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1958 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
1962 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
1964 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
1965 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
1969 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
1971 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
1972 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
1973 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
1974 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
1975 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
1976 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
1977 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
1981 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
1983 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
1984 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
1985 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
1986 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
1987 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
1988 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
1989 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
1993 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
1995 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
1996 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
1997 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
1998 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
1999 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2000 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2001 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2002 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2014 <table width='100%'>
2017 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2018 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2019 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2020 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2026 <table width='100%'>
2028 <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'> $Lang ::tr{'required field'}</font></td>
2029 <td align='right'> </td>
2036 & Header
:: closebox
();
2040 # ===================================================================
2041 # NCSA user management
2042 # ===================================================================
2044 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2046 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2047 <table width='100%'>
2049 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2052 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2053 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2056 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly='readonly' " ; }
2059 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2061 <select name='NCSA_GROUP'>
2062 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2063 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2064 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2070 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2071 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2072 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2073 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2080 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2081 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2082 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2085 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2086 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2092 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2097 <table width='100%'>
2099 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2102 <table width='100%' align='center'>
2108 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2109 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2113 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2114 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2118 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2119 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2122 @userlist = sort ( @userlist );
2124 # If the password file contains entries, print entries and action icons
2126 if ( ! - z
" $userdb " ) {
2129 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2130 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2131 <td class='boldbase' colspan='2' align='center'> </td>
2136 foreach $line ( @userlist )
2140 @temp = split ( /:/ , $line );
2141 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2142 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2144 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2146 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2149 <td align='center'> $temp [0]</td>
2153 if ( $temp [ 1 ] eq 'standard' ) {
2154 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2155 } elsif ( $temp [ 1 ] eq 'extended' ) {
2156 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2157 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2158 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2161 <td width='8%' align='center'>
2162 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2163 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2164 <input type='hidden' name='ID' value=' $line ' />
2165 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2169 <td width='8%' align='center'>
2170 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2171 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2172 <input type='hidden' name='ID' value=' $temp [0]' />
2173 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2186 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2187 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2188 <td class='base'> $Lang ::tr{'edit'}</td>
2189 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2190 <td class='base'> $Lang ::tr{'remove'}</td>
2197 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2208 & Header
:: closebox
();
2212 # ===================================================================
2214 & Header
:: closebigbox
();
2216 & Header
:: closepage
();
2218 # -------------------------------------------------------------------
2222 if (- e
" $acl_src_subnets " ) {
2223 open ( FILE
, " $acl_src_subnets " );
2224 delete $proxysettings { 'SRC_SUBNETS' };
2225 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2228 if (- e
" $acl_src_banned_ip " ) {
2229 open ( FILE
, " $acl_src_banned_ip " );
2230 delete $proxysettings { 'SRC_BANNED_IP' };
2231 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2234 if (- e
" $acl_src_banned_mac " ) {
2235 open ( FILE
, " $acl_src_banned_mac " );
2236 delete $proxysettings { 'SRC_BANNED_MAC' };
2237 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2240 if (- e
" $acl_src_unrestricted_ip " ) {
2241 open ( FILE
, " $acl_src_unrestricted_ip " );
2242 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2243 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2246 if (- e
" $acl_src_unrestricted_mac " ) {
2247 open ( FILE
, " $acl_src_unrestricted_mac " );
2248 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2249 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2252 if (- e
" $acl_dst_nocache " ) {
2253 open ( FILE
, " $acl_dst_nocache " );
2254 delete $proxysettings { 'DST_NOCACHE' };
2255 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2258 if (- e
" $acl_dst_noauth " ) {
2259 open ( FILE
, " $acl_dst_noauth " );
2260 delete $proxysettings { 'DST_NOAUTH' };
2261 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2264 if (- e
" $acl_ports_safe " ) {
2265 open ( FILE
, " $acl_ports_safe " );
2266 delete $proxysettings { 'PORTS_SAFE' };
2267 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2270 if (- e
" $acl_ports_ssl " ) {
2271 open ( FILE
, " $acl_ports_ssl " );
2272 delete $proxysettings { 'PORTS_SSL' };
2273 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2276 if (- e
" $mimetypes " ) {
2277 open ( FILE
, " $mimetypes " );
2278 delete $proxysettings { 'MIME_TYPES' };
2279 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2282 if (- e
" $raddir /radauth.allowusers" ) {
2283 open ( FILE
, " $raddir /radauth.allowusers" );
2284 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2285 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2288 if (- e
" $raddir /radauth.denyusers" ) {
2289 open ( FILE
, " $raddir /radauth.denyusers" );
2290 delete $proxysettings { 'RADIUS_DENY_USERS' };
2291 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2294 if (- e
" $identdir /identauth.allowusers" ) {
2295 open ( FILE
, " $identdir /identauth.allowusers" );
2296 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2297 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2300 if (- e
" $identdir /identauth.denyusers" ) {
2301 open ( FILE
, " $identdir /identauth.denyusers" );
2302 delete $proxysettings { 'IDENT_DENY_USERS' };
2303 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2306 if (- e
" $identhosts " ) {
2307 open ( FILE
, " $identhosts " );
2308 delete $proxysettings { 'IDENT_HOSTS' };
2309 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2312 if (- e
" $cre_groups " ) {
2313 open ( FILE
, " $cre_groups " );
2314 delete $proxysettings { 'CRE_GROUPS' };
2315 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2318 if (- e
" $cre_svhosts " ) {
2319 open ( FILE
, " $cre_svhosts " );
2320 delete $proxysettings { 'CRE_SVHOSTS' };
2321 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2326 # -------------------------------------------------------------------
2330 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2331 undef $proxysettings { 'PORTS_SAFE' };
2334 s/^\s+//g ; s/\s+$//g ;
2338 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2340 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2341 @templist = split ( /-/ );
2342 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2343 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2347 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2348 undef $proxysettings { 'PORTS_SSL' };
2351 s/^\s+//g ; s/\s+$//g ;
2356 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2357 @templist = split ( /-/ );
2358 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2359 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2363 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2364 undef $proxysettings { 'DST_NOCACHE' };
2368 unless ( /^#/ ) { s/\s+//g ; }
2371 if ( /^\./ ) { $_ = '*' . $_ ; }
2372 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2376 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2377 undef $proxysettings { 'SRC_SUBNETS' };
2380 s/^\s+//g ; s/\s+$//g ;
2383 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2384 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2388 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2389 undef $proxysettings { 'SRC_BANNED_IP' };
2392 s/^\s+//g ; s/\s+$//g ;
2395 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2396 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2400 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2401 undef $proxysettings { 'SRC_BANNED_MAC' };
2404 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2407 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2408 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2412 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2413 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2416 s/^\s+//g ; s/\s+$//g ;
2419 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2420 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2424 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2425 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2428 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2431 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2432 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2436 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2437 undef $proxysettings { 'DST_NOAUTH' };
2441 unless ( /^#/ ) { s/\s+//g ; }
2444 if ( /^\./ ) { $_ = '*' . $_ ; }
2445 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2449 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2451 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2452 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2455 s/^\s+//g ; s/\s+$//g ;
2456 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2458 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2461 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2463 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2464 undef $proxysettings { 'NTLM_DENY_USERS' };
2467 s/^\s+//g ; s/\s+$//g ;
2468 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2470 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2473 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2475 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2476 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2479 s/^\s+//g ; s/\s+$//g ;
2480 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2482 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2485 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2487 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2488 undef $proxysettings { 'IDENT_DENY_USERS' };
2491 s/^\s+//g ; s/\s+$//g ;
2492 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2494 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2497 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2499 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2500 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2503 s/^\s+//g ; s/\s+$//g ;
2504 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2506 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2509 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2511 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2512 undef $proxysettings { 'RADIUS_DENY_USERS' };
2515 s/^\s+//g ; s/\s+$//g ;
2516 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2518 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2521 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2522 undef $proxysettings { 'IDENT_HOSTS' };
2525 s/^\s+//g ; s/\s+$//g ;
2528 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2529 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2533 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2534 undef $proxysettings { 'CRE_SVHOSTS' };
2537 s/^\s+//g ; s/\s+$//g ;
2540 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2541 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2546 # -------------------------------------------------------------------
2550 open ( FILE
, "> $acl_src_subnets " );
2552 if (! $proxysettings { 'SRC_SUBNETS' })
2554 print FILE
" $green_cidr \n " ;
2555 if ( $netsettings { 'BLUE_DEV' })
2557 print FILE
" $blue_cidr \n " ;
2559 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2562 open ( FILE
, "> $acl_src_banned_ip " );
2564 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2567 open ( FILE
, "> $acl_src_banned_mac " );
2569 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2572 open ( FILE
, "> $acl_src_unrestricted_ip " );
2574 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2577 open ( FILE
, "> $acl_src_unrestricted_mac " );
2579 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2582 open ( FILE
, "> $acl_dst_noauth " );
2584 print FILE
$proxysettings { 'DST_NOAUTH' };
2587 open ( FILE
, "> $acl_dst_noauth_net " );
2589 open ( FILE
, "> $acl_dst_noauth_dom " );
2591 open ( FILE
, "> $acl_dst_noauth_url " );
2594 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2602 open ( FILE
, ">> $acl_dst_noauth_dom " );
2607 elsif (& General
:: validipormask
( $_ ))
2609 open ( FILE
, ">> $acl_dst_noauth_net " );
2614 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?/ )
2616 open ( FILE
, ">> $acl_dst_noauth_net " );
2623 open ( FILE
, ">> $acl_dst_noauth_url " );
2625 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2631 open ( FILE
, "> $acl_dst_nocache " );
2633 print FILE
$proxysettings { 'DST_NOCACHE' };
2636 open ( FILE
, "> $acl_dst_nocache_net " );
2638 open ( FILE
, "> $acl_dst_nocache_dom " );
2640 open ( FILE
, "> $acl_dst_nocache_url " );
2643 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2651 open ( FILE
, ">> $acl_dst_nocache_dom " );
2656 elsif (& General
:: validipormask
( $_ ))
2658 open ( FILE
, ">> $acl_dst_nocache_net " );
2663 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?/ )
2665 open ( FILE
, ">> $acl_dst_nocache_net " );
2672 open ( FILE
, ">> $acl_dst_nocache_url " );
2674 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2680 open ( FILE
, "> $acl_ports_safe " );
2682 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2685 open ( FILE
, "> $acl_ports_ssl " );
2687 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2690 if (- s
$throttled_urls )
2692 open ( URLFILE
, $throttled_urls );
2695 foreach ( @temp ) { print FILE
; }
2699 open ( FILE
, "> $mimetypes " );
2701 print FILE
$proxysettings { 'MIME_TYPES' };
2704 open ( FILE
, "> $raddir /radauth.allowusers" );
2706 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2709 open ( FILE
, "> $raddir /radauth.denyusers" );
2711 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2714 open ( FILE
, "> $identdir /identauth.allowusers" );
2716 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2719 open ( FILE
, "> $identdir /identauth.denyusers" );
2721 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2724 open ( FILE
, "> $identhosts " );
2726 print FILE
$proxysettings { 'IDENT_HOSTS' };
2729 open ( FILE
, "> $cre_groups " );
2731 print FILE
$proxysettings { 'CRE_GROUPS' };
2734 open ( FILE
, "> $cre_svhosts " );
2736 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2740 # -------------------------------------------------------------------
2744 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2746 print FILE
"function FindProxyForURL(url, host) \n " ;
2748 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2752 (isPlainHostName(host)) ||
2753 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2757 if ( $netsettings { 'GREEN_DEV' }) {
2758 print FILE
" (isInNet(host, \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" )) || \n " ;
2761 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
2762 print FILE
" (isInNet(host, \" $netsettings {'BLUE_NETADDRESS'} \" , \" $netsettings {'BLUE_NETMASK'} \" )) || \n " ;
2765 if (& Header
:: orange_used
() && $netsettings { 'ORANGE_DEV' }) {
2766 print FILE
" (isInNet(host, \" $netsettings {'ORANGE_NETADDRESS'} \" , \" $netsettings {'ORANGE_NETMASK'} \" )) || \n " ;
2769 # Additional exceptions for URLs
2770 # The file has to be created by the user and should contain one entry per line
2771 # Line-Format: <URL incl. wildcards>
2773 if (- s
" $acl_dst_noproxy_url " ) {
2776 open ( NOPROXY
, " $acl_dst_noproxy_url " );
2777 @templist = < NOPROXY
>;
2783 print FILE
" (shExpMatch(url, \" $_ \" )) || \n " ;
2787 # Additional exceptions for Subnets
2788 # The file has to be created by the user and should contain one entry per line
2789 # Line-Format: "<IP>", "<SUBNET MASK>"
2790 # e.g. "192.168.0.0", "255.255.255.0"
2791 if (- s
" $acl_dst_noproxy_ip " ) {
2794 open ( NOPROXY
, " $acl_dst_noproxy_ip " );
2795 @templist = < NOPROXY
>;
2801 print FILE
" (isInNet(host, $_ )) || \n " ;
2806 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2814 if ( $proxysettings { 'ENABLE' } eq 'on' )
2816 print FILE
"if ( \n " ;
2817 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2820 if (- e
" $acl_src_subnets " ) {
2821 open ( SUBNETS
, " $acl_src_subnets " );
2822 @templist = < SUBNETS
>;
2828 @temp = split ( /\/ /);
2830 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2831 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2835 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
2843 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2847 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
2849 print FILE
" \n else \n\n " ;
2851 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2855 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
2857 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2866 # -------------------------------------------------------------------
2873 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
2874 $proxysettings { 'THROTTLING_GREEN_HOST' } +
2875 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
2876 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
2878 $delaypools = 1 ; } else { $delaypools = 0 ;
2881 if ( $proxysettings { 'AUTH_REALM' } eq '' )
2883 $authrealm = "IPFire Advanced Proxy Server" ;
2885 $authrealm = $proxysettings { 'AUTH_REALM' };
2888 $_ = $proxysettings { 'UPSTREAM_PROXY' };
2889 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
2891 if ( $remoteport eq '' ) { $remoteport = 80 ; }
2893 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
2896 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
2897 # you make will be overwritten whenever you resave proxy settings using the
2900 # Instead, modify the file ' $acl_include ' and
2901 # then restart the proxy service using the web interface. Changes made to the
2902 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
2904 shutdown_lifetime 5 seconds
2910 # Include file with user defined settings.
2911 if (- e
"/etc/squid/squid.conf.pre.local" ) {
2912 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
2915 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2916 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2919 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) {
2920 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
2921 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2925 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
2926 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2927 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2930 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) {
2931 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
2932 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2937 if (( $proxysettings { 'CACHE_SIZE' } > 0 ) || ( $proxysettings { 'CACHE_MEM' } > 0 ))
2941 if (!- z
$acl_dst_nocache_dom ) {
2942 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
2943 print FILE
"cache deny no_cache_domains \n " ;
2945 if (!- z
$acl_dst_nocache_net ) {
2946 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
2947 print FILE
"cache deny no_cache_ipaddr \n " ;
2949 if (!- z
$acl_dst_nocache_url ) {
2950 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
2951 print FILE
"cache deny no_cache_hosts \n " ;
2957 cache_effective_user squid
2960 pid_filename /var/run/squid.pid
2962 cache_mem $proxysettings {'CACHE_MEM'} MB
2965 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
2967 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
2968 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
2970 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
2972 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
2974 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
2976 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
2978 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
2983 open ( PORTS
, " $acl_ports_ssl " );
2984 my @ssl_ports = < PORTS
>;
2988 foreach ( @ssl_ports ) {
2989 print FILE
"acl SSL_ports port $_ " ;
2993 open ( PORTS
, " $acl_ports_safe " );
2994 my @safe_ports = < PORTS
>;
2998 foreach ( @safe_ports ) {
2999 print FILE
"acl Safe_ports port $_ " ;
3005 acl IPFire_http port $http_port
3006 acl IPFire_https port $https_port
3007 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3008 acl IPFire_networks src " $acl_src_subnets "
3009 acl IPFire_servers dst " $acl_src_subnets "
3010 acl IPFire_green_network src $green_cidr
3011 acl IPFire_green_servers dst $green_cidr
3014 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3015 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3016 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3017 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3018 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3019 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3021 acl CONNECT method CONNECT
3025 if ( $proxysettings { 'CACHE_SIZE' } > 0 ) {
3027 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3028 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3030 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
3034 if ( $proxysettings { 'CACHE_MEM' } > 0 ) {
3035 # always 2% of CACHE_MEM defined as max object size
3036 print FILE
"maximum_object_size_in_memory " . int ( $proxysettings { 'CACHE_MEM' } * 1024 * 0.02 ) . " KB \n\n " ;
3038 print FILE
"cache deny all \n\n " ;
3043 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3047 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3048 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3049 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3050 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3052 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3056 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3058 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3061 if ( $proxysettings { 'LOGGING' } eq 'on' )
3064 access_log stdio:/var/log/squid/access.log
3065 cache_log /var/log/squid/cache.log
3066 cache_store_log none
3069 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"access_log stdio:\/var\/log\/squid\/user_agent.log useragent \n " ; }
3070 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3073 access_log /dev/null
3075 cache_store_log none
3084 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3086 print FILE
"forwarded_for on \n " ;
3088 print FILE
"forwarded_for off \n " ;
3090 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3092 print FILE
"via on \n " ;
3094 print FILE
"via off \n " ;
3098 # If we use authentication, users must always authenticate
3099 unless ( $proxysettings { "AUTH_METHOD" } eq "" ) {
3100 print FILE
"authenticate_ip_ttl 0 \n\n " ;
3103 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3105 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3107 print FILE
"auth_param basic program $authdir /basic_ncsa_auth $userdb \n " ;
3108 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3109 print FILE
"auth_param basic realm $authrealm \n " ;
3110 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3113 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3115 print FILE
"auth_param basic utf8 on \n " ;
3116 print FILE
"auth_param basic program $authdir /basic_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3117 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3118 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3119 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3121 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3123 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3125 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3127 print FILE
" -u sAMAccountName -P" ;
3129 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3131 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3133 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3135 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3137 print FILE
" -u cn -P" ;
3139 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3141 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3143 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3145 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3147 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3148 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3149 print FILE
" -u uid -P" ;
3151 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3152 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3153 print FILE
"auth_param basic realm $authrealm \n " ;
3154 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3157 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' )
3159 print FILE
"auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" ;
3160 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3161 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3162 $ntlm_auth_group =~ s/\\/\+/ ;
3164 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3168 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n\n " ;
3169 print FILE
"auth_param ntlm credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3171 # BASIC authentication
3172 if ( $proxysettings { 'NTLM_AUTH_BASIC' } eq "on" ) {
3173 print FILE
"auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic" ;
3174 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3175 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3176 $ntlm_auth_group =~ s/\\/\+/ ;
3178 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3181 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3182 print FILE
"auth_param basic realm $authrealm \n " ;
3183 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3187 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3189 print FILE
"auth_param basic program $authdir /basic_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3190 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3191 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3192 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3193 print FILE
"auth_param basic realm $authrealm \n " ;
3194 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3198 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3199 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3201 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3203 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3205 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3207 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3210 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3213 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3214 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3216 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3219 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3220 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3221 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3226 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3228 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3230 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3232 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3234 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3236 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3238 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3240 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3243 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3244 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3245 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3249 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3251 print FILE
"acl within_timeframe time " ;
3252 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3253 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3254 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3255 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3256 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3257 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3258 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3259 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3260 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3261 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3262 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3264 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3265 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3268 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3271 #Classroom extensions
3272 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3273 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3276 print FILE
"deny_info " ;
3277 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3279 print FILE
"ERR_ACCESS_DISABLED" ;
3281 print FILE
"ERR_ACCESS_DENIED" ;
3283 print FILE
" IPFire_no_access_ips \n " ;
3284 print FILE
"deny_info " ;
3285 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3287 print FILE
"ERR_ACCESS_DISABLED" ;
3289 print FILE
"ERR_ACCESS_DENIED" ;
3291 print FILE
" IPFire_no_access_mac \n " ;
3294 http_access deny IPFire_no_access_ips
3295 http_access deny IPFire_no_access_mac
3300 #Insert acl file and replace __VAR__ with correct values
3301 my $blue_net = '' ; #BLUE empty by default
3303 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3304 $blue_net = " $blue_cidr " ;
3305 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3307 if (!- z
$acl_include )
3309 open ( ACL
, " $acl_include " );
3310 print FILE
" \n #Start of custom includes \n\n " ;
3312 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3313 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3314 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3315 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3316 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3319 print FILE
" \n #End of custom includes \n " ;
3322 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3324 # Check if squidclamav is enabled.
3325 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3326 print FILE
" \n #Settings for squidclamav: \n " ;
3327 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} \n " ;
3328 print FILE
"acl purge method PURGE \n " ;
3329 print FILE
"http_access deny to_localhost \n " ;
3330 print FILE
"http_access allow localhost \n " ;
3331 print FILE
"http_access allow purge localhost \n " ;
3332 print FILE
"http_access deny purge \n " ;
3333 print FILE
"url_rewrite_access deny localhost \n " ;
3338 #local machine, no restriction
3339 http_access allow localhost
3341 #GUI admin if local machine connects
3342 http_access allow IPFire_ips IPFire_networks IPFire_http
3343 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3345 #Deny not web services
3349 print FILE
"http_access deny !Safe_ports \n " ;
3353 print FILE
"http_access deny CONNECT !SSL_ports \n " ;
3356 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3358 print FILE
"#Set ident ACLs \n " ;
3359 if (!- z
$identhosts )
3361 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3362 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3363 print FILE
"ident_lookup_access deny all \n " ;
3365 print FILE
"ident_lookup_access allow all \n " ;
3367 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3371 print FILE
"#Set download throttling \n " ;
3373 if ( $netsettings { 'BLUE_DEV' })
3375 print FILE
"delay_pools 2 \n " ;
3377 print FILE
"delay_pools 1 \n " ;
3380 print FILE
"delay_class 1 3 \n " ;
3381 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3383 print FILE
"delay_parameters 1 " ;
3384 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3388 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3390 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3393 print FILE
" -1/-1 " ;
3394 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3398 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3400 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3404 if ( $netsettings { 'BLUE_DEV' })
3406 print FILE
"delay_parameters 2 " ;
3407 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3411 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3413 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3415 print FILE
" -1/-1 " ;
3416 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3420 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3422 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3427 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3428 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3429 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3430 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3432 if ( $netsettings { 'BLUE_DEV' })
3434 print FILE
"delay_access 1 allow IPFire_green_network" ;
3435 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3437 print FILE
"delay_access 1 deny all \n " ;
3439 print FILE
"delay_access 1 allow all" ;
3440 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3444 if ( $netsettings { 'BLUE_DEV' })
3446 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3447 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3448 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3449 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3450 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3451 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3453 print FILE
"delay_access 2 deny all \n " ;
3456 print FILE
"delay_initial_bucket_level 100 \n " ;
3460 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3462 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3463 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3466 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3468 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3469 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3470 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3474 #Set custom configured ACLs
3477 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3478 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3480 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3482 if (!- z
$acl_src_unrestricted_ip )
3484 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3485 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3486 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3488 if (!- z
$acl_src_unrestricted_mac )
3490 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3491 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3492 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3494 if (!- z
$acl_dst_noauth_net )
3496 print FILE
"http_access allow IPFire_networks" ;
3497 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3498 print FILE
" !within_timeframe" ;
3500 print FILE
" within_timeframe" ; }
3501 print FILE
" to_ipaddr_without_auth \n " ;
3503 if (!- z
$acl_dst_noauth_dom )
3505 print FILE
"http_access allow IPFire_networks" ;
3506 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3507 print FILE
" !within_timeframe" ;
3509 print FILE
" within_timeframe" ; }
3510 print FILE
" to_domains_without_auth \n " ;
3512 if (!- z
$acl_dst_noauth_url )
3514 print FILE
"http_access allow IPFire_networks" ;
3515 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3516 print FILE
" !within_timeframe" ;
3518 print FILE
" within_timeframe" ; }
3519 print FILE
" to_hosts_without_auth \n " ;
3523 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3525 print FILE
"http_access deny !for_inetusers" ;
3526 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3531 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3532 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3533 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3534 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3535 (!- z
" $identdir /identauth.denyusers" )
3538 print FILE
"http_access deny for_acl_users" ;
3539 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3543 if (!- z
$acl_src_unrestricted_ip )
3545 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3546 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3548 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3550 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3552 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3554 print FILE
" for_inetusers" ;
3556 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3558 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3560 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3562 print FILE
" for_acl_users" ;
3564 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3566 print FILE
" !for_acl_users" ;
3568 } else { print FILE
" for_inetusers" ; }
3574 if (!- z
$acl_src_unrestricted_mac )
3576 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3577 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3579 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3581 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3583 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3585 print FILE
" for_inetusers" ;
3587 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3589 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3591 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3593 print FILE
" for_acl_users" ;
3595 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3597 print FILE
" !for_acl_users" ;
3599 } else { print FILE
" for_inetusers" ; }
3605 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3607 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3608 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3613 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3614 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3615 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3616 (!- z
" $raddir /radauth.denyusers" )
3620 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3621 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3622 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3623 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3624 (!- z
" $identdir /identauth.denyusers" )
3628 print FILE
"http_access deny for_acl_users" ;
3629 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3633 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3635 print FILE
"http_access allow" ;
3636 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3637 print FILE
" !within_timeframe" ;
3639 print FILE
" within_timeframe" ; }
3640 print FILE
" !on_ident_aware_hosts \n " ;
3643 print FILE
"http_access allow IPFire_networks" ;
3646 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3647 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3648 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3649 (!- z
" $raddir /radauth.allowusers" )
3653 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3654 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3655 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3656 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3657 (!- z
" $identdir /identauth.allowusers" )
3661 print FILE
" for_acl_users" ;
3662 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3663 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3664 print FILE
" for_inetusers" ;
3666 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3668 print FILE
" !concurrent" ;
3670 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3671 print FILE
" !within_timeframe" ;
3673 print FILE
" within_timeframe" ; }
3676 print FILE
"http_access deny all \n\n " ;
3678 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3679 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3681 print FILE
"#Strip HTTP Header \n " ;
3683 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3685 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3686 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3688 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3690 print FILE
"request_header_access Via deny all \n " ;
3691 print FILE
"reply_header_access Via deny all \n " ;
3693 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3695 print FILE
"request_header_access User-Agent deny all \n " ;
3696 print FILE
"reply_header_access User-Agent deny all \n " ;
3698 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3700 print FILE
"request_header_access Referer deny all \n " ;
3701 print FILE
"reply_header_access Referer deny all \n " ;
3706 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3708 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3710 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3712 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3714 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3720 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3722 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3723 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3724 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3725 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3727 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3729 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3730 print FILE
"http_reply_access allow all \n\n " ;
3733 print FILE
"visible_hostname" ;
3734 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3736 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3738 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3741 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3742 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3745 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3747 # Write the parent proxy info, if needed.
3748 if ( $remotehost ne '' )
3750 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3752 # Enter authentication for the parent cache. Option format is
3753 # login=user:password ($proxy1='YES')
3754 # login=PASS ($proxy1='PASS')
3755 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3756 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3758 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3759 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3761 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3763 print FILE
" \n always_direct allow IPFire_ips \n " ;
3764 print FILE
"never_direct allow all \n\n " ;
3766 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3768 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3769 print FILE
"url_rewrite_children " , & General
:: number_cpu_cores
();
3770 print FILE
" startup=" , & General
:: number_cpu_cores
();
3771 print FILE
" idle=" , & General
:: number_cpu_cores
();
3772 print FILE
" queue-size=" , & General
:: number_cpu_cores
() * 32 , " \n\n " ;
3775 # Include file with user defined settings.
3776 if (- e
"/etc/squid/squid.conf.local" ) {
3777 print FILE
"include /etc/squid/squid.conf.local \n " ;
3781 # Proxy settings for squidclamav - if installed.
3783 # Check if squidclamav is enabled.
3784 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3786 my $configfile = '/etc/squidclamav.conf' ;
3788 my $data = & General
:: read_file_utf8
( $configfile );
3789 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
3790 & General
:: write_file_utf8
( $configfile , $data );
3794 # -------------------------------------------------------------------
3798 my ( $str_user , $str_pass , $str_group ) = @_ ;
3799 my @groupmembers =();
3801 if ( $str_pass eq 'lEaVeAlOnE' )
3803 open ( FILE
, " $userdb " );
3804 @groupmembers = < FILE
>;
3806 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3807 & deluser
( $str_user );
3808 open ( FILE
, ">> $userdb " );
3810 print FILE
" $str_user $str_pass " ;
3813 & deluser
( $str_user );
3815 my $htpasswd = new Apache
:: Htpasswd
( " $userdb " );
3816 $htpasswd -> htpasswd ( $str_user , $str_pass );
3819 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3820 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3821 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3823 print FILE
" $str_user \n " ;
3829 # -------------------------------------------------------------------
3833 my ( $str_user ) = @_ ;
3835 my @groupmembers =();
3838 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
3841 open ( FILE
, " $groupfile " );
3842 @groupmembers = < FILE
>;
3844 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
3845 open ( FILE
, "> $groupfile " );
3847 print FILE
@templist ;
3852 open ( FILE
, " $userdb " );
3853 @groupmembers = < FILE
>;
3855 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
3856 open ( FILE
, "> $userdb " );
3858 print FILE
@templist ;
3864 # -------------------------------------------------------------------
3868 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
3870 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
3871 print FILE
"localhost" ;
3876 # -------------------------------------------------------------------