]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2021 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 # enable only the following on debugging purpose
27 #use CGI::Carp 'fatalsToBrowser';
29 require '/var/ipfire/general-functions.pl' ;
30 require "${General::swroot}/lang.pl" ;
31 require "${General::swroot}/header.pl" ;
33 require "${General::swroot}/ids-functions.pl" ;
35 my @squidversion = & General
:: system_output
( "/usr/sbin/squid" , "-v" );
40 my %mainsettings = ();
41 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
42 & General
:: readhash
( "/srv/web/ipfire/html/themes/ipfire/include/colors.txt" , \
%color );
46 my %filtersettings =();
47 my %xlratorsettings =();
48 my %stdproxysettings =();
54 my @throttle_limits =( 64 , 128 , 256 , 512 , 1024 , 1536 , 2048 , 3072 , 4096 , 5120 , 6144 , 7168 , 8192 , 10240 , 16384 , 20480 , 51200 , 102400 );
56 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 " ;
57 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
59 my $hintcolour = '#FFFFCC' ;
60 my $ncsa_buttontext = '' ;
75 my $browser_regexp = '' ;
79 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
80 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
81 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
82 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
83 my $credir = "${General::swroot}/proxy/advanced/cre" ;
85 my $userdb = " $ncsadir /passwd" ;
86 my $stdgrp = " $ncsadir /standard.grp" ;
87 my $extgrp = " $ncsadir /extended.grp" ;
88 my $disgrp = " $ncsadir /disabled.grp" ;
90 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
91 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
93 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
94 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
95 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
97 my $identhosts = " $identdir /hosts" ;
99 my $authdir = "/usr/lib/squid" ;
100 my $errordir = "/usr/lib/squid/errors" ;
102 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
103 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
104 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
105 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
106 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
107 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
108 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
109 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
110 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
111 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
112 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
113 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
114 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
115 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
116 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
117 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
118 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
119 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
120 my $acl_include = " $acldir /include.acl" ;
122 my $acl_dst_noproxy_url = " $acldir /dst_noproxy_url.acl" ;
123 my $acl_dst_noproxy_ip = " $acldir /dst_noproxy_ip.acl" ;
125 my $updaccelversion = 'n/a' ;
126 my $urlfilterversion = 'n/a' ;
128 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
129 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
130 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
131 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
132 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
134 unless (- e
$cre_groups ) { & General
:: system ( "touch" , " $cre_groups " ); }
135 unless (- e
$cre_svhosts ) { & General
:: system ( "touch $cre_svhosts " ); }
137 unless (- e
$userdb ) { & General
:: system ( "touch" , " $userdb " ); }
138 unless (- e
$stdgrp ) { & General
:: system ( "touch" , " $stdgrp " ); }
139 unless (- e
$extgrp ) { & General
:: system ( "touch" , " $extgrp " ); }
140 unless (- e
$disgrp ) { & General
:: system ( "touch" , " $disgrp " ); }
142 unless (- e
$acl_src_subnets ) { & General
:: system ( "touch" , " $acl_src_subnets " ); }
143 unless (- e
$acl_src_banned_ip ) { & General
:: system ( "touch" , " $acl_src_banned_ip " ); }
144 unless (- e
$acl_src_banned_mac ) { & General
:: system ( "touch" , " $acl_src_banned_mac " ); }
145 unless (- e
$acl_src_unrestricted_ip ) { & General
:: system ( "touch" , " $acl_src_unrestricted_ip " ); }
146 unless (- e
$acl_src_unrestricted_mac ) { & General
:: system ( "touch" , " $acl_src_unrestricted_mac " ); }
147 unless (- e
$acl_src_noaccess_ip ) { & General
:: system ( "touch" , " $acl_src_noaccess_ip " ); }
148 unless (- e
$acl_src_noaccess_mac ) { & General
:: system ( "touch" , " $acl_src_noaccess_mac " ); }
149 unless (- e
$acl_dst_noauth ) { & General
:: system ( "touch" , " $acl_dst_noauth " ); }
150 unless (- e
$acl_dst_noauth_dom ) { & General
:: system ( "touch" , " $acl_dst_noauth_dom " ); }
151 unless (- e
$acl_dst_noauth_net ) { & General
:: system ( "touch" , " $acl_dst_noauth_net " ); }
152 unless (- e
$acl_dst_noauth_url ) { & General
:: system ( "touch" , " $acl_dst_noauth_url " ); }
153 unless (- e
$acl_dst_nocache ) { & General
:: system ( "touch" , " $acl_dst_nocache " ); }
154 unless (- e
$acl_dst_nocache_dom ) { & General
:: system ( "touch" , " $acl_dst_nocache_dom " ); }
155 unless (- e
$acl_dst_nocache_net ) { & General
:: system ( "touch" , " $acl_dst_nocache_net " ); }
156 unless (- e
$acl_dst_nocache_url ) { & General
:: system ( "touch" , " $acl_dst_nocache_url " ); }
157 unless (- e
$acl_dst_throttle ) { & General
:: system ( "touch" , " $acl_dst_throttle " ); }
158 unless (- e
$acl_ports_safe ) { & General
:: system ( "touch" , " $acl_ports_safe " ); }
159 unless (- e
$acl_ports_ssl ) { & General
:: system ( "touch" , " $acl_ports_ssl " ); }
160 unless (- e
$acl_include ) { & General
:: system ( "touch" , " $acl_include " ); }
162 unless (- e
$mimetypes ) { & General
:: system ( "touch" , " $mimetypes " ); }
164 my $HAVE_NTLM_AUTH = (- e
"/usr/bin/ntlm_auth" );
166 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
167 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
170 if (& Header
:: green_used
() && $netsettings { 'GREEN_DEV' }) {
171 $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
175 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
176 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
179 & Header
:: showhttpheaders
();
181 $proxysettings { 'ACTION' } = '' ;
182 $proxysettings { 'VALID' } = '' ;
184 $proxysettings { 'ENABLE' } = 'off' ;
185 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
186 $proxysettings { 'TRANSPARENT' } = 'off' ;
187 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
188 $proxysettings { 'PROXY_PORT' } = '800' ;
189 $proxysettings { 'TRANSPARENT_PORT' } = '3128' ;
190 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
191 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
192 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
193 $proxysettings { 'ERR_LANGUAGE' } = 'en' ;
194 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
195 $proxysettings { 'SUPPRESS_VERSION' } = 'on' ;
196 $proxysettings { 'FORWARD_VIA' } = 'off' ;
197 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
198 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
199 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
200 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
201 $proxysettings { 'UPSTREAM_USER' } = '' ;
202 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
203 $proxysettings { 'LOGGING' } = 'off' ;
204 $proxysettings { 'CACHEMGR' } = 'off' ;
205 $proxysettings { 'LOGQUERY' } = 'off' ;
206 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
207 $proxysettings { 'FILEDESCRIPTORS' } = '16384' ;
208 $proxysettings { 'CACHE_MEM' } = '128' ;
209 $proxysettings { 'CACHE_SIZE' } = '0' ;
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 { 'CACHE_DIGESTS' } = 'off' ;
217 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
218 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
219 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
220 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
221 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
222 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
223 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
224 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
225 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
226 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
227 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
228 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
229 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
230 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
231 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
232 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
233 $proxysettings { 'AUTH_METHOD' } = 'none' ;
234 $proxysettings { 'AUTH_REALM' } = '' ;
235 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
236 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
237 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
238 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
239 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
240 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
241 $proxysettings { 'NCSA_USERNAME' } = '' ;
242 $proxysettings { 'NCSA_GROUP' } = '' ;
243 $proxysettings { 'NCSA_PASS' } = '' ;
244 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
245 $proxysettings { 'LDAP_BASEDN' } = '' ;
246 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
247 $proxysettings { 'LDAP_SERVER' } = '' ;
248 $proxysettings { 'LDAP_PORT' } = '389' ;
249 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
250 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
251 $proxysettings { 'LDAP_GROUP' } = '' ;
252 $proxysettings { 'NTLM_AUTH_GROUP' } = '' ;
253 $proxysettings { 'NTLM_AUTH_BASIC' } = 'off' ;
254 $proxysettings { 'NTLM_DOMAIN' } = '' ;
255 $proxysettings { 'NTLM_PDC' } = '' ;
256 $proxysettings { 'NTLM_BDC' } = '' ;
257 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
258 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
259 $proxysettings { 'RADIUS_SERVER' } = '' ;
260 $proxysettings { 'RADIUS_PORT' } = '1812' ;
261 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
262 $proxysettings { 'RADIUS_SECRET' } = '' ;
263 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
264 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
265 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
266 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
267 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
268 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
269 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
270 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
271 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
273 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
275 & Header
:: getcgihash
( \
%proxysettings );
277 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
278 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
279 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
280 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
282 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
284 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
287 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
289 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
290 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
291 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
293 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
294 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
296 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
297 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
299 if (! $errormessage ) {
300 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
301 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
303 $proxysettings { 'NCSA_USERNAME' } = '' ;
304 $proxysettings { 'NCSA_GROUP' } = '' ;
305 $proxysettings { 'NCSA_PASS' } = '' ;
306 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
309 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
311 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
312 & deluser
( $proxysettings { 'ID' });
315 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
316 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
317 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
319 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
321 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
322 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
323 @temp = split ( /:/ , $proxysettings { 'ID' });
324 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
325 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
326 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
327 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
330 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
332 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
333 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
334 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
335 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
336 $errormessage = $Lang :: tr
{ 'invalid input' };
339 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
340 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
344 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
346 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
349 if (!(& General
:: validport
( $proxysettings { 'TRANSPARENT_PORT' })))
351 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
354 if ( $proxysettings { 'PROXY_PORT' } eq $proxysettings { 'TRANSPARENT_PORT' }) {
355 $errormessage = $Lang :: tr
{ 'advproxy errmsg proxy ports equal' };
358 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
360 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
361 if (!(& General
:: validip
( $temp [ 0 ])))
363 if (!(& General
:: validdomainname
( $temp [ 0 ])))
365 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
370 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
371 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
373 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
375 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
379 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
380 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 1048576 ))
382 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
385 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ))
387 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
390 my @free = & General
:: system_output
( "/usr/bin/free" );
391 $free [ 1 ] =~ m/(\d+)/ ;
392 $cachemem = int $1 / 2048 ;
393 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
394 $proxysettings { 'CACHE_MEM' } = $cachemem ;
396 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
398 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
401 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
403 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
406 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
408 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
411 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
413 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
416 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
418 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
421 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
423 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
424 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
425 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
427 if ( $netsettings { 'BLUE_DEV' })
429 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
430 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
432 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
436 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
438 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
443 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
444 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
446 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
449 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
451 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
454 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
456 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
459 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
461 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
464 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
466 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
470 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
472 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
474 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
478 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
480 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
482 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
486 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
488 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
490 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
493 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
495 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
497 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
501 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
503 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
506 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
508 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
510 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
515 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
517 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
519 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
522 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
524 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
527 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
529 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
534 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
537 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
538 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
539 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
540 if (( $proxy1 ne $proxy2 ))
542 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
550 $proxysettings { 'VALID' } = 'no' ; }
552 $proxysettings { 'VALID' } = 'yes' ; }
554 if ( $proxysettings { 'VALID' } eq 'yes' )
556 # Determine if suricata may needs to be restarted.
557 my $suricata_proxy_ports_changed ;
559 # Check if the IDS is running
560 if (& IDS
:: ids_is_running
()) {
561 my %oldproxysettings ;
563 # Read-in current proxy settings and store them as oldsettings hash.
564 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%oldproxysettings );
566 # Check if the proxy port has been changed.
567 unless ( $proxysettings { 'PROXY_PORT' } eq $oldproxysettings { 'PROXY_PORT' }) {
568 # Port has changed, suricata needs to be adjusted.
569 $suricata_proxy_ports_changed = 1 ;
572 # Check if the transparent port has been changed.
573 unless ( $proxysettings { 'TRANSPARENT_PORT' } eq $oldproxysettings { 'TRANSPARENT_PORT' }) {
574 # Transparent port has changed, suricata needs to be adjusted.
575 $suricata_proxy_ports_changed = 1 ;
581 delete $proxysettings { 'SRC_SUBNETS' };
582 delete $proxysettings { 'SRC_BANNED_IP' };
583 delete $proxysettings { 'SRC_BANNED_MAC' };
584 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
585 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
586 delete $proxysettings { 'DST_NOCACHE' };
587 delete $proxysettings { 'DST_NOAUTH' };
588 delete $proxysettings { 'DST_NOPROXY_IP' };
589 delete $proxysettings { 'DST_NOPROXY_URL' };
590 delete $proxysettings { 'PORTS_SAFE' };
591 delete $proxysettings { 'PORTS_SSL' };
592 delete $proxysettings { 'MIME_TYPES' };
593 delete $proxysettings { 'NTLM_ALLOW_USERS' };
594 delete $proxysettings { 'NTLM_DENY_USERS' };
595 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
596 delete $proxysettings { 'RADIUS_DENY_USERS' };
597 delete $proxysettings { 'IDENT_HOSTS' };
598 delete $proxysettings { 'IDENT_ALLOW_USERS' };
599 delete $proxysettings { 'IDENT_DENY_USERS' };
601 delete $proxysettings { 'CRE_GROUPS' };
602 delete $proxysettings { 'CRE_SVHOSTS' };
604 delete $proxysettings { 'NCSA_USERNAME' };
605 delete $proxysettings { 'NCSA_GROUP' };
606 delete $proxysettings { 'NCSA_PASS' };
607 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
609 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
610 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
611 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
612 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
613 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
614 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
615 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
617 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
618 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
620 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
622 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
623 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
624 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
625 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
626 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
627 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
628 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
629 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
630 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
635 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
637 & General
:: system ( '/usr/local/bin/squidctrl' , 'disable' );
638 unlink "${General::swroot}/proxy/enable" ;
639 unlink "${General::swroot}/proxy/transparent" ;
640 unlink "${General::swroot}/proxy/enable_blue" ;
641 unlink "${General::swroot}/proxy/transparent_blue" ;
643 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
644 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
645 & General
:: system ( '/usr/local/bin/squidctrl' , 'enable' ); }
646 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
647 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
648 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
649 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
650 & General
:: system ( '/usr/local/bin/squidctrl' , 'enable' ); }
651 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
652 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
654 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { & General
:: system ( '/usr/local/bin/squidctrl' , 'restart' ); }
655 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { & General
:: system ( '/usr/local/bin/squidctrl' , 'reconfigure' ); }
657 # Check if the suricata_proxy_ports_changed flag has been set.
658 if ( $suricata_proxy_ports_changed ) {
659 # Re-generate HTTP ports file.
660 & IDS
:: generate_http_ports_file
();
663 & IDS
:: call_suricatactrl
( "restart" );
668 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
670 & General
:: system ( '/usr/local/bin/squidctrl' , 'flush' );
675 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
676 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
677 } elsif (- e
"${General::swroot}/proxy/settings" ) {
678 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
683 # ------------------------------------------------------------------
685 # Hook to regenerate the configuration files, if cgi got called from command line.
686 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
691 # -------------------------------------------------------------------
693 $checked { 'ENABLE' }{ 'off' } = '' ;
694 $checked { 'ENABLE' }{ 'on' } = '' ;
695 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
697 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
698 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
699 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
701 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
702 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
703 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
705 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
706 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
707 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
709 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
710 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
711 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
713 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
714 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
715 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
716 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
717 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
718 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
719 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
720 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
721 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
722 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
723 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
724 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
726 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
727 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
728 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
729 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
730 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
731 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
732 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
733 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
734 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
736 $checked { 'LOGGING' }{ 'off' } = '' ;
737 $checked { 'LOGGING' }{ 'on' } = '' ;
738 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
739 $checked { 'CACHEMGR' }{ 'off' } = '' ;
740 $checked { 'CACHEMGR' }{ 'on' } = '' ;
741 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
742 $checked { 'LOGQUERY' }{ 'off' } = '' ;
743 $checked { 'LOGQUERY' }{ 'on' } = '' ;
744 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
745 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
746 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
747 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
749 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
750 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
752 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
753 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
754 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
755 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
756 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
757 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
759 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
760 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
761 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
763 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
764 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
765 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
766 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
767 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
769 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
770 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
771 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
772 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
773 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
774 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
775 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
777 $checked { 'TIME_MON' }{ 'off' } = '' ;
778 $checked { 'TIME_MON' }{ 'on' } = '' ;
779 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
780 $checked { 'TIME_TUE' }{ 'off' } = '' ;
781 $checked { 'TIME_TUE' }{ 'on' } = '' ;
782 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
783 $checked { 'TIME_WED' }{ 'off' } = '' ;
784 $checked { 'TIME_WED' }{ 'on' } = '' ;
785 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
786 $checked { 'TIME_THU' }{ 'off' } = '' ;
787 $checked { 'TIME_THU' }{ 'on' } = '' ;
788 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
789 $checked { 'TIME_FRI' }{ 'off' } = '' ;
790 $checked { 'TIME_FRI' }{ 'on' } = '' ;
791 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
792 $checked { 'TIME_SAT' }{ 'off' } = '' ;
793 $checked { 'TIME_SAT' }{ 'on' } = '' ;
794 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
795 $checked { 'TIME_SUN' }{ 'off' } = '' ;
796 $checked { 'TIME_SUN' }{ 'on' } = '' ;
797 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
799 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
800 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
801 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
802 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
804 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
805 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
806 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
808 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
809 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
810 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
811 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
812 $checked { 'AUTH_METHOD' }{ 'ntlm-auth' } = '' ;
813 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
814 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
816 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
818 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
819 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
820 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
822 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
823 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
824 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
826 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
828 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
830 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
832 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
833 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
834 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
836 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
837 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
838 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
840 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
841 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
842 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
844 $checked { 'NTLM_AUTH_BASIC' }{ 'on' } = '' ;
845 $checked { 'NTLM_AUTH_BASIC' }{ 'off' } = '' ;
846 $checked { 'NTLM_AUTH_BASIC' }{ $proxysettings { 'NTLM_AUTH_BASIC' }} = "checked='checked'" ;
848 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
849 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
850 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
852 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
853 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
854 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
856 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
857 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
858 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
860 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
861 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
862 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
864 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
865 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
866 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
868 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
869 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
870 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
872 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
873 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
874 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
876 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
877 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
878 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
880 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
882 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
885 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
886 print "<font class='base'> $errormessage </font> \n " ;
890 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
892 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
893 $squidversion [ 0 ] =~ s/^\s+//g ;
894 $squidversion [ 0 ] =~ s/\s+$//g ;
896 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
899 # ===================================================================
901 # ===================================================================
903 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
905 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
907 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
912 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
915 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
916 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
917 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td>
918 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
921 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
922 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
923 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td>
924 <td width='30%'><input type='text' name='TRANSPARENT_PORT' value=' $proxysettings {'TRANSPARENT_PORT'}' size='5' /></td>
929 if ( $netsettings { 'BLUE_DEV' }) {
930 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
931 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
933 print "<td colspan='2'> </td>" ;
936 <td class='base'> $Lang ::tr{'advproxy visible hostname'}:</td>
937 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
942 if ( $netsettings { 'BLUE_DEV' }) {
943 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
944 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
946 print "<td colspan='2'> </td>" ;
949 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
951 <select name='ERR_LANGUAGE'>
954 foreach (< $errordir /*>) {
956 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
957 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
965 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
966 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
967 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
968 <td class='base'><select name='ERR_DESIGN'>
969 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
970 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
974 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
975 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
984 if ( - e
"/usr/bin/squidclamav" ) {
985 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
986 if ( ! - e
"/var/run/clamav/clamd.pid" ){
987 print "<font color='red'>clamav not running</font><br /><br />" ;
988 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
991 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
997 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</a></b><br />" ;
998 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
1000 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</a></b><br />" ;
1001 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1006 <table width='100%'>
1008 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1011 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1012 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1013 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}:</td>
1014 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1017 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1018 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1019 <td class='base'> $Lang ::tr{'advproxy upstream username'}:</td>
1020 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1023 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1024 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1025 <td class='base'> $Lang ::tr{'advproxy upstream password'}:</td>
1026 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1029 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1030 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1036 <table width='100%'>
1038 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1041 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1042 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1043 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1044 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1049 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1050 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1054 <table width='100%'>
1056 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1059 <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'> $Lang ::tr{'proxy cachemgr'}:</td>
1060 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1061 <td class='base'> $Lang ::tr{'advproxy admin mail'}:</td>
1062 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1065 <td class='base'> $Lang ::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td>
1066 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1067 <td class='base'> $Lang ::tr{'proxy admin password'}:</td>
1068 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1071 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1074 <td class='base'> $Lang ::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td>
1075 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1076 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td>
1077 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1080 <td class='base'> $Lang ::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td>
1081 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1082 <td class='base'> $Lang ::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td>
1083 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1086 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1087 <td class='base'><select name='L1_DIRS'>
1088 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1089 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1090 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1091 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1092 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1094 <td colspan='2' rowspan= '5' valign='top' class='base'>
1095 <table cellspacing='0' cellpadding='0'>
1097 <!-- intentionally left empty -->
1100 <td> $Lang ::tr{'advproxy no cache sites'}:</td>
1103 <!-- intentionally left empty -->
1106 <!-- intentionally left empty -->
1109 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1113 print $proxysettings { 'DST_NOCACHE' };
1122 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1123 <td class='base'><select name='MEM_POLICY'>
1124 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1125 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1126 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1127 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1131 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1132 <td class='base'><select name='CACHE_POLICY'>
1133 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1134 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1135 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1136 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1140 <td colspan='2'> </td>
1143 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1144 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1147 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1148 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1152 <table width='100%'>
1154 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1157 <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
1160 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td>
1161 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td>
1164 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1167 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1171 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1174 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1181 <table width='100%'>
1183 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1186 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1189 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td>
1192 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1196 if (! $proxysettings { 'SRC_SUBNETS' })
1198 if (& Header
:: green_used
()) {
1199 print " $green_cidr \n " ;
1202 if (& Header
:: blue_used
()) {
1203 print " $blue_cidr \n " ;
1205 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1212 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1213 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1214 print "<td class='base'> $line :</td> \n " ;
1216 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1220 if ( $netsettings { 'BLUE_DEV' }) {
1221 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1222 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1224 print "<td class='base'> $line :</td> \n " ;
1226 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1233 <td colspan='2'> </td>
1236 <td colspan='2'> </td>
1239 <table width='100%'>
1241 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1244 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}:</td>
1245 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}:</td>
1248 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1252 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1256 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1260 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1266 <table width='100%'>
1268 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1271 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}:</td>
1272 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}:</td>
1275 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1279 print $proxysettings { 'SRC_BANNED_IP' };
1283 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1287 print $proxysettings { 'SRC_BANNED_MAC' };
1298 # -------------------------------------------------------------------
1299 # CRE GUI - optional
1300 # -------------------------------------------------------------------
1302 if (- e
$cre_enabled ) { print <<END
1303 <table width='100%'>
1306 <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>
1309 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1315 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1317 <td class='base'> $Lang ::tr{'advproxy supervisor password'}:</td>
1318 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1321 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1322 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}:</td>
1327 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1330 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1334 print $proxysettings { 'CRE_GROUPS' };
1338 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1341 print $proxysettings { 'CRE_SVHOSTS' };
1349 print "</table><hr size='1'>" ;
1353 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1354 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1355 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1360 # ===================================================================
1362 # ===================================================================
1365 <table width='100%'>
1367 <td colspan='4'><b> $Lang ::tr{'advproxy wpad title'}</b></td>
1370 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1373 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_ip'}:</td>
1374 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_url'}:</td>
1377 <td colspan='2'><textarea name='DST_NOPROXY_IP' cols='32' rows='3' wrap='off'>
1381 print $proxysettings { 'DST_NOPROXY_IP' };
1386 <td colspan='2'><textarea name='DST_NOPROXY_URL' cols='32' rows='3' wrap='off'>
1390 print $proxysettings { 'DST_NOPROXY_URL' };
1396 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_ip'}</td>
1397 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_url'}</td>
1400 <td colspan="4"> </td>
1403 <td colspan="4"> $Lang ::tr{'advproxy wpad view pac'}: <a href="http:// $ENV {SERVER_ADDR}:81/wpad.dat" target="_blank">http:// $ENV {SERVER_ADDR}:81/wpad.dat</a></td>
1406 <td colspan="4"> </td>
1409 <td colspan="4"> $Lang ::tr{'advproxy wpad notice'}</td>
1418 # -------------------------------------------------------------------
1422 <table width='100%'>
1424 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1426 <table width='100%'>
1428 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1429 <td width='1%'> </td>
1430 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1431 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1432 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1433 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1434 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1435 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1436 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1437 <td width='1%'> </td>
1438 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1439 <td width='1%'> </td>
1440 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1445 <select name='TIME_ACCESS_MODE'>
1446 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1447 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1451 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1452 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1453 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1454 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1455 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1456 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1457 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1460 <select name='TIME_FROM_HOUR'>
1463 for ( $i = 0 ; $i <= 24 ; $i ++) {
1464 $_ = sprintf ( " %02s " , $i );
1465 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1472 <select name='TIME_FROM_MINUTE'>
1475 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1476 $_ = sprintf ( " %02s " , $i );
1477 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1484 <select name='TIME_TO_HOUR'>
1487 for ( $i = 0 ; $i <= 24 ; $i ++) {
1488 $_ = sprintf ( " %02s " , $i );
1489 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1496 <select name='TIME_TO_MINUTE'>
1499 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1500 $_ = sprintf ( " %02s " , $i );
1501 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1509 <table width='100%'>
1511 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1514 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td>
1515 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1516 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td>
1517 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1521 <table width='100%'>
1523 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1526 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1527 <td width='20%' class='base'>
1528 <select name='THROTTLING_GREEN_TOTAL'>
1532 foreach ( @throttle_limits ) {
1534 my $unit = "kbit/s" ;
1541 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $val $unit </option> \n " ;
1545 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1548 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1549 <td width='30%' class='base'>
1550 <select name='THROTTLING_GREEN_HOST'>
1554 foreach ( @throttle_limits ) {
1555 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1559 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1566 if ( $netsettings { 'BLUE_DEV' }) {
1569 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1571 <select name='THROTTLING_BLUE_TOTAL'>
1575 foreach ( @throttle_limits ) {
1576 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1580 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1583 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1585 <select name='THROTTLING_BLUE_HOST'>
1589 foreach ( @throttle_limits ) {
1590 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1594 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1605 <table width='100%'>
1607 <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>
1611 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1614 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}:</td>
1619 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1623 print $proxysettings { 'MIME_TYPES' };
1640 my $auth_columns = 5 ;
1641 if ( $HAVE_NTLM_AUTH ) {
1644 my $auth_column_width = 100 / $auth_columns ;
1647 <table width='100%'>
1649 <td colspan=' $auth_columns '><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1652 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked {'AUTH_METHOD'}{'none'} /> $Lang ::tr{'advproxy AUTH method none'}</td>
1653 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked {'AUTH_METHOD'}{'ncsa'} /> $Lang ::tr{'advproxy AUTH method ncsa'}</td>
1654 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked {'AUTH_METHOD'}{'ident'} /> $Lang ::tr{'advproxy AUTH method ident'}</td>
1655 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked {'AUTH_METHOD'}{'ldap'} /> $Lang ::tr{'advproxy AUTH method ldap'}</td>
1658 if ( $HAVE_NTLM_AUTH ) {
1660 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm-auth' $checked {'AUTH_METHOD'}{'ntlm-auth'} /> $Lang ::tr{'advproxy AUTH method ntlm auth'}</td>
1665 <td width=' $auth_column_width %' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked {'AUTH_METHOD'}{'radius'} /> $Lang ::tr{'advproxy AUTH method radius'}</td>
1671 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1673 <table width='100%'>
1675 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1678 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1681 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1682 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1683 <td colspan='2' rowspan= '6' valign='top' class='base'>
1684 <table cellpadding='0' cellspacing='0'>
1686 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}:</td>
1689 <!-- intentionally left empty -->
1692 <!-- intentionally left empty -->
1695 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1698 <!-- intentionally left empty -->
1701 <!-- intentionally left empty -->
1704 <td> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1707 <!-- intentionally left empty -->
1710 <!-- intentionally left empty -->
1713 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1717 print $proxysettings { 'DST_NOAUTH' };
1726 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1727 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1730 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}:</td>
1731 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1734 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1735 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1738 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1739 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1742 <td colspan='2'> </td>
1749 # ===================================================================
1750 # NCSA auth settings
1751 # ===================================================================
1753 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1756 <table width='100%'>
1758 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1761 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1762 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1763 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1764 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1767 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1775 # ===================================================================
1776 # IDENTD auth settings
1777 # ===================================================================
1779 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1782 <table width='100%'>
1784 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1787 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1788 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1789 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1790 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1793 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1794 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1799 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1800 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1803 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1806 if (! $proxysettings { 'IDENT_HOSTS' }) {
1807 if (& Header
:: green_used
()) {
1808 print " $green_cidr \n " ;
1811 if (& Header
:: blue_used
()) {
1812 print " $blue_cidr \n " ;
1815 print $proxysettings { 'IDENT_HOSTS' };
1820 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1824 print $proxysettings { 'DST_NOAUTH' };
1831 <table width='100%'>
1833 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1836 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1837 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1838 <td width='25%'> </td>
1839 <td width='30%'> </td>
1842 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1843 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1844 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1845 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1848 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1849 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1852 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1856 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1858 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1860 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1864 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1866 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1873 # ===================================================================
1874 # NTLM-AUTH settings
1875 # ===================================================================
1877 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' ) {
1880 <table width='100%'>
1881 <td width='20%' class='base'> $Lang ::tr{'advproxy basic authentication'}:</td>
1882 <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked {'NTLM_AUTH_BASIC'}{'on'} /></td>
1883 <td colspan='2'> </td>
1888 <table width='100%'>
1890 <td colspan='4'><b> $Lang ::tr{'advproxy group access control'}</b></td>
1893 <td width='20%' class='base'> $Lang ::tr{'advproxy group required'}:</td>
1894 <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value=' $proxysettings {'NTLM_AUTH_GROUP'}' size='37' /></td>
1902 # ===================================================================
1903 # LDAP auth settings
1904 # ===================================================================
1906 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1909 <table width='100%'>
1911 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1914 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1915 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1916 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1917 <td class='base'><select name='LDAP_TYPE'>
1918 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1919 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1920 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1921 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1925 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1926 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1927 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1928 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1932 <table width='100%'>
1934 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1937 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1938 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1939 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1940 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1944 <table width='100%'>
1946 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1949 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}:</td>
1950 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1958 # ===================================================================
1959 # RADIUS auth settings
1960 # ===================================================================
1962 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
1965 <table width='100%'>
1967 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
1970 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
1971 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
1972 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
1973 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
1976 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}:</td>
1977 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
1978 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
1979 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
1983 <table width='100%'>
1985 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
1988 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1989 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
1990 <td width='25%'> </td>
1991 <td width='30%'> </td>
1994 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
1995 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
1996 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
1997 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
2000 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
2001 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2004 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2008 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2010 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2012 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2016 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2018 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2025 # ===================================================================
2031 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2033 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2034 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2035 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2036 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2037 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2038 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2039 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2043 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2045 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2046 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2047 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2048 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2049 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2053 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2055 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2056 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2060 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2062 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2063 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2064 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2065 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2066 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2067 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2068 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2072 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2074 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2075 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2076 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2077 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2078 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2079 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2080 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2084 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2086 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2087 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2088 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2089 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2090 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2091 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2092 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2093 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2105 <table width='100%'>
2108 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2109 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2110 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2111 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2117 <table width='100%'>
2119 <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'> $Lang ::tr{'required field'}</font></td>
2120 <td align='right'> </td>
2127 & Header
:: closebox
();
2131 # ===================================================================
2132 # NCSA user management
2133 # ===================================================================
2135 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2137 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2138 <table width='100%'>
2140 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2143 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2144 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2147 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly='readonly' " ; }
2150 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2152 <select name='NCSA_GROUP'>
2153 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2154 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2155 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2161 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2162 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2163 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2164 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2171 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2172 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2173 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2176 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2177 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2183 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2188 <table width='100%'>
2190 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2193 <table width='100%' align='center'>
2199 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2200 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2204 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2205 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2209 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2210 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2213 @userlist = sort ( @userlist );
2215 # If the password file contains entries, print entries and action icons
2217 if ( ! - z
" $userdb " ) {
2220 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2221 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2222 <td class='boldbase' colspan='2' align='center'> </td>
2227 foreach $line ( @userlist )
2231 @temp = split ( /:/ , $line );
2232 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2233 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2235 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2237 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2240 <td align='center'> $temp [0]</td>
2244 if ( $temp [ 1 ] eq 'standard' ) {
2245 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2246 } elsif ( $temp [ 1 ] eq 'extended' ) {
2247 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2248 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2249 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2252 <td width='8%' align='center'>
2253 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2254 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2255 <input type='hidden' name='ID' value=' $line ' />
2256 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2260 <td width='8%' align='center'>
2261 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2262 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2263 <input type='hidden' name='ID' value=' $temp [0]' />
2264 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2277 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2278 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2279 <td class='base'> $Lang ::tr{'edit'}</td>
2280 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2281 <td class='base'> $Lang ::tr{'remove'}</td>
2288 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2299 & Header
:: closebox
();
2303 # ===================================================================
2305 & Header
:: closebigbox
();
2307 & Header
:: closepage
();
2309 # -------------------------------------------------------------------
2313 if (- e
" $acl_src_subnets " ) {
2314 open ( FILE
, " $acl_src_subnets " );
2315 delete $proxysettings { 'SRC_SUBNETS' };
2316 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2319 if (- e
" $acl_src_banned_ip " ) {
2320 open ( FILE
, " $acl_src_banned_ip " );
2321 delete $proxysettings { 'SRC_BANNED_IP' };
2322 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2325 if (- e
" $acl_src_banned_mac " ) {
2326 open ( FILE
, " $acl_src_banned_mac " );
2327 delete $proxysettings { 'SRC_BANNED_MAC' };
2328 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2331 if (- e
" $acl_src_unrestricted_ip " ) {
2332 open ( FILE
, " $acl_src_unrestricted_ip " );
2333 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2334 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2337 if (- e
" $acl_src_unrestricted_mac " ) {
2338 open ( FILE
, " $acl_src_unrestricted_mac " );
2339 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2340 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2343 if (- e
" $acl_dst_nocache " ) {
2344 open ( FILE
, " $acl_dst_nocache " );
2345 delete $proxysettings { 'DST_NOCACHE' };
2346 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2349 if (- e
" $acl_dst_noauth " ) {
2350 open ( FILE
, " $acl_dst_noauth " );
2351 delete $proxysettings { 'DST_NOAUTH' };
2352 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2355 if (- e
" $acl_dst_noproxy_ip " ) {
2356 open ( FILE
, " $acl_dst_noproxy_ip " );
2357 delete $proxysettings { 'DST_NOPROXY_IP' };
2358 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_IP' } .= $_ };
2361 if (- e
" $acl_dst_noproxy_url " ) {
2362 open ( FILE
, " $acl_dst_noproxy_url " );
2363 delete $proxysettings { 'DST_NOPROXY_URL' };
2364 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_URL' } .= $_ };
2367 if (- e
" $acl_ports_safe " ) {
2368 open ( FILE
, " $acl_ports_safe " );
2369 delete $proxysettings { 'PORTS_SAFE' };
2370 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2373 if (- e
" $acl_ports_ssl " ) {
2374 open ( FILE
, " $acl_ports_ssl " );
2375 delete $proxysettings { 'PORTS_SSL' };
2376 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2379 if (- e
" $mimetypes " ) {
2380 open ( FILE
, " $mimetypes " );
2381 delete $proxysettings { 'MIME_TYPES' };
2382 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2385 if (- e
" $raddir /radauth.allowusers" ) {
2386 open ( FILE
, " $raddir /radauth.allowusers" );
2387 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2388 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2391 if (- e
" $raddir /radauth.denyusers" ) {
2392 open ( FILE
, " $raddir /radauth.denyusers" );
2393 delete $proxysettings { 'RADIUS_DENY_USERS' };
2394 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2397 if (- e
" $identdir /identauth.allowusers" ) {
2398 open ( FILE
, " $identdir /identauth.allowusers" );
2399 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2400 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2403 if (- e
" $identdir /identauth.denyusers" ) {
2404 open ( FILE
, " $identdir /identauth.denyusers" );
2405 delete $proxysettings { 'IDENT_DENY_USERS' };
2406 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2409 if (- e
" $identhosts " ) {
2410 open ( FILE
, " $identhosts " );
2411 delete $proxysettings { 'IDENT_HOSTS' };
2412 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2415 if (- e
" $cre_groups " ) {
2416 open ( FILE
, " $cre_groups " );
2417 delete $proxysettings { 'CRE_GROUPS' };
2418 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2421 if (- e
" $cre_svhosts " ) {
2422 open ( FILE
, " $cre_svhosts " );
2423 delete $proxysettings { 'CRE_SVHOSTS' };
2424 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2429 # -------------------------------------------------------------------
2433 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2434 undef $proxysettings { 'PORTS_SAFE' };
2437 s/^\s+//g ; s/\s+$//g ;
2441 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2443 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2444 @templist = split ( /-/ );
2445 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2446 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2450 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2451 undef $proxysettings { 'PORTS_SSL' };
2454 s/^\s+//g ; s/\s+$//g ;
2459 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2460 @templist = split ( /-/ );
2461 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2462 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2466 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2467 undef $proxysettings { 'DST_NOCACHE' };
2471 unless ( /^#/ ) { s/\s+//g ; }
2474 if ( /^\./ ) { $_ = '*' . $_ ; }
2475 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2479 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2480 undef $proxysettings { 'SRC_SUBNETS' };
2483 s/^\s+//g ; s/\s+$//g ;
2486 unless (& Network
:: check_subnet
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' } . ": $_ " ; }
2487 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2491 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2492 undef $proxysettings { 'SRC_BANNED_IP' };
2495 s/^\s+//g ; s/\s+$//g ;
2498 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2499 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2503 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2504 undef $proxysettings { 'SRC_BANNED_MAC' };
2507 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2510 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2511 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2515 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2516 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2519 s/^\s+//g ; s/\s+$//g ;
2522 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2523 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2527 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2528 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2531 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2534 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2535 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2539 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2540 undef $proxysettings { 'DST_NOAUTH' };
2544 unless ( /^#/ ) { s/\s+//g ; }
2547 if ( /^\./ ) { $_ = '*' . $_ ; }
2548 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2552 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_IP' });
2553 undef $proxysettings { 'DST_NOPROXY_IP' };
2556 s/^\s+//g ; s/\s+$//g ;
2559 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg wpad invalid ip or mask' }; }
2560 $proxysettings { 'DST_NOPROXY_IP' } .= $_ . " \n " ;
2564 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_URL' });
2565 undef $proxysettings { 'DST_NOPROXY_URL' };
2569 unless ( /^#/ ) { s/\s+//g ; }
2572 if ( /^\./ ) { $_ = '*' . $_ ; }
2573 $proxysettings { 'DST_NOPROXY_URL' } .= $_ . " \n " ;
2577 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2579 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2580 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2583 s/^\s+//g ; s/\s+$//g ;
2584 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2586 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2589 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2591 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2592 undef $proxysettings { 'NTLM_DENY_USERS' };
2595 s/^\s+//g ; s/\s+$//g ;
2596 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2598 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2601 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2603 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2604 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2607 s/^\s+//g ; s/\s+$//g ;
2608 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2610 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2613 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2615 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2616 undef $proxysettings { 'IDENT_DENY_USERS' };
2619 s/^\s+//g ; s/\s+$//g ;
2620 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2622 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2625 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2627 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2628 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2631 s/^\s+//g ; s/\s+$//g ;
2632 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2634 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2637 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2639 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2640 undef $proxysettings { 'RADIUS_DENY_USERS' };
2643 s/^\s+//g ; s/\s+$//g ;
2644 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2646 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2649 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2650 undef $proxysettings { 'IDENT_HOSTS' };
2653 s/^\s+//g ; s/\s+$//g ;
2656 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2657 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2661 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2662 undef $proxysettings { 'CRE_SVHOSTS' };
2665 s/^\s+//g ; s/\s+$//g ;
2668 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2669 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2674 # -------------------------------------------------------------------
2678 open ( FILE
, "> $acl_src_subnets " );
2680 if (! $proxysettings { 'SRC_SUBNETS' })
2682 if (& Header
:: green_used
()) {
2683 print FILE
" $green_cidr \n " ;
2686 if (& Header
:: blue_used
()) {
2687 print FILE
" $blue_cidr \n " ;
2689 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2692 open ( FILE
, "> $acl_src_banned_ip " );
2694 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2697 open ( FILE
, "> $acl_src_banned_mac " );
2699 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2702 open ( FILE
, "> $acl_src_unrestricted_ip " );
2704 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2707 open ( FILE
, "> $acl_src_unrestricted_mac " );
2709 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2712 open ( FILE
, "> $acl_dst_noauth " );
2714 print FILE
$proxysettings { 'DST_NOAUTH' };
2717 open ( FILE
, "> $acl_dst_noproxy_ip " );
2719 print FILE
$proxysettings { 'DST_NOPROXY_IP' };
2722 open ( FILE
, "> $acl_dst_noproxy_url " );
2724 print FILE
$proxysettings { 'DST_NOPROXY_URL' };
2727 open ( FILE
, "> $acl_dst_noauth_net " );
2729 open ( FILE
, "> $acl_dst_noauth_dom " );
2731 open ( FILE
, "> $acl_dst_noauth_url " );
2734 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2742 open ( FILE
, ">> $acl_dst_noauth_dom " );
2747 elsif (& General
:: validipormask
( $_ ))
2749 open ( FILE
, ">> $acl_dst_noauth_net " );
2754 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?/ )
2756 open ( FILE
, ">> $acl_dst_noauth_net " );
2763 open ( FILE
, ">> $acl_dst_noauth_url " );
2765 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2771 open ( FILE
, "> $acl_dst_nocache " );
2773 print FILE
$proxysettings { 'DST_NOCACHE' };
2776 open ( FILE
, "> $acl_dst_nocache_net " );
2778 open ( FILE
, "> $acl_dst_nocache_dom " );
2780 open ( FILE
, "> $acl_dst_nocache_url " );
2783 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2791 open ( FILE
, ">> $acl_dst_nocache_dom " );
2796 elsif (& General
:: validipormask
( $_ ))
2798 open ( FILE
, ">> $acl_dst_nocache_net " );
2803 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?/ )
2805 open ( FILE
, ">> $acl_dst_nocache_net " );
2812 open ( FILE
, ">> $acl_dst_nocache_url " );
2814 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2820 open ( FILE
, "> $acl_ports_safe " );
2822 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2825 open ( FILE
, "> $acl_ports_ssl " );
2827 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2830 if (- s
$throttled_urls )
2832 open ( URLFILE
, $throttled_urls );
2835 foreach ( @temp ) { print FILE
; }
2839 open ( FILE
, "> $mimetypes " );
2841 print FILE
$proxysettings { 'MIME_TYPES' };
2844 open ( FILE
, "> $raddir /radauth.allowusers" );
2846 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2849 open ( FILE
, "> $raddir /radauth.denyusers" );
2851 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2854 open ( FILE
, "> $identdir /identauth.allowusers" );
2856 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2859 open ( FILE
, "> $identdir /identauth.denyusers" );
2861 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2864 open ( FILE
, "> $identhosts " );
2866 print FILE
$proxysettings { 'IDENT_HOSTS' };
2869 open ( FILE
, "> $cre_groups " );
2871 print FILE
$proxysettings { 'CRE_GROUPS' };
2874 open ( FILE
, "> $cre_svhosts " );
2876 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2880 # -------------------------------------------------------------------
2886 & General
:: readhasharray
( "${General::swroot}/vpn/config" , \
%vpnconfig );
2887 & General
:: readhasharray
( "${General::swroot}/ovpn/ovpnconfig" , \
%ovpnconfig );
2888 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2890 print FILE
"function FindProxyForURL(url, host) \n " ;
2892 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2896 (isPlainHostName(host)) ||
2897 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2901 if ( $netsettings { 'GREEN_DEV' }) {
2902 print FILE
" (isInNet(host, \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" )) || \n " ;
2905 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
2906 print FILE
" (isInNet(host, \" $netsettings {'BLUE_NETADDRESS'} \" , \" $netsettings {'BLUE_NETMASK'} \" )) || \n " ;
2909 if (& Header
:: orange_used
() && $netsettings { 'ORANGE_DEV' }) {
2910 print FILE
" (isInNet(host, \" $netsettings {'ORANGE_NETADDRESS'} \" , \" $netsettings {'ORANGE_NETMASK'} \" )) || \n " ;
2913 # Additional exceptions for URLs
2914 # The file has to be created by the user and should contain one entry per line
2915 # Line-Format: <URL incl. wildcards>
2916 # e.g. *.ipfire.org*
2917 if (- s
" $acl_dst_noproxy_url " ) {
2920 open ( NOPROXY
, " $acl_dst_noproxy_url " );
2921 @templist = < NOPROXY
>;
2927 print FILE
" (shExpMatch(url, \" $_ \" )) || \n " ;
2931 # Additional exceptions for Subnets
2932 # The file has to be created by the user and should contain one entry per line
2933 # Line-Format: <IP>/<SUBNET MASK>
2934 # e.g. 192.168.0.0/255.255.255.0
2935 if (- s
" $acl_dst_noproxy_ip " ) {
2938 open ( NOPROXY
, " $acl_dst_noproxy_ip " );
2939 @templist = < NOPROXY
>;
2945 @temp = split ( /\/ /);
2946 print FILE
" (isInNet(host, \" $temp [0] \" , \" $temp [1] \" )) || \n " ;
2950 foreach my $key ( sort { uc ( $vpnconfig { $a }[ 1 ]) cmp uc ( $vpnconfig { $b }[ 1 ]) } keys %vpnconfig ) {
2951 if ( $vpnconfig { $key }[ 0 ] eq 'on' && $vpnconfig { $key }[ 3 ] ne 'host' ) {
2952 my @networks = split ( /\|/ , $vpnconfig { $key }[ 11 ]);
2953 foreach my $network ( @networks ) {
2954 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
2955 $vpnsub = & Network
:: convert_prefix2netmask
( $vpnsub ) || $vpnsub ;
2956 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
2961 foreach my $key ( sort { uc ( $ovpnconfig { $a }[ 1 ]) cmp uc ( $ovpnconfig { $b }[ 1 ]) } keys %ovpnconfig ) {
2962 if ( $ovpnconfig { $key }[ 0 ] eq 'on' && $ovpnconfig { $key }[ 3 ] ne 'host' ) {
2963 my @networks = split ( /\|/ , $ovpnconfig { $key }[ 11 ]);
2964 foreach my $network ( @networks ) {
2965 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
2966 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
2972 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2980 if ( $proxysettings { 'ENABLE' } eq 'on' )
2982 print FILE
"if ( \n " ;
2983 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2986 if (- e
" $acl_src_subnets " ) {
2987 open ( SUBNETS
, " $acl_src_subnets " );
2988 @templist = < SUBNETS
>;
2994 @temp = split ( /\/ /);
2996 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2997 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
3001 my $tempmask = & Network
:: convert_prefix2netmask
( $temp [ 1 ]);
3002 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $tempmask \" ))" ;
3010 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3014 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
3016 print FILE
" \n else \n\n " ;
3018 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
3022 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
3024 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3033 # -------------------------------------------------------------------
3040 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3041 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3042 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3043 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3045 $delaypools = 1 ; } else { $delaypools = 0 ;
3048 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3050 $authrealm = "IPFire Advanced Proxy Server" ;
3052 $authrealm = $proxysettings { 'AUTH_REALM' };
3055 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3056 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3058 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3060 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3063 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3064 # you make will be overwritten whenever you resave proxy settings using the
3067 # Instead, modify the file ' $acl_include ' and
3068 # then restart the proxy service using the web interface. Changes made to the
3069 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3071 shutdown_lifetime 5 seconds
3077 # Include file with user defined settings.
3078 if (- e
"/etc/squid/squid.conf.pre.local" ) {
3079 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
3082 if (& Header
:: green_used
()) {
3083 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3085 print FILE
"http_port 0.0.0.0: $proxysettings {'PROXY_PORT'}" ;
3087 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3090 if (& Header
:: green_used
() && $proxysettings { 'TRANSPARENT' } eq 'on' ) {
3091 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3092 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3096 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3097 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3098 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3101 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) {
3102 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3103 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3108 if (( $proxysettings { 'CACHE_SIZE' } > 0 ) || ( $proxysettings { 'CACHE_MEM' } > 0 ))
3112 if (!- z
$acl_dst_nocache_dom ) {
3113 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3114 print FILE
"cache deny no_cache_domains \n " ;
3116 if (!- z
$acl_dst_nocache_net ) {
3117 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3118 print FILE
"cache deny no_cache_ipaddr \n " ;
3120 if (!- z
$acl_dst_nocache_url ) {
3121 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3122 print FILE
"cache deny no_cache_hosts \n " ;
3128 cache_effective_user squid
3131 pid_filename /var/run/squid.pid
3133 cache_mem $proxysettings {'CACHE_MEM'} MB
3136 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3138 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3139 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
3141 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3143 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3145 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3147 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3149 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3154 open ( PORTS
, " $acl_ports_ssl " );
3155 my @ssl_ports = < PORTS
>;
3159 foreach ( @ssl_ports ) {
3160 print FILE
"acl SSL_ports port $_ " ;
3164 open ( PORTS
, " $acl_ports_safe " );
3165 my @safe_ports = < PORTS
>;
3169 foreach ( @safe_ports ) {
3170 print FILE
"acl Safe_ports port $_ " ;
3175 acl IPFire_ips dst 127.0.0.1
3176 acl IPFire_http port $http_port
3177 acl IPFire_https port $https_port
3178 acl IPFire_networks src " $acl_src_subnets "
3179 acl IPFire_servers dst " $acl_src_subnets "
3181 if (& Header
:: green_used
()) {
3183 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3184 acl IPFire_green_network src $green_cidr
3185 acl IPFire_green_servers dst $green_cidr
3188 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3189 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3190 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3191 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3192 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3193 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3195 acl CONNECT method CONNECT
3199 if ( $proxysettings { 'CACHE_SIZE' } > 0 ) {
3201 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3202 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3204 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
3208 if ( $proxysettings { 'CACHE_MEM' } > 0 ) {
3209 # always 2% of CACHE_MEM defined as max object size
3210 print FILE
"maximum_object_size_in_memory " . int ( $proxysettings { 'CACHE_MEM' } * 1024 * 0.02 ) . " KB \n\n " ;
3212 print FILE
"cache deny all \n\n " ;
3217 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3221 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3222 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3223 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3224 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3226 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3230 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3232 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3235 if ( $proxysettings { 'LOGGING' } eq 'on' )
3238 access_log stdio:/var/log/squid/access.log
3239 cache_log /var/log/squid/cache.log
3240 cache_store_log none
3243 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"access_log stdio:\/var\/log\/squid\/user_agent.log useragent \n " ; }
3244 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3247 access_log /dev/null
3249 cache_store_log none
3258 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3260 print FILE
"forwarded_for on \n " ;
3262 print FILE
"forwarded_for off \n " ;
3264 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3266 print FILE
"via on \n " ;
3268 print FILE
"via off \n " ;
3272 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3274 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3276 print FILE
"auth_param basic program $authdir /basic_ncsa_auth $userdb \n " ;
3277 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3278 print FILE
"auth_param basic realm $authrealm \n " ;
3279 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3280 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3283 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3285 print FILE
"auth_param basic utf8 on \n " ;
3286 print FILE
"auth_param basic program $authdir /basic_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3287 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3288 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3289 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3291 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3293 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3295 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3297 print FILE
" -u sAMAccountName -P" ;
3299 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3301 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3303 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3305 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3307 print FILE
" -u cn -P" ;
3309 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3311 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3313 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3315 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3317 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3318 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3319 print FILE
" -u uid -P" ;
3321 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3322 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3323 print FILE
"auth_param basic realm $authrealm \n " ;
3324 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3325 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3328 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' )
3330 print FILE
"auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" ;
3331 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3332 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3333 $ntlm_auth_group =~ s/\\/\+/ ;
3335 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3339 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n\n " ;
3340 print FILE
"auth_param ntlm credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3342 # BASIC authentication
3343 if ( $proxysettings { 'NTLM_AUTH_BASIC' } eq "on" ) {
3344 print FILE
"auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic" ;
3345 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3346 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3347 $ntlm_auth_group =~ s/\\/\+/ ;
3349 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3352 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3353 print FILE
"auth_param basic realm $authrealm \n " ;
3354 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3358 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3360 print FILE
"auth_param basic program $authdir /basic_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3361 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3362 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3363 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3364 print FILE
"auth_param basic realm $authrealm \n " ;
3365 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3366 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3370 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3371 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3373 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3375 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3377 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3379 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3382 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3385 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3386 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3388 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3391 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3392 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3393 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3398 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3400 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3402 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3404 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3406 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3408 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3410 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3412 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3415 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3416 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3417 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3421 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3423 print FILE
"acl within_timeframe time " ;
3424 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3425 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3426 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3427 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3428 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3429 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3430 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3431 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3432 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3433 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3434 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3436 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3437 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3440 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3443 #Classroom extensions
3444 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3445 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3448 print FILE
"deny_info " ;
3449 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3451 print FILE
"ERR_ACCESS_DISABLED" ;
3453 print FILE
"ERR_ACCESS_DENIED" ;
3455 print FILE
" IPFire_no_access_ips \n " ;
3456 print FILE
"deny_info " ;
3457 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3459 print FILE
"ERR_ACCESS_DISABLED" ;
3461 print FILE
"ERR_ACCESS_DENIED" ;
3463 print FILE
" IPFire_no_access_mac \n " ;
3466 http_access deny IPFire_no_access_ips
3467 http_access deny IPFire_no_access_mac
3472 #Insert acl file and replace __VAR__ with correct values
3473 my $blue_net = '' ; #BLUE empty by default
3475 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3476 $blue_net = " $blue_cidr " ;
3477 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3479 if (!- z
$acl_include )
3481 open ( ACL
, " $acl_include " );
3482 print FILE
" \n #Start of custom includes \n\n " ;
3484 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3485 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3486 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3487 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3488 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3491 print FILE
" \n #End of custom includes \n " ;
3494 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3496 # Check if squidclamav is enabled.
3497 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3498 print FILE
" \n #Settings for squidclamav: \n " ;
3499 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} \n " ;
3500 print FILE
"acl purge method PURGE \n " ;
3501 print FILE
"http_access deny to_localhost \n " ;
3502 print FILE
"http_access allow localhost \n " ;
3503 print FILE
"http_access allow purge localhost \n " ;
3504 print FILE
"http_access deny purge \n " ;
3505 print FILE
"url_rewrite_access deny localhost \n " ;
3510 #local machine, no restriction
3511 http_access allow localhost
3513 #GUI admin if local machine connects
3514 http_access allow IPFire_ips IPFire_networks IPFire_http
3515 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3517 #Deny not web services
3521 print FILE
"http_access deny !Safe_ports \n " ;
3525 print FILE
"http_access deny CONNECT !SSL_ports \n " ;
3528 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3530 print FILE
"#Set ident ACLs \n " ;
3531 if (!- z
$identhosts )
3533 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3534 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3535 print FILE
"ident_lookup_access deny all \n " ;
3537 print FILE
"ident_lookup_access allow all \n " ;
3539 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3543 print FILE
"#Set download throttling \n " ;
3545 if ( $netsettings { 'BLUE_DEV' })
3547 print FILE
"delay_pools 2 \n " ;
3549 print FILE
"delay_pools 1 \n " ;
3552 print FILE
"delay_class 1 3 \n " ;
3553 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3555 print FILE
"delay_parameters 1 " ;
3556 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3560 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3562 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3565 print FILE
" -1/-1 " ;
3566 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3570 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3572 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3576 if ( $netsettings { 'BLUE_DEV' })
3578 print FILE
"delay_parameters 2 " ;
3579 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3583 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3585 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3587 print FILE
" -1/-1 " ;
3588 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3592 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3594 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3599 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3600 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3601 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3602 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3604 if ( $netsettings { 'BLUE_DEV' })
3606 if (& Header
:: green_used
()) {
3607 print FILE
"delay_access 1 allow IPFire_green_network" ;
3608 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3611 print FILE
"delay_access 1 deny all \n " ;
3613 print FILE
"delay_access 1 allow all" ;
3614 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3618 if ( $netsettings { 'BLUE_DEV' })
3620 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3621 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3622 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3623 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3624 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3625 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3627 print FILE
"delay_access 2 deny all \n " ;
3630 print FILE
"delay_initial_bucket_level 100 \n " ;
3634 if (& Header
:: green_used
() && $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3636 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3637 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3640 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3642 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3643 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3644 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3648 #Set custom configured ACLs
3651 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3652 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3654 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3656 if (!- z
$acl_src_unrestricted_ip )
3658 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3659 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3660 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3662 if (!- z
$acl_src_unrestricted_mac )
3664 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3665 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3666 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3668 if (!- z
$acl_dst_noauth_net )
3670 print FILE
"http_access allow IPFire_networks" ;
3671 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3672 print FILE
" !within_timeframe" ;
3674 print FILE
" within_timeframe" ; }
3675 print FILE
" to_ipaddr_without_auth \n " ;
3677 if (!- z
$acl_dst_noauth_dom )
3679 print FILE
"http_access allow IPFire_networks" ;
3680 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3681 print FILE
" !within_timeframe" ;
3683 print FILE
" within_timeframe" ; }
3684 print FILE
" to_domains_without_auth \n " ;
3686 if (!- z
$acl_dst_noauth_url )
3688 print FILE
"http_access allow IPFire_networks" ;
3689 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3690 print FILE
" !within_timeframe" ;
3692 print FILE
" within_timeframe" ; }
3693 print FILE
" to_hosts_without_auth \n " ;
3697 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3699 print FILE
"http_access deny !for_inetusers" ;
3700 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3705 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3706 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3707 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3708 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3709 (!- z
" $identdir /identauth.denyusers" )
3712 print FILE
"http_access deny for_acl_users" ;
3713 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3717 if (!- z
$acl_src_unrestricted_ip )
3719 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3720 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3722 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3724 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3726 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3728 print FILE
" for_inetusers" ;
3730 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3732 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3734 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3736 print FILE
" for_acl_users" ;
3738 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3740 print FILE
" !for_acl_users" ;
3742 } else { print FILE
" for_inetusers" ; }
3748 if (!- z
$acl_src_unrestricted_mac )
3750 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3751 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3753 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3755 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3757 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3759 print FILE
" for_inetusers" ;
3761 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3763 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3765 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3767 print FILE
" for_acl_users" ;
3769 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3771 print FILE
" !for_acl_users" ;
3773 } else { print FILE
" for_inetusers" ; }
3779 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3781 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3782 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3787 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3788 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3789 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3790 (!- z
" $raddir /radauth.denyusers" )
3794 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3795 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3796 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3797 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3798 (!- z
" $identdir /identauth.denyusers" )
3802 print FILE
"http_access deny for_acl_users" ;
3803 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3807 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3809 print FILE
"http_access allow" ;
3810 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3811 print FILE
" !within_timeframe" ;
3813 print FILE
" within_timeframe" ; }
3814 print FILE
" !on_ident_aware_hosts \n " ;
3817 print FILE
"http_access allow IPFire_networks" ;
3820 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3821 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3822 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3823 (!- z
" $raddir /radauth.allowusers" )
3827 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3828 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3829 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3830 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3831 (!- z
" $identdir /identauth.allowusers" )
3835 print FILE
" for_acl_users" ;
3836 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3837 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3838 print FILE
" for_inetusers" ;
3840 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3842 print FILE
" !concurrent" ;
3844 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3845 print FILE
" !within_timeframe" ;
3847 print FILE
" within_timeframe" ; }
3850 print FILE
"http_access deny all \n\n " ;
3852 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ))
3854 print FILE
"#Strip HTTP Header \n " ;
3856 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3858 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3859 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3861 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3863 print FILE
"request_header_access Via deny all \n " ;
3864 print FILE
"reply_header_access Via deny all \n " ;
3871 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3873 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3874 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3875 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3876 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3878 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3880 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3881 print FILE
"http_reply_access allow all \n\n " ;
3884 print FILE
"visible_hostname" ;
3885 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3887 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3889 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3892 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3893 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3896 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3898 # Write the parent proxy info, if needed.
3899 if ( $remotehost ne '' )
3901 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3903 # Enter authentication for the parent cache. Option format is
3904 # login=user:password ($proxy1='YES')
3905 # login=PASS ($proxy1='PASS')
3906 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3907 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3909 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3910 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3912 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3914 print FILE
" \n always_direct allow IPFire_ips \n " ;
3915 print FILE
"never_direct allow all \n\n " ;
3917 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3919 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3920 print FILE
"url_rewrite_children " , & General
:: number_cpu_cores
();
3921 print FILE
" startup=" , & General
:: number_cpu_cores
();
3922 print FILE
" idle=" , & General
:: number_cpu_cores
();
3923 print FILE
" queue-size=" , & General
:: number_cpu_cores
() * 32 , " \n\n " ;
3926 # Include file with user defined settings.
3927 if (- e
"/etc/squid/squid.conf.local" ) {
3928 print FILE
"include /etc/squid/squid.conf.local \n " ;
3932 # Proxy settings for squidclamav - if installed.
3934 # Check if squidclamav is enabled.
3935 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3937 my $configfile = '/etc/squidclamav.conf' ;
3939 my $data = & General
:: read_file_utf8
( $configfile );
3940 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
3941 & General
:: write_file_utf8
( $configfile , $data );
3945 # -------------------------------------------------------------------
3949 my ( $str_user , $str_pass , $str_group ) = @_ ;
3950 my @groupmembers =();
3952 if ( $str_pass eq 'lEaVeAlOnE' )
3954 open ( FILE
, " $userdb " );
3955 @groupmembers = < FILE
>;
3957 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3958 & deluser
( $str_user );
3959 open ( FILE
, ">> $userdb " );
3961 print FILE
" $str_user $str_pass " ;
3964 & deluser
( $str_user );
3966 my %htpasswd_options = (
3967 passwdFile
=> " $userdb " ,
3971 my $htpasswd = new Apache
:: Htpasswd
( \
%htpasswd_options );
3973 $htpasswd -> htpasswd ( $str_user , $str_pass );
3976 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3977 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3978 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3980 print FILE
" $str_user \n " ;
3986 # -------------------------------------------------------------------
3990 my ( $str_user ) = @_ ;
3992 my @groupmembers =();
3995 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
3998 open ( FILE
, " $groupfile " );
3999 @groupmembers = < FILE
>;
4001 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
4002 open ( FILE
, "> $groupfile " );
4004 print FILE
@templist ;
4009 open ( FILE
, " $userdb " );
4010 @groupmembers = < FILE
>;
4012 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4013 open ( FILE
, "> $userdb " );
4015 print FILE
@templist ;
4021 # -------------------------------------------------------------------
4025 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4027 if (& Header
:: green_used
()) {
4028 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4030 print FILE
"localhost" ;
4035 # -------------------------------------------------------------------