]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2021 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
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 { 'SUPPRESS_VERSION' } = 'on' ;
197 $proxysettings { 'FORWARD_VIA' } = 'off' ;
198 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
199 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
200 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
201 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
202 $proxysettings { 'UPSTREAM_USER' } = '' ;
203 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
204 $proxysettings { 'LOGGING' } = 'off' ;
205 $proxysettings { 'CACHEMGR' } = 'off' ;
206 $proxysettings { 'LOGQUERY' } = 'off' ;
207 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
208 $proxysettings { 'FILEDESCRIPTORS' } = '16384' ;
209 $proxysettings { 'CACHE_MEM' } = '128' ;
210 $proxysettings { 'CACHE_SIZE' } = '0' ;
211 $proxysettings { 'MAX_SIZE' } = '4096' ;
212 $proxysettings { 'MIN_SIZE' } = '0' ;
213 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
214 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
215 $proxysettings { 'L1_DIRS' } = '16' ;
216 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
217 $proxysettings { 'CACHE_DIGESTS' } = 'off' ;
218 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
219 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
220 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
221 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
222 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
223 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
224 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
225 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
226 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
227 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
228 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
229 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
230 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
231 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
232 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
233 $proxysettings { 'ASNBL_FASTFLUX_DETECTION' } = 'off' ;
234 $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' } = '5' ;
235 $proxysettings { 'ASNBL_SELECANN_DETECTION' } = 'off' ;
236 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
237 $proxysettings { 'AUTH_METHOD' } = 'none' ;
238 $proxysettings { 'AUTH_REALM' } = '' ;
239 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
240 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
241 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
242 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
243 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
244 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
245 $proxysettings { 'NCSA_USERNAME' } = '' ;
246 $proxysettings { 'NCSA_GROUP' } = '' ;
247 $proxysettings { 'NCSA_PASS' } = '' ;
248 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
249 $proxysettings { 'LDAP_BASEDN' } = '' ;
250 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
251 $proxysettings { 'LDAP_SERVER' } = '' ;
252 $proxysettings { 'LDAP_PORT' } = '389' ;
253 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
254 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
255 $proxysettings { 'LDAP_GROUP' } = '' ;
256 $proxysettings { 'NTLM_AUTH_GROUP' } = '' ;
257 $proxysettings { 'NTLM_AUTH_BASIC' } = 'off' ;
258 $proxysettings { 'NTLM_DOMAIN' } = '' ;
259 $proxysettings { 'NTLM_PDC' } = '' ;
260 $proxysettings { 'NTLM_BDC' } = '' ;
261 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
262 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
263 $proxysettings { 'RADIUS_SERVER' } = '' ;
264 $proxysettings { 'RADIUS_PORT' } = '1812' ;
265 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
266 $proxysettings { 'RADIUS_SECRET' } = '' ;
267 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
268 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
269 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
270 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
271 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
272 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
273 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
274 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
275 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
277 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
279 & Header
:: getcgihash
( \
%proxysettings );
281 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
282 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
283 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
284 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
286 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
288 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
291 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
293 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
294 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
295 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
297 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
298 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
300 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
301 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
303 if (! $errormessage ) {
304 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
305 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
307 $proxysettings { 'NCSA_USERNAME' } = '' ;
308 $proxysettings { 'NCSA_GROUP' } = '' ;
309 $proxysettings { 'NCSA_PASS' } = '' ;
310 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
313 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
315 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
316 & deluser
( $proxysettings { 'ID' });
319 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
320 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
321 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
323 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
325 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
326 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
327 @temp = split ( /:/ , $proxysettings { 'ID' });
328 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
329 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
330 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
331 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
334 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
336 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
337 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
338 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
339 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
340 $errormessage = $Lang :: tr
{ 'invalid input' };
343 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
344 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
348 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
350 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
353 if (!(& General
:: validport
( $proxysettings { 'TRANSPARENT_PORT' })))
355 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
358 if ( $proxysettings { 'PROXY_PORT' } eq $proxysettings { 'TRANSPARENT_PORT' }) {
359 $errormessage = $Lang :: tr
{ 'advproxy errmsg proxy ports equal' };
362 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
364 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
365 if (!(& General
:: validip
( $temp [ 0 ])))
367 if (!(& General
:: validdomainname
( $temp [ 0 ])))
369 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
374 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
375 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
377 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
379 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
383 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
384 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 1048576 ))
386 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
389 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ))
391 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
394 my @free = & General
:: system_output
( "/usr/bin/free" );
395 $free [ 1 ] =~ m/(\d+)/ ;
396 $cachemem = int $1 / 2048 ;
397 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
398 $proxysettings { 'CACHE_MEM' } = $cachemem ;
400 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
402 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
405 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
407 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
410 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
412 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
415 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
417 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
420 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
422 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
425 if (( $proxysettings { 'ASNBL_FASTFLUX_DETECTION' } eq 'on' ) || ( $proxysettings { 'ASNBL_SELECANN_DETECTION' } eq 'on' ))
427 if (- z
$proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' }) {
428 $errormessage = $Lang :: tr
{ 'advproxy fastflux no threshold given' };
431 if (! looks_like_number
( $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' })) {
432 $errormessage = $Lang :: tr
{ 'advproxy fastflux threshold invalid' };
435 if (( $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' } < 2 ) || ( $proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' } > 10 )) {
436 $errormessage = $Lang :: tr
{ 'advproxy fastflux threshold out of bounds' };
440 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
442 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
443 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
444 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
446 if ( $netsettings { 'BLUE_DEV' })
448 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
449 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
451 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
455 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
457 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
462 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
463 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
465 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
468 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
470 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
473 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
475 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
478 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
480 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
483 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
485 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
489 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
491 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
493 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
497 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
499 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
501 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
505 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
507 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
509 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
512 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
514 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
516 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
520 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
522 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
525 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
527 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
529 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
534 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
536 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
538 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
541 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
543 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
546 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
548 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
553 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
556 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
557 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
558 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
559 if (( $proxy1 ne $proxy2 ))
561 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
569 $proxysettings { 'VALID' } = 'no' ; }
571 $proxysettings { 'VALID' } = 'yes' ; }
573 if ( $proxysettings { 'VALID' } eq 'yes' )
575 # Determine if suricata may needs to be restarted.
576 my $suricata_proxy_ports_changed ;
578 # Check if the IDS is running
579 if (& IDS
:: ids_is_running
()) {
580 my %oldproxysettings ;
582 # Read-in current proxy settings and store them as oldsettings hash.
583 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%oldproxysettings );
585 # Check if the proxy port has been changed.
586 unless ( $proxysettings { 'PROXY_PORT' } eq $oldproxysettings { 'PROXY_PORT' }) {
587 # Port has changed, suricata needs to be adjusted.
588 $suricata_proxy_ports_changed = 1 ;
591 # Check if the transparent port has been changed.
592 unless ( $proxysettings { 'TRANSPARENT_PORT' } eq $oldproxysettings { 'TRANSPARENT_PORT' }) {
593 # Transparent port has changed, suricata needs to be adjusted.
594 $suricata_proxy_ports_changed = 1 ;
600 delete $proxysettings { 'SRC_SUBNETS' };
601 delete $proxysettings { 'SRC_BANNED_IP' };
602 delete $proxysettings { 'SRC_BANNED_MAC' };
603 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
604 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
605 delete $proxysettings { 'DST_NOCACHE' };
606 delete $proxysettings { 'DST_NOAUTH' };
607 delete $proxysettings { 'DST_NOPROXY_IP' };
608 delete $proxysettings { 'DST_NOPROXY_URL' };
609 delete $proxysettings { 'PORTS_SAFE' };
610 delete $proxysettings { 'PORTS_SSL' };
611 delete $proxysettings { 'MIME_TYPES' };
612 delete $proxysettings { 'NTLM_ALLOW_USERS' };
613 delete $proxysettings { 'NTLM_DENY_USERS' };
614 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
615 delete $proxysettings { 'RADIUS_DENY_USERS' };
616 delete $proxysettings { 'IDENT_HOSTS' };
617 delete $proxysettings { 'IDENT_ALLOW_USERS' };
618 delete $proxysettings { 'IDENT_DENY_USERS' };
620 delete $proxysettings { 'CRE_GROUPS' };
621 delete $proxysettings { 'CRE_SVHOSTS' };
623 delete $proxysettings { 'NCSA_USERNAME' };
624 delete $proxysettings { 'NCSA_GROUP' };
625 delete $proxysettings { 'NCSA_PASS' };
626 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
628 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
629 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
630 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
631 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
632 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
633 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
634 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
636 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
637 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
639 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
641 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
642 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
643 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
644 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
645 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
646 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
647 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
648 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
649 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
654 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
656 & General
:: system ( '/usr/local/bin/squidctrl' , 'disable' );
657 unlink "${General::swroot}/proxy/enable" ;
658 unlink "${General::swroot}/proxy/transparent" ;
659 unlink "${General::swroot}/proxy/enable_blue" ;
660 unlink "${General::swroot}/proxy/transparent_blue" ;
662 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
663 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
664 & General
:: system ( '/usr/local/bin/squidctrl' , 'enable' ); }
665 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
666 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
667 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
668 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
669 & General
:: system ( '/usr/local/bin/squidctrl' , 'enable' ); }
670 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
671 & General
:: system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
673 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { & General
:: system ( '/usr/local/bin/squidctrl' , 'restart' ); }
674 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { & General
:: system ( '/usr/local/bin/squidctrl' , 'reconfigure' ); }
676 # Check if the suricata_proxy_ports_changed flag has been set.
677 if ( $suricata_proxy_ports_changed ) {
678 # Re-generate HTTP ports file.
679 & IDS
:: generate_http_ports_file
();
682 & IDS
:: call_suricatactrl
( "restart" );
687 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
689 & General
:: system ( '/usr/local/bin/squidctrl' , 'flush' );
694 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
695 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
696 } elsif (- e
"${General::swroot}/proxy/settings" ) {
697 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
702 # ------------------------------------------------------------------
704 # Hook to regenerate the configuration files, if cgi got called from command line.
705 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
710 # -------------------------------------------------------------------
712 $checked { 'ENABLE' }{ 'off' } = '' ;
713 $checked { 'ENABLE' }{ 'on' } = '' ;
714 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
716 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
717 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
718 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
720 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
721 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
722 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
724 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
725 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
726 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
728 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
729 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
730 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
732 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
733 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
734 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
735 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
736 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
737 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
738 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
739 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
740 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
741 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
742 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
743 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
745 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
746 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
747 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
748 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
749 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
750 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
751 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
752 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
753 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
755 $checked { 'LOGGING' }{ 'off' } = '' ;
756 $checked { 'LOGGING' }{ 'on' } = '' ;
757 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
758 $checked { 'CACHEMGR' }{ 'off' } = '' ;
759 $checked { 'CACHEMGR' }{ 'on' } = '' ;
760 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
761 $checked { 'LOGQUERY' }{ 'off' } = '' ;
762 $checked { 'LOGQUERY' }{ 'on' } = '' ;
763 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
764 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
765 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
766 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
768 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
769 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
771 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
772 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
773 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
774 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
775 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
776 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
778 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
779 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
780 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
782 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
783 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
784 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
785 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
786 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
788 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
789 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
790 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
791 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
792 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
793 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
794 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
796 $checked { 'TIME_MON' }{ 'off' } = '' ;
797 $checked { 'TIME_MON' }{ 'on' } = '' ;
798 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
799 $checked { 'TIME_TUE' }{ 'off' } = '' ;
800 $checked { 'TIME_TUE' }{ 'on' } = '' ;
801 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
802 $checked { 'TIME_WED' }{ 'off' } = '' ;
803 $checked { 'TIME_WED' }{ 'on' } = '' ;
804 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
805 $checked { 'TIME_THU' }{ 'off' } = '' ;
806 $checked { 'TIME_THU' }{ 'on' } = '' ;
807 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
808 $checked { 'TIME_FRI' }{ 'off' } = '' ;
809 $checked { 'TIME_FRI' }{ 'on' } = '' ;
810 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
811 $checked { 'TIME_SAT' }{ 'off' } = '' ;
812 $checked { 'TIME_SAT' }{ 'on' } = '' ;
813 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
814 $checked { 'TIME_SUN' }{ 'off' } = '' ;
815 $checked { 'TIME_SUN' }{ 'on' } = '' ;
816 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
818 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
819 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
820 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
821 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
823 $checked { 'ASNBL_FASTFLUX_DETECTION' }{ 'off' } = '' ;
824 $checked { 'ASNBL_FASTFLUX_DETECTION' }{ 'on' } = '' ;
825 $checked { 'ASNBL_FASTFLUX_DETECTION' }{ $proxysettings { 'ASNBL_FASTFLUX_DETECTION' }} = "checked='checked'" ;
827 $checked { 'ASNBL_SELECANN_DETECTION' }{ 'off' } = '' ;
828 $checked { 'ASNBL_SELECANN_DETECTION' }{ 'on' } = '' ;
829 $checked { 'ASNBL_SELECANN_DETECTION' }{ $proxysettings { 'ASNBL_SELECANN_DETECTION' }} = "checked='checked'" ;
831 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
832 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
833 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
835 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
836 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
837 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
838 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
839 $checked { 'AUTH_METHOD' }{ 'ntlm-auth' } = '' ;
840 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
841 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
843 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
845 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
846 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
847 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
849 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
850 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
851 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
853 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
855 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
857 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
859 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
860 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
861 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
863 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
864 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
865 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
867 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
868 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
869 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
871 $checked { 'NTLM_AUTH_BASIC' }{ 'on' } = '' ;
872 $checked { 'NTLM_AUTH_BASIC' }{ 'off' } = '' ;
873 $checked { 'NTLM_AUTH_BASIC' }{ $proxysettings { 'NTLM_AUTH_BASIC' }} = "checked='checked'" ;
875 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
876 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
877 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
879 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
880 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
881 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
883 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
884 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
885 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
887 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
888 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
889 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
891 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
892 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
893 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
895 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
896 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
897 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
899 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
900 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
901 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
903 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
904 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
905 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
907 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
909 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
912 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
913 print "<font class='base'> $errormessage </font> \n " ;
917 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
919 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
920 $squidversion [ 0 ] =~ s/^\s+//g ;
921 $squidversion [ 0 ] =~ s/\s+$//g ;
923 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
926 # ===================================================================
928 # ===================================================================
930 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
932 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
934 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
939 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
942 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
943 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
944 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td>
945 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
948 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
949 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
950 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td>
951 <td width='30%'><input type='text' name='TRANSPARENT_PORT' value=' $proxysettings {'TRANSPARENT_PORT'}' size='5' /></td>
956 if ( $netsettings { 'BLUE_DEV' }) {
957 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
958 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
960 print "<td colspan='2'> </td>" ;
963 <td class='base'> $Lang ::tr{'advproxy visible hostname'}:</td>
964 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
969 if ( $netsettings { 'BLUE_DEV' }) {
970 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
971 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
973 print "<td colspan='2'> </td>" ;
976 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
978 <select name='ERR_LANGUAGE'>
981 foreach (< $errordir /*>) {
983 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
984 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
992 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
993 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
994 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
995 <td class='base'><select name='ERR_DESIGN'>
996 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
997 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
1001 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
1002 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
1008 <table width='100%'>
1011 if ( - e
"/usr/bin/squidclamav" ) {
1012 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
1013 if ( ! - e
"/var/run/clamav/clamd.pid" ){
1014 print "<font color='red'>clamav not running</font><br /><br />" ;
1015 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
1018 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
1024 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</a></b><br />" ;
1025 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
1027 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</a></b><br />" ;
1028 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1033 <table width='100%'>
1035 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1038 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1039 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1040 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}:</td>
1041 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1044 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1045 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1046 <td class='base'> $Lang ::tr{'advproxy upstream username'}:</td>
1047 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1050 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1051 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1052 <td class='base'> $Lang ::tr{'advproxy upstream password'}:</td>
1053 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1056 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1057 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1063 <table width='100%'>
1065 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1068 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1069 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1070 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1071 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1076 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1077 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1081 <table width='100%'>
1083 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1086 <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'> $Lang ::tr{'proxy cachemgr'}:</td>
1087 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1088 <td class='base'> $Lang ::tr{'advproxy admin mail'}:</td>
1089 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1092 <td class='base'> $Lang ::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td>
1093 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1094 <td class='base'> $Lang ::tr{'proxy admin password'}:</td>
1095 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1098 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1101 <td class='base'> $Lang ::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td>
1102 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1103 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td>
1104 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1107 <td class='base'> $Lang ::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td>
1108 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1109 <td class='base'> $Lang ::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td>
1110 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1113 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1114 <td class='base'><select name='L1_DIRS'>
1115 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1116 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1117 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1118 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1119 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1121 <td colspan='2' rowspan= '5' valign='top' class='base'>
1122 <table cellspacing='0' cellpadding='0'>
1124 <!-- intentionally left empty -->
1127 <td> $Lang ::tr{'advproxy no cache sites'}:</td>
1130 <!-- intentionally left empty -->
1133 <!-- intentionally left empty -->
1136 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1140 print $proxysettings { 'DST_NOCACHE' };
1149 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1150 <td class='base'><select name='MEM_POLICY'>
1151 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1152 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1153 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1154 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1158 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1159 <td class='base'><select name='CACHE_POLICY'>
1160 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1161 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1162 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1163 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1167 <td colspan='2'> </td>
1170 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1171 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1174 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1175 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1179 <table width='100%'>
1181 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1184 <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
1187 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td>
1188 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td>
1191 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1194 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1198 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1201 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1208 <table width='100%'>
1210 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1213 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1216 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td>
1219 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1223 if (! $proxysettings { 'SRC_SUBNETS' })
1225 if (& Header
:: green_used
()) {
1226 print " $green_cidr \n " ;
1229 if (& Header
:: blue_used
()) {
1230 print " $blue_cidr \n " ;
1232 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1239 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1240 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1241 print "<td class='base'> $line :</td> \n " ;
1243 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1247 if ( $netsettings { 'BLUE_DEV' }) {
1248 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1249 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1251 print "<td class='base'> $line :</td> \n " ;
1253 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1260 <td colspan='2'> </td>
1263 <td colspan='2'> </td>
1266 <table width='100%'>
1268 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1271 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}:</td>
1272 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}:</td>
1275 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1279 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1283 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1287 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1293 <table width='100%'>
1295 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1298 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}:</td>
1299 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}:</td>
1302 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1306 print $proxysettings { 'SRC_BANNED_IP' };
1310 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1314 print $proxysettings { 'SRC_BANNED_MAC' };
1325 # -------------------------------------------------------------------
1326 # CRE GUI - optional
1327 # -------------------------------------------------------------------
1329 if (- e
$cre_enabled ) { print <<END
1330 <table width='100%'>
1333 <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>
1336 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1342 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1344 <td class='base'> $Lang ::tr{'advproxy supervisor password'}:</td>
1345 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1348 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1349 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}:</td>
1354 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1357 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1361 print $proxysettings { 'CRE_GROUPS' };
1365 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1368 print $proxysettings { 'CRE_SVHOSTS' };
1376 print "</table><hr size='1'>" ;
1380 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1381 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1382 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1387 # ===================================================================
1389 # ===================================================================
1392 <table width='100%'>
1394 <td colspan='4'><b> $Lang ::tr{'advproxy wpad title'}</b></td>
1397 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1400 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_ip'}:</td>
1401 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_url'}:</td>
1404 <td colspan='2'><textarea name='DST_NOPROXY_IP' cols='32' rows='3' wrap='off'>
1408 print $proxysettings { 'DST_NOPROXY_IP' };
1413 <td colspan='2'><textarea name='DST_NOPROXY_URL' cols='32' rows='3' wrap='off'>
1417 print $proxysettings { 'DST_NOPROXY_URL' };
1423 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_ip'}</td>
1424 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_url'}</td>
1427 <td colspan="4"> </td>
1430 <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>
1433 <td colspan="4"> </td>
1436 <td colspan="4"> $Lang ::tr{'advproxy wpad notice'}</td>
1445 # -------------------------------------------------------------------
1449 <table width='100%'>
1451 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1453 <table width='100%'>
1455 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1456 <td width='1%'> </td>
1457 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1458 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1459 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1460 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1461 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1462 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1463 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1464 <td width='1%'> </td>
1465 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1466 <td width='1%'> </td>
1467 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1472 <select name='TIME_ACCESS_MODE'>
1473 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1474 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1478 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1479 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1480 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1481 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1482 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1483 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1484 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1487 <select name='TIME_FROM_HOUR'>
1490 for ( $i = 0 ; $i <= 24 ; $i ++) {
1491 $_ = sprintf ( " %02s " , $i );
1492 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1499 <select name='TIME_FROM_MINUTE'>
1502 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1503 $_ = sprintf ( " %02s " , $i );
1504 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1511 <select name='TIME_TO_HOUR'>
1514 for ( $i = 0 ; $i <= 24 ; $i ++) {
1515 $_ = sprintf ( " %02s " , $i );
1516 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1523 <select name='TIME_TO_MINUTE'>
1526 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1527 $_ = sprintf ( " %02s " , $i );
1528 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1536 <table width='100%'>
1538 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1541 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td>
1542 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1543 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td>
1544 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1548 <table width='100%'>
1550 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1553 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1554 <td width='20%' class='base'>
1555 <select name='THROTTLING_GREEN_TOTAL'>
1559 foreach ( @throttle_limits ) {
1561 my $unit = "kbit/s" ;
1568 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $val $unit </option> \n " ;
1572 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1575 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1576 <td width='30%' class='base'>
1577 <select name='THROTTLING_GREEN_HOST'>
1581 foreach ( @throttle_limits ) {
1582 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1586 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1593 if ( $netsettings { 'BLUE_DEV' }) {
1596 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1598 <select name='THROTTLING_BLUE_TOTAL'>
1602 foreach ( @throttle_limits ) {
1603 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1607 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1610 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1612 <select name='THROTTLING_BLUE_HOST'>
1616 foreach ( @throttle_limits ) {
1617 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1621 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1632 <table width='100%'>
1634 <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>
1638 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1641 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}:</td>
1646 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1650 print $proxysettings { 'MIME_TYPES' };
1665 <table width='100%'>
1667 <td><b> $Lang ::tr{'advproxy asbased anomaly detection'}</b></td>
1670 <td class='base'> $Lang ::tr{'advproxy fastflux detection'}:</td>
1671 <td><input type='checkbox' name='ASNBL_FASTFLUX_DETECTION' $checked {'ASNBL_FASTFLUX_DETECTION'}{'on'} /></td>
1672 <td class='base'> $Lang ::tr{'advproxy fastflux detection threshold'}:</td>
1673 <td><input type='text' name='ASNBL_FASTFLUX_THRESHOLD' value=' $proxysettings {'ASNBL_FASTFLUX_THRESHOLD'}' size=2 /></td>
1676 <td class='base'> $Lang ::tr{'advproxy selectively announcements detection'}:</td>
1677 <td colspan='3'><input type='checkbox' name='ASNBL_SELECANN_DETECTION' $checked {'ASNBL_SELECANN_DETECTION'}{'on'} /></td>
1685 my $auth_columns = 5 ;
1686 if ( $HAVE_NTLM_AUTH ) {
1689 my $auth_column_width = 100 / $auth_columns ;
1692 <table width='100%'>
1694 <td colspan=' $auth_columns '><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1697 <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>
1698 <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>
1699 <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>
1700 <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>
1703 if ( $HAVE_NTLM_AUTH ) {
1705 <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>
1710 <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>
1716 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1718 <table width='100%'>
1720 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1723 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1726 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1727 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1728 <td colspan='2' rowspan= '6' valign='top' class='base'>
1729 <table cellpadding='0' cellspacing='0'>
1731 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}:</td>
1734 <!-- intentionally left empty -->
1737 <!-- intentionally left empty -->
1740 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1743 <!-- intentionally left empty -->
1746 <!-- intentionally left empty -->
1749 <td> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1752 <!-- intentionally left empty -->
1755 <!-- intentionally left empty -->
1758 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1762 print $proxysettings { 'DST_NOAUTH' };
1771 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1772 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1775 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}:</td>
1776 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1779 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1780 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1783 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1784 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1787 <td colspan='2'> </td>
1794 # ===================================================================
1795 # NCSA auth settings
1796 # ===================================================================
1798 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1801 <table width='100%'>
1803 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1806 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1807 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1808 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1809 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1812 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1820 # ===================================================================
1821 # IDENTD auth settings
1822 # ===================================================================
1824 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1827 <table width='100%'>
1829 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1832 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1833 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1834 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1835 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1838 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1839 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1844 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1845 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1848 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1851 if (! $proxysettings { 'IDENT_HOSTS' }) {
1852 if (& Header
:: green_used
()) {
1853 print " $green_cidr \n " ;
1856 if (& Header
:: blue_used
()) {
1857 print " $blue_cidr \n " ;
1860 print $proxysettings { 'IDENT_HOSTS' };
1865 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1869 print $proxysettings { 'DST_NOAUTH' };
1876 <table width='100%'>
1878 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1881 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1882 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1883 <td width='25%'> </td>
1884 <td width='30%'> </td>
1887 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1888 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1889 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1890 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1893 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1894 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1897 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1901 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1903 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1905 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1909 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1911 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1918 # ===================================================================
1919 # NTLM-AUTH settings
1920 # ===================================================================
1922 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' ) {
1925 <table width='100%'>
1926 <td width='20%' class='base'> $Lang ::tr{'advproxy basic authentication'}:</td>
1927 <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked {'NTLM_AUTH_BASIC'}{'on'} /></td>
1928 <td colspan='2'> </td>
1933 <table width='100%'>
1935 <td colspan='4'><b> $Lang ::tr{'advproxy group access control'}</b></td>
1938 <td width='20%' class='base'> $Lang ::tr{'advproxy group required'}:</td>
1939 <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value=' $proxysettings {'NTLM_AUTH_GROUP'}' size='37' /></td>
1947 # ===================================================================
1948 # LDAP auth settings
1949 # ===================================================================
1951 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1954 <table width='100%'>
1956 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1959 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1960 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1961 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1962 <td class='base'><select name='LDAP_TYPE'>
1963 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1964 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1965 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1966 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1970 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1971 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1972 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1973 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1977 <table width='100%'>
1979 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1982 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1983 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1984 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1985 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1989 <table width='100%'>
1991 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1994 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}:</td>
1995 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
2003 # ===================================================================
2004 # RADIUS auth settings
2005 # ===================================================================
2007 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
2010 <table width='100%'>
2012 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
2015 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
2016 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
2017 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
2018 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
2021 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}:</td>
2022 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
2023 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
2024 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
2028 <table width='100%'>
2030 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
2033 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
2034 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
2035 <td width='25%'> </td>
2036 <td width='30%'> </td>
2039 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
2040 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
2041 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
2042 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
2045 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
2046 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2049 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2053 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2055 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2057 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2061 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2063 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2070 # ===================================================================
2076 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2078 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2079 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2080 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2081 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2082 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2083 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2084 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2088 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2090 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2091 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2092 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2093 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2094 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2098 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2100 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2101 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2105 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2107 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2108 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2109 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2110 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2111 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2112 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2113 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2117 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2119 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2120 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2121 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2122 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2123 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2124 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2125 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2129 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2131 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2132 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2133 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2134 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2135 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2136 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2137 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2138 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2150 <table width='100%'>
2153 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2154 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2155 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2156 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2162 <table width='100%'>
2164 <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'> $Lang ::tr{'required field'}</font></td>
2165 <td align='right'> </td>
2172 & Header
:: closebox
();
2176 # ===================================================================
2177 # NCSA user management
2178 # ===================================================================
2180 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2182 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2183 <table width='100%'>
2185 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2188 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2189 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2192 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly='readonly' " ; }
2195 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2197 <select name='NCSA_GROUP'>
2198 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2199 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2200 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2206 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2207 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2208 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2209 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2216 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2217 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2218 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2221 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2222 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2228 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2233 <table width='100%'>
2235 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2238 <table width='100%' align='center'>
2244 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2245 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2249 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2250 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2254 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2255 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2258 @userlist = sort ( @userlist );
2260 # If the password file contains entries, print entries and action icons
2262 if ( ! - z
" $userdb " ) {
2265 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2266 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2267 <td class='boldbase' colspan='2' align='center'> </td>
2272 foreach $line ( @userlist )
2276 @temp = split ( /:/ , $line );
2277 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2278 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2280 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2282 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2285 <td align='center'> $temp [0]</td>
2289 if ( $temp [ 1 ] eq 'standard' ) {
2290 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2291 } elsif ( $temp [ 1 ] eq 'extended' ) {
2292 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2293 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2294 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2297 <td width='8%' align='center'>
2298 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2299 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2300 <input type='hidden' name='ID' value=' $line ' />
2301 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2305 <td width='8%' align='center'>
2306 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2307 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2308 <input type='hidden' name='ID' value=' $temp [0]' />
2309 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2322 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2323 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2324 <td class='base'> $Lang ::tr{'edit'}</td>
2325 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2326 <td class='base'> $Lang ::tr{'remove'}</td>
2333 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2344 & Header
:: closebox
();
2348 # ===================================================================
2350 & Header
:: closebigbox
();
2352 & Header
:: closepage
();
2354 # -------------------------------------------------------------------
2358 if (- e
" $acl_src_subnets " ) {
2359 open ( FILE
, " $acl_src_subnets " );
2360 delete $proxysettings { 'SRC_SUBNETS' };
2361 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2364 if (- e
" $acl_src_banned_ip " ) {
2365 open ( FILE
, " $acl_src_banned_ip " );
2366 delete $proxysettings { 'SRC_BANNED_IP' };
2367 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2370 if (- e
" $acl_src_banned_mac " ) {
2371 open ( FILE
, " $acl_src_banned_mac " );
2372 delete $proxysettings { 'SRC_BANNED_MAC' };
2373 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2376 if (- e
" $acl_src_unrestricted_ip " ) {
2377 open ( FILE
, " $acl_src_unrestricted_ip " );
2378 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2379 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2382 if (- e
" $acl_src_unrestricted_mac " ) {
2383 open ( FILE
, " $acl_src_unrestricted_mac " );
2384 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2385 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2388 if (- e
" $acl_dst_nocache " ) {
2389 open ( FILE
, " $acl_dst_nocache " );
2390 delete $proxysettings { 'DST_NOCACHE' };
2391 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2394 if (- e
" $acl_dst_noauth " ) {
2395 open ( FILE
, " $acl_dst_noauth " );
2396 delete $proxysettings { 'DST_NOAUTH' };
2397 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2400 if (- e
" $acl_dst_noproxy_ip " ) {
2401 open ( FILE
, " $acl_dst_noproxy_ip " );
2402 delete $proxysettings { 'DST_NOPROXY_IP' };
2403 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_IP' } .= $_ };
2406 if (- e
" $acl_dst_noproxy_url " ) {
2407 open ( FILE
, " $acl_dst_noproxy_url " );
2408 delete $proxysettings { 'DST_NOPROXY_URL' };
2409 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_URL' } .= $_ };
2412 if (- e
" $acl_ports_safe " ) {
2413 open ( FILE
, " $acl_ports_safe " );
2414 delete $proxysettings { 'PORTS_SAFE' };
2415 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2418 if (- e
" $acl_ports_ssl " ) {
2419 open ( FILE
, " $acl_ports_ssl " );
2420 delete $proxysettings { 'PORTS_SSL' };
2421 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2424 if (- e
" $mimetypes " ) {
2425 open ( FILE
, " $mimetypes " );
2426 delete $proxysettings { 'MIME_TYPES' };
2427 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2430 if (- e
" $raddir /radauth.allowusers" ) {
2431 open ( FILE
, " $raddir /radauth.allowusers" );
2432 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2433 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2436 if (- e
" $raddir /radauth.denyusers" ) {
2437 open ( FILE
, " $raddir /radauth.denyusers" );
2438 delete $proxysettings { 'RADIUS_DENY_USERS' };
2439 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2442 if (- e
" $identdir /identauth.allowusers" ) {
2443 open ( FILE
, " $identdir /identauth.allowusers" );
2444 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2445 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2448 if (- e
" $identdir /identauth.denyusers" ) {
2449 open ( FILE
, " $identdir /identauth.denyusers" );
2450 delete $proxysettings { 'IDENT_DENY_USERS' };
2451 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2454 if (- e
" $identhosts " ) {
2455 open ( FILE
, " $identhosts " );
2456 delete $proxysettings { 'IDENT_HOSTS' };
2457 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2460 if (- e
" $cre_groups " ) {
2461 open ( FILE
, " $cre_groups " );
2462 delete $proxysettings { 'CRE_GROUPS' };
2463 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2466 if (- e
" $cre_svhosts " ) {
2467 open ( FILE
, " $cre_svhosts " );
2468 delete $proxysettings { 'CRE_SVHOSTS' };
2469 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2474 # -------------------------------------------------------------------
2478 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2479 undef $proxysettings { 'PORTS_SAFE' };
2482 s/^\s+//g ; s/\s+$//g ;
2486 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2488 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2489 @templist = split ( /-/ );
2490 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2491 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2495 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2496 undef $proxysettings { 'PORTS_SSL' };
2499 s/^\s+//g ; s/\s+$//g ;
2504 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2505 @templist = split ( /-/ );
2506 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2507 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2511 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2512 undef $proxysettings { 'DST_NOCACHE' };
2516 unless ( /^#/ ) { s/\s+//g ; }
2519 if ( /^\./ ) { $_ = '*' . $_ ; }
2520 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2524 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2525 undef $proxysettings { 'SRC_SUBNETS' };
2528 s/^\s+//g ; s/\s+$//g ;
2531 unless (& Network
:: check_subnet
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' } . ": $_ " ; }
2532 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2536 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2537 undef $proxysettings { 'SRC_BANNED_IP' };
2540 s/^\s+//g ; s/\s+$//g ;
2543 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2544 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2548 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2549 undef $proxysettings { 'SRC_BANNED_MAC' };
2552 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2555 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2556 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2560 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2561 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2564 s/^\s+//g ; s/\s+$//g ;
2567 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2568 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2572 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2573 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2576 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2579 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2580 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2584 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2585 undef $proxysettings { 'DST_NOAUTH' };
2589 unless ( /^#/ ) { s/\s+//g ; }
2592 if ( /^\./ ) { $_ = '*' . $_ ; }
2593 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2597 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_IP' });
2598 undef $proxysettings { 'DST_NOPROXY_IP' };
2601 s/^\s+//g ; s/\s+$//g ;
2604 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg wpad invalid ip or mask' }; }
2605 $proxysettings { 'DST_NOPROXY_IP' } .= $_ . " \n " ;
2609 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_URL' });
2610 undef $proxysettings { 'DST_NOPROXY_URL' };
2614 unless ( /^#/ ) { s/\s+//g ; }
2617 if ( /^\./ ) { $_ = '*' . $_ ; }
2618 $proxysettings { 'DST_NOPROXY_URL' } .= $_ . " \n " ;
2622 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2624 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2625 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2628 s/^\s+//g ; s/\s+$//g ;
2629 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2631 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2634 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2636 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2637 undef $proxysettings { 'NTLM_DENY_USERS' };
2640 s/^\s+//g ; s/\s+$//g ;
2641 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2643 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2646 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2648 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2649 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2652 s/^\s+//g ; s/\s+$//g ;
2653 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2655 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2658 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2660 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2661 undef $proxysettings { 'IDENT_DENY_USERS' };
2664 s/^\s+//g ; s/\s+$//g ;
2665 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2667 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2670 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2672 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2673 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2676 s/^\s+//g ; s/\s+$//g ;
2677 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2679 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2682 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2684 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2685 undef $proxysettings { 'RADIUS_DENY_USERS' };
2688 s/^\s+//g ; s/\s+$//g ;
2689 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2691 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2694 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2695 undef $proxysettings { 'IDENT_HOSTS' };
2698 s/^\s+//g ; s/\s+$//g ;
2701 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2702 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2706 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2707 undef $proxysettings { 'CRE_SVHOSTS' };
2710 s/^\s+//g ; s/\s+$//g ;
2713 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2714 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2719 # -------------------------------------------------------------------
2723 open ( FILE
, "> $acl_src_subnets " );
2725 if (! $proxysettings { 'SRC_SUBNETS' })
2727 if (& Header
:: green_used
()) {
2728 print FILE
" $green_cidr \n " ;
2731 if (& Header
:: blue_used
()) {
2732 print FILE
" $blue_cidr \n " ;
2734 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2737 open ( FILE
, "> $acl_src_banned_ip " );
2739 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2742 open ( FILE
, "> $acl_src_banned_mac " );
2744 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2747 open ( FILE
, "> $acl_src_unrestricted_ip " );
2749 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2752 open ( FILE
, "> $acl_src_unrestricted_mac " );
2754 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2757 open ( FILE
, "> $acl_dst_noauth " );
2759 print FILE
$proxysettings { 'DST_NOAUTH' };
2762 open ( FILE
, "> $acl_dst_noproxy_ip " );
2764 print FILE
$proxysettings { 'DST_NOPROXY_IP' };
2767 open ( FILE
, "> $acl_dst_noproxy_url " );
2769 print FILE
$proxysettings { 'DST_NOPROXY_URL' };
2772 open ( FILE
, "> $acl_dst_noauth_net " );
2774 open ( FILE
, "> $acl_dst_noauth_dom " );
2776 open ( FILE
, "> $acl_dst_noauth_url " );
2779 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2787 open ( FILE
, ">> $acl_dst_noauth_dom " );
2792 elsif (& General
:: validipormask
( $_ ))
2794 open ( FILE
, ">> $acl_dst_noauth_net " );
2799 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?/ )
2801 open ( FILE
, ">> $acl_dst_noauth_net " );
2808 open ( FILE
, ">> $acl_dst_noauth_url " );
2810 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2816 open ( FILE
, "> $acl_dst_nocache " );
2818 print FILE
$proxysettings { 'DST_NOCACHE' };
2821 open ( FILE
, "> $acl_dst_nocache_net " );
2823 open ( FILE
, "> $acl_dst_nocache_dom " );
2825 open ( FILE
, "> $acl_dst_nocache_url " );
2828 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2836 open ( FILE
, ">> $acl_dst_nocache_dom " );
2841 elsif (& General
:: validipormask
( $_ ))
2843 open ( FILE
, ">> $acl_dst_nocache_net " );
2848 elsif ( /\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?-\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?/ )
2850 open ( FILE
, ">> $acl_dst_nocache_net " );
2857 open ( FILE
, ">> $acl_dst_nocache_url " );
2859 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2865 open ( FILE
, "> $acl_ports_safe " );
2867 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2870 open ( FILE
, "> $acl_ports_ssl " );
2872 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2875 if (- s
$throttled_urls )
2877 open ( URLFILE
, $throttled_urls );
2880 foreach ( @temp ) { print FILE
; }
2884 open ( FILE
, "> $mimetypes " );
2886 print FILE
$proxysettings { 'MIME_TYPES' };
2889 open ( FILE
, "> $raddir /radauth.allowusers" );
2891 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2894 open ( FILE
, "> $raddir /radauth.denyusers" );
2896 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2899 open ( FILE
, "> $identdir /identauth.allowusers" );
2901 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2904 open ( FILE
, "> $identdir /identauth.denyusers" );
2906 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2909 open ( FILE
, "> $identhosts " );
2911 print FILE
$proxysettings { 'IDENT_HOSTS' };
2914 open ( FILE
, "> $cre_groups " );
2916 print FILE
$proxysettings { 'CRE_GROUPS' };
2919 open ( FILE
, "> $cre_svhosts " );
2921 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2925 # -------------------------------------------------------------------
2931 & General
:: readhasharray
( "${General::swroot}/vpn/config" , \
%vpnconfig );
2932 & General
:: readhasharray
( "${General::swroot}/ovpn/ovpnconfig" , \
%ovpnconfig );
2933 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2935 print FILE
"function FindProxyForURL(url, host) \n " ;
2937 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2941 (isPlainHostName(host)) ||
2942 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2946 if ( $netsettings { 'GREEN_DEV' }) {
2947 print FILE
" (isInNet(host, \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" )) || \n " ;
2950 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
2951 print FILE
" (isInNet(host, \" $netsettings {'BLUE_NETADDRESS'} \" , \" $netsettings {'BLUE_NETMASK'} \" )) || \n " ;
2954 if (& Header
:: orange_used
() && $netsettings { 'ORANGE_DEV' }) {
2955 print FILE
" (isInNet(host, \" $netsettings {'ORANGE_NETADDRESS'} \" , \" $netsettings {'ORANGE_NETMASK'} \" )) || \n " ;
2958 # Additional exceptions for URLs
2959 # The file has to be created by the user and should contain one entry per line
2960 # Line-Format: <URL incl. wildcards>
2961 # e.g. *.ipfire.org*
2962 if (- s
" $acl_dst_noproxy_url " ) {
2965 open ( NOPROXY
, " $acl_dst_noproxy_url " );
2966 @templist = < NOPROXY
>;
2972 print FILE
" (shExpMatch(url, \" $_ \" )) || \n " ;
2976 # Additional exceptions for Subnets
2977 # The file has to be created by the user and should contain one entry per line
2978 # Line-Format: <IP>/<SUBNET MASK>
2979 # e.g. 192.168.0.0/255.255.255.0
2980 if (- s
" $acl_dst_noproxy_ip " ) {
2983 open ( NOPROXY
, " $acl_dst_noproxy_ip " );
2984 @templist = < NOPROXY
>;
2990 @temp = split ( /\/ /);
2991 print FILE
" (isInNet(host, \" $temp [0] \" , \" $temp [1] \" )) || \n " ;
2995 foreach my $key ( sort { uc ( $vpnconfig { $a }[ 1 ]) cmp uc ( $vpnconfig { $b }[ 1 ]) } keys %vpnconfig ) {
2996 if ( $vpnconfig { $key }[ 0 ] eq 'on' && $vpnconfig { $key }[ 3 ] ne 'host' ) {
2997 my @networks = split ( /\|/ , $vpnconfig { $key }[ 11 ]);
2998 foreach my $network ( @networks ) {
2999 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
3000 $vpnsub = & Network
:: convert_prefix2netmask
( $vpnsub ) || $vpnsub ;
3001 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
3006 foreach my $key ( sort { uc ( $ovpnconfig { $a }[ 1 ]) cmp uc ( $ovpnconfig { $b }[ 1 ]) } keys %ovpnconfig ) {
3007 if ( $ovpnconfig { $key }[ 0 ] eq 'on' && $ovpnconfig { $key }[ 3 ] ne 'host' ) {
3008 my @networks = split ( /\|/ , $ovpnconfig { $key }[ 11 ]);
3009 foreach my $network ( @networks ) {
3010 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
3011 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
3017 (isInNet(host, "169.254.0.0", "255.255.0.0"))
3025 if ( $proxysettings { 'ENABLE' } eq 'on' )
3027 print FILE
"if ( \n " ;
3028 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
3031 if (- e
" $acl_src_subnets " ) {
3032 open ( SUBNETS
, " $acl_src_subnets " );
3033 @templist = < SUBNETS
>;
3039 @temp = split ( /\/ /);
3041 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
3042 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
3046 my $tempmask = & Network
:: convert_prefix2netmask
( $temp [ 1 ]);
3047 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $tempmask \" ))" ;
3055 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3059 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
3061 print FILE
" \n else \n\n " ;
3063 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
3067 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
3069 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3078 # -------------------------------------------------------------------
3085 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3086 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3087 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3088 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3090 $delaypools = 1 ; } else { $delaypools = 0 ;
3093 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3095 $authrealm = "IPFire Advanced Proxy Server" ;
3097 $authrealm = $proxysettings { 'AUTH_REALM' };
3100 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3101 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3103 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3105 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3108 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3109 # you make will be overwritten whenever you resave proxy settings using the
3112 # Instead, modify the file ' $acl_include ' and
3113 # then restart the proxy service using the web interface. Changes made to the
3114 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3116 shutdown_lifetime 5 seconds
3122 # Include file with user defined settings.
3123 if (- e
"/etc/squid/squid.conf.pre.local" ) {
3124 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
3127 if (& Header
:: green_used
()) {
3128 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3130 print FILE
"http_port 0.0.0.0: $proxysettings {'PROXY_PORT'}" ;
3132 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3135 if (& Header
:: green_used
() && $proxysettings { 'TRANSPARENT' } eq 'on' ) {
3136 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3137 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3141 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3142 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3143 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3146 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) {
3147 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3148 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3153 if (( $proxysettings { 'CACHE_SIZE' } > 0 ) || ( $proxysettings { 'CACHE_MEM' } > 0 ))
3157 if (!- z
$acl_dst_nocache_dom ) {
3158 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3159 print FILE
"cache deny no_cache_domains \n " ;
3161 if (!- z
$acl_dst_nocache_net ) {
3162 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3163 print FILE
"cache deny no_cache_ipaddr \n " ;
3165 if (!- z
$acl_dst_nocache_url ) {
3166 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3167 print FILE
"cache deny no_cache_hosts \n " ;
3173 cache_effective_user squid
3176 pid_filename /var/run/squid.pid
3178 cache_mem $proxysettings {'CACHE_MEM'} MB
3181 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3183 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3184 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
3186 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3188 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3190 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3192 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3194 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3199 open ( PORTS
, " $acl_ports_ssl " );
3200 my @ssl_ports = < PORTS
>;
3204 foreach ( @ssl_ports ) {
3205 print FILE
"acl SSL_ports port $_ " ;
3209 open ( PORTS
, " $acl_ports_safe " );
3210 my @safe_ports = < PORTS
>;
3214 foreach ( @safe_ports ) {
3215 print FILE
"acl Safe_ports port $_ " ;
3220 acl IPFire_ips dst 127.0.0.1
3221 acl IPFire_http port $http_port
3222 acl IPFire_https port $https_port
3223 acl IPFire_networks src " $acl_src_subnets "
3224 acl IPFire_servers dst " $acl_src_subnets "
3226 if (& Header
:: green_used
()) {
3228 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3229 acl IPFire_green_network src $green_cidr
3230 acl IPFire_green_servers dst $green_cidr
3233 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3234 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3235 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3236 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3237 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3238 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3240 acl CONNECT method CONNECT
3244 if ( $proxysettings { 'CACHE_SIZE' } > 0 ) {
3246 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3247 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3249 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
3253 if ( $proxysettings { 'CACHE_MEM' } > 0 ) {
3254 # always 2% of CACHE_MEM defined as max object size
3255 print FILE
"maximum_object_size_in_memory " . int ( $proxysettings { 'CACHE_MEM' } * 1024 * 0.02 ) . " KB \n\n " ;
3257 print FILE
"cache deny all \n\n " ;
3262 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3266 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3267 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3268 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3269 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3271 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3275 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3277 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3280 if ( $proxysettings { 'LOGGING' } eq 'on' )
3283 access_log stdio:/var/log/squid/access.log
3284 cache_log /var/log/squid/cache.log
3285 cache_store_log none
3288 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"access_log stdio:\/var\/log\/squid\/user_agent.log useragent \n " ; }
3289 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3292 access_log /dev/null
3294 cache_store_log none
3303 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3305 print FILE
"forwarded_for on \n " ;
3307 print FILE
"forwarded_for off \n " ;
3309 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3311 print FILE
"via on \n " ;
3313 print FILE
"via off \n " ;
3317 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3319 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3321 print FILE
"auth_param basic program $authdir /basic_ncsa_auth $userdb \n " ;
3322 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3323 print FILE
"auth_param basic realm $authrealm \n " ;
3324 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3325 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3328 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3330 print FILE
"auth_param basic utf8 on \n " ;
3331 print FILE
"auth_param basic program $authdir /basic_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3332 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3333 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3334 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3336 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3338 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3340 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3342 print FILE
" -u sAMAccountName -P" ;
3344 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3346 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3348 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3350 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3352 print FILE
" -u cn -P" ;
3354 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3356 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3358 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3360 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3362 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3363 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3364 print FILE
" -u uid -P" ;
3366 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3367 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3368 print FILE
"auth_param basic realm $authrealm \n " ;
3369 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3370 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3373 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' )
3375 print FILE
"auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" ;
3376 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3377 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3378 $ntlm_auth_group =~ s/\\/\+/ ;
3380 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3384 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n\n " ;
3385 print FILE
"auth_param ntlm credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3387 # BASIC authentication
3388 if ( $proxysettings { 'NTLM_AUTH_BASIC' } eq "on" ) {
3389 print FILE
"auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic" ;
3390 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3391 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3392 $ntlm_auth_group =~ s/\\/\+/ ;
3394 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3397 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3398 print FILE
"auth_param basic realm $authrealm \n " ;
3399 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3403 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3405 print FILE
"auth_param basic program $authdir /basic_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3406 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3407 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3408 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3409 print FILE
"auth_param basic realm $authrealm \n " ;
3410 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3411 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3415 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3416 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3418 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3420 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3422 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3424 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3427 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3430 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3431 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3433 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3436 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3437 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3438 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3443 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3445 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3447 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3449 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3451 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3453 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3455 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3457 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3460 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3461 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3462 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3466 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3468 print FILE
"acl within_timeframe time " ;
3469 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3470 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3471 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3472 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3473 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3474 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3475 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3476 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3477 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3478 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3479 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3481 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3482 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3485 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3488 #Classroom extensions
3489 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3490 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3493 print FILE
"deny_info " ;
3494 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3496 print FILE
"ERR_ACCESS_DISABLED" ;
3498 print FILE
"ERR_ACCESS_DENIED" ;
3500 print FILE
" IPFire_no_access_ips \n " ;
3501 print FILE
"deny_info " ;
3502 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3504 print FILE
"ERR_ACCESS_DISABLED" ;
3506 print FILE
"ERR_ACCESS_DENIED" ;
3508 print FILE
" IPFire_no_access_mac \n " ;
3511 http_access deny IPFire_no_access_ips
3512 http_access deny IPFire_no_access_mac
3517 #Insert acl file and replace __VAR__ with correct values
3518 my $blue_net = '' ; #BLUE empty by default
3520 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3521 $blue_net = " $blue_cidr " ;
3522 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3524 if (!- z
$acl_include )
3526 open ( ACL
, " $acl_include " );
3527 print FILE
" \n #Start of custom includes \n\n " ;
3529 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3530 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3531 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3532 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3533 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3536 print FILE
" \n #End of custom includes \n " ;
3539 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3541 # Check if squidclamav is enabled.
3542 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3543 print FILE
" \n #Settings for squidclamav: \n " ;
3544 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} \n " ;
3545 print FILE
"acl purge method PURGE \n " ;
3546 print FILE
"http_access deny to_localhost \n " ;
3547 print FILE
"http_access allow localhost \n " ;
3548 print FILE
"http_access allow purge localhost \n " ;
3549 print FILE
"http_access deny purge \n " ;
3550 print FILE
"url_rewrite_access deny localhost \n " ;
3555 #local machine, no restriction
3556 http_access allow localhost
3558 #GUI admin if local machine connects
3559 http_access allow IPFire_ips IPFire_networks IPFire_http
3560 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3562 #Deny not web services
3566 print FILE
"http_access deny !Safe_ports \n " ;
3570 print FILE
"http_access deny CONNECT !SSL_ports \n " ;
3573 if ((( $proxysettings { 'ASNBL_FASTFLUX_DETECTION' } eq 'on' ) && (!- z
$proxysettings { 'ASNBL_FASTFLUX_THRESHOLD' })) || ( $proxysettings { 'ASNBL_SELECANN_DETECTION' } eq 'on' )) {
3574 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 " ;
3575 print FILE
"acl asnbl external asnblhelper \n " ;
3577 # Use the user-defined URL filter whitelist (if present and populated) for the ASNBL helper as well
3578 # Necessary for destinations such as fedoraproject.org, but we do not want to maintain a dedicated
3579 # or hardcoded list for such FQDNs.
3580 if ((- e
"${General::swroot}/urlfilter/blacklists/custom/allowed/domains" ) && (!- z
"${General::swroot}/urlfilter/blacklists/custom/allowed/domains" )) {
3581 print FILE
"acl asnbl_whitelisted_destinations dstdomain \" ${General::swroot}/urlfilter/blacklists/custom/allowed/domains \"\n " ;
3582 print FILE
"http_access deny asnbl !asnbl_whitelisted_destinations \n\n " ;
3584 print FILE
"http_access deny asnbl \n\n " ;
3587 # Write ASNBL helper configuration file...
3588 open ( ASNBLFILE
, ">${General::swroot}/proxy/asnbl-helper.conf" );
3589 flock ( ASNBLFILE
, 2 );
3591 print ASNBLFILE
<<END
3593 # This file has been automatically generated. Manual changes will be overwritten.
3598 ASNDB_PATH = /var/lib/location/database.db
3603 print ASNBLFILE
"AS_DIVERSITY_THRESHOLD = $proxysettings {'ASNBL_FASTFLUX_THRESHOLD'} \n " ;
3605 if ( $proxysettings { 'ASNBL_SELECANN_DETECTION' } eq 'on' ) {
3606 print ASNBLFILE
"BLOCK_SUSPECTED_SELECTIVE_ANNOUNCEMENTS = yes \n " ;
3608 print ASNBLFILE
"BLOCK_SUSPECTED_SELECTIVE_ANNOUNCEMENTS = no \n " ;
3611 if ( $proxysettings { 'ASNBL_FASTFLUX_DETECTION' } eq 'on' ) {
3612 print ASNBLFILE
"BLOCK_DIVERSITY_EXCEEDING_DESTINATIONS = yes \n " ;
3614 print ASNBLFILE
"BLOCK_DIVERSITY_EXCEEDING_DESTINATIONS = no \n " ;
3617 print ASNBLFILE
<<END
3618 TESTDATA = (10.0.0.1, 0) (127.0.0.1, 0) (fe80::1, 0)
3626 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3628 print FILE
"#Set ident ACLs \n " ;
3629 if (!- z
$identhosts )
3631 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3632 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3633 print FILE
"ident_lookup_access deny all \n " ;
3635 print FILE
"ident_lookup_access allow all \n " ;
3637 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3641 print FILE
"#Set download throttling \n " ;
3643 if ( $netsettings { 'BLUE_DEV' })
3645 print FILE
"delay_pools 2 \n " ;
3647 print FILE
"delay_pools 1 \n " ;
3650 print FILE
"delay_class 1 3 \n " ;
3651 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3653 print FILE
"delay_parameters 1 " ;
3654 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3658 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3660 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3663 print FILE
" -1/-1 " ;
3664 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3668 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3670 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3674 if ( $netsettings { 'BLUE_DEV' })
3676 print FILE
"delay_parameters 2 " ;
3677 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3681 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3683 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3685 print FILE
" -1/-1 " ;
3686 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3690 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3692 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3697 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3698 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3699 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3700 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3702 if ( $netsettings { 'BLUE_DEV' })
3704 if (& Header
:: green_used
()) {
3705 print FILE
"delay_access 1 allow IPFire_green_network" ;
3706 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3709 print FILE
"delay_access 1 deny all \n " ;
3711 print FILE
"delay_access 1 allow all" ;
3712 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3716 if ( $netsettings { 'BLUE_DEV' })
3718 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3719 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3720 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3721 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3722 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3723 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3725 print FILE
"delay_access 2 deny all \n " ;
3728 print FILE
"delay_initial_bucket_level 100 \n " ;
3732 if (& Header
:: green_used
() && $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3734 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3735 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3738 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3740 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3741 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3742 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3746 #Set custom configured ACLs
3749 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3750 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3752 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3754 if (!- z
$acl_src_unrestricted_ip )
3756 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3757 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3758 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3760 if (!- z
$acl_src_unrestricted_mac )
3762 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3763 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3764 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3766 if (!- z
$acl_dst_noauth_net )
3768 print FILE
"http_access allow IPFire_networks" ;
3769 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3770 print FILE
" !within_timeframe" ;
3772 print FILE
" within_timeframe" ; }
3773 print FILE
" to_ipaddr_without_auth \n " ;
3775 if (!- z
$acl_dst_noauth_dom )
3777 print FILE
"http_access allow IPFire_networks" ;
3778 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3779 print FILE
" !within_timeframe" ;
3781 print FILE
" within_timeframe" ; }
3782 print FILE
" to_domains_without_auth \n " ;
3784 if (!- z
$acl_dst_noauth_url )
3786 print FILE
"http_access allow IPFire_networks" ;
3787 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3788 print FILE
" !within_timeframe" ;
3790 print FILE
" within_timeframe" ; }
3791 print FILE
" to_hosts_without_auth \n " ;
3795 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3797 print FILE
"http_access deny !for_inetusers" ;
3798 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3803 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3804 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3805 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3806 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3807 (!- z
" $identdir /identauth.denyusers" )
3810 print FILE
"http_access deny for_acl_users" ;
3811 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3815 if (!- z
$acl_src_unrestricted_ip )
3817 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3818 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3820 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3822 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3824 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3826 print FILE
" for_inetusers" ;
3828 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3830 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3832 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3834 print FILE
" for_acl_users" ;
3836 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3838 print FILE
" !for_acl_users" ;
3840 } else { print FILE
" for_inetusers" ; }
3846 if (!- z
$acl_src_unrestricted_mac )
3848 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3849 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3851 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3853 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3855 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3857 print FILE
" for_inetusers" ;
3859 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3861 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3863 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3865 print FILE
" for_acl_users" ;
3867 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3869 print FILE
" !for_acl_users" ;
3871 } else { print FILE
" for_inetusers" ; }
3877 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3879 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3880 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3885 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3886 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3887 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3888 (!- z
" $raddir /radauth.denyusers" )
3892 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3893 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3894 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3895 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3896 (!- z
" $identdir /identauth.denyusers" )
3900 print FILE
"http_access deny for_acl_users" ;
3901 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3905 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3907 print FILE
"http_access allow" ;
3908 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3909 print FILE
" !within_timeframe" ;
3911 print FILE
" within_timeframe" ; }
3912 print FILE
" !on_ident_aware_hosts \n " ;
3915 print FILE
"http_access allow IPFire_networks" ;
3918 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3919 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3920 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3921 (!- z
" $raddir /radauth.allowusers" )
3925 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3926 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3927 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3928 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3929 (!- z
" $identdir /identauth.allowusers" )
3933 print FILE
" for_acl_users" ;
3934 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3935 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3936 print FILE
" for_inetusers" ;
3938 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3940 print FILE
" !concurrent" ;
3942 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3943 print FILE
" !within_timeframe" ;
3945 print FILE
" within_timeframe" ; }
3948 print FILE
"http_access deny all \n\n " ;
3950 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ))
3952 print FILE
"#Strip HTTP Header \n " ;
3954 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3956 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3957 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3959 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3961 print FILE
"request_header_access Via deny all \n " ;
3962 print FILE
"reply_header_access Via deny all \n " ;
3969 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3971 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3972 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3973 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3974 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3976 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3978 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3979 print FILE
"http_reply_access allow all \n\n " ;
3982 print FILE
"visible_hostname" ;
3983 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3985 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3987 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3990 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3991 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3994 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3996 # Write the parent proxy info, if needed.
3997 if ( $remotehost ne '' )
3999 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
4001 # Enter authentication for the parent cache. Option format is
4002 # login=user:password ($proxy1='YES')
4003 # login=PASS ($proxy1='PASS')
4004 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
4005 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
4007 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
4008 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
4010 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
4012 print FILE
" \n always_direct allow IPFire_ips \n " ;
4013 print FILE
"never_direct allow all \n\n " ;
4015 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
4017 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
4018 print FILE
"url_rewrite_children " , & General
:: number_cpu_cores
();
4019 print FILE
" startup=" , & General
:: number_cpu_cores
();
4020 print FILE
" idle=" , & General
:: number_cpu_cores
();
4021 print FILE
" queue-size=" , & General
:: number_cpu_cores
() * 32 , " \n\n " ;
4024 # Include file with user defined settings.
4025 if (- e
"/etc/squid/squid.conf.local" ) {
4026 print FILE
"include /etc/squid/squid.conf.local \n " ;
4030 # Proxy settings for squidclamav - if installed.
4032 # Check if squidclamav is enabled.
4033 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
4035 my $configfile = '/etc/squidclamav.conf' ;
4037 my $data = & General
:: read_file_utf8
( $configfile );
4038 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
4039 & General
:: write_file_utf8
( $configfile , $data );
4043 # -------------------------------------------------------------------
4047 my ( $str_user , $str_pass , $str_group ) = @_ ;
4048 my @groupmembers =();
4050 if ( $str_pass eq 'lEaVeAlOnE' )
4052 open ( FILE
, " $userdb " );
4053 @groupmembers = < FILE
>;
4055 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
4056 & deluser
( $str_user );
4057 open ( FILE
, ">> $userdb " );
4059 print FILE
" $str_user $str_pass " ;
4062 & deluser
( $str_user );
4064 my %htpasswd_options = (
4065 passwdFile
=> " $userdb " ,
4069 my $htpasswd = new Apache
:: Htpasswd
( \
%htpasswd_options );
4071 $htpasswd -> htpasswd ( $str_user , $str_pass );
4074 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
4075 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
4076 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
4078 print FILE
" $str_user \n " ;
4084 # -------------------------------------------------------------------
4088 my ( $str_user ) = @_ ;
4090 my @groupmembers =();
4093 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
4096 open ( FILE
, " $groupfile " );
4097 @groupmembers = < FILE
>;
4099 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
4100 open ( FILE
, "> $groupfile " );
4102 print FILE
@templist ;
4107 open ( FILE
, " $userdb " );
4108 @groupmembers = < FILE
>;
4110 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4111 open ( FILE
, "> $userdb " );
4113 print FILE
@templist ;
4119 # -------------------------------------------------------------------
4123 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4125 if (& Header
:: green_used
()) {
4126 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4128 print FILE
"localhost" ;
4133 # -------------------------------------------------------------------