]>
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-2020 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 # enable only the following on debugging purpose
27 #use CGI::Carp 'fatalsToBrowser';
29 require '/var/ipfire/general-functions.pl' ;
30 require "${General::swroot}/lang.pl" ;
31 require "${General::swroot}/header.pl" ;
33 require "${General::swroot}/ids-functions.pl" ;
35 my @squidversion = `/usr/sbin/squid -v` ;
40 my %mainsettings = ();
41 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
42 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
46 my %filtersettings =();
47 my %xlratorsettings =();
48 my %stdproxysettings =();
54 my @throttle_limits =( 64 , 128 , 256 , 512 , 1024 , 1536 , 2048 , 3072 , 4096 , 5120 , 6144 , 7168 , 8192 , 10240 , 16384 , 20480 , 51200 , 102400 );
56 my $def_ports_safe = "80 # http \n 21 # ftp \n 443 # https \n 563 # snews \n 70 # gopher \n 210 # wais \n 1025-65535 # unregistered ports \n 280 # http-mgmt \n 488 # gss-http \n 591 # filemaker \n 777 # multiling http \n 800 # Squids port (for icons) \n " ;
57 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
59 my $hintcolour = '#FFFFCC' ;
60 my $ncsa_buttontext = '' ;
75 my $browser_regexp = '' ;
79 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
80 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
81 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
82 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
83 my $credir = "${General::swroot}/proxy/advanced/cre" ;
85 my $userdb = " $ncsadir /passwd" ;
86 my $stdgrp = " $ncsadir /standard.grp" ;
87 my $extgrp = " $ncsadir /extended.grp" ;
88 my $disgrp = " $ncsadir /disabled.grp" ;
90 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
91 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
93 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
94 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
95 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
97 my $identhosts = " $identdir /hosts" ;
99 my $authdir = "/usr/lib/squid" ;
100 my $errordir = "/usr/lib/squid/errors" ;
102 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
103 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
104 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
105 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
106 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
107 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
108 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
109 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
110 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
111 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
112 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
113 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
114 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
115 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
116 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
117 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
118 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
119 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
120 my $acl_include = " $acldir /include.acl" ;
122 my $acl_dst_noproxy_url = " $acldir /dst_noproxy_url.acl" ;
123 my $acl_dst_noproxy_ip = " $acldir /dst_noproxy_ip.acl" ;
125 my $updaccelversion = 'n/a' ;
126 my $urlfilterversion = 'n/a' ;
128 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
129 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
130 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
131 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
132 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
134 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
135 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
137 unless (- e
$userdb ) { system ( "touch $userdb " ); }
138 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
139 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
140 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
142 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
143 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
144 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
145 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
146 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
147 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
148 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
149 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
150 unless (- e
$acl_dst_noauth_dom ) { system ( "touch $acl_dst_noauth_dom " ); }
151 unless (- e
$acl_dst_noauth_net ) { system ( "touch $acl_dst_noauth_net " ); }
152 unless (- e
$acl_dst_noauth_url ) { system ( "touch $acl_dst_noauth_url " ); }
153 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
154 unless (- e
$acl_dst_nocache_dom ) { system ( "touch $acl_dst_nocache_dom " ); }
155 unless (- e
$acl_dst_nocache_net ) { system ( "touch $acl_dst_nocache_net " ); }
156 unless (- e
$acl_dst_nocache_url ) { system ( "touch $acl_dst_nocache_url " ); }
157 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
158 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
159 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
160 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
162 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
164 my $HAVE_NTLM_AUTH = (- e
"/usr/bin/ntlm_auth" );
166 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
167 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
169 my $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
171 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
172 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
175 & Header
:: showhttpheaders
();
177 $proxysettings { 'ACTION' } = '' ;
178 $proxysettings { 'VALID' } = '' ;
180 $proxysettings { 'ENABLE' } = 'off' ;
181 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
182 $proxysettings { 'TRANSPARENT' } = 'off' ;
183 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
184 $proxysettings { 'PROXY_PORT' } = '800' ;
185 $proxysettings { 'TRANSPARENT_PORT' } = '3128' ;
186 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
187 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
188 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
189 $proxysettings { 'ERR_LANGUAGE' } = 'en' ;
190 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
191 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
192 $proxysettings { 'FORWARD_VIA' } = 'off' ;
193 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
194 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
195 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
196 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
197 $proxysettings { 'UPSTREAM_USER' } = '' ;
198 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
199 $proxysettings { 'LOGGING' } = 'off' ;
200 $proxysettings { 'CACHEMGR' } = 'off' ;
201 $proxysettings { 'LOGQUERY' } = 'off' ;
202 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
203 $proxysettings { 'FILEDESCRIPTORS' } = '16384' ;
204 $proxysettings { 'CACHE_MEM' } = '128' ;
205 $proxysettings { 'CACHE_SIZE' } = '0' ;
206 $proxysettings { 'MAX_SIZE' } = '4096' ;
207 $proxysettings { 'MIN_SIZE' } = '0' ;
208 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
209 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
210 $proxysettings { 'L1_DIRS' } = '16' ;
211 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
212 $proxysettings { 'CACHE_DIGESTS' } = 'off' ;
213 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
214 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
215 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
216 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
217 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
218 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
219 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
220 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
221 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
222 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
223 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
224 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
225 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
226 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
227 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
228 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
229 $proxysettings { 'FAKE_USERAGENT' } = '' ;
230 $proxysettings { 'FAKE_REFERER' } = '' ;
231 $proxysettings { 'AUTH_METHOD' } = 'none' ;
232 $proxysettings { 'AUTH_REALM' } = '' ;
233 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
234 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
235 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
236 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
237 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
238 $proxysettings { 'NCSA_USERNAME' } = '' ;
239 $proxysettings { 'NCSA_GROUP' } = '' ;
240 $proxysettings { 'NCSA_PASS' } = '' ;
241 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
242 $proxysettings { 'LDAP_BASEDN' } = '' ;
243 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
244 $proxysettings { 'LDAP_SERVER' } = '' ;
245 $proxysettings { 'LDAP_PORT' } = '389' ;
246 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
247 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
248 $proxysettings { 'LDAP_GROUP' } = '' ;
249 $proxysettings { 'NTLM_AUTH_GROUP' } = '' ;
250 $proxysettings { 'NTLM_AUTH_BASIC' } = 'off' ;
251 $proxysettings { 'NTLM_DOMAIN' } = '' ;
252 $proxysettings { 'NTLM_PDC' } = '' ;
253 $proxysettings { 'NTLM_BDC' } = '' ;
254 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
255 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
256 $proxysettings { 'RADIUS_SERVER' } = '' ;
257 $proxysettings { 'RADIUS_PORT' } = '1812' ;
258 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
259 $proxysettings { 'RADIUS_SECRET' } = '' ;
260 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
261 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
262 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
263 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
264 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
265 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
266 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
267 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
268 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
270 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
272 & Header
:: getcgihash
( \
%proxysettings );
274 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
275 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
276 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
277 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
279 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
281 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
284 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
286 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
287 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
288 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
290 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
291 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
293 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
294 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
296 if (! $errormessage ) {
297 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
298 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
300 $proxysettings { 'NCSA_USERNAME' } = '' ;
301 $proxysettings { 'NCSA_GROUP' } = '' ;
302 $proxysettings { 'NCSA_PASS' } = '' ;
303 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
306 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
308 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
309 & deluser
( $proxysettings { 'ID' });
312 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
313 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
314 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
316 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
318 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
319 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
320 @temp = split ( /:/ , $proxysettings { 'ID' });
321 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
322 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
323 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
324 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
327 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
329 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
330 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
331 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
332 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
333 $errormessage = $Lang :: tr
{ 'invalid input' };
336 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
337 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
341 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
343 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
346 if (!(& General
:: validport
( $proxysettings { 'TRANSPARENT_PORT' })))
348 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
351 if ( $proxysettings { 'PROXY_PORT' } eq $proxysettings { 'TRANSPARENT_PORT' }) {
352 $errormessage = $Lang :: tr
{ 'advproxy errmsg proxy ports equal' };
355 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
357 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
358 if (!(& General
:: validip
( $temp [ 0 ])))
360 if (!(& General
:: validdomainname
( $temp [ 0 ])))
362 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
367 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
368 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
370 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
372 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
376 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
377 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 1048576 ))
379 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
382 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ))
384 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
387 my @free = `/usr/bin/free` ;
388 $free [ 1 ] =~ m/(\d+)/ ;
389 $cachemem = int $1 / 2048 ;
390 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
391 $proxysettings { 'CACHE_MEM' } = $cachemem ;
393 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
395 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
398 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
400 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
403 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
405 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
408 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
410 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
413 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
415 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
418 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
420 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
421 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
422 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
424 if ( $netsettings { 'BLUE_DEV' })
426 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
427 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
429 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
433 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
435 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
440 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
442 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
445 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
446 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
448 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
451 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' ))
453 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
456 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
458 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
462 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
464 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
466 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
470 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
472 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
474 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
478 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
480 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
482 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
485 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
487 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
489 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
493 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
495 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
498 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
500 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
502 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
507 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
509 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
511 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
514 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
516 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
519 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
521 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
526 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
529 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
530 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
531 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
532 if (( $proxy1 ne $proxy2 ))
534 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
542 $proxysettings { 'VALID' } = 'no' ; }
544 $proxysettings { 'VALID' } = 'yes' ; }
546 if ( $proxysettings { 'VALID' } eq 'yes' )
548 # Determine if suricata may needs to be restarted.
549 my $suricata_proxy_ports_changed ;
551 # Check if the IDS is running
552 if (& IDS
:: ids_is_running
()) {
553 my %oldproxysettings ;
555 # Read-in current proxy settings and store them as oldsettings hash.
556 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%oldproxysettings );
558 # Check if the proxy port has been changed.
559 unless ( $proxysettings { 'PROXY_PORT' } eq $oldproxysettings { 'PROXY_PORT' }) {
560 # Port has changed, suricata needs to be adjusted.
561 $suricata_proxy_ports_changed = 1 ;
564 # Check if the transparent port has been changed.
565 unless ( $proxysettings { 'TRANSPARENT_PORT' } eq $oldproxysettings { 'TRANSPARENT_PORT' }) {
566 # Transparent port has changed, suricata needs to be adjusted.
567 $suricata_proxy_ports_changed = 1 ;
573 delete $proxysettings { 'SRC_SUBNETS' };
574 delete $proxysettings { 'SRC_BANNED_IP' };
575 delete $proxysettings { 'SRC_BANNED_MAC' };
576 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
577 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
578 delete $proxysettings { 'DST_NOCACHE' };
579 delete $proxysettings { 'DST_NOAUTH' };
580 delete $proxysettings { 'DST_NOPROXY_IP' };
581 delete $proxysettings { 'DST_NOPROXY_URL' };
582 delete $proxysettings { 'PORTS_SAFE' };
583 delete $proxysettings { 'PORTS_SSL' };
584 delete $proxysettings { 'MIME_TYPES' };
585 delete $proxysettings { 'NTLM_ALLOW_USERS' };
586 delete $proxysettings { 'NTLM_DENY_USERS' };
587 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
588 delete $proxysettings { 'RADIUS_DENY_USERS' };
589 delete $proxysettings { 'IDENT_HOSTS' };
590 delete $proxysettings { 'IDENT_ALLOW_USERS' };
591 delete $proxysettings { 'IDENT_DENY_USERS' };
593 delete $proxysettings { 'CRE_GROUPS' };
594 delete $proxysettings { 'CRE_SVHOSTS' };
596 delete $proxysettings { 'NCSA_USERNAME' };
597 delete $proxysettings { 'NCSA_GROUP' };
598 delete $proxysettings { 'NCSA_PASS' };
599 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
601 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
602 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
603 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
604 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
605 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
606 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
607 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
609 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
610 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
612 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
614 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
615 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
616 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
617 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
618 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
619 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
620 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
621 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
622 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
627 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
629 system ( '/usr/local/bin/squidctrl' , 'disable' );
630 unlink "${General::swroot}/proxy/enable" ;
631 unlink "${General::swroot}/proxy/transparent" ;
632 unlink "${General::swroot}/proxy/enable_blue" ;
633 unlink "${General::swroot}/proxy/transparent_blue" ;
635 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
636 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
637 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
638 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
639 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
640 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
641 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
642 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
643 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
644 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
646 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
647 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { system ( '/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1' ); }
649 # Check if the suricata_proxy_ports_changed flag has been set.
650 if ( $suricata_proxy_ports_changed ) {
651 # Re-generate HTTP ports file.
652 & IDS
:: generate_http_ports_file
();
655 & IDS
:: call_suricatactrl
( "restart" );
660 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
662 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
667 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
668 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
669 } elsif (- e
"${General::swroot}/proxy/settings" ) {
670 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
675 # ------------------------------------------------------------------
677 # Hook to regenerate the configuration files, if cgi got called from command line.
678 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
683 # -------------------------------------------------------------------
685 $checked { 'ENABLE' }{ 'off' } = '' ;
686 $checked { 'ENABLE' }{ 'on' } = '' ;
687 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
689 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
690 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
691 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
693 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
694 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
695 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
697 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
698 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
699 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
701 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
702 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
703 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
705 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
706 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
707 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
708 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
709 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
710 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
711 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
712 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
713 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
714 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
715 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
716 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
718 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
719 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
720 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
721 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
722 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
723 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
724 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
725 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
726 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
728 $checked { 'LOGGING' }{ 'off' } = '' ;
729 $checked { 'LOGGING' }{ 'on' } = '' ;
730 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
731 $checked { 'CACHEMGR' }{ 'off' } = '' ;
732 $checked { 'CACHEMGR' }{ 'on' } = '' ;
733 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
734 $checked { 'LOGQUERY' }{ 'off' } = '' ;
735 $checked { 'LOGQUERY' }{ 'on' } = '' ;
736 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
737 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
738 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
739 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
741 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
742 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
744 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
745 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
746 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
747 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
748 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
749 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
751 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
752 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
753 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
755 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
756 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
757 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
758 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
759 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
761 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
762 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
763 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
764 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
765 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
766 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
767 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
769 $checked { 'TIME_MON' }{ 'off' } = '' ;
770 $checked { 'TIME_MON' }{ 'on' } = '' ;
771 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
772 $checked { 'TIME_TUE' }{ 'off' } = '' ;
773 $checked { 'TIME_TUE' }{ 'on' } = '' ;
774 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
775 $checked { 'TIME_WED' }{ 'off' } = '' ;
776 $checked { 'TIME_WED' }{ 'on' } = '' ;
777 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
778 $checked { 'TIME_THU' }{ 'off' } = '' ;
779 $checked { 'TIME_THU' }{ 'on' } = '' ;
780 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
781 $checked { 'TIME_FRI' }{ 'off' } = '' ;
782 $checked { 'TIME_FRI' }{ 'on' } = '' ;
783 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
784 $checked { 'TIME_SAT' }{ 'off' } = '' ;
785 $checked { 'TIME_SAT' }{ 'on' } = '' ;
786 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
787 $checked { 'TIME_SUN' }{ 'off' } = '' ;
788 $checked { 'TIME_SUN' }{ 'on' } = '' ;
789 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
791 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
792 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
793 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
794 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
796 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
797 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
798 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
800 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
801 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
802 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
803 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
804 $checked { 'AUTH_METHOD' }{ 'ntlm-auth' } = '' ;
805 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
806 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
808 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
810 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
811 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
812 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
814 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
815 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
816 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
818 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
820 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
822 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
824 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
825 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
826 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
828 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
829 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
830 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
832 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
833 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
834 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
836 $checked { 'NTLM_AUTH_BASIC' }{ 'on' } = '' ;
837 $checked { 'NTLM_AUTH_BASIC' }{ 'off' } = '' ;
838 $checked { 'NTLM_AUTH_BASIC' }{ $proxysettings { 'NTLM_AUTH_BASIC' }} = "checked='checked'" ;
840 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
841 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
842 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
844 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
845 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
846 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
848 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
849 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
850 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
852 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
853 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
854 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
856 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
857 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
858 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
860 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
861 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
862 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
864 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
865 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
866 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
868 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
869 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
870 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
872 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
874 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
877 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
878 print "<font class='base'> $errormessage </font> \n " ;
882 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
884 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
885 $squidversion [ 0 ] =~ s/^\s+//g ;
886 $squidversion [ 0 ] =~ s/\s+$//g ;
888 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
891 # ===================================================================
893 # ===================================================================
895 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
897 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
899 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
904 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
907 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
908 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
909 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td>
910 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
913 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
914 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
915 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td>
916 <td width='30%'><input type='text' name='TRANSPARENT_PORT' value=' $proxysettings {'TRANSPARENT_PORT'}' size='5' /></td>
921 if ( $netsettings { 'BLUE_DEV' }) {
922 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
923 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
925 print "<td colspan='2'> </td>" ;
928 <td class='base'> $Lang ::tr{'advproxy visible hostname'}:</td>
929 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
934 if ( $netsettings { 'BLUE_DEV' }) {
935 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
936 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
938 print "<td colspan='2'> </td>" ;
941 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
943 <select name='ERR_LANGUAGE'>
946 foreach (< $errordir /*>) {
948 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
949 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
957 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
958 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
959 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
960 <td class='base'><select name='ERR_DESIGN'>
961 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
962 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
966 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
967 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
976 if ( - e
"/usr/bin/squidclamav" ) {
977 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
978 if ( ! - e
"/var/run/clamav/clamd.pid" ){
979 print "<font color='red'>clamav not running</font><br /><br />" ;
980 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
983 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
989 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</a></b><br />" ;
990 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
992 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</a></b><br />" ;
993 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1000 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1003 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1004 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1005 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}:</td>
1006 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1009 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1010 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1011 <td class='base'> $Lang ::tr{'advproxy upstream username'}:</td>
1012 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1015 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1016 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1017 <td class='base'> $Lang ::tr{'advproxy upstream password'}:</td>
1018 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1021 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1022 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1028 <table width='100%'>
1030 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1033 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1034 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1035 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1036 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1041 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1042 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1046 <table width='100%'>
1048 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1051 <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'> $Lang ::tr{'proxy cachemgr'}:</td>
1052 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1053 <td class='base'> $Lang ::tr{'advproxy admin mail'}:</td>
1054 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1057 <td class='base'> $Lang ::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td>
1058 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1059 <td class='base'> $Lang ::tr{'proxy admin password'}:</td>
1060 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1063 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1066 <td class='base'> $Lang ::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td>
1067 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1068 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td>
1069 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1072 <td class='base'> $Lang ::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td>
1073 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1074 <td class='base'> $Lang ::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td>
1075 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1078 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1079 <td class='base'><select name='L1_DIRS'>
1080 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1081 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1082 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1083 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1084 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1086 <td colspan='2' rowspan= '5' valign='top' class='base'>
1087 <table cellspacing='0' cellpadding='0'>
1089 <!-- intentionally left empty -->
1092 <td> $Lang ::tr{'advproxy no cache sites'}:</td>
1095 <!-- intentionally left empty -->
1098 <!-- intentionally left empty -->
1101 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1105 print $proxysettings { 'DST_NOCACHE' };
1114 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1115 <td class='base'><select name='MEM_POLICY'>
1116 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1117 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1118 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1119 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1123 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1124 <td class='base'><select name='CACHE_POLICY'>
1125 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1126 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1127 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1128 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1132 <td colspan='2'> </td>
1135 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1136 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1139 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1140 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1144 <table width='100%'>
1146 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1149 <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
1152 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td>
1153 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td>
1156 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1159 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1163 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1166 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1173 <table width='100%'>
1175 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1178 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1181 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td>
1184 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1188 if (! $proxysettings { 'SRC_SUBNETS' })
1190 print " $green_cidr \n " ;
1191 if ( $netsettings { 'BLUE_DEV' })
1193 print " $blue_cidr \n " ;
1195 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1202 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1203 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1204 print "<td class='base'> $line :</td> \n " ;
1206 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1210 if ( $netsettings { 'BLUE_DEV' }) {
1211 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1212 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1214 print "<td class='base'> $line :</td> \n " ;
1216 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1223 <td colspan='2'> </td>
1226 <td colspan='2'> </td>
1229 <table width='100%'>
1231 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1234 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}:</td>
1235 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}:</td>
1238 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1242 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1246 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1250 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1256 <table width='100%'>
1258 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1261 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}:</td>
1262 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}:</td>
1265 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1269 print $proxysettings { 'SRC_BANNED_IP' };
1273 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1277 print $proxysettings { 'SRC_BANNED_MAC' };
1288 # -------------------------------------------------------------------
1289 # CRE GUI - optional
1290 # -------------------------------------------------------------------
1292 if (- e
$cre_enabled ) { print <<END
1293 <table width='100%'>
1296 <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>
1299 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1305 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1307 <td class='base'> $Lang ::tr{'advproxy supervisor password'}:</td>
1308 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1311 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1312 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}:</td>
1317 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1320 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1324 print $proxysettings { 'CRE_GROUPS' };
1328 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1331 print $proxysettings { 'CRE_SVHOSTS' };
1339 print "</table><hr size='1'>" ;
1343 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1344 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1345 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1350 # ===================================================================
1352 # ===================================================================
1355 <table width='100%'>
1357 <td colspan='4'><b> $Lang ::tr{'advproxy wpad title'}</b></td>
1360 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1363 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_ip'}:</td>
1364 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad label dst_noproxy_url'}:</td>
1367 <td colspan='2'><textarea name='DST_NOPROXY_IP' cols='32' rows='3' wrap='off'>
1371 print $proxysettings { 'DST_NOPROXY_IP' };
1376 <td colspan='2'><textarea name='DST_NOPROXY_URL' cols='32' rows='3' wrap='off'>
1380 print $proxysettings { 'DST_NOPROXY_URL' };
1386 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_ip'}</td>
1387 <td colspan='2' class='base'> $Lang ::tr{'advproxy wpad example dst_noproxy_url'}</td>
1390 <td colspan="4"> </td>
1393 <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>
1396 <td colspan="4"> </td>
1399 <td colspan="4"> $Lang ::tr{'advproxy wpad notice'}</td>
1408 # -------------------------------------------------------------------
1412 <table width='100%'>
1414 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1416 <table width='100%'>
1418 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1419 <td width='1%'> </td>
1420 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1421 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1422 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1423 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1424 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1425 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1426 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1427 <td width='1%'> </td>
1428 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1429 <td width='1%'> </td>
1430 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1435 <select name='TIME_ACCESS_MODE'>
1436 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1437 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1441 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1442 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1443 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1444 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1445 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1446 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1447 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1450 <select name='TIME_FROM_HOUR'>
1453 for ( $i = 0 ; $i <= 24 ; $i ++) {
1454 $_ = sprintf ( " %02s " , $i );
1455 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1462 <select name='TIME_FROM_MINUTE'>
1465 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1466 $_ = sprintf ( " %02s " , $i );
1467 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1474 <select name='TIME_TO_HOUR'>
1477 for ( $i = 0 ; $i <= 24 ; $i ++) {
1478 $_ = sprintf ( " %02s " , $i );
1479 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1486 <select name='TIME_TO_MINUTE'>
1489 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1490 $_ = sprintf ( " %02s " , $i );
1491 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1499 <table width='100%'>
1501 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1504 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td>
1505 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1506 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td>
1507 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1511 <table width='100%'>
1513 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1516 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1517 <td width='20%' class='base'>
1518 <select name='THROTTLING_GREEN_TOTAL'>
1522 foreach ( @throttle_limits ) {
1524 my $unit = "kbit/s" ;
1531 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $val $unit </option> \n " ;
1535 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1538 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1539 <td width='30%' class='base'>
1540 <select name='THROTTLING_GREEN_HOST'>
1544 foreach ( @throttle_limits ) {
1545 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1549 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1556 if ( $netsettings { 'BLUE_DEV' }) {
1559 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1561 <select name='THROTTLING_BLUE_TOTAL'>
1565 foreach ( @throttle_limits ) {
1566 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1570 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1573 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1575 <select name='THROTTLING_BLUE_HOST'>
1579 foreach ( @throttle_limits ) {
1580 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1584 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1595 <table width='100%'>
1597 <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>
1601 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1604 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}:</td>
1609 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1613 print $proxysettings { 'MIME_TYPES' };
1628 <table width='100%'>
1630 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1633 <td class='base'> $Lang ::tr{'advproxy fake useragent'}:</td>
1634 <td class='base'> $Lang ::tr{'advproxy fake referer'}:</td>
1637 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='40%' /></td>
1638 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='40%' /></td>
1645 my $auth_columns = 5 ;
1646 if ( $HAVE_NTLM_AUTH ) {
1649 my $auth_column_width = 100 / $auth_columns ;
1652 <table width='100%'>
1654 <td colspan=' $auth_columns '><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1657 <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>
1658 <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>
1659 <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>
1660 <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>
1663 if ( $HAVE_NTLM_AUTH ) {
1665 <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>
1670 <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>
1676 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1678 <table width='100%'>
1680 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1683 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1686 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1687 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1688 <td colspan='2' rowspan= '6' valign='top' class='base'>
1689 <table cellpadding='0' cellspacing='0'>
1691 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}:</td>
1694 <!-- intentionally left empty -->
1697 <!-- intentionally left empty -->
1700 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1703 <!-- intentionally left empty -->
1706 <!-- intentionally left empty -->
1709 <td> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1712 <!-- intentionally left empty -->
1715 <!-- intentionally left empty -->
1718 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1722 print $proxysettings { 'DST_NOAUTH' };
1731 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1732 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1735 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}:</td>
1736 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1739 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1740 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1743 <td colspan='2'> </td>
1750 # ===================================================================
1751 # NCSA auth settings
1752 # ===================================================================
1754 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1757 <table width='100%'>
1759 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1762 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1763 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1764 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1765 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1768 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1776 # ===================================================================
1777 # IDENTD auth settings
1778 # ===================================================================
1780 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1783 <table width='100%'>
1785 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1788 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1789 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1790 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1791 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1794 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1795 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1800 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1801 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1804 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1807 if (! $proxysettings { 'IDENT_HOSTS' }) {
1808 print " $green_cidr \n " ;
1809 if ( $netsettings { 'BLUE_DEV' }) {
1810 print " $blue_cidr \n " ;
1813 print $proxysettings { 'IDENT_HOSTS' };
1818 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1822 print $proxysettings { 'DST_NOAUTH' };
1829 <table width='100%'>
1831 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1834 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1835 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1836 <td width='25%'> </td>
1837 <td width='30%'> </td>
1840 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1841 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1842 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1843 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1846 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1847 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1850 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1854 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1856 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1858 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1862 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1864 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1871 # ===================================================================
1872 # NTLM-AUTH settings
1873 # ===================================================================
1875 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' ) {
1878 <table width='100%'>
1879 <td width='20%' class='base'> $Lang ::tr{'advproxy basic authentication'}:</td>
1880 <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked {'NTLM_AUTH_BASIC'}{'on'} /></td>
1881 <td colspan='2'> </td>
1886 <table width='100%'>
1888 <td colspan='4'><b> $Lang ::tr{'advproxy group access control'}</b></td>
1891 <td width='20%' class='base'> $Lang ::tr{'advproxy group required'}:</td>
1892 <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value=' $proxysettings {'NTLM_AUTH_GROUP'}' size='37' /></td>
1900 # ===================================================================
1901 # LDAP auth settings
1902 # ===================================================================
1904 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1907 <table width='100%'>
1909 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1912 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1913 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1914 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1915 <td class='base'><select name='LDAP_TYPE'>
1916 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1917 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1918 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1919 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1923 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1924 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1925 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1926 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1930 <table width='100%'>
1932 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1935 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1936 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1937 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1938 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1942 <table width='100%'>
1944 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1947 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}:</td>
1948 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1956 # ===================================================================
1957 # RADIUS auth settings
1958 # ===================================================================
1960 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
1963 <table width='100%'>
1965 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
1968 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
1969 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
1970 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
1971 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
1974 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}:</td>
1975 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
1976 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
1977 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
1981 <table width='100%'>
1983 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
1986 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1987 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
1988 <td width='25%'> </td>
1989 <td width='30%'> </td>
1992 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
1993 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
1994 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
1995 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
1998 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
1999 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2002 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2006 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2008 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2010 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2014 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2016 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2023 # ===================================================================
2029 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2031 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2032 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2033 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2034 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2035 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2036 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2040 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2042 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2043 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2044 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2045 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2049 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2051 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2052 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2056 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2058 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2059 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2060 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2061 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2062 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2063 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2064 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2068 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2070 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2071 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2072 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2073 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2074 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2075 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2076 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2080 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2082 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2083 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2084 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2085 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2086 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2087 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2088 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2089 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2101 <table width='100%'>
2104 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2105 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2106 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2107 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2113 <table width='100%'>
2115 <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'> $Lang ::tr{'required field'}</font></td>
2116 <td align='right'> </td>
2123 & Header
:: closebox
();
2127 # ===================================================================
2128 # NCSA user management
2129 # ===================================================================
2131 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2133 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2134 <table width='100%'>
2136 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2139 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2140 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2143 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly='readonly' " ; }
2146 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2148 <select name='NCSA_GROUP'>
2149 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2150 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2151 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2157 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2158 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2159 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2160 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2167 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2168 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2169 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2172 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2173 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2179 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2184 <table width='100%'>
2186 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2189 <table width='100%' align='center'>
2195 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2196 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2200 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2201 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2205 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2206 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2209 @userlist = sort ( @userlist );
2211 # If the password file contains entries, print entries and action icons
2213 if ( ! - z
" $userdb " ) {
2216 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2217 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2218 <td class='boldbase' colspan='2' align='center'> </td>
2223 foreach $line ( @userlist )
2227 @temp = split ( /:/ , $line );
2228 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2229 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2231 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2233 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2236 <td align='center'> $temp [0]</td>
2240 if ( $temp [ 1 ] eq 'standard' ) {
2241 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2242 } elsif ( $temp [ 1 ] eq 'extended' ) {
2243 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2244 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2245 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2248 <td width='8%' align='center'>
2249 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2250 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2251 <input type='hidden' name='ID' value=' $line ' />
2252 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2256 <td width='8%' align='center'>
2257 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2258 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2259 <input type='hidden' name='ID' value=' $temp [0]' />
2260 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2273 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2274 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2275 <td class='base'> $Lang ::tr{'edit'}</td>
2276 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2277 <td class='base'> $Lang ::tr{'remove'}</td>
2284 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2295 & Header
:: closebox
();
2299 # ===================================================================
2301 & Header
:: closebigbox
();
2303 & Header
:: closepage
();
2305 # -------------------------------------------------------------------
2309 if (- e
" $acl_src_subnets " ) {
2310 open ( FILE
, " $acl_src_subnets " );
2311 delete $proxysettings { 'SRC_SUBNETS' };
2312 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2315 if (- e
" $acl_src_banned_ip " ) {
2316 open ( FILE
, " $acl_src_banned_ip " );
2317 delete $proxysettings { 'SRC_BANNED_IP' };
2318 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2321 if (- e
" $acl_src_banned_mac " ) {
2322 open ( FILE
, " $acl_src_banned_mac " );
2323 delete $proxysettings { 'SRC_BANNED_MAC' };
2324 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2327 if (- e
" $acl_src_unrestricted_ip " ) {
2328 open ( FILE
, " $acl_src_unrestricted_ip " );
2329 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2330 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2333 if (- e
" $acl_src_unrestricted_mac " ) {
2334 open ( FILE
, " $acl_src_unrestricted_mac " );
2335 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2336 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2339 if (- e
" $acl_dst_nocache " ) {
2340 open ( FILE
, " $acl_dst_nocache " );
2341 delete $proxysettings { 'DST_NOCACHE' };
2342 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2345 if (- e
" $acl_dst_noauth " ) {
2346 open ( FILE
, " $acl_dst_noauth " );
2347 delete $proxysettings { 'DST_NOAUTH' };
2348 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2351 if (- e
" $acl_dst_noproxy_ip " ) {
2352 open ( FILE
, " $acl_dst_noproxy_ip " );
2353 delete $proxysettings { 'DST_NOPROXY_IP' };
2354 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_IP' } .= $_ };
2357 if (- e
" $acl_dst_noproxy_url " ) {
2358 open ( FILE
, " $acl_dst_noproxy_url " );
2359 delete $proxysettings { 'DST_NOPROXY_URL' };
2360 while (< FILE
>) { $proxysettings { 'DST_NOPROXY_URL' } .= $_ };
2363 if (- e
" $acl_ports_safe " ) {
2364 open ( FILE
, " $acl_ports_safe " );
2365 delete $proxysettings { 'PORTS_SAFE' };
2366 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2369 if (- e
" $acl_ports_ssl " ) {
2370 open ( FILE
, " $acl_ports_ssl " );
2371 delete $proxysettings { 'PORTS_SSL' };
2372 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2375 if (- e
" $mimetypes " ) {
2376 open ( FILE
, " $mimetypes " );
2377 delete $proxysettings { 'MIME_TYPES' };
2378 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2381 if (- e
" $raddir /radauth.allowusers" ) {
2382 open ( FILE
, " $raddir /radauth.allowusers" );
2383 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2384 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2387 if (- e
" $raddir /radauth.denyusers" ) {
2388 open ( FILE
, " $raddir /radauth.denyusers" );
2389 delete $proxysettings { 'RADIUS_DENY_USERS' };
2390 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2393 if (- e
" $identdir /identauth.allowusers" ) {
2394 open ( FILE
, " $identdir /identauth.allowusers" );
2395 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2396 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2399 if (- e
" $identdir /identauth.denyusers" ) {
2400 open ( FILE
, " $identdir /identauth.denyusers" );
2401 delete $proxysettings { 'IDENT_DENY_USERS' };
2402 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2405 if (- e
" $identhosts " ) {
2406 open ( FILE
, " $identhosts " );
2407 delete $proxysettings { 'IDENT_HOSTS' };
2408 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2411 if (- e
" $cre_groups " ) {
2412 open ( FILE
, " $cre_groups " );
2413 delete $proxysettings { 'CRE_GROUPS' };
2414 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2417 if (- e
" $cre_svhosts " ) {
2418 open ( FILE
, " $cre_svhosts " );
2419 delete $proxysettings { 'CRE_SVHOSTS' };
2420 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2425 # -------------------------------------------------------------------
2429 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2430 undef $proxysettings { 'PORTS_SAFE' };
2433 s/^\s+//g ; s/\s+$//g ;
2437 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2439 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2440 @templist = split ( /-/ );
2441 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2442 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2446 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2447 undef $proxysettings { 'PORTS_SSL' };
2450 s/^\s+//g ; s/\s+$//g ;
2455 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2456 @templist = split ( /-/ );
2457 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2458 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2462 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2463 undef $proxysettings { 'DST_NOCACHE' };
2467 unless ( /^#/ ) { s/\s+//g ; }
2470 if ( /^\./ ) { $_ = '*' . $_ ; }
2471 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2475 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2476 undef $proxysettings { 'SRC_SUBNETS' };
2479 s/^\s+//g ; s/\s+$//g ;
2482 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2483 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2487 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2488 undef $proxysettings { 'SRC_BANNED_IP' };
2491 s/^\s+//g ; s/\s+$//g ;
2494 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2495 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2499 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2500 undef $proxysettings { 'SRC_BANNED_MAC' };
2503 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2506 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2507 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2511 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2512 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2515 s/^\s+//g ; s/\s+$//g ;
2518 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2519 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2523 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2524 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2527 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2530 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2531 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2535 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2536 undef $proxysettings { 'DST_NOAUTH' };
2540 unless ( /^#/ ) { s/\s+//g ; }
2543 if ( /^\./ ) { $_ = '*' . $_ ; }
2544 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2548 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_IP' });
2549 undef $proxysettings { 'DST_NOPROXY_IP' };
2552 s/^\s+//g ; s/\s+$//g ;
2555 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg wpad invalid ip or mask' }; }
2556 $proxysettings { 'DST_NOPROXY_IP' } .= $_ . " \n " ;
2560 @temp = split ( /\n/ , $proxysettings { 'DST_NOPROXY_URL' });
2561 undef $proxysettings { 'DST_NOPROXY_URL' };
2565 unless ( /^#/ ) { s/\s+//g ; }
2568 if ( /^\./ ) { $_ = '*' . $_ ; }
2569 $proxysettings { 'DST_NOPROXY_URL' } .= $_ . " \n " ;
2573 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2575 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2576 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2579 s/^\s+//g ; s/\s+$//g ;
2580 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2582 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2585 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2587 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2588 undef $proxysettings { 'NTLM_DENY_USERS' };
2591 s/^\s+//g ; s/\s+$//g ;
2592 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2594 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2597 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2599 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2600 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2603 s/^\s+//g ; s/\s+$//g ;
2604 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2606 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2609 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2611 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2612 undef $proxysettings { 'IDENT_DENY_USERS' };
2615 s/^\s+//g ; s/\s+$//g ;
2616 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2618 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2621 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2623 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2624 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2627 s/^\s+//g ; s/\s+$//g ;
2628 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2630 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2633 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2635 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2636 undef $proxysettings { 'RADIUS_DENY_USERS' };
2639 s/^\s+//g ; s/\s+$//g ;
2640 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2642 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2645 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2646 undef $proxysettings { 'IDENT_HOSTS' };
2649 s/^\s+//g ; s/\s+$//g ;
2652 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2653 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2657 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2658 undef $proxysettings { 'CRE_SVHOSTS' };
2661 s/^\s+//g ; s/\s+$//g ;
2664 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2665 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2670 # -------------------------------------------------------------------
2674 open ( FILE
, "> $acl_src_subnets " );
2676 if (! $proxysettings { 'SRC_SUBNETS' })
2678 print FILE
" $green_cidr \n " ;
2679 if ( $netsettings { 'BLUE_DEV' })
2681 print FILE
" $blue_cidr \n " ;
2683 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2686 open ( FILE
, "> $acl_src_banned_ip " );
2688 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2691 open ( FILE
, "> $acl_src_banned_mac " );
2693 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2696 open ( FILE
, "> $acl_src_unrestricted_ip " );
2698 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2701 open ( FILE
, "> $acl_src_unrestricted_mac " );
2703 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2706 open ( FILE
, "> $acl_dst_noauth " );
2708 print FILE
$proxysettings { 'DST_NOAUTH' };
2711 open ( FILE
, "> $acl_dst_noproxy_ip " );
2713 print FILE
$proxysettings { 'DST_NOPROXY_IP' };
2716 open ( FILE
, "> $acl_dst_noproxy_url " );
2718 print FILE
$proxysettings { 'DST_NOPROXY_URL' };
2721 open ( FILE
, "> $acl_dst_noauth_net " );
2723 open ( FILE
, "> $acl_dst_noauth_dom " );
2725 open ( FILE
, "> $acl_dst_noauth_url " );
2728 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2736 open ( FILE
, ">> $acl_dst_noauth_dom " );
2741 elsif (& General
:: validipormask
( $_ ))
2743 open ( FILE
, ">> $acl_dst_noauth_net " );
2748 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?/ )
2750 open ( FILE
, ">> $acl_dst_noauth_net " );
2757 open ( FILE
, ">> $acl_dst_noauth_url " );
2759 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2765 open ( FILE
, "> $acl_dst_nocache " );
2767 print FILE
$proxysettings { 'DST_NOCACHE' };
2770 open ( FILE
, "> $acl_dst_nocache_net " );
2772 open ( FILE
, "> $acl_dst_nocache_dom " );
2774 open ( FILE
, "> $acl_dst_nocache_url " );
2777 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2785 open ( FILE
, ">> $acl_dst_nocache_dom " );
2790 elsif (& General
:: validipormask
( $_ ))
2792 open ( FILE
, ">> $acl_dst_nocache_net " );
2797 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?/ )
2799 open ( FILE
, ">> $acl_dst_nocache_net " );
2806 open ( FILE
, ">> $acl_dst_nocache_url " );
2808 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2814 open ( FILE
, "> $acl_ports_safe " );
2816 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2819 open ( FILE
, "> $acl_ports_ssl " );
2821 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2824 if (- s
$throttled_urls )
2826 open ( URLFILE
, $throttled_urls );
2829 foreach ( @temp ) { print FILE
; }
2833 open ( FILE
, "> $mimetypes " );
2835 print FILE
$proxysettings { 'MIME_TYPES' };
2838 open ( FILE
, "> $raddir /radauth.allowusers" );
2840 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2843 open ( FILE
, "> $raddir /radauth.denyusers" );
2845 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2848 open ( FILE
, "> $identdir /identauth.allowusers" );
2850 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2853 open ( FILE
, "> $identdir /identauth.denyusers" );
2855 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2858 open ( FILE
, "> $identhosts " );
2860 print FILE
$proxysettings { 'IDENT_HOSTS' };
2863 open ( FILE
, "> $cre_groups " );
2865 print FILE
$proxysettings { 'CRE_GROUPS' };
2868 open ( FILE
, "> $cre_svhosts " );
2870 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2874 # -------------------------------------------------------------------
2880 & General
:: readhasharray
( "${General::swroot}/vpn/config" , \
%vpnconfig );
2881 & General
:: readhasharray
( "${General::swroot}/ovpn/ovpnconfig" , \
%ovpnconfig );
2882 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2884 print FILE
"function FindProxyForURL(url, host) \n " ;
2886 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2890 (isPlainHostName(host)) ||
2891 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2895 if ( $netsettings { 'GREEN_DEV' }) {
2896 print FILE
" (isInNet(host, \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" )) || \n " ;
2899 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
2900 print FILE
" (isInNet(host, \" $netsettings {'BLUE_NETADDRESS'} \" , \" $netsettings {'BLUE_NETMASK'} \" )) || \n " ;
2903 if (& Header
:: orange_used
() && $netsettings { 'ORANGE_DEV' }) {
2904 print FILE
" (isInNet(host, \" $netsettings {'ORANGE_NETADDRESS'} \" , \" $netsettings {'ORANGE_NETMASK'} \" )) || \n " ;
2907 # Additional exceptions for URLs
2908 # The file has to be created by the user and should contain one entry per line
2909 # Line-Format: <URL incl. wildcards>
2910 # e.g. *.ipfire.org*
2911 if (- s
" $acl_dst_noproxy_url " ) {
2914 open ( NOPROXY
, " $acl_dst_noproxy_url " );
2915 @templist = < NOPROXY
>;
2921 print FILE
" (shExpMatch(url, \" $_ \" )) || \n " ;
2925 # Additional exceptions for Subnets
2926 # The file has to be created by the user and should contain one entry per line
2927 # Line-Format: <IP>/<SUBNET MASK>
2928 # e.g. 192.168.0.0/255.255.255.0
2929 if (- s
" $acl_dst_noproxy_ip " ) {
2932 open ( NOPROXY
, " $acl_dst_noproxy_ip " );
2933 @templist = < NOPROXY
>;
2939 @temp = split ( /\/ /);
2940 print FILE
" (isInNet(host, \" $temp [0] \" , \" $temp [1] \" )) || \n " ;
2944 foreach my $key ( sort { uc ( $vpnconfig { $a }[ 1 ]) cmp uc ( $vpnconfig { $b }[ 1 ]) } keys %vpnconfig ) {
2945 if ( $vpnconfig { $key }[ 0 ] eq 'on' && $vpnconfig { $key }[ 3 ] ne 'host' ) {
2946 my @networks = split ( /\|/ , $vpnconfig { $key }[ 11 ]);
2947 foreach my $network ( @networks ) {
2948 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
2949 $vpnsub = & Network
:: convert_prefix2netmask
( $vpnsub ) || $vpnsub ;
2950 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
2955 foreach my $key ( sort { uc ( $ovpnconfig { $a }[ 1 ]) cmp uc ( $ovpnconfig { $b }[ 1 ]) } keys %ovpnconfig ) {
2956 if ( $ovpnconfig { $key }[ 0 ] eq 'on' && $ovpnconfig { $key }[ 3 ] ne 'host' ) {
2957 my @networks = split ( /\|/ , $ovpnconfig { $key }[ 11 ]);
2958 foreach my $network ( @networks ) {
2959 my ( $vpnip , $vpnsub ) = split ( "/" , $network );
2960 print FILE
" (isInNet(host, \" $vpnip \" , \" $vpnsub \" )) || \n " ;
2966 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2974 if ( $proxysettings { 'ENABLE' } eq 'on' )
2976 print FILE
"if ( \n " ;
2977 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2980 if (- e
" $acl_src_subnets " ) {
2981 open ( SUBNETS
, " $acl_src_subnets " );
2982 @templist = < SUBNETS
>;
2988 @temp = split ( /\/ /);
2990 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2991 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2995 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
3003 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3007 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
3009 print FILE
" \n else \n\n " ;
3011 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
3015 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
3017 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3026 # -------------------------------------------------------------------
3033 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3034 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3035 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3036 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3038 $delaypools = 1 ; } else { $delaypools = 0 ;
3041 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3043 $authrealm = "IPFire Advanced Proxy Server" ;
3045 $authrealm = $proxysettings { 'AUTH_REALM' };
3048 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3049 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3051 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3053 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3056 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3057 # you make will be overwritten whenever you resave proxy settings using the
3060 # Instead, modify the file ' $acl_include ' and
3061 # then restart the proxy service using the web interface. Changes made to the
3062 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3064 shutdown_lifetime 5 seconds
3070 # Include file with user defined settings.
3071 if (- e
"/etc/squid/squid.conf.pre.local" ) {
3072 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
3075 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3076 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3079 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) {
3080 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3081 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3085 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3086 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3087 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3090 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) {
3091 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
3092 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3097 if (( $proxysettings { 'CACHE_SIZE' } > 0 ) || ( $proxysettings { 'CACHE_MEM' } > 0 ))
3101 if (!- z
$acl_dst_nocache_dom ) {
3102 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3103 print FILE
"cache deny no_cache_domains \n " ;
3105 if (!- z
$acl_dst_nocache_net ) {
3106 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3107 print FILE
"cache deny no_cache_ipaddr \n " ;
3109 if (!- z
$acl_dst_nocache_url ) {
3110 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3111 print FILE
"cache deny no_cache_hosts \n " ;
3117 cache_effective_user squid
3120 pid_filename /var/run/squid.pid
3122 cache_mem $proxysettings {'CACHE_MEM'} MB
3125 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3127 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3128 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
3130 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3132 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3134 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3136 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3138 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3143 open ( PORTS
, " $acl_ports_ssl " );
3144 my @ssl_ports = < PORTS
>;
3148 foreach ( @ssl_ports ) {
3149 print FILE
"acl SSL_ports port $_ " ;
3153 open ( PORTS
, " $acl_ports_safe " );
3154 my @safe_ports = < PORTS
>;
3158 foreach ( @safe_ports ) {
3159 print FILE
"acl Safe_ports port $_ " ;
3165 acl IPFire_http port $http_port
3166 acl IPFire_https port $https_port
3167 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3168 acl IPFire_networks src " $acl_src_subnets "
3169 acl IPFire_servers dst " $acl_src_subnets "
3170 acl IPFire_green_network src $green_cidr
3171 acl IPFire_green_servers dst $green_cidr
3174 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3175 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3176 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3177 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3178 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3179 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3181 acl CONNECT method CONNECT
3185 if ( $proxysettings { 'CACHE_SIZE' } > 0 ) {
3187 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3188 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3190 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
3194 if ( $proxysettings { 'CACHE_MEM' } > 0 ) {
3195 # always 2% of CACHE_MEM defined as max object size
3196 print FILE
"maximum_object_size_in_memory " . int ( $proxysettings { 'CACHE_MEM' } * 1024 * 0.02 ) . " KB \n\n " ;
3198 print FILE
"cache deny all \n\n " ;
3203 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3207 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3208 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3209 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3210 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3212 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3216 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3218 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3221 if ( $proxysettings { 'LOGGING' } eq 'on' )
3224 access_log stdio:/var/log/squid/access.log
3225 cache_log /var/log/squid/cache.log
3226 cache_store_log none
3229 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"access_log stdio:\/var\/log\/squid\/user_agent.log useragent \n " ; }
3230 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3233 access_log /dev/null
3235 cache_store_log none
3244 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3246 print FILE
"forwarded_for on \n " ;
3248 print FILE
"forwarded_for off \n " ;
3250 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3252 print FILE
"via on \n " ;
3254 print FILE
"via off \n " ;
3258 # If we use authentication, users must always authenticate
3259 unless ( $proxysettings { "AUTH_METHOD" } eq "" ) {
3260 print FILE
"authenticate_ip_ttl 0 \n\n " ;
3263 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3265 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3267 print FILE
"auth_param basic program $authdir /basic_ncsa_auth $userdb \n " ;
3268 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3269 print FILE
"auth_param basic realm $authrealm \n " ;
3270 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3273 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3275 print FILE
"auth_param basic utf8 on \n " ;
3276 print FILE
"auth_param basic program $authdir /basic_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3277 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3278 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3279 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3281 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3283 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3285 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3287 print FILE
" -u sAMAccountName -P" ;
3289 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3291 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3293 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3295 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3297 print FILE
" -u cn -P" ;
3299 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3301 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3303 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3305 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3307 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3308 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3309 print FILE
" -u uid -P" ;
3311 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3312 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3313 print FILE
"auth_param basic realm $authrealm \n " ;
3314 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3317 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' )
3319 print FILE
"auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" ;
3320 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3321 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3322 $ntlm_auth_group =~ s/\\/\+/ ;
3324 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3328 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n\n " ;
3329 print FILE
"auth_param ntlm credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3331 # BASIC authentication
3332 if ( $proxysettings { 'NTLM_AUTH_BASIC' } eq "on" ) {
3333 print FILE
"auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic" ;
3334 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3335 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3336 $ntlm_auth_group =~ s/\\/\+/ ;
3338 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3341 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3342 print FILE
"auth_param basic realm $authrealm \n " ;
3343 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3347 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3349 print FILE
"auth_param basic program $authdir /basic_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3350 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3351 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3352 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3353 print FILE
"auth_param basic realm $authrealm \n " ;
3354 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3358 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3359 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3361 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3363 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3365 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3367 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3370 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3373 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3374 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3376 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3379 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3380 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3381 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3386 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3388 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3390 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3392 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3394 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3396 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3398 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3400 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3403 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3404 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3405 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3409 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3411 print FILE
"acl within_timeframe time " ;
3412 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3413 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3414 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3415 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3416 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3417 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3418 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3419 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3420 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3421 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3422 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3424 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3425 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3428 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3431 #Classroom extensions
3432 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3433 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3436 print FILE
"deny_info " ;
3437 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3439 print FILE
"ERR_ACCESS_DISABLED" ;
3441 print FILE
"ERR_ACCESS_DENIED" ;
3443 print FILE
" IPFire_no_access_ips \n " ;
3444 print FILE
"deny_info " ;
3445 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3447 print FILE
"ERR_ACCESS_DISABLED" ;
3449 print FILE
"ERR_ACCESS_DENIED" ;
3451 print FILE
" IPFire_no_access_mac \n " ;
3454 http_access deny IPFire_no_access_ips
3455 http_access deny IPFire_no_access_mac
3460 #Insert acl file and replace __VAR__ with correct values
3461 my $blue_net = '' ; #BLUE empty by default
3463 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3464 $blue_net = " $blue_cidr " ;
3465 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3467 if (!- z
$acl_include )
3469 open ( ACL
, " $acl_include " );
3470 print FILE
" \n #Start of custom includes \n\n " ;
3472 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3473 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3474 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3475 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3476 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3479 print FILE
" \n #End of custom includes \n " ;
3482 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3484 # Check if squidclamav is enabled.
3485 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3486 print FILE
" \n #Settings for squidclamav: \n " ;
3487 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} \n " ;
3488 print FILE
"acl purge method PURGE \n " ;
3489 print FILE
"http_access deny to_localhost \n " ;
3490 print FILE
"http_access allow localhost \n " ;
3491 print FILE
"http_access allow purge localhost \n " ;
3492 print FILE
"http_access deny purge \n " ;
3493 print FILE
"url_rewrite_access deny localhost \n " ;
3498 #local machine, no restriction
3499 http_access allow localhost
3501 #GUI admin if local machine connects
3502 http_access allow IPFire_ips IPFire_networks IPFire_http
3503 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3505 #Deny not web services
3509 print FILE
"http_access deny !Safe_ports \n " ;
3513 print FILE
"http_access deny CONNECT !SSL_ports \n " ;
3516 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3518 print FILE
"#Set ident ACLs \n " ;
3519 if (!- z
$identhosts )
3521 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3522 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3523 print FILE
"ident_lookup_access deny all \n " ;
3525 print FILE
"ident_lookup_access allow all \n " ;
3527 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3531 print FILE
"#Set download throttling \n " ;
3533 if ( $netsettings { 'BLUE_DEV' })
3535 print FILE
"delay_pools 2 \n " ;
3537 print FILE
"delay_pools 1 \n " ;
3540 print FILE
"delay_class 1 3 \n " ;
3541 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3543 print FILE
"delay_parameters 1 " ;
3544 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3548 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3550 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3553 print FILE
" -1/-1 " ;
3554 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3558 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3560 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3564 if ( $netsettings { 'BLUE_DEV' })
3566 print FILE
"delay_parameters 2 " ;
3567 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3571 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3573 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3575 print FILE
" -1/-1 " ;
3576 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3580 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3582 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3587 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3588 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3589 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3590 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3592 if ( $netsettings { 'BLUE_DEV' })
3594 print FILE
"delay_access 1 allow IPFire_green_network" ;
3595 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3597 print FILE
"delay_access 1 deny all \n " ;
3599 print FILE
"delay_access 1 allow all" ;
3600 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3604 if ( $netsettings { 'BLUE_DEV' })
3606 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3607 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3608 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3609 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3610 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3611 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3613 print FILE
"delay_access 2 deny all \n " ;
3616 print FILE
"delay_initial_bucket_level 100 \n " ;
3620 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3622 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3623 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3626 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3628 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3629 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3630 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3634 #Set custom configured ACLs
3637 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3638 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3640 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3642 if (!- z
$acl_src_unrestricted_ip )
3644 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3645 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3646 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3648 if (!- z
$acl_src_unrestricted_mac )
3650 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3651 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3652 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3654 if (!- z
$acl_dst_noauth_net )
3656 print FILE
"http_access allow IPFire_networks" ;
3657 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3658 print FILE
" !within_timeframe" ;
3660 print FILE
" within_timeframe" ; }
3661 print FILE
" to_ipaddr_without_auth \n " ;
3663 if (!- z
$acl_dst_noauth_dom )
3665 print FILE
"http_access allow IPFire_networks" ;
3666 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3667 print FILE
" !within_timeframe" ;
3669 print FILE
" within_timeframe" ; }
3670 print FILE
" to_domains_without_auth \n " ;
3672 if (!- z
$acl_dst_noauth_url )
3674 print FILE
"http_access allow IPFire_networks" ;
3675 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3676 print FILE
" !within_timeframe" ;
3678 print FILE
" within_timeframe" ; }
3679 print FILE
" to_hosts_without_auth \n " ;
3683 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3685 print FILE
"http_access deny !for_inetusers" ;
3686 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3691 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3692 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3693 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3694 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3695 (!- z
" $identdir /identauth.denyusers" )
3698 print FILE
"http_access deny for_acl_users" ;
3699 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3703 if (!- z
$acl_src_unrestricted_ip )
3705 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3706 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3708 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3710 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3712 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3714 print FILE
" for_inetusers" ;
3716 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3718 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3720 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3722 print FILE
" for_acl_users" ;
3724 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3726 print FILE
" !for_acl_users" ;
3728 } else { print FILE
" for_inetusers" ; }
3734 if (!- z
$acl_src_unrestricted_mac )
3736 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3737 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3739 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3741 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3743 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3745 print FILE
" for_inetusers" ;
3747 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3749 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3751 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3753 print FILE
" for_acl_users" ;
3755 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3757 print FILE
" !for_acl_users" ;
3759 } else { print FILE
" for_inetusers" ; }
3765 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3767 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3768 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3773 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3774 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3775 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3776 (!- z
" $raddir /radauth.denyusers" )
3780 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3781 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3782 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3783 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3784 (!- z
" $identdir /identauth.denyusers" )
3788 print FILE
"http_access deny for_acl_users" ;
3789 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3793 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3795 print FILE
"http_access allow" ;
3796 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3797 print FILE
" !within_timeframe" ;
3799 print FILE
" within_timeframe" ; }
3800 print FILE
" !on_ident_aware_hosts \n " ;
3803 print FILE
"http_access allow IPFire_networks" ;
3806 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3807 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3808 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3809 (!- z
" $raddir /radauth.allowusers" )
3813 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3814 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3815 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3816 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3817 (!- z
" $identdir /identauth.allowusers" )
3821 print FILE
" for_acl_users" ;
3822 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3823 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3824 print FILE
" for_inetusers" ;
3826 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3828 print FILE
" !concurrent" ;
3830 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3831 print FILE
" !within_timeframe" ;
3833 print FILE
" within_timeframe" ; }
3836 print FILE
"http_access deny all \n\n " ;
3838 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3839 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3841 print FILE
"#Strip HTTP Header \n " ;
3843 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3845 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3846 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3848 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3850 print FILE
"request_header_access Via deny all \n " ;
3851 print FILE
"reply_header_access Via deny all \n " ;
3853 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3855 print FILE
"request_header_access User-Agent deny all \n " ;
3856 print FILE
"reply_header_access User-Agent deny all \n " ;
3858 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3860 print FILE
"request_header_access Referer deny all \n " ;
3861 print FILE
"reply_header_access Referer deny all \n " ;
3866 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3868 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3870 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3872 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3874 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3880 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3882 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3883 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3884 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3885 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3887 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3889 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3890 print FILE
"http_reply_access allow all \n\n " ;
3893 print FILE
"visible_hostname" ;
3894 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3896 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3898 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3901 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3902 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3905 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3907 # Write the parent proxy info, if needed.
3908 if ( $remotehost ne '' )
3910 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3912 # Enter authentication for the parent cache. Option format is
3913 # login=user:password ($proxy1='YES')
3914 # login=PASS ($proxy1='PASS')
3915 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3916 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3918 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3919 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3921 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3923 print FILE
" \n always_direct allow IPFire_ips \n " ;
3924 print FILE
"never_direct allow all \n\n " ;
3926 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3928 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3929 print FILE
"url_rewrite_children " , & General
:: number_cpu_cores
();
3930 print FILE
" startup=" , & General
:: number_cpu_cores
();
3931 print FILE
" idle=" , & General
:: number_cpu_cores
();
3932 print FILE
" queue-size=" , & General
:: number_cpu_cores
() * 32 , " \n\n " ;
3935 # Include file with user defined settings.
3936 if (- e
"/etc/squid/squid.conf.local" ) {
3937 print FILE
"include /etc/squid/squid.conf.local \n " ;
3941 # Proxy settings for squidclamav - if installed.
3943 # Check if squidclamav is enabled.
3944 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3946 my $configfile = '/etc/squidclamav.conf' ;
3948 my $data = & General
:: read_file_utf8
( $configfile );
3949 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
3950 & General
:: write_file_utf8
( $configfile , $data );
3954 # -------------------------------------------------------------------
3958 my ( $str_user , $str_pass , $str_group ) = @_ ;
3959 my @groupmembers =();
3961 if ( $str_pass eq 'lEaVeAlOnE' )
3963 open ( FILE
, " $userdb " );
3964 @groupmembers = < FILE
>;
3966 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3967 & deluser
( $str_user );
3968 open ( FILE
, ">> $userdb " );
3970 print FILE
" $str_user $str_pass " ;
3973 & deluser
( $str_user );
3975 my %htpasswd_options = (
3976 passwdFile
=> " $userdb " ,
3980 my $htpasswd = new Apache
:: Htpasswd
( \
%htpasswd_options );
3982 $htpasswd -> htpasswd ( $str_user , $str_pass );
3985 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3986 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3987 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3989 print FILE
" $str_user \n " ;
3995 # -------------------------------------------------------------------
3999 my ( $str_user ) = @_ ;
4001 my @groupmembers =();
4004 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
4007 open ( FILE
, " $groupfile " );
4008 @groupmembers = < FILE
>;
4010 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
4011 open ( FILE
, "> $groupfile " );
4013 print FILE
@templist ;
4018 open ( FILE
, " $userdb " );
4019 @groupmembers = < FILE
>;
4021 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4022 open ( FILE
, "> $userdb " );
4024 print FILE
@templist ;
4030 # -------------------------------------------------------------------
4034 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4036 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4037 print FILE
"localhost" ;
4042 # -------------------------------------------------------------------