]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/proxy.cgi
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 $
31 # enable only the following on debugging purpose
33 #use CGI::Carp 'fatalsToBrowser';
35 require '/var/ipfire/general-functions.pl' ;
36 require "${General::swroot}/lang.pl" ;
37 require "${General::swroot}/header.pl" ;
39 my @squidversion = `/usr/sbin/squid -v` ;
44 my %mainsettings = ();
45 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
46 & General
:: readhash
( "/srv/web/ipfire/html/themes/" . $mainsettings { 'THEME' }. "/include/colors.txt" , \
%color );
50 my %filtersettings =();
51 my %xlratorsettings =();
52 my %stdproxysettings =();
58 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 );
59 my $throttle_binary = "7z|arj|bin|bz2|cab|exe|gz|lzh|rar|sea|tar|tgz|xz|zip" ;
60 my $throttle_dskimg = "b5t|bin|bwt|ccd|cdi|cue|gho|img|iso|mds|nrg|pqi|vmdk" ;
61 my $throttle_mmedia = "aiff?|asf|avi|divx|mov|mp3|mpe?g|ogg|qt|ra?m|ts|vob" ;
63 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 " ;
64 my $def_ports_ssl = "443 # https \n 563 # snews \n " ;
69 my $hintcolour = '#FFFFCC' ;
70 my $ncsa_buttontext = '' ;
85 my $browser_regexp = '' ;
89 my $acldir = "${General::swroot}/proxy/advanced/acls" ;
90 my $ncsadir = "${General::swroot}/proxy/advanced/ncsa" ;
91 my $ntlmdir = "${General::swroot}/proxy/advanced/ntlm" ;
92 my $raddir = "${General::swroot}/proxy/advanced/radius" ;
93 my $identdir = "${General::swroot}/proxy/advanced/ident" ;
94 my $credir = "${General::swroot}/proxy/advanced/cre" ;
96 my $userdb = " $ncsadir /passwd" ;
97 my $stdgrp = " $ncsadir /standard.grp" ;
98 my $extgrp = " $ncsadir /extended.grp" ;
99 my $disgrp = " $ncsadir /disabled.grp" ;
101 my $browserdb = "${General::swroot}/proxy/advanced/useragents" ;
102 my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes" ;
103 my $throttled_urls = "${General::swroot}/proxy/advanced/throttle" ;
105 my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable" ;
106 my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms" ;
107 my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors" ;
109 my $identhosts = " $identdir /hosts" ;
111 my $authdir = "/usr/lib/squid/" ;
112 my $errordir = "/usr/lib/squid/errors" ;
114 my $acl_src_subnets = " $acldir /src_subnets.acl" ;
115 my $acl_src_banned_ip = " $acldir /src_banned_ip.acl" ;
116 my $acl_src_banned_mac = " $acldir /src_banned_mac.acl" ;
117 my $acl_src_unrestricted_ip = " $acldir /src_unrestricted_ip.acl" ;
118 my $acl_src_unrestricted_mac = " $acldir /src_unrestricted_mac.acl" ;
119 my $acl_src_noaccess_ip = " $acldir /src_noaccess_ip.acl" ;
120 my $acl_src_noaccess_mac = " $acldir /src_noaccess_mac.acl" ;
121 my $acl_dst_noauth = " $acldir /dst_noauth.acl" ;
122 my $acl_dst_noauth_dom = " $acldir /dst_noauth_dom.acl" ;
123 my $acl_dst_noauth_net = " $acldir /dst_noauth_net.acl" ;
124 my $acl_dst_noauth_url = " $acldir /dst_noauth_url.acl" ;
125 my $acl_dst_nocache = " $acldir /dst_nocache.acl" ;
126 my $acl_dst_nocache_dom = " $acldir /dst_nocache_dom.acl" ;
127 my $acl_dst_nocache_net = " $acldir /dst_nocache_net.acl" ;
128 my $acl_dst_nocache_url = " $acldir /dst_nocache_url.acl" ;
129 my $acl_dst_throttle = " $acldir /dst_throttle.acl" ;
130 my $acl_ports_safe = " $acldir /ports_safe.acl" ;
131 my $acl_ports_ssl = " $acldir /ports_ssl.acl" ;
132 my $acl_include = " $acldir /include.acl" ;
134 my $updaccelversion = 'n/a' ;
135 my $urlfilterversion = 'n/a' ;
137 unless (- d
" $acldir " ) { mkdir ( " $acldir " ); }
138 unless (- d
" $ncsadir " ) { mkdir ( " $ncsadir " ); }
139 unless (- d
" $ntlmdir " ) { mkdir ( " $ntlmdir " ); }
140 unless (- d
" $raddir " ) { mkdir ( " $raddir " ); }
141 unless (- d
" $identdir " ) { mkdir ( " $identdir " ); }
142 unless (- d
" $credir " ) { mkdir ( " $credir " ); }
144 unless (- e
$cre_groups ) { system ( "touch $cre_groups " ); }
145 unless (- e
$cre_svhosts ) { system ( "touch $cre_svhosts " ); }
147 unless (- e
$userdb ) { system ( "touch $userdb " ); }
148 unless (- e
$stdgrp ) { system ( "touch $stdgrp " ); }
149 unless (- e
$extgrp ) { system ( "touch $extgrp " ); }
150 unless (- e
$disgrp ) { system ( "touch $disgrp " ); }
152 unless (- e
$acl_src_subnets ) { system ( "touch $acl_src_subnets " ); }
153 unless (- e
$acl_src_banned_ip ) { system ( "touch $acl_src_banned_ip " ); }
154 unless (- e
$acl_src_banned_mac ) { system ( "touch $acl_src_banned_mac " ); }
155 unless (- e
$acl_src_unrestricted_ip ) { system ( "touch $acl_src_unrestricted_ip " ); }
156 unless (- e
$acl_src_unrestricted_mac ) { system ( "touch $acl_src_unrestricted_mac " ); }
157 unless (- e
$acl_src_noaccess_ip ) { system ( "touch $acl_src_noaccess_ip " ); }
158 unless (- e
$acl_src_noaccess_mac ) { system ( "touch $acl_src_noaccess_mac " ); }
159 unless (- e
$acl_dst_noauth ) { system ( "touch $acl_dst_noauth " ); }
160 unless (- e
$acl_dst_noauth_dom ) { system ( "touch $acl_dst_noauth_dom " ); }
161 unless (- e
$acl_dst_noauth_net ) { system ( "touch $acl_dst_noauth_net " ); }
162 unless (- e
$acl_dst_noauth_url ) { system ( "touch $acl_dst_noauth_url " ); }
163 unless (- e
$acl_dst_nocache ) { system ( "touch $acl_dst_nocache " ); }
164 unless (- e
$acl_dst_nocache_dom ) { system ( "touch $acl_dst_nocache_dom " ); }
165 unless (- e
$acl_dst_nocache_net ) { system ( "touch $acl_dst_nocache_net " ); }
166 unless (- e
$acl_dst_nocache_url ) { system ( "touch $acl_dst_nocache_url " ); }
167 unless (- e
$acl_dst_throttle ) { system ( "touch $acl_dst_throttle " ); }
168 unless (- e
$acl_ports_safe ) { system ( "touch $acl_ports_safe " ); }
169 unless (- e
$acl_ports_ssl ) { system ( "touch $acl_ports_ssl " ); }
170 unless (- e
$acl_include ) { system ( "touch $acl_include " ); }
172 unless (- e
$browserdb ) { system ( "touch $browserdb " ); }
173 unless (- e
$mimetypes ) { system ( "touch $mimetypes " ); }
175 open FILE
, $browserdb ;
176 @useragentlist = sort { reverse ( substr ( reverse ( substr ( $a , index ( $a , ',' )+ 1 )), index ( reverse ( substr ( $a , index ( $a , ',' ))), ',' )+ 1 )) cmp reverse ( substr ( reverse ( substr ( $b , index ( $b , ',' )+ 1 )), index ( reverse ( substr ( $b , index ( $b , ',' ))), ',' )+ 1 ))} grep ! /(^$)|(^\s*#)/ ,< FILE
>;
179 & General
:: readhash
( "${General::swroot}/ethernet/settings" , \
%netsettings );
180 & General
:: readhash
( "${General::swroot}/main/settings" , \
%mainsettings );
182 my $green_cidr = & General
:: ipcidr
( " $netsettings {'GREEN_NETADDRESS'}\/ $netsettings {'GREEN_NETMASK'}" );
183 my $blue_cidr = "# Blue not defined" ;
184 if ( $netsettings { 'BLUE_DEV' }) {
185 $blue_cidr = & General
:: ipcidr
( " $netsettings {'BLUE_NETADDRESS'}\/ $netsettings {'BLUE_NETMASK'}" );
188 & Header
:: showhttpheaders
();
190 $proxysettings { 'ACTION' } = '' ;
191 $proxysettings { 'VALID' } = '' ;
193 $proxysettings { 'ENABLE' } = 'off' ;
194 $proxysettings { 'ENABLE_BLUE' } = 'off' ;
195 $proxysettings { 'TRANSPARENT' } = 'off' ;
196 $proxysettings { 'TRANSPARENT_BLUE' } = 'off' ;
197 $proxysettings { 'PROXY_PORT' } = '800' ;
198 $proxysettings { 'VISIBLE_HOSTNAME' } = '' ;
199 $proxysettings { 'ADMIN_MAIL_ADDRESS' } = '' ;
200 $proxysettings { 'ADMIN_PASSWORD' } = '' ;
201 $proxysettings { 'ERR_LANGUAGE' } = 'German' ;
202 $proxysettings { 'ERR_DESIGN' } = 'ipfire' ;
203 $proxysettings { 'SUPPRESS_VERSION' } = 'off' ;
204 $proxysettings { 'FORWARD_VIA' } = 'off' ;
205 $proxysettings { 'FORWARD_IPADDRESS' } = 'off' ;
206 $proxysettings { 'FORWARD_USERNAME' } = 'off' ;
207 $proxysettings { 'NO_CONNECTION_AUTH' } = 'off' ;
208 $proxysettings { 'UPSTREAM_PROXY' } = '' ;
209 $proxysettings { 'UPSTREAM_USER' } = '' ;
210 $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;
211 $proxysettings { 'LOGGING' } = 'off' ;
212 $proxysettings { 'CACHEMGR' } = 'off' ;
213 $proxysettings { 'LOGQUERY' } = 'off' ;
214 $proxysettings { 'LOGUSERAGENT' } = 'off' ;
215 $proxysettings { 'FILEDESCRIPTORS' } = '4096' ;
216 $proxysettings { 'CACHE_MEM' } = '2' ;
217 $proxysettings { 'CACHE_SIZE' } = '50' ;
218 $proxysettings { 'MAX_SIZE' } = '4096' ;
219 $proxysettings { 'MIN_SIZE' } = '0' ;
220 $proxysettings { 'MEM_POLICY' } = 'LRU' ;
221 $proxysettings { 'CACHE_POLICY' } = 'LRU' ;
222 $proxysettings { 'L1_DIRS' } = '16' ;
223 $proxysettings { 'OFFLINE_MODE' } = 'off' ;
224 $proxysettings { 'CACHE_DIGESTS' } = 'off' ;
225 $proxysettings { 'CLASSROOM_EXT' } = 'off' ;
226 $proxysettings { 'SUPERVISOR_PASSWORD' } = '' ;
227 $proxysettings { 'NO_PROXY_LOCAL' } = 'off' ;
228 $proxysettings { 'NO_PROXY_LOCAL_BLUE' } = 'off' ;
229 $proxysettings { 'TIME_ACCESS_MODE' } = 'allow' ;
230 $proxysettings { 'TIME_FROM_HOUR' } = '00' ;
231 $proxysettings { 'TIME_FROM_MINUTE' } = '00' ;
232 $proxysettings { 'TIME_TO_HOUR' } = '24' ;
233 $proxysettings { 'TIME_TO_MINUTE' } = '00' ;
234 $proxysettings { 'MAX_OUTGOING_SIZE' } = '0' ;
235 $proxysettings { 'MAX_INCOMING_SIZE' } = '0' ;
236 $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;
237 $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;
238 $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;
239 $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;
240 $proxysettings { 'THROTTLE_BINARY' } = 'off' ;
241 $proxysettings { 'THROTTLE_DSKIMG' } = 'off' ;
242 $proxysettings { 'THROTTLE_MMEDIA' } = 'off' ;
243 $proxysettings { 'ENABLE_MIME_FILTER' } = 'off' ;
244 $proxysettings { 'ENABLE_BROWSER_CHECK' } = 'off' ;
245 $proxysettings { 'FAKE_USERAGENT' } = '' ;
246 $proxysettings { 'FAKE_REFERER' } = '' ;
247 $proxysettings { 'AUTH_METHOD' } = 'none' ;
248 $proxysettings { 'AUTH_REALM' } = '' ;
249 $proxysettings { 'AUTH_MAX_USERIP' } = '' ;
250 $proxysettings { 'AUTH_CACHE_TTL' } = '60' ;
251 $proxysettings { 'AUTH_IPCACHE_TTL' } = '0' ;
252 $proxysettings { 'AUTH_CHILDREN' } = '5' ;
253 $proxysettings { 'NCSA_MIN_PASS_LEN' } = '6' ;
254 $proxysettings { 'NCSA_BYPASS_REDIR' } = 'off' ;
255 $proxysettings { 'NCSA_USERNAME' } = '' ;
256 $proxysettings { 'NCSA_GROUP' } = '' ;
257 $proxysettings { 'NCSA_PASS' } = '' ;
258 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
259 $proxysettings { 'LDAP_BASEDN' } = '' ;
260 $proxysettings { 'LDAP_TYPE' } = 'ADS' ;
261 $proxysettings { 'LDAP_SERVER' } = '' ;
262 $proxysettings { 'LDAP_PORT' } = '389' ;
263 $proxysettings { 'LDAP_BINDDN_USER' } = '' ;
264 $proxysettings { 'LDAP_BINDDN_PASS' } = '' ;
265 $proxysettings { 'LDAP_GROUP' } = '' ;
266 $proxysettings { 'NTLM_DOMAIN' } = '' ;
267 $proxysettings { 'NTLM_PDC' } = '' ;
268 $proxysettings { 'NTLM_BDC' } = '' ;
269 $proxysettings { 'NTLM_ENABLE_ACL' } = 'off' ;
270 $proxysettings { 'NTLM_USER_ACL' } = 'positive' ;
271 $proxysettings { 'RADIUS_SERVER' } = '' ;
272 $proxysettings { 'RADIUS_PORT' } = '1812' ;
273 $proxysettings { 'RADIUS_IDENTIFIER' } = '' ;
274 $proxysettings { 'RADIUS_SECRET' } = '' ;
275 $proxysettings { 'RADIUS_ENABLE_ACL' } = 'off' ;
276 $proxysettings { 'RADIUS_USER_ACL' } = 'positive' ;
277 $proxysettings { 'IDENT_REQUIRED' } = 'off' ;
278 $proxysettings { 'IDENT_TIMEOUT' } = '10' ;
279 $proxysettings { 'IDENT_ENABLE_ACL' } = 'off' ;
280 $proxysettings { 'IDENT_USER_ACL' } = 'positive' ;
281 $proxysettings { 'ENABLE_FILTER' } = 'off' ;
282 $proxysettings { 'ENABLE_UPDXLRATOR' } = 'off' ;
283 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
284 $proxysettings { 'CHILDREN' } = '10' ;
286 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA create user' };
288 & Header
:: getcgihash
( \
%proxysettings );
290 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_TOTAL' } = 'unlimited' ;}
291 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_GREEN_HOST' } = 'unlimited' ;}
292 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_TOTAL' } = 'unlimited' ;}
293 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 0 ) { $proxysettings { 'THROTTLING_BLUE_HOST' } = 'unlimited' ;}
295 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy NCSA user management' })
297 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
300 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'add' })
302 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
303 if ( length ( $proxysettings { 'NCSA_PASS' }) < $proxysettings { 'NCSA_MIN_PASS_LEN' }) {
304 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length 1' }. $proxysettings { 'NCSA_MIN_PASS_LEN' }. $Lang :: tr
{ 'advproxy errmsg password length 2' };
306 if (!( $proxysettings { 'NCSA_PASS' } eq $proxysettings { 'NCSA_PASS_CONFIRM' })) {
307 $errormessage = $Lang :: tr
{ 'advproxy errmsg passwords different' };
309 if ( $proxysettings { 'NCSA_USERNAME' } eq '' ) {
310 $errormessage = $Lang :: tr
{ 'advproxy errmsg no username' };
312 if (! $errormessage ) {
313 $proxysettings { 'NCSA_USERNAME' } =~ tr/A-Z/a-z/ ;
314 & adduser
( $proxysettings { 'NCSA_USERNAME' }, $proxysettings { 'NCSA_PASS' }, $proxysettings { 'NCSA_GROUP' });
316 $proxysettings { 'NCSA_USERNAME' } = '' ;
317 $proxysettings { 'NCSA_GROUP' } = '' ;
318 $proxysettings { 'NCSA_PASS' } = '' ;
319 $proxysettings { 'NCSA_PASS_CONFIRM' } = '' ;
322 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'remove' })
324 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
325 & deluser
( $proxysettings { 'ID' });
328 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
329 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
330 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
332 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' })
334 $proxysettings { 'NCSA_EDIT_MODE' } = 'yes' ;
335 $ncsa_buttontext = $Lang :: tr
{ 'advproxy NCSA update user' };
336 @temp = split ( /:/ , $proxysettings { 'ID' });
337 $proxysettings { 'NCSA_USERNAME' } = $temp [ 0 ];
338 $proxysettings { 'NCSA_GROUP' } = $temp [ 1 ];
339 $proxysettings { 'NCSA_PASS' } = "lEaVeAlOnE" ;
340 $proxysettings { 'NCSA_PASS_CONFIRM' } = $proxysettings { 'NCSA_PASS' };
343 if (( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'save' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) || ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }))
345 if ( $proxysettings { 'ENABLE' } !~ /^(on|off)$/ ||
346 $proxysettings { 'TRANSPARENT' } !~ /^(on|off)$/ ||
347 $proxysettings { 'ENABLE_BLUE' } !~ /^(on|off)$/ ||
348 $proxysettings { 'TRANSPARENT_BLUE' } !~ /^(on|off)$/ ) {
349 $errormessage = $Lang :: tr
{ 'invalid input' };
352 if ( $proxysettings { 'CACHE_MEM' } > $proxysettings { 'CACHE_SIZE' } && $proxysettings { 'CACHE_SIZE' } > 0 ){
353 $errormessage = $Lang :: tr
{ 'advproxy errmsg cache' }. " " . $proxysettings { 'CACHE_MEM' }. " > " . $proxysettings { 'CACHE_SIZE' };
357 if (!(& General
:: validport
( $proxysettings { 'PROXY_PORT' })))
359 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid proxy port' };
362 if (!( $proxysettings { 'UPSTREAM_PROXY' } eq '' ))
364 my @temp = split ( /:/ , $proxysettings { 'UPSTREAM_PROXY' });
365 if (!(& General
:: validip
( $temp [ 0 ])))
367 if (!(& General
:: validdomainname
( $temp [ 0 ])))
369 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy' };
374 if (!( $proxysettings { 'CACHE_SIZE' } =~ /^\d+/ ) ||
375 ( $proxysettings { 'CACHE_SIZE' } < 10 ))
377 if (!( $proxysettings { 'CACHE_SIZE' } eq '0' ))
379 $errormessage = $Lang :: tr
{ 'advproxy errmsg hdd cache size' };
383 if (!( $proxysettings { 'FILEDESCRIPTORS' } =~ /^\d+/ ) ||
384 ( $proxysettings { 'FILEDESCRIPTORS' } < 1 ) || ( $proxysettings { 'FILEDESCRIPTORS' } > 65536 ))
386 $errormessage = $Lang :: tr
{ 'proxy errmsg filedescriptors' };
389 if (!( $proxysettings { 'CACHE_MEM' } =~ /^\d+/ ) ||
390 ( $proxysettings { 'CACHE_MEM' } < 1 ))
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 { 'CHILDREN' } =~ /^\d+$/ ) || ( $proxysettings { 'CHILDREN' } < 1 ))
428 $errormessage = $Lang :: tr
{ 'advproxy invalid num of children' };
431 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' )
433 $browser_regexp = '' ;
434 foreach ( @useragentlist )
437 @useragent = split ( /,/ );
438 if ( $proxysettings { 'UA_' . $useragent [ 0 ]} eq 'on' ) { $browser_regexp .= " $useragent [2]|" ; }
440 chop ( $browser_regexp );
441 if (! $browser_regexp )
443 $errormessage = $Lang :: tr
{ 'advproxy errmsg no browser' };
447 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' ))
449 unless (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
450 ( $proxysettings { 'IDENT_REQUIRED' } eq 'off' ) &&
451 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'off' ))
453 if ( $netsettings { 'BLUE_DEV' })
455 if ((( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' )) &&
456 (( $proxysettings { 'ENABLE_BLUE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' )))
458 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
462 if (( $proxysettings { 'ENABLE' } eq 'off' ) || ( $proxysettings { 'TRANSPARENT' } eq 'on' ))
464 $errormessage = $Lang :: tr
{ 'advproxy errmsg non-transparent proxy required' };
469 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) &&
470 ((!( $proxysettings { 'AUTH_MAX_USERIP' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_MAX_USERIP' } < 1 ) || ( $proxysettings { 'AUTH_MAX_USERIP' } > 255 )))
472 $errormessage = $Lang :: tr
{ 'advproxy errmsg max userip' };
475 if (!( $proxysettings { 'AUTH_CACHE_TTL' } =~ /^\d+/ ))
477 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth cache ttl' };
480 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } =~ /^\d+/ ))
482 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache ttl' };
485 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && ( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' ))
487 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth ipcache may not be null' };
490 if ((!( $proxysettings { 'AUTH_CHILDREN' } =~ /^\d+/ )) || ( $proxysettings { 'AUTH_CHILDREN' } < 1 ) || ( $proxysettings { 'AUTH_CHILDREN' } > 255 ))
492 $errormessage = $Lang :: tr
{ 'advproxy errmsg auth children' };
496 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
498 if ((!( $proxysettings { 'NCSA_MIN_PASS_LEN' } =~ /^\d+/ )) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } < 1 ) || ( $proxysettings { 'NCSA_MIN_PASS_LEN' } > 255 ))
500 $errormessage = $Lang :: tr
{ 'advproxy errmsg password length' };
504 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
506 if ((!( $proxysettings { 'IDENT_TIMEOUT' } =~ /^\d+/ )) || ( $proxysettings { 'IDENT_TIMEOUT' } < 1 ))
508 $errormessage = $Lang :: tr
{ 'advproxy errmsg ident timeout' };
512 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
514 if ( $proxysettings { 'LDAP_BASEDN' } eq '' )
516 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap base dn' };
519 if (!& General
:: validip
( $proxysettings { 'LDAP_SERVER' }))
521 if (!& General
:: validdomainname
( $proxysettings { 'LDAP_SERVER' }))
523 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap server' };
527 if (!& General
:: validport
( $proxysettings { 'LDAP_PORT' }))
529 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap port' };
532 if (( $proxysettings { 'LDAP_TYPE' } eq 'ADS' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' ))
534 if (( $proxysettings { 'LDAP_BINDDN_USER' } eq '' ) || ( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' ))
536 $errormessage = $Lang :: tr
{ 'advproxy errmsg ldap bind dn' };
541 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
543 if ( $proxysettings { 'NTLM_DOMAIN' } eq '' )
545 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm domain' };
548 if ( $proxysettings { 'NTLM_PDC' } eq '' )
550 $errormessage = $Lang :: tr
{ 'advproxy errmsg ntlm pdc' };
553 if (!& General
:: validhostname
( $proxysettings { 'NTLM_PDC' }))
555 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid pdc' };
558 if ((!( $proxysettings { 'NTLM_BDC' } eq '' )) && (!& General
:: validhostname
( $proxysettings { 'NTLM_BDC' })))
560 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid bdc' };
564 $proxysettings { 'NTLM_DOMAIN' } = lc ( $proxysettings { 'NTLM_DOMAIN' });
565 $proxysettings { 'NTLM_PDC' } = lc ( $proxysettings { 'NTLM_PDC' });
566 $proxysettings { 'NTLM_BDC' } = lc ( $proxysettings { 'NTLM_BDC' });
568 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
570 if (!& General
:: validip
( $proxysettings { 'RADIUS_SERVER' }))
572 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius server' };
575 if (!& General
:: validport
( $proxysettings { 'RADIUS_PORT' }))
577 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius port' };
580 if ( $proxysettings { 'RADIUS_SECRET' } eq '' )
582 $errormessage = $Lang :: tr
{ 'advproxy errmsg radius secret' };
587 # Quick parent proxy error checking of username and password info. If username password don't both exist give an error.
590 if (( $proxysettings { 'UPSTREAM_USER' } eq '' )) { $proxy1 = '' ;}
591 if (( $proxysettings { 'UPSTREAM_PASSWORD' } eq '' )) { $proxy2 = '' ;}
592 if ( $proxysettings { 'UPSTREAM_USER' } eq 'PASS' ) { $proxy1 = $proxy2 = 'PASS' ; $proxysettings { 'UPSTREAM_PASSWORD' } = '' ;}
593 if (( $proxy1 ne $proxy2 ))
595 $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid upstream proxy username or password setting' };
603 $proxysettings { 'VALID' } = 'no' ; }
605 $proxysettings { 'VALID' } = 'yes' ; }
607 if ( $proxysettings { 'VALID' } eq 'yes' )
611 delete $proxysettings { 'SRC_SUBNETS' };
612 delete $proxysettings { 'SRC_BANNED_IP' };
613 delete $proxysettings { 'SRC_BANNED_MAC' };
614 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
615 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
616 delete $proxysettings { 'DST_NOCACHE' };
617 delete $proxysettings { 'DST_NOAUTH' };
618 delete $proxysettings { 'PORTS_SAFE' };
619 delete $proxysettings { 'PORTS_SSL' };
620 delete $proxysettings { 'MIME_TYPES' };
621 delete $proxysettings { 'NTLM_ALLOW_USERS' };
622 delete $proxysettings { 'NTLM_DENY_USERS' };
623 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
624 delete $proxysettings { 'RADIUS_DENY_USERS' };
625 delete $proxysettings { 'IDENT_HOSTS' };
626 delete $proxysettings { 'IDENT_ALLOW_USERS' };
627 delete $proxysettings { 'IDENT_DENY_USERS' };
629 delete $proxysettings { 'CRE_GROUPS' };
630 delete $proxysettings { 'CRE_SVHOSTS' };
632 delete $proxysettings { 'NCSA_USERNAME' };
633 delete $proxysettings { 'NCSA_GROUP' };
634 delete $proxysettings { 'NCSA_PASS' };
635 delete $proxysettings { 'NCSA_PASS_CONFIRM' };
637 $proxysettings { 'TIME_MON' } = 'off' unless exists $proxysettings { 'TIME_MON' };
638 $proxysettings { 'TIME_TUE' } = 'off' unless exists $proxysettings { 'TIME_TUE' };
639 $proxysettings { 'TIME_WED' } = 'off' unless exists $proxysettings { 'TIME_WED' };
640 $proxysettings { 'TIME_THU' } = 'off' unless exists $proxysettings { 'TIME_THU' };
641 $proxysettings { 'TIME_FRI' } = 'off' unless exists $proxysettings { 'TIME_FRI' };
642 $proxysettings { 'TIME_SAT' } = 'off' unless exists $proxysettings { 'TIME_SAT' };
643 $proxysettings { 'TIME_SUN' } = 'off' unless exists $proxysettings { 'TIME_SUN' };
645 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'off' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
646 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'off' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
648 & General
:: writehash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
650 if (- e
"${General::swroot}/proxy/settings" ) { & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings ); }
651 $stdproxysettings { 'PROXY_PORT' } = $proxysettings { 'PROXY_PORT' };
652 $stdproxysettings { 'UPSTREAM_PROXY' } = $proxysettings { 'UPSTREAM_PROXY' };
653 $stdproxysettings { 'UPSTREAM_USER' } = $proxysettings { 'UPSTREAM_USER' };
654 $stdproxysettings { 'UPSTREAM_PASSWORD' } = $proxysettings { 'UPSTREAM_PASSWORD' };
655 $stdproxysettings { 'ENABLE_FILTER' } = $proxysettings { 'ENABLE_FILTER' };
656 $stdproxysettings { 'ENABLE_UPDXLRATOR' } = $proxysettings { 'ENABLE_UPDXLRATOR' };
657 $stdproxysettings { 'ENABLE_CLAMAV' } = $proxysettings { 'ENABLE_CLAMAV' };
658 & General
:: writehash
( "${General::swroot}/proxy/settings" , \
%stdproxysettings );
663 if ( $proxysettings { 'CACHEMGR' } eq 'on' ){& writecachemgr
;}
665 system ( '/usr/local/bin/squidctrl' , 'disable' );
666 unlink "${General::swroot}/proxy/enable" ;
667 unlink "${General::swroot}/proxy/transparent" ;
668 unlink "${General::swroot}/proxy/enable_blue" ;
669 unlink "${General::swroot}/proxy/transparent_blue" ;
671 if ( $proxysettings { 'ENABLE' } eq 'on' ) {
672 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable" );
673 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
674 if ( $proxysettings { 'TRANSPARENT' } eq 'on' && $proxysettings { 'ENABLE' } eq 'on' ) {
675 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent" ); }
676 if ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
677 system ( '/usr/bin/touch' , "${General::swroot}/proxy/enable_blue" );
678 system ( '/usr/local/bin/squidctrl' , 'enable' ); }
679 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
680 system ( '/usr/bin/touch' , "${General::swroot}/proxy/transparent_blue" ); }
682 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy save and restart' }) { system ( '/usr/local/bin/squidctrl restart >/dev/null 2>&1' ); }
683 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'proxy reconfigure' }) { system ( '/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1' ); }
687 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'advproxy clear cache' })
689 system ( '/usr/local/bin/squidctrl flush >/dev/null 2>&1' );
694 if (- e
"${General::swroot}/proxy/advanced/settings" ) {
695 & General
:: readhash
( "${General::swroot}/proxy/advanced/settings" , \
%proxysettings );
696 } elsif (- e
"${General::swroot}/proxy/settings" ) {
697 & General
:: readhash
( "${General::swroot}/proxy/settings" , \
%proxysettings );
702 # ------------------------------------------------------------------
704 # Hook to regenerate the configuration files, if cgi got called from command line.
705 if ( $ENV { "REMOTE_ADDR" } eq "" ) {
710 # -------------------------------------------------------------------
712 $checked { 'ENABLE' }{ 'off' } = '' ;
713 $checked { 'ENABLE' }{ 'on' } = '' ;
714 $checked { 'ENABLE' }{ $proxysettings { 'ENABLE' }} = "checked='checked'" ;
716 $checked { 'TRANSPARENT' }{ 'off' } = '' ;
717 $checked { 'TRANSPARENT' }{ 'on' } = '' ;
718 $checked { 'TRANSPARENT' }{ $proxysettings { 'TRANSPARENT' }} = "checked='checked'" ;
720 $checked { 'ENABLE_BLUE' }{ 'off' } = '' ;
721 $checked { 'ENABLE_BLUE' }{ 'on' } = '' ;
722 $checked { 'ENABLE_BLUE' }{ $proxysettings { 'ENABLE_BLUE' }} = "checked='checked'" ;
724 $checked { 'TRANSPARENT_BLUE' }{ 'off' } = '' ;
725 $checked { 'TRANSPARENT_BLUE' }{ 'on' } = '' ;
726 $checked { 'TRANSPARENT_BLUE' }{ $proxysettings { 'TRANSPARENT_BLUE' }} = "checked='checked'" ;
728 $checked { 'SUPPRESS_VERSION' }{ 'off' } = '' ;
729 $checked { 'SUPPRESS_VERSION' }{ 'on' } = '' ;
730 $checked { 'SUPPRESS_VERSION' }{ $proxysettings { 'SUPPRESS_VERSION' }} = "checked='checked'" ;
732 $checked { 'FORWARD_IPADDRESS' }{ 'off' } = '' ;
733 $checked { 'FORWARD_IPADDRESS' }{ 'on' } = '' ;
734 $checked { 'FORWARD_IPADDRESS' }{ $proxysettings { 'FORWARD_IPADDRESS' }} = "checked='checked'" ;
735 $checked { 'FORWARD_USERNAME' }{ 'off' } = '' ;
736 $checked { 'FORWARD_USERNAME' }{ 'on' } = '' ;
737 $checked { 'FORWARD_USERNAME' }{ $proxysettings { 'FORWARD_USERNAME' }} = "checked='checked'" ;
738 $checked { 'FORWARD_VIA' }{ 'off' } = '' ;
739 $checked { 'FORWARD_VIA' }{ 'on' } = '' ;
740 $checked { 'FORWARD_VIA' }{ $proxysettings { 'FORWARD_VIA' }} = "checked='checked'" ;
741 $checked { 'NO_CONNECTION_AUTH' }{ 'off' } = '' ;
742 $checked { 'NO_CONNECTION_AUTH' }{ 'on' } = '' ;
743 $checked { 'NO_CONNECTION_AUTH' }{ $proxysettings { 'NO_CONNECTION_AUTH' }} = "checked='checked'" ;
745 $selected { 'MEM_POLICY' }{ $proxysettings { 'MEM_POLICY' }} = "selected='selected'" ;
746 $selected { 'CACHE_POLICY' }{ $proxysettings { 'CACHE_POLICY' }} = "selected='selected'" ;
747 $selected { 'L1_DIRS' }{ $proxysettings { 'L1_DIRS' }} = "selected='selected'" ;
748 $checked { 'OFFLINE_MODE' }{ 'off' } = '' ;
749 $checked { 'OFFLINE_MODE' }{ 'on' } = '' ;
750 $checked { 'OFFLINE_MODE' }{ $proxysettings { 'OFFLINE_MODE' }} = "checked='checked'" ;
751 $checked { 'CACHE_DIGESTS' }{ 'off' } = '' ;
752 $checked { 'CACHE_DIGESTS' }{ 'on' } = '' ;
753 $checked { 'CACHE_DIGESTS' }{ $proxysettings { 'CACHE_DIGESTS' }} = "checked='checked'" ;
755 $checked { 'LOGGING' }{ 'off' } = '' ;
756 $checked { 'LOGGING' }{ 'on' } = '' ;
757 $checked { 'LOGGING' }{ $proxysettings { 'LOGGING' }} = "checked='checked'" ;
758 $checked { 'CACHEMGR' }{ 'off' } = '' ;
759 $checked { 'CACHEMGR' }{ 'on' } = '' ;
760 $checked { 'CACHEMGR' }{ $proxysettings { 'CACHEMGR' }} = "checked='checked'" ;
761 $checked { 'LOGQUERY' }{ 'off' } = '' ;
762 $checked { 'LOGQUERY' }{ 'on' } = '' ;
763 $checked { 'LOGQUERY' }{ $proxysettings { 'LOGQUERY' }} = "checked='checked'" ;
764 $checked { 'LOGUSERAGENT' }{ 'off' } = '' ;
765 $checked { 'LOGUSERAGENT' }{ 'on' } = '' ;
766 $checked { 'LOGUSERAGENT' }{ $proxysettings { 'LOGUSERAGENT' }} = "checked='checked'" ;
768 $selected { 'ERR_LANGUAGE' }{ $proxysettings { 'ERR_LANGUAGE' }} = "selected='selected'" ;
769 $selected { 'ERR_DESIGN' }{ $proxysettings { 'ERR_DESIGN' }} = "selected='selected'" ;
771 $checked { 'NO_PROXY_LOCAL' }{ 'off' } = '' ;
772 $checked { 'NO_PROXY_LOCAL' }{ 'on' } = '' ;
773 $checked { 'NO_PROXY_LOCAL' }{ $proxysettings { 'NO_PROXY_LOCAL' }} = "checked='checked'" ;
774 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'off' } = '' ;
775 $checked { 'NO_PROXY_LOCAL_BLUE' }{ 'on' } = '' ;
776 $checked { 'NO_PROXY_LOCAL_BLUE' }{ $proxysettings { 'NO_PROXY_LOCAL_BLUE' }} = "checked='checked'" ;
778 $checked { 'CLASSROOM_EXT' }{ 'off' } = '' ;
779 $checked { 'CLASSROOM_EXT' }{ 'on' } = '' ;
780 $checked { 'CLASSROOM_EXT' }{ $proxysettings { 'CLASSROOM_EXT' }} = "checked='checked'" ;
782 $selected { 'TIME_ACCESS_MODE' }{ $proxysettings { 'TIME_ACCESS_MODE' }} = "selected='selected'" ;
783 $selected { 'TIME_FROM_HOUR' }{ $proxysettings { 'TIME_FROM_HOUR' }} = "selected='selected'" ;
784 $selected { 'TIME_FROM_MINUTE' }{ $proxysettings { 'TIME_FROM_MINUTE' }} = "selected='selected'" ;
785 $selected { 'TIME_TO_HOUR' }{ $proxysettings { 'TIME_TO_HOUR' }} = "selected='selected'" ;
786 $selected { 'TIME_TO_MINUTE' }{ $proxysettings { 'TIME_TO_MINUTE' }} = "selected='selected'" ;
788 $proxysettings { 'TIME_MON' } = 'on' unless exists $proxysettings { 'TIME_MON' };
789 $proxysettings { 'TIME_TUE' } = 'on' unless exists $proxysettings { 'TIME_TUE' };
790 $proxysettings { 'TIME_WED' } = 'on' unless exists $proxysettings { 'TIME_WED' };
791 $proxysettings { 'TIME_THU' } = 'on' unless exists $proxysettings { 'TIME_THU' };
792 $proxysettings { 'TIME_FRI' } = 'on' unless exists $proxysettings { 'TIME_FRI' };
793 $proxysettings { 'TIME_SAT' } = 'on' unless exists $proxysettings { 'TIME_SAT' };
794 $proxysettings { 'TIME_SUN' } = 'on' unless exists $proxysettings { 'TIME_SUN' };
796 $checked { 'TIME_MON' }{ 'off' } = '' ;
797 $checked { 'TIME_MON' }{ 'on' } = '' ;
798 $checked { 'TIME_MON' }{ $proxysettings { 'TIME_MON' }} = "checked='checked'" ;
799 $checked { 'TIME_TUE' }{ 'off' } = '' ;
800 $checked { 'TIME_TUE' }{ 'on' } = '' ;
801 $checked { 'TIME_TUE' }{ $proxysettings { 'TIME_TUE' }} = "checked='checked'" ;
802 $checked { 'TIME_WED' }{ 'off' } = '' ;
803 $checked { 'TIME_WED' }{ 'on' } = '' ;
804 $checked { 'TIME_WED' }{ $proxysettings { 'TIME_WED' }} = "checked='checked'" ;
805 $checked { 'TIME_THU' }{ 'off' } = '' ;
806 $checked { 'TIME_THU' }{ 'on' } = '' ;
807 $checked { 'TIME_THU' }{ $proxysettings { 'TIME_THU' }} = "checked='checked'" ;
808 $checked { 'TIME_FRI' }{ 'off' } = '' ;
809 $checked { 'TIME_FRI' }{ 'on' } = '' ;
810 $checked { 'TIME_FRI' }{ $proxysettings { 'TIME_FRI' }} = "checked='checked'" ;
811 $checked { 'TIME_SAT' }{ 'off' } = '' ;
812 $checked { 'TIME_SAT' }{ 'on' } = '' ;
813 $checked { 'TIME_SAT' }{ $proxysettings { 'TIME_SAT' }} = "checked='checked'" ;
814 $checked { 'TIME_SUN' }{ 'off' } = '' ;
815 $checked { 'TIME_SUN' }{ 'on' } = '' ;
816 $checked { 'TIME_SUN' }{ $proxysettings { 'TIME_SUN' }} = "checked='checked'" ;
818 $selected { 'THROTTLING_GREEN_TOTAL' }{ $proxysettings { 'THROTTLING_GREEN_TOTAL' }} = "selected='selected'" ;
819 $selected { 'THROTTLING_GREEN_HOST' }{ $proxysettings { 'THROTTLING_GREEN_HOST' }} = "selected='selected'" ;
820 $selected { 'THROTTLING_BLUE_TOTAL' }{ $proxysettings { 'THROTTLING_BLUE_TOTAL' }} = "selected='selected'" ;
821 $selected { 'THROTTLING_BLUE_HOST' }{ $proxysettings { 'THROTTLING_BLUE_HOST' }} = "selected='selected'" ;
823 $checked { 'THROTTLE_BINARY' }{ 'off' } = '' ;
824 $checked { 'THROTTLE_BINARY' }{ 'on' } = '' ;
825 $checked { 'THROTTLE_BINARY' }{ $proxysettings { 'THROTTLE_BINARY' }} = "checked='checked'" ;
826 $checked { 'THROTTLE_DSKIMG' }{ 'off' } = '' ;
827 $checked { 'THROTTLE_DSKIMG' }{ 'on' } = '' ;
828 $checked { 'THROTTLE_DSKIMG' }{ $proxysettings { 'THROTTLE_DSKIMG' }} = "checked='checked'" ;
829 $checked { 'THROTTLE_MMEDIA' }{ 'off' } = '' ;
830 $checked { 'THROTTLE_MMEDIA' }{ 'on' } = '' ;
831 $checked { 'THROTTLE_MMEDIA' }{ $proxysettings { 'THROTTLE_MMEDIA' }} = "checked='checked'" ;
833 $checked { 'ENABLE_MIME_FILTER' }{ 'off' } = '' ;
834 $checked { 'ENABLE_MIME_FILTER' }{ 'on' } = '' ;
835 $checked { 'ENABLE_MIME_FILTER' }{ $proxysettings { 'ENABLE_MIME_FILTER' }} = "checked='checked'" ;
837 $checked { 'ENABLE_BROWSER_CHECK' }{ 'off' } = '' ;
838 $checked { 'ENABLE_BROWSER_CHECK' }{ 'on' } = '' ;
839 $checked { 'ENABLE_BROWSER_CHECK' }{ $proxysettings { 'ENABLE_BROWSER_CHECK' }} = "checked='checked'" ;
841 foreach ( @useragentlist ) {
842 @useragent = split ( /,/ );
843 $checked { 'UA_' . $useragent [ 0 ]}{ 'off' } = '' ;
844 $checked { 'UA_' . $useragent [ 0 ]}{ 'on' } = '' ;
845 $checked { 'UA_' . $useragent [ 0 ]}{ $proxysettings { 'UA_' . $useragent [ 0 ]}} = "checked='checked'" ;
848 $checked { 'AUTH_METHOD' }{ 'none' } = '' ;
849 $checked { 'AUTH_METHOD' }{ 'ncsa' } = '' ;
850 $checked { 'AUTH_METHOD' }{ 'ident' } = '' ;
851 $checked { 'AUTH_METHOD' }{ 'ldap' } = '' ;
852 $checked { 'AUTH_METHOD' }{ 'ntlm' } = '' ;
853 $checked { 'AUTH_METHOD' }{ 'radius' } = '' ;
854 $checked { 'AUTH_METHOD' }{ $proxysettings { 'AUTH_METHOD' }} = "checked='checked'" ;
856 $proxysettings { 'AUTH_ALWAYS_REQUIRED' } = 'on' unless exists $proxysettings { 'AUTH_ALWAYS_REQUIRED' };
858 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'off' } = '' ;
859 $checked { 'AUTH_ALWAYS_REQUIRED' }{ 'on' } = '' ;
860 $checked { 'AUTH_ALWAYS_REQUIRED' }{ $proxysettings { 'AUTH_ALWAYS_REQUIRED' }} = "checked='checked'" ;
862 $checked { 'NCSA_BYPASS_REDIR' }{ 'off' } = '' ;
863 $checked { 'NCSA_BYPASS_REDIR' }{ 'on' } = '' ;
864 $checked { 'NCSA_BYPASS_REDIR' }{ $proxysettings { 'NCSA_BYPASS_REDIR' }} = "checked='checked'" ;
866 $selected { 'NCSA_GROUP' }{ $proxysettings { 'NCSA_GROUP' }} = "selected='selected'" ;
868 $selected { 'LDAP_TYPE' }{ $proxysettings { 'LDAP_TYPE' }} = "selected='selected'" ;
870 $proxysettings { 'NTLM_ENABLE_INT_AUTH' } = 'on' unless exists $proxysettings { 'NTLM_ENABLE_INT_AUTH' };
872 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'off' } = '' ;
873 $checked { 'NTLM_ENABLE_INT_AUTH' }{ 'on' } = '' ;
874 $checked { 'NTLM_ENABLE_INT_AUTH' }{ $proxysettings { 'NTLM_ENABLE_INT_AUTH' }} = "checked='checked'" ;
876 $checked { 'NTLM_ENABLE_ACL' }{ 'off' } = '' ;
877 $checked { 'NTLM_ENABLE_ACL' }{ 'on' } = '' ;
878 $checked { 'NTLM_ENABLE_ACL' }{ $proxysettings { 'NTLM_ENABLE_ACL' }} = "checked='checked'" ;
880 $checked { 'NTLM_USER_ACL' }{ 'positive' } = '' ;
881 $checked { 'NTLM_USER_ACL' }{ 'negative' } = '' ;
882 $checked { 'NTLM_USER_ACL' }{ $proxysettings { 'NTLM_USER_ACL' }} = "checked='checked'" ;
884 $checked { 'RADIUS_ENABLE_ACL' }{ 'off' } = '' ;
885 $checked { 'RADIUS_ENABLE_ACL' }{ 'on' } = '' ;
886 $checked { 'RADIUS_ENABLE_ACL' }{ $proxysettings { 'RADIUS_ENABLE_ACL' }} = "checked='checked'" ;
888 $checked { 'RADIUS_USER_ACL' }{ 'positive' } = '' ;
889 $checked { 'RADIUS_USER_ACL' }{ 'negative' } = '' ;
890 $checked { 'RADIUS_USER_ACL' }{ $proxysettings { 'RADIUS_USER_ACL' }} = "checked='checked'" ;
892 $checked { 'IDENT_REQUIRED' }{ 'off' } = '' ;
893 $checked { 'IDENT_REQUIRED' }{ 'on' } = '' ;
894 $checked { 'IDENT_REQUIRED' }{ $proxysettings { 'IDENT_REQUIRED' }} = "checked='checked'" ;
896 $checked { 'IDENT_ENABLE_ACL' }{ 'off' } = '' ;
897 $checked { 'IDENT_ENABLE_ACL' }{ 'on' } = '' ;
898 $checked { 'IDENT_ENABLE_ACL' }{ $proxysettings { 'IDENT_ENABLE_ACL' }} = "checked='checked'" ;
900 $checked { 'IDENT_USER_ACL' }{ 'positive' } = '' ;
901 $checked { 'IDENT_USER_ACL' }{ 'negative' } = '' ;
902 $checked { 'IDENT_USER_ACL' }{ $proxysettings { 'IDENT_USER_ACL' }} = "checked='checked'" ;
904 $checked { 'ENABLE_FILTER' }{ 'off' } = '' ;
905 $checked { 'ENABLE_FILTER' }{ 'on' } = '' ;
906 $checked { 'ENABLE_FILTER' }{ $proxysettings { 'ENABLE_FILTER' }} = "checked='checked'" ;
908 $checked { 'ENABLE_UPDXLRATOR' }{ 'off' } = '' ;
909 $checked { 'ENABLE_UPDXLRATOR' }{ 'on' } = '' ;
910 $checked { 'ENABLE_UPDXLRATOR' }{ $proxysettings { 'ENABLE_UPDXLRATOR' }} = "checked='checked'" ;
912 $checked { 'ENABLE_CLAMAV' }{ 'off' } = '' ;
913 $checked { 'ENABLE_CLAMAV' }{ 'on' } = '' ;
914 $checked { 'ENABLE_CLAMAV' }{ $proxysettings { 'ENABLE_CLAMAV' }} = "checked='checked'" ;
916 & Header
:: openpage
( $Lang :: tr
{ 'advproxy advanced web proxy configuration' }, 1 , '' );
918 & Header
:: openbigbox
( '100%' , 'left' , '' , $errormessage );
921 & Header
:: openbox
( '100%' , 'left' , $Lang :: tr
{ 'error messages' });
922 print "<font class='base'> $errormessage </font> \n " ;
926 if ( $squidversion [ 0 ] =~ /^Squid\sCache:\sVersion\s/i )
928 $squidversion [ 0 ] =~ s/^Squid\sCache:\sVersion//i ;
929 $squidversion [ 0 ] =~ s/^\s+//g ;
930 $squidversion [ 0 ] =~ s/\s+$//g ;
932 $squidversion [ 0 ] = $Lang :: tr
{ 'advproxy unknown' };
935 # ===================================================================
937 # ===================================================================
939 unless ( $proxysettings { 'NCSA_EDIT_MODE' } eq 'yes' ) {
941 print "<form method='post' action=' $ENV {'SCRIPT_NAME'}'> \n " ;
943 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy advanced web proxy'}" );
948 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy common settings'}</b></td>
951 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled on'} <font color=" $Header ::colourgreen">Green</font>:</td>
952 <td width='20%'><input type='checkbox' name='ENABLE' $checked {'ENABLE'}{'on'} /></td>
953 <td width='25%' class='base'> $Lang ::tr{'advproxy proxy port'}:</td>
954 <td width='30%'><input type='text' name='PROXY_PORT' value=' $proxysettings {'PROXY_PORT'}' size='5' /></td>
957 <td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=" $Header ::colourgreen">Green</font>:</td>
958 <td><input type='checkbox' name='TRANSPARENT' $checked {'TRANSPARENT'}{'on'} /></td>
959 <td class='base'> $Lang ::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
960 <td><input type='text' name='VISIBLE_HOSTNAME' value=' $proxysettings {'VISIBLE_HOSTNAME'}' /></td>
965 if ( $netsettings { 'BLUE_DEV' }) {
966 print "<td class='base'> $Lang ::tr{'advproxy enabled on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
967 print "<td><input type='checkbox' name='ENABLE_BLUE' $checked {'ENABLE_BLUE'}{'on'} /></td>" ;
969 print "<td colspan='2'> </td>" ;
972 <td colspan='2'> </td>
977 if ( $netsettings { 'BLUE_DEV' }) {
978 print "<td class='base'> $Lang ::tr{'advproxy transparent on'} <font color=' $Header ::colourblue'>Blue</font>:</td>" ;
979 print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked {'TRANSPARENT_BLUE'}{'on'} /></td>" ;
981 print "<td colspan='2'> </td>" ;
984 <td class='base'> $Lang ::tr{'advproxy error language'}:</td>
986 <select name='ERR_LANGUAGE'>
989 foreach (< $errordir /*>) {
991 $language = substr ( $_ , rindex ( $_ , "/" )+ 1 );
992 print "<option value=' $language ' $selected {'ERR_LANGUAGE'}{ $language }> $language </option> \n " ;
1000 <td class='base'> $Lang ::tr{'advproxy suppress version'}:</td>
1001 <td><input type='checkbox' name='SUPPRESS_VERSION' $checked {'SUPPRESS_VERSION'}{'on'} /></td>
1002 <td class='base'> $Lang ::tr{'advproxy error design'}:</td>
1003 <td class='base'><select name='ERR_DESIGN'>
1004 <option value='ipfire' $selected {'ERR_DESIGN'}{'ipfire'}>IPFire</option>
1005 <option value='squid' $selected {'ERR_DESIGN'}{'squid'}> $Lang ::tr{'advproxy standard'}</option>
1009 <td class='base'> $Lang ::tr{'advproxy squid version'}:</td>
1010 <td class='base'> [<font color=' $Header ::colourred'> $squidversion [0] </font>]</td>
1016 <table width='100%'>
1017 <tr><td class='base' colspan='4'><b> $Lang ::tr{'advproxy redirector children'}</b></td></tr>
1018 <tr><td class='base' > $Lang ::tr{'processes'}<input type='text' name='CHILDREN' value=' $proxysettings {'CHILDREN'}' size='5' /></td>
1021 my $count = `ip n| wc -l` ;
1022 if ( $count < 1 ){ $count = 1 ;}
1023 if ( - e
"/usr/bin/squidclamav" ) {
1024 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy squidclamav' }. "</b><br />" ;
1025 if ( ! - e
"/var/run/clamav/clamd.pid" ){
1026 print "<font color='red'>clamav not running</font><br /><br />" ;
1027 $proxysettings { 'ENABLE_CLAMAV' } = 'off' ;
1030 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'} . " /><br />" ;
1031 print "+ " . int (( $count **( 1 / 3 )) * 8 );}
1036 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy url filter' }. "</b><br />" ;
1037 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'} . " /><br />" ;
1038 print "+ " . int (( $count **( 1 / 3 )) * 6 );
1040 print "<td class='base'><b>" . $Lang :: tr
{ 'advproxy update accelerator' }. "</b><br />" ;
1041 print $Lang :: tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'} . " /><br />" ;
1042 print "+ " . int (( $count **( 1 / 3 )) * 5 );
1047 <table width='100%'>
1049 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy upstream proxy'}</b></td>
1052 <td width='25%' class='base'> $Lang ::tr{'advproxy via forwarding'}:</td>
1053 <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked {'FORWARD_VIA'}{'on'} /></td>
1054 <td width='25%' class='base'> $Lang ::tr{'advproxy upstream proxy host:port'} <img src='/blob.gif' alt='*' /></td>
1055 <td width='30%'><input type='text' name='UPSTREAM_PROXY' value=' $proxysettings {'UPSTREAM_PROXY'}' /></td>
1058 <td class='base'> $Lang ::tr{'advproxy client IP forwarding'}:</td>
1059 <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked {'FORWARD_IPADDRESS'}{'on'} /></td>
1060 <td class='base'> $Lang ::tr{'advproxy upstream username'}: <img src='/blob.gif' alt='*' /></td>
1061 <td><input type='text' name='UPSTREAM_USER' value=' $proxysettings {'UPSTREAM_USER'}' /></td>
1064 <td class='base'> $Lang ::tr{'advproxy username forwarding'}:</td>
1065 <td><input type='checkbox' name='FORWARD_USERNAME' $checked {'FORWARD_USERNAME'}{'on'} /></td>
1066 <td class='base'> $Lang ::tr{'advproxy upstream password'}: <img src='/blob.gif' alt='*' /></td>
1067 <td><input type='password' name='UPSTREAM_PASSWORD' value=' $proxysettings {'UPSTREAM_PASSWORD'}' /></td>
1070 <td class='base'> $Lang ::tr{'advproxy no connection auth'}:</td>
1071 <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked {'NO_CONNECTION_AUTH'}{'on'} /></td>
1077 <table width='100%'>
1079 <td colspan='4' class='base'><b> $Lang ::tr{'advproxy log settings'}</b></td>
1082 <td width='25%' class='base'> $Lang ::tr{'advproxy log enabled'}:</td>
1083 <td width='20%'><input type='checkbox' name='LOGGING' $checked {'LOGGING'}{'on'} /></td>
1084 <td width='25%'class='base'> $Lang ::tr{'advproxy log query'}:</td>
1085 <td width='30%'><input type='checkbox' name='LOGQUERY' $checked {'LOGQUERY'}{'on'} /></td>
1090 <td class='base'> $Lang ::tr{'advproxy log useragent'}:</td>
1091 <td><input type='checkbox' name='LOGUSERAGENT' $checked {'LOGUSERAGENT'}{'on'} /></td>
1095 <table width='100%'>
1097 <td colspan='4'><b> $Lang ::tr{'advproxy cache management'}</b></td>
1100 <td class='base'> $Lang ::tr{'proxy cachemgr'}:</td>
1101 <td><input type='checkbox' name='CACHEMGR' $checked {'CACHEMGR'}{'on'} /></td>
1102 <td class='base'> $Lang ::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td>
1103 <td><input type='text' name='ADMIN_MAIL_ADDRESS' value=' $proxysettings {'ADMIN_MAIL_ADDRESS'}' /></td>
1106 <td class='base'> $Lang ::tr{'proxy filedescriptors'}:</td>
1107 <td><input type='text' name='FILEDESCRIPTORS' value=' $proxysettings {'FILEDESCRIPTORS'}' size='5' /></td>
1108 <td class='base'> $Lang ::tr{'proxy admin password'}: <img src='/blob.gif' alt='*' /></td>
1109 <td><input type='text' name='ADMIN_PASSWORD' value=' $proxysettings {'ADMIN_PASSWORD'}' /></td>
1112 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1115 <td class='base'> $Lang ::tr{'advproxy ram cache size'}:</td>
1116 <td><input type='text' name='CACHE_MEM' value=' $proxysettings {'CACHE_MEM'}' size='5' /></td>
1117 <td class='base'> $Lang ::tr{'advproxy hdd cache size'}:</td>
1118 <td><input type='text' name='CACHE_SIZE' value=' $proxysettings {'CACHE_SIZE'}' size='5' /></td>
1121 <td class='base'> $Lang ::tr{'advproxy min size'}:</td>
1122 <td><input type='text' name='MIN_SIZE' value=' $proxysettings {'MIN_SIZE'}' size='5' /></td>
1123 <td class='base'> $Lang ::tr{'advproxy max size'}:</td>
1124 <td><input type='text' name='MAX_SIZE' value=' $proxysettings {'MAX_SIZE'}' size='5' /></td>
1127 <td class='base'> $Lang ::tr{'advproxy number of L1 dirs'}:</td>
1128 <td class='base'><select name='L1_DIRS'>
1129 <option value='16' $selected {'L1_DIRS'}{'16'}>16</option>
1130 <option value='32' $selected {'L1_DIRS'}{'32'}>32</option>
1131 <option value='64' $selected {'L1_DIRS'}{'64'}>64</option>
1132 <option value='128' $selected {'L1_DIRS'}{'128'}>128</option>
1133 <option value='256' $selected {'L1_DIRS'}{'256'}>256</option>
1135 <td colspan='2' rowspan= '5' valign='top' class='base'>
1136 <table cellspacing='0' cellpadding='0'>
1138 <!-- intentionally left empty -->
1141 <td> $Lang ::tr{'advproxy no cache sites'}: <img src='/blob.gif' alt='*' /></td>
1144 <!-- intentionally left empty -->
1147 <!-- intentionally left empty -->
1150 <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
1154 print $proxysettings { 'DST_NOCACHE' };
1163 <td class='base'> $Lang ::tr{'advproxy memory replacement policy'}:</td>
1164 <td class='base'><select name='MEM_POLICY'>
1165 <option value='LRU' $selected {'MEM_POLICY'}{'LRU'}>LRU</option>
1166 <option value='heap LFUDA' $selected {'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1167 <option value='heap GDSF' $selected {'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option>
1168 <option value='heap LRU' $selected {'MEM_POLICY'}{'heap LRU'}>heap LRU</option>
1172 <td class='base'> $Lang ::tr{'advproxy cache replacement policy'}:</td>
1173 <td class='base'><select name='CACHE_POLICY'>
1174 <option value='LRU' $selected {'CACHE_POLICY'}{'LRU'}>LRU</option>
1175 <option value='heap LFUDA' $selected {'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option>
1176 <option value='heap GDSF' $selected {'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option>
1177 <option value='heap LRU' $selected {'CACHE_POLICY'}{'heap LRU'}>heap LRU</option>
1181 <td colspan='2'> </td>
1184 <td class='base'> $Lang ::tr{'advproxy offline mode'}:</td>
1185 <td><input type='checkbox' name='OFFLINE_MODE' $checked {'OFFLINE_MODE'}{'on'} /></td>
1188 <td class='base'> $Lang ::tr{'advproxy cache-digest'}:</td>
1189 <td><input type='checkbox' name='CACHE_DIGESTS' $checked {'CACHE_DIGESTS'}{'on'} /></td>
1193 <table width='100%'>
1195 <td colspan='4'><b> $Lang ::tr{'advproxy destination ports'}</b></td>
1198 <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
1201 <td colspan='2' class='base'> $Lang ::tr{'advproxy standard ports'}:</td>
1202 <td colspan='2' class='base'> $Lang ::tr{'advproxy ssl ports'}:</td>
1205 <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'>
1208 if (! $proxysettings { 'PORTS_SAFE' }) { print $def_ports_safe ; } else { print $proxysettings { 'PORTS_SAFE' }; }
1212 <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'>
1215 if (! $proxysettings { 'PORTS_SSL' }) { print $def_ports_ssl ; } else { print $proxysettings { 'PORTS_SSL' }; }
1222 <table width='100%'>
1224 <td colspan='4'><b> $Lang ::tr{'advproxy network based access'}</b></td>
1227 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1230 <td colspan='4' class='base'> $Lang ::tr{'advproxy allowed subnets'}:</td>
1233 <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
1237 if (! $proxysettings { 'SRC_SUBNETS' })
1239 print " $green_cidr \n " ;
1240 if ( $netsettings { 'BLUE_DEV' })
1242 print " $blue_cidr \n " ;
1244 } else { print $proxysettings { 'SRC_SUBNETS' }; }
1251 $line = $Lang :: tr
{ 'advproxy no internal proxy on green' };
1252 $line =~ s/Green/<font color="$Header::colourgreen">Green<\/ font
>/ i
;
1253 print "<td class='base'> $line :</td> \n " ;
1255 <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked {'NO_PROXY_LOCAL'}{'on'} /></td>
1259 if ( $netsettings { 'BLUE_DEV' }) {
1260 $line = $Lang :: tr
{ 'advproxy no internal proxy on blue' };
1261 $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/ font
>/ i
;
1263 print "<td class='base'> $line :</td> \n " ;
1265 <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked {'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
1272 <td colspan='2'> </td>
1275 <td colspan='2'> </td>
1278 <table width='100%'>
1280 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1283 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted ip clients'}: <img src='/blob.gif' alt='*' /></td>
1284 <td colspan='2' class='base'> $Lang ::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td>
1287 <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
1291 print $proxysettings { 'SRC_UNRESTRICTED_IP' };
1295 <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
1299 print $proxysettings { 'SRC_UNRESTRICTED_MAC' };
1305 <table width='100%'>
1307 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1310 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned ip clients'}: <img src='/blob.gif' alt='*' /></td>
1311 <td colspan='2' class='base'> $Lang ::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td>
1314 <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
1318 print $proxysettings { 'SRC_BANNED_IP' };
1322 <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
1326 print $proxysettings { 'SRC_BANNED_MAC' };
1337 # -------------------------------------------------------------------
1338 # CRE GUI - optional
1339 # -------------------------------------------------------------------
1341 if (- e
$cre_enabled ) { print <<END
1342 <table width='100%'>
1345 <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>
1348 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1354 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1356 <td class='base'> $Lang ::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td>
1357 <td><input type='password' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' size='12' /></td>
1360 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre group definitions'}:</td>
1361 <td colspan='2' class='base'> $Lang ::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td>
1366 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ){
1369 <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
1373 print $proxysettings { 'CRE_GROUPS' };
1377 <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'>
1380 print $proxysettings { 'CRE_SVHOSTS' };
1388 print "</table><hr size='1'>" ;
1392 <input type='hidden' name='SUPERVISOR_PASSWORD' value=' $proxysettings {'SUPERVISOR_PASSWORD'}' />
1393 <input type='hidden' name='CRE_GROUPS' value=' $proxysettings {'CRE_GROUPS'}' />
1394 <input type='hidden' name='CRE_SVHOSTS' value=' $proxysettings {'CRE_SVHOSTS'}' />
1399 # -------------------------------------------------------------------
1403 <table width='100%'>
1405 <td colspan='4'><b> $Lang ::tr{'advproxy time restrictions'}</b></td>
1407 <table width='100%'>
1409 <td width='2%'> $Lang ::tr{'advproxy access'}</td>
1410 <td width='1%'> </td>
1411 <td width='2%' align='center'> $Lang ::tr{'advproxy monday'}</td>
1412 <td width='2%' align='center'> $Lang ::tr{'advproxy tuesday'}</td>
1413 <td width='2%' align='center'> $Lang ::tr{'advproxy wednesday'}</td>
1414 <td width='2%' align='center'> $Lang ::tr{'advproxy thursday'}</td>
1415 <td width='2%' align='center'> $Lang ::tr{'advproxy friday'}</td>
1416 <td width='2%' align='center'> $Lang ::tr{'advproxy saturday'}</td>
1417 <td width='2%' align='center'> $Lang ::tr{'advproxy sunday'}</td>
1418 <td width='1%'> </td>
1419 <td width='7%' colspan=3> $Lang ::tr{'advproxy from'}</td>
1420 <td width='1%'> </td>
1421 <td width='7%' colspan=3> $Lang ::tr{'advproxy to'}</td>
1426 <select name='TIME_ACCESS_MODE'>
1427 <option value='allow' $selected {'TIME_ACCESS_MODE'}{'allow'}> $Lang ::tr{'advproxy mode allow'}</option>
1428 <option value='deny' $selected {'TIME_ACCESS_MODE'}{'deny'}> $Lang ::tr{'advproxy mode deny'}</option>
1432 <td class='base'><input type='checkbox' name='TIME_MON' $checked {'TIME_MON'}{'on'} /></td>
1433 <td class='base'><input type='checkbox' name='TIME_TUE' $checked {'TIME_TUE'}{'on'} /></td>
1434 <td class='base'><input type='checkbox' name='TIME_WED' $checked {'TIME_WED'}{'on'} /></td>
1435 <td class='base'><input type='checkbox' name='TIME_THU' $checked {'TIME_THU'}{'on'} /></td>
1436 <td class='base'><input type='checkbox' name='TIME_FRI' $checked {'TIME_FRI'}{'on'} /></td>
1437 <td class='base'><input type='checkbox' name='TIME_SAT' $checked {'TIME_SAT'}{'on'} /></td>
1438 <td class='base'><input type='checkbox' name='TIME_SUN' $checked {'TIME_SUN'}{'on'} /></td>
1441 <select name='TIME_FROM_HOUR'>
1444 for ( $i = 0 ; $i <= 24 ; $i ++) {
1445 $_ = sprintf ( " %02s " , $i );
1446 print "<option $selected {'TIME_FROM_HOUR'}{ $_ }> $_ </option> \n " ;
1453 <select name='TIME_FROM_MINUTE'>
1456 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1457 $_ = sprintf ( " %02s " , $i );
1458 print "<option $selected {'TIME_FROM_MINUTE'}{ $_ }> $_ </option> \n " ;
1465 <select name='TIME_TO_HOUR'>
1468 for ( $i = 0 ; $i <= 24 ; $i ++) {
1469 $_ = sprintf ( " %02s " , $i );
1470 print "<option $selected {'TIME_TO_HOUR'}{ $_ }> $_ </option> \n " ;
1477 <select name='TIME_TO_MINUTE'>
1480 for ( $i = 0 ; $i <= 45 ; $i += 15 ) {
1481 $_ = sprintf ( " %02s " , $i );
1482 print "<option $selected {'TIME_TO_MINUTE'}{ $_ }> $_ </option> \n " ;
1490 <table width='100%'>
1492 <td colspan='4'><b> $Lang ::tr{'advproxy transfer limits'}</b></td>
1495 <td width='25%' class='base'> $Lang ::tr{'advproxy max download size'}:</td>
1496 <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value=' $proxysettings {'MAX_INCOMING_SIZE'}' size='5' /></td>
1497 <td width='25%' class='base'> $Lang ::tr{'advproxy max upload size'}:</td>
1498 <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value=' $proxysettings {'MAX_OUTGOING_SIZE'}' size='5' /></td>
1502 <table width='100%'>
1504 <td colspan='4'><b> $Lang ::tr{'advproxy download throttling'}</b></td>
1507 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1508 <td width='20%' class='base'>
1509 <select name='THROTTLING_GREEN_TOTAL'>
1513 foreach ( @throttle_limits ) {
1514 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1518 <option value='0' $selected {'THROTTLING_GREEN_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1521 <td width='25%' class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourgreen">Green</font>:</td>
1522 <td width='30%' class='base'>
1523 <select name='THROTTLING_GREEN_HOST'>
1527 foreach ( @throttle_limits ) {
1528 print " \t <option value=' $_ ' $selected {'THROTTLING_GREEN_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1532 <option value='0' $selected {'THROTTLING_GREEN_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1539 if ( $netsettings { 'BLUE_DEV' }) {
1542 <td class='base'> $Lang ::tr{'advproxy throttling total on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1544 <select name='THROTTLING_BLUE_TOTAL'>
1548 foreach ( @throttle_limits ) {
1549 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_TOTAL'}{ $_ }> $_ kBit/s</option> \n " ;
1553 <option value='0' $selected {'THROTTLING_BLUE_TOTAL'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1556 <td class='base'> $Lang ::tr{'advproxy throttling per host on'} <font color=" $Header ::colourblue">Blue</font>:</td>
1558 <select name='THROTTLING_BLUE_HOST'>
1562 foreach ( @throttle_limits ) {
1563 print " \t <option value=' $_ ' $selected {'THROTTLING_BLUE_HOST'}{ $_ }> $_ kBit/s</option> \n " ;
1567 <option value='0' $selected {'THROTTLING_BLUE_HOST'}{'unlimited'}> $Lang ::tr{'advproxy throttling unlimited'}</option> \n ";
1577 <table width='100%'>
1579 <td colspan='4'><i> $Lang ::tr{'advproxy content based throttling'}:</i></td>
1582 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle binary'}:</td>
1583 <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked {'THROTTLE_BINARY'}{'on'} /></td>
1584 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle dskimg'}:</td>
1585 <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked {'THROTTLE_DSKIMG'}{'on'} /></td>
1586 <td width='15%' class='base'> $Lang ::tr{'advproxy throttle mmedia'}:</td>
1587 <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked {'THROTTLE_MMEDIA'}{'on'} /></td>
1588 <td width='15%'> </td>
1589 <td width='10%'> </td>
1593 <table width='100%'>
1595 <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>
1599 if ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' ){
1602 <td colspan='2' class='base'> $Lang ::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td>
1607 <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'>
1611 print $proxysettings { 'MIME_TYPES' };
1625 <table width='100%'>
1627 <td colspan='4'><b> $Lang ::tr{'advproxy web browser'}</b> $Lang::tr{'advproxy UA enable filter'}:<input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td>
1631 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ){
1637 if ( @useragentlist ) { print " $Lang ::tr{'advproxy allowed web browsers'}:" ; } else { print " $Lang ::tr{'advproxy no clients defined'}" ; }
1642 <table width='100%'>
1646 for ( $n = 0 ; $n <= @useragentlist ; $n = $n + $i ) {
1647 for ( $i = 0 ; $i <= 3 ; $i ++) {
1648 if ( $i eq 0 ) { print "<tr> \n " ; }
1649 if (( $n + $i ) < @useragentlist ) {
1650 @useragent = split ( /,/ , @useragentlist [ $n + $i ]);
1651 print "<td width='15%'> $useragent [1]:<\/td> \n " ;
1652 print "<td width='10%'><input type='checkbox' name='UA_ $useragent [0]' $checked {'UA_'. $useragent [0]}{'on'} /></td> \n " ;
1654 if ( $i eq 3 ) { print "<\/tr> \n " ; }
1661 <table width='100%'>
1663 <td><b> $Lang ::tr{'advproxy privacy'}</b></td>
1666 <td class='base'> $Lang ::tr{'advproxy fake useragent'}: <img src='/blob.gif' alt='*' /></td>
1667 <td class='base'> $Lang ::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td>
1670 <td><input type='text' name='FAKE_USERAGENT' value=' $proxysettings {'FAKE_USERAGENT'}' size='56' /></td>
1671 <td><input type='text' name='FAKE_REFERER' value=' $proxysettings {'FAKE_REFERER'}' size='56' /></td>
1679 <table width='100%'>
1681 <td colspan='5'><b> $Lang ::tr{'advproxy AUTH method'}</b></td>
1684 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked {'AUTH_METHOD'}{'none'} /> $Lang ::tr{'advproxy AUTH method none'}</td>
1685 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked {'AUTH_METHOD'}{'ncsa'} /> $Lang ::tr{'advproxy AUTH method ncsa'}</td>
1686 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked {'AUTH_METHOD'}{'ident'} /> $Lang ::tr{'advproxy AUTH method ident'}</td>
1687 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked {'AUTH_METHOD'}{'ldap'} /> $Lang ::tr{'advproxy AUTH method ldap'}</td>
1688 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked {'AUTH_METHOD'}{'ntlm'} /> $Lang ::tr{'advproxy AUTH method ntlm'}</td>
1689 <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked {'AUTH_METHOD'}{'radius'} /> $Lang ::tr{'advproxy AUTH method radius'}</td>
1695 if (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) { if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) { print <<END
1697 <table width='100%'>
1699 <td colspan='4'><b> $Lang ::tr{'advproxy AUTH global settings'}</b></td>
1702 <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
1705 <td class='base'> $Lang ::tr{'advproxy AUTH number of auth processes'}:</td>
1706 <td><input type='text' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}' size='5' /></td>
1707 <td colspan='2' rowspan= '6' valign='top' class='base'>
1708 <table cellpadding='0' cellspacing='0'>
1710 <td class='base'> $Lang ::tr{'advproxy AUTH realm'}: <img src='/blob.gif' alt='*' /></td>
1713 <!-- intentionally left empty -->
1716 <!-- intentionally left empty -->
1719 <td><input type='text' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}' size='40' /></td>
1722 <!-- intentionally left empty -->
1725 <!-- intentionally left empty -->
1728 <td> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1731 <!-- intentionally left empty -->
1734 <!-- intentionally left empty -->
1737 <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1741 print $proxysettings { 'DST_NOAUTH' };
1750 <td class='base'> $Lang ::tr{'advproxy AUTH auth cache TTL'}:</td>
1751 <td><input type='text' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
1754 <td class='base'> $Lang ::tr{'advproxy AUTH limit of IP addresses'}: <img src='/blob.gif' alt='*' /></td>
1755 <td><input type='text' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
1758 <td class='base'> $Lang ::tr{'advproxy AUTH user IP cache TTL'}:</td>
1759 <td><input type='text' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
1762 <td class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1763 <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1766 <td colspan='2'> </td>
1773 # ===================================================================
1774 # NCSA auth settings
1775 # ===================================================================
1777 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) {
1780 <table width='100%'>
1782 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA auth'}</b></td>
1785 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA min password length'}:</td>
1786 <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}' size='5' /></td>
1787 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA redirector bypass'} \' $Lang ::tr{'advproxy NCSA grp extended'} \' :</td>
1788 <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked {'NCSA_BYPASS_REDIR'}{'on'} /></td>
1791 <td colspan='2'><br> <input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy NCSA user management'}'></td>
1799 # ===================================================================
1800 # IDENTD auth settings
1801 # ===================================================================
1803 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
1806 <table width='100%'>
1808 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT identd settings'}</b></td>
1811 <td width='25%' class='base'> $Lang ::tr{'advproxy IDENT required'}:</td>
1812 <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked {'IDENT_REQUIRED'}{'on'} /></td>
1813 <td width='25%' class='base'> $Lang ::tr{'advproxy AUTH always required'}:</td>
1814 <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked {'AUTH_ALWAYS_REQUIRED'}{'on'} /></td>
1817 <td class='base'> $Lang ::tr{'advproxy IDENT timeout'}:</td>
1818 <td><input type='text' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}' size='5' /></td>
1823 <td colspan='2' class='base'> $Lang ::tr{'advproxy IDENT aware hosts'}:</td>
1824 <td colspan='2' class='base'> $Lang ::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td>
1827 <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'>
1830 if (! $proxysettings { 'IDENT_HOSTS' }) {
1831 print " $green_cidr \n " ;
1832 if ( $netsettings { 'BLUE_DEV' }) {
1833 print " $blue_cidr \n " ;
1836 print $proxysettings { 'IDENT_HOSTS' };
1841 <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'>
1845 print $proxysettings { 'DST_NOAUTH' };
1852 <table width='100%'>
1854 <td colspan='4'><b> $Lang ::tr{'advproxy IDENT user based access restrictions'}</b></td>
1857 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1858 <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked {'IDENT_ENABLE_ACL'}{'on'} /></td>
1859 <td width='25%'> </td>
1860 <td width='30%'> </td>
1863 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked {'IDENT_USER_ACL'}{'positive'} />
1864 $Lang ::tr{'advproxy IDENT use positive access list'}:</td>
1865 <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked {'IDENT_USER_ACL'}{'negative'} />
1866 $Lang ::tr{'advproxy IDENT use negative access list'}:</td>
1869 <td colspan='2'> $Lang ::tr{'advproxy IDENT authorized users'}</td>
1870 <td colspan='2'> $Lang ::tr{'advproxy IDENT unauthorized users'}</td>
1873 <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1877 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_ALLOW_USERS' }; }
1879 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1881 <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'>
1885 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print $proxysettings { 'IDENT_DENY_USERS' }; }
1887 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) { print <<END
1894 # ===================================================================
1895 # NTLM auth settings
1896 # ===================================================================
1898 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) {
1901 <table width='100%'>
1903 <td colspan='6'><b> $Lang ::tr{'advproxy NTLM domain settings'}</b></td>
1906 <td class='base'> $Lang ::tr{'advproxy NTLM domain'}:</td>
1907 <td><input type='text' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}' size='15' /></td>
1908 <td class='base'> $Lang ::tr{'advproxy NTLM PDC hostname'}:</td>
1909 <td><input type='text' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}' size='14' /></td>
1910 <td class='base'> $Lang ::tr{'advproxy NTLM BDC hostname'}: <img src='/blob.gif' alt='*' /></td>
1911 <td><input type='text' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}' size='14' /></td>
1915 <table width='100%'>
1917 <td colspan='3'><b> $Lang ::tr{'advproxy NTLM auth mode'}</b></td>
1920 <td width='25%' class='base' width='25%'> $Lang ::tr{'advproxy NTLM use integrated auth'}:</td>
1921 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked {'NTLM_ENABLE_INT_AUTH'}{'on'} /></td>
1926 <table width='100%'>
1928 <td colspan='4'><b> $Lang ::tr{'advproxy NTLM user based access restrictions'}</b></td>
1931 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
1932 <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked {'NTLM_ENABLE_ACL'}{'on'} /></td>
1933 <td width='25%'> </td>
1934 <td width='30%'> </td>
1937 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked {'NTLM_USER_ACL'}{'positive'} />
1938 $Lang ::tr{'advproxy NTLM use positive access list'}:</td>
1939 <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked {'NTLM_USER_ACL'}{'negative'} />
1940 $Lang ::tr{'advproxy NTLM use negative access list'}:</td>
1943 <td colspan='2'> $Lang ::tr{'advproxy NTLM authorized users'}</td>
1944 <td colspan='2'> $Lang ::tr{'advproxy NTLM unauthorized users'}</td>
1947 <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'>
1951 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_ALLOW_USERS' }; }
1953 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1955 <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'>
1959 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print $proxysettings { 'NTLM_DENY_USERS' }; }
1961 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) { print <<END
1968 # ===================================================================
1969 # LDAP auth settings
1970 # ===================================================================
1972 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) {
1975 <table width='100%'>
1977 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP common settings'}</b></td>
1980 <td class='base'> $Lang ::tr{'advproxy LDAP basedn'}:</td>
1981 <td><input type='text' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}' size='37' /></td>
1982 <td class='base'> $Lang ::tr{'advproxy LDAP type'}:</td>
1983 <td class='base'><select name='LDAP_TYPE'>
1984 <option value='ADS' $selected {'LDAP_TYPE'}{'ADS'}> $Lang ::tr{'advproxy LDAP ADS'}</option>
1985 <option value='NDS' $selected {'LDAP_TYPE'}{'NDS'}> $Lang ::tr{'advproxy LDAP NDS'}</option>
1986 <option value='V2' $selected {'LDAP_TYPE'}{'V2'}> $Lang ::tr{'advproxy LDAP V2'}</option>
1987 <option value='V3' $selected {'LDAP_TYPE'}{'V3'}> $Lang ::tr{'advproxy LDAP V3'}</option>
1991 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP server'}:</td>
1992 <td width='40%'><input type='text' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}' size='14' /></td>
1993 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP port'}:</td>
1994 <td><input type='text' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}' size='3' /></td>
1998 <table width='100%'>
2000 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP binddn settings'}</b></td>
2003 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn username'}:</td>
2004 <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}' size='37' /></td>
2005 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP binddn password'}:</td>
2006 <td><input type='password' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}' size='14' /></td>
2010 <table width='100%'>
2012 <td colspan='4'><b> $Lang ::tr{'advproxy LDAP group access control'}</b></td>
2015 <td width='20%' class='base'> $Lang ::tr{'advproxy LDAP group required'}: <img src='/blob.gif' alt='*' /></td>
2016 <td width='40%'><input type='text' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}' size='37' /></td>
2024 # ===================================================================
2025 # RADIUS auth settings
2026 # ===================================================================
2028 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) {
2031 <table width='100%'>
2033 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS radius settings'}</b></td>
2036 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS server'}:</td>
2037 <td width='20%'><input type='text' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}' size='14' /></td>
2038 <td width='25%' class='base'> $Lang ::tr{'advproxy RADIUS port'}:</td>
2039 <td width='30%'><input type='text' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}' size='3' /></td>
2042 <td class='base'> $Lang ::tr{'advproxy RADIUS identifier'}: <img src='/blob.gif' alt='*' /></td>
2043 <td><input type='text' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}' size='14' /></td>
2044 <td class='base'> $Lang ::tr{'advproxy RADIUS secret'}:</td>
2045 <td><input type='password' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}' size='14' /></td>
2049 <table width='100%'>
2051 <td colspan='4'><b> $Lang ::tr{'advproxy RADIUS user based access restrictions'}</b></td>
2054 <td width='25%' class='base'> $Lang ::tr{'advproxy enabled'}:</td>
2055 <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked {'RADIUS_ENABLE_ACL'}{'on'} /></td>
2056 <td width='25%'> </td>
2057 <td width='30%'> </td>
2060 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked {'RADIUS_USER_ACL'}{'positive'} />
2061 $Lang ::tr{'advproxy RADIUS use positive access list'}:</td>
2062 <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked {'RADIUS_USER_ACL'}{'negative'} />
2063 $Lang ::tr{'advproxy RADIUS use negative access list'}:</td>
2066 <td colspan='2'> $Lang ::tr{'advproxy RADIUS authorized users'}</td>
2067 <td colspan='2'> $Lang ::tr{'advproxy RADIUS unauthorized users'}</td>
2070 <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'>
2074 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_ALLOW_USERS' }; }
2076 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2078 <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'>
2082 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print $proxysettings { 'RADIUS_DENY_USERS' }; }
2084 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) { print <<END
2091 # ===================================================================
2097 if ( $proxysettings { 'AUTH_METHOD' } eq 'none' ) {
2099 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2100 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2101 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2102 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2103 <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value=' $proxysettings {'AUTH_ALWAYS_REQUIRED'}'></td>
2104 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2105 <td><input type='hidden' name='DST_NOAUTH' value=' $proxysettings {'DST_NOAUTH'}'></td>
2109 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) {
2111 <td><input type='hidden' name='AUTH_CHILDREN' value=' $proxysettings {'AUTH_CHILDREN'}'></td>
2112 <td><input type='hidden' name='AUTH_CACHE_TTL' value=' $proxysettings {'AUTH_CACHE_TTL'}' size='5' /></td>
2113 <td><input type='hidden' name='AUTH_MAX_USERIP' value=' $proxysettings {'AUTH_MAX_USERIP'}' size='5' /></td>
2114 <td><input type='hidden' name='AUTH_IPCACHE_TTL' value=' $proxysettings {'AUTH_IPCACHE_TTL'}' size='5' /></td>
2115 <td><input type='hidden' name='AUTH_REALM' value=' $proxysettings {'AUTH_REALM'}'></td>
2119 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )) {
2121 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2122 <td><input type='hidden' name='NCSA_BYPASS_REDIR' value=' $proxysettings {'NCSA_BYPASS_REDIR'}'></td>
2126 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )) {
2128 <td><input type='hidden' name='IDENT_REQUIRED' value=' $proxysettings {'IDENT_REQUIRED'}'></td>
2129 <td><input type='hidden' name='IDENT_TIMEOUT' value=' $proxysettings {'IDENT_TIMEOUT'}'></td>
2130 <td><input type='hidden' name='IDENT_HOSTS' value=' $proxysettings {'IDENT_HOSTS'}'></td>
2131 <td><input type='hidden' name='IDENT_ENABLE_ACL' value=' $proxysettings {'IDENT_ENABLE_ACL'}'></td>
2132 <td><input type='hidden' name='IDENT_USER_ACL' value=' $proxysettings {'IDENT_USER_ACL'}'></td>
2133 <td><input type='hidden' name='IDENT_ALLOW_USERS' value=' $proxysettings {'IDENT_ALLOW_USERS'}'></td>
2134 <td><input type='hidden' name='IDENT_DENY_USERS' value=' $proxysettings {'IDENT_DENY_USERS'}'></td>
2138 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )) {
2140 <td><input type='hidden' name='LDAP_BASEDN' value=' $proxysettings {'LDAP_BASEDN'}'></td>
2141 <td><input type='hidden' name='LDAP_TYPE' value=' $proxysettings {'LDAP_TYPE'}'></td>
2142 <td><input type='hidden' name='LDAP_SERVER' value=' $proxysettings {'LDAP_SERVER'}'></td>
2143 <td><input type='hidden' name='LDAP_PORT' value=' $proxysettings {'LDAP_PORT'}'></td>
2144 <td><input type='hidden' name='LDAP_BINDDN_USER' value=' $proxysettings {'LDAP_BINDDN_USER'}'></td>
2145 <td><input type='hidden' name='LDAP_BINDDN_PASS' value=' $proxysettings {'LDAP_BINDDN_PASS'}'></td>
2146 <td><input type='hidden' name='LDAP_GROUP' value=' $proxysettings {'LDAP_GROUP'}'></td>
2150 if (!( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )) {
2152 <td><input type='hidden' name='NTLM_DOMAIN' value=' $proxysettings {'NTLM_DOMAIN'}'></td>
2153 <td><input type='hidden' name='NTLM_PDC' value=' $proxysettings {'NTLM_PDC'}'></td>
2154 <td><input type='hidden' name='NTLM_BDC' value=' $proxysettings {'NTLM_BDC'}'></td>
2155 <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value=' $proxysettings {'NTLM_ENABLE_INT_AUTH'}'></td>
2156 <td><input type='hidden' name='NTLM_ENABLE_ACL' value=' $proxysettings {'NTLM_ENABLE_ACL'}'></td>
2157 <td><input type='hidden' name='NTLM_USER_ACL' value=' $proxysettings {'NTLM_USER_ACL'}'></td>
2158 <td><input type='hidden' name='NTLM_ALLOW_USERS' value=' $proxysettings {'NTLM_ALLOW_USERS'}'></td>
2159 <td><input type='hidden' name='NTLM_DENY_USERS' value=' $proxysettings {'NTLM_DENY_USERS'}'></td>
2163 if (!( $proxysettings { 'AUTH_METHOD' } eq 'radius' )) {
2165 <td><input type='hidden' name='RADIUS_SERVER' value=' $proxysettings {'RADIUS_SERVER'}'></td>
2166 <td><input type='hidden' name='RADIUS_PORT' value=' $proxysettings {'RADIUS_PORT'}'></td>
2167 <td><input type='hidden' name='RADIUS_IDENTIFIER' value=' $proxysettings {'RADIUS_IDENTIFIER'}'></td>
2168 <td><input type='hidden' name='RADIUS_SECRET' value=' $proxysettings {'RADIUS_SECRET'}'></td>
2169 <td><input type='hidden' name='RADIUS_ENABLE_ACL' value=' $proxysettings {'RADIUS_ENABLE_ACL'}'></td>
2170 <td><input type='hidden' name='RADIUS_USER_ACL' value=' $proxysettings {'RADIUS_USER_ACL'}'></td>
2171 <td><input type='hidden' name='RADIUS_ALLOW_USERS' value=' $proxysettings {'RADIUS_ALLOW_USERS'}'></td>
2172 <td><input type='hidden' name='RADIUS_DENY_USERS' value=' $proxysettings {'RADIUS_DENY_USERS'}'></td>
2184 <table width='100%'>
2187 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'save'}' /></td>
2188 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'proxy reconfigure'}' /></td>
2189 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy save and restart'}' /></td>
2190 <td align='center'><input type='submit' name='ACTION' value=' $Lang ::tr{'advproxy clear cache'}' /></td>
2196 <table width='100%'>
2198 <td><img src='/blob.gif' align='top' alt='*' />
2199 <font class='base'> $Lang ::tr{'this field may be blank'}</font>
2201 <td align='right'> </td>
2208 & Header
:: closebox
();
2212 # ===================================================================
2213 # NCSA user management
2214 # ===================================================================
2216 & Header
:: openbox
( '100%' , 'left' , " $Lang ::tr{'advproxy NCSA auth'}" );
2218 <form method='post' action=' $ENV {'SCRIPT_NAME'}'>
2219 <table width='100%'>
2221 <td colspan='4'><b> $Lang ::tr{'advproxy NCSA user management'}</b></td>
2224 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA username'}:</td>
2225 <td width='25%'><input type='text' name='NCSA_USERNAME' value=' $proxysettings {'NCSA_USERNAME'}' size='12'
2228 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) { print " readonly " ; }
2231 <td width='25%' class='base'> $Lang ::tr{'advproxy NCSA group'}:</td>
2233 <select name='NCSA_GROUP'>
2234 <option value='standard' $selected {'NCSA_GROUP'}{'standard'}> $Lang ::tr{'advproxy NCSA grp standard'}</option>
2235 <option value='extended' $selected {'NCSA_GROUP'}{'extended'}> $Lang ::tr{'advproxy NCSA grp extended'}</option>
2236 <option value='disabled' $selected {'NCSA_GROUP'}{'disabled'}> $Lang ::tr{'advproxy NCSA grp disabled'}</option>
2242 <td class='base'> $Lang ::tr{'advproxy NCSA password'}:</td>
2243 <td><input type='password' name='NCSA_PASS' value=' $proxysettings {'NCSA_PASS'}' size='14' /></td>
2244 <td class='base'> $Lang ::tr{'advproxy NCSA password confirm'}:</td>
2245 <td><input type='password' name='NCSA_PASS_CONFIRM' value=' $proxysettings {'NCSA_PASS_CONFIRM'}' size='14' /></td>
2252 <td><input type='submit' name='SUBMIT' value=' $ncsa_buttontext ' /></td>
2253 <td><input type='hidden' name='ACTION' value=' $Lang ::tr{'add'}' /></td>
2254 <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value=' $proxysettings {'NCSA_MIN_PASS_LEN'}'></td>
2257 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' }) {
2258 print "<td><input type='reset' name='ACTION' value=' $Lang ::tr{'advproxy reset'}' /></td> \n " ;
2264 <td><input type='button' name='return2main' value=' $Lang ::tr{'advproxy back to main page'}' onClick='self.location.href=" $ENV {'SCRIPT_NAME'}"'></td>
2269 <table width='100%'>
2271 <td><b> $Lang ::tr{'advproxy NCSA user accounts'}:</b></td>
2274 <table width='100%' align='center'>
2280 open ( FILE
, $extgrp ); @grouplist = < FILE
>; close ( FILE
);
2281 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":extended" ); }
2285 open ( FILE
, $stdgrp ); @grouplist = < FILE
>; close ( FILE
);
2286 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":standard" ); }
2290 open ( FILE
, $disgrp ); @grouplist = < FILE
>; close ( FILE
);
2291 foreach $user ( @grouplist ) { chomp ( $user ); push ( @userlist , $user . ":disabled" ); }
2294 @userlist = sort ( @userlist );
2296 # If the password file contains entries, print entries and action icons
2298 if ( ! - z
" $userdb " ) {
2301 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA username'}</i></b></td>
2302 <td width='30%' class='boldbase' align='center'><b><i> $Lang ::tr{'advproxy NCSA group membership'}</i></b></td>
2303 <td class='boldbase' colspan='2' align='center'> </td>
2308 foreach $line ( @userlist )
2312 @temp = split ( /:/ , $line );
2313 if ( $proxysettings { 'ACTION' } eq $Lang :: tr
{ 'edit' } && $proxysettings { 'ID' } eq $line ) {
2314 print "<tr bgcolor=' $Header ::colouryellow'> \n " ; }
2316 print "<tr bgcolor=' $color {'color20'}'> \n " ; }
2318 print "<tr bgcolor=' $color {'color22'}'> \n " ; }
2321 <td align='center'> $temp [0]</td>
2325 if ( $temp [ 1 ] eq 'standard' ) {
2326 print $Lang :: tr
{ 'advproxy NCSA grp standard' };
2327 } elsif ( $temp [ 1 ] eq 'extended' ) {
2328 print $Lang :: tr
{ 'advproxy NCSA grp extended' };
2329 } elsif ( $temp [ 1 ] eq 'disabled' ) {
2330 print $Lang :: tr
{ 'advproxy NCSA grp disabled' }; }
2333 <td width='8%' align='center'>
2334 <form method='post' name='frma $id ' action=' $ENV {'SCRIPT_NAME'}'>
2335 <input type='image' name=' $Lang ::tr{'edit'}' src='/images/edit.gif' title=' $Lang ::tr{'edit'}' alt=' $Lang ::tr{'edit'}' />
2336 <input type='hidden' name='ID' value=' $line ' />
2337 <input type='hidden' name='ACTION' value=' $Lang ::tr{'edit'}' />
2341 <td width='8%' align='center'>
2342 <form method='post' name='frmb $id ' action=' $ENV {'SCRIPT_NAME'}'>
2343 <input type='image' name=' $Lang ::tr{'remove'}' src='/images/delete.gif' title=' $Lang ::tr{'remove'}' alt=' $Lang ::tr{'remove'}' />
2344 <input type='hidden' name='ID' value=' $temp [0]' />
2345 <input type='hidden' name='ACTION' value=' $Lang ::tr{'remove'}' />
2358 <td class='boldbase'> <b> $Lang ::tr{'legend'}:</b></td>
2359 <td> <img src='/images/edit.gif' alt=' $Lang ::tr{'edit'}' /></td>
2360 <td class='base'> $Lang ::tr{'edit'}</td>
2361 <td> <img src='/images/delete.gif' alt=' $Lang ::tr{'remove'}' /></td>
2362 <td class='base'> $Lang ::tr{'remove'}</td>
2369 <td><i> $Lang ::tr{'advproxy NCSA no accounts'}</i></td>
2380 & Header
:: closebox
();
2384 # ===================================================================
2386 & Header
:: closebigbox
();
2388 & Header
:: closepage
();
2390 # -------------------------------------------------------------------
2394 if (- e
" $acl_src_subnets " ) {
2395 open ( FILE
, " $acl_src_subnets " );
2396 delete $proxysettings { 'SRC_SUBNETS' };
2397 while (< FILE
>) { $proxysettings { 'SRC_SUBNETS' } .= $_ };
2400 if (- e
" $acl_src_banned_ip " ) {
2401 open ( FILE
, " $acl_src_banned_ip " );
2402 delete $proxysettings { 'SRC_BANNED_IP' };
2403 while (< FILE
>) { $proxysettings { 'SRC_BANNED_IP' } .= $_ };
2406 if (- e
" $acl_src_banned_mac " ) {
2407 open ( FILE
, " $acl_src_banned_mac " );
2408 delete $proxysettings { 'SRC_BANNED_MAC' };
2409 while (< FILE
>) { $proxysettings { 'SRC_BANNED_MAC' } .= $_ };
2412 if (- e
" $acl_src_unrestricted_ip " ) {
2413 open ( FILE
, " $acl_src_unrestricted_ip " );
2414 delete $proxysettings { 'SRC_UNRESTRICTED_IP' };
2415 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ };
2418 if (- e
" $acl_src_unrestricted_mac " ) {
2419 open ( FILE
, " $acl_src_unrestricted_mac " );
2420 delete $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2421 while (< FILE
>) { $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ };
2424 if (- e
" $acl_dst_nocache " ) {
2425 open ( FILE
, " $acl_dst_nocache " );
2426 delete $proxysettings { 'DST_NOCACHE' };
2427 while (< FILE
>) { $proxysettings { 'DST_NOCACHE' } .= $_ };
2430 if (- e
" $acl_dst_noauth " ) {
2431 open ( FILE
, " $acl_dst_noauth " );
2432 delete $proxysettings { 'DST_NOAUTH' };
2433 while (< FILE
>) { $proxysettings { 'DST_NOAUTH' } .= $_ };
2436 if (- e
" $acl_ports_safe " ) {
2437 open ( FILE
, " $acl_ports_safe " );
2438 delete $proxysettings { 'PORTS_SAFE' };
2439 while (< FILE
>) { $proxysettings { 'PORTS_SAFE' } .= $_ };
2442 if (- e
" $acl_ports_ssl " ) {
2443 open ( FILE
, " $acl_ports_ssl " );
2444 delete $proxysettings { 'PORTS_SSL' };
2445 while (< FILE
>) { $proxysettings { 'PORTS_SSL' } .= $_ };
2448 if (- e
" $mimetypes " ) {
2449 open ( FILE
, " $mimetypes " );
2450 delete $proxysettings { 'MIME_TYPES' };
2451 while (< FILE
>) { $proxysettings { 'MIME_TYPES' } .= $_ };
2454 if (- e
" $ntlmdir /msntauth.allowusers" ) {
2455 open ( FILE
, " $ntlmdir /msntauth.allowusers" );
2456 delete $proxysettings { 'NTLM_ALLOW_USERS' };
2457 while (< FILE
>) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ };
2460 if (- e
" $ntlmdir /msntauth.denyusers" ) {
2461 open ( FILE
, " $ntlmdir /msntauth.denyusers" );
2462 delete $proxysettings { 'NTLM_DENY_USERS' };
2463 while (< FILE
>) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ };
2466 if (- e
" $raddir /radauth.allowusers" ) {
2467 open ( FILE
, " $raddir /radauth.allowusers" );
2468 delete $proxysettings { 'RADIUS_ALLOW_USERS' };
2469 while (< FILE
>) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ };
2472 if (- e
" $raddir /radauth.denyusers" ) {
2473 open ( FILE
, " $raddir /radauth.denyusers" );
2474 delete $proxysettings { 'RADIUS_DENY_USERS' };
2475 while (< FILE
>) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ };
2478 if (- e
" $identdir /identauth.allowusers" ) {
2479 open ( FILE
, " $identdir /identauth.allowusers" );
2480 delete $proxysettings { 'IDENT_ALLOW_USERS' };
2481 while (< FILE
>) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ };
2484 if (- e
" $identdir /identauth.denyusers" ) {
2485 open ( FILE
, " $identdir /identauth.denyusers" );
2486 delete $proxysettings { 'IDENT_DENY_USERS' };
2487 while (< FILE
>) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ };
2490 if (- e
" $identhosts " ) {
2491 open ( FILE
, " $identhosts " );
2492 delete $proxysettings { 'IDENT_HOSTS' };
2493 while (< FILE
>) { $proxysettings { 'IDENT_HOSTS' } .= $_ };
2496 if (- e
" $cre_groups " ) {
2497 open ( FILE
, " $cre_groups " );
2498 delete $proxysettings { 'CRE_GROUPS' };
2499 while (< FILE
>) { $proxysettings { 'CRE_GROUPS' } .= $_ };
2502 if (- e
" $cre_svhosts " ) {
2503 open ( FILE
, " $cre_svhosts " );
2504 delete $proxysettings { 'CRE_SVHOSTS' };
2505 while (< FILE
>) { $proxysettings { 'CRE_SVHOSTS' } .= $_ };
2510 # -------------------------------------------------------------------
2514 @temp = split ( /\n/ , $proxysettings { 'PORTS_SAFE' });
2515 undef $proxysettings { 'PORTS_SAFE' };
2518 s/^\s+//g ; s/\s+$//g ;
2522 if ( /^[^#]+\s+#\sSquids\sport/ ) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/ ; $line = $_ ; }
2524 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2525 @templist = split ( /-/ );
2526 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2527 $proxysettings { 'PORTS_SAFE' } .= $line . " \n " ;
2531 @temp = split ( /\n/ , $proxysettings { 'PORTS_SSL' });
2532 undef $proxysettings { 'PORTS_SSL' };
2535 s/^\s+//g ; s/\s+$//g ;
2540 if ( /.*-.*-.*/ ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; }
2541 @templist = split ( /-/ );
2542 foreach ( @templist ) { unless (& General
:: validport
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid destination port' }; } }
2543 $proxysettings { 'PORTS_SSL' } .= $line . " \n " ;
2547 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2548 undef $proxysettings { 'DST_NOCACHE' };
2552 unless ( /^#/ ) { s/\s+//g ; }
2555 if ( /^\./ ) { $_ = '*' . $_ ; }
2556 $proxysettings { 'DST_NOCACHE' } .= $_ . " \n " ;
2560 @temp = split ( /\n/ , $proxysettings { 'SRC_SUBNETS' });
2561 undef $proxysettings { 'SRC_SUBNETS' };
2564 s/^\s+//g ; s/\s+$//g ;
2567 unless (& General
:: validipandmask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2568 $proxysettings { 'SRC_SUBNETS' } .= $_ . " \n " ;
2572 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_IP' });
2573 undef $proxysettings { 'SRC_BANNED_IP' };
2576 s/^\s+//g ; s/\s+$//g ;
2579 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2580 $proxysettings { 'SRC_BANNED_IP' } .= $_ . " \n " ;
2584 @temp = split ( /\n/ , $proxysettings { 'SRC_BANNED_MAC' });
2585 undef $proxysettings { 'SRC_BANNED_MAC' };
2588 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2591 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2592 $proxysettings { 'SRC_BANNED_MAC' } .= $_ . " \n " ;
2596 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_IP' });
2597 undef $proxysettings { 'SRC_UNRESTRICTED_IP' };
2600 s/^\s+//g ; s/\s+$//g ;
2603 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2604 $proxysettings { 'SRC_UNRESTRICTED_IP' } .= $_ . " \n " ;
2608 @temp = split ( /\n/ , $proxysettings { 'SRC_UNRESTRICTED_MAC' });
2609 undef $proxysettings { 'SRC_UNRESTRICTED_MAC' };
2612 s/^\s+//g ; s/\s+$//g ; s/-/:/g ;
2615 unless (& General
:: validmac
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid mac' }; }
2616 $proxysettings { 'SRC_UNRESTRICTED_MAC' } .= $_ . " \n " ;
2620 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2621 undef $proxysettings { 'DST_NOAUTH' };
2625 unless ( /^#/ ) { s/\s+//g ; }
2628 if ( /^\./ ) { $_ = '*' . $_ ; }
2629 $proxysettings { 'DST_NOAUTH' } .= $_ . " \n " ;
2633 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
2635 @temp = split ( /\n/ , $proxysettings { 'NTLM_ALLOW_USERS' });
2636 undef $proxysettings { 'NTLM_ALLOW_USERS' };
2639 s/^\s+//g ; s/\s+$//g ;
2640 if ( $_ ) { $proxysettings { 'NTLM_ALLOW_USERS' } .= $_ . " \n " ; }
2642 if ( $proxysettings { 'NTLM_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2645 if (( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
2647 @temp = split ( /\n/ , $proxysettings { 'NTLM_DENY_USERS' });
2648 undef $proxysettings { 'NTLM_DENY_USERS' };
2651 s/^\s+//g ; s/\s+$//g ;
2652 if ( $_ ) { $proxysettings { 'NTLM_DENY_USERS' } .= $_ . " \n " ; }
2654 if ( $proxysettings { 'NTLM_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2657 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
2659 @temp = split ( /\n/ , $proxysettings { 'IDENT_ALLOW_USERS' });
2660 undef $proxysettings { 'IDENT_ALLOW_USERS' };
2663 s/^\s+//g ; s/\s+$//g ;
2664 if ( $_ ) { $proxysettings { 'IDENT_ALLOW_USERS' } .= $_ . " \n " ; }
2666 if ( $proxysettings { 'IDENT_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2669 if (( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
2671 @temp = split ( /\n/ , $proxysettings { 'IDENT_DENY_USERS' });
2672 undef $proxysettings { 'IDENT_DENY_USERS' };
2675 s/^\s+//g ; s/\s+$//g ;
2676 if ( $_ ) { $proxysettings { 'IDENT_DENY_USERS' } .= $_ . " \n " ; }
2678 if ( $proxysettings { 'IDENT_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2681 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
2683 @temp = split ( /\n/ , $proxysettings { 'RADIUS_ALLOW_USERS' });
2684 undef $proxysettings { 'RADIUS_ALLOW_USERS' };
2687 s/^\s+//g ; s/\s+$//g ;
2688 if ( $_ ) { $proxysettings { 'RADIUS_ALLOW_USERS' } .= $_ . " \n " ; }
2690 if ( $proxysettings { 'RADIUS_ALLOW_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2693 if (( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
2695 @temp = split ( /\n/ , $proxysettings { 'RADIUS_DENY_USERS' });
2696 undef $proxysettings { 'RADIUS_DENY_USERS' };
2699 s/^\s+//g ; s/\s+$//g ;
2700 if ( $_ ) { $proxysettings { 'RADIUS_DENY_USERS' } .= $_ . " \n " ; }
2702 if ( $proxysettings { 'RADIUS_DENY_USERS' } eq '' ) { $errormessage = $Lang :: tr
{ 'advproxy errmsg acl cannot be empty' }; }
2705 @temp = split ( /\n/ , $proxysettings { 'IDENT_HOSTS' });
2706 undef $proxysettings { 'IDENT_HOSTS' };
2709 s/^\s+//g ; s/\s+$//g ;
2712 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2713 $proxysettings { 'IDENT_HOSTS' } .= $_ . " \n " ;
2717 @temp = split ( /\n/ , $proxysettings { 'CRE_SVHOSTS' });
2718 undef $proxysettings { 'CRE_SVHOSTS' };
2721 s/^\s+//g ; s/\s+$//g ;
2724 unless (& General
:: validipormask
( $_ )) { $errormessage = $Lang :: tr
{ 'advproxy errmsg invalid ip or mask' }; }
2725 $proxysettings { 'CRE_SVHOSTS' } .= $_ . " \n " ;
2730 # -------------------------------------------------------------------
2734 open ( FILE
, "> $acl_src_subnets " );
2736 if (! $proxysettings { 'SRC_SUBNETS' })
2738 print FILE
" $green_cidr \n " ;
2739 if ( $netsettings { 'BLUE_DEV' })
2741 print FILE
" $blue_cidr \n " ;
2743 } else { print FILE
$proxysettings { 'SRC_SUBNETS' }; }
2746 open ( FILE
, "> $acl_src_banned_ip " );
2748 print FILE
$proxysettings { 'SRC_BANNED_IP' };
2751 open ( FILE
, "> $acl_src_banned_mac " );
2753 print FILE
$proxysettings { 'SRC_BANNED_MAC' };
2756 open ( FILE
, "> $acl_src_unrestricted_ip " );
2758 print FILE
$proxysettings { 'SRC_UNRESTRICTED_IP' };
2761 open ( FILE
, "> $acl_src_unrestricted_mac " );
2763 print FILE
$proxysettings { 'SRC_UNRESTRICTED_MAC' };
2766 open ( FILE
, "> $acl_dst_noauth " );
2768 print FILE
$proxysettings { 'DST_NOAUTH' };
2771 open ( FILE
, "> $acl_dst_noauth_net " );
2773 open ( FILE
, "> $acl_dst_noauth_dom " );
2775 open ( FILE
, "> $acl_dst_noauth_url " );
2778 @temp = split ( /\n/ , $proxysettings { 'DST_NOAUTH' });
2786 open ( FILE
, ">> $acl_dst_noauth_dom " );
2791 elsif (& General
:: validipormask
( $_ ))
2793 open ( FILE
, ">> $acl_dst_noauth_net " );
2798 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?/ )
2800 open ( FILE
, ">> $acl_dst_noauth_net " );
2807 open ( FILE
, ">> $acl_dst_noauth_url " );
2809 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2815 open ( FILE
, "> $acl_dst_nocache " );
2817 print FILE
$proxysettings { 'DST_NOCACHE' };
2820 open ( FILE
, "> $acl_dst_nocache_net " );
2822 open ( FILE
, "> $acl_dst_nocache_dom " );
2824 open ( FILE
, "> $acl_dst_nocache_url " );
2827 @temp = split ( /\n/ , $proxysettings { 'DST_NOCACHE' });
2835 open ( FILE
, ">> $acl_dst_nocache_dom " );
2840 elsif (& General
:: validipormask
( $_ ))
2842 open ( FILE
, ">> $acl_dst_nocache_net " );
2847 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?/ )
2849 open ( FILE
, ">> $acl_dst_nocache_net " );
2856 open ( FILE
, ">> $acl_dst_nocache_url " );
2858 if ( /^[fh]tt?ps?:\/ \
// ) { print FILE
" $_ \n " ; } else { print FILE
"^[fh]tt?ps?:// $_ \n " ; }
2864 open ( FILE
, "> $acl_ports_safe " );
2866 if (! $proxysettings { 'PORTS_SAFE' }) { print FILE
$def_ports_safe ; } else { print FILE
$proxysettings { 'PORTS_SAFE' }; }
2869 open ( FILE
, "> $acl_ports_ssl " );
2871 if (! $proxysettings { 'PORTS_SSL' }) { print FILE
$def_ports_ssl ; } else { print FILE
$proxysettings { 'PORTS_SSL' }; }
2874 open ( FILE
, "> $acl_dst_throttle " );
2876 if ( $proxysettings { 'THROTTLE_BINARY' } eq 'on' )
2878 @temp = split ( /\|/ , $throttle_binary );
2879 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2881 if ( $proxysettings { 'THROTTLE_DSKIMG' } eq 'on' )
2883 @temp = split ( /\|/ , $throttle_dskimg );
2884 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2886 if ( $proxysettings { 'THROTTLE_MMEDIA' } eq 'on' )
2888 @temp = split ( /\|/ , $throttle_mmedia );
2889 foreach ( @temp ) { print FILE
" \\ . $_ \$ \n " ; }
2891 if (- s
$throttled_urls )
2893 open ( URLFILE
, $throttled_urls );
2896 foreach ( @temp ) { print FILE
; }
2900 open ( FILE
, "> $mimetypes " );
2902 print FILE
$proxysettings { 'MIME_TYPES' };
2905 open ( FILE
, "> $ntlmdir /msntauth.allowusers" );
2907 print FILE
$proxysettings { 'NTLM_ALLOW_USERS' };
2910 open ( FILE
, "> $ntlmdir /msntauth.denyusers" );
2912 print FILE
$proxysettings { 'NTLM_DENY_USERS' };
2915 open ( FILE
, "> $raddir /radauth.allowusers" );
2917 print FILE
$proxysettings { 'RADIUS_ALLOW_USERS' };
2920 open ( FILE
, "> $raddir /radauth.denyusers" );
2922 print FILE
$proxysettings { 'RADIUS_DENY_USERS' };
2925 open ( FILE
, "> $identdir /identauth.allowusers" );
2927 print FILE
$proxysettings { 'IDENT_ALLOW_USERS' };
2930 open ( FILE
, "> $identdir /identauth.denyusers" );
2932 print FILE
$proxysettings { 'IDENT_DENY_USERS' };
2935 open ( FILE
, "> $identhosts " );
2937 print FILE
$proxysettings { 'IDENT_HOSTS' };
2940 open ( FILE
, "> $cre_groups " );
2942 print FILE
$proxysettings { 'CRE_GROUPS' };
2945 open ( FILE
, "> $cre_svhosts " );
2947 print FILE
$proxysettings { 'CRE_SVHOSTS' };
2951 # -------------------------------------------------------------------
2955 open ( FILE
, ">/srv/web/ipfire/html/proxy.pac" );
2957 print FILE
"function FindProxyForURL(url, host) \n " ;
2959 if (( $proxysettings { 'ENABLE' } eq 'on' ) || ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
2963 (isPlainHostName(host)) ||
2964 (dnsDomainIs(host, ". $mainsettings {'DOMAINNAME'}")) ||
2965 (isInNet(host, "127.0.0.1", "255.0.0.0")) ||
2966 (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
2967 (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
2968 (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
2969 (isInNet(host, "169.254.0.0", "255.255.0.0"))
2977 if ( $proxysettings { 'ENABLE' } eq 'on' )
2979 print FILE
"if ( \n " ;
2980 print FILE
" (isInNet(myIpAddress(), \" $netsettings {'GREEN_NETADDRESS'} \" , \" $netsettings {'GREEN_NETMASK'} \" ))" ;
2983 if (- e
" $acl_src_subnets " ) {
2984 open ( SUBNETS
, " $acl_src_subnets " );
2985 @templist = < SUBNETS
>;
2991 @temp = split ( /\/ /);
2993 ( $temp [ 0 ] ne $netsettings { 'GREEN_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'GREEN_NETMASK' }) &&
2994 ( $temp [ 0 ] ne $netsettings { 'BLUE_NETADDRESS' }) && ( $temp [ 1 ] ne $netsettings { 'BLUE_NETMASK' })
2998 print FILE
" || \n (isInNet(myIpAddress(), \" $temp [0] \" , \" $temp [1] \" ))" ;
3008 return "PROXY $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3012 if (( $proxysettings { 'ENABLE' } eq 'on' ) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ) && ( $netsettings { 'BLUE_DEV' }))
3014 print FILE
" \n else \n\n " ;
3016 if (( $netsettings { 'BLUE_DEV' }) && ( $proxysettings { 'ENABLE_BLUE' } eq 'on' ))
3020 (isInNet(myIpAddress(), " $netsettings {'BLUE_NETADDRESS'}", " $netsettings {'BLUE_NETMASK'}"))
3022 return "PROXY $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}";
3031 # -------------------------------------------------------------------
3038 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } +
3039 $proxysettings { 'THROTTLING_GREEN_HOST' } +
3040 $proxysettings { 'THROTTLING_BLUE_TOTAL' } +
3041 $proxysettings { 'THROTTLING_BLUE_HOST' } gt 0 )
3043 $delaypools = 1 ; } else { $delaypools = 0 ;
3046 if ( $proxysettings { 'AUTH_REALM' } eq '' )
3048 $authrealm = "IPFire Advanced Proxy Server" ;
3050 $authrealm = $proxysettings { 'AUTH_REALM' };
3053 $_ = $proxysettings { 'UPSTREAM_PROXY' };
3054 my ( $remotehost , $remoteport ) = split ( /:/ , $_ );
3056 if ( $remoteport eq '' ) { $remoteport = 80 ; }
3058 open ( FILE
, ">${General::swroot}/proxy/squid.conf" );
3061 # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes
3062 # you make will be overwritten whenever you resave proxy settings using the
3065 # Instead, modify the file ' $acl_include ' and
3066 # then restart the proxy service using the web interface. Changes made to the
3067 # 'include.acl' file will propagate to the 'squid.conf' file at that time.
3069 shutdown_lifetime 5 seconds
3075 # Include file with user defined settings.
3076 if (- e
"/etc/squid/squid.conf.pre.local" ) {
3077 print FILE
"include /etc/squid/squid.conf.pre.local \n\n " ;
3080 print FILE
"http_port $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3081 if ( $proxysettings { 'TRANSPARENT' } eq 'on' ) { print FILE
" transparent" }
3082 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3085 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3086 print FILE
"http_port $netsettings {'BLUE_ADDRESS'}: $proxysettings {'PROXY_PORT'}" ;
3087 if ( $proxysettings { 'TRANSPARENT_BLUE' } eq 'on' ) { print FILE
" transparent" }
3088 if ( $proxysettings { 'NO_CONNECTION_AUTH' } eq 'on' ) { print FILE
" no-connection-auth" }
3092 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3096 if (!- z
$acl_dst_nocache_dom ) {
3097 print FILE
"acl no_cache_domains dstdomain \" $acl_dst_nocache_dom \"\n " ;
3098 print FILE
"cache deny no_cache_domains \n " ;
3100 if (!- z
$acl_dst_nocache_net ) {
3101 print FILE
"acl no_cache_ipaddr dst \" $acl_dst_nocache_net \"\n " ;
3102 print FILE
"cache deny no_cache_ipaddr \n " ;
3104 if (!- z
$acl_dst_nocache_url ) {
3105 print FILE
"acl no_cache_hosts url_regex -i \" $acl_dst_nocache_url \"\n " ;
3106 print FILE
"cache deny no_cache_hosts \n " ;
3112 cache_effective_user squid
3113 cache_effective_group squid
3116 pid_filename /var/run/squid.pid
3118 cache_mem $proxysettings {'CACHE_MEM'} MB
3121 print FILE
"error_directory $errordir / $proxysettings {'ERR_LANGUAGE'} \n\n " ;
3123 if ( $proxysettings { 'OFFLINE_MODE' } eq 'on' ) { print FILE
"offline_mode on \n\n " ; }
3124 if ( $proxysettings { 'CACHE_DIGESTS' } eq 'on' ) { print FILE
"digest_generation on \n\n " ; } else { print FILE
"digest_generation off \n\n " ; }
3126 if ((!( $proxysettings { 'MEM_POLICY' } eq 'LRU' )) || (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' )))
3128 if (!( $proxysettings { 'MEM_POLICY' } eq 'LRU' ))
3130 print FILE
"memory_replacement_policy $proxysettings {'MEM_POLICY'} \n " ;
3132 if (!( $proxysettings { 'CACHE_POLICY' } eq 'LRU' ))
3134 print FILE
"cache_replacement_policy $proxysettings {'CACHE_POLICY'} \n " ;
3139 if ( $proxysettings { 'CACHE_SIZE' } ne '0' )
3141 print FILE
"cache_dir aufs /var/log/cache $proxysettings {'CACHE_SIZE'} $proxysettings {'L1_DIRS'} 256 \n\n " ;
3144 if ( $proxysettings { 'LOGGING' } eq 'on' )
3147 access_log /var/log/squid/access.log
3148 cache_log /var/log/squid/cache.log
3149 cache_store_log none
3152 if ( $proxysettings { 'LOGUSERAGENT' } eq 'on' ) { print FILE
"useragent_log \/var\/log\/squid\/user_agent.log \n " ; }
3153 if ( $proxysettings { 'LOGQUERY' } eq 'on' ) { print FILE
" \n strip_query_terms off \n " ; }
3156 access_log /dev/null
3158 cache_store_log none
3167 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'on' )
3169 print FILE
"forwarded_for on \n " ;
3171 print FILE
"forwarded_for off \n " ;
3173 if ( $proxysettings { 'FORWARD_VIA' } eq 'on' )
3175 print FILE
"via on \n " ;
3177 print FILE
"via off \n " ;
3181 if ((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3183 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3185 print FILE
"auth_param basic program $authdir /ncsa_auth $userdb \n " ;
3186 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3187 print FILE
"auth_param basic realm $authrealm \n " ;
3188 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3189 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3192 if ( $proxysettings { 'AUTH_METHOD' } eq 'ldap' )
3194 print FILE
"auth_param basic utf8 on \n " ;
3195 print FILE
"auth_param basic program $authdir /squid_ldap_auth -b \" $proxysettings {'LDAP_BASEDN'} \" " ;
3196 if (!( $proxysettings { 'LDAP_BINDDN_USER' } eq '' )) { print FILE
" -D \" $proxysettings {'LDAP_BINDDN_USER'} \" " ; }
3197 if (!( $proxysettings { 'LDAP_BINDDN_PASS' } eq '' )) { print FILE
" -w $proxysettings {'LDAP_BINDDN_PASS'}" ; }
3198 if ( $proxysettings { 'LDAP_TYPE' } eq 'ADS' )
3200 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3202 print FILE
" -f \" (\&(objectClass=person)(sAMAccountName=\ %s )) \" " ;
3204 print FILE
" -f \" (\&(\&(objectClass=person)(sAMAccountName=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3206 print FILE
" -u sAMAccountName -P" ;
3208 if ( $proxysettings { 'LDAP_TYPE' } eq 'NDS' )
3210 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3212 print FILE
" -f \" (\&(objectClass=person)(cn=\ %s )) \" " ;
3214 print FILE
" -f \" (\&(\&(objectClass=person)(cn=\ %s ))(groupMembership= $proxysettings {'LDAP_GROUP'})) \" " ;
3216 print FILE
" -u cn -P" ;
3218 if (( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) || ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ))
3220 if ( $proxysettings { 'LDAP_GROUP' } eq '' )
3222 print FILE
" -f \" (\&(objectClass=person)(uid=\ %s )) \" " ;
3224 print FILE
" -f \" (\&(\&(objectClass=person)(uid=\ %s ))(memberOf= $proxysettings {'LDAP_GROUP'})) \" " ;
3226 if ( $proxysettings { 'LDAP_TYPE' } eq 'V2' ) { print FILE
" -v 2" ; }
3227 if ( $proxysettings { 'LDAP_TYPE' } eq 'V3' ) { print FILE
" -v 3" ; }
3228 print FILE
" -u uid -P" ;
3230 print FILE
" $proxysettings {'LDAP_SERVER'}: $proxysettings {'LDAP_PORT'} \n " ;
3231 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3232 print FILE
"auth_param basic realm $authrealm \n " ;
3233 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3234 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3237 if ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' )
3239 if ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' )
3241 print FILE
"auth_param ntlm program $authdir /ntlm_smb_lm_auth $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_PDC'}" ;
3242 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print FILE
" \n " ; } else { print FILE
" $proxysettings {'NTLM_DOMAIN'}/ $proxysettings {'NTLM_BDC'} \n " ; }
3243 print FILE
"auth_param ntlm children $proxysettings {'AUTH_CHILDREN'} \n " ;
3244 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3246 print FILE
"auth_param basic program $authdir /msnt_auth \n " ;
3247 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3248 print FILE
"auth_param basic realm $authrealm \n " ;
3249 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3250 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3252 open ( MSNTCONF
, "> $ntlmdir /msntauth.conf" );
3254 print MSNTCONF
"server $proxysettings {'NTLM_PDC'}" ;
3255 if ( $proxysettings { 'NTLM_BDC' } eq '' ) { print MSNTCONF
" $proxysettings {'NTLM_PDC'}" ; } else { print MSNTCONF
" $proxysettings {'NTLM_BDC'}" ; }
3256 print MSNTCONF
" $proxysettings {'NTLM_DOMAIN'} \n " ;
3257 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3259 if ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' )
3261 print MSNTCONF
"allowusers $ntlmdir /msntauth.allowusers \n " ;
3263 print MSNTCONF
"denyusers $ntlmdir /msntauth.denyusers \n " ;
3270 if ( $proxysettings { 'AUTH_METHOD' } eq 'radius' )
3272 print FILE
"auth_param basic program $authdir /squid_radius_auth -h $proxysettings {'RADIUS_SERVER'} -p $proxysettings {'RADIUS_PORT'} " ;
3273 if (!( $proxysettings { 'RADIUS_IDENTIFIER' } eq '' )) { print FILE
"-i $proxysettings {'RADIUS_IDENTIFIER'} " ; }
3274 print FILE
"-w $proxysettings {'RADIUS_SECRET'} \n " ;
3275 print FILE
"auth_param basic children $proxysettings {'AUTH_CHILDREN'} \n " ;
3276 print FILE
"auth_param basic realm $authrealm \n " ;
3277 print FILE
"auth_param basic credentialsttl $proxysettings {'AUTH_CACHE_TTL'} minutes \n " ;
3278 if (!( $proxysettings { 'AUTH_IPCACHE_TTL' } eq '0' )) { print FILE
" \n authenticate_ip_ttl $proxysettings {'AUTH_IPCACHE_TTL'} minutes \n " ; }
3282 print FILE
"acl for_inetusers proxy_auth REQUIRED \n " ;
3283 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) && ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ))
3285 if ((!- z
" $ntlmdir /msntauth.allowusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ))
3287 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.allowusers \"\n " ;
3289 if ((!- z
" $ntlmdir /msntauth.denyusers" ) && ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ))
3291 print FILE
"acl for_acl_users proxy_auth \" $ntlmdir /msntauth.denyusers \"\n " ;
3294 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3296 if ((!- z
" $raddir /radauth.allowusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ))
3298 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.allowusers \"\n " ;
3300 if ((!- z
" $raddir /radauth.denyusers" ) && ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ))
3302 print FILE
"acl for_acl_users proxy_auth \" $raddir /radauth.denyusers \"\n " ;
3305 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3308 if (!- z
$extgrp ) { print FILE
"acl for_extended_users proxy_auth \" $extgrp \"\n " ; }
3309 if (!- z
$disgrp ) { print FILE
"acl for_disabled_users proxy_auth \" $disgrp \"\n " ; }
3311 if (!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) { print FILE
" \n acl concurrent max_user_ip -s $proxysettings {'AUTH_MAX_USERIP'} \n " ; }
3314 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3315 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3316 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3321 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3323 if ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' )
3325 print FILE
"acl for_inetusers ident REQUIRED \n " ;
3327 if ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' )
3329 if ((!- z
" $identdir /identauth.allowusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ))
3331 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.allowusers \"\n\n " ;
3333 if ((!- z
" $identdir /identauth.denyusers" ) && ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ))
3335 print FILE
"acl for_acl_users ident_regex -i \" $identdir /identauth.denyusers \"\n\n " ;
3338 if (!- z
$acl_dst_noauth_net ) { print FILE
"acl to_ipaddr_without_auth dst \" $acl_dst_noauth_net \"\n " ; }
3339 if (!- z
$acl_dst_noauth_dom ) { print FILE
"acl to_domains_without_auth dstdomain \" $acl_dst_noauth_dom \"\n " ; }
3340 if (!- z
$acl_dst_noauth_url ) { print FILE
"acl to_hosts_without_auth url_regex -i \" $acl_dst_noauth_url \"\n " ; }
3344 if (( $delaypools ) && (!- z
$acl_dst_throttle )) { print FILE
"acl for_throttled_urls url_regex -i \" $acl_dst_throttle \"\n\n " ; }
3346 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
"acl with_allowed_useragents browser $browser_regexp \n\n " ; }
3348 print FILE
"acl within_timeframe time " ;
3349 if ( $proxysettings { 'TIME_MON' } eq 'on' ) { print FILE
"M" ; }
3350 if ( $proxysettings { 'TIME_TUE' } eq 'on' ) { print FILE
"T" ; }
3351 if ( $proxysettings { 'TIME_WED' } eq 'on' ) { print FILE
"W" ; }
3352 if ( $proxysettings { 'TIME_THU' } eq 'on' ) { print FILE
"H" ; }
3353 if ( $proxysettings { 'TIME_FRI' } eq 'on' ) { print FILE
"F" ; }
3354 if ( $proxysettings { 'TIME_SAT' } eq 'on' ) { print FILE
"A" ; }
3355 if ( $proxysettings { 'TIME_SUN' } eq 'on' ) { print FILE
"S" ; }
3356 print FILE
" $proxysettings {'TIME_FROM_HOUR'}:" ;
3357 print FILE
" $proxysettings {'TIME_FROM_MINUTE'}-" ;
3358 print FILE
" $proxysettings {'TIME_TO_HOUR'}:" ;
3359 print FILE
" $proxysettings {'TIME_TO_MINUTE'} \n\n " ;
3361 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3362 print FILE
"acl blocked_mimetypes rep_mime_type \" $mimetypes \"\n\n " ;
3367 acl localhost src 127.0.0.1/32
3370 open ( PORTS
, " $acl_ports_ssl " );
3375 foreach ( @temp ) { print FILE
"acl SSL_ports port $_ " ; }
3377 open ( PORTS
, " $acl_ports_safe " );
3382 foreach ( @temp ) { print FILE
"acl Safe_ports port $_ " ; }
3386 acl IPFire_http port $http_port
3387 acl IPFire_https port $https_port
3388 acl IPFire_ips dst $netsettings {'GREEN_ADDRESS'}
3389 acl IPFire_networks src " $acl_src_subnets "
3390 acl IPFire_servers dst " $acl_src_subnets "
3391 acl IPFire_green_network src $green_cidr
3392 acl IPFire_green_servers dst $green_cidr
3395 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_network src $blue_cidr \n " ; }
3396 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"acl IPFire_blue_servers dst $blue_cidr \n " ; }
3397 if (!- z
$acl_src_banned_ip ) { print FILE
"acl IPFire_banned_ips src \" $acl_src_banned_ip \"\n " ; }
3398 if (!- z
$acl_src_banned_mac ) { print FILE
"acl IPFire_banned_mac arp \" $acl_src_banned_mac \"\n " ; }
3399 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"acl IPFire_unrestricted_ips src \" $acl_src_unrestricted_ip \"\n " ; }
3400 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"acl IPFire_unrestricted_mac arp \" $acl_src_unrestricted_mac \"\n " ; }
3402 acl CONNECT method CONNECT
3406 if ( $proxysettings { 'CLASSROOM_EXT' } eq 'on' ) {
3409 #Classroom extensions
3410 acl IPFire_no_access_ips src " $acl_src_noaccess_ip "
3411 acl IPFire_no_access_mac arp " $acl_src_noaccess_mac "
3414 print FILE
"deny_info " ;
3415 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3417 print FILE
"ERR_ACCESS_DISABLED" ;
3419 print FILE
"ERR_ACCESS_DENIED" ;
3421 print FILE
" IPFire_no_access_ips \n " ;
3422 print FILE
"deny_info " ;
3423 if (( $proxysettings { 'ERR_DESIGN' } eq 'squid' ) && (- e
" $errordir / $proxysettings {'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED" ))
3425 print FILE
"ERR_ACCESS_DISABLED" ;
3427 print FILE
"ERR_ACCESS_DENIED" ;
3429 print FILE
" IPFire_no_access_mac \n " ;
3432 http_access deny IPFire_no_access_ips
3433 http_access deny IPFire_no_access_mac
3438 #Insert acl file and replace __VAR__ with correct values
3439 my $blue_net = '' ; #BLUE empty by default
3441 if ( $netsettings { 'BLUE_DEV' } && $proxysettings { 'ENABLE_BLUE' } eq 'on' ) {
3442 $blue_net = " $blue_cidr " ;
3443 $blue_ip = " $netsettings {'BLUE_ADDRESS'}" ;
3445 if (!- z
$acl_include )
3447 open ( ACL
, " $acl_include " );
3448 print FILE
" \n #Start of custom includes \n\n " ;
3450 $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/ ;
3451 $_ =~ s/__GREEN_NET__/$green_cidr/ ;
3452 $_ =~ s/__BLUE_IP__/$blue_ip/ ;
3453 $_ =~ s/__BLUE_NET__/$blue_net/ ;
3454 $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/ ;
3457 print FILE
" \n #End of custom includes \n " ;
3460 if ((!- z
$extgrp ) && ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && ( $proxysettings { 'NCSA_BYPASS_REDIR' } eq 'on' )) { print FILE
" \n redirector_access deny for_extended_users \n " ; }
3462 # Check if squidclamav is enabled.
3463 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3464 print FILE
" \n #Settings for squidclamav: \n " ;
3465 print FILE
"http_port 127.0.0.1: $proxysettings {'PROXY_PORT'} transparent \n " ;
3466 print FILE
"acl to_localhost dst 127.0.0.0/8 \n " ;
3467 print FILE
"acl purge method PURGE \n " ;
3468 print FILE
"http_access deny to_localhost \n " ;
3469 print FILE
"http_access allow localhost \n " ;
3470 print FILE
"http_access allow purge localhost \n " ;
3471 print FILE
"http_access deny purge \n " ;
3472 print FILE
"url_rewrite_access deny localhost \n " ;
3477 #local machine, no restriction
3478 http_access allow localhost
3480 #GUI admin if local machine connects
3481 http_access allow IPFire_ips IPFire_networks IPFire_http
3482 http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
3484 #Deny not web services
3485 http_access deny !Safe_ports
3486 http_access deny CONNECT !SSL_ports
3491 if ( $proxysettings { 'AUTH_METHOD' } eq 'ident' )
3493 print FILE
"#Set ident ACLs \n " ;
3494 if (!- z
$identhosts )
3496 print FILE
"acl on_ident_aware_hosts src \" $identhosts \"\n " ;
3497 print FILE
"ident_lookup_access allow on_ident_aware_hosts \n " ;
3498 print FILE
"ident_lookup_access deny all \n " ;
3500 print FILE
"ident_lookup_access allow all \n " ;
3502 print FILE
"ident_timeout $proxysettings {'IDENT_TIMEOUT'} seconds \n\n " ;
3506 print FILE
"#Set download throttling \n " ;
3508 if ( $netsettings { 'BLUE_DEV' })
3510 print FILE
"delay_pools 2 \n " ;
3512 print FILE
"delay_pools 1 \n " ;
3515 print FILE
"delay_class 1 3 \n " ;
3516 if ( $netsettings { 'BLUE_DEV' }) { print FILE
"delay_class 2 3 \n " ; }
3518 print FILE
"delay_parameters 1 " ;
3519 if ( $proxysettings { 'THROTTLING_GREEN_TOTAL' } eq 'unlimited' )
3523 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 125 ;
3525 print FILE
$proxysettings { 'THROTTLING_GREEN_TOTAL' } * 250 ;
3528 print FILE
" -1/-1 " ;
3529 if ( $proxysettings { 'THROTTLING_GREEN_HOST' } eq 'unlimited' )
3533 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 125 ;
3535 print FILE
$proxysettings { 'THROTTLING_GREEN_HOST' } * 250 ;
3539 if ( $netsettings { 'BLUE_DEV' })
3541 print FILE
"delay_parameters 2 " ;
3542 if ( $proxysettings { 'THROTTLING_BLUE_TOTAL' } eq 'unlimited' )
3546 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 125 ;
3548 print FILE
$proxysettings { 'THROTTLING_BLUE_TOTAL' } * 250 ;
3550 print FILE
" -1/-1 " ;
3551 if ( $proxysettings { 'THROTTLING_BLUE_HOST' } eq 'unlimited' )
3555 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 125 ;
3557 print FILE
$proxysettings { 'THROTTLING_BLUE_HOST' } * 250 ;
3562 print FILE
"delay_access 1 deny IPFire_ips \n " ;
3563 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 1 deny IPFire_unrestricted_ips \n " ; }
3564 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 1 deny IPFire_unrestricted_mac \n " ; }
3565 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 1 deny for_extended_users \n " ; }
3567 if ( $netsettings { 'BLUE_DEV' })
3569 print FILE
"delay_access 1 allow IPFire_green_network" ;
3570 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3572 print FILE
"delay_access 1 deny all \n " ;
3574 print FILE
"delay_access 1 allow all" ;
3575 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3579 if ( $netsettings { 'BLUE_DEV' })
3581 print FILE
"delay_access 2 deny IPFire_ips \n " ;
3582 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"delay_access 2 deny IPFire_unrestricted_ips \n " ; }
3583 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"delay_access 2 deny IPFire_unrestricted_mac \n " ; }
3584 if (( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' ) && (!- z
$extgrp )) { print FILE
"delay_access 2 deny for_extended_users \n " ; }
3585 print FILE
"delay_access 2 allow IPFire_blue_network" ;
3586 if (!- z
$acl_dst_throttle ) { print FILE
" for_throttled_urls" ; }
3588 print FILE
"delay_access 2 deny all \n " ;
3591 print FILE
"delay_initial_bucket_level 100 \n " ;
3595 if ( $proxysettings { 'NO_PROXY_LOCAL' } eq 'on' )
3597 print FILE
"#Prevent internal proxy access to Green except IPFire itself \n " ;
3598 print FILE
"http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network \n\n " ;
3601 if ( $proxysettings { 'NO_PROXY_LOCAL_BLUE' } eq 'on' )
3603 print FILE
"#Prevent internal proxy access from Blue except IPFire itself \n " ;
3604 print FILE
"http_access allow IPFire_blue_network IPFire_blue_servers \n " ;
3605 print FILE
"http_access deny IPFire_blue_network !IPFire_ips IPFire_servers \n\n " ;
3609 #Set custom configured ACLs
3612 if (!- z
$acl_src_banned_ip ) { print FILE
"http_access deny IPFire_banned_ips \n " ; }
3613 if (!- z
$acl_src_banned_mac ) { print FILE
"http_access deny IPFire_banned_mac \n " ; }
3615 if ((!- z
$acl_dst_noauth ) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )))
3617 if (!- z
$acl_src_unrestricted_ip )
3619 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth \n " ; }
3620 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_ips to_domains_without_auth \n " ; }
3621 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_ips to_hosts_without_auth \n " ; }
3623 if (!- z
$acl_src_unrestricted_mac )
3625 if (!- z
$acl_dst_noauth_net ) { print FILE
"http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth \n " ; }
3626 if (!- z
$acl_dst_noauth_dom ) { print FILE
"http_access allow IPFire_unrestricted_mac to_domains_without_auth \n " ; }
3627 if (!- z
$acl_dst_noauth_url ) { print FILE
"http_access allow IPFire_unrestricted_mac to_hosts_without_auth \n " ; }
3629 if (!- z
$acl_dst_noauth_net )
3631 print FILE
"http_access allow IPFire_networks" ;
3632 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3633 print FILE
" !within_timeframe" ;
3635 print FILE
" within_timeframe" ; }
3636 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3637 print FILE
" to_ipaddr_without_auth \n " ;
3639 if (!- z
$acl_dst_noauth_dom )
3641 print FILE
"http_access allow IPFire_networks" ;
3642 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3643 print FILE
" !within_timeframe" ;
3645 print FILE
" within_timeframe" ; }
3646 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3647 print FILE
" to_domains_without_auth \n " ;
3649 if (!- z
$acl_dst_noauth_url )
3651 print FILE
"http_access allow IPFire_networks" ;
3652 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3653 print FILE
" !within_timeframe" ;
3655 print FILE
" within_timeframe" ; }
3656 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3657 print FILE
" to_hosts_without_auth \n " ;
3661 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ))
3663 print FILE
"http_access deny !for_inetusers" ;
3664 if (!- z
$identhosts ) { print FILE
" on_ident_aware_hosts" ; }
3669 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3670 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' ) &&
3671 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3672 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3673 (!- z
" $identdir /identauth.denyusers" )
3676 print FILE
"http_access deny for_acl_users" ;
3677 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3681 if (!- z
$acl_src_unrestricted_ip )
3683 print FILE
"http_access allow IPFire_unrestricted_ips" ;
3684 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3686 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3688 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3690 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3692 print FILE
" for_inetusers" ;
3694 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3696 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3698 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3700 print FILE
" for_acl_users" ;
3702 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3704 print FILE
" !for_acl_users" ;
3706 } else { print FILE
" for_inetusers" ; }
3708 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3710 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3712 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3714 print FILE
" for_acl_users" ;
3716 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3718 print FILE
" !for_acl_users" ;
3720 } else { print FILE
" for_inetusers" ; }
3726 if (!- z
$acl_src_unrestricted_mac )
3728 print FILE
"http_access allow IPFire_unrestricted_mac" ;
3729 if ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'on' )
3731 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3733 if (!- z
$disgrp ) { print FILE
" !for_disabled_users" ; } else { print FILE
" for_inetusers" ; }
3735 if (( $proxysettings { 'AUTH_METHOD' } eq 'ldap' ) || (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'off' )) || ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ))
3737 print FILE
" for_inetusers" ;
3739 if (( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) && ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ))
3741 if ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' )
3743 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) && (!- z
" $ntlmdir /msntauth.allowusers" ))
3745 print FILE
" for_acl_users" ;
3747 if (( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) && (!- z
" $ntlmdir /msntauth.denyusers" ))
3749 print FILE
" !for_acl_users" ;
3751 } else { print FILE
" for_inetusers" ; }
3753 if (( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) && ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ))
3755 if ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' )
3757 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) && (!- z
" $raddir /radauth.allowusers" ))
3759 print FILE
" for_acl_users" ;
3761 if (( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) && (!- z
" $raddir /radauth.denyusers" ))
3763 print FILE
" !for_acl_users" ;
3765 } else { print FILE
" for_inetusers" ; }
3771 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3773 if (!- z
$disgrp ) { print FILE
"http_access deny for_disabled_users \n " ; }
3774 if (!- z
$extgrp ) { print FILE
"http_access allow IPFire_networks for_extended_users \n " ; }
3779 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3780 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3781 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3782 ( $proxysettings { 'NTLM_USER_ACL' } eq 'negative' ) &&
3783 (!- z
" $ntlmdir /msntauth.denyusers" )
3787 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3788 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3789 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'negative' ) &&
3790 (!- z
" $raddir /radauth.denyusers" )
3794 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3795 ( $proxysettings { 'AUTH_ALWAYS_REQUIRED' } eq 'off' ) &&
3796 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3797 ( $proxysettings { 'IDENT_USER_ACL' } eq 'negative' ) &&
3798 (!- z
" $identdir /identauth.denyusers" )
3802 print FILE
"http_access deny for_acl_users" ;
3803 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && (!- z
" $identdir /hosts" )) { print FILE
" on_ident_aware_hosts" ; }
3807 if (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) && (!- z
" $identhosts " ))
3809 print FILE
"http_access allow" ;
3810 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3811 print FILE
" !within_timeframe" ;
3813 print FILE
" within_timeframe" ; }
3814 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3815 print FILE
" !on_ident_aware_hosts \n " ;
3818 print FILE
"http_access allow IPFire_networks" ;
3821 ( $proxysettings { 'AUTH_METHOD' } eq 'ntlm' ) &&
3822 ( $proxysettings { 'NTLM_ENABLE_INT_AUTH' } eq 'on' ) &&
3823 ( $proxysettings { 'NTLM_ENABLE_ACL' } eq 'on' ) &&
3824 ( $proxysettings { 'NTLM_USER_ACL' } eq 'positive' ) &&
3825 (!- z
" $ntlmdir /msntauth.allowusers" )
3829 ( $proxysettings { 'AUTH_METHOD' } eq 'radius' ) &&
3830 ( $proxysettings { 'RADIUS_ENABLE_ACL' } eq 'on' ) &&
3831 ( $proxysettings { 'RADIUS_USER_ACL' } eq 'positive' ) &&
3832 (!- z
" $raddir /radauth.allowusers" )
3836 ( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) &&
3837 ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ) &&
3838 ( $proxysettings { 'IDENT_ENABLE_ACL' } eq 'on' ) &&
3839 ( $proxysettings { 'IDENT_USER_ACL' } eq 'positive' ) &&
3840 (!- z
" $identdir /identauth.allowusers" )
3844 print FILE
" for_acl_users" ;
3845 } elsif (((!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' ))) ||
3846 (( $proxysettings { 'AUTH_METHOD' } eq 'ident' ) && ( $proxysettings { 'IDENT_REQUIRED' } eq 'on' ))) {
3847 print FILE
" for_inetusers" ;
3849 if ((!( $proxysettings { 'AUTH_MAX_USERIP' } eq '' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'none' )) && (!( $proxysettings { 'AUTH_METHOD' } eq 'ident' )))
3851 print FILE
" !concurrent" ;
3853 if ( $proxysettings { 'TIME_ACCESS_MODE' } eq 'deny' ) {
3854 print FILE
" !within_timeframe" ;
3856 print FILE
" within_timeframe" ; }
3857 if ( $proxysettings { 'ENABLE_BROWSER_CHECK' } eq 'on' ) { print FILE
" with_allowed_useragents" ; }
3860 print FILE
"http_access deny all \n\n " ;
3862 if (( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' ) || ( $proxysettings { 'FORWARD_VIA' } eq 'off' ) ||
3863 (!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3865 print FILE
"#Strip HTTP Header \n " ;
3867 if ( $proxysettings { 'FORWARD_IPADDRESS' } eq 'off' )
3869 print FILE
"request_header_access X-Forwarded-For deny all \n " ;
3870 print FILE
"reply_header_access X-Forwarded-For deny all \n " ;
3872 if ( $proxysettings { 'FORWARD_VIA' } eq 'off' )
3874 print FILE
"request_header_access Via deny all \n " ;
3875 print FILE
"reply_header_access Via deny all \n " ;
3877 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3879 print FILE
"request_header_access User-Agent deny all \n " ;
3880 print FILE
"reply_header_access User-Agent deny all \n " ;
3882 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3884 print FILE
"request_header_access Referer deny all \n " ;
3885 print FILE
"reply_header_access Referer deny all \n " ;
3890 if ((!( $proxysettings { 'FAKE_USERAGENT' } eq '' )) || (!( $proxysettings { 'FAKE_REFERER' } eq '' )))
3892 if (!( $proxysettings { 'FAKE_USERAGENT' } eq '' ))
3894 print FILE
"header_replace User-Agent $proxysettings {'FAKE_USERAGENT'} \n " ;
3896 if (!( $proxysettings { 'FAKE_REFERER' } eq '' ))
3898 print FILE
"header_replace Referer $proxysettings {'FAKE_REFERER'} \n " ;
3904 if ( $proxysettings { 'SUPPRESS_VERSION' } eq 'on' ) { print FILE
"httpd_suppress_version_string on \n\n " }
3906 if ((!- z
$mimetypes ) && ( $proxysettings { 'ENABLE_MIME_FILTER' } eq 'on' )) {
3907 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"http_reply_access allow IPFire_unrestricted_ips \n " ; }
3908 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"http_reply_access allow IPFire_unrestricted_mac \n " ; }
3909 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3911 if (!- z
$extgrp ) { print FILE
"http_reply_access allow for_extended_users \n " ; }
3913 print FILE
"http_reply_access deny blocked_mimetypes \n " ;
3914 print FILE
"http_reply_access allow all \n\n " ;
3917 if ( $proxysettings { 'CACHE_SIZE' } > 0 )
3920 maximum_object_size $proxysettings {'MAX_SIZE'} KB
3921 minimum_object_size $proxysettings {'MIN_SIZE'} KB
3925 } else { print FILE
"cache deny all \n\n " ; }
3928 request_body_max_size $proxysettings {'MAX_OUTGOING_SIZE'} KB
3931 if ( $proxysettings { 'MAX_INCOMING_SIZE' } > 0 ) {
3932 if (!- z
$acl_src_unrestricted_ip ) { print FILE
"reply_body_max_size none IPFire_unrestricted_ips \n " ; }
3933 if (!- z
$acl_src_unrestricted_mac ) { print FILE
"reply_body_max_size none IPFire_unrestricted_mac \n " ; }
3934 if ( $proxysettings { 'AUTH_METHOD' } eq 'ncsa' )
3936 if (!- z
$extgrp ) { print FILE
"reply_body_max_size none for_extended_users \n " ; }
3940 if ( $proxysettings { 'MAX_INCOMING_SIZE' } != '0' )
3942 print FILE
"reply_body_max_size $proxysettings {'MAX_INCOMING_SIZE'} KB all \n\n " ;
3945 print FILE
"visible_hostname" ;
3946 if ( $proxysettings { 'VISIBLE_HOSTNAME' } eq '' )
3948 print FILE
" $mainsettings {'HOSTNAME'}. $mainsettings {'DOMAINNAME'} \n\n " ;
3950 print FILE
" $proxysettings {'VISIBLE_HOSTNAME'} \n\n " ;
3953 if (!( $proxysettings { 'ADMIN_MAIL_ADDRESS' } eq '' )) { print FILE
"cache_mgr $proxysettings {'ADMIN_MAIL_ADDRESS'} \n " ; }
3954 if (!( $proxysettings { 'ADMIN_PASSWORD' } eq '' )) { print FILE
"cachemgr_passwd $proxysettings {'ADMIN_PASSWORD'} all \n " ; }
3957 print FILE
"max_filedescriptors $proxysettings {'FILEDESCRIPTORS'} \n\n " ;
3959 # Write the parent proxy info, if needed.
3960 if ( $remotehost ne '' )
3962 print FILE
"cache_peer $remotehost parent $remoteport 3130 default no-query" ;
3964 # Enter authentication for the parent cache. Option format is
3965 # login=user:password ($proxy1='YES')
3966 # login=PASS ($proxy1='PASS')
3967 # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on')
3968 if (( $proxy1 eq 'YES' ) || ( $proxy1 eq 'PASS' ))
3970 print FILE
" login= $proxysettings {'UPSTREAM_USER'}" ;
3971 if ( $proxy1 eq 'YES' ) { print FILE
": $proxysettings {'UPSTREAM_PASSWORD'}" ; }
3973 elsif ( $proxysettings { 'FORWARD_USERNAME' } eq 'on' ) { print FILE
" login=*:password" ; }
3975 print FILE
" \n always_direct allow IPFire_ips \n " ;
3976 print FILE
"never_direct allow all \n\n " ;
3978 if (( $proxysettings { 'ENABLE_FILTER' } eq 'on' ) || ( $proxysettings { 'ENABLE_UPDXLRATOR' } eq 'on' ) || ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ))
3980 print FILE
"url_rewrite_program /usr/sbin/redirect_wrapper \n " ;
3981 print FILE
"url_rewrite_children $proxysettings {'CHILDREN'} \n\n " ;
3984 # Include file with user defined settings.
3985 if (- e
"/etc/squid/squid.conf.local" ) {
3986 print FILE
"include /etc/squid/squid.conf.local \n " ;
3990 # Proxy settings for squidclamav - if installed.
3992 # Check if squidclamav is enabled.
3993 if ( $proxysettings { 'ENABLE_CLAMAV' } eq 'on' ) {
3995 my $configfile = '/etc/squidclamav.conf' ;
3997 my $data = & General
:: read_file_utf8
( $configfile );
3998 $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g ;
3999 & General
:: write_file_utf8
( $configfile , $data );
4003 # -------------------------------------------------------------------
4007 my ( $str_user , $str_pass , $str_group ) = @_ ;
4008 my @groupmembers =();
4010 if ( $str_pass eq 'lEaVeAlOnE' )
4012 open ( FILE
, " $userdb " );
4013 @groupmembers = < FILE
>;
4015 foreach $line ( @groupmembers ) { if ( $line =~ /^$str_user:/i ) { $str_pass = substr ( $line , index ( $line , ":" )); } }
4016 & deluser
( $str_user );
4017 open ( FILE
, ">> $userdb " );
4019 print FILE
" $str_user $str_pass " ;
4022 & deluser
( $str_user );
4023 system ( "/usr/sbin/htpasswd -b $userdb $str_user $str_pass " );
4026 if ( $str_group eq 'standard' ) { open ( FILE
, ">> $stdgrp " );
4027 } elsif ( $str_group eq 'extended' ) { open ( FILE
, ">> $extgrp " );
4028 } elsif ( $str_group eq 'disabled' ) { open ( FILE
, ">> $disgrp " ); }
4030 print FILE
" $str_user \n " ;
4036 # -------------------------------------------------------------------
4040 my ( $str_user ) = @_ ;
4042 my @groupmembers =();
4045 foreach $groupfile ( $stdgrp , $extgrp , $disgrp )
4048 open ( FILE
, " $groupfile " );
4049 @groupmembers = < FILE
>;
4051 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user$/i )) { push ( @templist , $line ); } }
4052 open ( FILE
, "> $groupfile " );
4054 print FILE
@templist ;
4059 open ( FILE
, " $userdb " );
4060 @groupmembers = < FILE
>;
4062 foreach $line ( @groupmembers ) { if (!( $line =~ /^$str_user:/i )) { push ( @templist , $line ); } }
4063 open ( FILE
, "> $userdb " );
4065 print FILE
@templist ;
4071 # -------------------------------------------------------------------
4075 open ( FILE
, ">${General::swroot}/proxy/cachemgr.conf" );
4077 print FILE
" $netsettings {'GREEN_ADDRESS'}: $proxysettings {'PROXY_PORT'} \n " ;
4078 print FILE
"localhost" ;
4083 # -------------------------------------------------------------------