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