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