]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
7b442e1043b2bc7a2f708094e7904bba2a392475
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2013 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 ###############################################################################
22 # (c) 2004-2009 marco.s - http://www.advproxy.net
24 # This code is distributed under the terms of the GPL
26 # $Id: advproxy.cgi,v 3.0.2 2009/02/04 00:00:00 marco.s Exp $
32 # enable only the following on debugging purpose
34 #use CGI::Carp 'fatalsToBrowser';
36 require '/var/ipfire/general-functions.pl' ;
37 require "${General::swroot}/lang.pl" ;
38 require "${General::swroot}/header.pl" ;
40 my @squidversion = `/usr/sbin/squid -v` ;
45 my %mainsettings = ();
46 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
47 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
51 my %filtersettings =();
52 my %xlratorsettings =();
53 my %stdproxysettings =();
59 my @throttle_limits =( 64 , 128 , 256 , 384 , 512 , 768 , 1024 , 1280 , 1536 , 1792 , 2048 , 2560 , 3072 , 3584 , 4096 , 5120 , 6144 , 7168 , 8192 , 10240 , 12288 , 16384 , 20480 );
60 my $throttle_binary = "7z|arj|bin|bz2|cab|exe|gz|lzh|rar|sea|tar|tgz|xz|zip" ;
61 my $throttle_dskimg = "b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi|vmdk" ;
62 my $throttle_mmedia = "aiff?|asf|avi|divx|mov|mp3|mpe?g|ogg|qt|ra?m|ts|vob" ;
64 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 " ;
65 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
67 my $hintcolour = '#FFFFCC' ;
68 my $ncsa_buttontext = '' ;
83 my $browser_regexp = '' ;
87 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
88 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
89 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
90 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
91 my $credir = "${General::swroot}/proxy/advanced/cre" ;
93 my $userdb = " $ncsadir /passwd" ;
94 my $stdgrp = " $ncsadir /standard.grp" ;
95 my $extgrp = " $ncsadir /extended.grp" ;
96 my $disgrp = " $ncsadir /disabled.grp" ;
98 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
99 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
101 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
102 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
103 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
105 my $identhosts = " $identdir /hosts" ;
107 my $authdir = "/usr/lib/squid/" ;
108 my $errordir = "/usr/lib/squid/errors" ;
110 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
111 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
112 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
113 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
114 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
115 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
116 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
117 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
118 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
119 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
120 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
121 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
122 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
123 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
124 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
125 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
126 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
127 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
128 my $acl_include = " $acldir /include.acl" ;
130 my $updaccelversion = 'n/a' ;
131 my $urlfilterversion = 'n/a' ;
133 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
134 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
135 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
136 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
137 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
139 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
140 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
142 unless (- e
$userdb ) { system ( "touch $userdb " ); }
143 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
144 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
145 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
147 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
148 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
149 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
150 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
151 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
152 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
153 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
154 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
155 unless (- e
$acl_dst_noauth_dom ) { system ( "touch $acl_dst_noauth_dom " ); }
156 unless (- e
$acl_dst_noauth_net ) { system ( "touch $acl_dst_noauth_net " ); }
157 unless (- e
$acl_dst_noauth_url ) { system ( "touch $acl_dst_noauth_url " ); }
158 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
159 unless (- e
$acl_dst_nocache_dom ) { system ( "touch $acl_dst_nocache_dom " ); }
160 unless (- e
$acl_dst_nocache_net ) { system ( "touch $acl_dst_nocache_net " ); }
161 unless (- e
$acl_dst_nocache_url ) { system ( "touch $acl_dst_nocache_url " ); }
162 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
163 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
164 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
165 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
167 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
169 my $HAVE_NTLM_AUTH = (- e
"/usr/bin/ntlm_auth" );
171 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
172 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
174 my $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
176 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
177 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
180 & Header
:: showhttpheaders
();
182 $proxysettings { 'ACTION' } = '' ;
183 $proxysettings { 'VALID' } = '' ;
185 $proxysettings { 'ENABLE' } = 'off' ;
186 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
187 $proxysettings { 'TRANSPARENT' } = 'off' ;
188 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
189 $proxysettings { 'PROXY_PORT' } = '800' ;
190 $proxysettings { 'TRANSPARENT_PORT' } = '3128' ;
191 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
192 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
193 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
194 $proxysettings { 'ERR_LANGUAGE' } = 'German' ;
195 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
196 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
197 $proxysettings { 'FORWARD_VIA' } = 'off' ;
198 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
199 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
200 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
201 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
202 $proxysettings { 'UPSTREAM_USER' } = '' ;
203 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
204 $proxysettings { 'LOGGING' } = 'off' ;
205 $proxysettings { 'CACHEMGR' } = 'off' ;
206 $proxysettings { 'LOGQUERY' } = 'off' ;
207 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
208 $proxysettings { 'FILEDESCRIPTORS' } = '16384' ;
209 $proxysettings { 'CACHE_MEM' } = '2' ;
210 $proxysettings { 'CACHE_SIZE' } = '50' ;
211 $proxysettings { 'MAX_SIZE' } = '4096' ;
212 $proxysettings { 'MIN_SIZE' } = '0' ;
213 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
214 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
215 $proxysettings { 'L1_DIRS' } = '16' ;
216 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
217 $proxysettings { 'CACHE_DIGESTS' } = 'off' ;
218 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
219 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
220 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
221 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
222 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
223 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
224 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
225 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
226 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
227 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
228 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
229 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
230 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
231 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
232 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
233 $proxysettings { 'THROTTLE_BINARY' } = 'off' ;
234 $proxysettings { 'THROTTLE_DSKIMG' } = 'off' ;
235 $proxysettings { 'THROTTLE_MMEDIA' } = 'off' ;
236 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
237 $proxysettings { 'FAKE_USERAGENT' } = '' ;
238 $proxysettings { 'FAKE_REFERER' } = '' ;
239 $proxysettings { 'AUTH_METHOD' } = 'none' ;
240 $proxysettings { 'AUTH_REALM' } = '' ;
241 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
242 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
243 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
244 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
245 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
246 $proxysettings { 'NCSA_USERNAME' } = '' ;
247 $proxysettings { 'NCSA_GROUP' } = '' ;
248 $proxysettings { 'NCSA_PASS' } = '' ;
249 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
250 $proxysettings { 'LDAP_BASEDN' } = '' ;
251 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
252 $proxysettings { 'LDAP_SERVER' } = '' ;
253 $proxysettings { 'LDAP_PORT' } = '389' ;
254 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
255 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
256 $proxysettings { 'LDAP_GROUP' } = '' ;
257 $proxysettings { 'NTLM_AUTH_GROUP' } = '' ;
258 $proxysettings { 'NTLM_AUTH_BASIC' } = 'off' ;
259 $proxysettings { 'NTLM_DOMAIN' } = '' ;
260 $proxysettings { 'NTLM_PDC' } = '' ;
261 $proxysettings { 'NTLM_BDC' } = '' ;
262 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
263 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
264 $proxysettings { 'RADIUS_SERVER' } = '' ;
265 $proxysettings { 'RADIUS_PORT' } = '1812' ;
266 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
267 $proxysettings { 'RADIUS_SECRET' } = '' ;
268 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
269 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
270 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
271 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
272 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
273 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
274 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
275 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
276 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
278 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
280 & Header
:: getcgihash
( \
%proxysettings );
282 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
283 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
284 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
285 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
287 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
289 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
292 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
294 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
295 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
296 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
298 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
299 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
301 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
302 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
304 if (! $errormessage ) {
305 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
306 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
308 $proxysettings { 'NCSA_USERNAME' } = '' ;
309 $proxysettings { 'NCSA_GROUP' } = '' ;
310 $proxysettings { 'NCSA_PASS' } = '' ;
311 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
314 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
316 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
317 & deluser
( $proxysettings { 'ID' });
320 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
321 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
322 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
324 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
326 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
327 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
328 @temp = split ( /:/ , $proxysettings { 'ID' });
329 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
330 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
331 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
332 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
335 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
337 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
338 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
339 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
340 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
341 $errormessage = $Lang :: tr
{ 'invalid input' };
344 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
345 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
349 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
351 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
354 if (!(& General
:: validport
( $proxysettings { 'TRANSPARENT_PORT' })))
356 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
359 if ( $proxysettings { 'PROXY_PORT' } eq $proxysettings { 'TRANSPARENT_PORT' }) {
360 $errormessage = $Lang :: tr
{ 'advproxy errmsg proxy ports equal' };
363 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
365 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
366 if (!(& General
:: validip
( $temp [ 0 ])))
368 if (!(& General
:: validdomainname
( $temp [ 0 ])))
370 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
375 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
376 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
378 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
380 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
384 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
385 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 1048576 ))
387 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
390 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ))
392 $errormessage = $Lang :: tr
{ 'advproxy errmsg mem cache size' };
395 my @free = `/usr/bin/free` ;
396 $free [ 1 ] =~ m/(\d+)/ ;
397 $cachemem = int $1 / 2048 ;
398 if ( $proxysettings { 'CACHE_MEM' } > $cachemem ) {
399 $proxysettings { 'CACHE_MEM' } = $cachemem ;
401 if (!( $proxysettings { 'MAX_SIZE' } =~ /^\d+/ ))
403 $errormessage = $Lang :: tr
{ 'invalid maximum object size' };
406 if (!( $proxysettings { 'MIN_SIZE' } =~ /^\d+/ ))
408 $errormessage = $Lang :: tr
{ 'invalid minimum object size' };
411 if (!( $proxysettings { 'MAX_OUTGOING_SIZE' } =~ /^\d+/ ))
413 $errormessage = $Lang :: tr
{ 'invalid maximum outgoing size' };
416 if (!( $proxysettings { 'TIME_TO_HOUR' }. $proxysettings { 'TIME_TO_MINUTE' } gt $proxysettings { 'TIME_FROM_HOUR' }. $proxysettings { 'TIME_FROM_MINUTE' }))
418 $errormessage = $Lang :: tr
{ 'advproxy errmsg time restriction' };
421 if (!( $proxysettings { 'MAX_INCOMING_SIZE' } =~ /^\d+/ ))
423 $errormessage = $Lang :: tr
{ 'invalid maximum incoming size' };
426 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
428 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
429 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
430 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
432 if ( $netsettings { 'BLUE_DEV' })
434 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
435 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
437 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
441 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
443 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
448 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
450 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
453 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
454 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
456 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
459 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' ))
461 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
464 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
466 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
470 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
472 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
474 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
478 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
480 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
482 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
486 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
488 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
490 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
493 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
495 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
497 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
501 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
503 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
506 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
508 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
510 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
515 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
517 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
519 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
522 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
524 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
527 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
529 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
534 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
537 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
538 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
539 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
540 if (( $proxy1 ne $proxy2 ))
542 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
550 $proxysettings { 'VALID' } = 'no' ; }
552 $proxysettings { 'VALID' } = 'yes' ; }
554 if ( $proxysettings { 'VALID' } eq 'yes' )
558 delete $proxysettings { 'SRC_SUBNETS' };
559 delete $proxysettings { 'SRC_BANNED_IP' };
560 delete $proxysettings { 'SRC_BANNED_MAC' };
561 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
562 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
563 delete $proxysettings { 'DST_NOCACHE' };
564 delete $proxysettings { 'DST_NOAUTH' };
565 delete $proxysettings { 'PORTS_SAFE' };
566 delete $proxysettings { 'PORTS_SSL' };
567 delete $proxysettings { 'MIME_TYPES' };
568 delete $proxysettings { 'NTLM_ALLOW_USERS' };
569 delete $proxysettings { 'NTLM_DENY_USERS' };
570 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
571 delete $proxysettings { 'RADIUS_DENY_USERS' };
572 delete $proxysettings { 'IDENT_HOSTS' };
573 delete $proxysettings { 'IDENT_ALLOW_USERS' };
574 delete $proxysettings { 'IDENT_DENY_USERS' };
576 delete $proxysettings { 'CRE_GROUPS' };
577 delete $proxysettings { 'CRE_SVHOSTS' };
579 delete $proxysettings { 'NCSA_USERNAME' };
580 delete $proxysettings { 'NCSA_GROUP' };
581 delete $proxysettings { 'NCSA_PASS' };
582 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
584 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
585 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
586 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
587 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
588 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
589 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
590 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
592 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
593 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
595 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
597 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
598 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
599 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
600 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
601 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
602 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
603 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
604 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
605 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
610 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
612 system ( '/usr/local/bin/squidctrl' , 'disable' );
613 unlink "${General::swroot}/proxy/enable" ;
614 unlink "${General::swroot}/proxy/transparent" ;
615 unlink "${General::swroot}/proxy/enable_blue" ;
616 unlink "${General::swroot}/proxy/transparent_blue" ;
618 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
619 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
620 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
621 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
622 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
623 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
624 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
625 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
626 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
627 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
629 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
630 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { system ( '/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1' ); }
634 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
636 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
641 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
642 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
643 } elsif (- e
"${General::swroot}/proxy/settings" ) {
644 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
649 # ------------------------------------------------------------------
651 # Hook to regenerate the configuration files, if cgi got called from command line.
652 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
657 # -------------------------------------------------------------------
659 $checked { 'ENABLE' }{ 'off' } = '' ;
660 $checked { 'ENABLE' }{ 'on' } = '' ;
661 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
663 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
664 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
665 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
667 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
668 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
669 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
671 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
672 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
673 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
675 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
676 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
677 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
679 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
680 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
681 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
682 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
683 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
684 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
685 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
686 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
687 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
688 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
689 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
690 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
692 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
693 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
694 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
695 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
696 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
697 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
698 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
699 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
700 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
702 $checked { 'LOGGING' }{ 'off' } = '' ;
703 $checked { 'LOGGING' }{ 'on' } = '' ;
704 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
705 $checked { 'CACHEMGR' }{ 'off' } = '' ;
706 $checked { 'CACHEMGR' }{ 'on' } = '' ;
707 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
708 $checked { 'LOGQUERY' }{ 'off' } = '' ;
709 $checked { 'LOGQUERY' }{ 'on' } = '' ;
710 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
711 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
712 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
713 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
715 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
716 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
718 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
719 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
720 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
721 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
722 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
723 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
725 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
726 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
727 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
729 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
730 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
731 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
732 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
733 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
735 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
736 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
737 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
738 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
739 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
740 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
741 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
743 $checked { 'TIME_MON' }{ 'off' } = '' ;
744 $checked { 'TIME_MON' }{ 'on' } = '' ;
745 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
746 $checked { 'TIME_TUE' }{ 'off' } = '' ;
747 $checked { 'TIME_TUE' }{ 'on' } = '' ;
748 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
749 $checked { 'TIME_WED' }{ 'off' } = '' ;
750 $checked { 'TIME_WED' }{ 'on' } = '' ;
751 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
752 $checked { 'TIME_THU' }{ 'off' } = '' ;
753 $checked { 'TIME_THU' }{ 'on' } = '' ;
754 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
755 $checked { 'TIME_FRI' }{ 'off' } = '' ;
756 $checked { 'TIME_FRI' }{ 'on' } = '' ;
757 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
758 $checked { 'TIME_SAT' }{ 'off' } = '' ;
759 $checked { 'TIME_SAT' }{ 'on' } = '' ;
760 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
761 $checked { 'TIME_SUN' }{ 'off' } = '' ;
762 $checked { 'TIME_SUN' }{ 'on' } = '' ;
763 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
765 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
766 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
767 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
768 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
770 $checked { 'THROTTLE_BINARY' }{ 'off' } = '' ;
771 $checked { 'THROTTLE_BINARY' }{ 'on' } = '' ;
772 $checked { 'THROTTLE_BINARY' }{ $proxysettings { 'THROTTLE_BINARY' }} = "checked='checked'" ;
773 $checked { 'THROTTLE_DSKIMG' }{ 'off' } = '' ;
774 $checked { 'THROTTLE_DSKIMG' }{ 'on' } = '' ;
775 $checked { 'THROTTLE_DSKIMG' }{ $proxysettings { 'THROTTLE_DSKIMG' }} = "checked='checked'" ;
776 $checked { 'THROTTLE_MMEDIA' }{ 'off' } = '' ;
777 $checked { 'THROTTLE_MMEDIA' }{ 'on' } = '' ;
778 $checked { 'THROTTLE_MMEDIA' }{ $proxysettings { 'THROTTLE_MMEDIA' }} = "checked='checked'" ;
780 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
781 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
782 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
784 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
785 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
786 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
787 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
788 $checked { 'AUTH_METHOD' }{ 'ntlm-auth' } = '' ;
789 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
790 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
792 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
794 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
795 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
796 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
798 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
799 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
800 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
802 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
804 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
806 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
808 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
809 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
810 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
812 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
813 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
814 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
816 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
817 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
818 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
820 $checked { 'NTLM_AUTH_BASIC' }{ 'on' } = '' ;
821 $checked { 'NTLM_AUTH_BASIC' }{ 'off' } = '' ;
822 $checked { 'NTLM_AUTH_BASIC' }{ $proxysettings { 'NTLM_AUTH_BASIC' }} = "checked='checked'" ;
824 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
825 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
826 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
828 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
829 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
830 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
832 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
833 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
834 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
836 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
837 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
838 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
840 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
841 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
842 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
844 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
845 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
846 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
848 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
849 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
850 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
852 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
853 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
854 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
856 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
858 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
861 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
862 print "<font class='base'> $errormessage </font> \n " ;
866 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
868 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
869 $squidversion [ 0 ] =~ s/^\s+//g ;
870 $squidversion [ 0 ] =~ s/\s+$//g ;
872 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
875 # ===================================================================
877 # ===================================================================
879 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
881 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
883 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
888 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
891 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
892 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
893 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td>
894 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
897 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
898 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
899 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td>
900 <td width='30%'><input type='text' name='TRANSPARENT_PORT' value=' $proxysettings {'TRANSPARENT_PORT'}' size='5' /></td>
905 if ( $netsettings { 'BLUE_DEV' }) {
906 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
907 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
909 print "<td colspan='2'> </td>" ;
912 <td class='base'> $Lang ::tr{'advproxy visible hostname'}:</td>
913 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
918 if ( $netsettings { 'BLUE_DEV' }) {
919 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
920 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
922 print "<td colspan='2'> </td>" ;
925 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
927 <select name='ERR_LANGUAGE'>
930 foreach (< $errordir /*>) {
932 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
933 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
941 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
942 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
943 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
944 <td class='base'><select name='ERR_DESIGN'>
945 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
946 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
950 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
951 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
960 if ( - e
"/usr/bin/squidclamav" ) {
961 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
962 if ( ! - e
"/var/run/clamav/clamd.pid" ){
963 print "<font color='red'>clamav not running</font><br /><br />" ;
964 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
967 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
973 print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</a></b><br />" ;
974 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
976 print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</a></b><br />" ;
977 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
984 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
987 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
988 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
989 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'}:</td>
990 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
993 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
994 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
995 <td class='base'> $Lang ::tr{'advproxy upstream username'}:</td>
996 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
999 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1000 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1001 <td class='base'> $Lang ::tr{'advproxy upstream password'}:</td>
1002 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1005 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1006 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1012 <table width='100%'>
1014 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1017 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1018 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1019 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1020 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1025 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1026 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1030 <table width='100%'>
1032 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1035 <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'> $Lang ::tr{'proxy cachemgr'}:</td>
1036 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1037 <td class='base'> $Lang ::tr{'advproxy admin mail'}:</td>
1038 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1041 <td class='base'> $Lang ::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td>
1042 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1043 <td class='base'> $Lang ::tr{'proxy admin password'}:</td>
1044 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1047 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1050 <td class='base'> $Lang ::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td>
1051 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1052 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td>
1053 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1056 <td class='base'> $Lang ::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td>
1057 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1058 <td class='base'> $Lang ::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td>
1059 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1062 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1063 <td class='base'><select name='L1_DIRS'>
1064 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1065 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1066 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1067 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1068 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1070 <td colspan='2' rowspan= '5' valign='top' class='base'>
1071 <table cellspacing='0' cellpadding='0'>
1073 <!-- intentionally left empty -->
1076 <td> $Lang ::tr{'advproxy no cache sites'}:</td>
1079 <!-- intentionally left empty -->
1082 <!-- intentionally left empty -->
1085 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1089 print $proxysettings { 'DST_NOCACHE' };
1098 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1099 <td class='base'><select name='MEM_POLICY'>
1100 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1101 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1102 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1103 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1107 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1108 <td class='base'><select name='CACHE_POLICY'>
1109 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1110 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1111 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1112 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1116 <td colspan='2'> </td>
1119 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1120 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1123 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1124 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1128 <table width='100%'>
1130 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1133 <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
1136 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td>
1137 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td>
1140 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1143 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1147 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1150 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1157 <table width='100%'>
1159 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1162 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1165 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td>
1168 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1172 if (! $proxysettings { 'SRC_SUBNETS' })
1174 print " $green_cidr \n " ;
1175 if ( $netsettings { 'BLUE_DEV' })
1177 print " $blue_cidr \n " ;
1179 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1186 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1187 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1188 print "<td class='base'> $line :</td> \n " ;
1190 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1194 if ( $netsettings { 'BLUE_DEV' }) {
1195 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1196 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1198 print "<td class='base'> $line :</td> \n " ;
1200 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1207 <td colspan='2'> </td>
1210 <td colspan='2'> </td>
1213 <table width='100%'>
1215 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1218 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}:</td>
1219 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}:</td>
1222 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1226 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1230 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1234 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1240 <table width='100%'>
1242 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1245 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}:</td>
1246 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}:</td>
1249 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1253 print $proxysettings { 'SRC_BANNED_IP' };
1257 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1261 print $proxysettings { 'SRC_BANNED_MAC' };
1272 # -------------------------------------------------------------------
1273 # CRE GUI - optional
1274 # -------------------------------------------------------------------
1276 if (- e
$cre_enabled ) { print <<END
1277 <table width='100%'>
1280 <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>
1283 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1289 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1291 <td class='base'> $Lang ::tr{'advproxy supervisor password'}:</td>
1292 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1295 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1296 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}:</td>
1301 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1304 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1308 print $proxysettings { 'CRE_GROUPS' };
1312 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1315 print $proxysettings { 'CRE_SVHOSTS' };
1323 print "</table><hr size='1'>" ;
1327 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1328 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1329 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1334 # -------------------------------------------------------------------
1338 <table width='100%'>
1340 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1342 <table width='100%'>
1344 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1345 <td width='1%'> </td>
1346 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1347 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1348 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1349 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1350 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1351 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1352 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1353 <td width='1%'> </td>
1354 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1355 <td width='1%'> </td>
1356 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1361 <select name='TIME_ACCESS_MODE'>
1362 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1363 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1367 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1368 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1369 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1370 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1371 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1372 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1373 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1376 <select name='TIME_FROM_HOUR'>
1379 for ( $i = 0 ; $i <= 24 ; $i ++) {
1380 $_ = sprintf ( " %02s " , $i );
1381 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1388 <select name='TIME_FROM_MINUTE'>
1391 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1392 $_ = sprintf ( " %02s " , $i );
1393 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1400 <select name='TIME_TO_HOUR'>
1403 for ( $i = 0 ; $i <= 24 ; $i ++) {
1404 $_ = sprintf ( " %02s " , $i );
1405 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1412 <select name='TIME_TO_MINUTE'>
1415 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1416 $_ = sprintf ( " %02s " , $i );
1417 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1425 <table width='100%'>
1427 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1430 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td>
1431 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1432 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td>
1433 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1437 <table width='100%'>
1439 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1442 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1443 <td width='20%' class='base'>
1444 <select name='THROTTLING_GREEN_TOTAL'>
1448 foreach ( @throttle_limits ) {
1449 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1453 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1456 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1457 <td width='30%' class='base'>
1458 <select name='THROTTLING_GREEN_HOST'>
1462 foreach ( @throttle_limits ) {
1463 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1467 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1474 if ( $netsettings { 'BLUE_DEV' }) {
1477 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1479 <select name='THROTTLING_BLUE_TOTAL'>
1483 foreach ( @throttle_limits ) {
1484 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kbit/s</option> \n " ;
1488 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1491 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1493 <select name='THROTTLING_BLUE_HOST'>
1497 foreach ( @throttle_limits ) {
1498 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kbit/s</option> \n " ;
1502 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1512 <table width='100%'>
1514 <td colspan='4'><i> $Lang ::tr{'advproxy content based throttling'}:</i></td>
1517 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle binary'}:</td>
1518 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked {'THROTTLE_BINARY'}{'on'} /></td>
1519 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle dskimg'}:</td>
1520 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked {'THROTTLE_DSKIMG'}{'on'} /></td>
1521 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle mmedia'}:</td>
1522 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked {'THROTTLE_MMEDIA'}{'on'} /></td>
1523 <td width='15%'> </td>
1524 <td width='10%'> </td>
1528 <table width='100%'>
1530 <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>
1534 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1537 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}:</td>
1542 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1546 print $proxysettings { 'MIME_TYPES' };
1561 <table width='100%'>
1563 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1566 <td class='base'> $Lang ::tr{'advproxy fake useragent'}:</td>
1567 <td class='base'> $Lang ::tr{'advproxy fake referer'}:</td>
1570 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='40%' /></td>
1571 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='40%' /></td>
1578 my $auth_columns = 5 ;
1579 if ( $HAVE_NTLM_AUTH ) {
1582 my $auth_column_width = 100 / $auth_columns ;
1585 <table width='100%'>
1587 <td colspan=' $auth_columns '><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1590 <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>
1591 <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>
1592 <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>
1593 <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>
1596 if ( $HAVE_NTLM_AUTH ) {
1598 <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>
1603 <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>
1609 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1611 <table width='100%'>
1613 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1616 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1619 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1620 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1621 <td colspan='2' rowspan= '6' valign='top' class='base'>
1622 <table cellpadding='0' cellspacing='0'>
1624 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}:</td>
1627 <!-- intentionally left empty -->
1630 <!-- intentionally left empty -->
1633 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1636 <!-- intentionally left empty -->
1639 <!-- intentionally left empty -->
1642 <td> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1645 <!-- intentionally left empty -->
1648 <!-- intentionally left empty -->
1651 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1655 print $proxysettings { 'DST_NOAUTH' };
1664 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1665 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1668 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}:</td>
1669 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1672 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1673 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1676 <td colspan='2'> </td>
1683 # ===================================================================
1684 # NCSA auth settings
1685 # ===================================================================
1687 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1690 <table width='100%'>
1692 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1695 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1696 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1697 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1698 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1701 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1709 # ===================================================================
1710 # IDENTD auth settings
1711 # ===================================================================
1713 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1716 <table width='100%'>
1718 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1721 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1722 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1723 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1724 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1727 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1728 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1733 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1734 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}:</td>
1737 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1740 if (! $proxysettings { 'IDENT_HOSTS' }) {
1741 print " $green_cidr \n " ;
1742 if ( $netsettings { 'BLUE_DEV' }) {
1743 print " $blue_cidr \n " ;
1746 print $proxysettings { 'IDENT_HOSTS' };
1751 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1755 print $proxysettings { 'DST_NOAUTH' };
1762 <table width='100%'>
1764 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1767 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1768 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1769 <td width='25%'> </td>
1770 <td width='30%'> </td>
1773 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1774 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1775 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1776 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1779 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1780 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1783 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1787 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1789 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1791 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1795 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1797 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1804 # ===================================================================
1805 # NTLM-AUTH settings
1806 # ===================================================================
1808 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' ) {
1811 <table width='100%'>
1812 <td width='20%' class='base'> $Lang ::tr{'advproxy basic authentication'}:</td>
1813 <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked {'NTLM_AUTH_BASIC'}{'on'} /></td>
1814 <td colspan='2'> </td>
1819 <table width='100%'>
1821 <td colspan='4'><b> $Lang ::tr{'advproxy group access control'}</b></td>
1824 <td width='20%' class='base'> $Lang ::tr{'advproxy group required'}:</td>
1825 <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value=' $proxysettings {'NTLM_AUTH_GROUP'}' size='37' /></td>
1833 # ===================================================================
1834 # LDAP auth settings
1835 # ===================================================================
1837 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1840 <table width='100%'>
1842 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1845 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1846 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1847 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1848 <td class='base'><select name='LDAP_TYPE'>
1849 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1850 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1851 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1852 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1856 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1857 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1858 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1859 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1863 <table width='100%'>
1865 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
1868 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
1869 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
1870 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
1871 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
1875 <table width='100%'>
1877 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
1880 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}:</td>
1881 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
1889 # ===================================================================
1890 # RADIUS auth settings
1891 # ===================================================================
1893 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
1896 <table width='100%'>
1898 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
1901 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
1902 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
1903 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
1904 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
1907 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}:</td>
1908 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
1909 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
1910 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
1914 <table width='100%'>
1916 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
1919 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1920 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
1921 <td width='25%'> </td>
1922 <td width='30%'> </td>
1925 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
1926 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
1927 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
1928 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
1931 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
1932 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
1935 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1939 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
1941 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
1943 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
1947 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
1949 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
1956 # ===================================================================
1962 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
1964 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
1965 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1966 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1967 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
1968 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
1969 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
1973 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1975 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
1976 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1977 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1978 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
1982 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
1984 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
1985 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
1989 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
1991 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
1992 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
1993 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
1994 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
1995 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
1996 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
1997 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2001 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2003 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2004 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2005 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2006 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2007 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2008 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2009 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2013 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2015 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2016 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2017 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2018 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2019 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2020 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2021 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2022 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2034 <table width='100%'>
2037 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2038 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2039 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2040 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2046 <table width='100%'>
2048 <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'> $Lang ::tr{'required field'}</font></td>
2049 <td align='right'> </td>
2056 & Header
:: closebox
();
2060 # ===================================================================
2061 # NCSA user management
2062 # ===================================================================
2064 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2066 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2067 <table width='100%'>
2069 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2072 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2073 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2076 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly='readonly' " ; }
2079 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2081 <select name='NCSA_GROUP'>
2082 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2083 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2084 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2090 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2091 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2092 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2093 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2100 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2101 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2102 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2105 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2106 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2112 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2117 <table width='100%'>
2119 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2122 <table width='100%' align='center'>
2128 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2129 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2133 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2134 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2138 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2139 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2142 @userlist = sort ( @userlist );
2144 # If the password file contains entries, print entries and action icons
2146 if ( ! - z
" $userdb " ) {
2149 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2150 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2151 <td class='boldbase' colspan='2' align='center'> </td>
2156 foreach $line ( @userlist )
2160 @temp = split ( /:/ , $line );
2161 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2162 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2164 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2166 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2169 <td align='center'> $temp [0]</td>
2173 if ( $temp [ 1 ] eq 'standard' ) {
2174 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2175 } elsif ( $temp [ 1 ] eq 'extended' ) {
2176 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2177 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2178 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2181 <td width='8%' align='center'>
2182 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2183 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2184 <input type='hidden' name='ID' value=' $line ' />
2185 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2189 <td width='8%' align='center'>
2190 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2191 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2192 <input type='hidden' name='ID' value=' $temp [0]' />
2193 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2206 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2207 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2208 <td class='base'> $Lang ::tr{'edit'}</td>
2209 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2210 <td class='base'> $Lang ::tr{'remove'}</td>
2217 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2228 & Header
:: closebox
();
2232 # ===================================================================
2234 & Header
:: closebigbox
();
2236 & Header
:: closepage
();
2238 # -------------------------------------------------------------------
2242 if (- e
" $acl_src_subnets " ) {
2243 open ( FILE
, " $acl_src_subnets " );
2244 delete $proxysettings { 'SRC_SUBNETS' };
2245 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2248 if (- e
" $acl_src_banned_ip " ) {
2249 open ( FILE
, " $acl_src_banned_ip " );
2250 delete $proxysettings { 'SRC_BANNED_IP' };
2251 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2254 if (- e
" $acl_src_banned_mac " ) {
2255 open ( FILE
, " $acl_src_banned_mac " );
2256 delete $proxysettings { 'SRC_BANNED_MAC' };
2257 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2260 if (- e
" $acl_src_unrestricted_ip " ) {
2261 open ( FILE
, " $acl_src_unrestricted_ip " );
2262 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2263 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2266 if (- e
" $acl_src_unrestricted_mac " ) {
2267 open ( FILE
, " $acl_src_unrestricted_mac " );
2268 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2269 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2272 if (- e
" $acl_dst_nocache " ) {
2273 open ( FILE
, " $acl_dst_nocache " );
2274 delete $proxysettings { 'DST_NOCACHE' };
2275 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2278 if (- e
" $acl_dst_noauth " ) {
2279 open ( FILE
, " $acl_dst_noauth " );
2280 delete $proxysettings { 'DST_NOAUTH' };
2281 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2284 if (- e
" $acl_ports_safe " ) {
2285 open ( FILE
, " $acl_ports_safe " );
2286 delete $proxysettings { 'PORTS_SAFE' };
2287 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2290 if (- e
" $acl_ports_ssl " ) {
2291 open ( FILE
, " $acl_ports_ssl " );
2292 delete $proxysettings { 'PORTS_SSL' };
2293 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2296 if (- e
" $mimetypes " ) {
2297 open ( FILE
, " $mimetypes " );
2298 delete $proxysettings { 'MIME_TYPES' };
2299 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2302 if (- e
" $raddir /radauth.allowusers" ) {
2303 open ( FILE
, " $raddir /radauth.allowusers" );
2304 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2305 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2308 if (- e
" $raddir /radauth.denyusers" ) {
2309 open ( FILE
, " $raddir /radauth.denyusers" );
2310 delete $proxysettings { 'RADIUS_DENY_USERS' };
2311 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2314 if (- e
" $identdir /identauth.allowusers" ) {
2315 open ( FILE
, " $identdir /identauth.allowusers" );
2316 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2317 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2320 if (- e
" $identdir /identauth.denyusers" ) {
2321 open ( FILE
, " $identdir /identauth.denyusers" );
2322 delete $proxysettings { 'IDENT_DENY_USERS' };
2323 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2326 if (- e
" $identhosts " ) {
2327 open ( FILE
, " $identhosts " );
2328 delete $proxysettings { 'IDENT_HOSTS' };
2329 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2332 if (- e
" $cre_groups " ) {
2333 open ( FILE
, " $cre_groups " );
2334 delete $proxysettings { 'CRE_GROUPS' };
2335 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2338 if (- e
" $cre_svhosts " ) {
2339 open ( FILE
, " $cre_svhosts " );
2340 delete $proxysettings { 'CRE_SVHOSTS' };
2341 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2346 # -------------------------------------------------------------------
2350 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2351 undef $proxysettings { 'PORTS_SAFE' };
2354 s/^\s+//g ; s/\s+$//g ;
2358 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2360 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2361 @templist = split ( /-/ );
2362 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2363 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2367 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2368 undef $proxysettings { 'PORTS_SSL' };
2371 s/^\s+//g ; s/\s+$//g ;
2376 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2377 @templist = split ( /-/ );
2378 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2379 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2383 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2384 undef $proxysettings { 'DST_NOCACHE' };
2388 unless ( /^#/ ) { s/\s+//g ; }
2391 if ( /^\./ ) { $_ = '*' . $_ ; }
2392 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2396 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2397 undef $proxysettings { 'SRC_SUBNETS' };
2400 s/^\s+//g ; s/\s+$//g ;
2403 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2404 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2408 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2409 undef $proxysettings { 'SRC_BANNED_IP' };
2412 s/^\s+//g ; s/\s+$//g ;
2415 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2416 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2420 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2421 undef $proxysettings { 'SRC_BANNED_MAC' };
2424 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2427 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2428 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2432 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2433 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2436 s/^\s+//g ; s/\s+$//g ;
2439 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2440 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2444 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2445 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2448 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2451 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2452 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2456 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2457 undef $proxysettings { 'DST_NOAUTH' };
2461 unless ( /^#/ ) { s/\s+//g ; }
2464 if ( /^\./ ) { $_ = '*' . $_ ; }
2465 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2469 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2471 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2472 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2475 s/^\s+//g ; s/\s+$//g ;
2476 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2478 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2481 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2483 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2484 undef $proxysettings { 'NTLM_DENY_USERS' };
2487 s/^\s+//g ; s/\s+$//g ;
2488 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2490 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2493 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2495 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2496 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2499 s/^\s+//g ; s/\s+$//g ;
2500 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2502 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2505 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2507 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2508 undef $proxysettings { 'IDENT_DENY_USERS' };
2511 s/^\s+//g ; s/\s+$//g ;
2512 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2514 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2517 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2519 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2520 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2523 s/^\s+//g ; s/\s+$//g ;
2524 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2526 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2529 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2531 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2532 undef $proxysettings { 'RADIUS_DENY_USERS' };
2535 s/^\s+//g ; s/\s+$//g ;
2536 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2538 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2541 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2542 undef $proxysettings { 'IDENT_HOSTS' };
2545 s/^\s+//g ; s/\s+$//g ;
2548 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2549 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2553 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2554 undef $proxysettings { 'CRE_SVHOSTS' };
2557 s/^\s+//g ; s/\s+$//g ;
2560 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2561 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2566 # -------------------------------------------------------------------
2570 open ( FILE
, "> $acl_src_subnets " );
2572 if (! $proxysettings { 'SRC_SUBNETS' })
2574 print FILE
" $green_cidr \n " ;
2575 if ( $netsettings { 'BLUE_DEV' })
2577 print FILE
" $blue_cidr \n " ;
2579 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2582 open ( FILE
, "> $acl_src_banned_ip " );
2584 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2587 open ( FILE
, "> $acl_src_banned_mac " );
2589 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2592 open ( FILE
, "> $acl_src_unrestricted_ip " );
2594 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2597 open ( FILE
, "> $acl_src_unrestricted_mac " );
2599 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2602 open ( FILE
, "> $acl_dst_noauth " );
2604 print FILE
$proxysettings { 'DST_NOAUTH' };
2607 open ( FILE
, "> $acl_dst_noauth_net " );
2609 open ( FILE
, "> $acl_dst_noauth_dom " );
2611 open ( FILE
, "> $acl_dst_noauth_url " );
2614 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2622 open ( FILE
, ">> $acl_dst_noauth_dom " );
2627 elsif (& General
:: validipormask
( $_ ))
2629 open ( FILE
, ">> $acl_dst_noauth_net " );
2634 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?/ )
2636 open ( FILE
, ">> $acl_dst_noauth_net " );
2643 open ( FILE
, ">> $acl_dst_noauth_url " );
2645 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2651 open ( FILE
, "> $acl_dst_nocache " );
2653 print FILE
$proxysettings { 'DST_NOCACHE' };
2656 open ( FILE
, "> $acl_dst_nocache_net " );
2658 open ( FILE
, "> $acl_dst_nocache_dom " );
2660 open ( FILE
, "> $acl_dst_nocache_url " );
2663 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2671 open ( FILE
, ">> $acl_dst_nocache_dom " );
2676 elsif (& General
:: validipormask
( $_ ))
2678 open ( FILE
, ">> $acl_dst_nocache_net " );
2683 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?/ )
2685 open ( FILE
, ">> $acl_dst_nocache_net " );
2692 open ( FILE
, ">> $acl_dst_nocache_url " );
2694 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2700 open ( FILE
, "> $acl_ports_safe " );
2702 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2705 open ( FILE
, "> $acl_ports_ssl " );
2707 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2710 open ( FILE
, "> $acl_dst_throttle " );
2712 if ( $proxysettings { 'THROTTLE_BINARY' } eq 'on' )
2714 @temp = split ( /\|/ , $throttle_binary );
2715 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2717 if ( $proxysettings { 'THROTTLE_DSKIMG' } eq 'on' )
2719 @temp = split ( /\|/ , $throttle_dskimg );
2720 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2722 if ( $proxysettings { 'THROTTLE_MMEDIA' } eq 'on' )
2724 @temp = split ( /\|/ , $throttle_mmedia );
2725 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2727 if (- s
$throttled_urls )
2729 open ( URLFILE
, $throttled_urls );
2732 foreach ( @temp ) { print FILE
; }
2736 open ( FILE
, "> $mimetypes " );
2738 print FILE
$proxysettings { 'MIME_TYPES' };
2741 open ( FILE
, "> $raddir /radauth.allowusers" );
2743 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2746 open ( FILE
, "> $raddir /radauth.denyusers" );
2748 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2751 open ( FILE
, "> $identdir /identauth.allowusers" );
2753 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2756 open ( FILE
, "> $identdir /identauth.denyusers" );
2758 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2761 open ( FILE
, "> $identhosts " );
2763 print FILE
$proxysettings { 'IDENT_HOSTS' };
2766 open ( FILE
, "> $cre_groups " );
2768 print FILE
$proxysettings { 'CRE_GROUPS' };
2771 open ( FILE
, "> $cre_svhosts " );
2773 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2777 # -------------------------------------------------------------------
2781 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2783 print FILE
"function FindProxyForURL(url, host) \n " ;
2785 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2789 (isPlainHostName(host)) ||
2790 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2794 if ( $netsettings { 'GREEN_DEV' }) {
2795 print FILE
" (isInNet(host, \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" )) || \n " ;
2798 if (& Header
:: blue_used
() && $netsettings { 'BLUE_DEV' }) {
2799 print FILE
" (isInNet(host, \" $netsettings {'BLUE_NETADDRESS'} \" , \" $netsettings {'BLUE_NETMASK'} \" )) || \n " ;
2802 if (& Header
:: orange_used
() && $netsettings { 'ORANGE_DEV' }) {
2803 print FILE
" (isInNet(host, \" $netsettings {'ORANGE_NETADDRESS'} \" , \" $netsettings {'ORANGE_NETMASK'} \" )) || \n " ;
2807 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2815 if ( $proxysettings { 'ENABLE' } eq 'on' )
2817 print FILE
"if ( \n " ;
2818 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2821 if (- e
" $acl_src_subnets " ) {
2822 open ( SUBNETS
, " $acl_src_subnets " );
2823 @templist = < SUBNETS
>;
2829 @temp = split ( /\/ /);
2831 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2832 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2836 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
2844 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2848 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
2850 print FILE
" \n else \n\n " ;
2852 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2856 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
2858 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
2867 # -------------------------------------------------------------------
2874 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
2875 $proxysettings { 'THROTTLING_GREEN_HOST' } +
2876 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
2877 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
2879 $delaypools = 1 ; } else { $delaypools = 0 ;
2882 if ( $proxysettings { 'AUTH_REALM' } eq '' )
2884 $authrealm = "IPFire Advanced Proxy Server" ;
2886 $authrealm = $proxysettings { 'AUTH_REALM' };
2889 $_ = $proxysettings { 'UPSTREAM_PROXY' };
2890 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
2892 if ( $remoteport eq '' ) { $remoteport = 80 ; }
2894 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
2897 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
2898 # you make will be overwritten whenever you resave proxy settings using the
2901 # Instead, modify the file ' $acl_include ' and
2902 # then restart the proxy service using the web interface. Changes made to the
2903 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
2905 shutdown_lifetime 5 seconds
2911 # Include file with user defined settings.
2912 if (- e
"/etc/squid/squid.conf.pre.local" ) {
2913 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
2916 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2917 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2920 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) {
2921 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
2922 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2926 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
2927 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
2928 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2931 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) {
2932 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'TRANSPARENT_PORT'} intercept" ;
2933 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
2938 if (( $proxysettings { 'CACHE_SIZE' } > 0 ) || ( $proxysettings { 'CACHE_MEM' } > 0 ))
2942 if (!- z
$acl_dst_nocache_dom ) {
2943 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
2944 print FILE
"cache deny no_cache_domains \n " ;
2946 if (!- z
$acl_dst_nocache_net ) {
2947 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
2948 print FILE
"cache deny no_cache_ipaddr \n " ;
2950 if (!- z
$acl_dst_nocache_url ) {
2951 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
2952 print FILE
"cache deny no_cache_hosts \n " ;
2958 cache_effective_user squid
2961 pid_filename /var/run/squid.pid
2963 cache_mem $proxysettings {'CACHE_MEM'} MB
2966 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
2968 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
2969 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
2971 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
2973 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
2975 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
2977 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
2979 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
2984 open ( PORTS
, " $acl_ports_ssl " );
2985 my @ssl_ports = < PORTS
>;
2989 foreach ( @ssl_ports ) {
2990 print FILE
"acl SSL_ports port $_ " ;
2994 open ( PORTS
, " $acl_ports_safe " );
2995 my @safe_ports = < PORTS
>;
2999 foreach ( @safe_ports ) {
3000 print FILE
"acl Safe_ports port $_ " ;
3006 acl IPFire_http port $http_port
3007 acl IPFire_https port $https_port
3008 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3009 acl IPFire_networks src " $acl_src_subnets "
3010 acl IPFire_servers dst " $acl_src_subnets "
3011 acl IPFire_green_network src $green_cidr
3012 acl IPFire_green_servers dst $green_cidr
3015 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3016 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3017 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3018 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3019 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3020 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3022 acl CONNECT method CONNECT
3026 if ( $proxysettings { 'CACHE_SIZE' } > 0 ) {
3028 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3029 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3031 cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256
3035 if ( $proxysettings { 'CACHE_MEM' } > 0 ) {
3036 # always 2% of CACHE_MEM defined as max object size
3037 print FILE
"maximum_object_size_in_memory " . int ( $proxysettings { 'CACHE_MEM' } * 1024 * 0.02 ) . " KB \n\n " ;
3039 print FILE
"cache deny all \n\n " ;
3044 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3048 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3049 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3050 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3051 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3053 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3057 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3059 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3062 if ( $proxysettings { 'LOGGING' } eq 'on' )
3065 access_log stdio:/var/log/squid/access.log
3066 cache_log /var/log/squid/cache.log
3067 cache_store_log none
3070 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"access_log stdio:\/var\/log\/squid\/user_agent.log useragent \n " ; }
3071 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3074 access_log /dev/null
3076 cache_store_log none
3085 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3087 print FILE
"forwarded_for on \n " ;
3089 print FILE
"forwarded_for off \n " ;
3091 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3093 print FILE
"via on \n " ;
3095 print FILE
"via off \n " ;
3099 # If we use authentication, users must always authenticate
3100 unless ( $proxysettings { "AUTH_METHOD" } eq "" ) {
3101 print FILE
"authenticate_ip_ttl 0 \n\n " ;
3104 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3106 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3108 print FILE
"auth_param basic program $authdir /basic_ncsa_auth $userdb \n " ;
3109 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3110 print FILE
"auth_param basic realm $authrealm \n " ;
3111 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3114 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3116 print FILE
"auth_param basic utf8 on \n " ;
3117 print FILE
"auth_param basic program $authdir /basic_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3118 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3119 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3120 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3122 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3124 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3126 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3128 print FILE
" -u sAMAccountName -P" ;
3130 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3132 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3134 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3136 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3138 print FILE
" -u cn -P" ;
3140 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3142 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3144 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3146 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3148 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3149 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3150 print FILE
" -u uid -P" ;
3152 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3153 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3154 print FILE
"auth_param basic realm $authrealm \n " ;
3155 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3158 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm-auth' )
3160 print FILE
"auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp" ;
3161 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3162 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3163 $ntlm_auth_group =~ s/\\/\+/ ;
3165 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3169 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n\n " ;
3170 print FILE
"auth_param ntlm credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3172 # BASIC authentication
3173 if ( $proxysettings { 'NTLM_AUTH_BASIC' } eq "on" ) {
3174 print FILE
"auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic" ;
3175 if ( $proxysettings { 'NTLM_AUTH_GROUP' }) {
3176 my $ntlm_auth_group = $proxysettings { 'NTLM_AUTH_GROUP' };
3177 $ntlm_auth_group =~ s/\\/\+/ ;
3179 print FILE
" --require-membership-of= $ntlm_auth_group " ;
3182 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3183 print FILE
"auth_param basic realm $authrealm \n " ;
3184 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n\n " ;
3188 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3190 print FILE
"auth_param basic program $authdir /basic_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3191 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3192 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3193 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3194 print FILE
"auth_param basic realm $authrealm \n " ;
3195 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3199 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3200 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3202 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3204 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3206 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3208 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3211 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3214 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3215 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3217 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3220 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3221 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3222 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3227 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3229 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3231 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3233 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3235 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3237 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3239 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3241 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3244 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3245 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3246 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3250 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3252 print FILE
"acl within_timeframe time " ;
3253 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3254 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3255 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3256 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3257 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3258 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3259 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3260 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3261 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3262 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3263 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3265 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3266 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3269 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3272 #Classroom extensions
3273 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3274 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3277 print FILE
"deny_info " ;
3278 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3280 print FILE
"ERR_ACCESS_DISABLED" ;
3282 print FILE
"ERR_ACCESS_DENIED" ;
3284 print FILE
" IPFire_no_access_ips \n " ;
3285 print FILE
"deny_info " ;
3286 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3288 print FILE
"ERR_ACCESS_DISABLED" ;
3290 print FILE
"ERR_ACCESS_DENIED" ;
3292 print FILE
" IPFire_no_access_mac \n " ;
3295 http_access deny IPFire_no_access_ips
3296 http_access deny IPFire_no_access_mac
3301 #Insert acl file and replace __VAR__ with correct values
3302 my $blue_net = '' ; #BLUE empty by default
3304 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3305 $blue_net = " $blue_cidr " ;
3306 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3308 if (!- z
$acl_include )
3310 open ( ACL
, " $acl_include " );
3311 print FILE
" \n #Start of custom includes \n\n " ;
3313 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3314 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3315 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3316 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3317 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3320 print FILE
" \n #End of custom includes \n " ;
3323 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3325 # Check if squidclamav is enabled.
3326 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3327 print FILE
" \n #Settings for squidclamav: \n " ;
3328 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} \n " ;
3329 print FILE
"acl purge method PURGE \n " ;
3330 print FILE
"http_access deny to_localhost \n " ;
3331 print FILE
"http_access allow localhost \n " ;
3332 print FILE
"http_access allow purge localhost \n " ;
3333 print FILE
"http_access deny purge \n " ;
3334 print FILE
"url_rewrite_access deny localhost \n " ;
3339 #local machine, no restriction
3340 http_access allow localhost
3342 #GUI admin if local machine connects
3343 http_access allow IPFire_ips IPFire_networks IPFire_http
3344 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3346 #Deny not web services
3350 print FILE
"http_access deny !Safe_ports \n " ;
3354 print FILE
"http_access deny CONNECT !SSL_ports \n " ;
3357 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3359 print FILE
"#Set ident ACLs \n " ;
3360 if (!- z
$identhosts )
3362 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3363 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3364 print FILE
"ident_lookup_access deny all \n " ;
3366 print FILE
"ident_lookup_access allow all \n " ;
3368 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3372 print FILE
"#Set download throttling \n " ;
3374 if ( $netsettings { 'BLUE_DEV' })
3376 print FILE
"delay_pools 2 \n " ;
3378 print FILE
"delay_pools 1 \n " ;
3381 print FILE
"delay_class 1 3 \n " ;
3382 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3384 print FILE
"delay_parameters 1 " ;
3385 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3389 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3391 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3394 print FILE
" -1/-1 " ;
3395 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3399 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3401 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3405 if ( $netsettings { 'BLUE_DEV' })
3407 print FILE
"delay_parameters 2 " ;
3408 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3412 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3414 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3416 print FILE
" -1/-1 " ;
3417 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3421 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3423 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3428 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3429 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3430 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3431 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3433 if ( $netsettings { 'BLUE_DEV' })
3435 print FILE
"delay_access 1 allow IPFire_green_network" ;
3436 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3438 print FILE
"delay_access 1 deny all \n " ;
3440 print FILE
"delay_access 1 allow all" ;
3441 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3445 if ( $netsettings { 'BLUE_DEV' })
3447 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3448 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3449 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3450 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3451 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3452 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3454 print FILE
"delay_access 2 deny all \n " ;
3457 print FILE
"delay_initial_bucket_level 100 \n " ;
3461 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3463 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3464 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3467 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3469 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3470 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3471 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3475 #Set custom configured ACLs
3478 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3479 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3481 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3483 if (!- z
$acl_src_unrestricted_ip )
3485 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3486 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3487 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3489 if (!- z
$acl_src_unrestricted_mac )
3491 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3492 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3493 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3495 if (!- z
$acl_dst_noauth_net )
3497 print FILE
"http_access allow IPFire_networks" ;
3498 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3499 print FILE
" !within_timeframe" ;
3501 print FILE
" within_timeframe" ; }
3502 print FILE
" to_ipaddr_without_auth \n " ;
3504 if (!- z
$acl_dst_noauth_dom )
3506 print FILE
"http_access allow IPFire_networks" ;
3507 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3508 print FILE
" !within_timeframe" ;
3510 print FILE
" within_timeframe" ; }
3511 print FILE
" to_domains_without_auth \n " ;
3513 if (!- z
$acl_dst_noauth_url )
3515 print FILE
"http_access allow IPFire_networks" ;
3516 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3517 print FILE
" !within_timeframe" ;
3519 print FILE
" within_timeframe" ; }
3520 print FILE
" to_hosts_without_auth \n " ;
3524 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3526 print FILE
"http_access deny !for_inetusers" ;
3527 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3532 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3533 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3534 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3535 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3536 (!- z
" $identdir /identauth.denyusers" )
3539 print FILE
"http_access deny for_acl_users" ;
3540 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3544 if (!- z
$acl_src_unrestricted_ip )
3546 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3547 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3549 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3551 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3553 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3555 print FILE
" for_inetusers" ;
3557 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3559 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3561 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3563 print FILE
" for_acl_users" ;
3565 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3567 print FILE
" !for_acl_users" ;
3569 } else { print FILE
" for_inetusers" ; }
3575 if (!- z
$acl_src_unrestricted_mac )
3577 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3578 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3580 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3582 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3584 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3586 print FILE
" for_inetusers" ;
3588 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3590 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3592 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3594 print FILE
" for_acl_users" ;
3596 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3598 print FILE
" !for_acl_users" ;
3600 } else { print FILE
" for_inetusers" ; }
3606 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3608 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3609 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3614 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3615 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3616 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3617 (!- z
" $raddir /radauth.denyusers" )
3621 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3622 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3623 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3624 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3625 (!- z
" $identdir /identauth.denyusers" )
3629 print FILE
"http_access deny for_acl_users" ;
3630 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3634 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3636 print FILE
"http_access allow" ;
3637 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3638 print FILE
" !within_timeframe" ;
3640 print FILE
" within_timeframe" ; }
3641 print FILE
" !on_ident_aware_hosts \n " ;
3644 print FILE
"http_access allow IPFire_networks" ;
3647 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3648 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3649 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3650 (!- z
" $raddir /radauth.allowusers" )
3654 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3655 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3656 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3657 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3658 (!- z
" $identdir /identauth.allowusers" )
3662 print FILE
" for_acl_users" ;
3663 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3664 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3665 print FILE
" for_inetusers" ;
3667 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3669 print FILE
" !concurrent" ;
3671 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3672 print FILE
" !within_timeframe" ;
3674 print FILE
" within_timeframe" ; }
3677 print FILE
"http_access deny all \n\n " ;
3679 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3680 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3682 print FILE
"#Strip HTTP Header \n " ;
3684 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3686 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3687 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3689 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3691 print FILE
"request_header_access Via deny all \n " ;
3692 print FILE
"reply_header_access Via deny all \n " ;
3694 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3696 print FILE
"request_header_access User-Agent deny all \n " ;
3697 print FILE
"reply_header_access User-Agent deny all \n " ;
3699 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3701 print FILE
"request_header_access Referer deny all \n " ;
3702 print FILE
"reply_header_access Referer deny all \n " ;
3707 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3709 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3711 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3713 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3715 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3721 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3723 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3724 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3725 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3726 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3728 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3730 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3731 print FILE
"http_reply_access allow all \n\n " ;
3734 print FILE
"visible_hostname" ;
3735 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3737 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3739 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3742 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3743 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3746 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3748 # Write the parent proxy info, if needed.
3749 if ( $remotehost ne '' )
3751 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3753 # Enter authentication for the parent cache. Option format is
3754 # login=user:password ($proxy1='YES')
3755 # login=PASS ($proxy1='PASS')
3756 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3757 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3759 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3760 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3762 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3764 print FILE
" \n always_direct allow IPFire_ips \n " ;
3765 print FILE
"never_direct allow all \n\n " ;
3767 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3769 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3770 print FILE
"url_rewrite_children " , & General
:: number_cpu_cores
();
3771 print FILE
" startup=" , & General
:: number_cpu_cores
();
3772 print FILE
" idle=" , & General
:: number_cpu_cores
();
3773 print FILE
" queue-size=" , & General
:: number_cpu_cores
() * 32 , " \n\n " ;
3776 # Include file with user defined settings.
3777 if (- e
"/etc/squid/squid.conf.local" ) {
3778 print FILE
"include /etc/squid/squid.conf.local \n " ;
3782 # Proxy settings for squidclamav - if installed.
3784 # Check if squidclamav is enabled.
3785 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3787 my $configfile = '/etc/squidclamav.conf' ;
3789 my $data = & General
:: read_file_utf8
( $configfile );
3790 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
3791 & General
:: write_file_utf8
( $configfile , $data );
3795 # -------------------------------------------------------------------
3799 my ( $str_user , $str_pass , $str_group ) = @_ ;
3800 my @groupmembers =();
3802 if ( $str_pass eq 'lEaVeAlOnE' )
3804 open ( FILE
, " $userdb " );
3805 @groupmembers = < FILE
>;
3807 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
3808 & deluser
( $str_user );
3809 open ( FILE
, ">> $userdb " );
3811 print FILE
" $str_user $str_pass " ;
3814 & deluser
( $str_user );
3816 my $htpasswd = new Apache
:: Htpasswd
( " $userdb " );
3817 $htpasswd -> htpasswd ( $str_user , $str_pass );
3820 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
3821 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
3822 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
3824 print FILE
" $str_user \n " ;
3830 # -------------------------------------------------------------------
3834 my ( $str_user ) = @_ ;
3836 my @groupmembers =();
3839 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
3842 open ( FILE
, " $groupfile " );
3843 @groupmembers = < FILE
>;
3845 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
3846 open ( FILE
, "> $groupfile " );
3848 print FILE
@templist ;
3853 open ( FILE
, " $userdb " );
3854 @groupmembers = < FILE
>;
3856 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
3857 open ( FILE
, "> $userdb " );
3859 print FILE
@templist ;
3865 # -------------------------------------------------------------------
3869 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
3871 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
3872 print FILE
"localhost" ;
3877 # -------------------------------------------------------------------