]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2008 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 # (c) 2004-2008 marco.s - http://www.advproxy.net
24 # This code is distributed under the terms of the GPL
26 # $Id: advproxy.cgi,v 3.0.0 2008/08/18 00:00:00 marco.s Exp $
31 # enable only the following on debugging purpose
33 #use CGI::Carp 'fatalsToBrowser';
35 require '/var/ipfire/general-functions.pl' ;
36 require "${General::swroot}/lang.pl" ;
37 require "${General::swroot}/header.pl" ;
39 my @squidversion = `/usr/sbin/squid -v` ;
44 my %mainsettings = ();
45 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
46 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
50 my %filtersettings =();
51 my %xlratorsettings =();
52 my %stdproxysettings =();
58 my @throttle_limits =( 64 , 128 , 256 , 384 , 512 , 1024 , 2048 , 3072 , 5120 );
59 my $throttle_binary = "bin|cab|exe|gz|rar|sea|tar|tgz|zip" ;
60 my $throttle_dskimg = "b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi" ;
61 my $throttle_mmedia = "aiff?|asf|avi|divx|mov|mp3|mpe?g|qt|ra?m" ;
63 my $def_ports_safe = "80 # http \n 21 # ftp \n 443 # https \n 563 # snews \n 70 # gopher \n 210 # wais \n 1025-65535 # unregistered ports \n 280 # http-mgmt \n 488 # gss-http \n 591 # filemaker \n 777 # multiling http \n 800 # Squids port (for icons) \n " ;
64 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
69 my $hintcolour = '#FFFFCC' ;
70 my $ncsa_buttontext = '' ;
85 my $replybodymaxsize = 0 ;
86 my $browser_regexp = '' ;
90 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
91 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
92 my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm" ;
93 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
94 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
95 my $credir = "${General::swroot}/proxy/advanced/cre" ;
97 my $userdb = " $ncsadir /passwd" ;
98 my $stdgrp = " $ncsadir /standard.grp" ;
99 my $extgrp = " $ncsadir /extended.grp" ;
100 my $disgrp = " $ncsadir /disabled.grp" ;
102 my $browserdb = "${General::swroot}/proxy/advanced/useragents" ;
103 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
104 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
106 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
107 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
108 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
110 my $identhosts = " $identdir /hosts" ;
112 my $authdir = "/usr/lib/squid/" ;
113 my $errordir = "/usr/lib/squid/errors" ;
115 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
116 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
117 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
118 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
119 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
120 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
121 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
122 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
123 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
124 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
125 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
126 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
127 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
128 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
129 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
130 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
131 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
132 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
133 my $acl_include = " $acldir /include.acl" ;
135 my $updaccelversion = 'n/a' ;
136 my $urlfilterversion = 'n/a' ;
138 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
139 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
140 unless (- d
" $ntlmdir " ) { mkdir ( " $ntlmdir " ); }
141 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
142 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
143 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
145 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
146 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
148 unless (- e
$userdb ) { system ( "touch $userdb " ); }
149 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
150 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
151 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
153 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
154 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
155 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
156 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
157 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
158 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
159 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
160 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
161 unless (- e
$acl_dst_noauth_dom ) { system ( "touch $acl_dst_noauth_dom " ); }
162 unless (- e
$acl_dst_noauth_net ) { system ( "touch $acl_dst_noauth_net " ); }
163 unless (- e
$acl_dst_noauth_url ) { system ( "touch $acl_dst_noauth_url " ); }
164 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
165 unless (- e
$acl_dst_nocache_dom ) { system ( "touch $acl_dst_nocache_dom " ); }
166 unless (- e
$acl_dst_nocache_net ) { system ( "touch $acl_dst_nocache_net " ); }
167 unless (- e
$acl_dst_nocache_url ) { system ( "touch $acl_dst_nocache_url " ); }
168 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
169 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
170 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
171 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
173 unless (- e
$browserdb ) { system ( "touch $browserdb " ); }
174 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
176 open FILE
, $browserdb ;
177 @useragentlist = sort { reverse ( substr ( reverse ( substr ( $a , index ( $a , ',' )+ 1 )), index ( reverse ( substr ( $a , index ( $a , ',' ))), ',' )+ 1 )) cmp reverse ( substr ( reverse ( substr ( $b , index ( $b , ',' )+ 1 )), index ( reverse ( substr ( $b , index ( $b , ',' ))), ',' )+ 1 ))} grep ! /(^$)|(^\s*#)/ ,< FILE
>;
180 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
181 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
183 & Header
:: showhttpheaders
();
185 $proxysettings { 'ACTION' } = '' ;
186 $proxysettings { 'VALID' } = '' ;
188 $proxysettings { 'ENABLE' } = 'off' ;
189 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
190 $proxysettings { 'TRANSPARENT' } = 'off' ;
191 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
192 $proxysettings { 'PROXY_PORT' } = '800' ;
193 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
194 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
195 $proxysettings { 'ERR_LANGUAGE' } = 'German' ;
196 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
197 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
198 $proxysettings { 'FORWARD_VIA' } = 'off' ;
199 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
200 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
201 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
202 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
203 $proxysettings { 'UPSTREAM_USER' } = '' ;
204 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
205 $proxysettings { 'LOGGING' } = 'off' ;
206 $proxysettings { 'LOGQUERY' } = 'off' ;
207 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
208 $proxysettings { 'CACHE_MEM' } = '2' ;
209 $proxysettings { 'CACHE_SIZE' } = '50' ;
210 $proxysettings { 'MAX_SIZE' } = '4096' ;
211 $proxysettings { 'MIN_SIZE' } = '0' ;
212 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
213 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
214 $proxysettings { 'L1_DIRS' } = '16' ;
215 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
216 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
217 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
218 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
219 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
220 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
221 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
222 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
223 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
224 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
225 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
226 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
227 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
228 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
229 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
230 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
231 $proxysettings { 'THROTTLE_BINARY' } = 'off' ;
232 $proxysettings { 'THROTTLE_DSKIMG' } = 'off' ;
233 $proxysettings { 'THROTTLE_MMEDIA' } = 'off' ;
234 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
235 $proxysettings { 'ENABLE_BROWSER_CHECK' } = 'off' ;
236 $proxysettings { 'FAKE_USERAGENT' } = '' ;
237 $proxysettings { 'FAKE_REFERER' } = '' ;
238 $proxysettings { 'AUTH_METHOD' } = 'none' ;
239 $proxysettings { 'AUTH_REALM' } = '' ;
240 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
241 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
242 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
243 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
244 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
245 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
246 $proxysettings { 'NCSA_USERNAME' } = '' ;
247 $proxysettings { 'NCSA_GROUP' } = '' ;
248 $proxysettings { 'NCSA_PASS' } = '' ;
249 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
250 $proxysettings { 'LDAP_BASEDN' } = '' ;
251 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
252 $proxysettings { 'LDAP_SERVER' } = '' ;
253 $proxysettings { 'LDAP_PORT' } = '389' ;
254 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
255 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
256 $proxysettings { 'LDAP_GROUP' } = '' ;
257 $proxysettings { 'NTLM_DOMAIN' } = '' ;
258 $proxysettings { 'NTLM_PDC' } = '' ;
259 $proxysettings { 'NTLM_BDC' } = '' ;
260 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
261 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
262 $proxysettings { 'RADIUS_SERVER' } = '' ;
263 $proxysettings { 'RADIUS_PORT' } = '1812' ;
264 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
265 $proxysettings { 'RADIUS_SECRET' } = '' ;
266 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
267 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
268 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
269 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
270 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
271 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
272 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
273 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
274 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
275 $proxysettings { 'CHILDREN' } = '5' ;
277 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
279 & Header
:: getcgihash
( \
%proxysettings );
281 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
282 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
283 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
284 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
286 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
288 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
291 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
293 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
294 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
295 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
297 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
298 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
300 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
301 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
303 if (! $errormessage ) {
304 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
305 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
307 $proxysettings { 'NCSA_USERNAME' } = '' ;
308 $proxysettings { 'NCSA_GROUP' } = '' ;
309 $proxysettings { 'NCSA_PASS' } = '' ;
310 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
313 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
315 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
316 & deluser
( $proxysettings { 'ID' });
319 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
320 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
321 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
323 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
325 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
326 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
327 @temp = split ( /:/ , $proxysettings { 'ID' });
328 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
329 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
330 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
331 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
334 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }))
336 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
337 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
338 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
339 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
340 $errormessage = $Lang :: tr
{ 'invalid input' };
343 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
345 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
348 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
349 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
351 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
353 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
357 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ) ||
358 ( $proxysettings { 'CACHE_MEM' } < 1 ))
360 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
363 my @free = `/usr/bin/free` ;
364 $free [ 1 ] =~ m/(\d+)/ ;
365 $cachemem = int $1 / 2048 ;
366 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
367 $proxysettings { 'CACHE_MEM' } = $cachemem ;
369 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
371 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
374 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
376 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
379 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
381 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
384 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
386 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
389 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
391 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
394 if (!( $proxysettings { 'CHILDREN' } =~ /^\d+$/ ) || ( $proxysettings { 'CHILDREN' } < 1 ))
396 $errormessage = $Lang :: tr
{ 'advproxy invalid num of children' };
399 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' )
401 $browser_regexp = '' ;
402 foreach ( @useragentlist )
405 @useragent = split ( /,/ );
406 if ( $proxysettings { 'UA_' . $useragent [ 0 ]} eq 'on' ) { $browser_regexp .= " $useragent [2]|" ; }
408 chop ( $browser_regexp );
409 if (! $browser_regexp )
411 $errormessage = $Lang :: tr
{ 'advproxy errmsg no browser' };
415 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
417 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
418 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
419 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
421 if ( $netsettings { 'BLUE_DEV' })
423 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
424 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
426 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
430 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
432 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
437 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
438 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
440 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
443 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
445 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
448 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
450 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
453 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
455 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
458 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
460 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
464 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
466 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
468 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
472 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
474 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
476 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
480 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
482 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
484 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
487 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
489 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
492 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
494 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
497 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
499 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
501 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
506 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
508 if ( $proxysettings { 'NTLM_DOMAIN' } eq '' )
510 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm domain' };
513 if ( $proxysettings { 'NTLM_PDC' } eq '' )
515 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm pdc' };
518 if (!& General
:: validhostname
( $proxysettings { 'NTLM_PDC' }))
520 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid pdc' };
523 if ((!( $proxysettings { 'NTLM_BDC' } eq '' )) && (!& General
:: validhostname
( $proxysettings { 'NTLM_BDC' })))
525 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid bdc' };
529 $proxysettings { 'NTLM_DOMAIN' } = lc ( $proxysettings { 'NTLM_DOMAIN' });
530 $proxysettings { 'NTLM_PDC' } = lc ( $proxysettings { 'NTLM_PDC' });
531 $proxysettings { 'NTLM_BDC' } = lc ( $proxysettings { 'NTLM_BDC' });
533 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
535 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
537 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
540 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
542 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
545 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
547 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
552 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
555 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
556 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
557 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
558 if (( $proxy1 ne $proxy2 ))
560 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
568 $proxysettings { 'VALID' } = 'no' ; }
570 $proxysettings { 'VALID' } = 'yes' ; }
572 if ( $proxysettings { 'VALID' } eq 'yes' )
576 delete $proxysettings { 'SRC_SUBNETS' };
577 delete $proxysettings { 'SRC_BANNED_IP' };
578 delete $proxysettings { 'SRC_BANNED_MAC' };
579 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
580 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
581 delete $proxysettings { 'DST_NOCACHE' };
582 delete $proxysettings { 'DST_NOAUTH' };
583 delete $proxysettings { 'PORTS_SAFE' };
584 delete $proxysettings { 'PORTS_SSL' };
585 delete $proxysettings { 'MIME_TYPES' };
586 delete $proxysettings { 'NTLM_ALLOW_USERS' };
587 delete $proxysettings { 'NTLM_DENY_USERS' };
588 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
589 delete $proxysettings { 'RADIUS_DENY_USERS' };
590 delete $proxysettings { 'IDENT_HOSTS' };
591 delete $proxysettings { 'IDENT_ALLOW_USERS' };
592 delete $proxysettings { 'IDENT_DENY_USERS' };
594 delete $proxysettings { 'CRE_GROUPS' };
595 delete $proxysettings { 'CRE_SVHOSTS' };
597 delete $proxysettings { 'NCSA_USERNAME' };
598 delete $proxysettings { 'NCSA_GROUP' };
599 delete $proxysettings { 'NCSA_PASS' };
600 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
602 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
603 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
604 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
605 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
606 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
607 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
608 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
610 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
611 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
613 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
615 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
616 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
617 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
618 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
619 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
620 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
621 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
622 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
623 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
628 system ( '/usr/local/bin/squidctrl' , 'disable' );
629 unlink "${General::swroot}/proxy/enable" ;
630 unlink "${General::swroot}/proxy/transparent" ;
631 unlink "${General::swroot}/proxy/enable_blue" ;
632 unlink "${General::swroot}/proxy/transparent_blue" ;
634 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
635 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
636 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
637 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
638 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
639 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
640 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
641 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
642 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
643 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
645 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
649 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
651 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
656 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
657 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
658 } elsif (- e
"${General::swroot}/proxy/settings" ) {
659 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
664 $checked { 'ENABLE' }{ 'off' } = '' ;
665 $checked { 'ENABLE' }{ 'on' } = '' ;
666 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
668 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
669 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
670 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
672 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
673 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
674 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
676 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
677 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
678 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
680 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
681 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
682 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
684 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
685 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
686 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
687 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
688 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
689 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
690 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
691 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
692 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
693 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
694 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
695 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
697 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
698 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
699 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
700 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
701 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
702 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
704 $checked { 'LOGGING' }{ 'off' } = '' ;
705 $checked { 'LOGGING' }{ 'on' } = '' ;
706 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
707 $checked { 'LOGQUERY' }{ 'off' } = '' ;
708 $checked { 'LOGQUERY' }{ 'on' } = '' ;
709 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
710 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
711 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
712 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
714 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
715 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
717 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
718 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
719 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
720 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
721 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
722 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
724 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
725 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
726 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
728 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
729 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
730 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
731 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
732 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
734 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
735 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
736 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
737 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
738 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
739 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
740 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
742 $checked { 'TIME_MON' }{ 'off' } = '' ;
743 $checked { 'TIME_MON' }{ 'on' } = '' ;
744 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
745 $checked { 'TIME_TUE' }{ 'off' } = '' ;
746 $checked { 'TIME_TUE' }{ 'on' } = '' ;
747 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
748 $checked { 'TIME_WED' }{ 'off' } = '' ;
749 $checked { 'TIME_WED' }{ 'on' } = '' ;
750 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
751 $checked { 'TIME_THU' }{ 'off' } = '' ;
752 $checked { 'TIME_THU' }{ 'on' } = '' ;
753 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
754 $checked { 'TIME_FRI' }{ 'off' } = '' ;
755 $checked { 'TIME_FRI' }{ 'on' } = '' ;
756 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
757 $checked { 'TIME_SAT' }{ 'off' } = '' ;
758 $checked { 'TIME_SAT' }{ 'on' } = '' ;
759 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
760 $checked { 'TIME_SUN' }{ 'off' } = '' ;
761 $checked { 'TIME_SUN' }{ 'on' } = '' ;
762 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
764 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
765 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
766 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
767 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
769 $checked { 'THROTTLE_BINARY' }{ 'off' } = '' ;
770 $checked { 'THROTTLE_BINARY' }{ 'on' } = '' ;
771 $checked { 'THROTTLE_BINARY' }{ $proxysettings { 'THROTTLE_BINARY' }} = "checked='checked'" ;
772 $checked { 'THROTTLE_DSKIMG' }{ 'off' } = '' ;
773 $checked { 'THROTTLE_DSKIMG' }{ 'on' } = '' ;
774 $checked { 'THROTTLE_DSKIMG' }{ $proxysettings { 'THROTTLE_DSKIMG' }} = "checked='checked'" ;
775 $checked { 'THROTTLE_MMEDIA' }{ 'off' } = '' ;
776 $checked { 'THROTTLE_MMEDIA' }{ 'on' } = '' ;
777 $checked { 'THROTTLE_MMEDIA' }{ $proxysettings { 'THROTTLE_MMEDIA' }} = "checked='checked'" ;
779 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
780 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
781 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
783 $checked { 'ENABLE_BROWSER_CHECK' }{ 'off' } = '' ;
784 $checked { 'ENABLE_BROWSER_CHECK' }{ 'on' } = '' ;
785 $checked { 'ENABLE_BROWSER_CHECK' }{ $proxysettings { 'ENABLE_BROWSER_CHECK' }} = "checked='checked'" ;
787 foreach ( @useragentlist ) {
788 @useragent = split ( /,/ );
789 $checked { 'UA_' . $useragent [ 0 ]}{ 'off' } = '' ;
790 $checked { 'UA_' . $useragent [ 0 ]}{ 'on' } = '' ;
791 $checked { 'UA_' . $useragent [ 0 ]}{ $proxysettings { 'UA_' . $useragent [ 0 ]}} = "checked='checked'" ;
794 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
795 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
796 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
797 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
798 $checked { 'AUTH_METHOD' }{ 'ntlm' } = '' ;
799 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
800 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
802 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
804 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
805 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
806 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
808 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
809 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
810 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
812 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
814 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
816 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
818 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
819 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
820 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
822 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
823 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
824 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
826 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
827 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
828 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
830 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
831 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
832 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
834 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
835 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
836 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
838 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
839 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
840 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
842 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
843 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
844 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
846 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
847 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
848 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
850 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
851 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
852 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
854 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
855 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
856 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
858 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
859 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
860 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
862 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
864 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
867 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
868 print "<font class='base'> $errormessage </font> \n " ;
872 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
874 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
875 $squidversion [ 0 ] =~ s/^\s+//g ;
876 $squidversion [ 0 ] =~ s/\s+$//g ;
878 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
881 # ===================================================================
883 # ===================================================================
885 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
887 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
889 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
894 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
897 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
898 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
899 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}:</td>
900 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
903 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
904 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
905 <td class='base'> $Lang ::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
906 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
911 if ( $netsettings { 'BLUE_DEV' }) {
912 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
913 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
915 print "<td colspan='2'> </td>" ;
918 <td class='base'> $Lang ::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td>
919 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
924 if ( $netsettings { 'BLUE_DEV' }) {
925 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
926 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
928 print "<td colspan='2'> </td>" ;
931 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
933 <select name='ERR_LANGUAGE'>
936 foreach (< $errordir /*>) {
938 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
939 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
947 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
948 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
949 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
950 <td class='base'><select name='ERR_DESIGN'>
951 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
952 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
956 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
957 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
964 <tr><td class='base' width='50%' ><b> $Lang ::tr{'advproxy redirector children'}</b><input type='text' name='CHILDREN' value=' $proxysettings {'CHILDREN'}' size='5' /></td>
967 if ( - e
"/usr/bin/squidclamav" ) {
968 print "<td class='base' width='33%'><b> $Lang ::tr{'advproxy squidclamav'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_CLAMAV' $checked{'ENABLE_CLAMAV'}{'on'} /></td></tr>" ;
972 print "<td class='base' width='33%'></td></tr>" ;
976 <tr><td class='base' width='50%'><b> $Lang ::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
977 <td class='base' width='50%'><b> $Lang ::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td></tr>
982 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
985 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
986 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
987 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'} <img src='/blob.gif' alt='*' /></td>
988 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
991 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
992 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
993 <td class='base'> $Lang ::tr{'advproxy upstream username'}: <img src='/blob.gif' alt='*' /></td>
994 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
997 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
998 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
999 <td class='base'> $Lang ::tr{'advproxy upstream password'}: <img src='/blob.gif' alt='*' /></td>
1000 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1003 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1004 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1010 <table width='100%'>
1012 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1015 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1016 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1017 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1018 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1023 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1024 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1028 <table width='100%'>
1030 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1033 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1036 <td class='base'> $Lang ::tr{'advproxy ram cache size'}:</td>
1037 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1038 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}:</td>
1039 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1042 <td class='base'> $Lang ::tr{'advproxy min size'}:</td>
1043 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1044 <td class='base'> $Lang ::tr{'advproxy max size'}:</td>
1045 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1048 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1049 <td class='base'><select name='L1_DIRS'>
1050 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1051 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1052 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1053 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1054 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1056 <td colspan='2' rowspan= '5' valign='top' class='base'>
1057 <table cellspacing='0' cellpadding='0'>
1059 <!-- intentionally left empty -->
1062 <td> $Lang ::tr{'advproxy no cache sites'}: <img src='/blob.gif' alt='*' /></td>
1065 <!-- intentionally left empty -->
1068 <!-- intentionally left empty -->
1071 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1075 print $proxysettings { 'DST_NOCACHE' };
1084 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1085 <td class='base'><select name='MEM_POLICY'>
1086 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1087 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1088 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1089 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1093 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1094 <td class='base'><select name='CACHE_POLICY'>
1095 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1096 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1097 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1098 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1102 <td colspan='2'> </td>
1105 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1106 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1110 <table width='100%'>
1112 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1115 <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
1118 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}:</td>
1119 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}:</td>
1122 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1125 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1129 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1132 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1139 <table width='100%'>
1141 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1144 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1147 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}:</td>
1150 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1154 if (! $proxysettings { 'SRC_SUBNETS' })
1156 print " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'} \n " ;
1157 if ( $netsettings { 'BLUE_DEV' })
1159 print " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'} \n " ;
1161 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1168 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1169 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1170 print "<td class='base'> $line :</td> \n " ;
1172 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1176 if ( $netsettings { 'BLUE_DEV' }) {
1177 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1178 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1180 print "<td class='base'> $line :</td> \n " ;
1182 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1189 <td colspan='2'> </td>
1192 <td colspan='2'> </td>
1195 <table width='100%'>
1197 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1200 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}: <img src='/blob.gif' alt='*' /></td>
1201 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td>
1204 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1208 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1212 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1216 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1222 <table width='100%'>
1224 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1227 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}: <img src='/blob.gif' alt='*' /></td>
1228 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td>
1231 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1235 print $proxysettings { 'SRC_BANNED_IP' };
1239 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1243 print $proxysettings { 'SRC_BANNED_MAC' };
1254 # -------------------------------------------------------------------
1255 # CRE GUI - optional
1256 # -------------------------------------------------------------------
1258 if (- e
$cre_enabled ) { print <<END
1259 <table width='100%'>
1262 <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>
1265 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1271 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1273 <td class='base'> $Lang ::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td>
1274 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1277 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1278 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td>
1283 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1286 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1290 print $proxysettings { 'CRE_GROUPS' };
1294 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1297 print $proxysettings { 'CRE_SVHOSTS' };
1305 print "</table><hr size='1'>" ;
1309 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1310 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1311 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1316 # -------------------------------------------------------------------
1320 <table width='100%'>
1322 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1324 <table width='100%'>
1326 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1327 <td width='1%'> </td>
1328 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1329 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1330 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1331 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1332 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1333 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1334 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1335 <td width='1%'> </td>
1336 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1337 <td width='1%'> </td>
1338 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1343 <select name='TIME_ACCESS_MODE'>
1344 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1345 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1349 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1350 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1351 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1352 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1353 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1354 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1355 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1358 <select name='TIME_FROM_HOUR'>
1361 for ( $i = 0 ; $i <= 24 ; $i ++) {
1362 $_ = sprintf ( " %02s " , $i );
1363 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1370 <select name='TIME_FROM_MINUTE'>
1373 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1374 $_ = sprintf ( " %02s " , $i );
1375 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1382 <select name='TIME_TO_HOUR'>
1385 for ( $i = 0 ; $i <= 24 ; $i ++) {
1386 $_ = sprintf ( " %02s " , $i );
1387 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1394 <select name='TIME_TO_MINUTE'>
1397 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1398 $_ = sprintf ( " %02s " , $i );
1399 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1407 <table width='100%'>
1409 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1412 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}:</td>
1413 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1414 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}:</td>
1415 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1419 <table width='100%'>
1421 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1424 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1425 <td width='20%' class='base'>
1426 <select name='THROTTLING_GREEN_TOTAL'>
1430 foreach ( @throttle_limits ) {
1431 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1435 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1438 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1439 <td width='30%' class='base'>
1440 <select name='THROTTLING_GREEN_HOST'>
1444 foreach ( @throttle_limits ) {
1445 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1449 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1456 if ( $netsettings { 'BLUE_DEV' }) {
1459 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1461 <select name='THROTTLING_BLUE_TOTAL'>
1465 foreach ( @throttle_limits ) {
1466 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1470 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1473 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1475 <select name='THROTTLING_BLUE_HOST'>
1479 foreach ( @throttle_limits ) {
1480 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1484 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1494 <table width='100%'>
1496 <td colspan='4'><i> $Lang ::tr{'advproxy content based throttling'}:</i></td>
1499 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle binary'}:</td>
1500 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked {'THROTTLE_BINARY'}{'on'} /></td>
1501 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle dskimg'}:</td>
1502 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked {'THROTTLE_DSKIMG'}{'on'} /></td>
1503 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle mmedia'}:</td>
1504 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked {'THROTTLE_MMEDIA'}{'on'} /></td>
1505 <td width='15%'> </td>
1506 <td width='10%'> </td>
1510 <table width='100%'>
1512 <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>
1516 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1519 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td>
1524 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1528 print $proxysettings { 'MIME_TYPES' };
1542 <table width='100%'>
1544 <td colspan='4'><b> $Lang ::tr{'advproxy web browser'}</b> $Lang::tr{'advproxy UA enable filter'}:<input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td>
1548 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ){
1554 if ( @useragentlist ) { print " $Lang ::tr{'advproxy allowed web browsers'}:" ; } else { print " $Lang ::tr{'advproxy no clients defined'}" ; }
1559 <table width='100%'>
1563 for ( $n = 0 ; $n <= @useragentlist ; $n = $n + $i ) {
1564 for ( $i = 0 ; $i <= 3 ; $i ++) {
1565 if ( $i eq 0 ) { print "<tr> \n " ; }
1566 if (( $n + $i ) < @useragentlist ) {
1567 @useragent = split ( /,/ , @useragentlist [ $n + $i ]);
1568 print "<td width='15%'> $useragent [1]:<\/td> \n " ;
1569 print "<td width='10%'><input type='checkbox' name='UA_ $useragent [0]' $checked {'UA_'. $useragent [0]}{'on'} /></td> \n " ;
1571 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1578 <table width='100%'>
1580 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1583 <td class='base'> $Lang ::tr{'advproxy fake useragent'}: <img src='/blob.gif' alt='*' /></td>
1584 <td class='base'> $Lang ::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td>
1587 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='56' /></td>
1588 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='56' /></td>
1596 <table width='100%'>
1598 <td colspan='5'><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1601 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked {'AUTH_METHOD'}{'none'} /> $Lang ::tr{'advproxy AUTH method none'}</td>
1602 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked {'AUTH_METHOD'}{'ncsa'} /> $Lang ::tr{'advproxy AUTH method ncsa'}</td>
1603 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked {'AUTH_METHOD'}{'ident'} /> $Lang ::tr{'advproxy AUTH method ident'}</td>
1604 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked {'AUTH_METHOD'}{'ldap'} /> $Lang ::tr{'advproxy AUTH method ldap'}</td>
1605 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked {'AUTH_METHOD'}{'ntlm'} /> $Lang ::tr{'advproxy AUTH method ntlm'}</td>
1606 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked {'AUTH_METHOD'}{'radius'} /> $Lang ::tr{'advproxy AUTH method radius'}</td>
1612 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1614 <table width='100%'>
1616 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1619 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1622 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1623 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1624 <td colspan='2' rowspan= '6' valign='top' class='base'>
1625 <table cellpadding='0' cellspacing='0'>
1627 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}: <img src='/blob.gif' alt='*' /></td>
1630 <!-- intentionally left empty -->
1633 <!-- intentionally left empty -->
1636 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1639 <!-- intentionally left empty -->
1642 <!-- intentionally left empty -->
1645 <td> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1648 <!-- intentionally left empty -->
1651 <!-- intentionally left empty -->
1654 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1658 print $proxysettings { 'DST_NOAUTH' };
1667 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1668 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1671 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}: <img src='/blob.gif' alt='*' /></td>
1672 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1675 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1676 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1679 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1680 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1683 <td colspan='2'> </td>
1690 # ===================================================================
1691 # NCSA auth settings
1692 # ===================================================================
1694 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1697 <table width='100%'>
1699 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1702 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1703 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1704 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1705 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1708 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1716 # ===================================================================
1717 # IDENTD auth settings
1718 # ===================================================================
1720 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1723 <table width='100%'>
1725 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1728 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1729 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1730 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1731 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1734 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1735 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1740 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1741 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1744 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1747 if (! $proxysettings { 'IDENT_HOSTS' }) {
1748 print " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'} \n " ;
1749 if ( $netsettings { 'BLUE_DEV' }) {
1750 print " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'} \n " ;
1753 print $proxysettings { 'IDENT_HOSTS' };
1758 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1762 print $proxysettings { 'DST_NOAUTH' };
1769 <table width='100%'>
1771 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1774 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1775 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1776 <td width='25%'> </td>
1777 <td width='30%'> </td>
1780 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1781 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1782 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1783 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1786 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1787 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1790 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1794 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1796 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1798 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1802 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1804 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1811 # ===================================================================
1812 # NTLM auth settings
1813 # ===================================================================
1815 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) {
1818 <table width='100%'>
1820 <td colspan='6'><b> $Lang ::tr{'advproxy NTLM domain settings'}</b></td>
1823 <td class='base'> $Lang ::tr{'advproxy NTLM domain'}:</td>
1824 <td><input type='text' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}' size='15' /></td>
1825 <td class='base'> $Lang ::tr{'advproxy NTLM PDC hostname'}:</td>
1826 <td><input type='text' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}' size='14' /></td>
1827 <td class='base'> $Lang ::tr{'advproxy NTLM BDC hostname'}: <img src='/blob.gif' alt='*' /></td>
1828 <td><input type='text' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}' size='14' /></td>
1832 <table width='100%'>
1834 <td colspan='3'><b> $Lang ::tr{'advproxy NTLM auth mode'}</b></td>
1837 <td width='25%' class='base' width='25%'> $Lang ::tr{'advproxy NTLM use integrated auth'}:</td>
1838 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked {'NTLM_ENABLE_INT_AUTH'}{'on'} /></td>
1843 <table width='100%'>
1845 <td colspan='4'><b> $Lang ::tr{'advproxy NTLM user based access restrictions'}</b></td>
1848 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1849 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked {'NTLM_ENABLE_ACL'}{'on'} /></td>
1850 <td width='25%'> </td>
1851 <td width='30%'> </td>
1854 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked {'NTLM_USER_ACL'}{'positive'} />
1855 $Lang ::tr{'advproxy NTLM use positive access list'}:</td>
1856 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked {'NTLM_USER_ACL'}{'negative'} />
1857 $Lang ::tr{'advproxy NTLM use negative access list'}:</td>
1860 <td colspan='2'> $Lang ::tr{'advproxy NTLM authorized users'}</td>
1861 <td colspan='2'> $Lang ::tr{'advproxy NTLM unauthorized users'}</td>
1864 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1868 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_ALLOW_USERS' }; }
1870 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1872 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
1876 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_DENY_USERS' }; }
1878 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1885 # ===================================================================
1886 # LDAP auth settings
1887 # ===================================================================
1889 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1892 <table width='100%'>
1894 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1897 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1898 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1899 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1900 <td class='base'><select name='LDAP_TYPE'>
1901 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1902 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1903 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1904 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1908 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1909 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1910 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1911 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1915 <table width='100%'>
1917 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1920 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1921 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1922 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1923 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1927 <table width='100%'>
1929 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1932 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}: <img src='/blob.gif' alt='*' /></td>
1933 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1941 # ===================================================================
1942 # RADIUS auth settings
1943 # ===================================================================
1945 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
1948 <table width='100%'>
1950 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
1953 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
1954 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
1955 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
1956 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
1959 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}: <img src='/blob.gif' alt='*' /></td>
1960 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
1961 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
1962 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
1966 <table width='100%'>
1968 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
1971 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1972 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
1973 <td width='25%'> </td>
1974 <td width='30%'> </td>
1977 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
1978 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
1979 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
1980 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
1983 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
1984 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
1987 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1991 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
1993 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
1995 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
1999 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2001 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2008 # ===================================================================
2014 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2016 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2017 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2018 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2019 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2020 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2021 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2022 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2026 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2028 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2029 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2030 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2031 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2032 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2036 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2038 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2039 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2043 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2045 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2046 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2047 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2048 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2049 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2050 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2051 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2055 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2057 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2058 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2059 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2060 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2061 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2062 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2063 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2067 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )) {
2069 <td><input type='hidden' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}'></td>
2070 <td><input type='hidden' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}'></td>
2071 <td><input type='hidden' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}'></td>
2072 <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value=' $proxysettings {'NTLM_ENABLE_INT_AUTH'}'></td>
2073 <td><input type='hidden' name='NTLM_ENABLE_ACL' value=' $proxysettings {'NTLM_ENABLE_ACL'}'></td>
2074 <td><input type='hidden' name='NTLM_USER_ACL' value=' $proxysettings {'NTLM_USER_ACL'}'></td>
2075 <td><input type='hidden' name='NTLM_ALLOW_USERS' value=' $proxysettings {'NTLM_ALLOW_USERS'}'></td>
2076 <td><input type='hidden' name='NTLM_DENY_USERS' value=' $proxysettings {'NTLM_DENY_USERS'}'></td>
2080 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2082 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2083 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2084 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2085 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2086 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2087 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2088 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2089 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2101 <table width='100%'>
2104 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2105 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2106 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2112 <table width='100%'>
2114 <td><img src='/blob.gif' align='top' alt='*' />
2115 <font class='base'> $Lang ::tr{'this field may be blank'}</font>
2117 <td align='right'> </td>
2124 & Header
:: closebox
();
2128 # ===================================================================
2129 # NCSA user management
2130 # ===================================================================
2132 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2134 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2135 <table width='100%'>
2137 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2140 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2141 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2144 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly " ; }
2147 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2149 <select name='NCSA_GROUP'>
2150 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2151 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2152 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2158 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2159 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2160 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2161 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2168 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2169 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2170 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2173 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2174 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2180 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2185 <table width='100%'>
2187 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2190 <table width='100%' align='center'>
2196 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2197 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2201 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2202 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2206 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2207 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2210 @userlist = sort ( @userlist );
2212 # If the password file contains entries, print entries and action icons
2214 if ( ! - z
" $userdb " ) {
2217 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2218 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2219 <td class='boldbase' colspan='2' align='center'> </td>
2224 foreach $line ( @userlist )
2228 @temp = split ( /:/ , $line );
2229 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2230 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2232 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2234 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2237 <td align='center'> $temp [0]</td>
2241 if ( $temp [ 1 ] eq 'standard' ) {
2242 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2243 } elsif ( $temp [ 1 ] eq 'extended' ) {
2244 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2245 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2246 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2249 <td width='8%' align='center'>
2250 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2251 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2252 <input type='hidden' name='ID' value=' $line ' />
2253 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2257 <td width='8%' align='center'>
2258 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2259 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2260 <input type='hidden' name='ID' value=' $temp [0]' />
2261 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2274 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2275 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2276 <td class='base'> $Lang ::tr{'edit'}</td>
2277 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2278 <td class='base'> $Lang ::tr{'remove'}</td>
2285 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2296 & Header
:: closebox
();
2300 # ===================================================================
2302 & Header
:: closebigbox
();
2304 & Header
:: closepage
();
2306 # -------------------------------------------------------------------
2310 if (- e
" $acl_src_subnets " ) {
2311 open ( FILE
, " $acl_src_subnets " );
2312 delete $proxysettings { 'SRC_SUBNETS' };
2313 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2316 if (- e
" $acl_src_banned_ip " ) {
2317 open ( FILE
, " $acl_src_banned_ip " );
2318 delete $proxysettings { 'SRC_BANNED_IP' };
2319 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2322 if (- e
" $acl_src_banned_mac " ) {
2323 open ( FILE
, " $acl_src_banned_mac " );
2324 delete $proxysettings { 'SRC_BANNED_MAC' };
2325 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2328 if (- e
" $acl_src_unrestricted_ip " ) {
2329 open ( FILE
, " $acl_src_unrestricted_ip " );
2330 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2331 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2334 if (- e
" $acl_src_unrestricted_mac " ) {
2335 open ( FILE
, " $acl_src_unrestricted_mac " );
2336 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2337 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2340 if (- e
" $acl_dst_nocache " ) {
2341 open ( FILE
, " $acl_dst_nocache " );
2342 delete $proxysettings { 'DST_NOCACHE' };
2343 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2346 if (- e
" $acl_dst_noauth " ) {
2347 open ( FILE
, " $acl_dst_noauth " );
2348 delete $proxysettings { 'DST_NOAUTH' };
2349 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2352 if (- e
" $acl_ports_safe " ) {
2353 open ( FILE
, " $acl_ports_safe " );
2354 delete $proxysettings { 'PORTS_SAFE' };
2355 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2358 if (- e
" $acl_ports_ssl " ) {
2359 open ( FILE
, " $acl_ports_ssl " );
2360 delete $proxysettings { 'PORTS_SSL' };
2361 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2364 if (- e
" $mimetypes " ) {
2365 open ( FILE
, " $mimetypes " );
2366 delete $proxysettings { 'MIME_TYPES' };
2367 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2370 if (- e
" $ntlmdir /msntauth.allowusers" ) {
2371 open ( FILE
, " $ntlmdir /msntauth.allowusers" );
2372 delete $proxysettings { 'NTLM_ALLOW_USERS' };
2373 while (< FILE
>) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ };
2376 if (- e
" $ntlmdir /msntauth.denyusers" ) {
2377 open ( FILE
, " $ntlmdir /msntauth.denyusers" );
2378 delete $proxysettings { 'NTLM_DENY_USERS' };
2379 while (< FILE
>) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ };
2382 if (- e
" $raddir /radauth.allowusers" ) {
2383 open ( FILE
, " $raddir /radauth.allowusers" );
2384 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2385 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2388 if (- e
" $raddir /radauth.denyusers" ) {
2389 open ( FILE
, " $raddir /radauth.denyusers" );
2390 delete $proxysettings { 'RADIUS_DENY_USERS' };
2391 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2394 if (- e
" $identdir /identauth.allowusers" ) {
2395 open ( FILE
, " $identdir /identauth.allowusers" );
2396 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2397 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2400 if (- e
" $identdir /identauth.denyusers" ) {
2401 open ( FILE
, " $identdir /identauth.denyusers" );
2402 delete $proxysettings { 'IDENT_DENY_USERS' };
2403 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2406 if (- e
" $identhosts " ) {
2407 open ( FILE
, " $identhosts " );
2408 delete $proxysettings { 'IDENT_HOSTS' };
2409 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2412 if (- e
" $cre_groups " ) {
2413 open ( FILE
, " $cre_groups " );
2414 delete $proxysettings { 'CRE_GROUPS' };
2415 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2418 if (- e
" $cre_svhosts " ) {
2419 open ( FILE
, " $cre_svhosts " );
2420 delete $proxysettings { 'CRE_SVHOSTS' };
2421 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2426 # -------------------------------------------------------------------
2430 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2431 undef $proxysettings { 'PORTS_SAFE' };
2434 s/^\s+//g ; s/\s+$//g ;
2438 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2440 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2441 @templist = split ( /-/ );
2442 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2443 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2447 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2448 undef $proxysettings { 'PORTS_SSL' };
2451 s/^\s+//g ; s/\s+$//g ;
2456 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2457 @templist = split ( /-/ );
2458 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2459 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2463 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2464 undef $proxysettings { 'DST_NOCACHE' };
2468 unless ( /^#/ ) { s/\s+//g ; }
2471 if ( /^\./ ) { $_ = '*' . $_ ; }
2472 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2476 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2477 undef $proxysettings { 'SRC_SUBNETS' };
2480 s/^\s+//g ; s/\s+$//g ;
2483 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2484 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2488 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2489 undef $proxysettings { 'SRC_BANNED_IP' };
2492 s/^\s+//g ; s/\s+$//g ;
2495 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2496 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2500 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2501 undef $proxysettings { 'SRC_BANNED_MAC' };
2504 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2507 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2508 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2512 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2513 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2516 s/^\s+//g ; s/\s+$//g ;
2519 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2520 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2524 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2525 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2528 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2531 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2532 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2536 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2540 unless ( /^#/ ) { s/\s+//g ; }
2543 if ( /^\./ ) { $_ = '*' . $_ ; }
2544 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2548 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2550 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2551 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2554 s/^\s+//g ; s/\s+$//g ;
2555 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2557 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2560 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2562 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2563 undef $proxysettings { 'NTLM_DENY_USERS' };
2566 s/^\s+//g ; s/\s+$//g ;
2567 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2569 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2572 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2574 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2575 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2578 s/^\s+//g ; s/\s+$//g ;
2579 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2581 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2584 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2586 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2587 undef $proxysettings { 'IDENT_DENY_USERS' };
2590 s/^\s+//g ; s/\s+$//g ;
2591 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2593 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2596 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2598 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2599 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2602 s/^\s+//g ; s/\s+$//g ;
2603 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2605 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2608 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2610 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2611 undef $proxysettings { 'RADIUS_DENY_USERS' };
2614 s/^\s+//g ; s/\s+$//g ;
2615 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2617 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2620 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2621 undef $proxysettings { 'IDENT_HOSTS' };
2624 s/^\s+//g ; s/\s+$//g ;
2627 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2628 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2632 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2633 undef $proxysettings { 'CRE_SVHOSTS' };
2636 s/^\s+//g ; s/\s+$//g ;
2639 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2640 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2645 # -------------------------------------------------------------------
2649 open ( FILE
, "> $acl_src_subnets " );
2651 if (! $proxysettings { 'SRC_SUBNETS' })
2653 print FILE
" $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'} \n " ;
2654 if ( $netsettings { 'BLUE_DEV' })
2656 print FILE
" $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'} \n " ;
2658 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2661 open ( FILE
, "> $acl_src_banned_ip " );
2663 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2666 open ( FILE
, "> $acl_src_banned_mac " );
2668 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2671 open ( FILE
, "> $acl_src_unrestricted_ip " );
2673 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2676 open ( FILE
, "> $acl_src_unrestricted_mac " );
2678 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2681 open ( FILE
, "> $acl_dst_noauth " );
2683 print FILE
$proxysettings { 'DST_NOAUTH' };
2686 open ( FILE
, "> $acl_dst_noauth_net " );
2688 open ( FILE
, "> $acl_dst_noauth_dom " );
2690 open ( FILE
, "> $acl_dst_noauth_url " );
2693 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2701 open ( FILE
, ">> $acl_dst_noauth_dom " );
2706 elsif (& General
:: validipormask
( $_ ))
2708 open ( FILE
, ">> $acl_dst_noauth_net " );
2713 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?/ )
2715 open ( FILE
, ">> $acl_dst_noauth_net " );
2722 open ( FILE
, ">> $acl_dst_noauth_url " );
2724 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2730 open ( FILE
, "> $acl_dst_nocache " );
2732 print FILE
$proxysettings { 'DST_NOCACHE' };
2735 open ( FILE
, "> $acl_dst_nocache_net " );
2737 open ( FILE
, "> $acl_dst_nocache_dom " );
2739 open ( FILE
, "> $acl_dst_nocache_url " );
2742 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2750 open ( FILE
, ">> $acl_dst_nocache_dom " );
2755 elsif (& General
:: validipormask
( $_ ))
2757 open ( FILE
, ">> $acl_dst_nocache_net " );
2762 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?/ )
2764 open ( FILE
, ">> $acl_dst_nocache_net " );
2771 open ( FILE
, ">> $acl_dst_nocache_url " );
2773 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2779 open ( FILE
, "> $acl_ports_safe " );
2781 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2784 open ( FILE
, "> $acl_ports_ssl " );
2786 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2789 open ( FILE
, "> $acl_dst_throttle " );
2791 if ( $proxysettings { 'THROTTLE_BINARY' } eq 'on' )
2793 @temp = split ( /\|/ , $throttle_binary );
2794 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2796 if ( $proxysettings { 'THROTTLE_DSKIMG' } eq 'on' )
2798 @temp = split ( /\|/ , $throttle_dskimg );
2799 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2801 if ( $proxysettings { 'THROTTLE_MMEDIA' } eq 'on' )
2803 @temp = split ( /\|/ , $throttle_mmedia );
2804 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2806 if (- s
$throttled_urls )
2808 open ( URLFILE
, $throttled_urls );
2811 foreach ( @temp ) { print FILE
; }
2815 open ( FILE
, "> $mimetypes " );
2817 print FILE
$proxysettings { 'MIME_TYPES' };
2820 open ( FILE
, "> $ntlmdir /msntauth.allowusers" );
2822 print FILE
$proxysettings { 'NTLM_ALLOW_USERS' };
2825 open ( FILE
, "> $ntlmdir /msntauth.denyusers" );
2827 print FILE
$proxysettings { 'NTLM_DENY_USERS' };
2830 open ( FILE
, "> $raddir /radauth.allowusers" );
2832 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2835 open ( FILE
, "> $raddir /radauth.denyusers" );
2837 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2840 open ( FILE
, "> $identdir /identauth.allowusers" );
2842 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2845 open ( FILE
, "> $identdir /identauth.denyusers" );
2847 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2850 open ( FILE
, "> $identhosts " );
2852 print FILE
$proxysettings { 'IDENT_HOSTS' };
2855 open ( FILE
, "> $cre_groups " );
2857 print FILE
$proxysettings { 'CRE_GROUPS' };
2860 open ( FILE
, "> $cre_svhosts " );
2862 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2866 # -------------------------------------------------------------------
2870 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2872 print FILE
"function FindProxyForURL(url, host) \n " ;
2874 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2878 (isPlainHostName(host)) ||
2879 (dnsDomainIs(host, ". $mainsettings {'DOMAINNAME'}")) ||
2880 (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
2881 (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
2882 (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
2883 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2891 if ( $proxysettings { 'ENABLE' } eq 'on' )
2893 print FILE
"if ( \n " ;
2894 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2897 if (- e
" $acl_src_subnets " ) {
2898 open ( SUBNETS
, " $acl_src_subnets " );
2899 @templist = < SUBNETS
>;
2905 @temp = split ( /\/ /);
2907 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2908 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2912 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
2922 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2926 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
2928 print FILE
" \n else \n\n " ;
2930 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2934 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
2936 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2945 # -------------------------------------------------------------------
2952 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
2953 $proxysettings { 'THROTTLING_GREEN_HOST' } +
2954 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
2955 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
2957 $delaypools = 1 ; } else { $delaypools = 0 ;
2960 if ( $proxysettings { 'AUTH_REALM' } eq '' )
2962 $authrealm = "IPFire Advanced Proxy Server" ;
2964 $authrealm = $proxysettings { 'AUTH_REALM' };
2967 $_ = $proxysettings { 'UPSTREAM_PROXY' };
2968 my ( $remotehost , $remoteport ) = ( /^(?:[a-zA-Z ]+\:\/ \
/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/ .* ?
) ?
$/);
2970 if ( $remoteport eq '' ) { $remoteport = 80 ; }
2972 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
2975 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
2976 # you make will be overwritten whenever you resave proxy settings using the
2979 # Instead, modify the file ' $acl_include ' and
2980 # then restart the proxy service using the web interface. Changes made to the
2981 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
2983 shutdown_lifetime 5 seconds
2988 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2989 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) { print FILE
" transparent" }
2990 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2993 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
2994 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2995 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) { print FILE
" transparent" }
2996 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3000 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3004 if (!- z
$acl_dst_nocache_dom ) {
3005 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3006 print FILE
"cache deny no_cache_domains \n " ;
3008 if (!- z
$acl_dst_nocache_net ) {
3009 print FILE
"acl no_cache_domains dst \" $acl_dst_nocache_net \"\n " ;
3010 print FILE
"cache deny no_cache_ipaddr \n " ;
3012 if (!- z
$acl_dst_nocache_url ) {
3013 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3014 print FILE
"cache deny no_cache_hosts \n " ;
3020 cache_effective_user squid
3021 cache_effective_group squid
3024 pid_filename /var/run/squid.pid
3026 cache_mem $proxysettings {'CACHE_MEM'} MB
3030 if ( $proxysettings { 'CACHE_SIZE' } eq '0' )
3032 print FILE
"cache_dir null /var/tmp \n\n " ;
3034 print FILE
"cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256 \n\n " ;
3037 if (( $proxysettings { 'ERR_DESIGN' } eq 'ipfire' ))
3039 print FILE
"error_directory $errordir .ipfire/ $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3041 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3044 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3046 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3048 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3050 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3052 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3054 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3059 if ( $proxysettings { 'LOGGING' } eq 'on' )
3062 access_log /var/log/squid/access.log
3063 cache_log /var/log/squid/cache.log
3064 cache_store_log none
3067 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"useragent_log \/var\/log\/squid\/user_agent.log \n " ; }
3068 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3071 access_log /dev/null
3073 cache_store_log none
3082 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3084 print FILE
"forwarded_for on \n " ;
3086 print FILE
"forwarded_for off \n " ;
3088 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3090 print FILE
"via on \n " ;
3092 print FILE
"via off \n " ;
3096 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3098 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3100 print FILE
"auth_param basic program $authdir /ncsa_auth $userdb \n " ;
3101 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3102 print FILE
"auth_param basic realm $authrealm \n " ;
3103 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3104 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3107 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3109 print FILE
"auth_param basic program $authdir /squid_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3110 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3111 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3112 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3114 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3116 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3118 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3120 print FILE
" -u sAMAccountName -P" ;
3122 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3124 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3126 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3128 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3130 print FILE
" -u cn -P" ;
3132 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3134 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3136 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3138 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3140 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3141 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3142 print FILE
" -u uid -P" ;
3144 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3145 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3146 print FILE
"auth_param basic realm $authrealm \n " ;
3147 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3148 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3151 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
3153 if ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' )
3155 print FILE
"auth_param ntlm program $authdir /ntlm_auth $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_PDC'}" ;
3156 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print FILE
" \n " ; } else { print FILE
" $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_BDC'} \n " ; }
3157 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n " ;
3158 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3160 print FILE
"auth_param basic program $authdir /msnt_auth \n " ;
3161 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3162 print FILE
"auth_param basic realm $authrealm \n " ;
3163 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3164 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3166 open ( MSNTCONF
, "> $ntlmdir /msntauth.conf" );
3168 print MSNTCONF
"server $proxysettings {'NTLM_PDC'}" ;
3169 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print MSNTCONF
" $proxysettings {'NTLM_PDC'}" ; } else { print MSNTCONF
" $proxysettings {'NTLM_BDC'}" ; }
3170 print MSNTCONF
" $proxysettings {'NTLM_DOMAIN'} \n " ;
3171 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3173 if ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' )
3175 print MSNTCONF
"allowusers $ntlmdir /msntauth.allowusers \n " ;
3177 print MSNTCONF
"denyusers $ntlmdir /msntauth.denyusers \n " ;
3184 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3186 print FILE
"auth_param basic program $authdir /squid_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3187 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3188 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3189 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3190 print FILE
"auth_param basic realm $authrealm \n " ;
3191 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3192 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3196 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3197 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) && ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ))
3199 if ((!- z
" $ntlmdir /msntauth.allowusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
3201 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.allowusers \"\n " ;
3203 if ((!- z
" $ntlmdir /msntauth.denyusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
3205 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.denyusers \"\n " ;
3208 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3210 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3212 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3214 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3216 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3219 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3222 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3223 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3225 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3228 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3229 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3230 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3235 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3237 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3239 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3241 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3243 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3245 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3247 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3249 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3252 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3253 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3254 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3258 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3260 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
"acl with_allowed_useragents browser $browser_regexp \n\n " ; }
3262 print FILE
"acl within_timeframe time " ;
3263 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3264 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3265 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3266 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3267 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3268 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3269 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3270 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3271 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3272 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3273 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3275 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3276 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3280 acl all src 0.0.0.0/0.0.0.0
3281 acl localhost src 127.0.0.1/255.255.255.255
3284 open ( PORTS
, " $acl_ports_ssl " );
3289 foreach ( @temp ) { print FILE
"acl SSL_ports port $_ " ; }
3291 open ( PORTS
, " $acl_ports_safe " );
3296 foreach ( @temp ) { print FILE
"acl Safe_ports port $_ " ; }
3300 acl IPFire_http port $http_port
3301 acl IPFire_https port $https_port
3302 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3303 acl IPFire_networks src " $acl_src_subnets "
3304 acl IPFire_servers dst " $acl_src_subnets "
3305 acl IPFire_green_network src $netsettings {'GREEN_NETADDRESS'}/ $netsettings {'GREEN_NETMASK'}
3306 acl IPFire_green_servers dst $netsettings {'GREEN_NETADDRESS'}/ $netsettings {'GREEN_NETMASK'}
3309 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $netsettings {'BLUE_NETADDRESS'}/ $netsettings {'BLUE_NETMASK'} \n " ; }
3310 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $netsettings {'BLUE_NETADDRESS'}/ $netsettings {'BLUE_NETMASK'} \n " ; }
3311 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3312 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3313 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3314 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3316 acl CONNECT method CONNECT
3320 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3323 #Classroom extensions
3324 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3325 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3328 print FILE
"deny_info " ;
3329 if ((( $proxysettings { 'ERR_DESIGN' } eq 'ipfire' ) && (- e
" $errordir .ipfire/ $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )) ||
3330 (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )))
3332 print FILE
"ERR_ACCESS_DISABLED" ;
3334 print FILE
"ERR_ACCESS_DENIED" ;
3336 print FILE
" IPFire_no_access_ips \n " ;
3337 print FILE
"deny_info " ;
3338 if ((( $proxysettings { 'ERR_DESIGN' } eq 'ipfire' ) && (- e
" $errordir .ipfire/ $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )) ||
3339 (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" )))
3341 print FILE
"ERR_ACCESS_DISABLED" ;
3343 print FILE
"ERR_ACCESS_DENIED" ;
3345 print FILE
" IPFire_no_access_mac \n " ;
3348 http_access deny IPFire_no_access_ips
3349 http_access deny IPFire_no_access_mac
3354 #Insert acl file and replace __VAR__ with correct values
3355 my $blue_net = '' ; #BLUE empty by default
3357 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3358 $blue_net = " $netsettings {'BLUE_NETADDRESS'}/ $netsettings {'BLUE_NETMASK'}" ;
3359 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3361 if (!- z
$acl_include )
3363 open ( ACL
, " $acl_include " );
3364 print FILE
" \n #Start of custom includes \n\n " ;
3366 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3367 $_ =~ s/__GREEN_NET__/$netsettings{'GREEN_NETADDRESS'}\/ $netsettings { 'GREEN_NETMASK' }/;
3368 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3369 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3370 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3373 print FILE
" \n #End of custom includes \n " ;
3376 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3380 #local machine, no restriction
3381 http_access allow localhost
3383 #GUI admin if local machine connects
3384 http_access allow IPFire_ips IPFire_networks IPFire_http
3385 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3387 #Deny not web services
3388 http_access deny !Safe_ports
3389 http_access deny CONNECT !SSL_ports
3394 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3396 print FILE
"#Set ident ACLs \n " ;
3397 if (!- z
$identhosts )
3399 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3400 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3401 print FILE
"ident_lookup_access deny all \n " ;
3403 print FILE
"ident_lookup_access allow all \n " ;
3405 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3409 print FILE
"#Set download throttling \n " ;
3411 if ( $netsettings { 'BLUE_DEV' })
3413 print FILE
"delay_pools 2 \n " ;
3415 print FILE
"delay_pools 1 \n " ;
3418 print FILE
"delay_class 1 3 \n " ;
3419 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3421 print FILE
"delay_parameters 1 " ;
3422 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3426 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3428 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3431 print FILE
" -1/-1 " ;
3432 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3436 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3438 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3442 if ( $netsettings { 'BLUE_DEV' })
3444 print FILE
"delay_parameters 2 " ;
3445 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3449 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3451 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3453 print FILE
" -1/-1 " ;
3454 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3458 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3460 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3465 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3466 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3467 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3468 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3470 if ( $netsettings { 'BLUE_DEV' })
3472 print FILE
"delay_access 1 allow IPFire_green_network" ;
3473 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3475 print FILE
"delay_access 1 deny all \n " ;
3477 print FILE
"delay_access 1 allow all" ;
3478 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3482 if ( $netsettings { 'BLUE_DEV' })
3484 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3485 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3486 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3487 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3488 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3489 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3491 print FILE
"delay_access 2 deny all \n " ;
3494 print FILE
"delay_initial_bucket_level 100 \n " ;
3498 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3500 print FILE
"#Prevent internal proxy access to Green \n " ;
3501 print FILE
"http_access deny IPFire_green_servers !IPFire_green_network \n\n " ;
3504 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3506 print FILE
"#Prevent internal proxy access from Blue \n " ;
3507 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3508 print FILE
"http_access deny IPFire_blue_network IPFire_servers \n\n " ;
3512 #Set custom configured ACLs
3515 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3516 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3518 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3520 if (!- z
$acl_src_unrestricted_ip )
3522 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3523 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3524 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3526 if (!- z
$acl_src_unrestricted_mac )
3528 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3529 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3530 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3532 if (!- z
$acl_dst_noauth_net )
3534 print FILE
"http_access allow IPFire_networks" ;
3535 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3536 print FILE
" !within_timeframe" ;
3538 print FILE
" within_timeframe" ; }
3539 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3540 print FILE
" to_ipaddr_without_auth \n " ;
3542 if (!- z
$acl_dst_noauth_dom )
3544 print FILE
"http_access allow IPFire_networks" ;
3545 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3546 print FILE
" !within_timeframe" ;
3548 print FILE
" within_timeframe" ; }
3549 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3550 print FILE
" to_domains_without_auth \n " ;
3552 if (!- z
$acl_dst_noauth_url )
3554 print FILE
"http_access allow IPFire_networks" ;
3555 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3556 print FILE
" !within_timeframe" ;
3558 print FILE
" within_timeframe" ; }
3559 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3560 print FILE
" to_hosts_without_auth \n " ;
3564 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3566 print FILE
"http_access deny !for_inetusers" ;
3567 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3572 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3573 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3574 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3575 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3576 (!- z
" $identdir /identauth.denyusers" )
3579 print FILE
"http_access deny for_acl_users" ;
3580 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3584 if (!- z
$acl_src_unrestricted_ip )
3586 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3587 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3589 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3591 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3593 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3595 print FILE
" for_inetusers" ;
3597 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3599 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3601 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3603 print FILE
" for_acl_users" ;
3605 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3607 print FILE
" !for_acl_users" ;
3609 } else { print FILE
" for_inetusers" ; }
3611 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3613 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3615 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3617 print FILE
" for_acl_users" ;
3619 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3621 print FILE
" !for_acl_users" ;
3623 } else { print FILE
" for_inetusers" ; }
3629 if (!- z
$acl_src_unrestricted_mac )
3631 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3632 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3634 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3636 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3638 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3640 print FILE
" for_inetusers" ;
3642 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3644 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3646 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3648 print FILE
" for_acl_users" ;
3650 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3652 print FILE
" !for_acl_users" ;
3654 } else { print FILE
" for_inetusers" ; }
3656 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3658 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3660 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3662 print FILE
" for_acl_users" ;
3664 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3666 print FILE
" !for_acl_users" ;
3668 } else { print FILE
" for_inetusers" ; }
3674 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3676 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3677 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3682 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3683 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3684 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3685 ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) &&
3686 (!- z
" $ntlmdir /msntauth.denyusers" )
3690 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3691 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3692 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3693 (!- z
" $raddir /radauth.denyusers" )
3697 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3698 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3699 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3700 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3701 (!- z
" $identdir /identauth.denyusers" )
3705 print FILE
"http_access deny for_acl_users" ;
3706 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3710 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3712 print FILE
"http_access allow" ;
3713 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3714 print FILE
" !within_timeframe" ;
3716 print FILE
" within_timeframe" ; }
3717 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3718 print FILE
" !on_ident_aware_hosts \n " ;
3721 print FILE
"http_access allow IPFire_networks" ;
3724 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3725 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3726 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3727 ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) &&
3728 (!- z
" $ntlmdir /msntauth.allowusers" )
3732 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3733 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3734 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3735 (!- z
" $raddir /radauth.allowusers" )
3739 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3740 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3741 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3742 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3743 (!- z
" $identdir /identauth.allowusers" )
3747 print FILE
" for_acl_users" ;
3748 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3749 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3750 print FILE
" for_inetusers" ;
3752 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3754 print FILE
" !concurrent" ;
3756 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3757 print FILE
" !within_timeframe" ;
3759 print FILE
" within_timeframe" ; }
3760 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3763 print FILE
"http_access deny all \n\n " ;
3765 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3766 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3768 print FILE
"#Strip HTTP Header \n " ;
3770 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3772 print FILE
"header_access X-Forwarded-For deny all \n " ;
3774 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3776 print FILE
"header_access Via deny all \n " ;
3778 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3780 print FILE
"header_access User-Agent deny all \n " ;
3782 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3784 print FILE
"header_access Referer deny all \n " ;
3789 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3791 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3793 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3795 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3797 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3803 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3805 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3806 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3807 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3808 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3810 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3812 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3813 print FILE
"http_reply_access allow all \n\n " ;
3816 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3819 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3820 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3824 } else { print FILE
"cache deny all \n\n " ; }
3827 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3830 $replybodymaxsize = 1024 * $proxysettings { 'MAX_INCOMING_SIZE' };
3831 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3832 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size 0 allow IPFire_unrestricted_ips \n " ; }
3833 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size 0 allow IPFire_unrestricted_mac \n " ; }
3834 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3836 if (!- z
$extgrp ) { print FILE
"reply_body_max_size 0 allow for_extended_users \n " ; }
3839 print FILE
"reply_body_max_size $replybodymaxsize allow all \n\n " ;
3841 print FILE
"visible_hostname" ;
3842 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3844 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3846 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3849 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n\n " ; }
3851 # Write the parent proxy info, if needed.
3852 if ( $remotehost ne '' )
3854 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3856 # Enter authentication for the parent cache. Option format is
3857 # login=user:password ($proxy1='YES')
3858 # login=PASS ($proxy1='PASS')
3859 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3860 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3862 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3863 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3865 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3867 print FILE
" \n always_direct allow IPFire_ips \n " ;
3868 print FILE
"never_direct allow all \n\n " ;
3870 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3872 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3873 print FILE
"url_rewrite_children $proxysettings {'CHILDREN'} \n\n " ;
3878 # -------------------------------------------------------------------
3882 my ( $str_user , $str_pass , $str_group ) = @_ ;
3883 my @groupmembers =();
3885 if ( $str_pass eq 'lEaVeAlOnE' )
3887 open ( FILE
, " $userdb " );
3888 @groupmembers = < FILE
>;
3890 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3891 & deluser
( $str_user );
3892 open ( FILE
, ">> $userdb " );
3894 print FILE
" $str_user $str_pass " ;
3897 & deluser
( $str_user );
3898 system ( "/usr/sbin/htpasswd -b $userdb $str_user $str_pass " );
3901 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3902 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3903 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3905 print FILE
" $str_user \n " ;
3911 # -------------------------------------------------------------------
3915 my ( $str_user ) = @_ ;
3917 my @groupmembers =();
3920 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
3923 open ( FILE
, " $groupfile " );
3924 @groupmembers = < FILE
>;
3926 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
3927 open ( FILE
, "> $groupfile " );
3929 print FILE
@templist ;
3934 open ( FILE
, " $userdb " );
3935 @groupmembers = < FILE
>;
3937 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
3938 open ( FILE
, "> $userdb " );
3940 print FILE
@templist ;
3946 # -------------------------------------------------------------------