]>
git.ipfire.org Git - people/stevee/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 ###############################################################################
24 use Scalar
:: Util
qw(looks_like_number) ;
26 # enable only the following on debugging purpose
28 #use CGI::Carp 'fatalsToBrowser';
30 require '/var/ipfire/general-functions.pl' ;
31 require "${General::swroot}/lang.pl" ;
32 require "${General::swroot}/header.pl" ;
34 require "${General::swroot}/ids-functions.pl" ;
36 my @squidversion = & General
:: system_output
( "/usr/sbin/squid" , "-v" );
41 my %mainsettings = ();
42 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
43 & General
:: readhash
( "/srv/web/ipfire/html/themes/ipfire/include/colors.txt" , \
%color );
47 my %filtersettings =();
48 my %xlratorsettings =();
49 my %stdproxysettings =();
55 my @throttle_limits =( 64 , 128 , 256 , 512 , 1024 , 1536 , 2048 , 3072 , 4096 , 5120 , 6144 , 7168 , 8192 , 10240 , 16384 , 20480 , 51200 , 102400 );
57 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 " ;
58 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
60 my $hintcolour = '#FFFFCC' ;
61 my $ncsa_buttontext = '' ;
76 my $browser_regexp = '' ;
80 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
81 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
82 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
83 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
84 my $credir = "${General::swroot}/proxy/advanced/cre" ;
86 my $userdb = " $ncsadir /passwd" ;
87 my $stdgrp = " $ncsadir /standard.grp" ;
88 my $extgrp = " $ncsadir /extended.grp" ;
89 my $disgrp = " $ncsadir /disabled.grp" ;
91 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
92 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
94 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
95 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
96 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
98 my $identhosts = " $identdir /hosts" ;
100 my $authdir = "/usr/lib/squid" ;
101 my $errordir = "/usr/lib/squid/errors" ;
103 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
104 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
105 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
106 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
107 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
108 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
109 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
110 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
111 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
112 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
113 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
114 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
115 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
116 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
117 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
118 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
119 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
120 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
121 my $acl_include = " $acldir /include.acl" ;
123 my $acl_dst_noproxy_url = " $acldir /dst_noproxy_url.acl" ;
124 my $acl_dst_noproxy_ip = " $acldir /dst_noproxy_ip.acl" ;
126 my $updaccelversion = 'n/a' ;
127 my $urlfilterversion = 'n/a' ;
129 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
130 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
131 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
132 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
133 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
135 unless (- e
$cre_groups ) { & General
:: system ( "touch" , " $cre_groups " ); }
136 unless (- e
$cre_svhosts ) { & General
:: system ( "touch $cre_svhosts " ); }
138 unless (- e
$userdb ) { & General
:: system ( "touch" , " $userdb " ); }
139 unless (- e
$stdgrp ) { & General
:: system ( "touch" , " $stdgrp " ); }
140 unless (- e
$extgrp ) { & General
:: system ( "touch" , " $extgrp " ); }
141 unless (- e
$disgrp ) { & General
:: system ( "touch" , " $disgrp " ); }
143 unless (- e
$acl_src_subnets ) { & General
:: system ( "touch" , " $acl_src_subnets " ); }
144 unless (- e
$acl_src_banned_ip ) { & General
:: system ( "touch" , " $acl_src_banned_ip " ); }
145 unless (- e
$acl_src_banned_mac ) { & General
:: system ( "touch" , " $acl_src_banned_mac " ); }
146 unless (- e
$acl_src_unrestricted_ip ) { & General
:: system ( "touch" , " $acl_src_unrestricted_ip " ); }
147 unless (- e
$acl_src_unrestricted_mac ) { & General
:: system ( "touch" , " $acl_src_unrestricted_mac " ); }
148 unless (- e
$acl_src_noaccess_ip ) { & General
:: system ( "touch" , " $acl_src_noaccess_ip " ); }
149 unless (- e
$acl_src_noaccess_mac ) { & General
:: system ( "touch" , " $acl_src_noaccess_mac " ); }
150 unless (- e
$acl_dst_noauth ) { & General
:: system ( "touch" , " $acl_dst_noauth " ); }
151 unless (- e
$acl_dst_noauth_dom ) { & General
:: system ( "touch" , " $acl_dst_noauth_dom " ); }
152 unless (- e
$acl_dst_noauth_net ) { & General
:: system ( "touch" , " $acl_dst_noauth_net " ); }
153 unless (- e
$acl_dst_noauth_url ) { & General
:: system ( "touch" , " $acl_dst_noauth_url " ); }
154 unless (- e
$acl_dst_nocache ) { & General
:: system ( "touch" , " $acl_dst_nocache " ); }
155 unless (- e
$acl_dst_nocache_dom ) { & General
:: system ( "touch" , " $acl_dst_nocache_dom " ); }
156 unless (- e
$acl_dst_nocache_net ) { & General
:: system ( "touch" , " $acl_dst_nocache_net " ); }
157 unless (- e
$acl_dst_nocache_url ) { & General
:: system ( "touch" , " $acl_dst_nocache_url " ); }
158 unless (- e
$acl_dst_throttle ) { & General
:: system ( "touch" , " $acl_dst_throttle " ); }
159 unless (- e
$acl_ports_safe ) { & General
:: system ( "touch" , " $acl_ports_safe " ); }
160 unless (- e
$acl_ports_ssl ) { & General
:: system ( "touch" , " $acl_ports_ssl " ); }
161 unless (- e
$acl_include ) { & General
:: system ( "touch" , " $acl_include " ); }
163 unless (- e
$mimetypes ) { & General
:: system ( "touch" , " $mimetypes " ); }
165 my $HAVE_NTLM_AUTH = (- e
"/usr/bin/ntlm_auth" );
167 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
168 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
171 if (& Header
:: green_used
() && $netsettings { 'GREEN_DEV' }) {
172 $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
176 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
177 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
180 & Header
:: showhttpheaders
();
182 $proxysettings { 'ACTION' } = '' ;
183 $proxysettings { 'VALID' } = '' ;
185 $proxysettings { 'ENABLE' } = 'off' ;
186 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
187 $proxysettings { 'TRANSPARENT' } = 'off' ;
188 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
189 $proxysettings { 'PROXY_PORT' } = '800' ;
190 $proxysettings { 'TRANSPARENT_PORT' } = '3128' ;
191 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
192 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
193 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
194 $proxysettings { 'ERR_LANGUAGE' } = 'en' ;
195 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
196 $proxysettings { '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 { 'ASNBL_FASTFLUX_DETECTION' } = 'off' ;
233 $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' } = '5' ;
234 $proxysettings { 'ASNBL_SELECANN_DETECTION' } = 'off' ;
235 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
236 $proxysettings { 'AUTH_METHOD' } = 'none' ;
237 $proxysettings { 'AUTH_REALM' } = '' ;
238 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
239 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
240 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
241 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
242 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
243 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
244 $proxysettings { 'NCSA_USERNAME' } = '' ;
245 $proxysettings { 'NCSA_GROUP' } = '' ;
246 $proxysettings { 'NCSA_PASS' } = '' ;
247 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
248 $proxysettings { 'LDAP_BASEDN' } = '' ;
249 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
250 $proxysettings { 'LDAP_SERVER' } = '' ;
251 $proxysettings { 'LDAP_PORT' } = '389' ;
252 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
253 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
254 $proxysettings { 'LDAP_GROUP' } = '' ;
255 $proxysettings { 'NTLM_AUTH_GROUP' } = '' ;
256 $proxysettings { 'NTLM_AUTH_BASIC' } = 'off' ;
257 $proxysettings { 'NTLM_DOMAIN' } = '' ;
258 $proxysettings { 'NTLM_PDC' } = '' ;
259 $proxysettings { 'NTLM_BDC' } = '' ;
260 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
261 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
262 $proxysettings { 'RADIUS_SERVER' } = '' ;
263 $proxysettings { 'RADIUS_PORT' } = '1812' ;
264 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
265 $proxysettings { 'RADIUS_SECRET' } = '' ;
266 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
267 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
268 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
269 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
270 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
271 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
272 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
273 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
274 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
276 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
278 & Header
:: getcgihash
( \
%proxysettings );
280 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
281 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
282 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
283 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
285 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
287 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
290 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
292 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
293 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
294 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
296 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
297 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
299 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
300 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
302 if (! $errormessage ) {
303 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
304 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
306 $proxysettings { 'NCSA_USERNAME' } = '' ;
307 $proxysettings { 'NCSA_GROUP' } = '' ;
308 $proxysettings { 'NCSA_PASS' } = '' ;
309 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
312 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
314 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
315 & deluser
( $proxysettings { 'ID' });
318 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
319 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
320 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
322 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
324 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
325 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
326 @temp = split ( /:/ , $proxysettings { 'ID' });
327 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
328 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
329 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
330 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
333 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
335 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
336 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
337 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
338 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
339 $errormessage = $Lang :: tr
{ 'invalid input' };
342 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
343 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
347 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
349 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
352 if (!(& General
:: validport
( $proxysettings { 'TRANSPARENT_PORT' })))
354 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
357 if ( $proxysettings { 'PROXY_PORT' } eq $proxysettings { 'TRANSPARENT_PORT' }) {
358 $errormessage = $Lang :: tr
{ 'advproxy errmsg proxy ports equal' };
361 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
363 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
364 if (!(& General
:: validip
( $temp [ 0 ])))
366 if (!(& General
:: validdomainname
( $temp [ 0 ])))
368 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
373 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
374 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
376 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
378 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
382 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
383 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 1048576 ))
385 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
388 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ))
390 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
393 my @free = & General
:: system_output
( "/usr/bin/free" );
394 $free [ 1 ] =~ m/(\d+)/ ;
395 $cachemem = int $1 / 2048 ;
396 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
397 $proxysettings { 'CACHE_MEM' } = $cachemem ;
399 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
401 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
404 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
406 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
409 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
411 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
414 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
416 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
419 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
421 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
424 if (( $proxysettings { 'ASNBL_FASTFLUX_DETECTION' } eq 'on' ) || ( $proxysettings { 'ASNBL_SELECANN_DETECTION' } eq 'on' ))
426 if (- z
$proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' }) {
427 $errormessage = $Lang :: tr
{ 'advproxy fastflux no threshold given' };
430 if (! looks_like_number
( $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' })) {
431 $errormessage = $Lang :: tr
{ 'advproxy fastflux threshold invalid' };
434 if (( $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' } < 2 ) || ( $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' } > 10 )) {
435 $errormessage = $Lang :: tr
{ 'advproxy fastflux threshold out of bounds' };
439 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
441 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
442 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
443 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
445 if ( $netsettings { 'BLUE_DEV' })
447 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
448 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
450 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
454 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
456 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
461 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
462 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
464 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
467 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
469 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
472 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
474 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
477 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
479 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
482 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
484 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
488 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
490 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
492 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
496 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
498 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
500 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
504 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
506 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
508 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
511 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
513 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
515 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
519 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
521 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
524 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
526 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
528 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
533 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
535 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
537 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
540 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
542 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
545 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
547 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
552 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
555 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
556 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
557 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
558 if (( $proxy1 ne $proxy2 ))
560 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
568 $proxysettings { 'VALID' } = 'no' ; }
570 $proxysettings { 'VALID' } = 'yes' ; }
572 if ( $proxysettings { 'VALID' } eq 'yes' )
574 # Determine if suricata may needs to be restarted.
575 my $suricata_proxy_ports_changed ;
577 # Check if the IDS is running
578 if (& IDS
:: ids_is_running
()) {
579 my %oldproxysettings ;
581 # Read-in current proxy settings and store them as oldsettings hash.
582 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%oldproxysettings );
584 # Check if the proxy port has been changed.
585 unless ( $proxysettings { 'PROXY_PORT' } eq $oldproxysettings { 'PROXY_PORT' }) {
586 # Port has changed, suricata needs to be adjusted.
587 $suricata_proxy_ports_changed = 1 ;
590 # Check if the transparent port has been changed.
591 unless ( $proxysettings { 'TRANSPARENT_PORT' } eq $oldproxysettings { 'TRANSPARENT_PORT' }) {
592 # Transparent port has changed, suricata needs to be adjusted.
593 $suricata_proxy_ports_changed = 1 ;
599 delete $proxysettings { 'SRC_SUBNETS' };
600 delete $proxysettings { 'SRC_BANNED_IP' };
601 delete $proxysettings { 'SRC_BANNED_MAC' };
602 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
603 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
604 delete $proxysettings { 'DST_NOCACHE' };
605 delete $proxysettings { 'DST_NOAUTH' };
606 delete $proxysettings { 'DST_NOPROXY_IP' };
607 delete $proxysettings { 'DST_NOPROXY_URL' };
608 delete $proxysettings { 'PORTS_SAFE' };
609 delete $proxysettings { 'PORTS_SSL' };
610 delete $proxysettings { 'MIME_TYPES' };
611 delete $proxysettings { 'NTLM_ALLOW_USERS' };
612 delete $proxysettings { 'NTLM_DENY_USERS' };
613 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
614 delete $proxysettings { 'RADIUS_DENY_USERS' };
615 delete $proxysettings { 'IDENT_HOSTS' };
616 delete $proxysettings { 'IDENT_ALLOW_USERS' };
617 delete $proxysettings { 'IDENT_DENY_USERS' };
619 delete $proxysettings { 'CRE_GROUPS' };
620 delete $proxysettings { 'CRE_SVHOSTS' };
622 delete $proxysettings { 'NCSA_USERNAME' };
623 delete $proxysettings { 'NCSA_GROUP' };
624 delete $proxysettings { 'NCSA_PASS' };
625 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
627 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
628 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
629 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
630 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
631 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
632 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
633 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
635 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
636 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
638 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
640 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
641 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
642 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
643 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
644 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
645 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
646 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
647 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
648 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
653 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
655 & General
:: system ( '/usr/local/bin/squidctrl' , 'disable' );
656 unlink "${General::swroot}/proxy/enable" ;
657 unlink "${General::swroot}/proxy/transparent" ;
658 unlink "${General::swroot}/proxy/enable_blue" ;
659 unlink "${General::swroot}/proxy/transparent_blue" ;
661 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
662 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
663 & General
:: system ( '/usr/local/bin/squidctrl' , 'enable' ); }
664 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
665 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
666 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
667 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
668 & General
:: system ( '/usr/local/bin/squidctrl' , 'enable' ); }
669 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
670 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
672 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { & General
:: system ( '/usr/local/bin/squidctrl' , 'restart' ); }
673 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { & General
:: system ( '/usr/local/bin/squidctrl' , 'reconfigure' ); }
675 # Check if the suricata_proxy_ports_changed flag has been set.
676 if ( $suricata_proxy_ports_changed ) {
677 # Re-generate HTTP ports file.
678 & IDS
:: generate_http_ports_file
();
681 & IDS
:: call_suricatactrl
( "restart" );
686 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
688 & General
:: system ( '/usr/local/bin/squidctrl' , 'flush' );
693 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
694 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
695 } elsif (- e
"${General::swroot}/proxy/settings" ) {
696 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
701 # ------------------------------------------------------------------
703 # Hook to regenerate the configuration files, if cgi got called from command line.
704 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
709 # -------------------------------------------------------------------
711 $checked { 'ENABLE' }{ 'off' } = '' ;
712 $checked { 'ENABLE' }{ 'on' } = '' ;
713 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
715 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
716 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
717 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
719 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
720 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
721 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
723 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
724 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
725 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
727 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
728 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
729 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
730 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
731 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
732 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
733 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
734 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
735 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
736 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
737 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
738 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
740 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
741 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
742 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
743 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
744 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
745 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
746 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
747 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
748 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
750 $checked { 'LOGGING' }{ 'off' } = '' ;
751 $checked { 'LOGGING' }{ 'on' } = '' ;
752 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
753 $checked { 'CACHEMGR' }{ 'off' } = '' ;
754 $checked { 'CACHEMGR' }{ 'on' } = '' ;
755 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
756 $checked { 'LOGQUERY' }{ 'off' } = '' ;
757 $checked { 'LOGQUERY' }{ 'on' } = '' ;
758 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
759 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
760 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
761 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
763 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
764 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
766 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
767 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
768 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
769 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
770 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
771 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
773 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
774 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
775 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
777 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
778 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
779 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
780 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
781 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
783 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
784 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
785 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
786 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
787 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
788 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
789 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
791 $checked { 'TIME_MON' }{ 'off' } = '' ;
792 $checked { 'TIME_MON' }{ 'on' } = '' ;
793 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
794 $checked { 'TIME_TUE' }{ 'off' } = '' ;
795 $checked { 'TIME_TUE' }{ 'on' } = '' ;
796 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
797 $checked { 'TIME_WED' }{ 'off' } = '' ;
798 $checked { 'TIME_WED' }{ 'on' } = '' ;
799 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
800 $checked { 'TIME_THU' }{ 'off' } = '' ;
801 $checked { 'TIME_THU' }{ 'on' } = '' ;
802 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
803 $checked { 'TIME_FRI' }{ 'off' } = '' ;
804 $checked { 'TIME_FRI' }{ 'on' } = '' ;
805 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
806 $checked { 'TIME_SAT' }{ 'off' } = '' ;
807 $checked { 'TIME_SAT' }{ 'on' } = '' ;
808 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
809 $checked { 'TIME_SUN' }{ 'off' } = '' ;
810 $checked { 'TIME_SUN' }{ 'on' } = '' ;
811 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
813 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
814 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
815 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
816 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
818 $checked { 'ASNBL_FASTFLUX_DETECTION' }{ 'off' } = '' ;
819 $checked { 'ASNBL_FASTFLUX_DETECTION' }{ 'on' } = '' ;
820 $checked { 'ASNBL_FASTFLUX_DETECTION' }{ $proxysettings { 'ASNBL_FASTFLUX_DETECTION' }} = "checked='checked'" ;
822 $checked { 'ASNBL_SELECANN_DETECTION' }{ 'off' } = '' ;
823 $checked { 'ASNBL_SELECANN_DETECTION' }{ 'on' } = '' ;
824 $checked { 'ASNBL_SELECANN_DETECTION' }{ $proxysettings { 'ASNBL_SELECANN_DETECTION' }} = "checked='checked'" ;
826 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
827 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
828 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
830 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
831 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
832 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
833 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
834 $checked { 'AUTH_METHOD' }{ 'ntlm-auth' } = '' ;
835 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
836 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
838 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
840 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
841 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
842 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
844 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
845 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
846 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
848 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
850 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
852 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
854 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
855 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
856 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
858 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
859 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
860 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
862 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
863 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
864 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
866 $checked { 'NTLM_AUTH_BASIC' }{ 'on' } = '' ;
867 $checked { 'NTLM_AUTH_BASIC' }{ 'off' } = '' ;
868 $checked { 'NTLM_AUTH_BASIC' }{ $proxysettings { 'NTLM_AUTH_BASIC' }} = "checked='checked'" ;
870 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
871 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
872 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
874 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
875 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
876 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
878 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
879 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
880 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
882 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
883 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
884 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
886 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
887 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
888 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
890 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
891 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
892 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
894 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
895 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
896 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
898 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
899 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
900 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
902 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
904 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
907 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
908 print "<font class='base'> $errormessage </font> \n " ;
912 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
914 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
915 $squidversion [ 0 ] =~ s/^\s+//g ;
916 $squidversion [ 0 ] =~ s/\s+$//g ;
918 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
921 # ===================================================================
923 # ===================================================================
925 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
927 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
929 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
934 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
937 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
938 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
939 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td>
940 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
943 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
944 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
945 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td>
946 <td width='30%'><input type='text' name='TRANSPARENT_PORT' value=' $proxysettings {'TRANSPARENT_PORT'}' size='5' /></td>
951 if ( $netsettings { 'BLUE_DEV' }) {
952 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
953 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
955 print "<td colspan='2'> </td>" ;
958 <td class='base'> $Lang ::tr{'advproxy visible hostname'}:</td>
959 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
964 if ( $netsettings { 'BLUE_DEV' }) {
965 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
966 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
968 print "<td colspan='2'> </td>" ;
971 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
973 <select name='ERR_LANGUAGE'>
976 foreach (< $errordir /*>) {
978 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
979 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
989 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
990 <td class='base'><select name='ERR_DESIGN'>
991 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
992 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
1000 if ( - e
"/usr/bin/squidclamav" ) {
1001 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
1002 if ( ! - e
"/var/run/clamav/clamd.pid" ){
1003 print "<font color='red'>clamav not running</font><br /><br />" ;
1004 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
1007 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
1013 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</a></b><br />" ;
1014 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
1016 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</a></b><br />" ;
1017 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1022 <table width='100%'>
1024 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1027 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1028 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1029 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}:</td>
1030 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1033 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1034 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1035 <td class='base'> $Lang ::tr{'advproxy upstream username'}:</td>
1036 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1039 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1040 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1041 <td class='base'> $Lang ::tr{'advproxy upstream password'}:</td>
1042 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1045 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1046 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1052 <table width='100%'>
1054 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1057 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1058 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1059 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1060 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1065 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1066 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1070 <table width='100%'>
1072 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1075 <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'> $Lang ::tr{'proxy cachemgr'}:</td>
1076 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1077 <td class='base'> $Lang ::tr{'advproxy admin mail'}:</td>
1078 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1081 <td class='base'> $Lang ::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td>
1082 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1083 <td class='base'> $Lang ::tr{'proxy admin password'}:</td>
1084 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1087 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1090 <td class='base'> $Lang ::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td>
1091 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1092 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td>
1093 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1096 <td class='base'> $Lang ::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td>
1097 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1098 <td class='base'> $Lang ::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td>
1099 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1102 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1103 <td class='base'><select name='L1_DIRS'>
1104 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1105 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1106 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1107 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1108 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1110 <td colspan='2' rowspan= '5' valign='top' class='base'>
1111 <table cellspacing='0' cellpadding='0'>
1113 <!-- intentionally left empty -->
1116 <td> $Lang ::tr{'advproxy no cache sites'}:</td>
1119 <!-- intentionally left empty -->
1122 <!-- intentionally left empty -->
1125 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1129 print $proxysettings { 'DST_NOCACHE' };
1138 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1139 <td class='base'><select name='MEM_POLICY'>
1140 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1141 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1142 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1143 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1147 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1148 <td class='base'><select name='CACHE_POLICY'>
1149 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1150 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1151 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1152 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1156 <td colspan='2'> </td>
1159 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1160 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1163 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1164 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1168 <table width='100%'>
1170 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1173 <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
1176 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td>
1177 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td>
1180 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1183 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1187 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1190 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1197 <table width='100%'>
1199 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1202 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1205 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td>
1208 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1212 if (! $proxysettings { 'SRC_SUBNETS' })
1214 if (& Header
:: green_used
()) {
1215 print " $green_cidr \n " ;
1218 if (& Header
:: blue_used
()) {
1219 print " $blue_cidr \n " ;
1221 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1228 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1229 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1230 print "<td class='base'> $line :</td> \n " ;
1232 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1236 if ( $netsettings { 'BLUE_DEV' }) {
1237 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1238 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1240 print "<td class='base'> $line :</td> \n " ;
1242 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1249 <td colspan='2'> </td>
1252 <td colspan='2'> </td>
1255 <table width='100%'>
1257 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1260 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}:</td>
1261 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}:</td>
1264 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1268 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1272 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1276 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1282 <table width='100%'>
1284 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1287 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}:</td>
1288 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}:</td>
1291 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1295 print $proxysettings { 'SRC_BANNED_IP' };
1299 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1303 print $proxysettings { 'SRC_BANNED_MAC' };
1314 # -------------------------------------------------------------------
1315 # CRE GUI - optional
1316 # -------------------------------------------------------------------
1318 if (- e
$cre_enabled ) { print <<END
1319 <table width='100%'>
1322 <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>
1325 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1331 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1333 <td class='base'> $Lang ::tr{'advproxy supervisor password'}:</td>
1334 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1337 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1338 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}:</td>
1343 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1346 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1350 print $proxysettings { 'CRE_GROUPS' };
1354 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1357 print $proxysettings { 'CRE_SVHOSTS' };
1365 print "</table><hr size='1'>" ;
1369 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1370 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1371 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1376 # ===================================================================
1378 # ===================================================================
1381 <table width='100%'>
1383 <td colspan='4'><b> $Lang ::tr{'advproxy wpad title'}</b></td>
1386 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1389 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_ip'}:</td>
1390 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_url'}:</td>
1393 <td colspan='2'><textarea name='DST_NOPROXY_IP' cols='32' rows='3' wrap='off'>
1397 print $proxysettings { 'DST_NOPROXY_IP' };
1402 <td colspan='2'><textarea name='DST_NOPROXY_URL' cols='32' rows='3' wrap='off'>
1406 print $proxysettings { 'DST_NOPROXY_URL' };
1412 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_ip'}</td>
1413 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_url'}</td>
1416 <td colspan="4"> </td>
1419 <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>
1422 <td colspan="4"> </td>
1425 <td colspan="4"> $Lang ::tr{'advproxy wpad notice'}</td>
1434 # -------------------------------------------------------------------
1438 <table width='100%'>
1440 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1442 <table width='100%'>
1444 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1445 <td width='1%'> </td>
1446 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1447 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1448 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1449 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1450 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1451 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1452 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1453 <td width='1%'> </td>
1454 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1455 <td width='1%'> </td>
1456 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1461 <select name='TIME_ACCESS_MODE'>
1462 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1463 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1467 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1468 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1469 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1470 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1471 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1472 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1473 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1476 <select name='TIME_FROM_HOUR'>
1479 for ( $i = 0 ; $i <= 24 ; $i ++) {
1480 $_ = sprintf ( " %02s " , $i );
1481 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1488 <select name='TIME_FROM_MINUTE'>
1491 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1492 $_ = sprintf ( " %02s " , $i );
1493 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1500 <select name='TIME_TO_HOUR'>
1503 for ( $i = 0 ; $i <= 24 ; $i ++) {
1504 $_ = sprintf ( " %02s " , $i );
1505 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1512 <select name='TIME_TO_MINUTE'>
1515 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1516 $_ = sprintf ( " %02s " , $i );
1517 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1525 <table width='100%'>
1527 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1530 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td>
1531 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1532 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td>
1533 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1537 <table width='100%'>
1539 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1542 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1543 <td width='20%' class='base'>
1544 <select name='THROTTLING_GREEN_TOTAL'>
1548 foreach ( @throttle_limits ) {
1550 my $unit = "kbit/s" ;
1557 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $val $unit </option> \n " ;
1561 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1564 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1565 <td width='30%' class='base'>
1566 <select name='THROTTLING_GREEN_HOST'>
1570 foreach ( @throttle_limits ) {
1571 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1575 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1582 if ( $netsettings { 'BLUE_DEV' }) {
1585 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1587 <select name='THROTTLING_BLUE_TOTAL'>
1591 foreach ( @throttle_limits ) {
1592 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1596 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1599 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1601 <select name='THROTTLING_BLUE_HOST'>
1605 foreach ( @throttle_limits ) {
1606 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1610 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1621 <table width='100%'>
1623 <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>
1627 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1630 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}:</td>
1635 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1639 print $proxysettings { 'MIME_TYPES' };
1654 <table width='100%'>
1656 <td><b> $Lang ::tr{'advproxy asbased anomaly detection'}</b></td>
1659 <td class='base'> $Lang ::tr{'advproxy fastflux detection'}:</td>
1660 <td><input type='checkbox' name='ASNBL_FASTFLUX_DETECTION' $checked {'ASNBL_FASTFLUX_DETECTION'}{'on'} /></td>
1661 <td class='base'> $Lang ::tr{'advproxy fastflux detection threshold'}:</td>
1662 <td><input type='text' name='ASNBL_FASTFLUX_THRESHOLD' value=' $proxysettings {'ASNBL_FASTFLUX_THRESHOLD'}' size=2 /></td>
1665 <td class='base'> $Lang ::tr{'advproxy selectively announcements detection'}:</td>
1666 <td colspan='3'><input type='checkbox' name='ASNBL_SELECANN_DETECTION' $checked {'ASNBL_SELECANN_DETECTION'}{'on'} /></td>
1674 my $auth_columns = 5 ;
1675 if ( $HAVE_NTLM_AUTH ) {
1678 my $auth_column_width = 100 / $auth_columns ;
1681 <table width='100%'>
1683 <td colspan=' $auth_columns '><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1686 <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>
1687 <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>
1688 <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>
1689 <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>
1692 if ( $HAVE_NTLM_AUTH ) {
1694 <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>
1699 <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>
1705 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1707 <table width='100%'>
1709 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1712 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1715 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1716 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1717 <td colspan='2' rowspan= '6' valign='top' class='base'>
1718 <table cellpadding='0' cellspacing='0'>
1720 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}:</td>
1723 <!-- intentionally left empty -->
1726 <!-- intentionally left empty -->
1729 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1732 <!-- intentionally left empty -->
1735 <!-- intentionally left empty -->
1738 <td> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1741 <!-- intentionally left empty -->
1744 <!-- intentionally left empty -->
1747 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1751 print $proxysettings { 'DST_NOAUTH' };
1760 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1761 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1764 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}:</td>
1765 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1768 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1769 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1772 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1773 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1776 <td colspan='2'> </td>
1783 # ===================================================================
1784 # NCSA auth settings
1785 # ===================================================================
1787 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1790 <table width='100%'>
1792 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1795 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1796 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1797 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1798 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1801 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1809 # ===================================================================
1810 # IDENTD auth settings
1811 # ===================================================================
1813 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1816 <table width='100%'>
1818 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1821 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1822 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1823 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1824 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1827 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1828 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1833 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1834 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1837 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1840 if (! $proxysettings { 'IDENT_HOSTS' }) {
1841 if (& Header
:: green_used
()) {
1842 print " $green_cidr \n " ;
1845 if (& Header
:: blue_used
()) {
1846 print " $blue_cidr \n " ;
1849 print $proxysettings { 'IDENT_HOSTS' };
1854 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1858 print $proxysettings { 'DST_NOAUTH' };
1865 <table width='100%'>
1867 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1870 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1871 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1872 <td width='25%'> </td>
1873 <td width='30%'> </td>
1876 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1877 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1878 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1879 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1882 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1883 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1886 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1890 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1892 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1894 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1898 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1900 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1907 # ===================================================================
1908 # NTLM-AUTH settings
1909 # ===================================================================
1911 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' ) {
1914 <table width='100%'>
1915 <td width='20%' class='base'> $Lang ::tr{'advproxy basic authentication'}:</td>
1916 <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked {'NTLM_AUTH_BASIC'}{'on'} /></td>
1917 <td colspan='2'> </td>
1922 <table width='100%'>
1924 <td colspan='4'><b> $Lang ::tr{'advproxy group access control'}</b></td>
1927 <td width='20%' class='base'> $Lang ::tr{'advproxy group required'}:</td>
1928 <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value=' $proxysettings {'NTLM_AUTH_GROUP'}' size='37' /></td>
1936 # ===================================================================
1937 # LDAP auth settings
1938 # ===================================================================
1940 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1943 <table width='100%'>
1945 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1948 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1949 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1950 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1951 <td class='base'><select name='LDAP_TYPE'>
1952 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1953 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1954 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1955 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1959 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1960 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1961 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1962 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1966 <table width='100%'>
1968 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1971 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1972 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1973 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1974 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1978 <table width='100%'>
1980 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1983 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}:</td>
1984 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1992 # ===================================================================
1993 # RADIUS auth settings
1994 # ===================================================================
1996 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
1999 <table width='100%'>
2001 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
2004 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
2005 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
2006 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
2007 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
2010 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}:</td>
2011 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
2012 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
2013 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
2017 <table width='100%'>
2019 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
2022 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
2023 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
2024 <td width='25%'> </td>
2025 <td width='30%'> </td>
2028 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
2029 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
2030 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
2031 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
2034 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
2035 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2038 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2042 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2044 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2046 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2050 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2052 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2059 # ===================================================================
2065 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2067 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2068 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2069 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2070 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2071 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2072 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2073 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2077 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2079 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2080 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2081 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2082 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2083 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2087 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2089 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2090 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2094 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2096 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2097 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2098 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2099 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2100 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2101 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2102 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2106 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2108 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2109 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2110 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2111 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2112 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2113 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2114 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2118 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2120 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2121 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2122 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2123 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2124 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2125 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2126 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2127 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2139 <table width='100%'>
2142 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2143 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2144 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2145 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2151 <table width='100%'>
2153 <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'> $Lang ::tr{'required field'}</font></td>
2154 <td align='right'> </td>
2161 & Header
:: closebox
();
2165 # ===================================================================
2166 # NCSA user management
2167 # ===================================================================
2169 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2171 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2172 <table width='100%'>
2174 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2177 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2178 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2181 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly='readonly' " ; }
2184 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2186 <select name='NCSA_GROUP'>
2187 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2188 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2189 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2195 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2196 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2197 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2198 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2205 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2206 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2207 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2210 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2211 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2217 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2222 <table width='100%'>
2224 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2227 <table width='100%' align='center'>
2233 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2234 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2238 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2239 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2243 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2244 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2247 @userlist = sort ( @userlist );
2249 # If the password file contains entries, print entries and action icons
2251 if ( ! - z
" $userdb " ) {
2254 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2255 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2256 <td class='boldbase' colspan='2' align='center'> </td>
2261 foreach $line ( @userlist )
2265 @temp = split ( /:/ , $line );
2266 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2267 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2269 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2271 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2274 <td align='center'> $temp [0]</td>
2278 if ( $temp [ 1 ] eq 'standard' ) {
2279 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2280 } elsif ( $temp [ 1 ] eq 'extended' ) {
2281 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2282 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2283 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2286 <td width='8%' align='center'>
2287 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2288 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2289 <input type='hidden' name='ID' value=' $line ' />
2290 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2294 <td width='8%' align='center'>
2295 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2296 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2297 <input type='hidden' name='ID' value=' $temp [0]' />
2298 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2311 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2312 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2313 <td class='base'> $Lang ::tr{'edit'}</td>
2314 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2315 <td class='base'> $Lang ::tr{'remove'}</td>
2322 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2333 & Header
:: closebox
();
2337 # ===================================================================
2339 & Header
:: closebigbox
();
2341 & Header
:: closepage
();
2343 # -------------------------------------------------------------------
2347 if (- e
" $acl_src_subnets " ) {
2348 open ( FILE
, " $acl_src_subnets " );
2349 delete $proxysettings { 'SRC_SUBNETS' };
2350 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2353 if (- e
" $acl_src_banned_ip " ) {
2354 open ( FILE
, " $acl_src_banned_ip " );
2355 delete $proxysettings { 'SRC_BANNED_IP' };
2356 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2359 if (- e
" $acl_src_banned_mac " ) {
2360 open ( FILE
, " $acl_src_banned_mac " );
2361 delete $proxysettings { 'SRC_BANNED_MAC' };
2362 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2365 if (- e
" $acl_src_unrestricted_ip " ) {
2366 open ( FILE
, " $acl_src_unrestricted_ip " );
2367 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2368 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2371 if (- e
" $acl_src_unrestricted_mac " ) {
2372 open ( FILE
, " $acl_src_unrestricted_mac " );
2373 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2374 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2377 if (- e
" $acl_dst_nocache " ) {
2378 open ( FILE
, " $acl_dst_nocache " );
2379 delete $proxysettings { 'DST_NOCACHE' };
2380 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2383 if (- e
" $acl_dst_noauth " ) {
2384 open ( FILE
, " $acl_dst_noauth " );
2385 delete $proxysettings { 'DST_NOAUTH' };
2386 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2389 if (- e
" $acl_dst_noproxy_ip " ) {
2390 open ( FILE
, " $acl_dst_noproxy_ip " );
2391 delete $proxysettings { 'DST_NOPROXY_IP' };
2392 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_IP' } .= $_ };
2395 if (- e
" $acl_dst_noproxy_url " ) {
2396 open ( FILE
, " $acl_dst_noproxy_url " );
2397 delete $proxysettings { 'DST_NOPROXY_URL' };
2398 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_URL' } .= $_ };
2401 if (- e
" $acl_ports_safe " ) {
2402 open ( FILE
, " $acl_ports_safe " );
2403 delete $proxysettings { 'PORTS_SAFE' };
2404 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2407 if (- e
" $acl_ports_ssl " ) {
2408 open ( FILE
, " $acl_ports_ssl " );
2409 delete $proxysettings { 'PORTS_SSL' };
2410 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2413 if (- e
" $mimetypes " ) {
2414 open ( FILE
, " $mimetypes " );
2415 delete $proxysettings { 'MIME_TYPES' };
2416 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2419 if (- e
" $raddir /radauth.allowusers" ) {
2420 open ( FILE
, " $raddir /radauth.allowusers" );
2421 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2422 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2425 if (- e
" $raddir /radauth.denyusers" ) {
2426 open ( FILE
, " $raddir /radauth.denyusers" );
2427 delete $proxysettings { 'RADIUS_DENY_USERS' };
2428 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2431 if (- e
" $identdir /identauth.allowusers" ) {
2432 open ( FILE
, " $identdir /identauth.allowusers" );
2433 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2434 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2437 if (- e
" $identdir /identauth.denyusers" ) {
2438 open ( FILE
, " $identdir /identauth.denyusers" );
2439 delete $proxysettings { 'IDENT_DENY_USERS' };
2440 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2443 if (- e
" $identhosts " ) {
2444 open ( FILE
, " $identhosts " );
2445 delete $proxysettings { 'IDENT_HOSTS' };
2446 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2449 if (- e
" $cre_groups " ) {
2450 open ( FILE
, " $cre_groups " );
2451 delete $proxysettings { 'CRE_GROUPS' };
2452 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2455 if (- e
" $cre_svhosts " ) {
2456 open ( FILE
, " $cre_svhosts " );
2457 delete $proxysettings { 'CRE_SVHOSTS' };
2458 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2463 # -------------------------------------------------------------------
2467 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2468 undef $proxysettings { 'PORTS_SAFE' };
2471 s/^\s+//g ; s/\s+$//g ;
2475 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2477 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2478 @templist = split ( /-/ );
2479 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2480 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2484 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2485 undef $proxysettings { 'PORTS_SSL' };
2488 s/^\s+//g ; s/\s+$//g ;
2493 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2494 @templist = split ( /-/ );
2495 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2496 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2500 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2501 undef $proxysettings { 'DST_NOCACHE' };
2505 unless ( /^#/ ) { s/\s+//g ; }
2508 if ( /^\./ ) { $_ = '*' . $_ ; }
2509 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2513 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2514 undef $proxysettings { 'SRC_SUBNETS' };
2517 s/^\s+//g ; s/\s+$//g ;
2520 unless (& Network
:: check_subnet
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' } . ": $_ " ; }
2521 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2525 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2526 undef $proxysettings { 'SRC_BANNED_IP' };
2529 s/^\s+//g ; s/\s+$//g ;
2532 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2533 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2537 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2538 undef $proxysettings { 'SRC_BANNED_MAC' };
2541 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2544 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2545 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2549 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2550 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2553 s/^\s+//g ; s/\s+$//g ;
2556 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2557 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2561 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2562 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2565 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2568 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2569 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2573 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2574 undef $proxysettings { 'DST_NOAUTH' };
2578 unless ( /^#/ ) { s/\s+//g ; }
2581 if ( /^\./ ) { $_ = '*' . $_ ; }
2582 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2586 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_IP' });
2587 undef $proxysettings { 'DST_NOPROXY_IP' };
2590 s/^\s+//g ; s/\s+$//g ;
2593 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg wpad invalid ip or mask' }; }
2594 $proxysettings { 'DST_NOPROXY_IP' } .= $_ . " \n " ;
2598 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_URL' });
2599 undef $proxysettings { 'DST_NOPROXY_URL' };
2603 unless ( /^#/ ) { s/\s+//g ; }
2606 if ( /^\./ ) { $_ = '*' . $_ ; }
2607 $proxysettings { 'DST_NOPROXY_URL' } .= $_ . " \n " ;
2611 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2613 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2614 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2617 s/^\s+//g ; s/\s+$//g ;
2618 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2620 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2623 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2625 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2626 undef $proxysettings { 'NTLM_DENY_USERS' };
2629 s/^\s+//g ; s/\s+$//g ;
2630 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2632 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2635 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2637 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2638 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2641 s/^\s+//g ; s/\s+$//g ;
2642 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2644 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2647 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2649 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2650 undef $proxysettings { 'IDENT_DENY_USERS' };
2653 s/^\s+//g ; s/\s+$//g ;
2654 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2656 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2659 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2661 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2662 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2665 s/^\s+//g ; s/\s+$//g ;
2666 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2668 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2671 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2673 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2674 undef $proxysettings { 'RADIUS_DENY_USERS' };
2677 s/^\s+//g ; s/\s+$//g ;
2678 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2680 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2683 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2684 undef $proxysettings { 'IDENT_HOSTS' };
2687 s/^\s+//g ; s/\s+$//g ;
2690 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2691 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2695 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2696 undef $proxysettings { 'CRE_SVHOSTS' };
2699 s/^\s+//g ; s/\s+$//g ;
2702 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2703 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2708 # -------------------------------------------------------------------
2712 open ( FILE
, "> $acl_src_subnets " );
2714 if (! $proxysettings { 'SRC_SUBNETS' })
2716 if (& Header
:: green_used
()) {
2717 print FILE
" $green_cidr \n " ;
2720 if (& Header
:: blue_used
()) {
2721 print FILE
" $blue_cidr \n " ;
2723 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2726 open ( FILE
, "> $acl_src_banned_ip " );
2728 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2731 open ( FILE
, "> $acl_src_banned_mac " );
2733 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2736 open ( FILE
, "> $acl_src_unrestricted_ip " );
2738 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2741 open ( FILE
, "> $acl_src_unrestricted_mac " );
2743 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2746 open ( FILE
, "> $acl_dst_noauth " );
2748 print FILE
$proxysettings { 'DST_NOAUTH' };
2751 open ( FILE
, "> $acl_dst_noproxy_ip " );
2753 print FILE
$proxysettings { 'DST_NOPROXY_IP' };
2756 open ( FILE
, "> $acl_dst_noproxy_url " );
2758 print FILE
$proxysettings { 'DST_NOPROXY_URL' };
2761 open ( FILE
, "> $acl_dst_noauth_net " );
2763 open ( FILE
, "> $acl_dst_noauth_dom " );
2765 open ( FILE
, "> $acl_dst_noauth_url " );
2768 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2776 open ( FILE
, ">> $acl_dst_noauth_dom " );
2781 elsif (& General
:: validipormask
( $_ ))
2783 open ( FILE
, ">> $acl_dst_noauth_net " );
2788 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?/ )
2790 open ( FILE
, ">> $acl_dst_noauth_net " );
2797 open ( FILE
, ">> $acl_dst_noauth_url " );
2799 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2805 open ( FILE
, "> $acl_dst_nocache " );
2807 print FILE
$proxysettings { 'DST_NOCACHE' };
2810 open ( FILE
, "> $acl_dst_nocache_net " );
2812 open ( FILE
, "> $acl_dst_nocache_dom " );
2814 open ( FILE
, "> $acl_dst_nocache_url " );
2817 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2825 open ( FILE
, ">> $acl_dst_nocache_dom " );
2830 elsif (& General
:: validipormask
( $_ ))
2832 open ( FILE
, ">> $acl_dst_nocache_net " );
2837 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?/ )
2839 open ( FILE
, ">> $acl_dst_nocache_net " );
2846 open ( FILE
, ">> $acl_dst_nocache_url " );
2848 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2854 open ( FILE
, "> $acl_ports_safe " );
2856 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2859 open ( FILE
, "> $acl_ports_ssl " );
2861 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2864 if (- s
$throttled_urls )
2866 open ( URLFILE
, $throttled_urls );
2869 foreach ( @temp ) { print FILE
; }
2873 open ( FILE
, "> $mimetypes " );
2875 print FILE
$proxysettings { 'MIME_TYPES' };
2878 open ( FILE
, "> $raddir /radauth.allowusers" );
2880 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2883 open ( FILE
, "> $raddir /radauth.denyusers" );
2885 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2888 open ( FILE
, "> $identdir /identauth.allowusers" );
2890 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2893 open ( FILE
, "> $identdir /identauth.denyusers" );
2895 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2898 open ( FILE
, "> $identhosts " );
2900 print FILE
$proxysettings { 'IDENT_HOSTS' };
2903 open ( FILE
, "> $cre_groups " );
2905 print FILE
$proxysettings { 'CRE_GROUPS' };
2908 open ( FILE
, "> $cre_svhosts " );
2910 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2914 # -------------------------------------------------------------------
2920 & General
:: readhasharray
( "${General::swroot}/vpn/config" , \
%vpnconfig );
2921 & General
:: readhasharray
( "${General::swroot}/ovpn/ovpnconfig" , \
%ovpnconfig );
2922 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2924 print FILE
"function FindProxyForURL(url, host) \n " ;
2926 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2930 (isPlainHostName(host)) ||
2931 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2935 if ( $netsettings { 'GREEN_DEV' }) {
2936 print FILE
" (isInNet(host, \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" )) || \n " ;
2939 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
2940 print FILE
" (isInNet(host, \" $netsettings {'BLUE_NETADDRESS'} \" , \" $netsettings {'BLUE_NETMASK'} \" )) || \n " ;
2943 if (& Header
:: orange_used
() && $netsettings { 'ORANGE_DEV' }) {
2944 print FILE
" (isInNet(host, \" $netsettings {'ORANGE_NETADDRESS'} \" , \" $netsettings {'ORANGE_NETMASK'} \" )) || \n " ;
2947 # Additional exceptions for URLs
2948 # The file has to be created by the user and should contain one entry per line
2949 # Line-Format: <URL incl. wildcards>
2950 # e.g. *.ipfire.org*
2951 if (- s
" $acl_dst_noproxy_url " ) {
2954 open ( NOPROXY
, " $acl_dst_noproxy_url " );
2955 @templist = < NOPROXY
>;
2961 print FILE
" (shExpMatch(url, \" $_ \" )) || \n " ;
2965 # Additional exceptions for Subnets
2966 # The file has to be created by the user and should contain one entry per line
2967 # Line-Format: <IP>/<SUBNET MASK>
2968 # e.g. 192.168.0.0/255.255.255.0
2969 if (- s
" $acl_dst_noproxy_ip " ) {
2972 open ( NOPROXY
, " $acl_dst_noproxy_ip " );
2973 @templist = < NOPROXY
>;
2979 @temp = split ( /\/ /);
2980 print FILE
" (isInNet(host, \" $temp [0] \" , \" $temp [1] \" )) || \n " ;
2984 foreach my $key ( sort { uc ( $vpnconfig { $a }[ 1 ]) cmp uc ( $vpnconfig { $b }[ 1 ]) } keys %vpnconfig ) {
2985 if ( $vpnconfig { $key }[ 0 ] eq 'on' && $vpnconfig { $key }[ 3 ] ne 'host' ) {
2986 my @networks = split ( /\|/ , $vpnconfig { $key }[ 11 ]);
2987 foreach my $network ( @networks ) {
2988 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
2989 $vpnsub = & Network
:: convert_prefix2netmask
( $vpnsub ) || $vpnsub ;
2990 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
2995 foreach my $key ( sort { uc ( $ovpnconfig { $a }[ 1 ]) cmp uc ( $ovpnconfig { $b }[ 1 ]) } keys %ovpnconfig ) {
2996 if ( $ovpnconfig { $key }[ 0 ] eq 'on' && $ovpnconfig { $key }[ 3 ] ne 'host' ) {
2997 my @networks = split ( /\|/ , $ovpnconfig { $key }[ 11 ]);
2998 foreach my $network ( @networks ) {
2999 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
3000 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
3006 (isInNet(host, "169.254.0.0", "255.255.0.0"))
3014 if ( $proxysettings { 'ENABLE' } eq 'on' )
3016 print FILE
"if ( \n " ;
3017 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
3020 if (- e
" $acl_src_subnets " ) {
3021 open ( SUBNETS
, " $acl_src_subnets " );
3022 @templist = < SUBNETS
>;
3028 @temp = split ( /\/ /);
3030 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
3031 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
3035 my $tempmask = & Network
:: convert_prefix2netmask
( $temp [ 1 ]);
3036 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $tempmask \" ))" ;
3044 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3048 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
3050 print FILE
" \n else \n\n " ;
3052 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
3056 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
3058 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3067 # -------------------------------------------------------------------
3074 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3075 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3076 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3077 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3079 $delaypools = 1 ; } else { $delaypools = 0 ;
3082 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3084 $authrealm = "IPFire Advanced Proxy Server" ;
3086 $authrealm = $proxysettings { 'AUTH_REALM' };
3089 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3090 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3092 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3094 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3097 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3098 # you make will be overwritten whenever you resave proxy settings using the
3101 # Instead, modify the file ' $acl_include ' and
3102 # then restart the proxy service using the web interface. Changes made to the
3103 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3105 shutdown_lifetime 5 seconds
3107 httpd_suppress_version_string on
3112 # Include file with user defined settings.
3113 if (- e
"/etc/squid/squid.conf.pre.local" ) {
3114 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
3117 if (& Header
:: green_used
()) {
3118 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3120 print FILE
"http_port 0.0.0.0: $proxysettings {'PROXY_PORT'}" ;
3122 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3125 if (& Header
:: green_used
() && $proxysettings { 'TRANSPARENT' } eq 'on' ) {
3126 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3127 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3131 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3132 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3133 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3136 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) {
3137 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3138 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3143 if (( $proxysettings { 'CACHE_SIZE' } > 0 ) || ( $proxysettings { 'CACHE_MEM' } > 0 ))
3147 if (!- z
$acl_dst_nocache_dom ) {
3148 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3149 print FILE
"cache deny no_cache_domains \n " ;
3151 if (!- z
$acl_dst_nocache_net ) {
3152 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3153 print FILE
"cache deny no_cache_ipaddr \n " ;
3155 if (!- z
$acl_dst_nocache_url ) {
3156 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3157 print FILE
"cache deny no_cache_hosts \n " ;
3163 cache_effective_user squid
3166 pid_filename /var/run/squid.pid
3168 cache_mem $proxysettings {'CACHE_MEM'} MB
3171 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3173 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3174 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
3176 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3178 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3180 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3182 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3184 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3189 open ( PORTS
, " $acl_ports_ssl " );
3190 my @ssl_ports = < PORTS
>;
3194 foreach ( @ssl_ports ) {
3195 print FILE
"acl SSL_ports port $_ " ;
3199 open ( PORTS
, " $acl_ports_safe " );
3200 my @safe_ports = < PORTS
>;
3204 foreach ( @safe_ports ) {
3205 print FILE
"acl Safe_ports port $_ " ;
3210 acl IPFire_ips dst 127.0.0.1
3211 acl IPFire_http port $http_port
3212 acl IPFire_https port $https_port
3213 acl IPFire_networks src " $acl_src_subnets "
3214 acl IPFire_servers dst " $acl_src_subnets "
3216 if (& Header
:: green_used
()) {
3218 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3219 acl IPFire_green_network src $green_cidr
3220 acl IPFire_green_servers dst $green_cidr
3223 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3224 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3225 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3226 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3227 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3228 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3230 acl CONNECT method CONNECT
3234 if ( $proxysettings { 'CACHE_SIZE' } > 0 ) {
3236 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3237 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3239 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
3243 if ( $proxysettings { 'CACHE_MEM' } > 0 ) {
3244 # always 2% of CACHE_MEM defined as max object size
3245 print FILE
"maximum_object_size_in_memory " . int ( $proxysettings { 'CACHE_MEM' } * 1024 * 0.02 ) . " KB \n\n " ;
3247 print FILE
"cache deny all \n\n " ;
3252 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3256 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3257 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3258 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3259 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3261 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3265 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3267 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3270 if ( $proxysettings { 'LOGGING' } eq 'on' )
3273 access_log stdio:/var/log/squid/access.log
3274 cache_log /var/log/squid/cache.log
3275 cache_store_log none
3278 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"access_log stdio:\/var\/log\/squid\/user_agent.log useragent \n " ; }
3279 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3282 access_log /dev/null
3284 cache_store_log none
3293 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3295 print FILE
"forwarded_for on \n " ;
3297 print FILE
"forwarded_for off \n " ;
3299 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3301 print FILE
"via on \n " ;
3303 print FILE
"via off \n " ;
3307 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3309 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3311 print FILE
"auth_param basic program $authdir /basic_ncsa_auth $userdb \n " ;
3312 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3313 print FILE
"auth_param basic realm $authrealm \n " ;
3314 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3315 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3318 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3320 print FILE
"auth_param basic utf8 on \n " ;
3321 print FILE
"auth_param basic program $authdir /basic_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3322 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3323 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3324 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3326 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3328 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3330 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3332 print FILE
" -u sAMAccountName -P" ;
3334 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3336 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3338 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3340 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3342 print FILE
" -u cn -P" ;
3344 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3346 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3348 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3350 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3352 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3353 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3354 print FILE
" -u uid -P" ;
3356 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3357 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3358 print FILE
"auth_param basic realm $authrealm \n " ;
3359 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3360 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3363 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' )
3365 print FILE
"auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" ;
3366 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3367 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3368 $ntlm_auth_group =~ s/\\/\+/ ;
3370 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3374 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n\n " ;
3375 print FILE
"auth_param ntlm credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3377 # BASIC authentication
3378 if ( $proxysettings { 'NTLM_AUTH_BASIC' } eq "on" ) {
3379 print FILE
"auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic" ;
3380 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3381 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3382 $ntlm_auth_group =~ s/\\/\+/ ;
3384 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3387 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3388 print FILE
"auth_param basic realm $authrealm \n " ;
3389 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3393 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3395 print FILE
"auth_param basic program $authdir /basic_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3396 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3397 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3398 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3399 print FILE
"auth_param basic realm $authrealm \n " ;
3400 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3401 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3405 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3406 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3408 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3410 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3412 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3414 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3417 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3420 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3421 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3423 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3426 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3427 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3428 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3433 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3435 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3437 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3439 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3441 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3443 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3445 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3447 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3450 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3451 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3452 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3456 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3458 print FILE
"acl within_timeframe time " ;
3459 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3460 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3461 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3462 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3463 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3464 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3465 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3466 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3467 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3468 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3469 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3471 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3472 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3475 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3478 #Classroom extensions
3479 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3480 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3483 print FILE
"deny_info " ;
3484 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3486 print FILE
"ERR_ACCESS_DISABLED" ;
3488 print FILE
"ERR_ACCESS_DENIED" ;
3490 print FILE
" IPFire_no_access_ips \n " ;
3491 print FILE
"deny_info " ;
3492 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3494 print FILE
"ERR_ACCESS_DISABLED" ;
3496 print FILE
"ERR_ACCESS_DENIED" ;
3498 print FILE
" IPFire_no_access_mac \n " ;
3501 http_access deny IPFire_no_access_ips
3502 http_access deny IPFire_no_access_mac
3507 #Insert acl file and replace __VAR__ with correct values
3508 my $blue_net = '' ; #BLUE empty by default
3510 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3511 $blue_net = " $blue_cidr " ;
3512 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3514 if (!- z
$acl_include )
3516 open ( ACL
, " $acl_include " );
3517 print FILE
" \n #Start of custom includes \n\n " ;
3519 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3520 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3521 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3522 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3523 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3526 print FILE
" \n #End of custom includes \n " ;
3529 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3531 # Check if squidclamav is enabled.
3532 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3533 print FILE
" \n #Settings for squidclamav: \n " ;
3534 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} \n " ;
3535 print FILE
"acl purge method PURGE \n " ;
3536 print FILE
"http_access deny to_localhost \n " ;
3537 print FILE
"http_access allow localhost \n " ;
3538 print FILE
"http_access allow purge localhost \n " ;
3539 print FILE
"http_access deny purge \n " ;
3540 print FILE
"url_rewrite_access deny localhost \n " ;
3545 #local machine, no restriction
3546 http_access allow localhost
3548 #GUI admin if local machine connects
3549 http_access allow IPFire_ips IPFire_networks IPFire_http
3550 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3552 #Deny not web services
3556 print FILE
"http_access deny !Safe_ports \n " ;
3560 print FILE
"http_access deny CONNECT !SSL_ports \n " ;
3563 if ((( $proxysettings { 'ASNBL_FASTFLUX_DETECTION' } eq 'on' ) && (!- z
$proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' })) || ( $proxysettings { 'ASNBL_SELECANN_DETECTION' } eq 'on' )) {
3564 print FILE
"external_acl_type asnblhelper children-max=10 children-startup=2 ttl=86400 %DST /usr/bin/asnbl-helper.py ${General::swroot}/proxy/asnbl-helper.conf \n " ;
3565 print FILE
"acl asnbl external asnblhelper \n " ;
3567 # Use the user-defined URL filter whitelist (if present and populated) for the ASNBL helper as well
3568 # Necessary for destinations such as fedoraproject.org, but we do not want to maintain a dedicated
3569 # or hardcoded list for such FQDNs.
3570 if ((- e
"${General::swroot}/urlfilter/blacklists/custom/allowed/domains" ) && (!- z
"${General::swroot}/urlfilter/blacklists/custom/allowed/domains" )) {
3571 print FILE
"acl asnbl_whitelisted_destinations dstdomain \" ${General::swroot}/urlfilter/blacklists/custom/allowed/domains \"\n " ;
3572 print FILE
"http_access deny asnbl !asnbl_whitelisted_destinations \n\n " ;
3574 print FILE
"http_access deny asnbl \n\n " ;
3577 # Write ASNBL helper configuration file...
3578 open ( ASNBLFILE
, ">${General::swroot}/proxy/asnbl-helper.conf" );
3579 flock ( ASNBLFILE
, 2 );
3581 print ASNBLFILE
<<END
3583 # This file has been automatically generated. Manual changes will be overwritten.
3588 ASNDB_PATH = /var/lib/location/database.db
3593 print ASNBLFILE
"AS_DIVERSITY_THRESHOLD = $proxysettings {'ASNBL_FASTFLUX_THRESHOLD'} \n " ;
3595 if ( $proxysettings { 'ASNBL_SELECANN_DETECTION' } eq 'on' ) {
3596 print ASNBLFILE
"BLOCK_SUSPECTED_SELECTIVE_ANNOUNCEMENTS = yes \n " ;
3598 print ASNBLFILE
"BLOCK_SUSPECTED_SELECTIVE_ANNOUNCEMENTS = no \n " ;
3601 if ( $proxysettings { 'ASNBL_FASTFLUX_DETECTION' } eq 'on' ) {
3602 print ASNBLFILE
"BLOCK_DIVERSITY_EXCEEDING_DESTINATIONS = yes \n " ;
3604 print ASNBLFILE
"BLOCK_DIVERSITY_EXCEEDING_DESTINATIONS = no \n " ;
3607 print ASNBLFILE
<<END
3608 TESTDATA = (10.0.0.1, 0) (127.0.0.1, 0) (fe80::1, 0)
3616 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3618 print FILE
"#Set ident ACLs \n " ;
3619 if (!- z
$identhosts )
3621 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3622 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3623 print FILE
"ident_lookup_access deny all \n " ;
3625 print FILE
"ident_lookup_access allow all \n " ;
3627 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3631 print FILE
"#Set download throttling \n " ;
3633 if ( $netsettings { 'BLUE_DEV' })
3635 print FILE
"delay_pools 2 \n " ;
3637 print FILE
"delay_pools 1 \n " ;
3640 print FILE
"delay_class 1 3 \n " ;
3641 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3643 print FILE
"delay_parameters 1 " ;
3644 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3648 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3650 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3653 print FILE
" -1/-1 " ;
3654 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3658 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3660 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3664 if ( $netsettings { 'BLUE_DEV' })
3666 print FILE
"delay_parameters 2 " ;
3667 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3671 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3673 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3675 print FILE
" -1/-1 " ;
3676 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3680 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3682 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3687 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3688 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3689 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3690 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3692 if ( $netsettings { 'BLUE_DEV' })
3694 if (& Header
:: green_used
()) {
3695 print FILE
"delay_access 1 allow IPFire_green_network" ;
3696 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3699 print FILE
"delay_access 1 deny all \n " ;
3701 print FILE
"delay_access 1 allow all" ;
3702 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3706 if ( $netsettings { 'BLUE_DEV' })
3708 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3709 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3710 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3711 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3712 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3713 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3715 print FILE
"delay_access 2 deny all \n " ;
3718 print FILE
"delay_initial_bucket_level 100 \n " ;
3722 if (& Header
:: green_used
() && $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3724 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3725 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3728 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3730 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3731 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3732 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3736 #Set custom configured ACLs
3739 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3740 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3742 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3744 if (!- z
$acl_src_unrestricted_ip )
3746 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3747 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3748 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3750 if (!- z
$acl_src_unrestricted_mac )
3752 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3753 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3754 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3756 if (!- z
$acl_dst_noauth_net )
3758 print FILE
"http_access allow IPFire_networks" ;
3759 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3760 print FILE
" !within_timeframe" ;
3762 print FILE
" within_timeframe" ; }
3763 print FILE
" to_ipaddr_without_auth \n " ;
3765 if (!- z
$acl_dst_noauth_dom )
3767 print FILE
"http_access allow IPFire_networks" ;
3768 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3769 print FILE
" !within_timeframe" ;
3771 print FILE
" within_timeframe" ; }
3772 print FILE
" to_domains_without_auth \n " ;
3774 if (!- z
$acl_dst_noauth_url )
3776 print FILE
"http_access allow IPFire_networks" ;
3777 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3778 print FILE
" !within_timeframe" ;
3780 print FILE
" within_timeframe" ; }
3781 print FILE
" to_hosts_without_auth \n " ;
3785 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3787 print FILE
"http_access deny !for_inetusers" ;
3788 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3793 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3794 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3795 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3796 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3797 (!- z
" $identdir /identauth.denyusers" )
3800 print FILE
"http_access deny for_acl_users" ;
3801 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3805 if (!- z
$acl_src_unrestricted_ip )
3807 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3808 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3810 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3812 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3814 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3816 print FILE
" for_inetusers" ;
3818 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3820 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3822 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3824 print FILE
" for_acl_users" ;
3826 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3828 print FILE
" !for_acl_users" ;
3830 } else { print FILE
" for_inetusers" ; }
3836 if (!- z
$acl_src_unrestricted_mac )
3838 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3839 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3841 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3843 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3845 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3847 print FILE
" for_inetusers" ;
3849 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3851 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3853 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3855 print FILE
" for_acl_users" ;
3857 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3859 print FILE
" !for_acl_users" ;
3861 } else { print FILE
" for_inetusers" ; }
3867 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3869 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3870 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3875 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3876 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3877 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3878 (!- z
" $raddir /radauth.denyusers" )
3882 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3883 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3884 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3885 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3886 (!- z
" $identdir /identauth.denyusers" )
3890 print FILE
"http_access deny for_acl_users" ;
3891 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3895 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3897 print FILE
"http_access allow" ;
3898 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3899 print FILE
" !within_timeframe" ;
3901 print FILE
" within_timeframe" ; }
3902 print FILE
" !on_ident_aware_hosts \n " ;
3905 print FILE
"http_access allow IPFire_networks" ;
3908 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3909 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3910 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3911 (!- z
" $raddir /radauth.allowusers" )
3915 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3916 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3917 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3918 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3919 (!- z
" $identdir /identauth.allowusers" )
3923 print FILE
" for_acl_users" ;
3924 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3925 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3926 print FILE
" for_inetusers" ;
3928 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3930 print FILE
" !concurrent" ;
3932 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3933 print FILE
" !within_timeframe" ;
3935 print FILE
" within_timeframe" ; }
3938 print FILE
"http_access deny all \n\n " ;
3940 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ))
3942 print FILE
"#Strip HTTP Header \n " ;
3944 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3946 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3947 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3949 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3951 print FILE
"request_header_access Via deny all \n " ;
3952 print FILE
"reply_header_access Via deny all \n " ;
3959 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3960 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3961 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3962 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3964 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3966 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3967 print FILE
"http_reply_access allow all \n\n " ;
3970 print FILE
"visible_hostname" ;
3971 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3973 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3975 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3978 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3979 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3982 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3984 # Write the parent proxy info, if needed.
3985 if ( $remotehost ne '' )
3987 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3989 # Enter authentication for the parent cache. Option format is
3990 # login=user:password ($proxy1='YES')
3991 # login=PASS ($proxy1='PASS')
3992 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3993 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3995 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3996 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3998 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
4000 print FILE
" \n always_direct allow IPFire_ips \n " ;
4001 print FILE
"never_direct allow all \n\n " ;
4003 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
4005 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
4006 print FILE
"url_rewrite_children " , & General
:: number_cpu_cores
();
4007 print FILE
" startup=" , & General
:: number_cpu_cores
();
4008 print FILE
" idle=" , & General
:: number_cpu_cores
();
4009 print FILE
" queue-size=" , & General
:: number_cpu_cores
() * 32 , " \n\n " ;
4012 # Include file with user defined settings.
4013 if (- e
"/etc/squid/squid.conf.local" ) {
4014 print FILE
"include /etc/squid/squid.conf.local \n " ;
4018 # Proxy settings for squidclamav - if installed.
4020 # Check if squidclamav is enabled.
4021 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
4023 my $configfile = '/etc/squidclamav.conf' ;
4025 my $data = & General
:: read_file_utf8
( $configfile );
4026 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
4027 & General
:: write_file_utf8
( $configfile , $data );
4031 # -------------------------------------------------------------------
4035 my ( $str_user , $str_pass , $str_group ) = @_ ;
4036 my @groupmembers =();
4038 if ( $str_pass eq 'lEaVeAlOnE' )
4040 open ( FILE
, " $userdb " );
4041 @groupmembers = < FILE
>;
4043 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
4044 & deluser
( $str_user );
4045 open ( FILE
, ">> $userdb " );
4047 print FILE
" $str_user $str_pass " ;
4050 & deluser
( $str_user );
4052 my %htpasswd_options = (
4053 passwdFile
=> " $userdb " ,
4057 my $htpasswd = new Apache
:: Htpasswd
( \
%htpasswd_options );
4059 $htpasswd -> htpasswd ( $str_user , $str_pass );
4062 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
4063 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
4064 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
4066 print FILE
" $str_user \n " ;
4072 # -------------------------------------------------------------------
4076 my ( $str_user ) = @_ ;
4078 my @groupmembers =();
4081 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
4084 open ( FILE
, " $groupfile " );
4085 @groupmembers = < FILE
>;
4087 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
4088 open ( FILE
, "> $groupfile " );
4090 print FILE
@templist ;
4095 open ( FILE
, " $userdb " );
4096 @groupmembers = < FILE
>;
4098 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4099 open ( FILE
, "> $userdb " );
4101 print FILE
@templist ;
4107 # -------------------------------------------------------------------
4111 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4113 if (& Header
:: green_used
()) {
4114 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4116 print FILE
"localhost" ;
4121 # -------------------------------------------------------------------