]>
Commit | Line | Data |
---|---|---|
ac1cfefa | 1 | #!/usr/bin/perl |
70df8302 MT |
2 | ############################################################################### |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
b34fdcae | 5 | # Copyright (C) 2007-2013 IPFire Team <info@ipfire.org> # |
70df8302 MT |
6 | # # |
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. # | |
11 | # # | |
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. # | |
16 | # # | |
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/>. # | |
19 | # # | |
20 | ############################################################################### | |
488d1b7c | 21 | # |
37273bc6 | 22 | # (c) 2004-2009 marco.s - http://www.advproxy.net |
488d1b7c CS |
23 | # |
24 | # This code is distributed under the terms of the GPL | |
25 | # | |
37273bc6 | 26 | # $Id: advproxy.cgi,v 3.0.2 2009/02/04 00:00:00 marco.s Exp $ |
488d1b7c | 27 | # |
ac1cfefa MT |
28 | |
29 | use strict; | |
0aff7b81 | 30 | use Apache::Htpasswd; |
ac1cfefa MT |
31 | |
32 | # enable only the following on debugging purpose | |
cb5e9c6c CS |
33 | #use warnings; |
34 | #use CGI::Carp 'fatalsToBrowser'; | |
ac1cfefa | 35 | |
ed38f89d | 36 | require '/var/ipfire/general-functions.pl'; |
ac1cfefa MT |
37 | require "${General::swroot}/lang.pl"; |
38 | require "${General::swroot}/header.pl"; | |
39 | ||
363fb6af MT |
40 | my @squidversion = `/usr/sbin/squid -v`; |
41 | my $http_port='81'; | |
42 | my $https_port='444'; | |
43 | ||
18322edf CS |
44 | my %color = (); |
45 | my %mainsettings = (); | |
46 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
47 | &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); | |
48 | ||
ac1cfefa MT |
49 | my %proxysettings=(); |
50 | my %netsettings=(); | |
ed38f89d | 51 | my %filtersettings=(); |
9fb25b1c | 52 | my %xlratorsettings=(); |
ed38f89d | 53 | my %stdproxysettings=(); |
ac1cfefa | 54 | my %mainsettings=(); |
ed38f89d MT |
55 | |
56 | my %checked=(); | |
57 | my %selected=(); | |
58 | ||
ce1f04ee | 59 | my @throttle_limits=(64,128,256,512,1024,1536,2048,3072,4096,5120,6144,7168,8192,10240,16384,20480,51200,102400); |
ed38f89d | 60 | |
363fb6af MT |
61 | my $def_ports_safe="80 # http\n21 # ftp\n443 # https\n563 # snews\n70 # gopher\n210 # wais\n1025-65535 # unregistered ports\n280 # http-mgmt\n488 # gss-http\n591 # filemaker\n777 # multiling http\n800 # Squids port (for icons)\n"; |
62 | my $def_ports_ssl="443 # https\n563 # snews\n"; | |
63 | ||
ed38f89d MT |
64 | my $hintcolour='#FFFFCC'; |
65 | my $ncsa_buttontext=''; | |
66 | my $language=''; | |
67 | my $i=0; | |
68 | my $n=0; | |
69 | my $id=0; | |
70 | my $line=''; | |
71 | my $user=''; | |
72 | my @userlist=(); | |
73 | my @grouplist=(); | |
74 | my @temp=(); | |
75 | my @templist=(); | |
76 | ||
77 | my $cachemem=0; | |
78 | my $proxy1=''; | |
79 | my $proxy2=''; | |
ed38f89d MT |
80 | my $browser_regexp=''; |
81 | my $needhup = 0; | |
82 | my $errormessage=''; | |
83 | ||
84 | my $acldir = "${General::swroot}/proxy/advanced/acls"; | |
85 | my $ncsadir = "${General::swroot}/proxy/advanced/ncsa"; | |
ed38f89d MT |
86 | my $raddir = "${General::swroot}/proxy/advanced/radius"; |
87 | my $identdir = "${General::swroot}/proxy/advanced/ident"; | |
88 | my $credir = "${General::swroot}/proxy/advanced/cre"; | |
89 | ||
90 | my $userdb = "$ncsadir/passwd"; | |
91 | my $stdgrp = "$ncsadir/standard.grp"; | |
92 | my $extgrp = "$ncsadir/extended.grp"; | |
93 | my $disgrp = "$ncsadir/disabled.grp"; | |
94 | ||
ed38f89d MT |
95 | my $mimetypes = "${General::swroot}/proxy/advanced/mimetypes"; |
96 | my $throttled_urls = "${General::swroot}/proxy/advanced/throttle"; | |
97 | ||
98 | my $cre_enabled = "${General::swroot}/proxy/advanced/cre/enable"; | |
99 | my $cre_groups = "${General::swroot}/proxy/advanced/cre/classrooms"; | |
100 | my $cre_svhosts = "${General::swroot}/proxy/advanced/cre/supervisors"; | |
101 | ||
102 | my $identhosts = "$identdir/hosts"; | |
103 | ||
8c55860f | 104 | my $authdir = "/usr/lib/squid/"; |
f1baee3e | 105 | my $errordir = "/usr/lib/squid/errors"; |
ed38f89d MT |
106 | |
107 | my $acl_src_subnets = "$acldir/src_subnets.acl"; | |
108 | my $acl_src_banned_ip = "$acldir/src_banned_ip.acl"; | |
109 | my $acl_src_banned_mac = "$acldir/src_banned_mac.acl"; | |
110 | my $acl_src_unrestricted_ip = "$acldir/src_unrestricted_ip.acl"; | |
111 | my $acl_src_unrestricted_mac = "$acldir/src_unrestricted_mac.acl"; | |
112 | my $acl_src_noaccess_ip = "$acldir/src_noaccess_ip.acl"; | |
113 | my $acl_src_noaccess_mac = "$acldir/src_noaccess_mac.acl"; | |
ed38f89d | 114 | my $acl_dst_noauth = "$acldir/dst_noauth.acl"; |
488d1b7c CS |
115 | my $acl_dst_noauth_dom = "$acldir/dst_noauth_dom.acl"; |
116 | my $acl_dst_noauth_net = "$acldir/dst_noauth_net.acl"; | |
117 | my $acl_dst_noauth_url = "$acldir/dst_noauth_url.acl"; | |
118 | my $acl_dst_nocache = "$acldir/dst_nocache.acl"; | |
119 | my $acl_dst_nocache_dom = "$acldir/dst_nocache_dom.acl"; | |
120 | my $acl_dst_nocache_net = "$acldir/dst_nocache_net.acl"; | |
121 | my $acl_dst_nocache_url = "$acldir/dst_nocache_url.acl"; | |
ed38f89d | 122 | my $acl_dst_throttle = "$acldir/dst_throttle.acl"; |
363fb6af MT |
123 | my $acl_ports_safe = "$acldir/ports_safe.acl"; |
124 | my $acl_ports_ssl = "$acldir/ports_ssl.acl"; | |
ed38f89d MT |
125 | my $acl_include = "$acldir/include.acl"; |
126 | ||
363fb6af MT |
127 | my $updaccelversion = 'n/a'; |
128 | my $urlfilterversion = 'n/a'; | |
129 | ||
ed38f89d MT |
130 | unless (-d "$acldir") { mkdir("$acldir"); } |
131 | unless (-d "$ncsadir") { mkdir("$ncsadir"); } | |
ed38f89d MT |
132 | unless (-d "$raddir") { mkdir("$raddir"); } |
133 | unless (-d "$identdir") { mkdir("$identdir"); } | |
134 | unless (-d "$credir") { mkdir("$credir"); } | |
135 | ||
136 | unless (-e $cre_groups) { system("touch $cre_groups"); } | |
137 | unless (-e $cre_svhosts) { system("touch $cre_svhosts"); } | |
138 | ||
139 | unless (-e $userdb) { system("touch $userdb"); } | |
140 | unless (-e $stdgrp) { system("touch $stdgrp"); } | |
141 | unless (-e $extgrp) { system("touch $extgrp"); } | |
142 | unless (-e $disgrp) { system("touch $disgrp"); } | |
143 | ||
144 | unless (-e $acl_src_subnets) { system("touch $acl_src_subnets"); } | |
145 | unless (-e $acl_src_banned_ip) { system("touch $acl_src_banned_ip"); } | |
146 | unless (-e $acl_src_banned_mac) { system("touch $acl_src_banned_mac"); } | |
147 | unless (-e $acl_src_unrestricted_ip) { system("touch $acl_src_unrestricted_ip"); } | |
148 | unless (-e $acl_src_unrestricted_mac) { system("touch $acl_src_unrestricted_mac"); } | |
149 | unless (-e $acl_src_noaccess_ip) { system("touch $acl_src_noaccess_ip"); } | |
150 | unless (-e $acl_src_noaccess_mac) { system("touch $acl_src_noaccess_mac"); } | |
488d1b7c CS |
151 | unless (-e $acl_dst_noauth) { system("touch $acl_dst_noauth"); } |
152 | unless (-e $acl_dst_noauth_dom) { system("touch $acl_dst_noauth_dom"); } | |
153 | unless (-e $acl_dst_noauth_net) { system("touch $acl_dst_noauth_net"); } | |
154 | unless (-e $acl_dst_noauth_url) { system("touch $acl_dst_noauth_url"); } | |
155 | unless (-e $acl_dst_nocache) { system("touch $acl_dst_nocache"); } | |
156 | unless (-e $acl_dst_nocache_dom) { system("touch $acl_dst_nocache_dom"); } | |
157 | unless (-e $acl_dst_nocache_net) { system("touch $acl_dst_nocache_net"); } | |
158 | unless (-e $acl_dst_nocache_url) { system("touch $acl_dst_nocache_url"); } | |
ed38f89d | 159 | unless (-e $acl_dst_throttle) { system("touch $acl_dst_throttle"); } |
363fb6af MT |
160 | unless (-e $acl_ports_safe) { system("touch $acl_ports_safe"); } |
161 | unless (-e $acl_ports_ssl) { system("touch $acl_ports_ssl"); } | |
ed38f89d MT |
162 | unless (-e $acl_include) { system("touch $acl_include"); } |
163 | ||
ed38f89d MT |
164 | unless (-e $mimetypes) { system("touch $mimetypes"); } |
165 | ||
603248db MT |
166 | my $HAVE_NTLM_AUTH = (-e "/usr/bin/ntlm_auth"); |
167 | ||
ac1cfefa MT |
168 | &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); |
169 | &General::readhash("${General::swroot}/main/settings", \%mainsettings); | |
170 | ||
f09a0af5 | 171 | my $green_cidr = &General::ipcidr("$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}"); |
d3527a38 MT |
172 | my $blue_cidr = ""; |
173 | if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) { | |
f09a0af5 AF |
174 | $blue_cidr = &General::ipcidr("$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}"); |
175 | } | |
176 | ||
ac1cfefa MT |
177 | &Header::showhttpheaders(); |
178 | ||
179 | $proxysettings{'ACTION'} = ''; | |
180 | $proxysettings{'VALID'} = ''; | |
181 | ||
ac1cfefa MT |
182 | $proxysettings{'ENABLE'} = 'off'; |
183 | $proxysettings{'ENABLE_BLUE'} = 'off'; | |
ac1cfefa MT |
184 | $proxysettings{'TRANSPARENT'} = 'off'; |
185 | $proxysettings{'TRANSPARENT_BLUE'} = 'off'; | |
ed38f89d | 186 | $proxysettings{'PROXY_PORT'} = '800'; |
0f6b6067 | 187 | $proxysettings{'TRANSPARENT_PORT'} = '3128'; |
ed38f89d MT |
188 | $proxysettings{'VISIBLE_HOSTNAME'} = ''; |
189 | $proxysettings{'ADMIN_MAIL_ADDRESS'} = ''; | |
fe1656d2 | 190 | $proxysettings{'ADMIN_PASSWORD'} = ''; |
7ec83993 | 191 | $proxysettings{'ERR_LANGUAGE'} = 'en'; |
0d948999 | 192 | $proxysettings{'ERR_DESIGN'} = 'ipfire'; |
363fb6af | 193 | $proxysettings{'SUPPRESS_VERSION'} = 'off'; |
ed38f89d MT |
194 | $proxysettings{'FORWARD_VIA'} = 'off'; |
195 | $proxysettings{'FORWARD_IPADDRESS'} = 'off'; | |
196 | $proxysettings{'FORWARD_USERNAME'} = 'off'; | |
363fb6af | 197 | $proxysettings{'NO_CONNECTION_AUTH'} = 'off'; |
ed38f89d MT |
198 | $proxysettings{'UPSTREAM_PROXY'} = ''; |
199 | $proxysettings{'UPSTREAM_USER'} = ''; | |
200 | $proxysettings{'UPSTREAM_PASSWORD'} = ''; | |
201 | $proxysettings{'LOGGING'} = 'off'; | |
fe1656d2 | 202 | $proxysettings{'CACHEMGR'} = 'off'; |
ed38f89d MT |
203 | $proxysettings{'LOGQUERY'} = 'off'; |
204 | $proxysettings{'LOGUSERAGENT'} = 'off'; | |
8dc17705 | 205 | $proxysettings{'FILEDESCRIPTORS'} = '16384'; |
c2f1b818 MT |
206 | $proxysettings{'CACHE_MEM'} = '128'; |
207 | $proxysettings{'CACHE_SIZE'} = '0'; | |
ac1cfefa MT |
208 | $proxysettings{'MAX_SIZE'} = '4096'; |
209 | $proxysettings{'MIN_SIZE'} = '0'; | |
ed38f89d MT |
210 | $proxysettings{'MEM_POLICY'} = 'LRU'; |
211 | $proxysettings{'CACHE_POLICY'} = 'LRU'; | |
212 | $proxysettings{'L1_DIRS'} = '16'; | |
213 | $proxysettings{'OFFLINE_MODE'} = 'off'; | |
6bea848d | 214 | $proxysettings{'CACHE_DIGESTS'} = 'off'; |
ed38f89d MT |
215 | $proxysettings{'CLASSROOM_EXT'} = 'off'; |
216 | $proxysettings{'SUPERVISOR_PASSWORD'} = ''; | |
9fb25b1c MT |
217 | $proxysettings{'NO_PROXY_LOCAL'} = 'off'; |
218 | $proxysettings{'NO_PROXY_LOCAL_BLUE'} = 'off'; | |
ed38f89d MT |
219 | $proxysettings{'TIME_ACCESS_MODE'} = 'allow'; |
220 | $proxysettings{'TIME_FROM_HOUR'} = '00'; | |
221 | $proxysettings{'TIME_FROM_MINUTE'} = '00'; | |
222 | $proxysettings{'TIME_TO_HOUR'} = '24'; | |
223 | $proxysettings{'TIME_TO_MINUTE'} = '00'; | |
ac1cfefa MT |
224 | $proxysettings{'MAX_OUTGOING_SIZE'} = '0'; |
225 | $proxysettings{'MAX_INCOMING_SIZE'} = '0'; | |
ed38f89d MT |
226 | $proxysettings{'THROTTLING_GREEN_TOTAL'} = 'unlimited'; |
227 | $proxysettings{'THROTTLING_GREEN_HOST'} = 'unlimited'; | |
228 | $proxysettings{'THROTTLING_BLUE_TOTAL'} = 'unlimited'; | |
229 | $proxysettings{'THROTTLING_BLUE_HOST'} = 'unlimited'; | |
ed38f89d | 230 | $proxysettings{'ENABLE_MIME_FILTER'} = 'off'; |
ed38f89d MT |
231 | $proxysettings{'FAKE_USERAGENT'} = ''; |
232 | $proxysettings{'FAKE_REFERER'} = ''; | |
233 | $proxysettings{'AUTH_METHOD'} = 'none'; | |
234 | $proxysettings{'AUTH_REALM'} = ''; | |
235 | $proxysettings{'AUTH_MAX_USERIP'} = ''; | |
236 | $proxysettings{'AUTH_CACHE_TTL'} = '60'; | |
ed38f89d MT |
237 | $proxysettings{'AUTH_CHILDREN'} = '5'; |
238 | $proxysettings{'NCSA_MIN_PASS_LEN'} = '6'; | |
239 | $proxysettings{'NCSA_BYPASS_REDIR'} = 'off'; | |
240 | $proxysettings{'NCSA_USERNAME'} = ''; | |
241 | $proxysettings{'NCSA_GROUP'} = ''; | |
242 | $proxysettings{'NCSA_PASS'} = ''; | |
243 | $proxysettings{'NCSA_PASS_CONFIRM'} = ''; | |
244 | $proxysettings{'LDAP_BASEDN'} = ''; | |
245 | $proxysettings{'LDAP_TYPE'} = 'ADS'; | |
246 | $proxysettings{'LDAP_SERVER'} = ''; | |
247 | $proxysettings{'LDAP_PORT'} = '389'; | |
248 | $proxysettings{'LDAP_BINDDN_USER'} = ''; | |
249 | $proxysettings{'LDAP_BINDDN_PASS'} = ''; | |
250 | $proxysettings{'LDAP_GROUP'} = ''; | |
b5674643 | 251 | $proxysettings{'NTLM_AUTH_GROUP'} = ''; |
2fc5124b | 252 | $proxysettings{'NTLM_AUTH_BASIC'} = 'off'; |
ed38f89d MT |
253 | $proxysettings{'NTLM_DOMAIN'} = ''; |
254 | $proxysettings{'NTLM_PDC'} = ''; | |
255 | $proxysettings{'NTLM_BDC'} = ''; | |
256 | $proxysettings{'NTLM_ENABLE_ACL'} = 'off'; | |
257 | $proxysettings{'NTLM_USER_ACL'} = 'positive'; | |
258 | $proxysettings{'RADIUS_SERVER'} = ''; | |
363fb6af | 259 | $proxysettings{'RADIUS_PORT'} = '1812'; |
ed38f89d MT |
260 | $proxysettings{'RADIUS_IDENTIFIER'} = ''; |
261 | $proxysettings{'RADIUS_SECRET'} = ''; | |
262 | $proxysettings{'RADIUS_ENABLE_ACL'} = 'off'; | |
263 | $proxysettings{'RADIUS_USER_ACL'} = 'positive'; | |
264 | $proxysettings{'IDENT_REQUIRED'} = 'off'; | |
265 | $proxysettings{'IDENT_TIMEOUT'} = '10'; | |
266 | $proxysettings{'IDENT_ENABLE_ACL'} = 'off'; | |
267 | $proxysettings{'IDENT_USER_ACL'} = 'positive'; | |
9fb25b1c MT |
268 | $proxysettings{'ENABLE_FILTER'} = 'off'; |
269 | $proxysettings{'ENABLE_UPDXLRATOR'} = 'off'; | |
d12aede7 | 270 | $proxysettings{'ENABLE_CLAMAV'} = 'off'; |
ed38f89d MT |
271 | |
272 | $ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'}; | |
ac1cfefa MT |
273 | |
274 | &Header::getcgihash(\%proxysettings); | |
275 | ||
ed38f89d MT |
276 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} eq 0) {$proxysettings{'THROTTLING_GREEN_TOTAL'} = 'unlimited';} |
277 | if ($proxysettings{'THROTTLING_GREEN_HOST'} eq 0) {$proxysettings{'THROTTLING_GREEN_HOST'} = 'unlimited';} | |
278 | if ($proxysettings{'THROTTLING_BLUE_TOTAL'} eq 0) {$proxysettings{'THROTTLING_BLUE_TOTAL'} = 'unlimited';} | |
279 | if ($proxysettings{'THROTTLING_BLUE_HOST'} eq 0) {$proxysettings{'THROTTLING_BLUE_HOST'} = 'unlimited';} | |
ac1cfefa | 280 | |
ed38f89d | 281 | if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy NCSA user management'}) |
ac1cfefa | 282 | { |
ed38f89d MT |
283 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; |
284 | } | |
285 | ||
286 | if ($proxysettings{'ACTION'} eq $Lang::tr{'add'}) | |
287 | { | |
288 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; | |
289 | if (length($proxysettings{'NCSA_PASS'}) < $proxysettings{'NCSA_MIN_PASS_LEN'}) { | |
290 | $errormessage = $Lang::tr{'advproxy errmsg password length 1'}.$proxysettings{'NCSA_MIN_PASS_LEN'}.$Lang::tr{'advproxy errmsg password length 2'}; | |
291 | } | |
292 | if (!($proxysettings{'NCSA_PASS'} eq $proxysettings{'NCSA_PASS_CONFIRM'})) { | |
293 | $errormessage = $Lang::tr{'advproxy errmsg passwords different'}; | |
294 | } | |
295 | if ($proxysettings{'NCSA_USERNAME'} eq '') { | |
296 | $errormessage = $Lang::tr{'advproxy errmsg no username'}; | |
297 | } | |
298 | if (!$errormessage) { | |
299 | $proxysettings{'NCSA_USERNAME'} =~ tr/A-Z/a-z/; | |
300 | &adduser($proxysettings{'NCSA_USERNAME'}, $proxysettings{'NCSA_PASS'}, $proxysettings{'NCSA_GROUP'}); | |
301 | } | |
302 | $proxysettings{'NCSA_USERNAME'} = ''; | |
303 | $proxysettings{'NCSA_GROUP'} = ''; | |
304 | $proxysettings{'NCSA_PASS'} = ''; | |
305 | $proxysettings{'NCSA_PASS_CONFIRM'} = ''; | |
306 | } | |
ac1cfefa | 307 | |
ed38f89d MT |
308 | if ($proxysettings{'ACTION'} eq $Lang::tr{'remove'}) |
309 | { | |
310 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; | |
311 | &deluser($proxysettings{'ID'}); | |
312 | } | |
313 | ||
9fb25b1c MT |
314 | $checked{'ENABLE_UPDXLRATOR'}{'off'} = ''; |
315 | $checked{'ENABLE_UPDXLRATOR'}{'on'} = ''; | |
316 | $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'"; | |
317 | ||
ed38f89d MT |
318 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) |
319 | { | |
320 | $proxysettings{'NCSA_EDIT_MODE'} = 'yes'; | |
321 | $ncsa_buttontext = $Lang::tr{'advproxy NCSA update user'}; | |
322 | @temp = split(/:/,$proxysettings{'ID'}); | |
323 | $proxysettings{'NCSA_USERNAME'} = $temp[0]; | |
324 | $proxysettings{'NCSA_GROUP'} = $temp[1]; | |
325 | $proxysettings{'NCSA_PASS'} = "lEaVeAlOnE"; | |
326 | $proxysettings{'NCSA_PASS_CONFIRM'} = $proxysettings{'NCSA_PASS'}; | |
327 | } | |
328 | ||
fe1656d2 | 329 | if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'})) |
28c9dec6 CS |
330 | { |
331 | if ($proxysettings{'ENABLE'} !~ /^(on|off)$/ || | |
332 | $proxysettings{'TRANSPARENT'} !~ /^(on|off)$/ || | |
333 | $proxysettings{'ENABLE_BLUE'} !~ /^(on|off)$/ || | |
ac1cfefa MT |
334 | $proxysettings{'TRANSPARENT_BLUE'} !~ /^(on|off)$/ ) { |
335 | $errormessage = $Lang::tr{'invalid input'}; | |
336 | goto ERROR; | |
28c9dec6 | 337 | } |
8b6f424c | 338 | if($proxysettings{'CACHE_MEM'} > $proxysettings{'CACHE_SIZE'} && $proxysettings{'CACHE_SIZE'} > 0){ |
d5a7ff95 AM |
339 | $errormessage = $Lang::tr{'advproxy errmsg cache'}." ".$proxysettings{'CACHE_MEM'}." > ".$proxysettings{'CACHE_SIZE'}; |
340 | goto ERROR; | |
341 | } | |
c4b12981 | 342 | |
f2fdd0c1 | 343 | if (!(&General::validport($proxysettings{'PROXY_PORT'}))) |
363fb6af MT |
344 | { |
345 | $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'}; | |
346 | goto ERROR; | |
347 | } | |
0f6b6067 MT |
348 | if (!(&General::validport($proxysettings{'TRANSPARENT_PORT'}))) |
349 | { | |
350 | $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'}; | |
351 | goto ERROR; | |
352 | } | |
353 | if ($proxysettings{'PROXY_PORT'} eq $proxysettings{'TRANSPARENT_PORT'}) { | |
354 | $errormessage = $Lang::tr{'advproxy errmsg proxy ports equal'}; | |
355 | goto ERROR; | |
356 | } | |
dcfc6334 SS |
357 | if (!($proxysettings{'UPSTREAM_PROXY'} eq '')) |
358 | { | |
359 | my @temp = split(/:/,$proxysettings{'UPSTREAM_PROXY'}); | |
360 | if (!(&General::validip($temp[0]))) | |
361 | { | |
362 | if (!(&General::validdomainname($temp[0]))) | |
363 | { | |
364 | $errormessage = $Lang::tr{'advproxy errmsg invalid upstream proxy'}; | |
365 | goto ERROR; | |
366 | } | |
367 | } | |
69491545 | 368 | } |
ac1cfefa MT |
369 | if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) || |
370 | ($proxysettings{'CACHE_SIZE'} < 10)) | |
371 | { | |
488d1b7c CS |
372 | if (!($proxysettings{'CACHE_SIZE'} eq '0')) |
373 | { | |
374 | $errormessage = $Lang::tr{'advproxy errmsg hdd cache size'}; | |
375 | goto ERROR; | |
376 | } | |
ed38f89d | 377 | } |
fe1656d2 | 378 | if (!($proxysettings{'FILEDESCRIPTORS'} =~ /^\d+/) || |
4f160f04 | 379 | ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 1048576)) |
fe1656d2 CS |
380 | { |
381 | $errormessage = $Lang::tr{'proxy errmsg filedescriptors'}; | |
382 | goto ERROR; | |
383 | } | |
53d67554 | 384 | if (!($proxysettings{'CACHE_MEM'} =~ /^\d+/)) |
ed38f89d MT |
385 | { |
386 | $errormessage = $Lang::tr{'advproxy errmsg mem cache size'}; | |
ac1cfefa | 387 | goto ERROR; |
28c9dec6 | 388 | } |
ed38f89d MT |
389 | my @free = `/usr/bin/free`; |
390 | $free[1] =~ m/(\d+)/; | |
391 | $cachemem = int $1 / 2048; | |
392 | if ($proxysettings{'CACHE_MEM'} > $cachemem) { | |
393 | $proxysettings{'CACHE_MEM'} = $cachemem; | |
394 | } | |
ac1cfefa MT |
395 | if (!($proxysettings{'MAX_SIZE'} =~ /^\d+/)) |
396 | { | |
397 | $errormessage = $Lang::tr{'invalid maximum object size'}; | |
398 | goto ERROR; | |
399 | } | |
400 | if (!($proxysettings{'MIN_SIZE'} =~ /^\d+/)) | |
401 | { | |
402 | $errormessage = $Lang::tr{'invalid minimum object size'}; | |
403 | goto ERROR; | |
404 | } | |
405 | if (!($proxysettings{'MAX_OUTGOING_SIZE'} =~ /^\d+/)) | |
406 | { | |
407 | $errormessage = $Lang::tr{'invalid maximum outgoing size'}; | |
408 | goto ERROR; | |
409 | } | |
ed38f89d MT |
410 | if (!($proxysettings{'TIME_TO_HOUR'}.$proxysettings{'TIME_TO_MINUTE'} gt $proxysettings{'TIME_FROM_HOUR'}.$proxysettings{'TIME_FROM_MINUTE'})) |
411 | { | |
412 | $errormessage = $Lang::tr{'advproxy errmsg time restriction'}; | |
413 | goto ERROR; | |
414 | } | |
ac1cfefa MT |
415 | if (!($proxysettings{'MAX_INCOMING_SIZE'} =~ /^\d+/)) |
416 | { | |
417 | $errormessage = $Lang::tr{'invalid maximum incoming size'}; | |
418 | goto ERROR; | |
419 | } | |
ed38f89d MT |
420 | if (!($proxysettings{'AUTH_METHOD'} eq 'none')) |
421 | { | |
363fb6af | 422 | unless (($proxysettings{'AUTH_METHOD'} eq 'ident') && |
ed38f89d MT |
423 | ($proxysettings{'IDENT_REQUIRED'} eq 'off') && |
424 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'off')) | |
425 | { | |
426 | if ($netsettings{'BLUE_DEV'}) | |
363fb6af | 427 | { |
ed38f89d MT |
428 | if ((($proxysettings{'ENABLE'} eq 'off') || ($proxysettings{'TRANSPARENT'} eq 'on')) && |
429 | (($proxysettings{'ENABLE_BLUE'} eq 'off') || ($proxysettings{'TRANSPARENT_BLUE'} eq 'on'))) | |
430 | { | |
431 | $errormessage = $Lang::tr{'advproxy errmsg non-transparent proxy required'}; | |
432 | goto ERROR; | |
433 | } | |
434 | } else { | |
435 | if (($proxysettings{'ENABLE'} eq 'off') || ($proxysettings{'TRANSPARENT'} eq 'on')) | |
436 | { | |
437 | $errormessage = $Lang::tr{'advproxy errmsg non-transparent proxy required'}; | |
438 | goto ERROR; | |
439 | } | |
440 | } | |
441 | } | |
ed38f89d MT |
442 | if (!($proxysettings{'AUTH_CACHE_TTL'} =~ /^\d+/)) |
443 | { | |
444 | $errormessage = $Lang::tr{'advproxy errmsg auth cache ttl'}; | |
445 | goto ERROR; | |
446 | } | |
dc637f08 MT |
447 | if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) && |
448 | ((!($proxysettings{'AUTH_MAX_USERIP'} =~ /^\d+/)) || ($proxysettings{'AUTH_MAX_USERIP'} < 1) || ($proxysettings{'AUTH_MAX_USERIP'} > 255))) | |
ed38f89d | 449 | { |
dc637f08 | 450 | $errormessage = $Lang::tr{'advproxy errmsg max userip'}; |
ed38f89d MT |
451 | goto ERROR; |
452 | } | |
dc637f08 | 453 | if (!($proxysettings{'AUTH_MAX_USERIP'} eq '')) |
ed38f89d MT |
454 | { |
455 | $errormessage = $Lang::tr{'advproxy errmsg auth ipcache may not be null'}; | |
456 | goto ERROR; | |
457 | } | |
458 | if ((!($proxysettings{'AUTH_CHILDREN'} =~ /^\d+/)) || ($proxysettings{'AUTH_CHILDREN'} < 1) || ($proxysettings{'AUTH_CHILDREN'} > 255)) | |
459 | { | |
460 | $errormessage = $Lang::tr{'advproxy errmsg auth children'}; | |
461 | goto ERROR; | |
462 | } | |
463 | } | |
464 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
465 | { | |
466 | if ((!($proxysettings{'NCSA_MIN_PASS_LEN'} =~ /^\d+/)) || ($proxysettings{'NCSA_MIN_PASS_LEN'} < 1) || ($proxysettings{'NCSA_MIN_PASS_LEN'} > 255)) | |
467 | { | |
468 | $errormessage = $Lang::tr{'advproxy errmsg password length'}; | |
469 | goto ERROR; | |
470 | } | |
471 | } | |
472 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
473 | { | |
474 | if ((!($proxysettings{'IDENT_TIMEOUT'} =~ /^\d+/)) || ($proxysettings{'IDENT_TIMEOUT'} < 1)) | |
475 | { | |
476 | $errormessage = $Lang::tr{'advproxy errmsg ident timeout'}; | |
477 | goto ERROR; | |
478 | } | |
479 | } | |
480 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') | |
481 | { | |
482 | if ($proxysettings{'LDAP_BASEDN'} eq '') | |
483 | { | |
484 | $errormessage = $Lang::tr{'advproxy errmsg ldap base dn'}; | |
485 | goto ERROR; | |
486 | } | |
487 | if (!&General::validip($proxysettings{'LDAP_SERVER'})) | |
488 | { | |
e201b6d5 SS |
489 | if (!&General::validdomainname($proxysettings{'LDAP_SERVER'})) |
490 | { | |
491 | $errormessage = $Lang::tr{'advproxy errmsg ldap server'}; | |
492 | goto ERROR; | |
493 | } | |
ed38f89d MT |
494 | } |
495 | if (!&General::validport($proxysettings{'LDAP_PORT'})) | |
496 | { | |
497 | $errormessage = $Lang::tr{'advproxy errmsg ldap port'}; | |
498 | goto ERROR; | |
499 | } | |
500 | if (($proxysettings{'LDAP_TYPE'} eq 'ADS') || ($proxysettings{'LDAP_TYPE'} eq 'NDS')) | |
501 | { | |
502 | if (($proxysettings{'LDAP_BINDDN_USER'} eq '') || ($proxysettings{'LDAP_BINDDN_PASS'} eq '')) | |
503 | { | |
504 | $errormessage = $Lang::tr{'advproxy errmsg ldap bind dn'}; | |
505 | goto ERROR; | |
506 | } | |
507 | } | |
508 | } | |
ed38f89d MT |
509 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') |
510 | { | |
511 | if (!&General::validip($proxysettings{'RADIUS_SERVER'})) | |
512 | { | |
513 | $errormessage = $Lang::tr{'advproxy errmsg radius server'}; | |
514 | goto ERROR; | |
515 | } | |
516 | if (!&General::validport($proxysettings{'RADIUS_PORT'})) | |
517 | { | |
518 | $errormessage = $Lang::tr{'advproxy errmsg radius port'}; | |
519 | goto ERROR; | |
520 | } | |
521 | if ($proxysettings{'RADIUS_SECRET'} eq '') | |
522 | { | |
523 | $errormessage = $Lang::tr{'advproxy errmsg radius secret'}; | |
524 | goto ERROR; | |
525 | } | |
ac1cfefa MT |
526 | } |
527 | ||
363fb6af MT |
528 | # Quick parent proxy error checking of username and password info. If username password don't both exist give an error. |
529 | $proxy1 = 'YES'; | |
530 | $proxy2 = 'YES'; | |
531 | if (($proxysettings{'UPSTREAM_USER'} eq '')) {$proxy1 = '';} | |
532 | if (($proxysettings{'UPSTREAM_PASSWORD'} eq '')) {$proxy2 = '';} | |
533 | if ($proxysettings{'UPSTREAM_USER'} eq 'PASS') {$proxy1=$proxy2='PASS'; $proxysettings{'UPSTREAM_PASSWORD'} = '';} | |
534 | if (($proxy1 ne $proxy2)) | |
535 | { | |
536 | $errormessage = $Lang::tr{'advproxy errmsg invalid upstream proxy username or password setting'}; | |
537 | goto ERROR; | |
538 | } | |
ac1cfefa | 539 | |
ed38f89d MT |
540 | ERROR: |
541 | &check_acls; | |
ac1cfefa | 542 | |
ed38f89d MT |
543 | if ($errormessage) { |
544 | $proxysettings{'VALID'} = 'no'; } | |
545 | else { | |
363fb6af | 546 | $proxysettings{'VALID'} = 'yes'; } |
ac1cfefa | 547 | |
ed38f89d | 548 | if ($proxysettings{'VALID'} eq 'yes') |
ac1cfefa | 549 | { |
ed38f89d | 550 | &write_acls; |
ac1cfefa | 551 | |
ed38f89d MT |
552 | delete $proxysettings{'SRC_SUBNETS'}; |
553 | delete $proxysettings{'SRC_BANNED_IP'}; | |
554 | delete $proxysettings{'SRC_BANNED_MAC'}; | |
555 | delete $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
556 | delete $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
557 | delete $proxysettings{'DST_NOCACHE'}; | |
558 | delete $proxysettings{'DST_NOAUTH'}; | |
363fb6af MT |
559 | delete $proxysettings{'PORTS_SAFE'}; |
560 | delete $proxysettings{'PORTS_SSL'}; | |
ed38f89d MT |
561 | delete $proxysettings{'MIME_TYPES'}; |
562 | delete $proxysettings{'NTLM_ALLOW_USERS'}; | |
563 | delete $proxysettings{'NTLM_DENY_USERS'}; | |
564 | delete $proxysettings{'RADIUS_ALLOW_USERS'}; | |
565 | delete $proxysettings{'RADIUS_DENY_USERS'}; | |
566 | delete $proxysettings{'IDENT_HOSTS'}; | |
567 | delete $proxysettings{'IDENT_ALLOW_USERS'}; | |
568 | delete $proxysettings{'IDENT_DENY_USERS'}; | |
ac1cfefa | 569 | |
ed38f89d MT |
570 | delete $proxysettings{'CRE_GROUPS'}; |
571 | delete $proxysettings{'CRE_SVHOSTS'}; | |
ac1cfefa | 572 | |
ed38f89d MT |
573 | delete $proxysettings{'NCSA_USERNAME'}; |
574 | delete $proxysettings{'NCSA_GROUP'}; | |
575 | delete $proxysettings{'NCSA_PASS'}; | |
576 | delete $proxysettings{'NCSA_PASS_CONFIRM'}; | |
ac1cfefa | 577 | |
ed38f89d MT |
578 | $proxysettings{'TIME_MON'} = 'off' unless exists $proxysettings{'TIME_MON'}; |
579 | $proxysettings{'TIME_TUE'} = 'off' unless exists $proxysettings{'TIME_TUE'}; | |
580 | $proxysettings{'TIME_WED'} = 'off' unless exists $proxysettings{'TIME_WED'}; | |
581 | $proxysettings{'TIME_THU'} = 'off' unless exists $proxysettings{'TIME_THU'}; | |
582 | $proxysettings{'TIME_FRI'} = 'off' unless exists $proxysettings{'TIME_FRI'}; | |
583 | $proxysettings{'TIME_SAT'} = 'off' unless exists $proxysettings{'TIME_SAT'}; | |
584 | $proxysettings{'TIME_SUN'} = 'off' unless exists $proxysettings{'TIME_SUN'}; | |
ac1cfefa | 585 | |
ed38f89d MT |
586 | $proxysettings{'AUTH_ALWAYS_REQUIRED'} = 'off' unless exists $proxysettings{'AUTH_ALWAYS_REQUIRED'}; |
587 | $proxysettings{'NTLM_ENABLE_INT_AUTH'} = 'off' unless exists $proxysettings{'NTLM_ENABLE_INT_AUTH'}; | |
ac1cfefa | 588 | |
ed38f89d | 589 | &General::writehash("${General::swroot}/proxy/advanced/settings", \%proxysettings); |
ac1cfefa | 590 | |
363fb6af MT |
591 | if (-e "${General::swroot}/proxy/settings") { &General::readhash("${General::swroot}/proxy/settings", \%stdproxysettings); } |
592 | $stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'}; | |
488d1b7c CS |
593 | $stdproxysettings{'UPSTREAM_PROXY'} = $proxysettings{'UPSTREAM_PROXY'}; |
594 | $stdproxysettings{'UPSTREAM_USER'} = $proxysettings{'UPSTREAM_USER'}; | |
595 | $stdproxysettings{'UPSTREAM_PASSWORD'} = $proxysettings{'UPSTREAM_PASSWORD'}; | |
9fb25b1c MT |
596 | $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'}; |
597 | $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'}; | |
d12aede7 | 598 | $stdproxysettings{'ENABLE_CLAMAV'} = $proxysettings{'ENABLE_CLAMAV'}; |
363fb6af | 599 | &General::writehash("${General::swroot}/proxy/settings", \%stdproxysettings); |
ac1cfefa | 600 | |
ed38f89d MT |
601 | &writeconfig; |
602 | &writepacfile; | |
603 | ||
fe1656d2 CS |
604 | if ($proxysettings{'CACHEMGR'} eq 'on'){&writecachemgr;} |
605 | ||
d56fc335 | 606 | system ('/usr/local/bin/squidctrl', 'disable'); |
ed38f89d MT |
607 | unlink "${General::swroot}/proxy/enable"; |
608 | unlink "${General::swroot}/proxy/transparent"; | |
609 | unlink "${General::swroot}/proxy/enable_blue"; | |
610 | unlink "${General::swroot}/proxy/transparent_blue"; | |
ac1cfefa | 611 | |
ac1cfefa | 612 | if ($proxysettings{'ENABLE'} eq 'on') { |
d56fc335 MT |
613 | system ('/usr/bin/touch', "${General::swroot}/proxy/enable"); |
614 | system ('/usr/local/bin/squidctrl', 'enable'); } | |
6c689591 | 615 | if ($proxysettings{'TRANSPARENT'} eq 'on' && $proxysettings{'ENABLE'} eq 'on') { |
9833e7d8 | 616 | system ('/usr/bin/touch', "${General::swroot}/proxy/transparent"); } |
ac1cfefa | 617 | if ($proxysettings{'ENABLE_BLUE'} eq 'on') { |
d56fc335 MT |
618 | system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue"); |
619 | system ('/usr/local/bin/squidctrl', 'enable'); } | |
6c689591 | 620 | if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on' && $proxysettings{'ENABLE_BLUE'} eq 'on') { |
9833e7d8 | 621 | system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); } |
ed38f89d | 622 | |
d56fc335 | 623 | if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/squidctrl restart >/dev/null 2>&1'); } |
c4b12981 | 624 | if ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'}) { system('/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1'); } |
fe1656d2 | 625 | } |
ac1cfefa MT |
626 | } |
627 | ||
363fb6af | 628 | if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy clear cache'}) |
ac1cfefa | 629 | { |
d56fc335 | 630 | system('/usr/local/bin/squidctrl flush >/dev/null 2>&1'); |
ac1cfefa MT |
631 | } |
632 | ||
ed38f89d MT |
633 | if (!$errormessage) |
634 | { | |
635 | if (-e "${General::swroot}/proxy/advanced/settings") { | |
636 | &General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings); | |
637 | } elsif (-e "${General::swroot}/proxy/settings") { | |
638 | &General::readhash("${General::swroot}/proxy/settings", \%proxysettings); | |
639 | } | |
640 | &read_acls; | |
641 | } | |
ac1cfefa | 642 | |
dfee7582 SS |
643 | # ------------------------------------------------------------------ |
644 | ||
645 | # Hook to regenerate the configuration files, if cgi got called from command line. | |
646 | if ($ENV{"REMOTE_ADDR"} eq "") { | |
647 | writeconfig(); | |
648 | exit(0); | |
649 | } | |
650 | ||
651 | # ------------------------------------------------------------------- | |
652 | ||
ac1cfefa MT |
653 | $checked{'ENABLE'}{'off'} = ''; |
654 | $checked{'ENABLE'}{'on'} = ''; | |
655 | $checked{'ENABLE'}{$proxysettings{'ENABLE'}} = "checked='checked'"; | |
656 | ||
657 | $checked{'TRANSPARENT'}{'off'} = ''; | |
658 | $checked{'TRANSPARENT'}{'on'} = ''; | |
659 | $checked{'TRANSPARENT'}{$proxysettings{'TRANSPARENT'}} = "checked='checked'"; | |
660 | ||
661 | $checked{'ENABLE_BLUE'}{'off'} = ''; | |
662 | $checked{'ENABLE_BLUE'}{'on'} = ''; | |
663 | $checked{'ENABLE_BLUE'}{$proxysettings{'ENABLE_BLUE'}} = "checked='checked'"; | |
664 | ||
665 | $checked{'TRANSPARENT_BLUE'}{'off'} = ''; | |
666 | $checked{'TRANSPARENT_BLUE'}{'on'} = ''; | |
667 | $checked{'TRANSPARENT_BLUE'}{$proxysettings{'TRANSPARENT_BLUE'}} = "checked='checked'"; | |
668 | ||
363fb6af MT |
669 | $checked{'SUPPRESS_VERSION'}{'off'} = ''; |
670 | $checked{'SUPPRESS_VERSION'}{'on'} = ''; | |
671 | $checked{'SUPPRESS_VERSION'}{$proxysettings{'SUPPRESS_VERSION'}} = "checked='checked'"; | |
672 | ||
ed38f89d MT |
673 | $checked{'FORWARD_IPADDRESS'}{'off'} = ''; |
674 | $checked{'FORWARD_IPADDRESS'}{'on'} = ''; | |
675 | $checked{'FORWARD_IPADDRESS'}{$proxysettings{'FORWARD_IPADDRESS'}} = "checked='checked'"; | |
676 | $checked{'FORWARD_USERNAME'}{'off'} = ''; | |
677 | $checked{'FORWARD_USERNAME'}{'on'} = ''; | |
678 | $checked{'FORWARD_USERNAME'}{$proxysettings{'FORWARD_USERNAME'}} = "checked='checked'"; | |
679 | $checked{'FORWARD_VIA'}{'off'} = ''; | |
680 | $checked{'FORWARD_VIA'}{'on'} = ''; | |
681 | $checked{'FORWARD_VIA'}{$proxysettings{'FORWARD_VIA'}} = "checked='checked'"; | |
363fb6af MT |
682 | $checked{'NO_CONNECTION_AUTH'}{'off'} = ''; |
683 | $checked{'NO_CONNECTION_AUTH'}{'on'} = ''; | |
684 | $checked{'NO_CONNECTION_AUTH'}{$proxysettings{'NO_CONNECTION_AUTH'}} = "checked='checked'"; | |
ed38f89d MT |
685 | |
686 | $selected{'MEM_POLICY'}{$proxysettings{'MEM_POLICY'}} = "selected='selected'"; | |
687 | $selected{'CACHE_POLICY'}{$proxysettings{'CACHE_POLICY'}} = "selected='selected'"; | |
688 | $selected{'L1_DIRS'}{$proxysettings{'L1_DIRS'}} = "selected='selected'"; | |
689 | $checked{'OFFLINE_MODE'}{'off'} = ''; | |
690 | $checked{'OFFLINE_MODE'}{'on'} = ''; | |
691 | $checked{'OFFLINE_MODE'}{$proxysettings{'OFFLINE_MODE'}} = "checked='checked'"; | |
6bea848d JB |
692 | $checked{'CACHE_DIGESTS'}{'off'} = ''; |
693 | $checked{'CACHE_DIGESTS'}{'on'} = ''; | |
694 | $checked{'CACHE_DIGESTS'}{$proxysettings{'CACHE_DIGESTS'}} = "checked='checked'"; | |
ed38f89d | 695 | |
ac1cfefa MT |
696 | $checked{'LOGGING'}{'off'} = ''; |
697 | $checked{'LOGGING'}{'on'} = ''; | |
698 | $checked{'LOGGING'}{$proxysettings{'LOGGING'}} = "checked='checked'"; | |
fe1656d2 CS |
699 | $checked{'CACHEMGR'}{'off'} = ''; |
700 | $checked{'CACHEMGR'}{'on'} = ''; | |
701 | $checked{'CACHEMGR'}{$proxysettings{'CACHEMGR'}} = "checked='checked'"; | |
ed38f89d MT |
702 | $checked{'LOGQUERY'}{'off'} = ''; |
703 | $checked{'LOGQUERY'}{'on'} = ''; | |
704 | $checked{'LOGQUERY'}{$proxysettings{'LOGQUERY'}} = "checked='checked'"; | |
705 | $checked{'LOGUSERAGENT'}{'off'} = ''; | |
706 | $checked{'LOGUSERAGENT'}{'on'} = ''; | |
707 | $checked{'LOGUSERAGENT'}{$proxysettings{'LOGUSERAGENT'}} = "checked='checked'"; | |
708 | ||
709 | $selected{'ERR_LANGUAGE'}{$proxysettings{'ERR_LANGUAGE'}} = "selected='selected'"; | |
363fb6af | 710 | $selected{'ERR_DESIGN'}{$proxysettings{'ERR_DESIGN'}} = "selected='selected'"; |
ed38f89d | 711 | |
9fb25b1c MT |
712 | $checked{'NO_PROXY_LOCAL'}{'off'} = ''; |
713 | $checked{'NO_PROXY_LOCAL'}{'on'} = ''; | |
714 | $checked{'NO_PROXY_LOCAL'}{$proxysettings{'NO_PROXY_LOCAL'}} = "checked='checked'"; | |
715 | $checked{'NO_PROXY_LOCAL_BLUE'}{'off'} = ''; | |
716 | $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} = ''; | |
717 | $checked{'NO_PROXY_LOCAL_BLUE'}{$proxysettings{'NO_PROXY_LOCAL_BLUE'}} = "checked='checked'"; | |
718 | ||
ed38f89d MT |
719 | $checked{'CLASSROOM_EXT'}{'off'} = ''; |
720 | $checked{'CLASSROOM_EXT'}{'on'} = ''; | |
721 | $checked{'CLASSROOM_EXT'}{$proxysettings{'CLASSROOM_EXT'}} = "checked='checked'"; | |
722 | ||
723 | $selected{'TIME_ACCESS_MODE'}{$proxysettings{'TIME_ACCESS_MODE'}} = "selected='selected'"; | |
724 | $selected{'TIME_FROM_HOUR'}{$proxysettings{'TIME_FROM_HOUR'}} = "selected='selected'"; | |
725 | $selected{'TIME_FROM_MINUTE'}{$proxysettings{'TIME_FROM_MINUTE'}} = "selected='selected'"; | |
726 | $selected{'TIME_TO_HOUR'}{$proxysettings{'TIME_TO_HOUR'}} = "selected='selected'"; | |
727 | $selected{'TIME_TO_MINUTE'}{$proxysettings{'TIME_TO_MINUTE'}} = "selected='selected'"; | |
728 | ||
729 | $proxysettings{'TIME_MON'} = 'on' unless exists $proxysettings{'TIME_MON'}; | |
730 | $proxysettings{'TIME_TUE'} = 'on' unless exists $proxysettings{'TIME_TUE'}; | |
731 | $proxysettings{'TIME_WED'} = 'on' unless exists $proxysettings{'TIME_WED'}; | |
732 | $proxysettings{'TIME_THU'} = 'on' unless exists $proxysettings{'TIME_THU'}; | |
733 | $proxysettings{'TIME_FRI'} = 'on' unless exists $proxysettings{'TIME_FRI'}; | |
734 | $proxysettings{'TIME_SAT'} = 'on' unless exists $proxysettings{'TIME_SAT'}; | |
735 | $proxysettings{'TIME_SUN'} = 'on' unless exists $proxysettings{'TIME_SUN'}; | |
736 | ||
737 | $checked{'TIME_MON'}{'off'} = ''; | |
738 | $checked{'TIME_MON'}{'on'} = ''; | |
739 | $checked{'TIME_MON'}{$proxysettings{'TIME_MON'}} = "checked='checked'"; | |
740 | $checked{'TIME_TUE'}{'off'} = ''; | |
741 | $checked{'TIME_TUE'}{'on'} = ''; | |
742 | $checked{'TIME_TUE'}{$proxysettings{'TIME_TUE'}} = "checked='checked'"; | |
743 | $checked{'TIME_WED'}{'off'} = ''; | |
744 | $checked{'TIME_WED'}{'on'} = ''; | |
745 | $checked{'TIME_WED'}{$proxysettings{'TIME_WED'}} = "checked='checked'"; | |
746 | $checked{'TIME_THU'}{'off'} = ''; | |
747 | $checked{'TIME_THU'}{'on'} = ''; | |
748 | $checked{'TIME_THU'}{$proxysettings{'TIME_THU'}} = "checked='checked'"; | |
749 | $checked{'TIME_FRI'}{'off'} = ''; | |
750 | $checked{'TIME_FRI'}{'on'} = ''; | |
751 | $checked{'TIME_FRI'}{$proxysettings{'TIME_FRI'}} = "checked='checked'"; | |
752 | $checked{'TIME_SAT'}{'off'} = ''; | |
753 | $checked{'TIME_SAT'}{'on'} = ''; | |
754 | $checked{'TIME_SAT'}{$proxysettings{'TIME_SAT'}} = "checked='checked'"; | |
755 | $checked{'TIME_SUN'}{'off'} = ''; | |
756 | $checked{'TIME_SUN'}{'on'} = ''; | |
757 | $checked{'TIME_SUN'}{$proxysettings{'TIME_SUN'}} = "checked='checked'"; | |
758 | ||
759 | $selected{'THROTTLING_GREEN_TOTAL'}{$proxysettings{'THROTTLING_GREEN_TOTAL'}} = "selected='selected'"; | |
760 | $selected{'THROTTLING_GREEN_HOST'}{$proxysettings{'THROTTLING_GREEN_HOST'}} = "selected='selected'"; | |
761 | $selected{'THROTTLING_BLUE_TOTAL'}{$proxysettings{'THROTTLING_BLUE_TOTAL'}} = "selected='selected'"; | |
762 | $selected{'THROTTLING_BLUE_HOST'}{$proxysettings{'THROTTLING_BLUE_HOST'}} = "selected='selected'"; | |
763 | ||
ed38f89d MT |
764 | $checked{'ENABLE_MIME_FILTER'}{'off'} = ''; |
765 | $checked{'ENABLE_MIME_FILTER'}{'on'} = ''; | |
766 | $checked{'ENABLE_MIME_FILTER'}{$proxysettings{'ENABLE_MIME_FILTER'}} = "checked='checked'"; | |
767 | ||
ed38f89d MT |
768 | $checked{'AUTH_METHOD'}{'none'} = ''; |
769 | $checked{'AUTH_METHOD'}{'ncsa'} = ''; | |
770 | $checked{'AUTH_METHOD'}{'ident'} = ''; | |
771 | $checked{'AUTH_METHOD'}{'ldap'} = ''; | |
603248db | 772 | $checked{'AUTH_METHOD'}{'ntlm-auth'} = ''; |
ed38f89d MT |
773 | $checked{'AUTH_METHOD'}{'radius'} = ''; |
774 | $checked{'AUTH_METHOD'}{$proxysettings{'AUTH_METHOD'}} = "checked='checked'"; | |
ac1cfefa | 775 | |
ed38f89d MT |
776 | $proxysettings{'AUTH_ALWAYS_REQUIRED'} = 'on' unless exists $proxysettings{'AUTH_ALWAYS_REQUIRED'}; |
777 | ||
778 | $checked{'AUTH_ALWAYS_REQUIRED'}{'off'} = ''; | |
779 | $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} = ''; | |
780 | $checked{'AUTH_ALWAYS_REQUIRED'}{$proxysettings{'AUTH_ALWAYS_REQUIRED'}} = "checked='checked'"; | |
781 | ||
782 | $checked{'NCSA_BYPASS_REDIR'}{'off'} = ''; | |
783 | $checked{'NCSA_BYPASS_REDIR'}{'on'} = ''; | |
784 | $checked{'NCSA_BYPASS_REDIR'}{$proxysettings{'NCSA_BYPASS_REDIR'}} = "checked='checked'"; | |
785 | ||
786 | $selected{'NCSA_GROUP'}{$proxysettings{'NCSA_GROUP'}} = "selected='selected'"; | |
787 | ||
788 | $selected{'LDAP_TYPE'}{$proxysettings{'LDAP_TYPE'}} = "selected='selected'"; | |
789 | ||
790 | $proxysettings{'NTLM_ENABLE_INT_AUTH'} = 'on' unless exists $proxysettings{'NTLM_ENABLE_INT_AUTH'}; | |
791 | ||
792 | $checked{'NTLM_ENABLE_INT_AUTH'}{'off'} = ''; | |
793 | $checked{'NTLM_ENABLE_INT_AUTH'}{'on'} = ''; | |
794 | $checked{'NTLM_ENABLE_INT_AUTH'}{$proxysettings{'NTLM_ENABLE_INT_AUTH'}} = "checked='checked'"; | |
795 | ||
796 | $checked{'NTLM_ENABLE_ACL'}{'off'} = ''; | |
797 | $checked{'NTLM_ENABLE_ACL'}{'on'} = ''; | |
798 | $checked{'NTLM_ENABLE_ACL'}{$proxysettings{'NTLM_ENABLE_ACL'}} = "checked='checked'"; | |
799 | ||
800 | $checked{'NTLM_USER_ACL'}{'positive'} = ''; | |
801 | $checked{'NTLM_USER_ACL'}{'negative'} = ''; | |
802 | $checked{'NTLM_USER_ACL'}{$proxysettings{'NTLM_USER_ACL'}} = "checked='checked'"; | |
803 | ||
2fc5124b MT |
804 | $checked{'NTLM_AUTH_BASIC'}{'on'} = ''; |
805 | $checked{'NTLM_AUTH_BASIC'}{'off'} = ''; | |
806 | $checked{'NTLM_AUTH_BASIC'}{$proxysettings{'NTLM_AUTH_BASIC'}} = "checked='checked'"; | |
807 | ||
ed38f89d MT |
808 | $checked{'RADIUS_ENABLE_ACL'}{'off'} = ''; |
809 | $checked{'RADIUS_ENABLE_ACL'}{'on'} = ''; | |
810 | $checked{'RADIUS_ENABLE_ACL'}{$proxysettings{'RADIUS_ENABLE_ACL'}} = "checked='checked'"; | |
811 | ||
812 | $checked{'RADIUS_USER_ACL'}{'positive'} = ''; | |
813 | $checked{'RADIUS_USER_ACL'}{'negative'} = ''; | |
814 | $checked{'RADIUS_USER_ACL'}{$proxysettings{'RADIUS_USER_ACL'}} = "checked='checked'"; | |
815 | ||
816 | $checked{'IDENT_REQUIRED'}{'off'} = ''; | |
817 | $checked{'IDENT_REQUIRED'}{'on'} = ''; | |
818 | $checked{'IDENT_REQUIRED'}{$proxysettings{'IDENT_REQUIRED'}} = "checked='checked'"; | |
819 | ||
820 | $checked{'IDENT_ENABLE_ACL'}{'off'} = ''; | |
821 | $checked{'IDENT_ENABLE_ACL'}{'on'} = ''; | |
822 | $checked{'IDENT_ENABLE_ACL'}{$proxysettings{'IDENT_ENABLE_ACL'}} = "checked='checked'"; | |
823 | ||
824 | $checked{'IDENT_USER_ACL'}{'positive'} = ''; | |
825 | $checked{'IDENT_USER_ACL'}{'negative'} = ''; | |
826 | $checked{'IDENT_USER_ACL'}{$proxysettings{'IDENT_USER_ACL'}} = "checked='checked'"; | |
827 | ||
9fb25b1c MT |
828 | $checked{'ENABLE_FILTER'}{'off'} = ''; |
829 | $checked{'ENABLE_FILTER'}{'on'} = ''; | |
830 | $checked{'ENABLE_FILTER'}{$proxysettings{'ENABLE_FILTER'}} = "checked='checked'"; | |
ed38f89d | 831 | |
9fb25b1c MT |
832 | $checked{'ENABLE_UPDXLRATOR'}{'off'} = ''; |
833 | $checked{'ENABLE_UPDXLRATOR'}{'on'} = ''; | |
834 | $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'"; | |
ed38f89d | 835 | |
d12aede7 CS |
836 | $checked{'ENABLE_CLAMAV'}{'off'} = ''; |
837 | $checked{'ENABLE_CLAMAV'}{'on'} = ''; | |
838 | $checked{'ENABLE_CLAMAV'}{$proxysettings{'ENABLE_CLAMAV'}} = "checked='checked'"; | |
839 | ||
ed38f89d | 840 | &Header::openpage($Lang::tr{'advproxy advanced web proxy configuration'}, 1, ''); |
ac1cfefa MT |
841 | |
842 | &Header::openbigbox('100%', 'left', '', $errormessage); | |
843 | ||
844 | if ($errormessage) { | |
845 | &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); | |
846 | print "<font class='base'>$errormessage </font>\n"; | |
847 | &Header::closebox(); | |
848 | } | |
849 | ||
363fb6af MT |
850 | if ($squidversion[0] =~ /^Squid\sCache:\sVersion\s/i) |
851 | { | |
852 | $squidversion[0] =~ s/^Squid\sCache:\sVersion//i; | |
853 | $squidversion[0] =~ s/^\s+//g; | |
854 | $squidversion[0] =~ s/\s+$//g; | |
855 | } else { | |
856 | $squidversion[0] = $Lang::tr{'advproxy unknown'}; | |
857 | } | |
858 | ||
ed38f89d MT |
859 | # =================================================================== |
860 | # Main settings | |
861 | # =================================================================== | |
862 | ||
863 | unless ($proxysettings{'NCSA_EDIT_MODE'} eq 'yes') { | |
864 | ||
ac1cfefa MT |
865 | print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n"; |
866 | ||
ed38f89d MT |
867 | &Header::openbox('100%', 'left', "$Lang::tr{'advproxy advanced web proxy'}"); |
868 | ||
ac1cfefa MT |
869 | print <<END |
870 | <table width='100%'> | |
871 | <tr> | |
ed38f89d MT |
872 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy common settings'}</b></td> |
873 | </tr> | |
874 | <tr> | |
875 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled on'} <font color="$Header::colourgreen">Green</font>:</td> | |
876 | <td width='20%'><input type='checkbox' name='ENABLE' $checked{'ENABLE'}{'on'} /></td> | |
e3edceeb | 877 | <td width='25%' class='base'>$Lang::tr{'advproxy proxy port'}: <img src='/blob.gif' alt='*' /></td> |
ed38f89d | 878 | <td width='30%'><input type='text' name='PROXY_PORT' value='$proxysettings{'PROXY_PORT'}' size='5' /></td> |
ac1cfefa MT |
879 | </tr> |
880 | <tr> | |
ed38f89d | 881 | <td class='base'>$Lang::tr{'advproxy transparent on'} <font color="$Header::colourgreen">Green</font>:</td> |
ac1cfefa | 882 | <td><input type='checkbox' name='TRANSPARENT' $checked{'TRANSPARENT'}{'on'} /></td> |
e3edceeb | 883 | <td width='25%' class='base'>$Lang::tr{'advproxy proxy port transparent'}: <img src='/blob.gif' alt='*' /></td> |
0f6b6067 | 884 | <td width='30%'><input type='text' name='TRANSPARENT_PORT' value='$proxysettings{'TRANSPARENT_PORT'}' size='5' /></td> |
ac1cfefa MT |
885 | </tr> |
886 | <tr> | |
887 | END | |
888 | ; | |
889 | if ($netsettings{'BLUE_DEV'}) { | |
ed38f89d | 890 | print "<td class='base'>$Lang::tr{'advproxy enabled on'} <font color='$Header::colourblue'>Blue</font>:</td>"; |
ac1cfefa MT |
891 | print "<td><input type='checkbox' name='ENABLE_BLUE' $checked{'ENABLE_BLUE'}{'on'} /></td>"; |
892 | } else { | |
893 | print "<td colspan='2'> </td>"; | |
894 | } | |
895 | print <<END | |
e3edceeb | 896 | <td class='base'>$Lang::tr{'advproxy visible hostname'}:</td> |
0f6b6067 | 897 | <td><input type='text' name='VISIBLE_HOSTNAME' value='$proxysettings{'VISIBLE_HOSTNAME'}' /></td> |
ac1cfefa MT |
898 | </tr> |
899 | <tr> | |
900 | END | |
901 | ; | |
902 | if ($netsettings{'BLUE_DEV'}) { | |
ed38f89d | 903 | print "<td class='base'>$Lang::tr{'advproxy transparent on'} <font color='$Header::colourblue'>Blue</font>:</td>"; |
ac1cfefa MT |
904 | print "<td><input type='checkbox' name='TRANSPARENT_BLUE' $checked{'TRANSPARENT_BLUE'}{'on'} /></td>"; |
905 | } else { | |
906 | print "<td colspan='2'> </td>"; | |
907 | } | |
908 | print <<END | |
ed38f89d MT |
909 | <td class='base'>$Lang::tr{'advproxy error language'}:</td> |
910 | <td class='base'> | |
911 | <select name='ERR_LANGUAGE'> | |
912 | END | |
913 | ; | |
363fb6af | 914 | foreach (<$errordir/*>) { |
ed38f89d MT |
915 | if (-d) { |
916 | $language = substr($_,rindex($_,"/")+1); | |
917 | print "<option value='$language' $selected{'ERR_LANGUAGE'}{$language}>$language</option>\n"; | |
918 | } | |
919 | } | |
920 | print <<END | |
921 | </select> | |
922 | </td> | |
923 | </tr> | |
10e4f239 | 924 | <tr> |
363fb6af MT |
925 | <td class='base'>$Lang::tr{'advproxy suppress version'}:</td> |
926 | <td><input type='checkbox' name='SUPPRESS_VERSION' $checked{'SUPPRESS_VERSION'}{'on'} /></td> | |
927 | <td class='base'>$Lang::tr{'advproxy error design'}:</td> | |
928 | <td class='base'><select name='ERR_DESIGN'> | |
0d948999 | 929 | <option value='ipfire' $selected{'ERR_DESIGN'}{'ipfire'}>IPFire</option> |
363fb6af MT |
930 | <option value='squid' $selected{'ERR_DESIGN'}{'squid'}>$Lang::tr{'advproxy standard'}</option> |
931 | </select></td> | |
10e4f239 MT |
932 | </tr> |
933 | <tr> | |
363fb6af MT |
934 | <td class='base'>$Lang::tr{'advproxy squid version'}:</td> |
935 | <td class='base'> [<font color='$Header::colourred'> $squidversion[0] </font>]</td> | |
936 | <td> </td> | |
937 | <td> </td> | |
10e4f239 | 938 | </tr> |
ed38f89d MT |
939 | </table> |
940 | <hr size='1'> | |
941 | <table width='100%'> | |
d12aede7 CS |
942 | END |
943 | ; | |
944 | if ( -e "/usr/bin/squidclamav" ) { | |
01212e04 | 945 | print "<td class='base'><b>".$Lang::tr{'advproxy squidclamav'}."</b><br />"; |
bd027d94 CS |
946 | if ( ! -e "/var/run/clamav/clamd.pid" ){ |
947 | print "<font color='red'>clamav not running</font><br /><br />"; | |
948 | $proxysettings{'ENABLE_CLAMAV'} = 'off'; | |
949 | } | |
950 | else { | |
951 | print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_CLAMAV' ".$checked{'ENABLE_CLAMAV'}{'on'}." /><br />"; | |
1a3323f2 | 952 | } |
01212e04 CS |
953 | print "</td>"; |
954 | } else { | |
955 | print "<td></td>"; | |
d12aede7 | 956 | } |
082771c1 | 957 | print "<td class='base'><a href='/cgi-bin/urlfilter.cgi'><b>".$Lang::tr{'advproxy url filter'}."</a></b><br />"; |
01212e04 | 958 | print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_FILTER' ".$checked{'ENABLE_FILTER'}{'on'}." /><br />"; |
01212e04 | 959 | print "</td>"; |
082771c1 | 960 | print "<td class='base'><a href='/cgi-bin/updatexlrator.cgi'><b>".$Lang::tr{'advproxy update accelerator'}."</a></b><br />"; |
01212e04 | 961 | print $Lang::tr{'advproxy enabled'}."<input type='checkbox' name='ENABLE_UPDXLRATOR' ".$checked{'ENABLE_UPDXLRATOR'}{'on'}." /><br />"; |
01212e04 | 962 | print "</td></tr>"; |
d12aede7 | 963 | print <<END |
9141bd34 CS |
964 | </table> |
965 | <hr size='1'> | |
966 | <table width='100%'> | |
ed38f89d MT |
967 | <tr> |
968 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy upstream proxy'}</b></td> | |
969 | </tr> | |
970 | <tr> | |
488d1b7c CS |
971 | <td width='25%' class='base'>$Lang::tr{'advproxy via forwarding'}:</td> |
972 | <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td> | |
e3edceeb | 973 | <td width='25%' class='base'>$Lang::tr{'advproxy upstream proxy host:port'}:</td> |
488d1b7c | 974 | <td width='30%'><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td> |
ed38f89d MT |
975 | </tr> |
976 | <tr> | |
488d1b7c CS |
977 | <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td> |
978 | <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td> | |
e3edceeb | 979 | <td class='base'>$Lang::tr{'advproxy upstream username'}:</td> |
488d1b7c | 980 | <td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td> |
ac1cfefa | 981 | </tr> |
ac1cfefa | 982 | <tr> |
488d1b7c CS |
983 | <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td> |
984 | <td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} /></td> | |
e3edceeb | 985 | <td class='base'>$Lang::tr{'advproxy upstream password'}:</td> |
488d1b7c | 986 | <td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td> |
ed38f89d | 987 | </tr> |
363fb6af | 988 | <tr> |
488d1b7c CS |
989 | <td class='base'>$Lang::tr{'advproxy no connection auth'}:</td> |
990 | <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td> | |
991 | <td> </td> | |
992 | <td> </td> | |
363fb6af | 993 | </tr> |
ed38f89d MT |
994 | </table> |
995 | <hr size='1'> | |
996 | <table width='100%'> | |
997 | <tr> | |
998 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy log settings'}</b></td> | |
999 | </tr> | |
1000 | <tr> | |
488d1b7c CS |
1001 | <td width='25%' class='base'>$Lang::tr{'advproxy log enabled'}:</td> |
1002 | <td width='20%'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td> | |
1003 | <td width='25%'class='base'>$Lang::tr{'advproxy log query'}:</td> | |
1004 | <td width='30%'><input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td> | |
1005 | </tr> | |
1006 | <tr> | |
1007 | <td> </td> | |
1008 | <td> </td> | |
1009 | <td class='base'>$Lang::tr{'advproxy log useragent'}:</td> | |
1010 | <td><input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td> | |
ed38f89d MT |
1011 | </tr> |
1012 | </table> | |
1013 | <hr size='1'> | |
1014 | <table width='100%'> | |
1015 | <tr> | |
1016 | <td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td> | |
1017 | </tr> | |
fe1656d2 | 1018 | <tr> |
c4b12981 | 1019 | <td class='base'><a href='/cgi-bin/cachemgr.cgi' target='_blank'>$Lang::tr{'proxy cachemgr'}:</td> |
fe1656d2 | 1020 | <td><input type='checkbox' name='CACHEMGR' $checked{'CACHEMGR'}{'on'} /></td> |
e3edceeb | 1021 | <td class='base'>$Lang::tr{'advproxy admin mail'}:</td> |
fe1656d2 CS |
1022 | <td><input type='text' name='ADMIN_MAIL_ADDRESS' value='$proxysettings{'ADMIN_MAIL_ADDRESS'}' /></td> |
1023 | </tr> | |
1024 | <tr> | |
e3edceeb | 1025 | <td class='base'>$Lang::tr{'proxy filedescriptors'}: <img src='/blob.gif' alt='*' /></td> |
fe1656d2 | 1026 | <td><input type='text' name='FILEDESCRIPTORS' value='$proxysettings{'FILEDESCRIPTORS'}' size='5' /></td> |
e3edceeb | 1027 | <td class='base'>$Lang::tr{'proxy admin password'}:</td> |
fe1656d2 CS |
1028 | <td><input type='text' name='ADMIN_PASSWORD' value='$proxysettings{'ADMIN_PASSWORD'}' /></td> |
1029 | </tr> | |
ed38f89d | 1030 | <tr> |
488d1b7c | 1031 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> |
ac1cfefa MT |
1032 | </tr> |
1033 | <tr> | |
e3edceeb | 1034 | <td class='base'>$Lang::tr{'advproxy ram cache size'}: <img src='/blob.gif' alt='*' /></td> |
ed38f89d | 1035 | <td><input type='text' name='CACHE_MEM' value='$proxysettings{'CACHE_MEM'}' size='5' /></td> |
e3edceeb | 1036 | <td class='base'>$Lang::tr{'advproxy hdd cache size'}: <img src='/blob.gif' alt='*' /></td> |
ac1cfefa MT |
1037 | <td><input type='text' name='CACHE_SIZE' value='$proxysettings{'CACHE_SIZE'}' size='5' /></td> |
1038 | </tr> | |
1039 | <tr> | |
e3edceeb | 1040 | <td class='base'>$Lang::tr{'advproxy min size'}: <img src='/blob.gif' alt='*' /></td> |
ac1cfefa | 1041 | <td><input type='text' name='MIN_SIZE' value='$proxysettings{'MIN_SIZE'}' size='5' /></td> |
e3edceeb | 1042 | <td class='base'>$Lang::tr{'advproxy max size'}: <img src='/blob.gif' alt='*' /></td> |
ac1cfefa MT |
1043 | <td><input type='text' name='MAX_SIZE' value='$proxysettings{'MAX_SIZE'}' size='5' /></td> |
1044 | </tr> | |
1045 | <tr> | |
ed38f89d | 1046 | <td class='base'>$Lang::tr{'advproxy number of L1 dirs'}:</td> |
363fb6af MT |
1047 | <td class='base'><select name='L1_DIRS'> |
1048 | <option value='16' $selected{'L1_DIRS'}{'16'}>16</option> | |
1049 | <option value='32' $selected{'L1_DIRS'}{'32'}>32</option> | |
1050 | <option value='64' $selected{'L1_DIRS'}{'64'}>64</option> | |
1051 | <option value='128' $selected{'L1_DIRS'}{'128'}>128</option> | |
1052 | <option value='256' $selected{'L1_DIRS'}{'256'}>256</option> | |
1053 | </select></td> | |
ed38f89d | 1054 | <td colspan='2' rowspan= '5' valign='top' class='base'> |
363fb6af | 1055 | <table cellspacing='0' cellpadding='0'> |
ed38f89d MT |
1056 | <tr> |
1057 | <!-- intentionally left empty --> | |
1058 | </tr> | |
1059 | <tr> | |
e3edceeb | 1060 | <td>$Lang::tr{'advproxy no cache sites'}:</td> |
ed38f89d MT |
1061 | </tr> |
1062 | <tr> | |
1063 | <!-- intentionally left empty --> | |
1064 | </tr> | |
1065 | <tr> | |
1066 | <!-- intentionally left empty --> | |
1067 | </tr> | |
1068 | <tr> | |
488d1b7c | 1069 | <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1070 | END |
1071 | ; | |
1072 | ||
1073 | print $proxysettings{'DST_NOCACHE'}; | |
1074 | ||
1075 | print <<END | |
1076 | </textarea></td> | |
1077 | </tr> | |
1078 | </table> | |
1079 | </td> | |
1080 | </tr> | |
1081 | <tr> | |
363fb6af MT |
1082 | <td class='base'>$Lang::tr{'advproxy memory replacement policy'}:</td> |
1083 | <td class='base'><select name='MEM_POLICY'> | |
1084 | <option value='LRU' $selected{'MEM_POLICY'}{'LRU'}>LRU</option> | |
1085 | <option value='heap LFUDA' $selected{'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option> | |
1086 | <option value='heap GDSF' $selected{'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option> | |
1087 | <option value='heap LRU' $selected{'MEM_POLICY'}{'heap LRU'}>heap LRU</option> | |
1088 | </select></td> | |
ed38f89d MT |
1089 | </tr> |
1090 | <tr> | |
363fb6af MT |
1091 | <td class='base'>$Lang::tr{'advproxy cache replacement policy'}:</td> |
1092 | <td class='base'><select name='CACHE_POLICY'> | |
1093 | <option value='LRU' $selected{'CACHE_POLICY'}{'LRU'}>LRU</option> | |
1094 | <option value='heap LFUDA' $selected{'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option> | |
1095 | <option value='heap GDSF' $selected{'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option> | |
1096 | <option value='heap LRU' $selected{'CACHE_POLICY'}{'heap LRU'}>heap LRU</option> | |
1097 | </select></td> | |
ed38f89d MT |
1098 | </tr> |
1099 | <tr> | |
1100 | <td colspan='2'> </td> | |
1101 | </tr> | |
1102 | <tr> | |
363fb6af | 1103 | <td class='base'>$Lang::tr{'advproxy offline mode'}:</td> |
ed38f89d MT |
1104 | <td><input type='checkbox' name='OFFLINE_MODE' $checked{'OFFLINE_MODE'}{'on'} /></td> |
1105 | </tr> | |
6bea848d JB |
1106 | <tr> |
1107 | <td class='base'>$Lang::tr{'advproxy cache-digest'}:</td> | |
1108 | <td><input type='checkbox' name='CACHE_DIGESTS' $checked{'CACHE_DIGESTS'}{'on'} /></td> | |
1109 | </tr> | |
ed38f89d MT |
1110 | </table> |
1111 | <hr size='1'> | |
1112 | <table width='100%'> | |
363fb6af MT |
1113 | <tr> |
1114 | <td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td> | |
1115 | </tr> | |
1116 | <tr> | |
631b67b7 | 1117 | <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td> |
363fb6af MT |
1118 | </tr> |
1119 | <tr> | |
e3edceeb LS |
1120 | <td colspan='2' class='base'>$Lang::tr{'advproxy standard ports'}: <img src='/blob.gif' alt='*' /></td> |
1121 | <td colspan='2' class='base'>$Lang::tr{'advproxy ssl ports'}: <img src='/blob.gif' alt='*' /></td> | |
363fb6af MT |
1122 | </tr> |
1123 | <tr> | |
1124 | <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'> | |
1125 | END | |
1126 | ; | |
1127 | if (!$proxysettings{'PORTS_SAFE'}) { print $def_ports_safe; } else { print $proxysettings{'PORTS_SAFE'}; } | |
1128 | ||
1129 | print <<END | |
1130 | </textarea></td> | |
1131 | <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'> | |
1132 | END | |
1133 | ; | |
1134 | if (!$proxysettings{'PORTS_SSL'}) { print $def_ports_ssl; } else { print $proxysettings{'PORTS_SSL'}; } | |
1135 | ||
1136 | print <<END | |
1137 | </textarea></td> | |
1138 | </tr> | |
1139 | </table> | |
1140 | <hr size='1'> | |
1141 | <table width='100%'> | |
ed38f89d MT |
1142 | <tr> |
1143 | <td colspan='4'><b>$Lang::tr{'advproxy network based access'}</b></td> | |
1144 | </tr> | |
1145 | <tr> | |
1146 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1147 | </tr> | |
1148 | <tr> | |
e3edceeb | 1149 | <td colspan='4' class='base'>$Lang::tr{'advproxy allowed subnets'}: <img src='/blob.gif' alt='*' /></td> |
ed38f89d MT |
1150 | </tr> |
1151 | <tr> | |
9141bd34 | 1152 | <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1153 | END |
1154 | ; | |
1155 | ||
363fb6af MT |
1156 | if (!$proxysettings{'SRC_SUBNETS'}) |
1157 | { | |
f09a0af5 | 1158 | print "$green_cidr\n"; |
363fb6af MT |
1159 | if ($netsettings{'BLUE_DEV'}) |
1160 | { | |
f09a0af5 | 1161 | print "$blue_cidr\n"; |
ed38f89d | 1162 | } |
363fb6af | 1163 | } else { print $proxysettings{'SRC_SUBNETS'}; } |
ed38f89d MT |
1164 | |
1165 | print <<END | |
1166 | </textarea></td> | |
9fb25b1c MT |
1167 | END |
1168 | ; | |
1169 | ||
1170 | $line = $Lang::tr{'advproxy no internal proxy on green'}; | |
1171 | $line =~ s/Green/<font color="$Header::colourgreen">Green<\/font>/i; | |
1172 | print "<td class='base'>$line:</td>\n"; | |
1173 | print <<END | |
1174 | <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked{'NO_PROXY_LOCAL'}{'on'} /></td> | |
1175 | </tr> | |
1176 | END | |
1177 | ; | |
1178 | if ($netsettings{'BLUE_DEV'}) { | |
1179 | $line = $Lang::tr{'advproxy no internal proxy on blue'}; | |
1180 | $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/font>/i; | |
1181 | print "<tr>\n"; | |
1182 | print "<td class='base'>$line:</td>\n"; | |
1183 | print <<END | |
1184 | <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} /></td> | |
1185 | </tr> | |
1186 | END | |
1187 | ; | |
1188 | } | |
1189 | print <<END | |
1190 | <tr> | |
1191 | <td colspan='2'> </td> | |
1192 | </tr> | |
1193 | <tr> | |
ed38f89d MT |
1194 | <td colspan='2'> </td> |
1195 | </tr> | |
1196 | </table> | |
1197 | <table width='100%'> | |
1198 | <tr> | |
1199 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1200 | </tr> | |
1201 | <tr> | |
e3edceeb LS |
1202 | <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted ip clients'}:</td> |
1203 | <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted mac clients'}:</td> | |
ed38f89d MT |
1204 | </tr> |
1205 | <tr> | |
9141bd34 | 1206 | <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1207 | END |
1208 | ; | |
1209 | ||
1210 | print $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
1211 | ||
1212 | print <<END | |
1213 | </textarea></td> | |
9141bd34 | 1214 | <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1215 | END |
1216 | ; | |
1217 | ||
1218 | print $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
1219 | ||
1220 | print <<END | |
1221 | </textarea></td> | |
1222 | </tr> | |
1223 | </table> | |
1224 | <table width='100%'> | |
1225 | <tr> | |
1226 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1227 | </tr> | |
1228 | <tr> | |
e3edceeb LS |
1229 | <td colspan='2' class='base'>$Lang::tr{'advproxy banned ip clients'}:</td> |
1230 | <td colspan='2' class='base'>$Lang::tr{'advproxy banned mac clients'}:</td> | |
ed38f89d MT |
1231 | </tr> |
1232 | <tr> | |
9141bd34 | 1233 | <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1234 | END |
1235 | ; | |
1236 | ||
1237 | print $proxysettings{'SRC_BANNED_IP'}; | |
1238 | ||
1239 | print <<END | |
1240 | </textarea></td> | |
9141bd34 | 1241 | <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1242 | END |
1243 | ; | |
1244 | ||
1245 | print $proxysettings{'SRC_BANNED_MAC'}; | |
1246 | ||
1247 | print <<END | |
1248 | </textarea></td> | |
1249 | </tr> | |
1250 | </table> | |
1251 | ||
1252 | <hr size='1'> | |
1253 | ||
1254 | END | |
1255 | ; | |
1256 | # ------------------------------------------------------------------- | |
1257 | # CRE GUI - optional | |
1258 | # ------------------------------------------------------------------- | |
1259 | ||
1260 | if (-e $cre_enabled) { print <<END | |
1261 | <table width='100%'> | |
1262 | ||
1263 | <tr> | |
9141bd34 | 1264 | <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> |
ed38f89d MT |
1265 | </tr> |
1266 | <tr> | |
1267 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1268 | </tr> | |
1269 | <tr> | |
9141bd34 CS |
1270 | |
1271 | END | |
1272 | ; | |
1273 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){ | |
1274 | print <<END | |
e3edceeb | 1275 | <td class='base'>$Lang::tr{'advproxy supervisor password'}:</td> |
ed38f89d MT |
1276 | <td><input type='password' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' size='12' /></td> |
1277 | </tr> | |
1278 | <tr> | |
1279 | <td colspan='2' class='base'>$Lang::tr{'advproxy cre group definitions'}:</td> | |
e3edceeb | 1280 | <td colspan='2' class='base'>$Lang::tr{'advproxy cre supervisors'}:</td> |
9141bd34 CS |
1281 | END |
1282 | ; | |
1283 | } | |
1284 | print "</tr>"; | |
1285 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){ | |
1286 | print <<END | |
ed38f89d MT |
1287 | <tr> |
1288 | <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'> | |
1289 | END | |
1290 | ; | |
1291 | ||
1292 | print $proxysettings{'CRE_GROUPS'}; | |
1293 | ||
1294 | print <<END | |
1295 | </textarea></td> | |
1296 | <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'> | |
1297 | END | |
1298 | ; | |
1299 | print $proxysettings{'CRE_SVHOSTS'}; | |
1300 | ||
1301 | print <<END | |
1302 | </textarea></td> | |
1303 | </tr> | |
ed38f89d MT |
1304 | END |
1305 | ; | |
9141bd34 CS |
1306 | } |
1307 | print "</table><hr size='1'>"; | |
1308 | ||
ed38f89d MT |
1309 | } else { |
1310 | print <<END | |
1311 | <input type='hidden' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' /> | |
1312 | <input type='hidden' name='CRE_GROUPS' value='$proxysettings{'CRE_GROUPS'}' /> | |
1313 | <input type='hidden' name='CRE_SVHOSTS' value='$proxysettings{'CRE_SVHOSTS'}' /> | |
1314 | END | |
1315 | ; | |
1316 | } | |
363fb6af | 1317 | |
ed38f89d MT |
1318 | # ------------------------------------------------------------------- |
1319 | ||
28c9dec6 | 1320 | print <<END |
ed38f89d MT |
1321 | |
1322 | <table width='100%'> | |
1323 | <tr> | |
363fb6af | 1324 | <td colspan='4'><b>$Lang::tr{'advproxy time restrictions'}</b></td> |
ed38f89d MT |
1325 | </tr> |
1326 | <table width='100%'> | |
1327 | <tr> | |
1328 | <td width='2%'>$Lang::tr{'advproxy access'}</td> | |
1329 | <td width='1%'> </td> | |
1330 | <td width='2%' align='center'>$Lang::tr{'advproxy monday'}</td> | |
1331 | <td width='2%' align='center'>$Lang::tr{'advproxy tuesday'}</td> | |
1332 | <td width='2%' align='center'>$Lang::tr{'advproxy wednesday'}</td> | |
1333 | <td width='2%' align='center'>$Lang::tr{'advproxy thursday'}</td> | |
1334 | <td width='2%' align='center'>$Lang::tr{'advproxy friday'}</td> | |
1335 | <td width='2%' align='center'>$Lang::tr{'advproxy saturday'}</td> | |
1336 | <td width='2%' align='center'>$Lang::tr{'advproxy sunday'}</td> | |
1337 | <td width='1%'> </td> | |
1338 | <td width='7%' colspan=3>$Lang::tr{'advproxy from'}</td> | |
1339 | <td width='1%'> </td> | |
1340 | <td width='7%' colspan=3>$Lang::tr{'advproxy to'}</td> | |
1341 | <td> </td> | |
1342 | </tr> | |
1343 | <tr> | |
1344 | <td class='base'> | |
1345 | <select name='TIME_ACCESS_MODE'> | |
1346 | <option value='allow' $selected{'TIME_ACCESS_MODE'}{'allow'}>$Lang::tr{'advproxy mode allow'}</option> | |
1347 | <option value='deny' $selected{'TIME_ACCESS_MODE'}{'deny'}>$Lang::tr{'advproxy mode deny'}</option> | |
1348 | </select> | |
1349 | </td> | |
1350 | <td> </td> | |
1351 | <td class='base'><input type='checkbox' name='TIME_MON' $checked{'TIME_MON'}{'on'} /></td> | |
1352 | <td class='base'><input type='checkbox' name='TIME_TUE' $checked{'TIME_TUE'}{'on'} /></td> | |
1353 | <td class='base'><input type='checkbox' name='TIME_WED' $checked{'TIME_WED'}{'on'} /></td> | |
1354 | <td class='base'><input type='checkbox' name='TIME_THU' $checked{'TIME_THU'}{'on'} /></td> | |
1355 | <td class='base'><input type='checkbox' name='TIME_FRI' $checked{'TIME_FRI'}{'on'} /></td> | |
1356 | <td class='base'><input type='checkbox' name='TIME_SAT' $checked{'TIME_SAT'}{'on'} /></td> | |
1357 | <td class='base'><input type='checkbox' name='TIME_SUN' $checked{'TIME_SUN'}{'on'} /></td> | |
1358 | <td> </td> | |
1359 | <td class='base'> | |
1360 | <select name='TIME_FROM_HOUR'> | |
1361 | END | |
1362 | ; | |
1363 | for ($i=0;$i<=24;$i++) { | |
1364 | $_ = sprintf("%02s",$i); | |
1365 | print "<option $selected{'TIME_FROM_HOUR'}{$_}>$_</option>\n"; | |
1366 | } | |
1367 | print <<END | |
1368 | </select> | |
1369 | </td> | |
1370 | <td>:</td> | |
1371 | <td class='base'> | |
1372 | <select name='TIME_FROM_MINUTE'> | |
1373 | END | |
1374 | ; | |
1375 | for ($i=0;$i<=45;$i+=15) { | |
1376 | $_ = sprintf("%02s",$i); | |
1377 | print "<option $selected{'TIME_FROM_MINUTE'}{$_}>$_</option>\n"; | |
1378 | } | |
1379 | print <<END | |
1380 | </select> | |
1381 | <td> - </td> | |
1382 | </td> | |
1383 | <td class='base'> | |
1384 | <select name='TIME_TO_HOUR'> | |
1385 | END | |
1386 | ; | |
1387 | for ($i=0;$i<=24;$i++) { | |
1388 | $_ = sprintf("%02s",$i); | |
1389 | print "<option $selected{'TIME_TO_HOUR'}{$_}>$_</option>\n"; | |
1390 | } | |
1391 | print <<END | |
1392 | </select> | |
1393 | </td> | |
1394 | <td>:</td> | |
1395 | <td class='base'> | |
1396 | <select name='TIME_TO_MINUTE'> | |
1397 | END | |
1398 | ; | |
1399 | for ($i=0;$i<=45;$i+=15) { | |
1400 | $_ = sprintf("%02s",$i); | |
1401 | print "<option $selected{'TIME_TO_MINUTE'}{$_}>$_</option>\n"; | |
1402 | } | |
1403 | print <<END | |
1404 | </select> | |
1405 | </td> | |
1406 | </tr> | |
1407 | </table> | |
1408 | <hr size='1'> | |
1409 | <table width='100%'> | |
1410 | <tr> | |
1411 | <td colspan='4'><b>$Lang::tr{'advproxy transfer limits'}</b></td> | |
ac1cfefa MT |
1412 | </tr> |
1413 | <tr> | |
e3edceeb | 1414 | <td width='25%' class='base'>$Lang::tr{'advproxy max download size'}: <img src='/blob.gif' alt='*' /></td> |
ed38f89d | 1415 | <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value='$proxysettings{'MAX_INCOMING_SIZE'}' size='5' /></td> |
e3edceeb | 1416 | <td width='25%' class='base'>$Lang::tr{'advproxy max upload size'}: <img src='/blob.gif' alt='*' /></td> |
ed38f89d | 1417 | <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value='$proxysettings{'MAX_OUTGOING_SIZE'}' size='5' /></td> |
ac1cfefa MT |
1418 | </tr> |
1419 | </table> | |
ed38f89d | 1420 | <hr size='1'> |
ac1cfefa | 1421 | <table width='100%'> |
ac1cfefa | 1422 | <tr> |
ed38f89d MT |
1423 | <td colspan='4'><b>$Lang::tr{'advproxy download throttling'}</b></td> |
1424 | </tr> | |
1425 | <tr> | |
1426 | <td width='25%' class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourgreen">Green</font>:</td> | |
1427 | <td width='20%' class='base'> | |
1428 | <select name='THROTTLING_GREEN_TOTAL'> | |
1429 | END | |
1430 | ; | |
1431 | ||
1432 | foreach (@throttle_limits) { | |
ce1f04ee MT |
1433 | my $val = $_; |
1434 | my $unit = "kbit/s"; | |
1435 | ||
1436 | if ($val >= 1024) { | |
1437 | $unit = "Mbit/s"; | |
1438 | $val /= 1024; | |
1439 | } | |
1440 | ||
1441 | print "\t<option value='$_' $selected{'THROTTLING_GREEN_TOTAL'}{$_}>$val $unit</option>\n"; | |
ed38f89d MT |
1442 | } |
1443 | ||
1444 | print <<END | |
1445 | <option value='0' $selected{'THROTTLING_GREEN_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1446 | </select> | |
1447 | </td> | |
1448 | <td width='25%' class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourgreen">Green</font>:</td> | |
1449 | <td width='30%' class='base'> | |
1450 | <select name='THROTTLING_GREEN_HOST'> | |
1451 | END | |
1452 | ; | |
1453 | ||
1454 | foreach (@throttle_limits) { | |
f00699e8 | 1455 | print "\t<option value='$_' $selected{'THROTTLING_GREEN_HOST'}{$_}>$_ kbit/s</option>\n"; |
ed38f89d MT |
1456 | } |
1457 | ||
1458 | print <<END | |
1459 | <option value='0' $selected{'THROTTLING_GREEN_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1460 | </select> | |
1461 | </td> | |
1462 | </tr> | |
1463 | END | |
1464 | ; | |
1465 | ||
1466 | if ($netsettings{'BLUE_DEV'}) { | |
1467 | print <<END | |
1468 | <tr> | |
1469 | <td class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourblue">Blue</font>:</td> | |
1470 | <td class='base'> | |
1471 | <select name='THROTTLING_BLUE_TOTAL'> | |
1472 | END | |
1473 | ; | |
1474 | ||
1475 | foreach (@throttle_limits) { | |
f00699e8 | 1476 | print "\t<option value='$_' $selected{'THROTTLING_BLUE_TOTAL'}{$_}>$_ kbit/s</option>\n"; |
ed38f89d MT |
1477 | } |
1478 | ||
1479 | print <<END | |
1480 | <option value='0' $selected{'THROTTLING_BLUE_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1481 | </select> | |
1482 | </td> | |
1483 | <td class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourblue">Blue</font>:</td> | |
1484 | <td class='base'> | |
1485 | <select name='THROTTLING_BLUE_HOST'> | |
1486 | END | |
1487 | ; | |
1488 | ||
1489 | foreach (@throttle_limits) { | |
f00699e8 | 1490 | print "\t<option value='$_' $selected{'THROTTLING_BLUE_HOST'}{$_}>$_ kbit/s</option>\n"; |
ed38f89d MT |
1491 | } |
1492 | ||
1493 | print <<END | |
1494 | <option value='0' $selected{'THROTTLING_BLUE_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1495 | </select> | |
ac1cfefa | 1496 | </td> |
ac1cfefa | 1497 | </tr> |
ed38f89d MT |
1498 | END |
1499 | ; | |
1500 | } | |
ac1cfefa | 1501 | |
ed38f89d MT |
1502 | print <<END |
1503 | </table> | |
ed38f89d MT |
1504 | <hr size='1'> |
1505 | <table width='100%'> | |
1506 | <tr> | |
9141bd34 | 1507 | <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> |
ed38f89d | 1508 | </tr> |
9141bd34 CS |
1509 | END |
1510 | ; | |
1511 | if ( $proxysettings{'ENABLE_MIME_FILTER'} eq 'on' ){ | |
1512 | print <<END | |
ed38f89d | 1513 | <tr> |
e3edceeb | 1514 | <td colspan='2' class='base'>$Lang::tr{'advproxy MIME block types'}:</td> |
363fb6af MT |
1515 | <td> </td> |
1516 | <td> </td> | |
ed38f89d MT |
1517 | </tr> |
1518 | <tr> | |
1519 | <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'> | |
ac1cfefa MT |
1520 | END |
1521 | ; | |
ac1cfefa | 1522 | |
ed38f89d | 1523 | print $proxysettings{'MIME_TYPES'}; |
ac1cfefa | 1524 | |
ed38f89d MT |
1525 | print <<END |
1526 | </textarea></td> | |
363fb6af MT |
1527 | <td> </td> |
1528 | <td> </td> | |
ed38f89d | 1529 | </tr> |
9141bd34 CS |
1530 | END |
1531 | ; | |
1532 | } | |
1533 | print <<END | |
ed38f89d | 1534 | </table> |
9141bd34 | 1535 | |
ed38f89d | 1536 | <hr size='1'> |
ac1cfefa | 1537 | |
ed38f89d MT |
1538 | <table width='100%'> |
1539 | <tr> | |
1540 | <td><b>$Lang::tr{'advproxy privacy'}</b></td> | |
1541 | </tr> | |
1542 | <tr> | |
e3edceeb LS |
1543 | <td class='base'>$Lang::tr{'advproxy fake useragent'}:</td> |
1544 | <td class='base'>$Lang::tr{'advproxy fake referer'}:</td> | |
ed38f89d MT |
1545 | </tr> |
1546 | <tr> | |
73cb6627 AM |
1547 | <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='40%' /></td> |
1548 | <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='40%' /></td> | |
ed38f89d MT |
1549 | </tr> |
1550 | </table> | |
1551 | <hr size='1'> | |
1552 | END | |
1553 | ; | |
1554 | ||
603248db MT |
1555 | my $auth_columns = 5; |
1556 | if ($HAVE_NTLM_AUTH) { | |
1557 | $auth_columns++; | |
1558 | } | |
1559 | my $auth_column_width = 100 / $auth_columns; | |
1560 | ||
1561 | print <<END; | |
ed38f89d MT |
1562 | <table width='100%'> |
1563 | <tr> | |
603248db | 1564 | <td colspan='$auth_columns'><b>$Lang::tr{'advproxy AUTH method'}</b></td> |
ed38f89d MT |
1565 | </tr> |
1566 | <tr> | |
603248db MT |
1567 | <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked{'AUTH_METHOD'}{'none'} />$Lang::tr{'advproxy AUTH method none'}</td> |
1568 | <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked{'AUTH_METHOD'}{'ncsa'} />$Lang::tr{'advproxy AUTH method ncsa'}</td> | |
1569 | <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked{'AUTH_METHOD'}{'ident'} />$Lang::tr{'advproxy AUTH method ident'}</td> | |
1570 | <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked{'AUTH_METHOD'}{'ldap'} />$Lang::tr{'advproxy AUTH method ldap'}</td> | |
603248db MT |
1571 | END |
1572 | ||
1573 | if ($HAVE_NTLM_AUTH) { | |
1574 | print <<END; | |
1575 | <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm-auth' $checked{'AUTH_METHOD'}{'ntlm-auth'} />$Lang::tr{'advproxy AUTH method ntlm auth'}</td> | |
1576 | END | |
1577 | } | |
1578 | ||
1579 | print <<END | |
1580 | <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked{'AUTH_METHOD'}{'radius'} />$Lang::tr{'advproxy AUTH method radius'}</td> | |
ed38f89d MT |
1581 | </tr> |
1582 | </table> | |
1583 | END | |
1584 | ; | |
1585 | ||
1586 | if (!($proxysettings{'AUTH_METHOD'} eq 'none')) { if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { print <<END | |
1587 | <hr size='1'> | |
1588 | <table width='100%'> | |
1589 | <tr> | |
363fb6af | 1590 | <td colspan='4'><b>$Lang::tr{'advproxy AUTH global settings'}</b></td> |
ed38f89d MT |
1591 | </tr> |
1592 | <tr> | |
1593 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1594 | </tr> | |
1595 | <tr> | |
1596 | <td class='base'>$Lang::tr{'advproxy AUTH number of auth processes'}:</td> | |
1597 | <td><input type='text' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}' size='5' /></td> | |
1598 | <td colspan='2' rowspan= '6' valign='top' class='base'> | |
1599 | <table cellpadding='0' cellspacing='0'> | |
1600 | <tr> | |
e3edceeb | 1601 | <td class='base'>$Lang::tr{'advproxy AUTH realm'}:</td> |
ed38f89d MT |
1602 | </tr> |
1603 | <tr> | |
1604 | <!-- intentionally left empty --> | |
1605 | </tr> | |
1606 | <tr> | |
1607 | <!-- intentionally left empty --> | |
1608 | </tr> | |
1609 | <tr> | |
1610 | <td><input type='text' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}' size='40' /></td> | |
1611 | </tr> | |
1612 | <tr> | |
1613 | <!-- intentionally left empty --> | |
1614 | </tr> | |
1615 | <tr> | |
1616 | <!-- intentionally left empty --> | |
1617 | </tr> | |
1618 | <tr> | |
e3edceeb | 1619 | <td>$Lang::tr{'advproxy AUTH no auth'}:</td> |
ed38f89d MT |
1620 | </tr> |
1621 | <tr> | |
1622 | <!-- intentionally left empty --> | |
1623 | </tr> | |
1624 | <tr> | |
1625 | <!-- intentionally left empty --> | |
1626 | </tr> | |
1627 | <tr> | |
1628 | <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'> | |
1629 | END | |
1630 | ; | |
1631 | ||
1632 | print $proxysettings{'DST_NOAUTH'}; | |
1633 | ||
1634 | print <<END | |
1635 | </textarea></td> | |
1636 | </tr> | |
1637 | </table> | |
1638 | </td> | |
1639 | </tr> | |
1640 | <tr> | |
1641 | <td class='base'>$Lang::tr{'advproxy AUTH auth cache TTL'}:</td> | |
1642 | <td><input type='text' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
1643 | </tr> | |
1644 | <tr> | |
e3edceeb | 1645 | <td class='base'>$Lang::tr{'advproxy AUTH limit of IP addresses'}:</td> |
ed38f89d MT |
1646 | <td><input type='text' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> |
1647 | </tr> | |
ed38f89d | 1648 | <tr> |
363fb6af MT |
1649 | <td class='base'>$Lang::tr{'advproxy AUTH always required'}:</td> |
1650 | <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td> | |
ed38f89d MT |
1651 | </tr> |
1652 | <tr> | |
1653 | <td colspan='2'> </td> | |
1654 | </tr> | |
1655 | </table> | |
1656 | END | |
1657 | ; | |
1658 | } | |
1659 | ||
1660 | # =================================================================== | |
1661 | # NCSA auth settings | |
1662 | # =================================================================== | |
1663 | ||
1664 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') { | |
1665 | print <<END | |
1666 | <hr size='1'> | |
1667 | <table width='100%'> | |
1668 | <tr> | |
1669 | <td colspan='4'><b>$Lang::tr{'advproxy NCSA auth'}</b></td> | |
1670 | </tr> | |
1671 | <tr> | |
1672 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA min password length'}:</td> | |
1673 | <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}' size='5' /></td> | |
1674 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA redirector bypass'} \'$Lang::tr{'advproxy NCSA grp extended'}\':</td> | |
363fb6af | 1675 | <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked{'NCSA_BYPASS_REDIR'}{'on'} /></td> |
ed38f89d MT |
1676 | </tr> |
1677 | <tr> | |
1678 | <td colspan='2'><br> <input type='submit' name='ACTION' value='$Lang::tr{'advproxy NCSA user management'}'></td> | |
1679 | <td> </td> | |
1680 | <td> </td> | |
1681 | </tr> | |
1682 | </table> | |
1683 | END | |
1684 | ; } | |
1685 | ||
1686 | # =================================================================== | |
1687 | # IDENTD auth settings | |
1688 | # =================================================================== | |
1689 | ||
1690 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { | |
1691 | print <<END | |
1692 | <hr size ='1'> | |
1693 | <table width='100%'> | |
1694 | <tr> | |
1695 | <td colspan='4'><b>$Lang::tr{'advproxy IDENT identd settings'}</b></td> | |
1696 | </tr> | |
1697 | <tr> | |
1698 | <td width='25%' class='base'>$Lang::tr{'advproxy IDENT required'}:</td> | |
363fb6af MT |
1699 | <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked{'IDENT_REQUIRED'}{'on'} /></td> |
1700 | <td width='25%' class='base'>$Lang::tr{'advproxy AUTH always required'}:</td> | |
1701 | <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td> | |
ed38f89d MT |
1702 | </tr> |
1703 | <tr> | |
1704 | <td class='base'>$Lang::tr{'advproxy IDENT timeout'}:</td> | |
1705 | <td><input type='text' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}' size='5' /></td> | |
1706 | <td> </td> | |
1707 | <td> </td> | |
1708 | </tr> | |
1709 | <tr> | |
1710 | <td colspan='2' class='base'>$Lang::tr{'advproxy IDENT aware hosts'}:</td> | |
e3edceeb | 1711 | <td colspan='2' class='base'>$Lang::tr{'advproxy AUTH no auth'}:</td> |
ed38f89d MT |
1712 | </tr> |
1713 | <tr> | |
1714 | <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'> | |
1715 | END | |
1716 | ; | |
1717 | if (!$proxysettings{'IDENT_HOSTS'}) { | |
f09a0af5 | 1718 | print "$green_cidr\n"; |
ed38f89d | 1719 | if ($netsettings{'BLUE_DEV'}) { |
f09a0af5 | 1720 | print "$blue_cidr\n"; |
ed38f89d MT |
1721 | } |
1722 | } else { | |
1723 | print $proxysettings{'IDENT_HOSTS'}; | |
1724 | } | |
1725 | ||
1726 | print <<END | |
1727 | </textarea></td> | |
1728 | <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'> | |
1729 | END | |
1730 | ; | |
1731 | ||
1732 | print $proxysettings{'DST_NOAUTH'}; | |
1733 | ||
1734 | print <<END | |
1735 | </textarea></td> | |
1736 | </tr> | |
1737 | </table> | |
1738 | <hr size ='1'> | |
1739 | <table width='100%'> | |
1740 | <tr> | |
1741 | <td colspan='4'><b>$Lang::tr{'advproxy IDENT user based access restrictions'}</b></td> | |
1742 | </tr> | |
1743 | <tr> | |
1744 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
1745 | <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked{'IDENT_ENABLE_ACL'}{'on'} /></td> | |
1746 | <td width='25%'> </td> | |
1747 | <td width='30%'> </td> | |
1748 | </tr> | |
1749 | <tr> | |
1750 | <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked{'IDENT_USER_ACL'}{'positive'} /> | |
1751 | $Lang::tr{'advproxy IDENT use positive access list'}:</td> | |
1752 | <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked{'IDENT_USER_ACL'}{'negative'} /> | |
1753 | $Lang::tr{'advproxy IDENT use negative access list'}:</td> | |
1754 | </tr> | |
1755 | <tr> | |
1756 | <td colspan='2'>$Lang::tr{'advproxy IDENT authorized users'}</td> | |
1757 | <td colspan='2'>$Lang::tr{'advproxy IDENT unauthorized users'}</td> | |
1758 | </tr> | |
1759 | <tr> | |
363fb6af | 1760 | <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1761 | END |
1762 | ; } | |
1763 | ||
1764 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_ALLOW_USERS'}; } | |
1765 | ||
1766 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END | |
1767 | </textarea></td> | |
363fb6af | 1768 | <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1769 | END |
1770 | ; } | |
1771 | ||
1772 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_DENY_USERS'}; } | |
1773 | ||
1774 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END | |
1775 | </textarea></td> | |
1776 | </tr> | |
1777 | </table> | |
1778 | END | |
1779 | ; } | |
1780 | ||
b5674643 MT |
1781 | # =================================================================== |
1782 | # NTLM-AUTH settings | |
1783 | # =================================================================== | |
1784 | ||
1785 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm-auth') { | |
1786 | print <<END; | |
1787 | <hr size ='1'> | |
2fc5124b MT |
1788 | <table width='100%'> |
1789 | <td width='20%' class='base'>$Lang::tr{'advproxy basic authentication'}:</td> | |
1790 | <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked{'NTLM_AUTH_BASIC'}{'on'} /></td> | |
1791 | <td colspan='2'> </td> | |
1792 | </table> | |
1793 | ||
1794 | <hr size='1' /> | |
1795 | ||
b5674643 MT |
1796 | <table width='100%'> |
1797 | <tr> | |
1798 | <td colspan='4'><b>$Lang::tr{'advproxy group access control'}</b></td> | |
1799 | </tr> | |
1800 | <tr> | |
e3edceeb | 1801 | <td width='20%' class='base'>$Lang::tr{'advproxy group required'}:</td> |
b5674643 MT |
1802 | <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value='$proxysettings{'NTLM_AUTH_GROUP'}' size='37' /></td> |
1803 | <td> </td> | |
1804 | <td> </td> | |
1805 | </tr> | |
1806 | </table> | |
1807 | END | |
1808 | } | |
1809 | ||
ed38f89d MT |
1810 | # =================================================================== |
1811 | # LDAP auth settings | |
1812 | # =================================================================== | |
1813 | ||
1814 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') { | |
1815 | print <<END | |
1816 | <hr size='1'> | |
1817 | <table width='100%'> | |
1818 | <tr> | |
1819 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP common settings'}</b></td> | |
1820 | </tr> | |
1821 | <tr> | |
1822 | <td class='base'>$Lang::tr{'advproxy LDAP basedn'}:</td> | |
1823 | <td><input type='text' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}' size='37' /></td> | |
1824 | <td class='base'>$Lang::tr{'advproxy LDAP type'}:</td> | |
1825 | <td class='base'><select name='LDAP_TYPE'> | |
1826 | <option value='ADS' $selected{'LDAP_TYPE'}{'ADS'}>$Lang::tr{'advproxy LDAP ADS'}</option> | |
1827 | <option value='NDS' $selected{'LDAP_TYPE'}{'NDS'}>$Lang::tr{'advproxy LDAP NDS'}</option> | |
1828 | <option value='V2' $selected{'LDAP_TYPE'}{'V2'}>$Lang::tr{'advproxy LDAP V2'}</option> | |
1829 | <option value='V3' $selected{'LDAP_TYPE'}{'V3'}>$Lang::tr{'advproxy LDAP V3'}</option> | |
1830 | </select></td> | |
1831 | </tr> | |
1832 | <tr> | |
1833 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP server'}:</td> | |
1834 | <td width='40%'><input type='text' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}' size='14' /></td> | |
1835 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP port'}:</td> | |
1836 | <td><input type='text' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}' size='3' /></td> | |
1837 | </tr> | |
1838 | </table> | |
1839 | <hr size ='1'> | |
1840 | <table width='100%'> | |
1841 | <tr> | |
1842 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP binddn settings'}</b></td> | |
1843 | </tr> | |
1844 | <tr> | |
1845 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn username'}:</td> | |
1846 | <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}' size='37' /></td> | |
1847 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn password'}:</td> | |
1848 | <td><input type='password' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}' size='14' /></td> | |
1849 | </tr> | |
1850 | </table> | |
1851 | <hr size ='1'> | |
1852 | <table width='100%'> | |
1853 | <tr> | |
1854 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP group access control'}</b></td> | |
1855 | </tr> | |
1856 | <tr> | |
e3edceeb | 1857 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP group required'}:</td> |
ed38f89d MT |
1858 | <td width='40%'><input type='text' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}' size='37' /></td> |
1859 | <td> </td> | |
1860 | <td> </td> | |
1861 | </tr> | |
1862 | </table> | |
1863 | END | |
1864 | ; } | |
1865 | ||
1866 | # =================================================================== | |
1867 | # RADIUS auth settings | |
1868 | # =================================================================== | |
1869 | ||
1870 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { | |
1871 | print <<END | |
1872 | <hr size='1'> | |
1873 | <table width='100%'> | |
1874 | <tr> | |
1875 | <td colspan='4'><b>$Lang::tr{'advproxy RADIUS radius settings'}</b></td> | |
1876 | </tr> | |
1877 | <tr> | |
1878 | <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS server'}:</td> | |
1879 | <td width='20%'><input type='text' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}' size='14' /></td> | |
1880 | <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS port'}:</td> | |
1881 | <td width='30%'><input type='text' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}' size='3' /></td> | |
1882 | </tr> | |
1883 | <tr> | |
e3edceeb | 1884 | <td class='base'>$Lang::tr{'advproxy RADIUS identifier'}:</td> |
ed38f89d MT |
1885 | <td><input type='text' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}' size='14' /></td> |
1886 | <td class='base'>$Lang::tr{'advproxy RADIUS secret'}:</td> | |
1887 | <td><input type='password' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}' size='14' /></td> | |
1888 | </tr> | |
1889 | </table> | |
1890 | <hr size ='1'> | |
1891 | <table width='100%'> | |
1892 | <tr> | |
1893 | <td colspan='4'><b>$Lang::tr{'advproxy RADIUS user based access restrictions'}</b></td> | |
1894 | </tr> | |
1895 | <tr> | |
1896 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
1897 | <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked{'RADIUS_ENABLE_ACL'}{'on'} /></td> | |
1898 | <td width='25%'> </td> | |
1899 | <td width='30%'> </td> | |
1900 | </tr> | |
1901 | <tr> | |
1902 | <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked{'RADIUS_USER_ACL'}{'positive'} /> | |
1903 | $Lang::tr{'advproxy RADIUS use positive access list'}:</td> | |
1904 | <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked{'RADIUS_USER_ACL'}{'negative'} /> | |
1905 | $Lang::tr{'advproxy RADIUS use negative access list'}:</td> | |
1906 | </tr> | |
1907 | <tr> | |
1908 | <td colspan='2'>$Lang::tr{'advproxy RADIUS authorized users'}</td> | |
1909 | <td colspan='2'>$Lang::tr{'advproxy RADIUS unauthorized users'}</td> | |
1910 | </tr> | |
1911 | <tr> | |
363fb6af | 1912 | <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1913 | END |
1914 | ; } | |
1915 | ||
1916 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_ALLOW_USERS'}; } | |
1917 | ||
1918 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END | |
1919 | </textarea></td> | |
363fb6af | 1920 | <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1921 | END |
1922 | ; } | |
1923 | ||
1924 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_DENY_USERS'}; } | |
1925 | ||
1926 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END | |
1927 | </textarea></td> | |
1928 | </tr> | |
1929 | </table> | |
1930 | END | |
1931 | ; } | |
1932 | ||
1933 | # =================================================================== | |
1934 | ||
1935 | } | |
1936 | ||
1937 | print "<table>\n"; | |
1938 | ||
1939 | if ($proxysettings{'AUTH_METHOD'} eq 'none') { | |
1940 | print <<END | |
1941 | <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td> | |
1942 | <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
1943 | <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
ed38f89d MT |
1944 | <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value='$proxysettings{'AUTH_ALWAYS_REQUIRED'}'></td> |
1945 | <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td> | |
1946 | <td><input type='hidden' name='DST_NOAUTH' value='$proxysettings{'DST_NOAUTH'}'></td> | |
1947 | END | |
1948 | ; } | |
1949 | ||
1950 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { | |
1951 | print <<END | |
1952 | <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td> | |
1953 | <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
1954 | <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
ed38f89d MT |
1955 | <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td> |
1956 | END | |
1957 | ; } | |
1958 | ||
1959 | if (!($proxysettings{'AUTH_METHOD'} eq 'ncsa')) { | |
1960 | print <<END | |
1961 | <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td> | |
1962 | <td><input type='hidden' name='NCSA_BYPASS_REDIR' value='$proxysettings{'NCSA_BYPASS_REDIR'}'></td> | |
1963 | END | |
1964 | ; } | |
1965 | ||
1966 | if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { | |
1967 | print <<END | |
1968 | <td><input type='hidden' name='IDENT_REQUIRED' value='$proxysettings{'IDENT_REQUIRED'}'></td> | |
1969 | <td><input type='hidden' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}'></td> | |
1970 | <td><input type='hidden' name='IDENT_HOSTS' value='$proxysettings{'IDENT_HOSTS'}'></td> | |
1971 | <td><input type='hidden' name='IDENT_ENABLE_ACL' value='$proxysettings{'IDENT_ENABLE_ACL'}'></td> | |
1972 | <td><input type='hidden' name='IDENT_USER_ACL' value='$proxysettings{'IDENT_USER_ACL'}'></td> | |
1973 | <td><input type='hidden' name='IDENT_ALLOW_USERS' value='$proxysettings{'IDENT_ALLOW_USERS'}'></td> | |
1974 | <td><input type='hidden' name='IDENT_DENY_USERS' value='$proxysettings{'IDENT_DENY_USERS'}'></td> | |
1975 | END | |
1976 | ; } | |
1977 | ||
1978 | if (!($proxysettings{'AUTH_METHOD'} eq 'ldap')) { | |
1979 | print <<END | |
1980 | <td><input type='hidden' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}'></td> | |
1981 | <td><input type='hidden' name='LDAP_TYPE' value='$proxysettings{'LDAP_TYPE'}'></td> | |
1982 | <td><input type='hidden' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}'></td> | |
1983 | <td><input type='hidden' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}'></td> | |
1984 | <td><input type='hidden' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}'></td> | |
1985 | <td><input type='hidden' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}'></td> | |
1986 | <td><input type='hidden' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}'></td> | |
1987 | END | |
1988 | ; } | |
1989 | ||
ed38f89d MT |
1990 | if (!($proxysettings{'AUTH_METHOD'} eq 'radius')) { |
1991 | print <<END | |
1992 | <td><input type='hidden' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}'></td> | |
1993 | <td><input type='hidden' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}'></td> | |
1994 | <td><input type='hidden' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}'></td> | |
1995 | <td><input type='hidden' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}'></td> | |
1996 | <td><input type='hidden' name='RADIUS_ENABLE_ACL' value='$proxysettings{'RADIUS_ENABLE_ACL'}'></td> | |
1997 | <td><input type='hidden' name='RADIUS_USER_ACL' value='$proxysettings{'RADIUS_USER_ACL'}'></td> | |
1998 | <td><input type='hidden' name='RADIUS_ALLOW_USERS' value='$proxysettings{'RADIUS_ALLOW_USERS'}'></td> | |
1999 | <td><input type='hidden' name='RADIUS_DENY_USERS' value='$proxysettings{'RADIUS_DENY_USERS'}'></td> | |
2000 | END | |
2001 | ; } | |
2002 | ||
2003 | print "</table>\n"; | |
2004 | ||
2005 | print <<END | |
2006 | <hr size='1'> | |
2007 | END | |
2008 | ; | |
2009 | ||
2010 | print <<END | |
2011 | <table width='100%'> | |
2012 | <tr> | |
363fb6af | 2013 | <td> </td> |
ed38f89d | 2014 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td> |
fe1656d2 | 2015 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'proxy reconfigure'}' /></td> |
ed38f89d | 2016 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy save and restart'}' /></td> |
363fb6af MT |
2017 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy clear cache'}' /></td> |
2018 | <td> </td> | |
ed38f89d MT |
2019 | </tr> |
2020 | ||
2021 | </table> | |
2022 | <br /> | |
2023 | <table width='100%'> | |
2024 | <tr> | |
e3edceeb | 2025 | <td><img src='/blob.gif' align='top' alt='*' /> <font class='base'>$Lang::tr{'required field'}</font></td> |
363fb6af | 2026 | <td align='right'> </td> |
ed38f89d MT |
2027 | </tr> |
2028 | </table> | |
2029 | </form> | |
2030 | END | |
2031 | ; | |
2032 | ||
2033 | &Header::closebox(); | |
2034 | ||
2035 | } else { | |
2036 | ||
2037 | # =================================================================== | |
2038 | # NCSA user management | |
2039 | # =================================================================== | |
2040 | ||
2041 | &Header::openbox('100%', 'left', "$Lang::tr{'advproxy NCSA auth'}"); | |
2042 | print <<END | |
2043 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
2044 | <table width='100%'> | |
2045 | <tr> | |
363fb6af | 2046 | <td colspan='4'><b>$Lang::tr{'advproxy NCSA user management'}</b></td> |
ed38f89d MT |
2047 | </tr> |
2048 | <tr> | |
2049 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA username'}:</td> | |
2050 | <td width='25%'><input type='text' name='NCSA_USERNAME' value='$proxysettings{'NCSA_USERNAME'}' size='12' | |
2051 | END | |
2052 | ; | |
153cf640 | 2053 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly='readonly' "; } |
ed38f89d MT |
2054 | print <<END |
2055 | /></td> | |
2056 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA group'}:</td> | |
2057 | <td class='base'> | |
2058 | <select name='NCSA_GROUP'> | |
2059 | <option value='standard' $selected{'NCSA_GROUP'}{'standard'}>$Lang::tr{'advproxy NCSA grp standard'}</option> | |
2060 | <option value='extended' $selected{'NCSA_GROUP'}{'extended'}>$Lang::tr{'advproxy NCSA grp extended'}</option> | |
2061 | <option value='disabled' $selected{'NCSA_GROUP'}{'disabled'}>$Lang::tr{'advproxy NCSA grp disabled'}</option> | |
2062 | </select> | |
2063 | </td> | |
2064 | ||
2065 | </tr> | |
2066 | <tr> | |
2067 | <td class='base'>$Lang::tr{'advproxy NCSA password'}:</td> | |
2068 | <td><input type='password' name='NCSA_PASS' value='$proxysettings{'NCSA_PASS'}' size='14' /></td> | |
2069 | <td class='base'>$Lang::tr{'advproxy NCSA password confirm'}:</td> | |
2070 | <td><input type='password' name='NCSA_PASS_CONFIRM' value='$proxysettings{'NCSA_PASS_CONFIRM'}' size='14' /></td> | |
2071 | </tr> | |
2072 | </table> | |
2073 | <br> | |
2074 | <table> | |
2075 | <tr> | |
2076 | <td> </td> | |
2077 | <td><input type='submit' name='SUBMIT' value='$ncsa_buttontext' /></td> | |
2078 | <td><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /></td> | |
2079 | <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td> | |
2080 | END | |
2081 | ; | |
2082 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { | |
2083 | print "<td><input type='reset' name='ACTION' value='$Lang::tr{'advproxy reset'}' /></td>\n"; | |
2084 | } | |
2085 | ||
2086 | print <<END | |
2087 | <td> </td> | |
2088 | <td> </td> | |
2089 | <td><input type='button' name='return2main' value='$Lang::tr{'advproxy back to main page'}' onClick='self.location.href="$ENV{'SCRIPT_NAME'}"'></td> | |
2090 | </tr> | |
2091 | </table> | |
2092 | </form> | |
2093 | <hr size='1'> | |
2094 | <table width='100%'> | |
2095 | <tr> | |
363fb6af | 2096 | <td><b>$Lang::tr{'advproxy NCSA user accounts'}:</b></td> |
ed38f89d MT |
2097 | </tr> |
2098 | </table> | |
2099 | <table width='100%' align='center'> | |
2100 | END | |
2101 | ; | |
2102 | ||
2103 | if (-e $extgrp) | |
2104 | { | |
2105 | open(FILE, $extgrp); @grouplist = <FILE>; close(FILE); | |
2106 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":extended"); } | |
2107 | } | |
2108 | if (-e $stdgrp) | |
2109 | { | |
2110 | open(FILE, $stdgrp); @grouplist = <FILE>; close(FILE); | |
2111 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":standard"); } | |
2112 | } | |
2113 | if (-e $disgrp) | |
2114 | { | |
2115 | open(FILE, $disgrp); @grouplist = <FILE>; close(FILE); | |
2116 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":disabled"); } | |
2117 | } | |
2118 | ||
2119 | @userlist = sort(@userlist); | |
2120 | ||
2121 | # If the password file contains entries, print entries and action icons | |
2122 | ||
488d1b7c | 2123 | if ( ! -z "$userdb" ) { |
ed38f89d MT |
2124 | print <<END |
2125 | <tr> | |
2126 | <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA username'}</i></b></td> | |
2127 | <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA group membership'}</i></b></td> | |
2128 | <td class='boldbase' colspan='2' align='center'> </td> | |
2129 | </tr> | |
2130 | END | |
2131 | ; | |
2132 | $id = 0; | |
2133 | foreach $line (@userlist) | |
2134 | { | |
2135 | $id++; | |
2136 | chomp($line); | |
2137 | @temp = split(/:/,$line); | |
2138 | if($proxysettings{'ACTION'} eq $Lang::tr{'edit'} && $proxysettings{'ID'} eq $line) { | |
2139 | print "<tr bgcolor='$Header::colouryellow'>\n"; } | |
2140 | elsif ($id % 2) { | |
4e17adad | 2141 | print "<tr bgcolor='$color{'color20'}'>\n"; } |
ed38f89d | 2142 | else { |
4e17adad | 2143 | print "<tr bgcolor='$color{'color22'}'>\n"; } |
ed38f89d MT |
2144 | |
2145 | print <<END | |
2146 | <td align='center'>$temp[0]</td> | |
2147 | <td align='center'> | |
2148 | END | |
2149 | ; | |
2150 | if ($temp[1] eq 'standard') { | |
2151 | print $Lang::tr{'advproxy NCSA grp standard'}; | |
2152 | } elsif ($temp[1] eq 'extended') { | |
2153 | print $Lang::tr{'advproxy NCSA grp extended'}; | |
2154 | } elsif ($temp[1] eq 'disabled') { | |
2155 | print $Lang::tr{'advproxy NCSA grp disabled'}; } | |
2156 | print <<END | |
2157 | </td> | |
2158 | <td width='8%' align='center'> | |
2159 | <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'> | |
2160 | <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' title='$Lang::tr{'edit'}' alt='$Lang::tr{'edit'}' /> | |
2161 | <input type='hidden' name='ID' value='$line' /> | |
2162 | <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' /> | |
2163 | </form> | |
2164 | </td> | |
2165 | ||
2166 | <td width='8%' align='center'> | |
2167 | <form method='post' name='frmb$id' action='$ENV{'SCRIPT_NAME'}'> | |
2168 | <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' title='$Lang::tr{'remove'}' alt='$Lang::tr{'remove'}' /> | |
2169 | <input type='hidden' name='ID' value='$temp[0]' /> | |
2170 | <input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' /> | |
2171 | </form> | |
2172 | </td> | |
2173 | </tr> | |
2174 | END | |
2175 | ; | |
2176 | } | |
2177 | ||
2178 | print <<END | |
2179 | </table> | |
2180 | <br> | |
9fb25b1c | 2181 | <table> |
ed38f89d MT |
2182 | <tr> |
2183 | <td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td> | |
2184 | <td> <img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td> | |
2185 | <td class='base'>$Lang::tr{'edit'}</td> | |
2186 | <td> <img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td> | |
2187 | <td class='base'>$Lang::tr{'remove'}</td> | |
2188 | </tr> | |
2189 | END | |
2190 | ; | |
2191 | } else { | |
2192 | print <<END | |
2193 | <tr> | |
363fb6af | 2194 | <td><i>$Lang::tr{'advproxy NCSA no accounts'}</i></td> |
ed38f89d MT |
2195 | </tr> |
2196 | END | |
2197 | ; | |
2198 | } | |
2199 | ||
2200 | print <<END | |
2201 | </table> | |
2202 | END | |
2203 | ; | |
2204 | ||
2205 | &Header::closebox(); | |
2206 | ||
2207 | } | |
2208 | ||
2209 | # =================================================================== | |
2210 | ||
2211 | &Header::closebigbox(); | |
2212 | ||
2213 | &Header::closepage(); | |
2214 | ||
2215 | # ------------------------------------------------------------------- | |
2216 | ||
2217 | sub read_acls | |
2218 | { | |
2219 | if (-e "$acl_src_subnets") { | |
2220 | open(FILE,"$acl_src_subnets"); | |
2221 | delete $proxysettings{'SRC_SUBNETS'}; | |
2222 | while (<FILE>) { $proxysettings{'SRC_SUBNETS'} .= $_ }; | |
2223 | close(FILE); | |
2224 | } | |
2225 | if (-e "$acl_src_banned_ip") { | |
2226 | open(FILE,"$acl_src_banned_ip"); | |
2227 | delete $proxysettings{'SRC_BANNED_IP'}; | |
2228 | while (<FILE>) { $proxysettings{'SRC_BANNED_IP'} .= $_ }; | |
2229 | close(FILE); | |
2230 | } | |
2231 | if (-e "$acl_src_banned_mac") { | |
2232 | open(FILE,"$acl_src_banned_mac"); | |
2233 | delete $proxysettings{'SRC_BANNED_MAC'}; | |
2234 | while (<FILE>) { $proxysettings{'SRC_BANNED_MAC'} .= $_ }; | |
2235 | close(FILE); | |
2236 | } | |
2237 | if (-e "$acl_src_unrestricted_ip") { | |
2238 | open(FILE,"$acl_src_unrestricted_ip"); | |
2239 | delete $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2240 | while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_ }; | |
2241 | close(FILE); | |
2242 | } | |
2243 | if (-e "$acl_src_unrestricted_mac") { | |
2244 | open(FILE,"$acl_src_unrestricted_mac"); | |
2245 | delete $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2246 | while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_ }; | |
2247 | close(FILE); | |
2248 | } | |
2249 | if (-e "$acl_dst_nocache") { | |
2250 | open(FILE,"$acl_dst_nocache"); | |
2251 | delete $proxysettings{'DST_NOCACHE'}; | |
2252 | while (<FILE>) { $proxysettings{'DST_NOCACHE'} .= $_ }; | |
2253 | close(FILE); | |
2254 | } | |
2255 | if (-e "$acl_dst_noauth") { | |
2256 | open(FILE,"$acl_dst_noauth"); | |
2257 | delete $proxysettings{'DST_NOAUTH'}; | |
2258 | while (<FILE>) { $proxysettings{'DST_NOAUTH'} .= $_ }; | |
2259 | close(FILE); | |
2260 | } | |
363fb6af MT |
2261 | if (-e "$acl_ports_safe") { |
2262 | open(FILE,"$acl_ports_safe"); | |
2263 | delete $proxysettings{'PORTS_SAFE'}; | |
2264 | while (<FILE>) { $proxysettings{'PORTS_SAFE'} .= $_ }; | |
2265 | close(FILE); | |
2266 | } | |
2267 | if (-e "$acl_ports_ssl") { | |
2268 | open(FILE,"$acl_ports_ssl"); | |
2269 | delete $proxysettings{'PORTS_SSL'}; | |
2270 | while (<FILE>) { $proxysettings{'PORTS_SSL'} .= $_ }; | |
2271 | close(FILE); | |
2272 | } | |
ed38f89d MT |
2273 | if (-e "$mimetypes") { |
2274 | open(FILE,"$mimetypes"); | |
2275 | delete $proxysettings{'MIME_TYPES'}; | |
2276 | while (<FILE>) { $proxysettings{'MIME_TYPES'} .= $_ }; | |
2277 | close(FILE); | |
2278 | } | |
ed38f89d MT |
2279 | if (-e "$raddir/radauth.allowusers") { |
2280 | open(FILE,"$raddir/radauth.allowusers"); | |
2281 | delete $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2282 | while (<FILE>) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_ }; | |
2283 | close(FILE); | |
2284 | } | |
2285 | if (-e "$raddir/radauth.denyusers") { | |
2286 | open(FILE,"$raddir/radauth.denyusers"); | |
2287 | delete $proxysettings{'RADIUS_DENY_USERS'}; | |
2288 | while (<FILE>) { $proxysettings{'RADIUS_DENY_USERS'} .= $_ }; | |
2289 | close(FILE); | |
2290 | } | |
2291 | if (-e "$identdir/identauth.allowusers") { | |
2292 | open(FILE,"$identdir/identauth.allowusers"); | |
2293 | delete $proxysettings{'IDENT_ALLOW_USERS'}; | |
2294 | while (<FILE>) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_ }; | |
2295 | close(FILE); | |
2296 | } | |
2297 | if (-e "$identdir/identauth.denyusers") { | |
2298 | open(FILE,"$identdir/identauth.denyusers"); | |
2299 | delete $proxysettings{'IDENT_DENY_USERS'}; | |
2300 | while (<FILE>) { $proxysettings{'IDENT_DENY_USERS'} .= $_ }; | |
2301 | close(FILE); | |
2302 | } | |
2303 | if (-e "$identhosts") { | |
2304 | open(FILE,"$identhosts"); | |
2305 | delete $proxysettings{'IDENT_HOSTS'}; | |
2306 | while (<FILE>) { $proxysettings{'IDENT_HOSTS'} .= $_ }; | |
2307 | close(FILE); | |
2308 | } | |
2309 | if (-e "$cre_groups") { | |
2310 | open(FILE,"$cre_groups"); | |
2311 | delete $proxysettings{'CRE_GROUPS'}; | |
2312 | while (<FILE>) { $proxysettings{'CRE_GROUPS'} .= $_ }; | |
2313 | close(FILE); | |
2314 | } | |
2315 | if (-e "$cre_svhosts") { | |
2316 | open(FILE,"$cre_svhosts"); | |
2317 | delete $proxysettings{'CRE_SVHOSTS'}; | |
2318 | while (<FILE>) { $proxysettings{'CRE_SVHOSTS'} .= $_ }; | |
2319 | close(FILE); | |
2320 | } | |
2321 | } | |
2322 | ||
2323 | # ------------------------------------------------------------------- | |
2324 | ||
2325 | sub check_acls | |
2326 | { | |
363fb6af MT |
2327 | @temp = split(/\n/,$proxysettings{'PORTS_SAFE'}); |
2328 | undef $proxysettings{'PORTS_SAFE'}; | |
2329 | foreach (@temp) | |
2330 | { | |
2331 | s/^\s+//g; s/\s+$//g; | |
2332 | if ($_) | |
2333 | { | |
2334 | $line = $_; | |
2335 | if (/^[^#]+\s+#\sSquids\sport/) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/; $line=$_; } | |
2336 | s/#.*//g; s/\s+//g; | |
2337 | if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } | |
2338 | @templist = split(/-/); | |
2339 | foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } } | |
2340 | $proxysettings{'PORTS_SAFE'} .= $line."\n"; | |
2341 | } | |
2342 | } | |
2343 | ||
2344 | @temp = split(/\n/,$proxysettings{'PORTS_SSL'}); | |
2345 | undef $proxysettings{'PORTS_SSL'}; | |
2346 | foreach (@temp) | |
2347 | { | |
2348 | s/^\s+//g; s/\s+$//g; | |
2349 | if ($_) | |
2350 | { | |
2351 | $line = $_; | |
2352 | s/#.*//g; s/\s+//g; | |
2353 | if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } | |
2354 | @templist = split(/-/); | |
2355 | foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } } | |
2356 | $proxysettings{'PORTS_SSL'} .= $line."\n"; | |
2357 | } | |
2358 | } | |
2359 | ||
2360 | @temp = split(/\n/,$proxysettings{'DST_NOCACHE'}); | |
2361 | undef $proxysettings{'DST_NOCACHE'}; | |
2362 | foreach (@temp) | |
2363 | { | |
488d1b7c CS |
2364 | s/^\s+//g; |
2365 | unless (/^#/) { s/\s+//g; } | |
363fb6af MT |
2366 | if ($_) |
2367 | { | |
488d1b7c | 2368 | if (/^\./) { $_ = '*'.$_; } |
363fb6af MT |
2369 | $proxysettings{'DST_NOCACHE'} .= $_."\n"; |
2370 | } | |
2371 | } | |
2372 | ||
ed38f89d MT |
2373 | @temp = split(/\n/,$proxysettings{'SRC_SUBNETS'}); |
2374 | undef $proxysettings{'SRC_SUBNETS'}; | |
2375 | foreach (@temp) | |
2376 | { | |
2377 | s/^\s+//g; s/\s+$//g; | |
2378 | if ($_) | |
2379 | { | |
2380 | unless (&General::validipandmask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2381 | $proxysettings{'SRC_SUBNETS'} .= $_."\n"; | |
2382 | } | |
2383 | } | |
2384 | ||
2385 | @temp = split(/\n/,$proxysettings{'SRC_BANNED_IP'}); | |
2386 | undef $proxysettings{'SRC_BANNED_IP'}; | |
2387 | foreach (@temp) | |
2388 | { | |
2389 | s/^\s+//g; s/\s+$//g; | |
2390 | if ($_) | |
2391 | { | |
2392 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2393 | $proxysettings{'SRC_BANNED_IP'} .= $_."\n"; | |
2394 | } | |
2395 | } | |
2396 | ||
2397 | @temp = split(/\n/,$proxysettings{'SRC_BANNED_MAC'}); | |
2398 | undef $proxysettings{'SRC_BANNED_MAC'}; | |
2399 | foreach (@temp) | |
2400 | { | |
2401 | s/^\s+//g; s/\s+$//g; s/-/:/g; | |
2402 | if ($_) | |
2403 | { | |
2404 | unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; } | |
2405 | $proxysettings{'SRC_BANNED_MAC'} .= $_."\n"; | |
2406 | } | |
2407 | } | |
2408 | ||
2409 | @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_IP'}); | |
2410 | undef $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2411 | foreach (@temp) | |
2412 | { | |
2413 | s/^\s+//g; s/\s+$//g; | |
2414 | if ($_) | |
2415 | { | |
2416 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2417 | $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_."\n"; | |
2418 | } | |
2419 | } | |
2420 | ||
2421 | @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_MAC'}); | |
2422 | undef $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2423 | foreach (@temp) | |
2424 | { | |
2425 | s/^\s+//g; s/\s+$//g; s/-/:/g; | |
2426 | if ($_) | |
2427 | { | |
2428 | unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; } | |
2429 | $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_."\n"; | |
2430 | } | |
2431 | } | |
2432 | ||
363fb6af | 2433 | @temp = split(/\n/,$proxysettings{'DST_NOAUTH'}); |
37273bc6 | 2434 | undef $proxysettings{'DST_NOAUTH'}; |
363fb6af MT |
2435 | foreach (@temp) |
2436 | { | |
488d1b7c CS |
2437 | s/^\s+//g; |
2438 | unless (/^#/) { s/\s+//g; } | |
363fb6af MT |
2439 | if ($_) |
2440 | { | |
488d1b7c | 2441 | if (/^\./) { $_ = '*'.$_; } |
363fb6af MT |
2442 | $proxysettings{'DST_NOAUTH'} .= $_."\n"; |
2443 | } | |
2444 | } | |
2445 | ||
ed38f89d MT |
2446 | if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'positive')) |
2447 | { | |
2448 | @temp = split(/\n/,$proxysettings{'NTLM_ALLOW_USERS'}); | |
2449 | undef $proxysettings{'NTLM_ALLOW_USERS'}; | |
2450 | foreach (@temp) | |
2451 | { | |
2452 | s/^\s+//g; s/\s+$//g; | |
2453 | if ($_) { $proxysettings{'NTLM_ALLOW_USERS'} .= $_."\n"; } | |
2454 | } | |
2455 | if ($proxysettings{'NTLM_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2456 | } | |
2457 | ||
2458 | if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'negative')) | |
2459 | { | |
2460 | @temp = split(/\n/,$proxysettings{'NTLM_DENY_USERS'}); | |
2461 | undef $proxysettings{'NTLM_DENY_USERS'}; | |
2462 | foreach (@temp) | |
2463 | { | |
2464 | s/^\s+//g; s/\s+$//g; | |
2465 | if ($_) { $proxysettings{'NTLM_DENY_USERS'} .= $_."\n"; } | |
2466 | } | |
2467 | if ($proxysettings{'NTLM_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2468 | } | |
2469 | ||
2470 | if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'positive')) | |
2471 | { | |
2472 | @temp = split(/\n/,$proxysettings{'IDENT_ALLOW_USERS'}); | |
2473 | undef $proxysettings{'IDENT_ALLOW_USERS'}; | |
2474 | foreach (@temp) | |
2475 | { | |
2476 | s/^\s+//g; s/\s+$//g; | |
2477 | if ($_) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_."\n"; } | |
2478 | } | |
2479 | if ($proxysettings{'IDENT_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2480 | } | |
2481 | ||
2482 | if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'negative')) | |
2483 | { | |
2484 | @temp = split(/\n/,$proxysettings{'IDENT_DENY_USERS'}); | |
2485 | undef $proxysettings{'IDENT_DENY_USERS'}; | |
2486 | foreach (@temp) | |
2487 | { | |
2488 | s/^\s+//g; s/\s+$//g; | |
2489 | if ($_) { $proxysettings{'IDENT_DENY_USERS'} .= $_."\n"; } | |
2490 | } | |
2491 | if ($proxysettings{'IDENT_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2492 | } | |
2493 | ||
2494 | if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive')) | |
2495 | { | |
2496 | @temp = split(/\n/,$proxysettings{'RADIUS_ALLOW_USERS'}); | |
2497 | undef $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2498 | foreach (@temp) | |
2499 | { | |
2500 | s/^\s+//g; s/\s+$//g; | |
2501 | if ($_) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_."\n"; } | |
2502 | } | |
2503 | if ($proxysettings{'RADIUS_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2504 | } | |
2505 | ||
2506 | if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative')) | |
2507 | { | |
2508 | @temp = split(/\n/,$proxysettings{'RADIUS_DENY_USERS'}); | |
2509 | undef $proxysettings{'RADIUS_DENY_USERS'}; | |
2510 | foreach (@temp) | |
2511 | { | |
2512 | s/^\s+//g; s/\s+$//g; | |
2513 | if ($_) { $proxysettings{'RADIUS_DENY_USERS'} .= $_."\n"; } | |
2514 | } | |
2515 | if ($proxysettings{'RADIUS_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2516 | } | |
2517 | ||
2518 | @temp = split(/\n/,$proxysettings{'IDENT_HOSTS'}); | |
2519 | undef $proxysettings{'IDENT_HOSTS'}; | |
2520 | foreach (@temp) | |
2521 | { | |
2522 | s/^\s+//g; s/\s+$//g; | |
2523 | if ($_) | |
2524 | { | |
2525 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2526 | $proxysettings{'IDENT_HOSTS'} .= $_."\n"; | |
2527 | } | |
2528 | } | |
2529 | ||
2530 | @temp = split(/\n/,$proxysettings{'CRE_SVHOSTS'}); | |
2531 | undef $proxysettings{'CRE_SVHOSTS'}; | |
2532 | foreach (@temp) | |
2533 | { | |
2534 | s/^\s+//g; s/\s+$//g; | |
2535 | if ($_) | |
2536 | { | |
2537 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2538 | $proxysettings{'CRE_SVHOSTS'} .= $_."\n"; | |
2539 | } | |
2540 | } | |
2541 | } | |
2542 | ||
ed38f89d MT |
2543 | # ------------------------------------------------------------------- |
2544 | ||
2545 | sub write_acls | |
2546 | { | |
2547 | open(FILE, ">$acl_src_subnets"); | |
2548 | flock(FILE, 2); | |
363fb6af MT |
2549 | if (!$proxysettings{'SRC_SUBNETS'}) |
2550 | { | |
f09a0af5 | 2551 | print FILE "$green_cidr\n"; |
363fb6af MT |
2552 | if ($netsettings{'BLUE_DEV'}) |
2553 | { | |
f09a0af5 | 2554 | print FILE "$blue_cidr\n"; |
363fb6af MT |
2555 | } |
2556 | } else { print FILE $proxysettings{'SRC_SUBNETS'}; } | |
ed38f89d MT |
2557 | close(FILE); |
2558 | ||
2559 | open(FILE, ">$acl_src_banned_ip"); | |
2560 | flock(FILE, 2); | |
2561 | print FILE $proxysettings{'SRC_BANNED_IP'}; | |
2562 | close(FILE); | |
2563 | ||
2564 | open(FILE, ">$acl_src_banned_mac"); | |
2565 | flock(FILE, 2); | |
2566 | print FILE $proxysettings{'SRC_BANNED_MAC'}; | |
2567 | close(FILE); | |
2568 | ||
2569 | open(FILE, ">$acl_src_unrestricted_ip"); | |
2570 | flock(FILE, 2); | |
2571 | print FILE $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2572 | close(FILE); | |
2573 | ||
2574 | open(FILE, ">$acl_src_unrestricted_mac"); | |
2575 | flock(FILE, 2); | |
2576 | print FILE $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2577 | close(FILE); | |
2578 | ||
488d1b7c CS |
2579 | open(FILE, ">$acl_dst_noauth"); |
2580 | flock(FILE, 2); | |
2581 | print FILE $proxysettings{'DST_NOAUTH'}; | |
2582 | close(FILE); | |
2583 | ||
2584 | open(FILE, ">$acl_dst_noauth_net"); | |
2585 | close(FILE); | |
2586 | open(FILE, ">$acl_dst_noauth_dom"); | |
2587 | close(FILE); | |
2588 | open(FILE, ">$acl_dst_noauth_url"); | |
2589 | close(FILE); | |
2590 | ||
2591 | @temp = split(/\n/,$proxysettings{'DST_NOAUTH'}); | |
2592 | foreach(@temp) | |
2593 | { | |
2594 | unless (/^#/) | |
2595 | { | |
2596 | if (/^\*\.\w/) | |
2597 | { | |
2598 | s/^\*//; | |
2599 | open(FILE, ">>$acl_dst_noauth_dom"); | |
2600 | flock(FILE, 2); | |
2601 | print FILE "$_\n"; | |
2602 | close(FILE); | |
2603 | } | |
2604 | elsif (&General::validipormask($_)) | |
2605 | { | |
2606 | open(FILE, ">>$acl_dst_noauth_net"); | |
2607 | flock(FILE, 2); | |
2608 | print FILE "$_\n"; | |
2609 | close(FILE); | |
2610 | } | |
2611 | 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?/) | |
2612 | { | |
2613 | open(FILE, ">>$acl_dst_noauth_net"); | |
2614 | flock(FILE, 2); | |
2615 | print FILE "$_\n"; | |
2616 | close(FILE); | |
2617 | } | |
2618 | else | |
2619 | { | |
2620 | open(FILE, ">>$acl_dst_noauth_url"); | |
2621 | flock(FILE, 2); | |
2622 | if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; } | |
2623 | close(FILE); | |
2624 | } | |
2625 | } | |
2626 | } | |
2627 | ||
ed38f89d MT |
2628 | open(FILE, ">$acl_dst_nocache"); |
2629 | flock(FILE, 2); | |
2630 | print FILE $proxysettings{'DST_NOCACHE'}; | |
2631 | close(FILE); | |
2632 | ||
488d1b7c CS |
2633 | open(FILE, ">$acl_dst_nocache_net"); |
2634 | close(FILE); | |
2635 | open(FILE, ">$acl_dst_nocache_dom"); | |
2636 | close(FILE); | |
2637 | open(FILE, ">$acl_dst_nocache_url"); | |
ed38f89d MT |
2638 | close(FILE); |
2639 | ||
488d1b7c CS |
2640 | @temp = split(/\n/,$proxysettings{'DST_NOCACHE'}); |
2641 | foreach(@temp) | |
2642 | { | |
2643 | unless (/^#/) | |
2644 | { | |
2645 | if (/^\*\.\w/) | |
2646 | { | |
2647 | s/^\*//; | |
2648 | open(FILE, ">>$acl_dst_nocache_dom"); | |
2649 | flock(FILE, 2); | |
2650 | print FILE "$_\n"; | |
2651 | close(FILE); | |
2652 | } | |
2653 | elsif (&General::validipormask($_)) | |
2654 | { | |
2655 | open(FILE, ">>$acl_dst_nocache_net"); | |
2656 | flock(FILE, 2); | |
2657 | print FILE "$_\n"; | |
2658 | close(FILE); | |
2659 | } | |
2660 | 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?/) | |
2661 | { | |
2662 | open(FILE, ">>$acl_dst_nocache_net"); | |
2663 | flock(FILE, 2); | |
2664 | print FILE "$_\n"; | |
2665 | close(FILE); | |
2666 | } | |
2667 | else | |
2668 | { | |
2669 | open(FILE, ">>$acl_dst_nocache_url"); | |
2670 | flock(FILE, 2); | |
2671 | if (/^[fh]tt?ps?:\/\//) { print FILE "$_\n"; } else { print FILE "^[fh]tt?ps?://$_\n"; } | |
2672 | close(FILE); | |
2673 | } | |
2674 | } | |
2675 | } | |
2676 | ||
363fb6af MT |
2677 | open(FILE, ">$acl_ports_safe"); |
2678 | flock(FILE, 2); | |
2679 | if (!$proxysettings{'PORTS_SAFE'}) { print FILE $def_ports_safe; } else { print FILE $proxysettings{'PORTS_SAFE'}; } | |
2680 | close(FILE); | |
2681 | ||
2682 | open(FILE, ">$acl_ports_ssl"); | |
2683 | flock(FILE, 2); | |
2684 | if (!$proxysettings{'PORTS_SSL'}) { print FILE $def_ports_ssl; } else { print FILE $proxysettings{'PORTS_SSL'}; } | |
2685 | close(FILE); | |
2686 | ||
ed38f89d MT |
2687 | if (-s $throttled_urls) |
2688 | { | |
2689 | open(URLFILE, $throttled_urls); | |
2690 | @temp = <URLFILE>; | |
2691 | close(URLFILE); | |
363fb6af | 2692 | foreach (@temp) { print FILE; } |
ed38f89d MT |
2693 | } |
2694 | close(FILE); | |
2695 | ||
2696 | open(FILE, ">$mimetypes"); | |
2697 | flock(FILE, 2); | |
2698 | print FILE $proxysettings{'MIME_TYPES'}; | |
2699 | close(FILE); | |
2700 | ||
ed38f89d MT |
2701 | open(FILE, ">$raddir/radauth.allowusers"); |
2702 | flock(FILE, 2); | |
2703 | print FILE $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2704 | close(FILE); | |
2705 | ||
2706 | open(FILE, ">$raddir/radauth.denyusers"); | |
2707 | flock(FILE, 2); | |
2708 | print FILE $proxysettings{'RADIUS_DENY_USERS'}; | |
2709 | close(FILE); | |
2710 | ||
2711 | open(FILE, ">$identdir/identauth.allowusers"); | |
2712 | flock(FILE, 2); | |
2713 | print FILE $proxysettings{'IDENT_ALLOW_USERS'}; | |
2714 | close(FILE); | |
2715 | ||
2716 | open(FILE, ">$identdir/identauth.denyusers"); | |
2717 | flock(FILE, 2); | |
2718 | print FILE $proxysettings{'IDENT_DENY_USERS'}; | |
2719 | close(FILE); | |
2720 | ||
2721 | open(FILE, ">$identhosts"); | |
2722 | flock(FILE, 2); | |
2723 | print FILE $proxysettings{'IDENT_HOSTS'}; | |
2724 | close(FILE); | |
2725 | ||
2726 | open(FILE, ">$cre_groups"); | |
2727 | flock(FILE, 2); | |
2728 | print FILE $proxysettings{'CRE_GROUPS'}; | |
2729 | close(FILE); | |
2730 | ||
2731 | open(FILE, ">$cre_svhosts"); | |
2732 | flock(FILE, 2); | |
2733 | print FILE $proxysettings{'CRE_SVHOSTS'}; | |
2734 | close(FILE); | |
2735 | } | |
2736 | ||
2737 | # ------------------------------------------------------------------- | |
2738 | ||
2739 | sub writepacfile | |
2740 | { | |
22527178 | 2741 | open(FILE, ">/srv/web/ipfire/html/proxy.pac"); |
ed38f89d MT |
2742 | flock(FILE, 2); |
2743 | print FILE "function FindProxyForURL(url, host)\n"; | |
2744 | print FILE "{\n"; | |
2745 | if (($proxysettings{'ENABLE'} eq 'on') || ($proxysettings{'ENABLE_BLUE'} eq 'on')) | |
2746 | { | |
2747 | print FILE <<END | |
2748 | if ( | |
2749 | (isPlainHostName(host)) || | |
c03cf9ea | 2750 | (isInNet(host, "127.0.0.1", "255.0.0.0")) || |
7c1b7d3e BB |
2751 | END |
2752 | ; | |
2753 | ||
2754 | if ($netsettings{'GREEN_DEV'}) { | |
2755 | print FILE " (isInNet(host, \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\")) ||\n"; | |
2756 | } | |
2757 | ||
2758 | if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) { | |
2759 | print FILE " (isInNet(host, \"$netsettings{'BLUE_NETADDRESS'}\", \"$netsettings{'BLUE_NETMASK'}\")) ||\n"; | |
2760 | } | |
2761 | ||
2762 | if (&Header::orange_used() && $netsettings{'ORANGE_DEV'}) { | |
2763 | print FILE " (isInNet(host, \"$netsettings{'ORANGE_NETADDRESS'}\", \"$netsettings{'ORANGE_NETMASK'}\")) ||\n"; | |
2764 | } | |
2765 | ||
2766 | print FILE <<END | |
488d1b7c | 2767 | (isInNet(host, "169.254.0.0", "255.255.0.0")) |
ed38f89d MT |
2768 | ) |
2769 | return "DIRECT"; | |
2770 | ||
2771 | else | |
2772 | ||
2773 | END | |
2774 | ; | |
2775 | if ($proxysettings{'ENABLE'} eq 'on') | |
2776 | { | |
268292e7 CS |
2777 | print FILE "if (\n"; |
2778 | print FILE " (isInNet(myIpAddress(), \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\"))"; | |
2779 | ||
2780 | undef @templist; | |
2781 | if (-e "$acl_src_subnets") { | |
2782 | open(SUBNETS,"$acl_src_subnets"); | |
2783 | @templist = <SUBNETS>; | |
2784 | close(SUBNETS); | |
2785 | } | |
2786 | ||
2787 | foreach (@templist) | |
2788 | { | |
2789 | @temp = split(/\//); | |
2790 | if ( | |
28c9dec6 | 2791 | ($temp[0] ne $netsettings{'GREEN_NETADDRESS'}) && ($temp[1] ne $netsettings{'GREEN_NETMASK'}) && |
268292e7 CS |
2792 | ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'}) |
2793 | ) | |
2794 | { | |
2795 | chomp $temp[1]; | |
2796 | print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))"; | |
2797 | } | |
2798 | } | |
2799 | ||
2800 | print FILE "\n"; | |
2801 | ||
ed38f89d | 2802 | print FILE <<END |
ed38f89d MT |
2803 | ) |
2804 | return "PROXY $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; | |
2805 | END | |
2806 | ; | |
2807 | } | |
2808 | if (($proxysettings{'ENABLE'} eq 'on') && ($proxysettings{'ENABLE_BLUE'} eq 'on') && ($netsettings{'BLUE_DEV'})) | |
2809 | { | |
2810 | print FILE "\n else\n\n"; | |
2811 | } | |
2812 | if (($netsettings{'BLUE_DEV'}) && ($proxysettings{'ENABLE_BLUE'} eq 'on')) | |
2813 | { | |
2814 | print FILE <<END | |
2815 | if ( | |
2816 | (isInNet(myIpAddress(), "$netsettings{'BLUE_NETADDRESS'}", "$netsettings{'BLUE_NETMASK'}")) | |
2817 | ) | |
2818 | return "PROXY $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; | |
2819 | END | |
2820 | ; | |
2821 | } | |
2822 | } | |
2823 | print FILE "}\n"; | |
2824 | close(FILE); | |
2825 | } | |
2826 | ||
2827 | # ------------------------------------------------------------------- | |
2828 | ||
2829 | sub writeconfig | |
2830 | { | |
2831 | my $authrealm; | |
2832 | my $delaypools; | |
2833 | ||
363fb6af | 2834 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} + |
ed38f89d MT |
2835 | $proxysettings{'THROTTLING_GREEN_HOST'} + |
2836 | $proxysettings{'THROTTLING_BLUE_TOTAL'} + | |
2837 | $proxysettings{'THROTTLING_BLUE_HOST'} gt 0) | |
2838 | { | |
2839 | $delaypools = 1; } else { $delaypools = 0; | |
2840 | } | |
2841 | ||
2842 | if ($proxysettings{'AUTH_REALM'} eq '') | |
2843 | { | |
d12aede7 | 2844 | $authrealm = "IPFire Advanced Proxy Server"; |
ed38f89d MT |
2845 | } else { |
2846 | $authrealm = $proxysettings{'AUTH_REALM'}; | |
2847 | } | |
2848 | ||
2849 | $_ = $proxysettings{'UPSTREAM_PROXY'}; | |
69491545 | 2850 | my ($remotehost, $remoteport) = split(/:/,$_); |
ed38f89d MT |
2851 | |
2852 | if ($remoteport eq '') { $remoteport = 80; } | |
2853 | ||
2854 | open(FILE, ">${General::swroot}/proxy/squid.conf"); | |
2855 | flock(FILE, 2); | |
2856 | print FILE <<END | |
363fb6af MT |
2857 | # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes |
2858 | # you make will be overwritten whenever you resave proxy settings using the | |
2859 | # web interface! | |
2860 | # | |
2861 | # Instead, modify the file '$acl_include' and | |
2862 | # then restart the proxy service using the web interface. Changes made to the | |
2863 | # 'include.acl' file will propagate to the 'squid.conf' file at that time. | |
2864 | ||
ed38f89d MT |
2865 | shutdown_lifetime 5 seconds |
2866 | icp_port 0 | |
2867 | ||
ed38f89d MT |
2868 | END |
2869 | ; | |
8b417dd1 MT |
2870 | |
2871 | # Include file with user defined settings. | |
2872 | if (-e "/etc/squid/squid.conf.pre.local") { | |
2873 | print FILE "include /etc/squid/squid.conf.pre.local\n\n"; | |
2874 | } | |
2875 | ||
363fb6af | 2876 | print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; |
363fb6af MT |
2877 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } |
2878 | print FILE "\n"; | |
2879 | ||
0f6b6067 MT |
2880 | if ($proxysettings{'TRANSPARENT'} eq 'on') { |
2881 | print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept"; | |
2882 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } | |
2883 | print FILE "\n"; | |
2884 | } | |
2885 | ||
ed38f89d | 2886 | if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') { |
363fb6af | 2887 | print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; |
363fb6af MT |
2888 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } |
2889 | print FILE "\n"; | |
0f6b6067 MT |
2890 | |
2891 | if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { | |
2892 | print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept"; | |
2893 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } | |
2894 | print FILE "\n"; | |
2895 | } | |
ed38f89d MT |
2896 | } |
2897 | ||
53d67554 | 2898 | if (($proxysettings{'CACHE_SIZE'} > 0) || ($proxysettings{'CACHE_MEM'} > 0)) |
488d1b7c CS |
2899 | { |
2900 | print FILE "\n"; | |
ed38f89d | 2901 | |
488d1b7c CS |
2902 | if (!-z $acl_dst_nocache_dom) { |
2903 | print FILE "acl no_cache_domains dstdomain \"$acl_dst_nocache_dom\"\n"; | |
2904 | print FILE "cache deny no_cache_domains\n"; | |
2905 | } | |
2906 | if (!-z $acl_dst_nocache_net) { | |
37273bc6 | 2907 | print FILE "acl no_cache_ipaddr dst \"$acl_dst_nocache_net\"\n"; |
488d1b7c CS |
2908 | print FILE "cache deny no_cache_ipaddr\n"; |
2909 | } | |
2910 | if (!-z $acl_dst_nocache_url) { | |
2911 | print FILE "acl no_cache_hosts url_regex -i \"$acl_dst_nocache_url\"\n"; | |
2912 | print FILE "cache deny no_cache_hosts\n"; | |
2913 | } | |
ed38f89d MT |
2914 | } |
2915 | ||
2916 | print FILE <<END | |
2917 | ||
2918 | cache_effective_user squid | |
363fb6af | 2919 | umask 022 |
ed38f89d MT |
2920 | |
2921 | pid_filename /var/run/squid.pid | |
2922 | ||
2923 | cache_mem $proxysettings{'CACHE_MEM'} MB | |
ed38f89d MT |
2924 | END |
2925 | ; | |
ab4a5a35 | 2926 | print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n"; |
363fb6af | 2927 | |
ed38f89d | 2928 | if ($proxysettings{'OFFLINE_MODE'} eq 'on') { print FILE "offline_mode on\n\n"; } |
6bea848d | 2929 | if ($proxysettings{'CACHE_DIGESTS'} eq 'on') { print FILE "digest_generation on\n\n"; } else { print FILE "digest_generation off\n\n"; } |
c4b12981 | 2930 | |
ed38f89d MT |
2931 | if ((!($proxysettings{'MEM_POLICY'} eq 'LRU')) || (!($proxysettings{'CACHE_POLICY'} eq 'LRU'))) |
2932 | { | |
2933 | if (!($proxysettings{'MEM_POLICY'} eq 'LRU')) | |
2934 | { | |
2935 | print FILE "memory_replacement_policy $proxysettings{'MEM_POLICY'}\n"; | |
2936 | } | |
2937 | if (!($proxysettings{'CACHE_POLICY'} eq 'LRU')) | |
2938 | { | |
2939 | print FILE "cache_replacement_policy $proxysettings{'CACHE_POLICY'}\n"; | |
2940 | } | |
2941 | print FILE "\n"; | |
2942 | } | |
2943 | ||
8fbcf730 MT |
2944 | open (PORTS,"$acl_ports_ssl"); |
2945 | my @ssl_ports = <PORTS>; | |
2946 | close PORTS; | |
2947 | ||
2948 | if (@ssl_ports) { | |
2949 | foreach (@ssl_ports) { | |
2950 | print FILE "acl SSL_ports port $_"; | |
2951 | } | |
2952 | } | |
2953 | ||
2954 | open (PORTS,"$acl_ports_safe"); | |
2955 | my @safe_ports = <PORTS>; | |
2956 | close PORTS; | |
2957 | ||
2958 | if (@safe_ports) { | |
2959 | foreach (@safe_ports) { | |
2960 | print FILE "acl Safe_ports port $_"; | |
2961 | } | |
2962 | } | |
2963 | ||
2964 | print FILE <<END | |
2965 | ||
2966 | acl IPFire_http port $http_port | |
2967 | acl IPFire_https port $https_port | |
2968 | acl IPFire_ips dst $netsettings{'GREEN_ADDRESS'} | |
2969 | acl IPFire_networks src "$acl_src_subnets" | |
2970 | acl IPFire_servers dst "$acl_src_subnets" | |
2971 | acl IPFire_green_network src $green_cidr | |
2972 | acl IPFire_green_servers dst $green_cidr | |
2973 | END | |
2974 | ; | |
2975 | if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPFire_blue_network src $blue_cidr\n"; } | |
2976 | if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPFire_blue_servers dst $blue_cidr\n"; } | |
2977 | if (!-z $acl_src_banned_ip) { print FILE "acl IPFire_banned_ips src \"$acl_src_banned_ip\"\n"; } | |
2978 | if (!-z $acl_src_banned_mac) { print FILE "acl IPFire_banned_mac arp \"$acl_src_banned_mac\"\n"; } | |
2979 | if (!-z $acl_src_unrestricted_ip) { print FILE "acl IPFire_unrestricted_ips src \"$acl_src_unrestricted_ip\"\n"; } | |
2980 | if (!-z $acl_src_unrestricted_mac) { print FILE "acl IPFire_unrestricted_mac arp \"$acl_src_unrestricted_mac\"\n"; } | |
2981 | print FILE <<END | |
2982 | acl CONNECT method CONNECT | |
2983 | END | |
2984 | ; | |
2985 | ||
f0b7534f MT |
2986 | if ($proxysettings{'CACHE_SIZE'} > 0) { |
2987 | print FILE <<END | |
2988 | maximum_object_size $proxysettings{'MAX_SIZE'} KB | |
2989 | minimum_object_size $proxysettings{'MIN_SIZE'} KB | |
2990 | ||
2991 | cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256 | |
2992 | END | |
2993 | ; | |
2994 | } else { | |
53d67554 DWD |
2995 | if ($proxysettings{'CACHE_MEM'} > 0) { |
2996 | # always 2% of CACHE_MEM defined as max object size | |
2997 | print FILE "maximum_object_size_in_memory " . int($proxysettings{'CACHE_MEM'} * 1024 * 0.02) . " KB\n\n"; | |
2998 | } else { | |
2999 | print FILE "cache deny all\n\n"; | |
3000 | } | |
f0b7534f MT |
3001 | } |
3002 | ||
3003 | print FILE <<END | |
3004 | request_body_max_size $proxysettings{'MAX_OUTGOING_SIZE'} KB | |
3005 | END | |
3006 | ; | |
3007 | ||
3008 | if ($proxysettings{'MAX_INCOMING_SIZE'} > 0) { | |
3009 | if (!-z $acl_src_unrestricted_ip) { print FILE "reply_body_max_size none IPFire_unrestricted_ips\n"; } | |
3010 | if (!-z $acl_src_unrestricted_mac) { print FILE "reply_body_max_size none IPFire_unrestricted_mac\n"; } | |
3011 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3012 | { | |
3013 | if (!-z $extgrp) { print FILE "reply_body_max_size none for_extended_users\n"; } | |
3014 | } | |
3015 | } | |
3016 | ||
3017 | if ( $proxysettings{'MAX_INCOMING_SIZE'} != '0' ) | |
e7b7cbae | 3018 | { |
f0b7534f | 3019 | print FILE "reply_body_max_size $proxysettings{'MAX_INCOMING_SIZE'} KB all\n\n"; |
e7b7cbae AF |
3020 | } |
3021 | ||
ed38f89d MT |
3022 | if ($proxysettings{'LOGGING'} eq 'on') |
3023 | { | |
363fb6af | 3024 | print FILE <<END |
754f508b | 3025 | access_log stdio:/var/log/squid/access.log |
ed38f89d MT |
3026 | cache_log /var/log/squid/cache.log |
3027 | cache_store_log none | |
3028 | END | |
3029 | ; | |
754f508b | 3030 | if ($proxysettings{'LOGUSERAGENT'} eq 'on') { print FILE "access_log stdio:\/var\/log\/squid\/user_agent.log useragent\n"; } |
ed38f89d MT |
3031 | if ($proxysettings{'LOGQUERY'} eq 'on') { print FILE "\nstrip_query_terms off\n"; } |
3032 | } else { | |
3033 | print FILE <<END | |
363fb6af | 3034 | access_log /dev/null |
ed38f89d MT |
3035 | cache_log /dev/null |
3036 | cache_store_log none | |
3037 | END | |
3038 | ;} | |
3039 | print FILE <<END | |
3040 | ||
3041 | log_mime_hdrs off | |
3042 | END | |
3043 | ; | |
3044 | ||
3045 | if ($proxysettings{'FORWARD_IPADDRESS'} eq 'on') | |
3046 | { | |
363fb6af | 3047 | print FILE "forwarded_for on\n"; |
ed38f89d | 3048 | } else { |
363fb6af | 3049 | print FILE "forwarded_for off\n"; |
ed38f89d | 3050 | } |
363fb6af MT |
3051 | if ($proxysettings{'FORWARD_VIA'} eq 'on') |
3052 | { | |
3053 | print FILE "via on\n"; | |
3054 | } else { | |
3055 | print FILE "via off\n"; | |
3056 | } | |
3057 | print FILE "\n"; | |
ed38f89d | 3058 | |
dc637f08 MT |
3059 | # If we use authentication, users must always authenticate |
3060 | unless ($proxysettings{"AUTH_METHOD"} eq "") { | |
3061 | print FILE "authenticate_ip_ttl 0\n\n"; | |
3062 | } | |
3063 | ||
ed38f89d MT |
3064 | if ((!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) |
3065 | { | |
3066 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3067 | { | |
754f508b | 3068 | print FILE "auth_param basic program $authdir/basic_ncsa_auth $userdb\n"; |
ed38f89d MT |
3069 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; |
3070 | print FILE "auth_param basic realm $authrealm\n"; | |
3071 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
ed38f89d MT |
3072 | } |
3073 | ||
3074 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') | |
3075 | { | |
725e3869 | 3076 | print FILE "auth_param basic utf8 on\n"; |
754f508b | 3077 | print FILE "auth_param basic program $authdir/basic_ldap_auth -b \"$proxysettings{'LDAP_BASEDN'}\""; |
ed38f89d MT |
3078 | if (!($proxysettings{'LDAP_BINDDN_USER'} eq '')) { print FILE " -D \"$proxysettings{'LDAP_BINDDN_USER'}\""; } |
3079 | if (!($proxysettings{'LDAP_BINDDN_PASS'} eq '')) { print FILE " -w $proxysettings{'LDAP_BINDDN_PASS'}"; } | |
3080 | if ($proxysettings{'LDAP_TYPE'} eq 'ADS') | |
3081 | { | |
3082 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
3083 | { | |
3084 | print FILE " -f \"(\&(objectClass=person)(sAMAccountName=\%s))\""; | |
3085 | } else { | |
3086 | print FILE " -f \"(\&(\&(objectClass=person)(sAMAccountName=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\""; | |
3087 | } | |
3088 | print FILE " -u sAMAccountName -P"; | |
3089 | } | |
3090 | if ($proxysettings{'LDAP_TYPE'} eq 'NDS') | |
3091 | { | |
3092 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
3093 | { | |
3094 | print FILE " -f \"(\&(objectClass=person)(cn=\%s))\""; | |
3095 | } else { | |
3096 | print FILE " -f \"(\&(\&(objectClass=person)(cn=\%s))(groupMembership=$proxysettings{'LDAP_GROUP'}))\""; | |
3097 | } | |
3098 | print FILE " -u cn -P"; | |
3099 | } | |
3100 | if (($proxysettings{'LDAP_TYPE'} eq 'V2') || ($proxysettings{'LDAP_TYPE'} eq 'V3')) | |
3101 | { | |
3102 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
3103 | { | |
3104 | print FILE " -f \"(\&(objectClass=person)(uid=\%s))\""; | |
3105 | } else { | |
3106 | print FILE " -f \"(\&(\&(objectClass=person)(uid=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\""; | |
3107 | } | |
3108 | if ($proxysettings{'LDAP_TYPE'} eq 'V2') { print FILE " -v 2"; } | |
3109 | if ($proxysettings{'LDAP_TYPE'} eq 'V3') { print FILE " -v 3"; } | |
3110 | print FILE " -u uid -P"; | |
3111 | } | |
3112 | print FILE " $proxysettings{'LDAP_SERVER'}:$proxysettings{'LDAP_PORT'}\n"; | |
3113 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; | |
3114 | print FILE "auth_param basic realm $authrealm\n"; | |
3115 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
ed38f89d MT |
3116 | } |
3117 | ||
603248db MT |
3118 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm-auth') |
3119 | { | |
b5674643 MT |
3120 | print FILE "auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp"; |
3121 | if ($proxysettings{'NTLM_AUTH_GROUP'}) { | |
3122 | my $ntlm_auth_group = $proxysettings{'NTLM_AUTH_GROUP'}; | |
3123 | $ntlm_auth_group =~ s/\\/\+/; | |
3124 | ||
a44eed25 | 3125 | print FILE " --require-membership-of=$ntlm_auth_group"; |
b5674643 MT |
3126 | } |
3127 | print FILE "\n"; | |
3128 | ||
2fc5124b | 3129 | print FILE "auth_param ntlm children $proxysettings{'AUTH_CHILDREN'}\n\n"; |
a1018d86 | 3130 | print FILE "auth_param ntlm credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n\n"; |
2fc5124b MT |
3131 | |
3132 | # BASIC authentication | |
3133 | if ($proxysettings{'NTLM_AUTH_BASIC'} eq "on") { | |
3134 | print FILE "auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic"; | |
3135 | if ($proxysettings{'NTLM_AUTH_GROUP'}) { | |
3136 | my $ntlm_auth_group = $proxysettings{'NTLM_AUTH_GROUP'}; | |
3137 | $ntlm_auth_group =~ s/\\/\+/; | |
3138 | ||
a44eed25 | 3139 | print FILE " --require-membership-of=$ntlm_auth_group"; |
2fc5124b MT |
3140 | } |
3141 | print FILE "\n"; | |
fa286b13 | 3142 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; |
5c2a76f7 | 3143 | print FILE "auth_param basic realm $authrealm\n"; |
6df2d528 | 3144 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n\n"; |
2fc5124b | 3145 | } |
603248db MT |
3146 | } |
3147 | ||
ed38f89d MT |
3148 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') |
3149 | { | |
754f508b | 3150 | print FILE "auth_param basic program $authdir/basic_radius_auth -h $proxysettings{'RADIUS_SERVER'} -p $proxysettings{'RADIUS_PORT'} "; |
ed38f89d MT |
3151 | if (!($proxysettings{'RADIUS_IDENTIFIER'} eq '')) { print FILE "-i $proxysettings{'RADIUS_IDENTIFIER'} "; } |
3152 | print FILE "-w $proxysettings{'RADIUS_SECRET'}\n"; | |
3153 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; | |
3154 | print FILE "auth_param basic realm $authrealm\n"; | |
3155 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
ed38f89d MT |
3156 | } |
3157 | ||
3158 | print FILE "\n"; | |
3159 | print FILE "acl for_inetusers proxy_auth REQUIRED\n"; | |
ed38f89d MT |
3160 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) |
3161 | { | |
3162 | if ((!-z "$raddir/radauth.allowusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive')) | |
3163 | { | |
3164 | print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.allowusers\"\n"; | |
3165 | } | |
3166 | if ((!-z "$raddir/radauth.denyusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative')) | |
3167 | { | |
3168 | print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.denyusers\"\n"; | |
3169 | } | |
3170 | } | |
3171 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3172 | { | |
3173 | print FILE "\n"; | |
3174 | if (!-z $extgrp) { print FILE "acl for_extended_users proxy_auth \"$extgrp\"\n"; } | |
3175 | if (!-z $disgrp) { print FILE "acl for_disabled_users proxy_auth \"$disgrp\"\n"; } | |
3176 | } | |
3177 | if (!($proxysettings{'AUTH_MAX_USERIP'} eq '')) { print FILE "\nacl concurrent max_user_ip -s $proxysettings{'AUTH_MAX_USERIP'}\n"; } | |
3178 | print FILE "\n"; | |
3179 | ||
488d1b7c CS |
3180 | if (!-z $acl_dst_noauth_net) { print FILE "acl to_ipaddr_without_auth dst \"$acl_dst_noauth_net\"\n"; } |
3181 | if (!-z $acl_dst_noauth_dom) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth_dom\"\n"; } | |
3182 | if (!-z $acl_dst_noauth_url) { print FILE "acl to_hosts_without_auth url_regex -i \"$acl_dst_noauth_url\"\n"; } | |
363fb6af | 3183 | print FILE "\n"; |
488d1b7c | 3184 | |
ed38f89d MT |
3185 | } |
3186 | ||
3187 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
3188 | { | |
3189 | if ($proxysettings{'IDENT_REQUIRED'} eq 'on') | |
3190 | { | |
3191 | print FILE "acl for_inetusers ident REQUIRED\n"; | |
3192 | } | |
3193 | if ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') | |
3194 | { | |
3195 | if ((!-z "$identdir/identauth.allowusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'positive')) | |
3196 | { | |
3197 | print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.allowusers\"\n\n"; | |
3198 | } | |
3199 | if ((!-z "$identdir/identauth.denyusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'negative')) | |
3200 | { | |
3201 | print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.denyusers\"\n\n"; | |
3202 | } | |
3203 | } | |
488d1b7c CS |
3204 | if (!-z $acl_dst_noauth_net) { print FILE "acl to_ipaddr_without_auth dst \"$acl_dst_noauth_net\"\n"; } |
3205 | if (!-z $acl_dst_noauth_dom) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth_dom\"\n"; } | |
3206 | if (!-z $acl_dst_noauth_url) { print FILE "acl to_hosts_without_auth url_regex -i \"$acl_dst_noauth_url\"\n"; } | |
363fb6af | 3207 | print FILE "\n"; |
ed38f89d MT |
3208 | } |
3209 | ||
3210 | if (($delaypools) && (!-z $acl_dst_throttle)) { print FILE "acl for_throttled_urls url_regex -i \"$acl_dst_throttle\"\n\n"; } | |
3211 | ||
28c9dec6 | 3212 | print FILE "acl within_timeframe time "; |
ed38f89d MT |
3213 | if ($proxysettings{'TIME_MON'} eq 'on') { print FILE "M"; } |
3214 | if ($proxysettings{'TIME_TUE'} eq 'on') { print FILE "T"; } | |
3215 | if ($proxysettings{'TIME_WED'} eq 'on') { print FILE "W"; } | |
3216 | if ($proxysettings{'TIME_THU'} eq 'on') { print FILE "H"; } | |
3217 | if ($proxysettings{'TIME_FRI'} eq 'on') { print FILE "F"; } | |
3218 | if ($proxysettings{'TIME_SAT'} eq 'on') { print FILE "A"; } | |
3219 | if ($proxysettings{'TIME_SUN'} eq 'on') { print FILE "S"; } | |
363fb6af MT |
3220 | print FILE " $proxysettings{'TIME_FROM_HOUR'}:"; |
3221 | print FILE "$proxysettings{'TIME_FROM_MINUTE'}-"; | |
3222 | print FILE "$proxysettings{'TIME_TO_HOUR'}:"; | |
3223 | print FILE "$proxysettings{'TIME_TO_MINUTE'}\n\n"; | |
ed38f89d MT |
3224 | |
3225 | if ((!-z $mimetypes) && ($proxysettings{'ENABLE_MIME_FILTER'} eq 'on')) { | |
3226 | print FILE "acl blocked_mimetypes rep_mime_type \"$mimetypes\"\n\n"; | |
3227 | } | |
3228 | ||
ed38f89d MT |
3229 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on') { |
3230 | print FILE <<END | |
3231 | ||
3232 | #Classroom extensions | |
488d1b7c CS |
3233 | acl IPFire_no_access_ips src "$acl_src_noaccess_ip" |
3234 | acl IPFire_no_access_mac arp "$acl_src_noaccess_mac" | |
ed38f89d MT |
3235 | END |
3236 | ; | |
3237 | print FILE "deny_info "; | |
ab4a5a35 | 3238 | if (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) |
363fb6af MT |
3239 | { |
3240 | print FILE "ERR_ACCESS_DISABLED"; | |
3241 | } else { | |
3242 | print FILE "ERR_ACCESS_DENIED"; | |
3243 | } | |
488d1b7c | 3244 | print FILE " IPFire_no_access_ips\n"; |
ed38f89d | 3245 | print FILE "deny_info "; |
ab4a5a35 | 3246 | if (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) |
363fb6af MT |
3247 | { |
3248 | print FILE "ERR_ACCESS_DISABLED"; | |
3249 | } else { | |
3250 | print FILE "ERR_ACCESS_DENIED"; | |
3251 | } | |
488d1b7c | 3252 | print FILE " IPFire_no_access_mac\n"; |
ed38f89d MT |
3253 | |
3254 | print FILE <<END | |
488d1b7c CS |
3255 | http_access deny IPFire_no_access_ips |
3256 | http_access deny IPFire_no_access_mac | |
ed38f89d MT |
3257 | END |
3258 | ; | |
3259 | } | |
3260 | ||
363fb6af MT |
3261 | #Insert acl file and replace __VAR__ with correct values |
3262 | my $blue_net = ''; #BLUE empty by default | |
3263 | my $blue_ip = ''; | |
3264 | if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') { | |
f09a0af5 | 3265 | $blue_net = "$blue_cidr"; |
363fb6af MT |
3266 | $blue_ip = "$netsettings{'BLUE_ADDRESS'}"; |
3267 | } | |
3268 | if (!-z $acl_include) | |
ed38f89d MT |
3269 | { |
3270 | open (ACL, "$acl_include"); | |
488d1b7c | 3271 | print FILE "\n#Start of custom includes\n\n"; |
ed38f89d MT |
3272 | while (<ACL>) { |
3273 | $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/; | |
f09a0af5 | 3274 | $_ =~ s/__GREEN_NET__/$green_cidr/; |
ed38f89d MT |
3275 | $_ =~ s/__BLUE_IP__/$blue_ip/; |
3276 | $_ =~ s/__BLUE_NET__/$blue_net/; | |
363fb6af | 3277 | $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/; |
ed38f89d MT |
3278 | print FILE $_; |
3279 | } | |
488d1b7c | 3280 | print FILE "\n#End of custom includes\n"; |
ed38f89d MT |
3281 | close (ACL); |
3282 | } | |
3283 | if ((!-z $extgrp) && ($proxysettings{'AUTH_METHOD'} eq 'ncsa') && ($proxysettings{'NCSA_BYPASS_REDIR'} eq 'on')) { print FILE "\nredirector_access deny for_extended_users\n"; } | |
dfee7582 SS |
3284 | |
3285 | # Check if squidclamav is enabled. | |
3286 | if ($proxysettings{'ENABLE_CLAMAV'} eq 'on') { | |
3287 | print FILE "\n#Settings for squidclamav:\n"; | |
0f6b6067 | 3288 | print FILE "http_port 127.0.0.1:$proxysettings{'PROXY_PORT'}\n"; |
dfee7582 SS |
3289 | print FILE "acl purge method PURGE\n"; |
3290 | print FILE "http_access deny to_localhost\n"; | |
3291 | print FILE "http_access allow localhost\n"; | |
3292 | print FILE "http_access allow purge localhost\n"; | |
3293 | print FILE "http_access deny purge\n"; | |
3294 | print FILE "url_rewrite_access deny localhost\n"; | |
3295 | } | |
3ebc0da7 | 3296 | print FILE <<END; |
ed38f89d MT |
3297 | |
3298 | #Access to squid: | |
3299 | #local machine, no restriction | |
3300 | http_access allow localhost | |
3301 | ||
3302 | #GUI admin if local machine connects | |
488d1b7c CS |
3303 | http_access allow IPFire_ips IPFire_networks IPFire_http |
3304 | http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https | |
ed38f89d MT |
3305 | |
3306 | #Deny not web services | |
ed38f89d | 3307 | END |
3ebc0da7 MT |
3308 | |
3309 | if (@safe_ports) { | |
3310 | print FILE "http_access deny !Safe_ports\n"; | |
3311 | } | |
3312 | ||
3313 | if (@ssl_ports) { | |
3314 | print FILE "http_access deny CONNECT !SSL_ports\n"; | |
3315 | } | |
ed38f89d MT |
3316 | |
3317 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
3318 | { | |
3319 | print FILE "#Set ident ACLs\n"; | |
3320 | if (!-z $identhosts) | |
3321 | { | |
3322 | print FILE "acl on_ident_aware_hosts src \"$identhosts\"\n"; | |
3323 | print FILE "ident_lookup_access allow on_ident_aware_hosts\n"; | |
3324 | print FILE "ident_lookup_access deny all\n"; | |
3325 | } else { | |
3326 | print FILE "ident_lookup_access allow all\n"; | |
3327 | } | |
3328 | print FILE "ident_timeout $proxysettings{'IDENT_TIMEOUT'} seconds\n\n"; | |
3329 | } | |
3330 | ||
3331 | if ($delaypools) { | |
3332 | print FILE "#Set download throttling\n"; | |
3333 | ||
3334 | if ($netsettings{'BLUE_DEV'}) | |
3335 | { | |
3336 | print FILE "delay_pools 2\n"; | |
3337 | } else { | |
3338 | print FILE "delay_pools 1\n"; | |
3339 | } | |
3340 | ||
3341 | print FILE "delay_class 1 3\n"; | |
3342 | if ($netsettings{'BLUE_DEV'}) { print FILE "delay_class 2 3\n"; } | |
3343 | ||
3344 | print FILE "delay_parameters 1 "; | |
3345 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} eq 'unlimited') | |
3346 | { | |
3347 | print FILE "-1/-1"; | |
3348 | } else { | |
3349 | print FILE $proxysettings{'THROTTLING_GREEN_TOTAL'} * 125; | |
3350 | print FILE "/"; | |
3351 | print FILE $proxysettings{'THROTTLING_GREEN_TOTAL'} * 250; | |
3352 | } | |
3353 | ||
3354 | print FILE " -1/-1 "; | |
3355 | if ($proxysettings{'THROTTLING_GREEN_HOST'} eq 'unlimited') | |
3356 | { | |
3357 | print FILE "-1/-1"; | |
3358 | } else { | |
3359 | print FILE $proxysettings{'THROTTLING_GREEN_HOST'} * 125; | |
3360 | print FILE "/"; | |
3361 | print FILE $proxysettings{'THROTTLING_GREEN_HOST'} * 250; | |
3362 | } | |
3363 | print FILE "\n"; | |
3364 | ||
3365 | if ($netsettings{'BLUE_DEV'}) | |
3366 | { | |
3367 | print FILE "delay_parameters 2 "; | |
3368 | if ($proxysettings{'THROTTLING_BLUE_TOTAL'} eq 'unlimited') | |
3369 | { | |
3370 | print FILE "-1/-1"; | |
3371 | } else { | |
3372 | print FILE $proxysettings{'THROTTLING_BLUE_TOTAL'} * 125; | |
3373 | print FILE "/"; | |
3374 | print FILE $proxysettings{'THROTTLING_BLUE_TOTAL'} * 250; | |
3375 | } | |
3376 | print FILE " -1/-1 "; | |
3377 | if ($proxysettings{'THROTTLING_BLUE_HOST'} eq 'unlimited') | |
3378 | { | |
3379 | print FILE "-1/-1"; | |
3380 | } else { | |
3381 | print FILE $proxysettings{'THROTTLING_BLUE_HOST'} * 125; | |
3382 | print FILE "/"; | |
3383 | print FILE $proxysettings{'THROTTLING_BLUE_HOST'} * 250; | |
3384 | } | |
3385 | print FILE "\n"; | |
3386 | } | |
3387 | ||
488d1b7c CS |
3388 | print FILE "delay_access 1 deny IPFire_ips\n"; |
3389 | if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 1 deny IPFire_unrestricted_ips\n"; } | |
3390 | if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 1 deny IPFire_unrestricted_mac\n"; } | |
ed38f89d MT |
3391 | if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 1 deny for_extended_users\n"; } |
3392 | ||
3393 | if ($netsettings{'BLUE_DEV'}) | |
3394 | { | |
488d1b7c | 3395 | print FILE "delay_access 1 allow IPFire_green_network"; |
363fb6af | 3396 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3397 | print FILE "\n"; |
3398 | print FILE "delay_access 1 deny all\n"; | |
3399 | } else { | |
3400 | print FILE "delay_access 1 allow all"; | |
363fb6af | 3401 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3402 | print FILE "\n"; |
3403 | } | |
3404 | ||
3405 | if ($netsettings{'BLUE_DEV'}) | |
3406 | { | |
488d1b7c CS |
3407 | print FILE "delay_access 2 deny IPFire_ips\n"; |
3408 | if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 2 deny IPFire_unrestricted_ips\n"; } | |
3409 | if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 2 deny IPFire_unrestricted_mac\n"; } | |
ed38f89d | 3410 | if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 2 deny for_extended_users\n"; } |
488d1b7c | 3411 | print FILE "delay_access 2 allow IPFire_blue_network"; |
363fb6af | 3412 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3413 | print FILE "\n"; |
3414 | print FILE "delay_access 2 deny all\n"; | |
3415 | } | |
3416 | ||
28c9dec6 | 3417 | print FILE "delay_initial_bucket_level 100\n"; |
ed38f89d MT |
3418 | print FILE "\n"; |
3419 | } | |
9fb25b1c MT |
3420 | |
3421 | if ($proxysettings{'NO_PROXY_LOCAL'} eq 'on') | |
3422 | { | |
b34fdcae AF |
3423 | print FILE "#Prevent internal proxy access to Green except IPFire itself\n"; |
3424 | print FILE "http_access deny IPFire_green_servers !IPFire_ips !IPFire_green_network\n\n"; | |
9fb25b1c MT |
3425 | } |
3426 | ||
3427 | if ($proxysettings{'NO_PROXY_LOCAL_BLUE'} eq 'on') | |
3428 | { | |
b34fdcae | 3429 | print FILE "#Prevent internal proxy access from Blue except IPFire itself\n"; |
488d1b7c | 3430 | print FILE "http_access allow IPFire_blue_network IPFire_blue_servers\n"; |
b34fdcae | 3431 | print FILE "http_access deny IPFire_blue_network !IPFire_ips IPFire_servers\n\n"; |
9fb25b1c MT |
3432 | } |
3433 | ||
ed38f89d MT |
3434 | print FILE <<END |
3435 | #Set custom configured ACLs | |
3436 | END | |
3437 | ; | |
488d1b7c CS |
3438 | if (!-z $acl_src_banned_ip) { print FILE "http_access deny IPFire_banned_ips\n"; } |
3439 | if (!-z $acl_src_banned_mac) { print FILE "http_access deny IPFire_banned_mac\n"; } | |
ed38f89d MT |
3440 | |
3441 | if ((!-z $acl_dst_noauth) && (!($proxysettings{'AUTH_METHOD'} eq 'none'))) | |
3442 | { | |
3443 | if (!-z $acl_src_unrestricted_ip) | |
3444 | { | |
488d1b7c CS |
3445 | if (!-z $acl_dst_noauth_net) { print FILE "http_access allow IPFire_unrestricted_ips to_ipaddr_without_auth\n"; } |
3446 | if (!-z $acl_dst_noauth_dom) { print FILE "http_access allow IPFire_unrestricted_ips to_domains_without_auth\n"; } | |
3447 | if (!-z $acl_dst_noauth_url) { print FILE "http_access allow IPFire_unrestricted_ips to_hosts_without_auth\n"; } | |
ed38f89d MT |
3448 | } |
3449 | if (!-z $acl_src_unrestricted_mac) | |
3450 | { | |
488d1b7c CS |
3451 | if (!-z $acl_dst_noauth_net) { print FILE "http_access allow IPFire_unrestricted_mac to_ipaddr_without_auth\n"; } |
3452 | if (!-z $acl_dst_noauth_dom) { print FILE "http_access allow IPFire_unrestricted_mac to_domains_without_auth\n"; } | |
3453 | if (!-z $acl_dst_noauth_url) { print FILE "http_access allow IPFire_unrestricted_mac to_hosts_without_auth\n"; } | |
3454 | } | |
3455 | if (!-z $acl_dst_noauth_net) | |
3456 | { | |
3457 | print FILE "http_access allow IPFire_networks"; | |
3458 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3459 | print FILE " !within_timeframe"; | |
3460 | } else { | |
3461 | print FILE " within_timeframe"; } | |
488d1b7c CS |
3462 | print FILE " to_ipaddr_without_auth\n"; |
3463 | } | |
3464 | if (!-z $acl_dst_noauth_dom) | |
3465 | { | |
3466 | print FILE "http_access allow IPFire_networks"; | |
3467 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3468 | print FILE " !within_timeframe"; | |
3469 | } else { | |
3470 | print FILE " within_timeframe"; } | |
488d1b7c CS |
3471 | print FILE " to_domains_without_auth\n"; |
3472 | } | |
3473 | if (!-z $acl_dst_noauth_url) | |
3474 | { | |
3475 | print FILE "http_access allow IPFire_networks"; | |
3476 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3477 | print FILE " !within_timeframe"; | |
3478 | } else { | |
3479 | print FILE " within_timeframe"; } | |
488d1b7c | 3480 | print FILE " to_hosts_without_auth\n"; |
ed38f89d | 3481 | } |
ed38f89d MT |
3482 | } |
3483 | ||
3484 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on') && ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on')) | |
3485 | { | |
3486 | print FILE "http_access deny !for_inetusers"; | |
3487 | if (!-z $identhosts) { print FILE " on_ident_aware_hosts"; } | |
3488 | print FILE "\n"; | |
3489 | } | |
3490 | ||
3491 | if ( | |
3492 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3493 | ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') && | |
3494 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3495 | ($proxysettings{'IDENT_USER_ACL'} eq 'negative') && | |
3496 | (!-z "$identdir/identauth.denyusers") | |
3497 | ) | |
3498 | { | |
3499 | print FILE "http_access deny for_acl_users"; | |
3500 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && (!-z "$identdir/hosts")) { print FILE " on_ident_aware_hosts"; } | |
3501 | print FILE "\n"; | |
3502 | } | |
3503 | ||
3504 | if (!-z $acl_src_unrestricted_ip) | |
3505 | { | |
488d1b7c | 3506 | print FILE "http_access allow IPFire_unrestricted_ips"; |
ed38f89d MT |
3507 | if ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') |
3508 | { | |
3509 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3510 | { | |
3511 | if (!-z $disgrp) { print FILE " !for_disabled_users"; } else { print FILE " for_inetusers"; } | |
3512 | } | |
ea72700a | 3513 | if (($proxysettings{'AUTH_METHOD'} eq 'ldap') || ($proxysettings{'AUTH_METHOD'} eq 'radius')) |
ed38f89d MT |
3514 | { |
3515 | print FILE " for_inetusers"; | |
3516 | } | |
ed38f89d | 3517 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) |
363fb6af | 3518 | { |
ed38f89d | 3519 | if ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') |
363fb6af | 3520 | { |
ed38f89d MT |
3521 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && (!-z "$raddir/radauth.allowusers")) |
3522 | { | |
3523 | print FILE " for_acl_users"; | |
3524 | } | |
3525 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && (!-z "$raddir/radauth.denyusers")) | |
3526 | { | |
3527 | print FILE " !for_acl_users"; | |
3528 | } | |
3529 | } else { print FILE " for_inetusers"; } | |
3530 | } | |
3531 | } | |
3532 | print FILE "\n"; | |
3533 | } | |
3534 | ||
3535 | if (!-z $acl_src_unrestricted_mac) | |
3536 | { | |
488d1b7c | 3537 | print FILE "http_access allow IPFire_unrestricted_mac"; |
ed38f89d MT |
3538 | if ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') |
3539 | { | |
3540 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3541 | { | |
3542 | if (!-z $disgrp) { print FILE " !for_disabled_users"; } else { print FILE " for_inetusers"; } | |
3543 | } | |
ea72700a | 3544 | if (($proxysettings{'AUTH_METHOD'} eq 'ldap') || ($proxysettings{'AUTH_METHOD'} eq 'radius')) |
ed38f89d MT |
3545 | { |
3546 | print FILE " for_inetusers"; | |
3547 | } | |
ed38f89d | 3548 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) |
363fb6af | 3549 | { |
ed38f89d | 3550 | if ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') |
363fb6af | 3551 | { |
ed38f89d MT |
3552 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && (!-z "$raddir/radauth.allowusers")) |
3553 | { | |
3554 | print FILE " for_acl_users"; | |
3555 | } | |
3556 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && (!-z "$raddir/radauth.denyusers")) | |
3557 | { | |
3558 | print FILE " !for_acl_users"; | |
3559 | } | |
3560 | } else { print FILE " for_inetusers"; } | |
3561 | } | |
3562 | } | |
3563 | print FILE "\n"; | |
3564 | } | |
3565 | ||
3566 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3567 | { | |
3568 | if (!-z $disgrp) { print FILE "http_access deny for_disabled_users\n"; } | |
488d1b7c | 3569 | if (!-z $extgrp) { print FILE "http_access allow IPFire_networks for_extended_users\n"; } |
ed38f89d MT |
3570 | } |
3571 | ||
3572 | if ( | |
ed38f89d MT |
3573 | ( |
3574 | ($proxysettings{'AUTH_METHOD'} eq 'radius') && | |
3575 | ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && | |
3576 | ($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && | |
3577 | (!-z "$raddir/radauth.denyusers") | |
3578 | ) | |
3579 | || | |
3580 | ( | |
3581 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3582 | ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'off') && | |
3583 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3584 | ($proxysettings{'IDENT_USER_ACL'} eq 'negative') && | |
3585 | (!-z "$identdir/identauth.denyusers") | |
3586 | ) | |
3587 | ) | |
3588 | { | |
3589 | print FILE "http_access deny for_acl_users"; | |
3590 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && (!-z "$identdir/hosts")) { print FILE " on_ident_aware_hosts"; } | |
3591 | print FILE "\n"; | |
3592 | } | |
3593 | ||
3594 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on') && (!-z "$identhosts")) | |
3595 | { | |
3596 | print FILE "http_access allow"; | |
3597 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3598 | print FILE " !within_timeframe"; | |
3599 | } else { | |
3600 | print FILE " within_timeframe"; } | |
ed38f89d MT |
3601 | print FILE " !on_ident_aware_hosts\n"; |
3602 | } | |
3603 | ||
488d1b7c | 3604 | print FILE "http_access allow IPFire_networks"; |
ed38f89d | 3605 | if ( |
ed38f89d MT |
3606 | ( |
3607 | ($proxysettings{'AUTH_METHOD'} eq 'radius') && | |
3608 | ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && | |
3609 | ($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && | |
3610 | (!-z "$raddir/radauth.allowusers") | |
3611 | ) | |
3612 | || | |
3613 | ( | |
3614 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3615 | ($proxysettings{'IDENT_REQUIRED'} eq 'on') && | |
3616 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3617 | ($proxysettings{'IDENT_USER_ACL'} eq 'positive') && | |
3618 | (!-z "$identdir/identauth.allowusers") | |
3619 | ) | |
3620 | ) | |
3621 | { | |
3622 | print FILE " for_acl_users"; | |
3623 | } elsif (((!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) || | |
3624 | (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on'))) { | |
3625 | print FILE " for_inetusers"; | |
3626 | } | |
3627 | if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) && (!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) | |
3628 | { | |
3629 | print FILE " !concurrent"; | |
3630 | } | |
3631 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3632 | print FILE " !within_timeframe"; | |
3633 | } else { | |
3634 | print FILE " within_timeframe"; } | |
ed38f89d MT |
3635 | print FILE "\n"; |
3636 | ||
3637 | print FILE "http_access deny all\n\n"; | |
3638 | ||
3639 | if (($proxysettings{'FORWARD_IPADDRESS'} eq 'off') || ($proxysettings{'FORWARD_VIA'} eq 'off') || | |
3640 | (!($proxysettings{'FAKE_USERAGENT'} eq '')) || (!($proxysettings{'FAKE_REFERER'} eq ''))) | |
3641 | { | |
3642 | print FILE "#Strip HTTP Header\n"; | |
3643 | ||
3644 | if ($proxysettings{'FORWARD_IPADDRESS'} eq 'off') | |
3645 | { | |
30793ae1 AF |
3646 | print FILE "request_header_access X-Forwarded-For deny all\n"; |
3647 | print FILE "reply_header_access X-Forwarded-For deny all\n"; | |
ed38f89d MT |
3648 | } |
3649 | if ($proxysettings{'FORWARD_VIA'} eq 'off') | |
3650 | { | |
30793ae1 AF |
3651 | print FILE "request_header_access Via deny all\n"; |
3652 | print FILE "reply_header_access Via deny all\n"; | |
ed38f89d MT |
3653 | } |
3654 | if (!($proxysettings{'FAKE_USERAGENT'} eq '')) | |
3655 | { | |
30793ae1 AF |
3656 | print FILE "request_header_access User-Agent deny all\n"; |
3657 | print FILE "reply_header_access User-Agent deny all\n"; | |
ed38f89d MT |
3658 | } |
3659 | if (!($proxysettings{'FAKE_REFERER'} eq '')) | |
3660 | { | |
30793ae1 AF |
3661 | print FILE "request_header_access Referer deny all\n"; |
3662 | print FILE "reply_header_access Referer deny all\n"; | |
ed38f89d MT |
3663 | } |
3664 | ||
3665 | print FILE "\n"; | |
3666 | ||
3667 | if ((!($proxysettings{'FAKE_USERAGENT'} eq '')) || (!($proxysettings{'FAKE_REFERER'} eq ''))) | |
3668 | { | |
3669 | if (!($proxysettings{'FAKE_USERAGENT'} eq '')) | |
3670 | { | |
3671 | print FILE "header_replace User-Agent $proxysettings{'FAKE_USERAGENT'}\n"; | |
3672 | } | |
3673 | if (!($proxysettings{'FAKE_REFERER'} eq '')) | |
3674 | { | |
3675 | print FILE "header_replace Referer $proxysettings{'FAKE_REFERER'}\n"; | |
3676 | } | |
3677 | print FILE "\n"; | |
3678 | } | |
3679 | } | |
3680 | ||
363fb6af MT |
3681 | if ($proxysettings{'SUPPRESS_VERSION'} eq 'on') { print FILE "httpd_suppress_version_string on\n\n" } |
3682 | ||
ed38f89d | 3683 | if ((!-z $mimetypes) && ($proxysettings{'ENABLE_MIME_FILTER'} eq 'on')) { |
488d1b7c CS |
3684 | if (!-z $acl_src_unrestricted_ip) { print FILE "http_reply_access allow IPFire_unrestricted_ips\n"; } |
3685 | if (!-z $acl_src_unrestricted_mac) { print FILE "http_reply_access allow IPFire_unrestricted_mac\n"; } | |
ed38f89d MT |
3686 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') |
3687 | { | |
3688 | if (!-z $extgrp) { print FILE "http_reply_access allow for_extended_users\n"; } | |
3689 | } | |
3690 | print FILE "http_reply_access deny blocked_mimetypes\n"; | |
3691 | print FILE "http_reply_access allow all\n\n"; | |
3692 | } | |
3693 | ||
ed38f89d MT |
3694 | print FILE "visible_hostname"; |
3695 | if ($proxysettings{'VISIBLE_HOSTNAME'} eq '') | |
3696 | { | |
3697 | print FILE " $mainsettings{'HOSTNAME'}.$mainsettings{'DOMAINNAME'}\n\n"; | |
3698 | } else { | |
3699 | print FILE " $proxysettings{'VISIBLE_HOSTNAME'}\n\n"; | |
3700 | } | |
3701 | ||
fe1656d2 CS |
3702 | if (!($proxysettings{'ADMIN_MAIL_ADDRESS'} eq '')) { print FILE "cache_mgr $proxysettings{'ADMIN_MAIL_ADDRESS'}\n"; } |
3703 | if (!($proxysettings{'ADMIN_PASSWORD'} eq '')) { print FILE "cachemgr_passwd $proxysettings{'ADMIN_PASSWORD'} all\n"; } | |
3704 | print FILE "\n"; | |
3705 | ||
3706 | print FILE "max_filedescriptors $proxysettings{'FILEDESCRIPTORS'}\n\n"; | |
ed38f89d MT |
3707 | |
3708 | # Write the parent proxy info, if needed. | |
3709 | if ($remotehost ne '') | |
3710 | { | |
ed38f89d | 3711 | print FILE "cache_peer $remotehost parent $remoteport 3130 default no-query"; |
363fb6af MT |
3712 | |
3713 | # Enter authentication for the parent cache. Option format is | |
3714 | # login=user:password ($proxy1='YES') | |
3715 | # login=PASS ($proxy1='PASS') | |
3716 | # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on') | |
3717 | if (($proxy1 eq 'YES') || ($proxy1 eq 'PASS')) | |
3718 | { | |
3719 | print FILE " login=$proxysettings{'UPSTREAM_USER'}"; | |
3720 | if ($proxy1 eq 'YES') { print FILE ":$proxysettings{'UPSTREAM_PASSWORD'}"; } | |
ed38f89d | 3721 | } |
363fb6af MT |
3722 | elsif ($proxysettings{'FORWARD_USERNAME'} eq 'on') { print FILE " login=*:password"; } |
3723 | ||
488d1b7c CS |
3724 | print FILE "\nalways_direct allow IPFire_ips\n"; |
3725 | print FILE "never_direct allow all\n\n"; | |
ed38f89d | 3726 | } |
3900a6c7 | 3727 | if (($proxysettings{'ENABLE_FILTER'} eq 'on') || ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') || ($proxysettings{'ENABLE_CLAMAV'} eq 'on')) |
363fb6af MT |
3728 | { |
3729 | print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n"; | |
eedca6e3 MT |
3730 | print FILE "url_rewrite_children ", &General::number_cpu_cores(); |
3731 | print FILE " startup=", &General::number_cpu_cores(); | |
3732 | print FILE " idle=", &General::number_cpu_cores(); | |
3733 | print FILE " queue-size=", &General::number_cpu_cores() * 32, "\n\n"; | |
ed38f89d | 3734 | } |
eb3b93cc MT |
3735 | |
3736 | # Include file with user defined settings. | |
3737 | if (-e "/etc/squid/squid.conf.local") { | |
3738 | print FILE "include /etc/squid/squid.conf.local\n"; | |
3739 | } | |
ed38f89d | 3740 | close FILE; |
dfee7582 SS |
3741 | |
3742 | # Proxy settings for squidclamav - if installed. | |
3743 | # | |
3744 | # Check if squidclamav is enabled. | |
3745 | if ($proxysettings{'ENABLE_CLAMAV'} eq 'on') { | |
3746 | ||
3747 | my $configfile='/etc/squidclamav.conf'; | |
3748 | ||
3749 | my $data = &General::read_file_utf8($configfile); | |
3750 | $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g; | |
3751 | &General::write_file_utf8($configfile, $data); | |
3752 | } | |
ed38f89d MT |
3753 | } |
3754 | ||
3755 | # ------------------------------------------------------------------- | |
3756 | ||
3757 | sub adduser | |
3758 | { | |
3759 | my ($str_user, $str_pass, $str_group) = @_; | |
3760 | my @groupmembers=(); | |
3761 | ||
3762 | if ($str_pass eq 'lEaVeAlOnE') | |
3763 | { | |
3764 | open(FILE, "$userdb"); | |
3765 | @groupmembers = <FILE>; | |
3766 | close(FILE); | |
3767 | foreach $line (@groupmembers) { if ($line =~ /^$str_user:/i) { $str_pass = substr($line,index($line,":")); } } | |
3768 | &deluser($str_user); | |
3769 | open(FILE, ">>$userdb"); | |
3770 | flock FILE,2; | |
3771 | print FILE "$str_user$str_pass"; | |
3772 | close(FILE); | |
3773 | } else { | |
3774 | &deluser($str_user); | |
0aff7b81 MT |
3775 | |
3776 | my $htpasswd = new Apache::Htpasswd("$userdb"); | |
3777 | $htpasswd->htpasswd($str_user, $str_pass); | |
ed38f89d MT |
3778 | } |
3779 | ||
3780 | if ($str_group eq 'standard') { open(FILE, ">>$stdgrp"); | |
3781 | } elsif ($str_group eq 'extended') { open(FILE, ">>$extgrp"); | |
3782 | } elsif ($str_group eq 'disabled') { open(FILE, ">>$disgrp"); } | |
3783 | flock FILE, 2; | |
3784 | print FILE "$str_user\n"; | |
3785 | close(FILE); | |
3786 | ||
3787 | return; | |
3788 | } | |
3789 | ||
3790 | # ------------------------------------------------------------------- | |
3791 | ||
3792 | sub deluser | |
3793 | { | |
3794 | my ($str_user) = @_; | |
3795 | my $groupfile=''; | |
3796 | my @groupmembers=(); | |
3797 | my @templist=(); | |
3798 | ||
3799 | foreach $groupfile ($stdgrp, $extgrp, $disgrp) | |
3800 | { | |
3801 | undef @templist; | |
3802 | open(FILE, "$groupfile"); | |
3803 | @groupmembers = <FILE>; | |
3804 | close(FILE); | |
3805 | foreach $line (@groupmembers) { if (!($line =~ /^$str_user$/i)) { push(@templist, $line); } } | |
3806 | open(FILE, ">$groupfile"); | |
3807 | flock FILE, 2; | |
3808 | print FILE @templist; | |
3809 | close(FILE); | |
3810 | } | |
3811 | ||
3812 | undef @templist; | |
3813 | open(FILE, "$userdb"); | |
3814 | @groupmembers = <FILE>; | |
3815 | close(FILE); | |
3816 | foreach $line (@groupmembers) { if (!($line =~ /^$str_user:/i)) { push(@templist, $line); } } | |
3817 | open(FILE, ">$userdb"); | |
3818 | flock FILE, 2; | |
3819 | print FILE @templist; | |
3820 | close(FILE); | |
3821 | ||
3822 | return; | |
3823 | } | |
ac1cfefa | 3824 | |
ed38f89d | 3825 | # ------------------------------------------------------------------- |
fe1656d2 CS |
3826 | |
3827 | sub writecachemgr | |
3828 | { | |
3829 | open(FILE, ">${General::swroot}/proxy/cachemgr.conf"); | |
3830 | flock(FILE, 2); | |
3831 | print FILE "$netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}\n"; | |
3832 | print FILE "localhost"; | |
d9f2cfa4 | 3833 | close(FILE); |
fe1656d2 CS |
3834 | return; |
3835 | } | |
3836 | ||
bd027d94 | 3837 | # ------------------------------------------------------------------- |