]>
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 | } | |
f2fdd0c1 | 315 | if (!(&General::validport($proxysettings{'PROXY_PORT'}))) |
363fb6af MT |
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'> | |
885 | <select name='ERR_LANGUAGE'> | |
886 | END | |
887 | ; | |
363fb6af | 888 | foreach (<$errordir/*>) { |
ed38f89d MT |
889 | if (-d) { |
890 | $language = substr($_,rindex($_,"/")+1); | |
891 | print "<option value='$language' $selected{'ERR_LANGUAGE'}{$language}>$language</option>\n"; | |
892 | } | |
893 | } | |
894 | print <<END | |
895 | </select> | |
896 | </td> | |
897 | </tr> | |
10e4f239 | 898 | <tr> |
363fb6af MT |
899 | <td class='base'>$Lang::tr{'advproxy suppress version'}:</td> |
900 | <td><input type='checkbox' name='SUPPRESS_VERSION' $checked{'SUPPRESS_VERSION'}{'on'} /></td> | |
901 | <td class='base'>$Lang::tr{'advproxy error design'}:</td> | |
902 | <td class='base'><select name='ERR_DESIGN'> | |
0d948999 | 903 | <option value='ipfire' $selected{'ERR_DESIGN'}{'ipfire'}>IPFire</option> |
363fb6af MT |
904 | <option value='squid' $selected{'ERR_DESIGN'}{'squid'}>$Lang::tr{'advproxy standard'}</option> |
905 | </select></td> | |
10e4f239 MT |
906 | </tr> |
907 | <tr> | |
363fb6af MT |
908 | <td class='base'>$Lang::tr{'advproxy squid version'}:</td> |
909 | <td class='base'> [<font color='$Header::colourred'> $squidversion[0] </font>]</td> | |
910 | <td> </td> | |
911 | <td> </td> | |
10e4f239 | 912 | </tr> |
ed38f89d MT |
913 | </table> |
914 | <hr size='1'> | |
915 | <table width='100%'> | |
9141bd34 CS |
916 | <tr> |
917 | <td class='base' width='50%'><b>$Lang::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td> | |
918 | <td class='base' width='50%'><b>$Lang::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td> | |
919 | </tr> | |
920 | </table> | |
921 | <hr size='1'> | |
922 | <table width='100%'> | |
ed38f89d MT |
923 | <tr> |
924 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy upstream proxy'}</b></td> | |
925 | </tr> | |
926 | <tr> | |
9141bd34 CS |
927 | <td class='base'>$Lang::tr{'advproxy via forwarding'}:</td><td><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td> |
928 | <td class='base'>$Lang::tr{'advproxy upstream proxy host:port'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td> | |
ed38f89d MT |
929 | </tr> |
930 | <tr> | |
9141bd34 CS |
931 | <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td><td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td> |
932 | <td class='base'>$Lang::tr{'advproxy upstream username'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td> | |
ac1cfefa | 933 | </tr> |
ac1cfefa | 934 | <tr> |
9141bd34 CS |
935 | <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td><td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} /> |
936 | <td class='base'>$Lang::tr{'advproxy upstream password'}:<img src='/blob.gif' alt='*' /></td><td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td> | |
ed38f89d | 937 | </tr> |
363fb6af | 938 | <tr> |
9141bd34 | 939 | <td class='base' colspan='4'>$Lang::tr{'advproxy no connection auth'}:<input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td> |
363fb6af | 940 | </tr> |
ed38f89d MT |
941 | </table> |
942 | <hr size='1'> | |
943 | <table width='100%'> | |
944 | <tr> | |
945 | <td colspan='4' class='base'><b>$Lang::tr{'advproxy log settings'}</b></td> | |
946 | </tr> | |
947 | <tr> | |
9141bd34 CS |
948 | <td class='base'>$Lang::tr{'advproxy log enabled'}:<input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td> |
949 | <td class='base'>$Lang::tr{'advproxy log query'}:<input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td> | |
950 | <td class='base'>$Lang::tr{'advproxy log useragent'}:<input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td> | |
ed38f89d MT |
951 | </tr> |
952 | </table> | |
953 | <hr size='1'> | |
954 | <table width='100%'> | |
955 | <tr> | |
956 | <td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td> | |
957 | </tr> | |
958 | <tr> | |
9141bd34 | 959 | <td width='35%'></td><td width='15%'></td><td width='35%'></td><td width='15%'></td> |
ac1cfefa MT |
960 | </tr> |
961 | <tr> | |
ed38f89d MT |
962 | <td class='base'>$Lang::tr{'advproxy ram cache size'}:</td> |
963 | <td><input type='text' name='CACHE_MEM' value='$proxysettings{'CACHE_MEM'}' size='5' /></td> | |
964 | <td class='base'>$Lang::tr{'advproxy hdd cache size'}:</td> | |
ac1cfefa MT |
965 | <td><input type='text' name='CACHE_SIZE' value='$proxysettings{'CACHE_SIZE'}' size='5' /></td> |
966 | </tr> | |
967 | <tr> | |
ed38f89d | 968 | <td class='base'>$Lang::tr{'advproxy min size'}:</td> |
ac1cfefa | 969 | <td><input type='text' name='MIN_SIZE' value='$proxysettings{'MIN_SIZE'}' size='5' /></td> |
ed38f89d | 970 | <td class='base'>$Lang::tr{'advproxy max size'}:</td> |
ac1cfefa MT |
971 | <td><input type='text' name='MAX_SIZE' value='$proxysettings{'MAX_SIZE'}' size='5' /></td> |
972 | </tr> | |
973 | <tr> | |
ed38f89d | 974 | <td class='base'>$Lang::tr{'advproxy number of L1 dirs'}:</td> |
363fb6af MT |
975 | <td class='base'><select name='L1_DIRS'> |
976 | <option value='16' $selected{'L1_DIRS'}{'16'}>16</option> | |
977 | <option value='32' $selected{'L1_DIRS'}{'32'}>32</option> | |
978 | <option value='64' $selected{'L1_DIRS'}{'64'}>64</option> | |
979 | <option value='128' $selected{'L1_DIRS'}{'128'}>128</option> | |
980 | <option value='256' $selected{'L1_DIRS'}{'256'}>256</option> | |
981 | </select></td> | |
ed38f89d | 982 | <td colspan='2' rowspan= '5' valign='top' class='base'> |
363fb6af | 983 | <table cellspacing='0' cellpadding='0'> |
ed38f89d MT |
984 | <tr> |
985 | <!-- intentionally left empty --> | |
986 | </tr> | |
987 | <tr> | |
988 | <td>$Lang::tr{'advproxy no cache sites'}: <img src='/blob.gif' alt='*' /></td> | |
989 | </tr> | |
990 | <tr> | |
991 | <!-- intentionally left empty --> | |
992 | </tr> | |
993 | <tr> | |
994 | <!-- intentionally left empty --> | |
995 | </tr> | |
996 | <tr> | |
9141bd34 | 997 | <td align=center><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
998 | END |
999 | ; | |
1000 | ||
1001 | print $proxysettings{'DST_NOCACHE'}; | |
1002 | ||
1003 | print <<END | |
1004 | </textarea></td> | |
1005 | </tr> | |
1006 | </table> | |
1007 | </td> | |
1008 | </tr> | |
1009 | <tr> | |
363fb6af MT |
1010 | <td class='base'>$Lang::tr{'advproxy memory replacement policy'}:</td> |
1011 | <td class='base'><select name='MEM_POLICY'> | |
1012 | <option value='LRU' $selected{'MEM_POLICY'}{'LRU'}>LRU</option> | |
1013 | <option value='heap LFUDA' $selected{'MEM_POLICY'}{'heap LFUDA'}>heap LFUDA</option> | |
1014 | <option value='heap GDSF' $selected{'MEM_POLICY'}{'heap GDSF'}>heap GDSF</option> | |
1015 | <option value='heap LRU' $selected{'MEM_POLICY'}{'heap LRU'}>heap LRU</option> | |
1016 | </select></td> | |
ed38f89d MT |
1017 | </tr> |
1018 | <tr> | |
363fb6af MT |
1019 | <td class='base'>$Lang::tr{'advproxy cache replacement policy'}:</td> |
1020 | <td class='base'><select name='CACHE_POLICY'> | |
1021 | <option value='LRU' $selected{'CACHE_POLICY'}{'LRU'}>LRU</option> | |
1022 | <option value='heap LFUDA' $selected{'CACHE_POLICY'}{'heap LFUDA'}>heap LFUDA</option> | |
1023 | <option value='heap GDSF' $selected{'CACHE_POLICY'}{'heap GDSF'}>heap GDSF</option> | |
1024 | <option value='heap LRU' $selected{'CACHE_POLICY'}{'heap LRU'}>heap LRU</option> | |
1025 | </select></td> | |
ed38f89d MT |
1026 | </tr> |
1027 | <tr> | |
1028 | <td colspan='2'> </td> | |
1029 | </tr> | |
1030 | <tr> | |
363fb6af | 1031 | <td class='base'>$Lang::tr{'advproxy offline mode'}:</td> |
ed38f89d MT |
1032 | <td><input type='checkbox' name='OFFLINE_MODE' $checked{'OFFLINE_MODE'}{'on'} /></td> |
1033 | </tr> | |
1034 | </table> | |
1035 | <hr size='1'> | |
1036 | <table width='100%'> | |
363fb6af MT |
1037 | <tr> |
1038 | <td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td> | |
1039 | </tr> | |
1040 | <tr> | |
9141bd34 | 1041 | <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td> |
363fb6af MT |
1042 | </tr> |
1043 | <tr> | |
1044 | <td colspan='2' class='base'>$Lang::tr{'advproxy standard ports'}:</td> | |
1045 | <td colspan='2' class='base'>$Lang::tr{'advproxy ssl ports'}:</td> | |
1046 | </tr> | |
1047 | <tr> | |
1048 | <td colspan='2'><textarea name='PORTS_SAFE' cols='32' rows='6' wrap='off'> | |
1049 | END | |
1050 | ; | |
1051 | if (!$proxysettings{'PORTS_SAFE'}) { print $def_ports_safe; } else { print $proxysettings{'PORTS_SAFE'}; } | |
1052 | ||
1053 | print <<END | |
1054 | </textarea></td> | |
1055 | <td colspan='2'><textarea name='PORTS_SSL' cols='32' rows='6' wrap='off'> | |
1056 | END | |
1057 | ; | |
1058 | if (!$proxysettings{'PORTS_SSL'}) { print $def_ports_ssl; } else { print $proxysettings{'PORTS_SSL'}; } | |
1059 | ||
1060 | print <<END | |
1061 | </textarea></td> | |
1062 | </tr> | |
1063 | </table> | |
1064 | <hr size='1'> | |
1065 | <table width='100%'> | |
ed38f89d MT |
1066 | <tr> |
1067 | <td colspan='4'><b>$Lang::tr{'advproxy network based access'}</b></td> | |
1068 | </tr> | |
1069 | <tr> | |
1070 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1071 | </tr> | |
1072 | <tr> | |
9fb25b1c | 1073 | <td colspan='4' class='base'>$Lang::tr{'advproxy allowed subnets'}:</td> |
ed38f89d MT |
1074 | </tr> |
1075 | <tr> | |
9141bd34 | 1076 | <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1077 | END |
1078 | ; | |
1079 | ||
363fb6af MT |
1080 | if (!$proxysettings{'SRC_SUBNETS'}) |
1081 | { | |
ed38f89d | 1082 | print "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n"; |
363fb6af MT |
1083 | if ($netsettings{'BLUE_DEV'}) |
1084 | { | |
1085 | print "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n"; | |
ed38f89d | 1086 | } |
363fb6af | 1087 | } else { print $proxysettings{'SRC_SUBNETS'}; } |
ed38f89d MT |
1088 | |
1089 | print <<END | |
1090 | </textarea></td> | |
9fb25b1c MT |
1091 | END |
1092 | ; | |
1093 | ||
1094 | $line = $Lang::tr{'advproxy no internal proxy on green'}; | |
1095 | $line =~ s/Green/<font color="$Header::colourgreen">Green<\/font>/i; | |
1096 | print "<td class='base'>$line:</td>\n"; | |
1097 | print <<END | |
1098 | <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked{'NO_PROXY_LOCAL'}{'on'} /></td> | |
1099 | </tr> | |
1100 | END | |
1101 | ; | |
1102 | if ($netsettings{'BLUE_DEV'}) { | |
1103 | $line = $Lang::tr{'advproxy no internal proxy on blue'}; | |
1104 | $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/font>/i; | |
1105 | print "<tr>\n"; | |
1106 | print "<td class='base'>$line:</td>\n"; | |
1107 | print <<END | |
1108 | <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} /></td> | |
1109 | </tr> | |
1110 | END | |
1111 | ; | |
1112 | } | |
1113 | print <<END | |
1114 | <tr> | |
1115 | <td colspan='2'> </td> | |
1116 | </tr> | |
1117 | <tr> | |
ed38f89d MT |
1118 | <td colspan='2'> </td> |
1119 | </tr> | |
1120 | </table> | |
1121 | <table width='100%'> | |
1122 | <tr> | |
1123 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1124 | </tr> | |
1125 | <tr> | |
1126 | <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted ip clients'}: <img src='/blob.gif' alt='*' /></td> | |
1127 | <td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td> | |
1128 | </tr> | |
1129 | <tr> | |
9141bd34 | 1130 | <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1131 | END |
1132 | ; | |
1133 | ||
1134 | print $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
1135 | ||
1136 | print <<END | |
1137 | </textarea></td> | |
9141bd34 | 1138 | <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1139 | END |
1140 | ; | |
1141 | ||
1142 | print $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
1143 | ||
1144 | print <<END | |
1145 | </textarea></td> | |
1146 | </tr> | |
1147 | </table> | |
1148 | <table width='100%'> | |
1149 | <tr> | |
1150 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1151 | </tr> | |
1152 | <tr> | |
1153 | <td colspan='2' class='base'>$Lang::tr{'advproxy banned ip clients'}: <img src='/blob.gif' alt='*' /></td> | |
1154 | <td colspan='2' class='base'>$Lang::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td> | |
1155 | </tr> | |
1156 | <tr> | |
9141bd34 | 1157 | <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1158 | END |
1159 | ; | |
1160 | ||
1161 | print $proxysettings{'SRC_BANNED_IP'}; | |
1162 | ||
1163 | print <<END | |
1164 | </textarea></td> | |
9141bd34 | 1165 | <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'> |
ed38f89d MT |
1166 | END |
1167 | ; | |
1168 | ||
1169 | print $proxysettings{'SRC_BANNED_MAC'}; | |
1170 | ||
1171 | print <<END | |
1172 | </textarea></td> | |
1173 | </tr> | |
1174 | </table> | |
1175 | ||
1176 | <hr size='1'> | |
1177 | ||
1178 | END | |
1179 | ; | |
1180 | # ------------------------------------------------------------------- | |
1181 | # CRE GUI - optional | |
1182 | # ------------------------------------------------------------------- | |
1183 | ||
1184 | if (-e $cre_enabled) { print <<END | |
1185 | <table width='100%'> | |
1186 | ||
1187 | <tr> | |
9141bd34 | 1188 | <td colspan='4'><b>$Lang::tr{'advproxy classroom extensions'}</b> $Lang::tr{'advproxy enabled'}:<input type='checkbox' name='CLASSROOM_EXT' $checked{'CLASSROOM_EXT'}{'on'} /></td> |
ed38f89d MT |
1189 | </tr> |
1190 | <tr> | |
1191 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1192 | </tr> | |
1193 | <tr> | |
9141bd34 CS |
1194 | |
1195 | END | |
1196 | ; | |
1197 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){ | |
1198 | print <<END | |
ed38f89d MT |
1199 | <td class='base'>$Lang::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td> |
1200 | <td><input type='password' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' size='12' /></td> | |
1201 | </tr> | |
1202 | <tr> | |
1203 | <td colspan='2' class='base'>$Lang::tr{'advproxy cre group definitions'}:</td> | |
1204 | <td colspan='2' class='base'>$Lang::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td> | |
9141bd34 CS |
1205 | END |
1206 | ; | |
1207 | } | |
1208 | print "</tr>"; | |
1209 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){ | |
1210 | print <<END | |
ed38f89d MT |
1211 | <tr> |
1212 | <td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'> | |
1213 | END | |
1214 | ; | |
1215 | ||
1216 | print $proxysettings{'CRE_GROUPS'}; | |
1217 | ||
1218 | print <<END | |
1219 | </textarea></td> | |
1220 | <td colspan='2'><textarea name='CRE_SVHOSTS' cols='32' rows='6' wrap='off'> | |
1221 | END | |
1222 | ; | |
1223 | print $proxysettings{'CRE_SVHOSTS'}; | |
1224 | ||
1225 | print <<END | |
1226 | </textarea></td> | |
1227 | </tr> | |
ed38f89d MT |
1228 | END |
1229 | ; | |
9141bd34 CS |
1230 | } |
1231 | print "</table><hr size='1'>"; | |
1232 | ||
ed38f89d MT |
1233 | } else { |
1234 | print <<END | |
1235 | <input type='hidden' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' /> | |
1236 | <input type='hidden' name='CRE_GROUPS' value='$proxysettings{'CRE_GROUPS'}' /> | |
1237 | <input type='hidden' name='CRE_SVHOSTS' value='$proxysettings{'CRE_SVHOSTS'}' /> | |
1238 | END | |
1239 | ; | |
1240 | } | |
363fb6af | 1241 | |
ed38f89d MT |
1242 | # ------------------------------------------------------------------- |
1243 | ||
1244 | print <<END | |
1245 | ||
1246 | <table width='100%'> | |
1247 | <tr> | |
363fb6af | 1248 | <td colspan='4'><b>$Lang::tr{'advproxy time restrictions'}</b></td> |
ed38f89d MT |
1249 | </tr> |
1250 | <table width='100%'> | |
1251 | <tr> | |
1252 | <td width='2%'>$Lang::tr{'advproxy access'}</td> | |
1253 | <td width='1%'> </td> | |
1254 | <td width='2%' align='center'>$Lang::tr{'advproxy monday'}</td> | |
1255 | <td width='2%' align='center'>$Lang::tr{'advproxy tuesday'}</td> | |
1256 | <td width='2%' align='center'>$Lang::tr{'advproxy wednesday'}</td> | |
1257 | <td width='2%' align='center'>$Lang::tr{'advproxy thursday'}</td> | |
1258 | <td width='2%' align='center'>$Lang::tr{'advproxy friday'}</td> | |
1259 | <td width='2%' align='center'>$Lang::tr{'advproxy saturday'}</td> | |
1260 | <td width='2%' align='center'>$Lang::tr{'advproxy sunday'}</td> | |
1261 | <td width='1%'> </td> | |
1262 | <td width='7%' colspan=3>$Lang::tr{'advproxy from'}</td> | |
1263 | <td width='1%'> </td> | |
1264 | <td width='7%' colspan=3>$Lang::tr{'advproxy to'}</td> | |
1265 | <td> </td> | |
1266 | </tr> | |
1267 | <tr> | |
1268 | <td class='base'> | |
1269 | <select name='TIME_ACCESS_MODE'> | |
1270 | <option value='allow' $selected{'TIME_ACCESS_MODE'}{'allow'}>$Lang::tr{'advproxy mode allow'}</option> | |
1271 | <option value='deny' $selected{'TIME_ACCESS_MODE'}{'deny'}>$Lang::tr{'advproxy mode deny'}</option> | |
1272 | </select> | |
1273 | </td> | |
1274 | <td> </td> | |
1275 | <td class='base'><input type='checkbox' name='TIME_MON' $checked{'TIME_MON'}{'on'} /></td> | |
1276 | <td class='base'><input type='checkbox' name='TIME_TUE' $checked{'TIME_TUE'}{'on'} /></td> | |
1277 | <td class='base'><input type='checkbox' name='TIME_WED' $checked{'TIME_WED'}{'on'} /></td> | |
1278 | <td class='base'><input type='checkbox' name='TIME_THU' $checked{'TIME_THU'}{'on'} /></td> | |
1279 | <td class='base'><input type='checkbox' name='TIME_FRI' $checked{'TIME_FRI'}{'on'} /></td> | |
1280 | <td class='base'><input type='checkbox' name='TIME_SAT' $checked{'TIME_SAT'}{'on'} /></td> | |
1281 | <td class='base'><input type='checkbox' name='TIME_SUN' $checked{'TIME_SUN'}{'on'} /></td> | |
1282 | <td> </td> | |
1283 | <td class='base'> | |
1284 | <select name='TIME_FROM_HOUR'> | |
1285 | END | |
1286 | ; | |
1287 | for ($i=0;$i<=24;$i++) { | |
1288 | $_ = sprintf("%02s",$i); | |
1289 | print "<option $selected{'TIME_FROM_HOUR'}{$_}>$_</option>\n"; | |
1290 | } | |
1291 | print <<END | |
1292 | </select> | |
1293 | </td> | |
1294 | <td>:</td> | |
1295 | <td class='base'> | |
1296 | <select name='TIME_FROM_MINUTE'> | |
1297 | END | |
1298 | ; | |
1299 | for ($i=0;$i<=45;$i+=15) { | |
1300 | $_ = sprintf("%02s",$i); | |
1301 | print "<option $selected{'TIME_FROM_MINUTE'}{$_}>$_</option>\n"; | |
1302 | } | |
1303 | print <<END | |
1304 | </select> | |
1305 | <td> - </td> | |
1306 | </td> | |
1307 | <td class='base'> | |
1308 | <select name='TIME_TO_HOUR'> | |
1309 | END | |
1310 | ; | |
1311 | for ($i=0;$i<=24;$i++) { | |
1312 | $_ = sprintf("%02s",$i); | |
1313 | print "<option $selected{'TIME_TO_HOUR'}{$_}>$_</option>\n"; | |
1314 | } | |
1315 | print <<END | |
1316 | </select> | |
1317 | </td> | |
1318 | <td>:</td> | |
1319 | <td class='base'> | |
1320 | <select name='TIME_TO_MINUTE'> | |
1321 | END | |
1322 | ; | |
1323 | for ($i=0;$i<=45;$i+=15) { | |
1324 | $_ = sprintf("%02s",$i); | |
1325 | print "<option $selected{'TIME_TO_MINUTE'}{$_}>$_</option>\n"; | |
1326 | } | |
1327 | print <<END | |
1328 | </select> | |
1329 | </td> | |
1330 | </tr> | |
1331 | </table> | |
1332 | <hr size='1'> | |
1333 | <table width='100%'> | |
1334 | <tr> | |
1335 | <td colspan='4'><b>$Lang::tr{'advproxy transfer limits'}</b></td> | |
ac1cfefa MT |
1336 | </tr> |
1337 | <tr> | |
ed38f89d MT |
1338 | <td width='25%' class='base'>$Lang::tr{'advproxy max download size'}:</td> |
1339 | <td width='20%'><input type='text' name='MAX_INCOMING_SIZE' value='$proxysettings{'MAX_INCOMING_SIZE'}' size='5' /></td> | |
1340 | <td width='25%' class='base'>$Lang::tr{'advproxy max upload size'}:</td> | |
1341 | <td width='30%'><input type='text' name='MAX_OUTGOING_SIZE' value='$proxysettings{'MAX_OUTGOING_SIZE'}' size='5' /></td> | |
ac1cfefa MT |
1342 | </tr> |
1343 | </table> | |
ed38f89d | 1344 | <hr size='1'> |
ac1cfefa | 1345 | <table width='100%'> |
ac1cfefa | 1346 | <tr> |
ed38f89d MT |
1347 | <td colspan='4'><b>$Lang::tr{'advproxy download throttling'}</b></td> |
1348 | </tr> | |
1349 | <tr> | |
1350 | <td width='25%' class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourgreen">Green</font>:</td> | |
1351 | <td width='20%' class='base'> | |
1352 | <select name='THROTTLING_GREEN_TOTAL'> | |
1353 | END | |
1354 | ; | |
1355 | ||
1356 | foreach (@throttle_limits) { | |
1357 | print "\t<option value='$_' $selected{'THROTTLING_GREEN_TOTAL'}{$_}>$_ kBit/s</option>\n"; | |
1358 | } | |
1359 | ||
1360 | print <<END | |
1361 | <option value='0' $selected{'THROTTLING_GREEN_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1362 | </select> | |
1363 | </td> | |
1364 | <td width='25%' class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourgreen">Green</font>:</td> | |
1365 | <td width='30%' class='base'> | |
1366 | <select name='THROTTLING_GREEN_HOST'> | |
1367 | END | |
1368 | ; | |
1369 | ||
1370 | foreach (@throttle_limits) { | |
1371 | print "\t<option value='$_' $selected{'THROTTLING_GREEN_HOST'}{$_}>$_ kBit/s</option>\n"; | |
1372 | } | |
1373 | ||
1374 | print <<END | |
1375 | <option value='0' $selected{'THROTTLING_GREEN_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1376 | </select> | |
1377 | </td> | |
1378 | </tr> | |
1379 | END | |
1380 | ; | |
1381 | ||
1382 | if ($netsettings{'BLUE_DEV'}) { | |
1383 | print <<END | |
1384 | <tr> | |
1385 | <td class='base'>$Lang::tr{'advproxy throttling total on'} <font color="$Header::colourblue">Blue</font>:</td> | |
1386 | <td class='base'> | |
1387 | <select name='THROTTLING_BLUE_TOTAL'> | |
1388 | END | |
1389 | ; | |
1390 | ||
1391 | foreach (@throttle_limits) { | |
1392 | print "\t<option value='$_' $selected{'THROTTLING_BLUE_TOTAL'}{$_}>$_ kBit/s</option>\n"; | |
1393 | } | |
1394 | ||
1395 | print <<END | |
1396 | <option value='0' $selected{'THROTTLING_BLUE_TOTAL'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1397 | </select> | |
1398 | </td> | |
1399 | <td class='base'>$Lang::tr{'advproxy throttling per host on'} <font color="$Header::colourblue">Blue</font>:</td> | |
1400 | <td class='base'> | |
1401 | <select name='THROTTLING_BLUE_HOST'> | |
1402 | END | |
1403 | ; | |
1404 | ||
1405 | foreach (@throttle_limits) { | |
1406 | print "\t<option value='$_' $selected{'THROTTLING_BLUE_HOST'}{$_}>$_ kBit/s</option>\n"; | |
1407 | } | |
1408 | ||
1409 | print <<END | |
1410 | <option value='0' $selected{'THROTTLING_BLUE_HOST'}{'unlimited'}>$Lang::tr{'advproxy throttling unlimited'}</option>\n"; | |
1411 | </select> | |
ac1cfefa | 1412 | </td> |
ac1cfefa | 1413 | </tr> |
ed38f89d MT |
1414 | END |
1415 | ; | |
1416 | } | |
ac1cfefa | 1417 | |
ed38f89d MT |
1418 | print <<END |
1419 | </table> | |
1420 | <table width='100%'> | |
1421 | <tr> | |
1422 | <td colspan='4'><i>$Lang::tr{'advproxy content based throttling'}:</i></td> | |
1423 | </tr> | |
1424 | <tr> | |
1425 | <td width='15%' class='base'>$Lang::tr{'advproxy throttle binary'}:</td> | |
1426 | <td width='10%'><input type='checkbox' name='THROTTLE_BINARY' $checked{'THROTTLE_BINARY'}{'on'} /></td> | |
1427 | <td width='15%' class='base'>$Lang::tr{'advproxy throttle dskimg'}:</td> | |
1428 | <td width='10%'><input type='checkbox' name='THROTTLE_DSKIMG' $checked{'THROTTLE_DSKIMG'}{'on'} /></td> | |
1429 | <td width='15%' class='base'>$Lang::tr{'advproxy throttle mmedia'}:</td> | |
1430 | <td width='10%'><input type='checkbox' name='THROTTLE_MMEDIA' $checked{'THROTTLE_MMEDIA'}{'on'} /></td> | |
363fb6af MT |
1431 | <td width='15%'> </td> |
1432 | <td width='10%'> </td> | |
ed38f89d | 1433 | </tr> |
ac1cfefa | 1434 | </table> |
ed38f89d MT |
1435 | <hr size='1'> |
1436 | <table width='100%'> | |
1437 | <tr> | |
9141bd34 | 1438 | <td colspan='4'><b>$Lang::tr{'advproxy MIME filter'}</b> $Lang::tr{'advproxy enabled'}:<input type='checkbox' name='ENABLE_MIME_FILTER' $checked{'ENABLE_MIME_FILTER'}{'on'} /></td> |
ed38f89d | 1439 | </tr> |
9141bd34 CS |
1440 | END |
1441 | ; | |
1442 | if ( $proxysettings{'ENABLE_MIME_FILTER'} eq 'on' ){ | |
1443 | print <<END | |
ed38f89d MT |
1444 | <tr> |
1445 | <td colspan='2' class='base'>$Lang::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td> | |
363fb6af MT |
1446 | <td> </td> |
1447 | <td> </td> | |
ed38f89d MT |
1448 | </tr> |
1449 | <tr> | |
1450 | <td colspan='2'><textarea name='MIME_TYPES' cols='32' rows='6' wrap='off'> | |
ac1cfefa MT |
1451 | END |
1452 | ; | |
ac1cfefa | 1453 | |
ed38f89d | 1454 | print $proxysettings{'MIME_TYPES'}; |
ac1cfefa | 1455 | |
ed38f89d MT |
1456 | print <<END |
1457 | </textarea></td> | |
363fb6af MT |
1458 | <td> </td> |
1459 | <td> </td> | |
ed38f89d | 1460 | </tr> |
9141bd34 CS |
1461 | END |
1462 | ; | |
1463 | } | |
1464 | print <<END | |
ed38f89d | 1465 | </table> |
9141bd34 | 1466 | |
ed38f89d MT |
1467 | <hr size='1'> |
1468 | <table width='100%'> | |
1469 | <tr> | |
9141bd34 | 1470 | <td colspan='4'><b>$Lang::tr{'advproxy web browser'}</b> $Lang::tr{'advproxy UA enable filter'}:<input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td> |
ed38f89d | 1471 | </tr> |
9141bd34 CS |
1472 | END |
1473 | ; | |
1474 | if ( $proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on' ){ | |
1475 | print <<END | |
ed38f89d MT |
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 | } | |
9141bd34 | 1500 | } |
ed38f89d MT |
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> | |
ed38f89d MT |
1510 | <td class='base'>$Lang::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td> |
1511 | </tr> | |
1512 | <tr> | |
9141bd34 | 1513 | <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td> |
ed38f89d MT |
1514 | <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='56' /></td> |
1515 | </tr> | |
1516 | </table> | |
1517 | <hr size='1'> | |
1518 | END | |
1519 | ; | |
1520 | ||
9fb25b1c | 1521 | print <<END |
ed38f89d MT |
1522 | <table width='100%'> |
1523 | <tr> | |
363fb6af | 1524 | <td colspan='5'><b>$Lang::tr{'advproxy AUTH method'}</b></td> |
ed38f89d MT |
1525 | </tr> |
1526 | <tr> | |
1527 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked{'AUTH_METHOD'}{'none'} />$Lang::tr{'advproxy AUTH method none'}</td> | |
1528 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked{'AUTH_METHOD'}{'ncsa'} />$Lang::tr{'advproxy AUTH method ncsa'}</td> | |
1529 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked{'AUTH_METHOD'}{'ident'} />$Lang::tr{'advproxy AUTH method ident'}</td> | |
1530 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked{'AUTH_METHOD'}{'ldap'} />$Lang::tr{'advproxy AUTH method ldap'}</td> | |
1531 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked{'AUTH_METHOD'}{'ntlm'} />$Lang::tr{'advproxy AUTH method ntlm'}</td> | |
1532 | <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked{'AUTH_METHOD'}{'radius'} />$Lang::tr{'advproxy AUTH method radius'}</td> | |
1533 | </tr> | |
1534 | </table> | |
1535 | END | |
1536 | ; | |
1537 | ||
1538 | if (!($proxysettings{'AUTH_METHOD'} eq 'none')) { if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { print <<END | |
1539 | <hr size='1'> | |
1540 | <table width='100%'> | |
1541 | <tr> | |
363fb6af | 1542 | <td colspan='4'><b>$Lang::tr{'advproxy AUTH global settings'}</b></td> |
ed38f89d MT |
1543 | </tr> |
1544 | <tr> | |
1545 | <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td> | |
1546 | </tr> | |
1547 | <tr> | |
1548 | <td class='base'>$Lang::tr{'advproxy AUTH number of auth processes'}:</td> | |
1549 | <td><input type='text' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}' size='5' /></td> | |
1550 | <td colspan='2' rowspan= '6' valign='top' class='base'> | |
1551 | <table cellpadding='0' cellspacing='0'> | |
1552 | <tr> | |
1553 | <td class='base'>$Lang::tr{'advproxy AUTH realm'}: <img src='/blob.gif' alt='*' /></td> | |
1554 | </tr> | |
1555 | <tr> | |
1556 | <!-- intentionally left empty --> | |
1557 | </tr> | |
1558 | <tr> | |
1559 | <!-- intentionally left empty --> | |
1560 | </tr> | |
1561 | <tr> | |
1562 | <td><input type='text' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}' size='40' /></td> | |
1563 | </tr> | |
1564 | <tr> | |
1565 | <!-- intentionally left empty --> | |
1566 | </tr> | |
1567 | <tr> | |
1568 | <!-- intentionally left empty --> | |
1569 | </tr> | |
1570 | <tr> | |
1571 | <td>$Lang::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td> | |
1572 | </tr> | |
1573 | <tr> | |
1574 | <!-- intentionally left empty --> | |
1575 | </tr> | |
1576 | <tr> | |
1577 | <!-- intentionally left empty --> | |
1578 | </tr> | |
1579 | <tr> | |
1580 | <td><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'> | |
1581 | END | |
1582 | ; | |
1583 | ||
1584 | print $proxysettings{'DST_NOAUTH'}; | |
1585 | ||
1586 | print <<END | |
1587 | </textarea></td> | |
1588 | </tr> | |
1589 | </table> | |
1590 | </td> | |
1591 | </tr> | |
1592 | <tr> | |
1593 | <td class='base'>$Lang::tr{'advproxy AUTH auth cache TTL'}:</td> | |
1594 | <td><input type='text' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
1595 | </tr> | |
1596 | <tr> | |
1597 | <td class='base'>$Lang::tr{'advproxy AUTH limit of IP addresses'}: <img src='/blob.gif' alt='*' /></td> | |
1598 | <td><input type='text' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
1599 | </tr> | |
1600 | <tr> | |
1601 | <td class='base'>$Lang::tr{'advproxy AUTH user IP cache TTL'}:</td> | |
1602 | <td><input type='text' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td> | |
1603 | </tr> | |
1604 | <tr> | |
363fb6af MT |
1605 | <td class='base'>$Lang::tr{'advproxy AUTH always required'}:</td> |
1606 | <td><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td> | |
ed38f89d MT |
1607 | </tr> |
1608 | <tr> | |
1609 | <td colspan='2'> </td> | |
1610 | </tr> | |
1611 | </table> | |
1612 | END | |
1613 | ; | |
1614 | } | |
1615 | ||
1616 | # =================================================================== | |
1617 | # NCSA auth settings | |
1618 | # =================================================================== | |
1619 | ||
1620 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') { | |
1621 | print <<END | |
1622 | <hr size='1'> | |
1623 | <table width='100%'> | |
1624 | <tr> | |
1625 | <td colspan='4'><b>$Lang::tr{'advproxy NCSA auth'}</b></td> | |
1626 | </tr> | |
1627 | <tr> | |
1628 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA min password length'}:</td> | |
1629 | <td width='20%'><input type='text' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}' size='5' /></td> | |
1630 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA redirector bypass'} \'$Lang::tr{'advproxy NCSA grp extended'}\':</td> | |
363fb6af | 1631 | <td width='20%'><input type='checkbox' name='NCSA_BYPASS_REDIR' $checked{'NCSA_BYPASS_REDIR'}{'on'} /></td> |
ed38f89d MT |
1632 | </tr> |
1633 | <tr> | |
1634 | <td colspan='2'><br> <input type='submit' name='ACTION' value='$Lang::tr{'advproxy NCSA user management'}'></td> | |
1635 | <td> </td> | |
1636 | <td> </td> | |
1637 | </tr> | |
1638 | </table> | |
1639 | END | |
1640 | ; } | |
1641 | ||
1642 | # =================================================================== | |
1643 | # IDENTD auth settings | |
1644 | # =================================================================== | |
1645 | ||
1646 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { | |
1647 | print <<END | |
1648 | <hr size ='1'> | |
1649 | <table width='100%'> | |
1650 | <tr> | |
1651 | <td colspan='4'><b>$Lang::tr{'advproxy IDENT identd settings'}</b></td> | |
1652 | </tr> | |
1653 | <tr> | |
1654 | <td width='25%' class='base'>$Lang::tr{'advproxy IDENT required'}:</td> | |
363fb6af MT |
1655 | <td width='20%'><input type='checkbox' name='IDENT_REQUIRED' $checked{'IDENT_REQUIRED'}{'on'} /></td> |
1656 | <td width='25%' class='base'>$Lang::tr{'advproxy AUTH always required'}:</td> | |
1657 | <td width='30%'><input type='checkbox' name='AUTH_ALWAYS_REQUIRED' $checked{'AUTH_ALWAYS_REQUIRED'}{'on'} /></td> | |
ed38f89d MT |
1658 | </tr> |
1659 | <tr> | |
1660 | <td class='base'>$Lang::tr{'advproxy IDENT timeout'}:</td> | |
1661 | <td><input type='text' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}' size='5' /></td> | |
1662 | <td> </td> | |
1663 | <td> </td> | |
1664 | </tr> | |
1665 | <tr> | |
1666 | <td colspan='2' class='base'>$Lang::tr{'advproxy IDENT aware hosts'}:</td> | |
1667 | <td colspan='2' class='base'>$Lang::tr{'advproxy AUTH no auth'}: <img src='/blob.gif' alt='*' /></td> | |
1668 | </tr> | |
1669 | <tr> | |
1670 | <td colspan='2'><textarea name='IDENT_HOSTS' cols='32' rows='6' wrap='off'> | |
1671 | END | |
1672 | ; | |
1673 | if (!$proxysettings{'IDENT_HOSTS'}) { | |
1674 | print "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n"; | |
1675 | if ($netsettings{'BLUE_DEV'}) { | |
1676 | print "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n"; | |
1677 | } | |
1678 | } else { | |
1679 | print $proxysettings{'IDENT_HOSTS'}; | |
1680 | } | |
1681 | ||
1682 | print <<END | |
1683 | </textarea></td> | |
1684 | <td colspan='2'><textarea name='DST_NOAUTH' cols='32' rows='6' wrap='off'> | |
1685 | END | |
1686 | ; | |
1687 | ||
1688 | print $proxysettings{'DST_NOAUTH'}; | |
1689 | ||
1690 | print <<END | |
1691 | </textarea></td> | |
1692 | </tr> | |
1693 | </table> | |
1694 | <hr size ='1'> | |
1695 | <table width='100%'> | |
1696 | <tr> | |
1697 | <td colspan='4'><b>$Lang::tr{'advproxy IDENT user based access restrictions'}</b></td> | |
1698 | </tr> | |
1699 | <tr> | |
1700 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
1701 | <td width='20%'><input type='checkbox' name='IDENT_ENABLE_ACL' $checked{'IDENT_ENABLE_ACL'}{'on'} /></td> | |
1702 | <td width='25%'> </td> | |
1703 | <td width='30%'> </td> | |
1704 | </tr> | |
1705 | <tr> | |
1706 | <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='positive' $checked{'IDENT_USER_ACL'}{'positive'} /> | |
1707 | $Lang::tr{'advproxy IDENT use positive access list'}:</td> | |
1708 | <td colspan='2'><input type='radio' name='IDENT_USER_ACL' value='negative' $checked{'IDENT_USER_ACL'}{'negative'} /> | |
1709 | $Lang::tr{'advproxy IDENT use negative access list'}:</td> | |
1710 | </tr> | |
1711 | <tr> | |
1712 | <td colspan='2'>$Lang::tr{'advproxy IDENT authorized users'}</td> | |
1713 | <td colspan='2'>$Lang::tr{'advproxy IDENT unauthorized users'}</td> | |
1714 | </tr> | |
1715 | <tr> | |
363fb6af | 1716 | <td colspan='2'><textarea name='IDENT_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1717 | END |
1718 | ; } | |
1719 | ||
1720 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_ALLOW_USERS'}; } | |
1721 | ||
1722 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END | |
1723 | </textarea></td> | |
363fb6af | 1724 | <td colspan='2'><textarea name='IDENT_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1725 | END |
1726 | ; } | |
1727 | ||
1728 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print $proxysettings{'IDENT_DENY_USERS'}; } | |
1729 | ||
1730 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { print <<END | |
1731 | </textarea></td> | |
1732 | </tr> | |
1733 | </table> | |
1734 | END | |
1735 | ; } | |
1736 | ||
1737 | # =================================================================== | |
1738 | # NTLM auth settings | |
1739 | # =================================================================== | |
1740 | ||
1741 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { | |
1742 | print <<END | |
1743 | <hr size='1'> | |
1744 | <table width='100%'> | |
1745 | <tr> | |
1746 | <td colspan='6'><b>$Lang::tr{'advproxy NTLM domain settings'}</b></td> | |
1747 | </tr> | |
1748 | <tr> | |
1749 | <td class='base'>$Lang::tr{'advproxy NTLM domain'}:</td> | |
1750 | <td><input type='text' name='NTLM_DOMAIN' value='$proxysettings{'NTLM_DOMAIN'}' size='15' /></td> | |
1751 | <td class='base'>$Lang::tr{'advproxy NTLM PDC hostname'}:</td> | |
1752 | <td><input type='text' name='NTLM_PDC' value='$proxysettings{'NTLM_PDC'}' size='14' /></td> | |
1753 | <td class='base'>$Lang::tr{'advproxy NTLM BDC hostname'}: <img src='/blob.gif' alt='*' /></td> | |
1754 | <td><input type='text' name='NTLM_BDC' value='$proxysettings{'NTLM_BDC'}' size='14' /></td> | |
1755 | </tr> | |
1756 | </table> | |
1757 | <hr size ='1'> | |
1758 | <table width='100%'> | |
1759 | <tr> | |
1760 | <td colspan='3'><b>$Lang::tr{'advproxy NTLM auth mode'}</b></td> | |
1761 | </tr> | |
1762 | <tr> | |
1763 | <td width='25%' class='base' width='25%'>$Lang::tr{'advproxy NTLM use integrated auth'}:</td> | |
1764 | <td width='20%'><input type='checkbox' name='NTLM_ENABLE_INT_AUTH' $checked{'NTLM_ENABLE_INT_AUTH'}{'on'} /></td> | |
1765 | <td> </td> | |
1766 | </tr> | |
1767 | </table> | |
1768 | <hr size ='1'> | |
1769 | <table width='100%'> | |
1770 | <tr> | |
1771 | <td colspan='4'><b>$Lang::tr{'advproxy NTLM user based access restrictions'}</b></td> | |
1772 | </tr> | |
1773 | <tr> | |
1774 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
1775 | <td width='20%'><input type='checkbox' name='NTLM_ENABLE_ACL' $checked{'NTLM_ENABLE_ACL'}{'on'} /></td> | |
1776 | <td width='25%'> </td> | |
1777 | <td width='30%'> </td> | |
1778 | </tr> | |
1779 | <tr> | |
1780 | <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='positive' $checked{'NTLM_USER_ACL'}{'positive'} /> | |
1781 | $Lang::tr{'advproxy NTLM use positive access list'}:</td> | |
1782 | <td colspan='2'><input type='radio' name='NTLM_USER_ACL' value='negative' $checked{'NTLM_USER_ACL'}{'negative'} /> | |
1783 | $Lang::tr{'advproxy NTLM use negative access list'}:</td> | |
1784 | </tr> | |
1785 | <tr> | |
1786 | <td colspan='2'>$Lang::tr{'advproxy NTLM authorized users'}</td> | |
1787 | <td colspan='2'>$Lang::tr{'advproxy NTLM unauthorized users'}</td> | |
1788 | </tr> | |
1789 | <tr> | |
363fb6af | 1790 | <td colspan='2'><textarea name='NTLM_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1791 | END |
1792 | ; } | |
1793 | ||
1794 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_ALLOW_USERS'}; } | |
1795 | ||
1796 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END | |
1797 | </textarea></td> | |
363fb6af | 1798 | <td colspan='2'><textarea name='NTLM_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1799 | END |
1800 | ; } | |
1801 | ||
1802 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print $proxysettings{'NTLM_DENY_USERS'}; } | |
1803 | ||
1804 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') { print <<END | |
1805 | </textarea></td> | |
1806 | </tr> | |
1807 | </table> | |
1808 | END | |
1809 | ; } | |
1810 | ||
1811 | # =================================================================== | |
1812 | # LDAP auth settings | |
1813 | # =================================================================== | |
1814 | ||
1815 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') { | |
1816 | print <<END | |
1817 | <hr size='1'> | |
1818 | <table width='100%'> | |
1819 | <tr> | |
1820 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP common settings'}</b></td> | |
1821 | </tr> | |
1822 | <tr> | |
1823 | <td class='base'>$Lang::tr{'advproxy LDAP basedn'}:</td> | |
1824 | <td><input type='text' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}' size='37' /></td> | |
1825 | <td class='base'>$Lang::tr{'advproxy LDAP type'}:</td> | |
1826 | <td class='base'><select name='LDAP_TYPE'> | |
1827 | <option value='ADS' $selected{'LDAP_TYPE'}{'ADS'}>$Lang::tr{'advproxy LDAP ADS'}</option> | |
1828 | <option value='NDS' $selected{'LDAP_TYPE'}{'NDS'}>$Lang::tr{'advproxy LDAP NDS'}</option> | |
1829 | <option value='V2' $selected{'LDAP_TYPE'}{'V2'}>$Lang::tr{'advproxy LDAP V2'}</option> | |
1830 | <option value='V3' $selected{'LDAP_TYPE'}{'V3'}>$Lang::tr{'advproxy LDAP V3'}</option> | |
1831 | </select></td> | |
1832 | </tr> | |
1833 | <tr> | |
1834 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP server'}:</td> | |
1835 | <td width='40%'><input type='text' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}' size='14' /></td> | |
1836 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP port'}:</td> | |
1837 | <td><input type='text' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}' size='3' /></td> | |
1838 | </tr> | |
1839 | </table> | |
1840 | <hr size ='1'> | |
1841 | <table width='100%'> | |
1842 | <tr> | |
1843 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP binddn settings'}</b></td> | |
1844 | </tr> | |
1845 | <tr> | |
1846 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn username'}:</td> | |
1847 | <td width='40%'><input type='text' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}' size='37' /></td> | |
1848 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP binddn password'}:</td> | |
1849 | <td><input type='password' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}' size='14' /></td> | |
1850 | </tr> | |
1851 | </table> | |
1852 | <hr size ='1'> | |
1853 | <table width='100%'> | |
1854 | <tr> | |
1855 | <td colspan='4'><b>$Lang::tr{'advproxy LDAP group access control'}</b></td> | |
1856 | </tr> | |
1857 | <tr> | |
1858 | <td width='20%' class='base'>$Lang::tr{'advproxy LDAP group required'}: <img src='/blob.gif' alt='*' /></td> | |
1859 | <td width='40%'><input type='text' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}' size='37' /></td> | |
1860 | <td> </td> | |
1861 | <td> </td> | |
1862 | </tr> | |
1863 | </table> | |
1864 | END | |
1865 | ; } | |
1866 | ||
1867 | # =================================================================== | |
1868 | # RADIUS auth settings | |
1869 | # =================================================================== | |
1870 | ||
1871 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { | |
1872 | print <<END | |
1873 | <hr size='1'> | |
1874 | <table width='100%'> | |
1875 | <tr> | |
1876 | <td colspan='4'><b>$Lang::tr{'advproxy RADIUS radius settings'}</b></td> | |
1877 | </tr> | |
1878 | <tr> | |
1879 | <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS server'}:</td> | |
1880 | <td width='20%'><input type='text' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}' size='14' /></td> | |
1881 | <td width='25%' class='base'>$Lang::tr{'advproxy RADIUS port'}:</td> | |
1882 | <td width='30%'><input type='text' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}' size='3' /></td> | |
1883 | </tr> | |
1884 | <tr> | |
1885 | <td class='base'>$Lang::tr{'advproxy RADIUS identifier'}: <img src='/blob.gif' alt='*' /></td> | |
1886 | <td><input type='text' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}' size='14' /></td> | |
1887 | <td class='base'>$Lang::tr{'advproxy RADIUS secret'}:</td> | |
1888 | <td><input type='password' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}' size='14' /></td> | |
1889 | </tr> | |
1890 | </table> | |
1891 | <hr size ='1'> | |
1892 | <table width='100%'> | |
1893 | <tr> | |
1894 | <td colspan='4'><b>$Lang::tr{'advproxy RADIUS user based access restrictions'}</b></td> | |
1895 | </tr> | |
1896 | <tr> | |
1897 | <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td> | |
1898 | <td width='20%'><input type='checkbox' name='RADIUS_ENABLE_ACL' $checked{'RADIUS_ENABLE_ACL'}{'on'} /></td> | |
1899 | <td width='25%'> </td> | |
1900 | <td width='30%'> </td> | |
1901 | </tr> | |
1902 | <tr> | |
1903 | <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='positive' $checked{'RADIUS_USER_ACL'}{'positive'} /> | |
1904 | $Lang::tr{'advproxy RADIUS use positive access list'}:</td> | |
1905 | <td colspan='2'><input type='radio' name='RADIUS_USER_ACL' value='negative' $checked{'RADIUS_USER_ACL'}{'negative'} /> | |
1906 | $Lang::tr{'advproxy RADIUS use negative access list'}:</td> | |
1907 | </tr> | |
1908 | <tr> | |
1909 | <td colspan='2'>$Lang::tr{'advproxy RADIUS authorized users'}</td> | |
1910 | <td colspan='2'>$Lang::tr{'advproxy RADIUS unauthorized users'}</td> | |
1911 | </tr> | |
1912 | <tr> | |
363fb6af | 1913 | <td colspan='2'><textarea name='RADIUS_ALLOW_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1914 | END |
1915 | ; } | |
1916 | ||
1917 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_ALLOW_USERS'}; } | |
1918 | ||
1919 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END | |
1920 | </textarea></td> | |
363fb6af | 1921 | <td colspan='2'><textarea name='RADIUS_DENY_USERS' cols='32' rows='6' wrap='off'> |
ed38f89d MT |
1922 | END |
1923 | ; } | |
1924 | ||
1925 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print $proxysettings{'RADIUS_DENY_USERS'}; } | |
1926 | ||
1927 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') { print <<END | |
1928 | </textarea></td> | |
1929 | </tr> | |
1930 | </table> | |
1931 | END | |
1932 | ; } | |
1933 | ||
1934 | # =================================================================== | |
1935 | ||
1936 | } | |
1937 | ||
1938 | print "<table>\n"; | |
1939 | ||
1940 | if ($proxysettings{'AUTH_METHOD'} eq 'none') { | |
1941 | print <<END | |
1942 | <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td> | |
1943 | <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
1944 | <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
1945 | <td><input type='hidden' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td> | |
1946 | <td><input type='hidden' name='AUTH_ALWAYS_REQUIRED' value='$proxysettings{'AUTH_ALWAYS_REQUIRED'}'></td> | |
1947 | <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td> | |
1948 | <td><input type='hidden' name='DST_NOAUTH' value='$proxysettings{'DST_NOAUTH'}'></td> | |
1949 | END | |
1950 | ; } | |
1951 | ||
1952 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') { | |
1953 | print <<END | |
1954 | <td><input type='hidden' name='AUTH_CHILDREN' value='$proxysettings{'AUTH_CHILDREN'}'></td> | |
1955 | <td><input type='hidden' name='AUTH_CACHE_TTL' value='$proxysettings{'AUTH_CACHE_TTL'}' size='5' /></td> | |
1956 | <td><input type='hidden' name='AUTH_MAX_USERIP' value='$proxysettings{'AUTH_MAX_USERIP'}' size='5' /></td> | |
1957 | <td><input type='hidden' name='AUTH_IPCACHE_TTL' value='$proxysettings{'AUTH_IPCACHE_TTL'}' size='5' /></td> | |
1958 | <td><input type='hidden' name='AUTH_REALM' value='$proxysettings{'AUTH_REALM'}'></td> | |
1959 | END | |
1960 | ; } | |
1961 | ||
1962 | if (!($proxysettings{'AUTH_METHOD'} eq 'ncsa')) { | |
1963 | print <<END | |
1964 | <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td> | |
1965 | <td><input type='hidden' name='NCSA_BYPASS_REDIR' value='$proxysettings{'NCSA_BYPASS_REDIR'}'></td> | |
1966 | END | |
1967 | ; } | |
1968 | ||
1969 | if (!($proxysettings{'AUTH_METHOD'} eq 'ident')) { | |
1970 | print <<END | |
1971 | <td><input type='hidden' name='IDENT_REQUIRED' value='$proxysettings{'IDENT_REQUIRED'}'></td> | |
1972 | <td><input type='hidden' name='IDENT_TIMEOUT' value='$proxysettings{'IDENT_TIMEOUT'}'></td> | |
1973 | <td><input type='hidden' name='IDENT_HOSTS' value='$proxysettings{'IDENT_HOSTS'}'></td> | |
1974 | <td><input type='hidden' name='IDENT_ENABLE_ACL' value='$proxysettings{'IDENT_ENABLE_ACL'}'></td> | |
1975 | <td><input type='hidden' name='IDENT_USER_ACL' value='$proxysettings{'IDENT_USER_ACL'}'></td> | |
1976 | <td><input type='hidden' name='IDENT_ALLOW_USERS' value='$proxysettings{'IDENT_ALLOW_USERS'}'></td> | |
1977 | <td><input type='hidden' name='IDENT_DENY_USERS' value='$proxysettings{'IDENT_DENY_USERS'}'></td> | |
1978 | END | |
1979 | ; } | |
1980 | ||
1981 | if (!($proxysettings{'AUTH_METHOD'} eq 'ldap')) { | |
1982 | print <<END | |
1983 | <td><input type='hidden' name='LDAP_BASEDN' value='$proxysettings{'LDAP_BASEDN'}'></td> | |
1984 | <td><input type='hidden' name='LDAP_TYPE' value='$proxysettings{'LDAP_TYPE'}'></td> | |
1985 | <td><input type='hidden' name='LDAP_SERVER' value='$proxysettings{'LDAP_SERVER'}'></td> | |
1986 | <td><input type='hidden' name='LDAP_PORT' value='$proxysettings{'LDAP_PORT'}'></td> | |
1987 | <td><input type='hidden' name='LDAP_BINDDN_USER' value='$proxysettings{'LDAP_BINDDN_USER'}'></td> | |
1988 | <td><input type='hidden' name='LDAP_BINDDN_PASS' value='$proxysettings{'LDAP_BINDDN_PASS'}'></td> | |
1989 | <td><input type='hidden' name='LDAP_GROUP' value='$proxysettings{'LDAP_GROUP'}'></td> | |
1990 | END | |
1991 | ; } | |
1992 | ||
1993 | if (!($proxysettings{'AUTH_METHOD'} eq 'ntlm')) { | |
1994 | print <<END | |
1995 | <td><input type='hidden' name='NTLM_DOMAIN' value='$proxysettings{'NTLM_DOMAIN'}'></td> | |
1996 | <td><input type='hidden' name='NTLM_PDC' value='$proxysettings{'NTLM_PDC'}'></td> | |
1997 | <td><input type='hidden' name='NTLM_BDC' value='$proxysettings{'NTLM_BDC'}'></td> | |
1998 | <td><input type='hidden' name='NTLM_ENABLE_INT_AUTH' value='$proxysettings{'NTLM_ENABLE_INT_AUTH'}'></td> | |
1999 | <td><input type='hidden' name='NTLM_ENABLE_ACL' value='$proxysettings{'NTLM_ENABLE_ACL'}'></td> | |
2000 | <td><input type='hidden' name='NTLM_USER_ACL' value='$proxysettings{'NTLM_USER_ACL'}'></td> | |
2001 | <td><input type='hidden' name='NTLM_ALLOW_USERS' value='$proxysettings{'NTLM_ALLOW_USERS'}'></td> | |
2002 | <td><input type='hidden' name='NTLM_DENY_USERS' value='$proxysettings{'NTLM_DENY_USERS'}'></td> | |
2003 | END | |
2004 | ; } | |
2005 | ||
2006 | if (!($proxysettings{'AUTH_METHOD'} eq 'radius')) { | |
2007 | print <<END | |
2008 | <td><input type='hidden' name='RADIUS_SERVER' value='$proxysettings{'RADIUS_SERVER'}'></td> | |
2009 | <td><input type='hidden' name='RADIUS_PORT' value='$proxysettings{'RADIUS_PORT'}'></td> | |
2010 | <td><input type='hidden' name='RADIUS_IDENTIFIER' value='$proxysettings{'RADIUS_IDENTIFIER'}'></td> | |
2011 | <td><input type='hidden' name='RADIUS_SECRET' value='$proxysettings{'RADIUS_SECRET'}'></td> | |
2012 | <td><input type='hidden' name='RADIUS_ENABLE_ACL' value='$proxysettings{'RADIUS_ENABLE_ACL'}'></td> | |
2013 | <td><input type='hidden' name='RADIUS_USER_ACL' value='$proxysettings{'RADIUS_USER_ACL'}'></td> | |
2014 | <td><input type='hidden' name='RADIUS_ALLOW_USERS' value='$proxysettings{'RADIUS_ALLOW_USERS'}'></td> | |
2015 | <td><input type='hidden' name='RADIUS_DENY_USERS' value='$proxysettings{'RADIUS_DENY_USERS'}'></td> | |
2016 | END | |
2017 | ; } | |
2018 | ||
2019 | print "</table>\n"; | |
2020 | ||
2021 | print <<END | |
2022 | <hr size='1'> | |
2023 | END | |
2024 | ; | |
2025 | ||
2026 | print <<END | |
2027 | <table width='100%'> | |
2028 | <tr> | |
363fb6af | 2029 | <td> </td> |
ed38f89d MT |
2030 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td> |
2031 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy save and restart'}' /></td> | |
363fb6af MT |
2032 | <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy clear cache'}' /></td> |
2033 | <td> </td> | |
ed38f89d MT |
2034 | </tr> |
2035 | ||
2036 | </table> | |
2037 | <br /> | |
2038 | <table width='100%'> | |
2039 | <tr> | |
2040 | <td><img src='/blob.gif' align='top' alt='*' /> | |
2041 | <font class='base'>$Lang::tr{'this field may be blank'}</font> | |
2042 | </td> | |
363fb6af | 2043 | <td align='right'> </td> |
ed38f89d MT |
2044 | </tr> |
2045 | </table> | |
2046 | </form> | |
2047 | END | |
2048 | ; | |
2049 | ||
2050 | &Header::closebox(); | |
2051 | ||
2052 | } else { | |
2053 | ||
2054 | # =================================================================== | |
2055 | # NCSA user management | |
2056 | # =================================================================== | |
2057 | ||
2058 | &Header::openbox('100%', 'left', "$Lang::tr{'advproxy NCSA auth'}"); | |
2059 | print <<END | |
2060 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
2061 | <table width='100%'> | |
2062 | <tr> | |
363fb6af | 2063 | <td colspan='4'><b>$Lang::tr{'advproxy NCSA user management'}</b></td> |
ed38f89d MT |
2064 | </tr> |
2065 | <tr> | |
2066 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA username'}:</td> | |
2067 | <td width='25%'><input type='text' name='NCSA_USERNAME' value='$proxysettings{'NCSA_USERNAME'}' size='12' | |
2068 | END | |
2069 | ; | |
2070 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly "; } | |
2071 | print <<END | |
2072 | /></td> | |
2073 | <td width='25%' class='base'>$Lang::tr{'advproxy NCSA group'}:</td> | |
2074 | <td class='base'> | |
2075 | <select name='NCSA_GROUP'> | |
2076 | <option value='standard' $selected{'NCSA_GROUP'}{'standard'}>$Lang::tr{'advproxy NCSA grp standard'}</option> | |
2077 | <option value='extended' $selected{'NCSA_GROUP'}{'extended'}>$Lang::tr{'advproxy NCSA grp extended'}</option> | |
2078 | <option value='disabled' $selected{'NCSA_GROUP'}{'disabled'}>$Lang::tr{'advproxy NCSA grp disabled'}</option> | |
2079 | </select> | |
2080 | </td> | |
2081 | ||
2082 | </tr> | |
2083 | <tr> | |
2084 | <td class='base'>$Lang::tr{'advproxy NCSA password'}:</td> | |
2085 | <td><input type='password' name='NCSA_PASS' value='$proxysettings{'NCSA_PASS'}' size='14' /></td> | |
2086 | <td class='base'>$Lang::tr{'advproxy NCSA password confirm'}:</td> | |
2087 | <td><input type='password' name='NCSA_PASS_CONFIRM' value='$proxysettings{'NCSA_PASS_CONFIRM'}' size='14' /></td> | |
2088 | </tr> | |
2089 | </table> | |
2090 | <br> | |
2091 | <table> | |
2092 | <tr> | |
2093 | <td> </td> | |
2094 | <td><input type='submit' name='SUBMIT' value='$ncsa_buttontext' /></td> | |
2095 | <td><input type='hidden' name='ACTION' value='$Lang::tr{'add'}' /></td> | |
2096 | <td><input type='hidden' name='NCSA_MIN_PASS_LEN' value='$proxysettings{'NCSA_MIN_PASS_LEN'}'></td> | |
2097 | END | |
2098 | ; | |
2099 | if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { | |
2100 | print "<td><input type='reset' name='ACTION' value='$Lang::tr{'advproxy reset'}' /></td>\n"; | |
2101 | } | |
2102 | ||
2103 | print <<END | |
2104 | <td> </td> | |
2105 | <td> </td> | |
2106 | <td><input type='button' name='return2main' value='$Lang::tr{'advproxy back to main page'}' onClick='self.location.href="$ENV{'SCRIPT_NAME'}"'></td> | |
2107 | </tr> | |
2108 | </table> | |
2109 | </form> | |
2110 | <hr size='1'> | |
2111 | <table width='100%'> | |
2112 | <tr> | |
363fb6af | 2113 | <td><b>$Lang::tr{'advproxy NCSA user accounts'}:</b></td> |
ed38f89d MT |
2114 | </tr> |
2115 | </table> | |
2116 | <table width='100%' align='center'> | |
2117 | END | |
2118 | ; | |
2119 | ||
2120 | if (-e $extgrp) | |
2121 | { | |
2122 | open(FILE, $extgrp); @grouplist = <FILE>; close(FILE); | |
2123 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":extended"); } | |
2124 | } | |
2125 | if (-e $stdgrp) | |
2126 | { | |
2127 | open(FILE, $stdgrp); @grouplist = <FILE>; close(FILE); | |
2128 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":standard"); } | |
2129 | } | |
2130 | if (-e $disgrp) | |
2131 | { | |
2132 | open(FILE, $disgrp); @grouplist = <FILE>; close(FILE); | |
2133 | foreach $user (@grouplist) { chomp($user); push(@userlist,$user.":disabled"); } | |
2134 | } | |
2135 | ||
2136 | @userlist = sort(@userlist); | |
2137 | ||
2138 | # If the password file contains entries, print entries and action icons | |
2139 | ||
22527178 | 2140 | if ( $userdb ne "" ) { |
ed38f89d MT |
2141 | print <<END |
2142 | <tr> | |
2143 | <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA username'}</i></b></td> | |
2144 | <td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA group membership'}</i></b></td> | |
2145 | <td class='boldbase' colspan='2' align='center'> </td> | |
2146 | </tr> | |
2147 | END | |
2148 | ; | |
2149 | $id = 0; | |
2150 | foreach $line (@userlist) | |
2151 | { | |
2152 | $id++; | |
2153 | chomp($line); | |
2154 | @temp = split(/:/,$line); | |
2155 | if($proxysettings{'ACTION'} eq $Lang::tr{'edit'} && $proxysettings{'ID'} eq $line) { | |
2156 | print "<tr bgcolor='$Header::colouryellow'>\n"; } | |
2157 | elsif ($id % 2) { | |
2158 | print "<tr bgcolor='$Header::table1colour'>\n"; } | |
2159 | else { | |
2160 | print "<tr bgcolor='$Header::table2colour'>\n"; } | |
2161 | ||
2162 | print <<END | |
2163 | <td align='center'>$temp[0]</td> | |
2164 | <td align='center'> | |
2165 | END | |
2166 | ; | |
2167 | if ($temp[1] eq 'standard') { | |
2168 | print $Lang::tr{'advproxy NCSA grp standard'}; | |
2169 | } elsif ($temp[1] eq 'extended') { | |
2170 | print $Lang::tr{'advproxy NCSA grp extended'}; | |
2171 | } elsif ($temp[1] eq 'disabled') { | |
2172 | print $Lang::tr{'advproxy NCSA grp disabled'}; } | |
2173 | print <<END | |
2174 | </td> | |
2175 | <td width='8%' align='center'> | |
2176 | <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'> | |
2177 | <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' title='$Lang::tr{'edit'}' alt='$Lang::tr{'edit'}' /> | |
2178 | <input type='hidden' name='ID' value='$line' /> | |
2179 | <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' /> | |
2180 | </form> | |
2181 | </td> | |
2182 | ||
2183 | <td width='8%' align='center'> | |
2184 | <form method='post' name='frmb$id' action='$ENV{'SCRIPT_NAME'}'> | |
2185 | <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' title='$Lang::tr{'remove'}' alt='$Lang::tr{'remove'}' /> | |
2186 | <input type='hidden' name='ID' value='$temp[0]' /> | |
2187 | <input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' /> | |
2188 | </form> | |
2189 | </td> | |
2190 | </tr> | |
2191 | END | |
2192 | ; | |
2193 | } | |
2194 | ||
2195 | print <<END | |
2196 | </table> | |
2197 | <br> | |
9fb25b1c | 2198 | <table> |
ed38f89d MT |
2199 | <tr> |
2200 | <td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td> | |
2201 | <td> <img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td> | |
2202 | <td class='base'>$Lang::tr{'edit'}</td> | |
2203 | <td> <img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td> | |
2204 | <td class='base'>$Lang::tr{'remove'}</td> | |
2205 | </tr> | |
2206 | END | |
2207 | ; | |
2208 | } else { | |
2209 | print <<END | |
2210 | <tr> | |
363fb6af | 2211 | <td><i>$Lang::tr{'advproxy NCSA no accounts'}</i></td> |
ed38f89d MT |
2212 | </tr> |
2213 | END | |
2214 | ; | |
2215 | } | |
2216 | ||
2217 | print <<END | |
2218 | </table> | |
2219 | END | |
2220 | ; | |
2221 | ||
2222 | &Header::closebox(); | |
2223 | ||
2224 | } | |
2225 | ||
2226 | # =================================================================== | |
2227 | ||
2228 | &Header::closebigbox(); | |
2229 | ||
2230 | &Header::closepage(); | |
2231 | ||
2232 | # ------------------------------------------------------------------- | |
2233 | ||
2234 | sub read_acls | |
2235 | { | |
2236 | if (-e "$acl_src_subnets") { | |
2237 | open(FILE,"$acl_src_subnets"); | |
2238 | delete $proxysettings{'SRC_SUBNETS'}; | |
2239 | while (<FILE>) { $proxysettings{'SRC_SUBNETS'} .= $_ }; | |
2240 | close(FILE); | |
2241 | } | |
2242 | if (-e "$acl_src_banned_ip") { | |
2243 | open(FILE,"$acl_src_banned_ip"); | |
2244 | delete $proxysettings{'SRC_BANNED_IP'}; | |
2245 | while (<FILE>) { $proxysettings{'SRC_BANNED_IP'} .= $_ }; | |
2246 | close(FILE); | |
2247 | } | |
2248 | if (-e "$acl_src_banned_mac") { | |
2249 | open(FILE,"$acl_src_banned_mac"); | |
2250 | delete $proxysettings{'SRC_BANNED_MAC'}; | |
2251 | while (<FILE>) { $proxysettings{'SRC_BANNED_MAC'} .= $_ }; | |
2252 | close(FILE); | |
2253 | } | |
2254 | if (-e "$acl_src_unrestricted_ip") { | |
2255 | open(FILE,"$acl_src_unrestricted_ip"); | |
2256 | delete $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2257 | while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_ }; | |
2258 | close(FILE); | |
2259 | } | |
2260 | if (-e "$acl_src_unrestricted_mac") { | |
2261 | open(FILE,"$acl_src_unrestricted_mac"); | |
2262 | delete $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2263 | while (<FILE>) { $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_ }; | |
2264 | close(FILE); | |
2265 | } | |
2266 | if (-e "$acl_dst_nocache") { | |
2267 | open(FILE,"$acl_dst_nocache"); | |
2268 | delete $proxysettings{'DST_NOCACHE'}; | |
2269 | while (<FILE>) { $proxysettings{'DST_NOCACHE'} .= $_ }; | |
2270 | close(FILE); | |
2271 | } | |
2272 | if (-e "$acl_dst_noauth") { | |
2273 | open(FILE,"$acl_dst_noauth"); | |
2274 | delete $proxysettings{'DST_NOAUTH'}; | |
2275 | while (<FILE>) { $proxysettings{'DST_NOAUTH'} .= $_ }; | |
2276 | close(FILE); | |
2277 | } | |
363fb6af MT |
2278 | if (-e "$acl_ports_safe") { |
2279 | open(FILE,"$acl_ports_safe"); | |
2280 | delete $proxysettings{'PORTS_SAFE'}; | |
2281 | while (<FILE>) { $proxysettings{'PORTS_SAFE'} .= $_ }; | |
2282 | close(FILE); | |
2283 | } | |
2284 | if (-e "$acl_ports_ssl") { | |
2285 | open(FILE,"$acl_ports_ssl"); | |
2286 | delete $proxysettings{'PORTS_SSL'}; | |
2287 | while (<FILE>) { $proxysettings{'PORTS_SSL'} .= $_ }; | |
2288 | close(FILE); | |
2289 | } | |
ed38f89d MT |
2290 | if (-e "$mimetypes") { |
2291 | open(FILE,"$mimetypes"); | |
2292 | delete $proxysettings{'MIME_TYPES'}; | |
2293 | while (<FILE>) { $proxysettings{'MIME_TYPES'} .= $_ }; | |
2294 | close(FILE); | |
2295 | } | |
2296 | if (-e "$ntlmdir/msntauth.allowusers") { | |
2297 | open(FILE,"$ntlmdir/msntauth.allowusers"); | |
2298 | delete $proxysettings{'NTLM_ALLOW_USERS'}; | |
2299 | while (<FILE>) { $proxysettings{'NTLM_ALLOW_USERS'} .= $_ }; | |
2300 | close(FILE); | |
2301 | } | |
2302 | if (-e "$ntlmdir/msntauth.denyusers") { | |
2303 | open(FILE,"$ntlmdir/msntauth.denyusers"); | |
2304 | delete $proxysettings{'NTLM_DENY_USERS'}; | |
2305 | while (<FILE>) { $proxysettings{'NTLM_DENY_USERS'} .= $_ }; | |
2306 | close(FILE); | |
2307 | } | |
2308 | if (-e "$raddir/radauth.allowusers") { | |
2309 | open(FILE,"$raddir/radauth.allowusers"); | |
2310 | delete $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2311 | while (<FILE>) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_ }; | |
2312 | close(FILE); | |
2313 | } | |
2314 | if (-e "$raddir/radauth.denyusers") { | |
2315 | open(FILE,"$raddir/radauth.denyusers"); | |
2316 | delete $proxysettings{'RADIUS_DENY_USERS'}; | |
2317 | while (<FILE>) { $proxysettings{'RADIUS_DENY_USERS'} .= $_ }; | |
2318 | close(FILE); | |
2319 | } | |
2320 | if (-e "$identdir/identauth.allowusers") { | |
2321 | open(FILE,"$identdir/identauth.allowusers"); | |
2322 | delete $proxysettings{'IDENT_ALLOW_USERS'}; | |
2323 | while (<FILE>) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_ }; | |
2324 | close(FILE); | |
2325 | } | |
2326 | if (-e "$identdir/identauth.denyusers") { | |
2327 | open(FILE,"$identdir/identauth.denyusers"); | |
2328 | delete $proxysettings{'IDENT_DENY_USERS'}; | |
2329 | while (<FILE>) { $proxysettings{'IDENT_DENY_USERS'} .= $_ }; | |
2330 | close(FILE); | |
2331 | } | |
2332 | if (-e "$identhosts") { | |
2333 | open(FILE,"$identhosts"); | |
2334 | delete $proxysettings{'IDENT_HOSTS'}; | |
2335 | while (<FILE>) { $proxysettings{'IDENT_HOSTS'} .= $_ }; | |
2336 | close(FILE); | |
2337 | } | |
2338 | if (-e "$cre_groups") { | |
2339 | open(FILE,"$cre_groups"); | |
2340 | delete $proxysettings{'CRE_GROUPS'}; | |
2341 | while (<FILE>) { $proxysettings{'CRE_GROUPS'} .= $_ }; | |
2342 | close(FILE); | |
2343 | } | |
2344 | if (-e "$cre_svhosts") { | |
2345 | open(FILE,"$cre_svhosts"); | |
2346 | delete $proxysettings{'CRE_SVHOSTS'}; | |
2347 | while (<FILE>) { $proxysettings{'CRE_SVHOSTS'} .= $_ }; | |
2348 | close(FILE); | |
2349 | } | |
2350 | } | |
2351 | ||
2352 | # ------------------------------------------------------------------- | |
2353 | ||
2354 | sub check_acls | |
2355 | { | |
363fb6af MT |
2356 | @temp = split(/\n/,$proxysettings{'PORTS_SAFE'}); |
2357 | undef $proxysettings{'PORTS_SAFE'}; | |
2358 | foreach (@temp) | |
2359 | { | |
2360 | s/^\s+//g; s/\s+$//g; | |
2361 | if ($_) | |
2362 | { | |
2363 | $line = $_; | |
2364 | if (/^[^#]+\s+#\sSquids\sport/) { s/(^[^#]+)(\s+#\sSquids\sport)/$proxysettings{'PROXY_PORT'}\2/; $line=$_; } | |
2365 | s/#.*//g; s/\s+//g; | |
2366 | if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } | |
2367 | @templist = split(/-/); | |
2368 | foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } } | |
2369 | $proxysettings{'PORTS_SAFE'} .= $line."\n"; | |
2370 | } | |
2371 | } | |
2372 | ||
2373 | @temp = split(/\n/,$proxysettings{'PORTS_SSL'}); | |
2374 | undef $proxysettings{'PORTS_SSL'}; | |
2375 | foreach (@temp) | |
2376 | { | |
2377 | s/^\s+//g; s/\s+$//g; | |
2378 | if ($_) | |
2379 | { | |
2380 | $line = $_; | |
2381 | s/#.*//g; s/\s+//g; | |
2382 | if (/.*-.*-.*/) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } | |
2383 | @templist = split(/-/); | |
2384 | foreach (@templist) { unless (&General::validport($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid destination port'}; } } | |
2385 | $proxysettings{'PORTS_SSL'} .= $line."\n"; | |
2386 | } | |
2387 | } | |
2388 | ||
2389 | @temp = split(/\n/,$proxysettings{'DST_NOCACHE'}); | |
2390 | undef $proxysettings{'DST_NOCACHE'}; | |
2391 | foreach (@temp) | |
2392 | { | |
2393 | s/^\s+//g; s/\s+$//g; | |
2394 | if ($_) | |
2395 | { | |
2396 | unless (/^\./) { $_ = '.'.$_; } | |
2397 | $proxysettings{'DST_NOCACHE'} .= $_."\n"; | |
2398 | } | |
2399 | } | |
2400 | ||
ed38f89d MT |
2401 | @temp = split(/\n/,$proxysettings{'SRC_SUBNETS'}); |
2402 | undef $proxysettings{'SRC_SUBNETS'}; | |
2403 | foreach (@temp) | |
2404 | { | |
2405 | s/^\s+//g; s/\s+$//g; | |
2406 | if ($_) | |
2407 | { | |
2408 | unless (&General::validipandmask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2409 | $proxysettings{'SRC_SUBNETS'} .= $_."\n"; | |
2410 | } | |
2411 | } | |
2412 | ||
2413 | @temp = split(/\n/,$proxysettings{'SRC_BANNED_IP'}); | |
2414 | undef $proxysettings{'SRC_BANNED_IP'}; | |
2415 | foreach (@temp) | |
2416 | { | |
2417 | s/^\s+//g; s/\s+$//g; | |
2418 | if ($_) | |
2419 | { | |
2420 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2421 | $proxysettings{'SRC_BANNED_IP'} .= $_."\n"; | |
2422 | } | |
2423 | } | |
2424 | ||
2425 | @temp = split(/\n/,$proxysettings{'SRC_BANNED_MAC'}); | |
2426 | undef $proxysettings{'SRC_BANNED_MAC'}; | |
2427 | foreach (@temp) | |
2428 | { | |
2429 | s/^\s+//g; s/\s+$//g; s/-/:/g; | |
2430 | if ($_) | |
2431 | { | |
2432 | unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; } | |
2433 | $proxysettings{'SRC_BANNED_MAC'} .= $_."\n"; | |
2434 | } | |
2435 | } | |
2436 | ||
2437 | @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_IP'}); | |
2438 | undef $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2439 | foreach (@temp) | |
2440 | { | |
2441 | s/^\s+//g; s/\s+$//g; | |
2442 | if ($_) | |
2443 | { | |
2444 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2445 | $proxysettings{'SRC_UNRESTRICTED_IP'} .= $_."\n"; | |
2446 | } | |
2447 | } | |
2448 | ||
2449 | @temp = split(/\n/,$proxysettings{'SRC_UNRESTRICTED_MAC'}); | |
2450 | undef $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2451 | foreach (@temp) | |
2452 | { | |
2453 | s/^\s+//g; s/\s+$//g; s/-/:/g; | |
2454 | if ($_) | |
2455 | { | |
2456 | unless (&General::validmac($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid mac'}; } | |
2457 | $proxysettings{'SRC_UNRESTRICTED_MAC'} .= $_."\n"; | |
2458 | } | |
2459 | } | |
2460 | ||
363fb6af MT |
2461 | @temp = split(/\n/,$proxysettings{'DST_NOAUTH'}); |
2462 | undef $proxysettings{'DST_NOAUTH'}; | |
2463 | foreach (@temp) | |
2464 | { | |
2465 | s/^\s+//g; s/\s+$//g; | |
2466 | if ($_) | |
2467 | { | |
2468 | unless (/^\./) { $_ = '.'.$_; } | |
2469 | $proxysettings{'DST_NOAUTH'} .= $_."\n"; | |
2470 | } | |
2471 | } | |
2472 | ||
ed38f89d MT |
2473 | if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'positive')) |
2474 | { | |
2475 | @temp = split(/\n/,$proxysettings{'NTLM_ALLOW_USERS'}); | |
2476 | undef $proxysettings{'NTLM_ALLOW_USERS'}; | |
2477 | foreach (@temp) | |
2478 | { | |
2479 | s/^\s+//g; s/\s+$//g; | |
2480 | if ($_) { $proxysettings{'NTLM_ALLOW_USERS'} .= $_."\n"; } | |
2481 | } | |
2482 | if ($proxysettings{'NTLM_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2483 | } | |
2484 | ||
2485 | if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_USER_ACL'} eq 'negative')) | |
2486 | { | |
2487 | @temp = split(/\n/,$proxysettings{'NTLM_DENY_USERS'}); | |
2488 | undef $proxysettings{'NTLM_DENY_USERS'}; | |
2489 | foreach (@temp) | |
2490 | { | |
2491 | s/^\s+//g; s/\s+$//g; | |
2492 | if ($_) { $proxysettings{'NTLM_DENY_USERS'} .= $_."\n"; } | |
2493 | } | |
2494 | if ($proxysettings{'NTLM_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2495 | } | |
2496 | ||
2497 | if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'positive')) | |
2498 | { | |
2499 | @temp = split(/\n/,$proxysettings{'IDENT_ALLOW_USERS'}); | |
2500 | undef $proxysettings{'IDENT_ALLOW_USERS'}; | |
2501 | foreach (@temp) | |
2502 | { | |
2503 | s/^\s+//g; s/\s+$//g; | |
2504 | if ($_) { $proxysettings{'IDENT_ALLOW_USERS'} .= $_."\n"; } | |
2505 | } | |
2506 | if ($proxysettings{'IDENT_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2507 | } | |
2508 | ||
2509 | if (($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && ($proxysettings{'IDENT_USER_ACL'} eq 'negative')) | |
2510 | { | |
2511 | @temp = split(/\n/,$proxysettings{'IDENT_DENY_USERS'}); | |
2512 | undef $proxysettings{'IDENT_DENY_USERS'}; | |
2513 | foreach (@temp) | |
2514 | { | |
2515 | s/^\s+//g; s/\s+$//g; | |
2516 | if ($_) { $proxysettings{'IDENT_DENY_USERS'} .= $_."\n"; } | |
2517 | } | |
2518 | if ($proxysettings{'IDENT_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2519 | } | |
2520 | ||
2521 | if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive')) | |
2522 | { | |
2523 | @temp = split(/\n/,$proxysettings{'RADIUS_ALLOW_USERS'}); | |
2524 | undef $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2525 | foreach (@temp) | |
2526 | { | |
2527 | s/^\s+//g; s/\s+$//g; | |
2528 | if ($_) { $proxysettings{'RADIUS_ALLOW_USERS'} .= $_."\n"; } | |
2529 | } | |
2530 | if ($proxysettings{'RADIUS_ALLOW_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2531 | } | |
2532 | ||
2533 | if (($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative')) | |
2534 | { | |
2535 | @temp = split(/\n/,$proxysettings{'RADIUS_DENY_USERS'}); | |
2536 | undef $proxysettings{'RADIUS_DENY_USERS'}; | |
2537 | foreach (@temp) | |
2538 | { | |
2539 | s/^\s+//g; s/\s+$//g; | |
2540 | if ($_) { $proxysettings{'RADIUS_DENY_USERS'} .= $_."\n"; } | |
2541 | } | |
2542 | if ($proxysettings{'RADIUS_DENY_USERS'} eq '') { $errormessage = $Lang::tr{'advproxy errmsg acl cannot be empty'}; } | |
2543 | } | |
2544 | ||
2545 | @temp = split(/\n/,$proxysettings{'IDENT_HOSTS'}); | |
2546 | undef $proxysettings{'IDENT_HOSTS'}; | |
2547 | foreach (@temp) | |
2548 | { | |
2549 | s/^\s+//g; s/\s+$//g; | |
2550 | if ($_) | |
2551 | { | |
2552 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2553 | $proxysettings{'IDENT_HOSTS'} .= $_."\n"; | |
2554 | } | |
2555 | } | |
2556 | ||
2557 | @temp = split(/\n/,$proxysettings{'CRE_SVHOSTS'}); | |
2558 | undef $proxysettings{'CRE_SVHOSTS'}; | |
2559 | foreach (@temp) | |
2560 | { | |
2561 | s/^\s+//g; s/\s+$//g; | |
2562 | if ($_) | |
2563 | { | |
2564 | unless (&General::validipormask($_)) { $errormessage = $Lang::tr{'advproxy errmsg invalid ip or mask'}; } | |
2565 | $proxysettings{'CRE_SVHOSTS'} .= $_."\n"; | |
2566 | } | |
2567 | } | |
2568 | } | |
2569 | ||
ed38f89d MT |
2570 | # ------------------------------------------------------------------- |
2571 | ||
2572 | sub write_acls | |
2573 | { | |
2574 | open(FILE, ">$acl_src_subnets"); | |
2575 | flock(FILE, 2); | |
363fb6af MT |
2576 | if (!$proxysettings{'SRC_SUBNETS'}) |
2577 | { | |
2578 | print FILE "$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}\n"; | |
2579 | if ($netsettings{'BLUE_DEV'}) | |
2580 | { | |
2581 | print FILE "$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}\n"; | |
2582 | } | |
2583 | } else { print FILE $proxysettings{'SRC_SUBNETS'}; } | |
ed38f89d MT |
2584 | close(FILE); |
2585 | ||
2586 | open(FILE, ">$acl_src_banned_ip"); | |
2587 | flock(FILE, 2); | |
2588 | print FILE $proxysettings{'SRC_BANNED_IP'}; | |
2589 | close(FILE); | |
2590 | ||
2591 | open(FILE, ">$acl_src_banned_mac"); | |
2592 | flock(FILE, 2); | |
2593 | print FILE $proxysettings{'SRC_BANNED_MAC'}; | |
2594 | close(FILE); | |
2595 | ||
2596 | open(FILE, ">$acl_src_unrestricted_ip"); | |
2597 | flock(FILE, 2); | |
2598 | print FILE $proxysettings{'SRC_UNRESTRICTED_IP'}; | |
2599 | close(FILE); | |
2600 | ||
2601 | open(FILE, ">$acl_src_unrestricted_mac"); | |
2602 | flock(FILE, 2); | |
2603 | print FILE $proxysettings{'SRC_UNRESTRICTED_MAC'}; | |
2604 | close(FILE); | |
2605 | ||
2606 | open(FILE, ">$acl_dst_nocache"); | |
2607 | flock(FILE, 2); | |
2608 | print FILE $proxysettings{'DST_NOCACHE'}; | |
2609 | close(FILE); | |
2610 | ||
2611 | open(FILE, ">$acl_dst_noauth"); | |
2612 | flock(FILE, 2); | |
2613 | print FILE $proxysettings{'DST_NOAUTH'}; | |
2614 | close(FILE); | |
2615 | ||
363fb6af MT |
2616 | open(FILE, ">$acl_ports_safe"); |
2617 | flock(FILE, 2); | |
2618 | if (!$proxysettings{'PORTS_SAFE'}) { print FILE $def_ports_safe; } else { print FILE $proxysettings{'PORTS_SAFE'}; } | |
2619 | close(FILE); | |
2620 | ||
2621 | open(FILE, ">$acl_ports_ssl"); | |
2622 | flock(FILE, 2); | |
2623 | if (!$proxysettings{'PORTS_SSL'}) { print FILE $def_ports_ssl; } else { print FILE $proxysettings{'PORTS_SSL'}; } | |
2624 | close(FILE); | |
2625 | ||
ed38f89d MT |
2626 | open(FILE, ">$acl_dst_throttle"); |
2627 | flock(FILE, 2); | |
2628 | if ($proxysettings{'THROTTLE_BINARY'} eq 'on') | |
2629 | { | |
2630 | @temp = split(/\|/,$throttle_binary); | |
363fb6af | 2631 | foreach (@temp) { print FILE "\\.$_\$\n"; } |
ed38f89d MT |
2632 | } |
2633 | if ($proxysettings{'THROTTLE_DSKIMG'} eq 'on') | |
2634 | { | |
2635 | @temp = split(/\|/,$throttle_dskimg); | |
363fb6af | 2636 | foreach (@temp) { print FILE "\\.$_\$\n"; } |
ed38f89d MT |
2637 | } |
2638 | if ($proxysettings{'THROTTLE_MMEDIA'} eq 'on') | |
2639 | { | |
2640 | @temp = split(/\|/,$throttle_mmedia); | |
363fb6af | 2641 | foreach (@temp) { print FILE "\\.$_\$\n"; } |
ed38f89d MT |
2642 | } |
2643 | if (-s $throttled_urls) | |
2644 | { | |
2645 | open(URLFILE, $throttled_urls); | |
2646 | @temp = <URLFILE>; | |
2647 | close(URLFILE); | |
363fb6af | 2648 | foreach (@temp) { print FILE; } |
ed38f89d MT |
2649 | } |
2650 | close(FILE); | |
2651 | ||
2652 | open(FILE, ">$mimetypes"); | |
2653 | flock(FILE, 2); | |
2654 | print FILE $proxysettings{'MIME_TYPES'}; | |
2655 | close(FILE); | |
2656 | ||
2657 | open(FILE, ">$ntlmdir/msntauth.allowusers"); | |
2658 | flock(FILE, 2); | |
2659 | print FILE $proxysettings{'NTLM_ALLOW_USERS'}; | |
2660 | close(FILE); | |
2661 | ||
2662 | open(FILE, ">$ntlmdir/msntauth.denyusers"); | |
2663 | flock(FILE, 2); | |
2664 | print FILE $proxysettings{'NTLM_DENY_USERS'}; | |
2665 | close(FILE); | |
2666 | ||
2667 | open(FILE, ">$raddir/radauth.allowusers"); | |
2668 | flock(FILE, 2); | |
2669 | print FILE $proxysettings{'RADIUS_ALLOW_USERS'}; | |
2670 | close(FILE); | |
2671 | ||
2672 | open(FILE, ">$raddir/radauth.denyusers"); | |
2673 | flock(FILE, 2); | |
2674 | print FILE $proxysettings{'RADIUS_DENY_USERS'}; | |
2675 | close(FILE); | |
2676 | ||
2677 | open(FILE, ">$identdir/identauth.allowusers"); | |
2678 | flock(FILE, 2); | |
2679 | print FILE $proxysettings{'IDENT_ALLOW_USERS'}; | |
2680 | close(FILE); | |
2681 | ||
2682 | open(FILE, ">$identdir/identauth.denyusers"); | |
2683 | flock(FILE, 2); | |
2684 | print FILE $proxysettings{'IDENT_DENY_USERS'}; | |
2685 | close(FILE); | |
2686 | ||
2687 | open(FILE, ">$identhosts"); | |
2688 | flock(FILE, 2); | |
2689 | print FILE $proxysettings{'IDENT_HOSTS'}; | |
2690 | close(FILE); | |
2691 | ||
2692 | open(FILE, ">$cre_groups"); | |
2693 | flock(FILE, 2); | |
2694 | print FILE $proxysettings{'CRE_GROUPS'}; | |
2695 | close(FILE); | |
2696 | ||
2697 | open(FILE, ">$cre_svhosts"); | |
2698 | flock(FILE, 2); | |
2699 | print FILE $proxysettings{'CRE_SVHOSTS'}; | |
2700 | close(FILE); | |
2701 | } | |
2702 | ||
2703 | # ------------------------------------------------------------------- | |
2704 | ||
2705 | sub writepacfile | |
2706 | { | |
22527178 | 2707 | open(FILE, ">/srv/web/ipfire/html/proxy.pac"); |
ed38f89d MT |
2708 | flock(FILE, 2); |
2709 | print FILE "function FindProxyForURL(url, host)\n"; | |
2710 | print FILE "{\n"; | |
2711 | if (($proxysettings{'ENABLE'} eq 'on') || ($proxysettings{'ENABLE_BLUE'} eq 'on')) | |
2712 | { | |
2713 | print FILE <<END | |
2714 | if ( | |
2715 | (isPlainHostName(host)) || | |
2716 | (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) || | |
2717 | (isInNet(host, "10.0.0.0", "255.0.0.0")) || | |
2718 | (isInNet(host, "172.16.0.0", "255.240.0.0")) || | |
2719 | (isInNet(host, "169.254.0.0", "255.255.0.0")) || | |
2720 | (isInNet(host, "192.168.0.0", "255.255.0.0")) | |
2721 | ) | |
2722 | return "DIRECT"; | |
2723 | ||
2724 | else | |
2725 | ||
2726 | END | |
2727 | ; | |
2728 | if ($proxysettings{'ENABLE'} eq 'on') | |
2729 | { | |
268292e7 CS |
2730 | print FILE "if (\n"; |
2731 | print FILE " (isInNet(myIpAddress(), \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\"))"; | |
2732 | ||
2733 | undef @templist; | |
2734 | if (-e "$acl_src_subnets") { | |
2735 | open(SUBNETS,"$acl_src_subnets"); | |
2736 | @templist = <SUBNETS>; | |
2737 | close(SUBNETS); | |
2738 | } | |
2739 | ||
2740 | foreach (@templist) | |
2741 | { | |
2742 | @temp = split(/\//); | |
2743 | if ( | |
2744 | ($temp[0] ne $netsettings{'GREEN_NETADDRESS'}) && ($temp[1] ne $netsettings{'GREEN_NETMASK'}) && | |
2745 | ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'}) | |
2746 | ) | |
2747 | { | |
2748 | chomp $temp[1]; | |
2749 | print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))"; | |
2750 | } | |
2751 | } | |
2752 | ||
2753 | print FILE "\n"; | |
2754 | ||
ed38f89d | 2755 | print FILE <<END |
268292e7 CS |
2756 | |
2757 | ||
ed38f89d MT |
2758 | ) |
2759 | return "PROXY $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; | |
2760 | END | |
2761 | ; | |
2762 | } | |
2763 | if (($proxysettings{'ENABLE'} eq 'on') && ($proxysettings{'ENABLE_BLUE'} eq 'on') && ($netsettings{'BLUE_DEV'})) | |
2764 | { | |
2765 | print FILE "\n else\n\n"; | |
2766 | } | |
2767 | if (($netsettings{'BLUE_DEV'}) && ($proxysettings{'ENABLE_BLUE'} eq 'on')) | |
2768 | { | |
2769 | print FILE <<END | |
2770 | if ( | |
2771 | (isInNet(myIpAddress(), "$netsettings{'BLUE_NETADDRESS'}", "$netsettings{'BLUE_NETMASK'}")) | |
2772 | ) | |
2773 | return "PROXY $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; | |
2774 | END | |
2775 | ; | |
2776 | } | |
2777 | } | |
2778 | print FILE "}\n"; | |
2779 | close(FILE); | |
2780 | } | |
2781 | ||
2782 | # ------------------------------------------------------------------- | |
2783 | ||
2784 | sub writeconfig | |
2785 | { | |
2786 | my $authrealm; | |
2787 | my $delaypools; | |
2788 | ||
363fb6af | 2789 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} + |
ed38f89d MT |
2790 | $proxysettings{'THROTTLING_GREEN_HOST'} + |
2791 | $proxysettings{'THROTTLING_BLUE_TOTAL'} + | |
2792 | $proxysettings{'THROTTLING_BLUE_HOST'} gt 0) | |
2793 | { | |
2794 | $delaypools = 1; } else { $delaypools = 0; | |
2795 | } | |
2796 | ||
2797 | if ($proxysettings{'AUTH_REALM'} eq '') | |
2798 | { | |
363fb6af | 2799 | $authrealm = "IPCop Advanced Proxy Server"; |
ed38f89d MT |
2800 | } else { |
2801 | $authrealm = $proxysettings{'AUTH_REALM'}; | |
2802 | } | |
2803 | ||
2804 | $_ = $proxysettings{'UPSTREAM_PROXY'}; | |
2805 | my ($remotehost, $remoteport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/); | |
2806 | ||
2807 | if ($remoteport eq '') { $remoteport = 80; } | |
2808 | ||
2809 | open(FILE, ">${General::swroot}/proxy/squid.conf"); | |
2810 | flock(FILE, 2); | |
2811 | print FILE <<END | |
363fb6af MT |
2812 | # Do not modify '${General::swroot}/proxy/squid.conf' directly since any changes |
2813 | # you make will be overwritten whenever you resave proxy settings using the | |
2814 | # web interface! | |
2815 | # | |
2816 | # Instead, modify the file '$acl_include' and | |
2817 | # then restart the proxy service using the web interface. Changes made to the | |
2818 | # 'include.acl' file will propagate to the 'squid.conf' file at that time. | |
2819 | ||
ed38f89d MT |
2820 | shutdown_lifetime 5 seconds |
2821 | icp_port 0 | |
2822 | ||
ed38f89d MT |
2823 | END |
2824 | ; | |
363fb6af MT |
2825 | print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; |
2826 | if ($proxysettings{'TRANSPARENT'} eq 'on') { print FILE " transparent" } | |
2827 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } | |
2828 | print FILE "\n"; | |
2829 | ||
ed38f89d | 2830 | if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') { |
363fb6af MT |
2831 | print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}"; |
2832 | if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { print FILE " transparent" } | |
2833 | if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" } | |
2834 | print FILE "\n"; | |
ed38f89d MT |
2835 | } |
2836 | ||
2837 | print FILE <<END | |
2838 | ||
2839 | acl QUERY urlpath_regex cgi-bin \\? | |
363fb6af | 2840 | cache deny QUERY |
ed38f89d MT |
2841 | END |
2842 | ; | |
2843 | if (!-z $acl_dst_nocache) { | |
2844 | print FILE "acl no_cache_domains dstdomain \"$acl_dst_nocache\"\n"; | |
363fb6af | 2845 | print FILE "cache deny no_cache_domains\n"; |
ed38f89d MT |
2846 | } |
2847 | ||
2848 | print FILE <<END | |
2849 | ||
2850 | cache_effective_user squid | |
2851 | cache_effective_group squid | |
363fb6af | 2852 | umask 022 |
ed38f89d MT |
2853 | |
2854 | pid_filename /var/run/squid.pid | |
2855 | ||
2856 | cache_mem $proxysettings{'CACHE_MEM'} MB | |
2857 | cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256 | |
2858 | ||
ed38f89d MT |
2859 | END |
2860 | ; | |
2861 | ||
0d948999 | 2862 | if (($proxysettings{'ERR_DESIGN'} eq 'ipfire' )) |
363fb6af | 2863 | { |
0d948999 | 2864 | print FILE "error_directory $errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}\n\n"; |
363fb6af MT |
2865 | } else { |
2866 | print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n"; | |
2867 | } | |
2868 | ||
ed38f89d MT |
2869 | if ($proxysettings{'OFFLINE_MODE'} eq 'on') { print FILE "offline_mode on\n\n"; } |
2870 | ||
2871 | if ((!($proxysettings{'MEM_POLICY'} eq 'LRU')) || (!($proxysettings{'CACHE_POLICY'} eq 'LRU'))) | |
2872 | { | |
2873 | if (!($proxysettings{'MEM_POLICY'} eq 'LRU')) | |
2874 | { | |
2875 | print FILE "memory_replacement_policy $proxysettings{'MEM_POLICY'}\n"; | |
2876 | } | |
2877 | if (!($proxysettings{'CACHE_POLICY'} eq 'LRU')) | |
2878 | { | |
2879 | print FILE "cache_replacement_policy $proxysettings{'CACHE_POLICY'}\n"; | |
2880 | } | |
2881 | print FILE "\n"; | |
2882 | } | |
2883 | ||
2884 | if ($proxysettings{'LOGGING'} eq 'on') | |
2885 | { | |
363fb6af MT |
2886 | print FILE <<END |
2887 | access_log /var/log/squid/access.log | |
ed38f89d MT |
2888 | cache_log /var/log/squid/cache.log |
2889 | cache_store_log none | |
2890 | END | |
2891 | ; | |
2892 | if ($proxysettings{'LOGUSERAGENT'} eq 'on') { print FILE "useragent_log \/var\/log\/squid\/user_agent.log\n"; } | |
2893 | if ($proxysettings{'LOGQUERY'} eq 'on') { print FILE "\nstrip_query_terms off\n"; } | |
2894 | } else { | |
2895 | print FILE <<END | |
363fb6af | 2896 | access_log /dev/null |
ed38f89d MT |
2897 | cache_log /dev/null |
2898 | cache_store_log none | |
2899 | END | |
2900 | ;} | |
2901 | print FILE <<END | |
2902 | ||
2903 | log_mime_hdrs off | |
2904 | END | |
2905 | ; | |
2906 | ||
2907 | if ($proxysettings{'FORWARD_IPADDRESS'} eq 'on') | |
2908 | { | |
363fb6af | 2909 | print FILE "forwarded_for on\n"; |
ed38f89d | 2910 | } else { |
363fb6af | 2911 | print FILE "forwarded_for off\n"; |
ed38f89d | 2912 | } |
363fb6af MT |
2913 | if ($proxysettings{'FORWARD_VIA'} eq 'on') |
2914 | { | |
2915 | print FILE "via on\n"; | |
2916 | } else { | |
2917 | print FILE "via off\n"; | |
2918 | } | |
2919 | print FILE "\n"; | |
ed38f89d MT |
2920 | |
2921 | if ((!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) | |
2922 | { | |
2923 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
2924 | { | |
363fb6af | 2925 | print FILE "auth_param basic program $authdir/ncsa_auth $userdb\n"; |
ed38f89d MT |
2926 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; |
2927 | print FILE "auth_param basic realm $authrealm\n"; | |
2928 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
2929 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
2930 | } | |
2931 | ||
2932 | if ($proxysettings{'AUTH_METHOD'} eq 'ldap') | |
2933 | { | |
363fb6af | 2934 | print FILE "auth_param basic program $authdir/squid_ldap_auth -b \"$proxysettings{'LDAP_BASEDN'}\""; |
ed38f89d MT |
2935 | if (!($proxysettings{'LDAP_BINDDN_USER'} eq '')) { print FILE " -D \"$proxysettings{'LDAP_BINDDN_USER'}\""; } |
2936 | if (!($proxysettings{'LDAP_BINDDN_PASS'} eq '')) { print FILE " -w $proxysettings{'LDAP_BINDDN_PASS'}"; } | |
2937 | if ($proxysettings{'LDAP_TYPE'} eq 'ADS') | |
2938 | { | |
2939 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
2940 | { | |
2941 | print FILE " -f \"(\&(objectClass=person)(sAMAccountName=\%s))\""; | |
2942 | } else { | |
2943 | print FILE " -f \"(\&(\&(objectClass=person)(sAMAccountName=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\""; | |
2944 | } | |
2945 | print FILE " -u sAMAccountName -P"; | |
2946 | } | |
2947 | if ($proxysettings{'LDAP_TYPE'} eq 'NDS') | |
2948 | { | |
2949 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
2950 | { | |
2951 | print FILE " -f \"(\&(objectClass=person)(cn=\%s))\""; | |
2952 | } else { | |
2953 | print FILE " -f \"(\&(\&(objectClass=person)(cn=\%s))(groupMembership=$proxysettings{'LDAP_GROUP'}))\""; | |
2954 | } | |
2955 | print FILE " -u cn -P"; | |
2956 | } | |
2957 | if (($proxysettings{'LDAP_TYPE'} eq 'V2') || ($proxysettings{'LDAP_TYPE'} eq 'V3')) | |
2958 | { | |
2959 | if ($proxysettings{'LDAP_GROUP'} eq '') | |
2960 | { | |
2961 | print FILE " -f \"(\&(objectClass=person)(uid=\%s))\""; | |
2962 | } else { | |
2963 | print FILE " -f \"(\&(\&(objectClass=person)(uid=\%s))(memberOf=$proxysettings{'LDAP_GROUP'}))\""; | |
2964 | } | |
2965 | if ($proxysettings{'LDAP_TYPE'} eq 'V2') { print FILE " -v 2"; } | |
2966 | if ($proxysettings{'LDAP_TYPE'} eq 'V3') { print FILE " -v 3"; } | |
2967 | print FILE " -u uid -P"; | |
2968 | } | |
2969 | print FILE " $proxysettings{'LDAP_SERVER'}:$proxysettings{'LDAP_PORT'}\n"; | |
2970 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; | |
2971 | print FILE "auth_param basic realm $authrealm\n"; | |
2972 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
2973 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
2974 | } | |
2975 | ||
2976 | if ($proxysettings{'AUTH_METHOD'} eq 'ntlm') | |
2977 | { | |
2978 | if ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') | |
2979 | { | |
363fb6af | 2980 | print FILE "auth_param ntlm program $authdir/ntlm_auth $proxysettings{'NTLM_DOMAIN'}/$proxysettings{'NTLM_PDC'}"; |
ed38f89d MT |
2981 | if ($proxysettings{'NTLM_BDC'} eq '') { print FILE "\n"; } else { print FILE " $proxysettings{'NTLM_DOMAIN'}/$proxysettings{'NTLM_BDC'}\n"; } |
2982 | print FILE "auth_param ntlm children $proxysettings{'AUTH_CHILDREN'}\n"; | |
ed38f89d MT |
2983 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } |
2984 | } else { | |
363fb6af | 2985 | print FILE "auth_param basic program $authdir/msnt_auth\n"; |
ed38f89d MT |
2986 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; |
2987 | print FILE "auth_param basic realm $authrealm\n"; | |
2988 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
2989 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
2990 | ||
2991 | open(MSNTCONF, ">$ntlmdir/msntauth.conf"); | |
2992 | flock(MSNTCONF,2); | |
2993 | print MSNTCONF "server $proxysettings{'NTLM_PDC'}"; | |
2994 | if ($proxysettings{'NTLM_BDC'} eq '') { print MSNTCONF " $proxysettings{'NTLM_PDC'}"; } else { print MSNTCONF " $proxysettings{'NTLM_BDC'}"; } | |
2995 | print MSNTCONF " $proxysettings{'NTLM_DOMAIN'}\n"; | |
2996 | if ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') | |
2997 | { | |
2998 | if ($proxysettings{'NTLM_USER_ACL'} eq 'positive') | |
2999 | { | |
3000 | print MSNTCONF "allowusers $ntlmdir/msntauth.allowusers\n"; | |
3001 | } else { | |
3002 | print MSNTCONF "denyusers $ntlmdir/msntauth.denyusers\n"; | |
3003 | } | |
3004 | } | |
3005 | close(MSNTCONF); | |
3006 | } | |
3007 | } | |
3008 | ||
3009 | if ($proxysettings{'AUTH_METHOD'} eq 'radius') | |
3010 | { | |
363fb6af | 3011 | print FILE "auth_param basic program $authdir/squid_radius_auth -h $proxysettings{'RADIUS_SERVER'} -p $proxysettings{'RADIUS_PORT'} "; |
ed38f89d MT |
3012 | if (!($proxysettings{'RADIUS_IDENTIFIER'} eq '')) { print FILE "-i $proxysettings{'RADIUS_IDENTIFIER'} "; } |
3013 | print FILE "-w $proxysettings{'RADIUS_SECRET'}\n"; | |
3014 | print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n"; | |
3015 | print FILE "auth_param basic realm $authrealm\n"; | |
3016 | print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n"; | |
3017 | if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; } | |
3018 | } | |
3019 | ||
3020 | print FILE "\n"; | |
3021 | print FILE "acl for_inetusers proxy_auth REQUIRED\n"; | |
3022 | if (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') && ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on')) | |
3023 | { | |
3024 | if ((!-z "$ntlmdir/msntauth.allowusers") && ($proxysettings{'NTLM_USER_ACL'} eq 'positive')) | |
3025 | { | |
3026 | print FILE "acl for_acl_users proxy_auth \"$ntlmdir/msntauth.allowusers\"\n"; | |
3027 | } | |
3028 | if ((!-z "$ntlmdir/msntauth.denyusers") && ($proxysettings{'NTLM_USER_ACL'} eq 'negative')) | |
3029 | { | |
3030 | print FILE "acl for_acl_users proxy_auth \"$ntlmdir/msntauth.denyusers\"\n"; | |
3031 | } | |
3032 | } | |
3033 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) | |
3034 | { | |
3035 | if ((!-z "$raddir/radauth.allowusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'positive')) | |
3036 | { | |
3037 | print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.allowusers\"\n"; | |
3038 | } | |
3039 | if ((!-z "$raddir/radauth.denyusers") && ($proxysettings{'RADIUS_USER_ACL'} eq 'negative')) | |
3040 | { | |
3041 | print FILE "acl for_acl_users proxy_auth \"$raddir/radauth.denyusers\"\n"; | |
3042 | } | |
3043 | } | |
3044 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3045 | { | |
3046 | print FILE "\n"; | |
3047 | if (!-z $extgrp) { print FILE "acl for_extended_users proxy_auth \"$extgrp\"\n"; } | |
3048 | if (!-z $disgrp) { print FILE "acl for_disabled_users proxy_auth \"$disgrp\"\n"; } | |
3049 | } | |
3050 | if (!($proxysettings{'AUTH_MAX_USERIP'} eq '')) { print FILE "\nacl concurrent max_user_ip -s $proxysettings{'AUTH_MAX_USERIP'}\n"; } | |
3051 | print FILE "\n"; | |
3052 | ||
363fb6af MT |
3053 | if (!-z $acl_dst_noauth) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth\"\n"; } |
3054 | print FILE "\n"; | |
ed38f89d MT |
3055 | } |
3056 | ||
3057 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
3058 | { | |
3059 | if ($proxysettings{'IDENT_REQUIRED'} eq 'on') | |
3060 | { | |
3061 | print FILE "acl for_inetusers ident REQUIRED\n"; | |
3062 | } | |
3063 | if ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') | |
3064 | { | |
3065 | if ((!-z "$identdir/identauth.allowusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'positive')) | |
3066 | { | |
3067 | print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.allowusers\"\n\n"; | |
3068 | } | |
3069 | if ((!-z "$identdir/identauth.denyusers") && ($proxysettings{'IDENT_USER_ACL'} eq 'negative')) | |
3070 | { | |
3071 | print FILE "acl for_acl_users ident_regex -i \"$identdir/identauth.denyusers\"\n\n"; | |
3072 | } | |
3073 | } | |
363fb6af MT |
3074 | if (!-z $acl_dst_noauth) { print FILE "acl to_domains_without_auth dstdomain \"$acl_dst_noauth\"\n"; } |
3075 | print FILE "\n"; | |
ed38f89d MT |
3076 | } |
3077 | ||
3078 | if (($delaypools) && (!-z $acl_dst_throttle)) { print FILE "acl for_throttled_urls url_regex -i \"$acl_dst_throttle\"\n\n"; } | |
3079 | ||
3080 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE "acl with_allowed_useragents browser $browser_regexp\n\n"; } | |
3081 | ||
3082 | print FILE "acl within_timeframe time "; | |
3083 | if ($proxysettings{'TIME_MON'} eq 'on') { print FILE "M"; } | |
3084 | if ($proxysettings{'TIME_TUE'} eq 'on') { print FILE "T"; } | |
3085 | if ($proxysettings{'TIME_WED'} eq 'on') { print FILE "W"; } | |
3086 | if ($proxysettings{'TIME_THU'} eq 'on') { print FILE "H"; } | |
3087 | if ($proxysettings{'TIME_FRI'} eq 'on') { print FILE "F"; } | |
3088 | if ($proxysettings{'TIME_SAT'} eq 'on') { print FILE "A"; } | |
3089 | if ($proxysettings{'TIME_SUN'} eq 'on') { print FILE "S"; } | |
363fb6af MT |
3090 | print FILE " $proxysettings{'TIME_FROM_HOUR'}:"; |
3091 | print FILE "$proxysettings{'TIME_FROM_MINUTE'}-"; | |
3092 | print FILE "$proxysettings{'TIME_TO_HOUR'}:"; | |
3093 | print FILE "$proxysettings{'TIME_TO_MINUTE'}\n\n"; | |
ed38f89d MT |
3094 | |
3095 | if ((!-z $mimetypes) && ($proxysettings{'ENABLE_MIME_FILTER'} eq 'on')) { | |
3096 | print FILE "acl blocked_mimetypes rep_mime_type \"$mimetypes\"\n\n"; | |
3097 | } | |
3098 | ||
3099 | print FILE <<END | |
3100 | acl all src 0.0.0.0/0.0.0.0 | |
3101 | acl localhost src 127.0.0.1/255.255.255.255 | |
363fb6af MT |
3102 | END |
3103 | ; | |
3104 | open (PORTS,"$acl_ports_ssl"); | |
3105 | @temp = <PORTS>; | |
3106 | close PORTS; | |
3107 | if (@temp) | |
3108 | { | |
3109 | foreach (@temp) { print FILE "acl SSL_ports port $_"; } | |
3110 | } | |
3111 | open (PORTS,"$acl_ports_safe"); | |
3112 | @temp = <PORTS>; | |
3113 | close PORTS; | |
3114 | if (@temp) | |
3115 | { | |
3116 | foreach (@temp) { print FILE "acl Safe_ports port $_"; } | |
3117 | } | |
3118 | print FILE <<END | |
3119 | ||
3120 | acl IPCop_http port $http_port | |
3121 | acl IPCop_https port $https_port | |
ed38f89d MT |
3122 | acl IPCop_ips dst $netsettings{'GREEN_ADDRESS'} |
3123 | acl IPCop_networks src "$acl_src_subnets" | |
9fb25b1c | 3124 | acl IPCop_servers dst "$acl_src_subnets" |
ed38f89d | 3125 | acl IPCop_green_network src $netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'} |
9fb25b1c | 3126 | acl IPCop_green_servers dst $netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'} |
ed38f89d MT |
3127 | END |
3128 | ; | |
363fb6af | 3129 | if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPCop_blue_network src $netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}\n"; } |
9fb25b1c | 3130 | if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPCop_blue_servers dst $netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}\n"; } |
ed38f89d MT |
3131 | if (!-z $acl_src_banned_ip) { print FILE "acl IPCop_banned_ips src \"$acl_src_banned_ip\"\n"; } |
3132 | if (!-z $acl_src_banned_mac) { print FILE "acl IPCop_banned_mac arp \"$acl_src_banned_mac\"\n"; } | |
3133 | if (!-z $acl_src_unrestricted_ip) { print FILE "acl IPCop_unrestricted_ips src \"$acl_src_unrestricted_ip\"\n"; } | |
3134 | if (!-z $acl_src_unrestricted_mac) { print FILE "acl IPCop_unrestricted_mac arp \"$acl_src_unrestricted_mac\"\n"; } | |
3135 | print FILE <<END | |
3136 | acl CONNECT method CONNECT | |
3137 | END | |
3138 | ; | |
3139 | ||
3140 | if ($proxysettings{'CLASSROOM_EXT'} eq 'on') { | |
3141 | print FILE <<END | |
3142 | ||
3143 | #Classroom extensions | |
3144 | acl IPCop_no_access_ips src "$acl_src_noaccess_ip" | |
3145 | acl IPCop_no_access_mac arp "$acl_src_noaccess_mac" | |
3146 | END | |
3147 | ; | |
3148 | print FILE "deny_info "; | |
0d948999 | 3149 | if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) || |
363fb6af MT |
3150 | (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED"))) |
3151 | { | |
3152 | print FILE "ERR_ACCESS_DISABLED"; | |
3153 | } else { | |
3154 | print FILE "ERR_ACCESS_DENIED"; | |
3155 | } | |
ed38f89d MT |
3156 | print FILE " IPCop_no_access_ips\n"; |
3157 | print FILE "deny_info "; | |
0d948999 | 3158 | if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) || |
363fb6af MT |
3159 | (($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED"))) |
3160 | { | |
3161 | print FILE "ERR_ACCESS_DISABLED"; | |
3162 | } else { | |
3163 | print FILE "ERR_ACCESS_DENIED"; | |
3164 | } | |
ed38f89d MT |
3165 | print FILE " IPCop_no_access_mac\n"; |
3166 | ||
3167 | print FILE <<END | |
3168 | http_access deny IPCop_no_access_ips | |
3169 | http_access deny IPCop_no_access_mac | |
3170 | END | |
3171 | ; | |
3172 | } | |
3173 | ||
363fb6af MT |
3174 | #Insert acl file and replace __VAR__ with correct values |
3175 | my $blue_net = ''; #BLUE empty by default | |
3176 | my $blue_ip = ''; | |
3177 | if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') { | |
3178 | $blue_net = "$netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}"; | |
3179 | $blue_ip = "$netsettings{'BLUE_ADDRESS'}"; | |
3180 | } | |
3181 | if (!-z $acl_include) | |
ed38f89d MT |
3182 | { |
3183 | open (ACL, "$acl_include"); | |
3184 | print FILE "\n#Start of custom includes\n"; | |
3185 | while (<ACL>) { | |
3186 | $_ =~ s/__GREEN_IP__/$netsettings{'GREEN_ADDRESS'}/; | |
3187 | $_ =~ s/__GREEN_NET__/$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}/; | |
3188 | $_ =~ s/__BLUE_IP__/$blue_ip/; | |
3189 | $_ =~ s/__BLUE_NET__/$blue_net/; | |
363fb6af | 3190 | $_ =~ s/__PROXY_PORT__/$proxysettings{'PROXY_PORT'}/; |
ed38f89d MT |
3191 | print FILE $_; |
3192 | } | |
3193 | print FILE "#End of custom includes\n"; | |
3194 | close (ACL); | |
3195 | } | |
3196 | if ((!-z $extgrp) && ($proxysettings{'AUTH_METHOD'} eq 'ncsa') && ($proxysettings{'NCSA_BYPASS_REDIR'} eq 'on')) { print FILE "\nredirector_access deny for_extended_users\n"; } | |
3197 | print FILE <<END | |
3198 | ||
3199 | #Access to squid: | |
3200 | #local machine, no restriction | |
3201 | http_access allow localhost | |
3202 | ||
3203 | #GUI admin if local machine connects | |
3204 | http_access allow IPCop_ips IPCop_networks IPCop_http | |
3205 | http_access allow CONNECT IPCop_ips IPCop_networks IPCop_https | |
3206 | ||
3207 | #Deny not web services | |
3208 | http_access deny !Safe_ports | |
3209 | http_access deny CONNECT !SSL_ports | |
3210 | ||
3211 | END | |
3212 | ; | |
3213 | ||
3214 | if ($proxysettings{'AUTH_METHOD'} eq 'ident') | |
3215 | { | |
3216 | print FILE "#Set ident ACLs\n"; | |
3217 | if (!-z $identhosts) | |
3218 | { | |
3219 | print FILE "acl on_ident_aware_hosts src \"$identhosts\"\n"; | |
3220 | print FILE "ident_lookup_access allow on_ident_aware_hosts\n"; | |
3221 | print FILE "ident_lookup_access deny all\n"; | |
3222 | } else { | |
3223 | print FILE "ident_lookup_access allow all\n"; | |
3224 | } | |
3225 | print FILE "ident_timeout $proxysettings{'IDENT_TIMEOUT'} seconds\n\n"; | |
3226 | } | |
3227 | ||
3228 | if ($delaypools) { | |
3229 | print FILE "#Set download throttling\n"; | |
3230 | ||
3231 | if ($netsettings{'BLUE_DEV'}) | |
3232 | { | |
3233 | print FILE "delay_pools 2\n"; | |
3234 | } else { | |
3235 | print FILE "delay_pools 1\n"; | |
3236 | } | |
3237 | ||
3238 | print FILE "delay_class 1 3\n"; | |
3239 | if ($netsettings{'BLUE_DEV'}) { print FILE "delay_class 2 3\n"; } | |
3240 | ||
3241 | print FILE "delay_parameters 1 "; | |
3242 | if ($proxysettings{'THROTTLING_GREEN_TOTAL'} eq 'unlimited') | |
3243 | { | |
3244 | print FILE "-1/-1"; | |
3245 | } else { | |
3246 | print FILE $proxysettings{'THROTTLING_GREEN_TOTAL'} * 125; | |
3247 | print FILE "/"; | |
3248 | print FILE $proxysettings{'THROTTLING_GREEN_TOTAL'} * 250; | |
3249 | } | |
3250 | ||
3251 | print FILE " -1/-1 "; | |
3252 | if ($proxysettings{'THROTTLING_GREEN_HOST'} eq 'unlimited') | |
3253 | { | |
3254 | print FILE "-1/-1"; | |
3255 | } else { | |
3256 | print FILE $proxysettings{'THROTTLING_GREEN_HOST'} * 125; | |
3257 | print FILE "/"; | |
3258 | print FILE $proxysettings{'THROTTLING_GREEN_HOST'} * 250; | |
3259 | } | |
3260 | print FILE "\n"; | |
3261 | ||
3262 | if ($netsettings{'BLUE_DEV'}) | |
3263 | { | |
3264 | print FILE "delay_parameters 2 "; | |
3265 | if ($proxysettings{'THROTTLING_BLUE_TOTAL'} eq 'unlimited') | |
3266 | { | |
3267 | print FILE "-1/-1"; | |
3268 | } else { | |
3269 | print FILE $proxysettings{'THROTTLING_BLUE_TOTAL'} * 125; | |
3270 | print FILE "/"; | |
3271 | print FILE $proxysettings{'THROTTLING_BLUE_TOTAL'} * 250; | |
3272 | } | |
3273 | print FILE " -1/-1 "; | |
3274 | if ($proxysettings{'THROTTLING_BLUE_HOST'} eq 'unlimited') | |
3275 | { | |
3276 | print FILE "-1/-1"; | |
3277 | } else { | |
3278 | print FILE $proxysettings{'THROTTLING_BLUE_HOST'} * 125; | |
3279 | print FILE "/"; | |
3280 | print FILE $proxysettings{'THROTTLING_BLUE_HOST'} * 250; | |
3281 | } | |
3282 | print FILE "\n"; | |
3283 | } | |
3284 | ||
363fb6af | 3285 | print FILE "delay_access 1 deny IPCop_ips\n"; |
ed38f89d MT |
3286 | if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 1 deny IPCop_unrestricted_ips\n"; } |
3287 | if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 1 deny IPCop_unrestricted_mac\n"; } | |
3288 | if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 1 deny for_extended_users\n"; } | |
3289 | ||
3290 | if ($netsettings{'BLUE_DEV'}) | |
3291 | { | |
3292 | print FILE "delay_access 1 allow IPCop_green_network"; | |
363fb6af | 3293 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3294 | print FILE "\n"; |
3295 | print FILE "delay_access 1 deny all\n"; | |
3296 | } else { | |
3297 | print FILE "delay_access 1 allow all"; | |
363fb6af | 3298 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3299 | print FILE "\n"; |
3300 | } | |
3301 | ||
3302 | if ($netsettings{'BLUE_DEV'}) | |
3303 | { | |
363fb6af | 3304 | print FILE "delay_access 2 deny IPCop_ips\n"; |
ed38f89d MT |
3305 | if (!-z $acl_src_unrestricted_ip) { print FILE "delay_access 2 deny IPCop_unrestricted_ips\n"; } |
3306 | if (!-z $acl_src_unrestricted_mac) { print FILE "delay_access 2 deny IPCop_unrestricted_mac\n"; } | |
3307 | if (($proxysettings{'AUTH_METHOD'} eq 'ncsa') && (!-z $extgrp)) { print FILE "delay_access 2 deny for_extended_users\n"; } | |
3308 | print FILE "delay_access 2 allow IPCop_blue_network"; | |
363fb6af | 3309 | if (!-z $acl_dst_throttle) { print FILE " for_throttled_urls"; } |
ed38f89d MT |
3310 | print FILE "\n"; |
3311 | print FILE "delay_access 2 deny all\n"; | |
3312 | } | |
3313 | ||
9fb25b1c | 3314 | print FILE "delay_initial_bucket_level 100\n"; |
ed38f89d MT |
3315 | print FILE "\n"; |
3316 | } | |
9fb25b1c MT |
3317 | |
3318 | if ($proxysettings{'NO_PROXY_LOCAL'} eq 'on') | |
3319 | { | |
3320 | print FILE "#Prevent internal proxy access to Green\n"; | |
3321 | print FILE "http_access deny IPCop_green_servers !IPCop_green_network\n\n"; | |
3322 | } | |
3323 | ||
3324 | if ($proxysettings{'NO_PROXY_LOCAL_BLUE'} eq 'on') | |
3325 | { | |
3326 | print FILE "#Prevent internal proxy access from Blue\n"; | |
3327 | print FILE "http_access allow IPCop_blue_network IPCop_blue_servers\n"; | |
3328 | print FILE "http_access deny IPCop_blue_network IPCop_servers\n\n"; | |
3329 | } | |
3330 | ||
ed38f89d MT |
3331 | print FILE <<END |
3332 | #Set custom configured ACLs | |
3333 | END | |
3334 | ; | |
3335 | if (!-z $acl_src_banned_ip) { print FILE "http_access deny IPCop_banned_ips\n"; } | |
3336 | if (!-z $acl_src_banned_mac) { print FILE "http_access deny IPCop_banned_mac\n"; } | |
3337 | ||
3338 | if ((!-z $acl_dst_noauth) && (!($proxysettings{'AUTH_METHOD'} eq 'none'))) | |
3339 | { | |
3340 | if (!-z $acl_src_unrestricted_ip) | |
3341 | { | |
3342 | print FILE "http_access allow IPCop_unrestricted_ips to_domains_without_auth\n"; | |
3343 | } | |
3344 | if (!-z $acl_src_unrestricted_mac) | |
3345 | { | |
3346 | print FILE "http_access allow IPCop_unrestricted_mac to_domains_without_auth\n"; | |
3347 | } | |
3348 | print FILE "http_access allow IPCop_networks"; | |
3349 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3350 | print FILE " !within_timeframe"; | |
3351 | } else { | |
3352 | print FILE " within_timeframe"; } | |
3353 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3354 | print FILE " to_domains_without_auth\n"; | |
3355 | } | |
3356 | ||
3357 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on') && ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on')) | |
3358 | { | |
3359 | print FILE "http_access deny !for_inetusers"; | |
3360 | if (!-z $identhosts) { print FILE " on_ident_aware_hosts"; } | |
3361 | print FILE "\n"; | |
3362 | } | |
3363 | ||
3364 | if ( | |
3365 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3366 | ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') && | |
3367 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3368 | ($proxysettings{'IDENT_USER_ACL'} eq 'negative') && | |
3369 | (!-z "$identdir/identauth.denyusers") | |
3370 | ) | |
3371 | { | |
3372 | print FILE "http_access deny for_acl_users"; | |
3373 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && (!-z "$identdir/hosts")) { print FILE " on_ident_aware_hosts"; } | |
3374 | print FILE "\n"; | |
3375 | } | |
3376 | ||
3377 | if (!-z $acl_src_unrestricted_ip) | |
3378 | { | |
3379 | print FILE "http_access allow IPCop_unrestricted_ips"; | |
3380 | if ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') | |
3381 | { | |
3382 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3383 | { | |
3384 | if (!-z $disgrp) { print FILE " !for_disabled_users"; } else { print FILE " for_inetusers"; } | |
3385 | } | |
3386 | if (($proxysettings{'AUTH_METHOD'} eq 'ldap') || (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'off')) || ($proxysettings{'AUTH_METHOD'} eq 'radius')) | |
3387 | { | |
3388 | print FILE " for_inetusers"; | |
3389 | } | |
3390 | if (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on')) | |
3391 | { | |
3392 | if ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') | |
3393 | { | |
3394 | if (($proxysettings{'NTLM_USER_ACL'} eq 'positive') && (!-z "$ntlmdir/msntauth.allowusers")) | |
3395 | { | |
3396 | print FILE " for_acl_users"; | |
3397 | } | |
3398 | if (($proxysettings{'NTLM_USER_ACL'} eq 'negative') && (!-z "$ntlmdir/msntauth.denyusers")) | |
3399 | { | |
3400 | print FILE " !for_acl_users"; | |
3401 | } | |
3402 | } else { print FILE " for_inetusers"; } | |
3403 | } | |
3404 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) | |
363fb6af | 3405 | { |
ed38f89d | 3406 | if ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') |
363fb6af | 3407 | { |
ed38f89d MT |
3408 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && (!-z "$raddir/radauth.allowusers")) |
3409 | { | |
3410 | print FILE " for_acl_users"; | |
3411 | } | |
3412 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && (!-z "$raddir/radauth.denyusers")) | |
3413 | { | |
3414 | print FILE " !for_acl_users"; | |
3415 | } | |
3416 | } else { print FILE " for_inetusers"; } | |
3417 | } | |
3418 | } | |
3419 | print FILE "\n"; | |
3420 | } | |
3421 | ||
3422 | if (!-z $acl_src_unrestricted_mac) | |
3423 | { | |
3424 | print FILE "http_access allow IPCop_unrestricted_mac"; | |
3425 | if ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'on') | |
3426 | { | |
3427 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3428 | { | |
3429 | if (!-z $disgrp) { print FILE " !for_disabled_users"; } else { print FILE " for_inetusers"; } | |
3430 | } | |
3431 | if (($proxysettings{'AUTH_METHOD'} eq 'ldap') || (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'off')) || ($proxysettings{'AUTH_METHOD'} eq 'radius')) | |
3432 | { | |
3433 | print FILE " for_inetusers"; | |
3434 | } | |
3435 | if (($proxysettings{'AUTH_METHOD'} eq 'ntlm') && ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on')) | |
3436 | { | |
3437 | if ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') | |
3438 | { | |
3439 | if (($proxysettings{'NTLM_USER_ACL'} eq 'positive') && (!-z "$ntlmdir/msntauth.allowusers")) | |
3440 | { | |
3441 | print FILE " for_acl_users"; | |
3442 | } | |
3443 | if (($proxysettings{'NTLM_USER_ACL'} eq 'negative') && (!-z "$ntlmdir/msntauth.denyusers")) | |
3444 | { | |
3445 | print FILE " !for_acl_users"; | |
3446 | } | |
3447 | } else { print FILE " for_inetusers"; } | |
3448 | } | |
3449 | if (($proxysettings{'AUTH_METHOD'} eq 'radius') && ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on')) | |
363fb6af | 3450 | { |
ed38f89d | 3451 | if ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') |
363fb6af | 3452 | { |
ed38f89d MT |
3453 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && (!-z "$raddir/radauth.allowusers")) |
3454 | { | |
3455 | print FILE " for_acl_users"; | |
3456 | } | |
3457 | if (($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && (!-z "$raddir/radauth.denyusers")) | |
3458 | { | |
3459 | print FILE " !for_acl_users"; | |
3460 | } | |
3461 | } else { print FILE " for_inetusers"; } | |
3462 | } | |
3463 | } | |
3464 | print FILE "\n"; | |
3465 | } | |
3466 | ||
3467 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3468 | { | |
3469 | if (!-z $disgrp) { print FILE "http_access deny for_disabled_users\n"; } | |
3470 | if (!-z $extgrp) { print FILE "http_access allow IPCop_networks for_extended_users\n"; } | |
3471 | } | |
3472 | ||
3473 | if ( | |
3474 | ( | |
3475 | ($proxysettings{'AUTH_METHOD'} eq 'ntlm') && | |
3476 | ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') && | |
3477 | ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && | |
3478 | ($proxysettings{'NTLM_USER_ACL'} eq 'negative') && | |
3479 | (!-z "$ntlmdir/msntauth.denyusers") | |
3480 | ) | |
3481 | || | |
3482 | ( | |
3483 | ($proxysettings{'AUTH_METHOD'} eq 'radius') && | |
3484 | ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && | |
3485 | ($proxysettings{'RADIUS_USER_ACL'} eq 'negative') && | |
3486 | (!-z "$raddir/radauth.denyusers") | |
3487 | ) | |
3488 | || | |
3489 | ( | |
3490 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3491 | ($proxysettings{'AUTH_ALWAYS_REQUIRED'} eq 'off') && | |
3492 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3493 | ($proxysettings{'IDENT_USER_ACL'} eq 'negative') && | |
3494 | (!-z "$identdir/identauth.denyusers") | |
3495 | ) | |
3496 | ) | |
3497 | { | |
3498 | print FILE "http_access deny for_acl_users"; | |
3499 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && (!-z "$identdir/hosts")) { print FILE " on_ident_aware_hosts"; } | |
3500 | print FILE "\n"; | |
3501 | } | |
3502 | ||
3503 | if (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on') && (!-z "$identhosts")) | |
3504 | { | |
3505 | print FILE "http_access allow"; | |
3506 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3507 | print FILE " !within_timeframe"; | |
3508 | } else { | |
3509 | print FILE " within_timeframe"; } | |
3510 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3511 | print FILE " !on_ident_aware_hosts\n"; | |
3512 | } | |
3513 | ||
3514 | print FILE "http_access allow IPCop_networks"; | |
3515 | if ( | |
3516 | ( | |
3517 | ($proxysettings{'AUTH_METHOD'} eq 'ntlm') && | |
3518 | ($proxysettings{'NTLM_ENABLE_INT_AUTH'} eq 'on') && | |
3519 | ($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && | |
3520 | ($proxysettings{'NTLM_USER_ACL'} eq 'positive') && | |
3521 | (!-z "$ntlmdir/msntauth.allowusers") | |
3522 | ) | |
3523 | || | |
3524 | ( | |
3525 | ($proxysettings{'AUTH_METHOD'} eq 'radius') && | |
3526 | ($proxysettings{'RADIUS_ENABLE_ACL'} eq 'on') && | |
3527 | ($proxysettings{'RADIUS_USER_ACL'} eq 'positive') && | |
3528 | (!-z "$raddir/radauth.allowusers") | |
3529 | ) | |
3530 | || | |
3531 | ( | |
3532 | ($proxysettings{'AUTH_METHOD'} eq 'ident') && | |
3533 | ($proxysettings{'IDENT_REQUIRED'} eq 'on') && | |
3534 | ($proxysettings{'IDENT_ENABLE_ACL'} eq 'on') && | |
3535 | ($proxysettings{'IDENT_USER_ACL'} eq 'positive') && | |
3536 | (!-z "$identdir/identauth.allowusers") | |
3537 | ) | |
3538 | ) | |
3539 | { | |
3540 | print FILE " for_acl_users"; | |
3541 | } elsif (((!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) || | |
3542 | (($proxysettings{'AUTH_METHOD'} eq 'ident') && ($proxysettings{'IDENT_REQUIRED'} eq 'on'))) { | |
3543 | print FILE " for_inetusers"; | |
3544 | } | |
3545 | if ((!($proxysettings{'AUTH_MAX_USERIP'} eq '')) && (!($proxysettings{'AUTH_METHOD'} eq 'none')) && (!($proxysettings{'AUTH_METHOD'} eq 'ident'))) | |
3546 | { | |
3547 | print FILE " !concurrent"; | |
3548 | } | |
3549 | if ($proxysettings{'TIME_ACCESS_MODE'} eq 'deny') { | |
3550 | print FILE " !within_timeframe"; | |
3551 | } else { | |
3552 | print FILE " within_timeframe"; } | |
3553 | if ($proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on') { print FILE " with_allowed_useragents"; } | |
3554 | print FILE "\n"; | |
3555 | ||
3556 | print FILE "http_access deny all\n\n"; | |
3557 | ||
3558 | if (($proxysettings{'FORWARD_IPADDRESS'} eq 'off') || ($proxysettings{'FORWARD_VIA'} eq 'off') || | |
3559 | (!($proxysettings{'FAKE_USERAGENT'} eq '')) || (!($proxysettings{'FAKE_REFERER'} eq ''))) | |
3560 | { | |
3561 | print FILE "#Strip HTTP Header\n"; | |
3562 | ||
3563 | if ($proxysettings{'FORWARD_IPADDRESS'} eq 'off') | |
3564 | { | |
3565 | print FILE "header_access X-Forwarded-For deny all\n"; | |
3566 | } | |
3567 | if ($proxysettings{'FORWARD_VIA'} eq 'off') | |
3568 | { | |
3569 | print FILE "header_access Via deny all\n"; | |
3570 | } | |
3571 | if (!($proxysettings{'FAKE_USERAGENT'} eq '')) | |
3572 | { | |
3573 | print FILE "header_access User-Agent deny all\n"; | |
3574 | } | |
3575 | if (!($proxysettings{'FAKE_REFERER'} eq '')) | |
3576 | { | |
3577 | print FILE "header_access Referer deny all\n"; | |
3578 | } | |
3579 | ||
3580 | print FILE "\n"; | |
3581 | ||
3582 | if ((!($proxysettings{'FAKE_USERAGENT'} eq '')) || (!($proxysettings{'FAKE_REFERER'} eq ''))) | |
3583 | { | |
3584 | if (!($proxysettings{'FAKE_USERAGENT'} eq '')) | |
3585 | { | |
3586 | print FILE "header_replace User-Agent $proxysettings{'FAKE_USERAGENT'}\n"; | |
3587 | } | |
3588 | if (!($proxysettings{'FAKE_REFERER'} eq '')) | |
3589 | { | |
3590 | print FILE "header_replace Referer $proxysettings{'FAKE_REFERER'}\n"; | |
3591 | } | |
3592 | print FILE "\n"; | |
3593 | } | |
3594 | } | |
3595 | ||
363fb6af MT |
3596 | if ($proxysettings{'SUPPRESS_VERSION'} eq 'on') { print FILE "httpd_suppress_version_string on\n\n" } |
3597 | ||
ed38f89d MT |
3598 | if ((!-z $mimetypes) && ($proxysettings{'ENABLE_MIME_FILTER'} eq 'on')) { |
3599 | if (!-z $acl_src_unrestricted_ip) { print FILE "http_reply_access allow IPCop_unrestricted_ips\n"; } | |
3600 | if (!-z $acl_src_unrestricted_mac) { print FILE "http_reply_access allow IPCop_unrestricted_mac\n"; } | |
3601 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3602 | { | |
3603 | if (!-z $extgrp) { print FILE "http_reply_access allow for_extended_users\n"; } | |
3604 | } | |
3605 | print FILE "http_reply_access deny blocked_mimetypes\n"; | |
3606 | print FILE "http_reply_access allow all\n\n"; | |
3607 | } | |
3608 | ||
3609 | print FILE <<END | |
3610 | maximum_object_size $proxysettings{'MAX_SIZE'} KB | |
3611 | minimum_object_size $proxysettings{'MIN_SIZE'} KB | |
3612 | ||
3613 | request_body_max_size $proxysettings{'MAX_OUTGOING_SIZE'} KB | |
3614 | END | |
3615 | ; | |
3616 | $replybodymaxsize = 1024 * $proxysettings{'MAX_INCOMING_SIZE'}; | |
3617 | if ($proxysettings{'MAX_INCOMING_SIZE'} > 0) { | |
3618 | if (!-z $acl_src_unrestricted_ip) { print FILE "reply_body_max_size 0 allow IPCop_unrestricted_ips\n"; } | |
3619 | if (!-z $acl_src_unrestricted_mac) { print FILE "reply_body_max_size 0 allow IPCop_unrestricted_mac\n"; } | |
3620 | if ($proxysettings{'AUTH_METHOD'} eq 'ncsa') | |
3621 | { | |
3622 | if (!-z $extgrp) { print FILE "reply_body_max_size 0 allow for_extended_users\n"; } | |
3623 | } | |
3624 | } | |
3625 | print FILE "reply_body_max_size $replybodymaxsize allow all\n\n"; | |
3626 | ||
3627 | print FILE "visible_hostname"; | |
3628 | if ($proxysettings{'VISIBLE_HOSTNAME'} eq '') | |
3629 | { | |
3630 | print FILE " $mainsettings{'HOSTNAME'}.$mainsettings{'DOMAINNAME'}\n\n"; | |
3631 | } else { | |
3632 | print FILE " $proxysettings{'VISIBLE_HOSTNAME'}\n\n"; | |
3633 | } | |
3634 | ||
3635 | if (!($proxysettings{'ADMIN_MAIL_ADDRESS'} eq '')) { print FILE "cache_mgr $proxysettings{'ADMIN_MAIL_ADDRESS'}\n\n"; } | |
3636 | ||
3637 | # Write the parent proxy info, if needed. | |
3638 | if ($remotehost ne '') | |
3639 | { | |
ed38f89d | 3640 | print FILE "cache_peer $remotehost parent $remoteport 3130 default no-query"; |
363fb6af MT |
3641 | |
3642 | # Enter authentication for the parent cache. Option format is | |
3643 | # login=user:password ($proxy1='YES') | |
3644 | # login=PASS ($proxy1='PASS') | |
3645 | # login=*:password ($proxysettings{'FORWARD_USERNAME'} eq 'on') | |
3646 | if (($proxy1 eq 'YES') || ($proxy1 eq 'PASS')) | |
3647 | { | |
3648 | print FILE " login=$proxysettings{'UPSTREAM_USER'}"; | |
3649 | if ($proxy1 eq 'YES') { print FILE ":$proxysettings{'UPSTREAM_PASSWORD'}"; } | |
ed38f89d | 3650 | } |
363fb6af MT |
3651 | elsif ($proxysettings{'FORWARD_USERNAME'} eq 'on') { print FILE " login=*:password"; } |
3652 | ||
3653 | print FILE "\nnever_direct allow all\n\n"; | |
ed38f89d | 3654 | } |
9fb25b1c | 3655 | if (($proxysettings{'ENABLE_FILTER'} eq 'on') && ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on')) |
363fb6af MT |
3656 | { |
3657 | print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n"; | |
9fb25b1c | 3658 | if ($filtersettings{'CHILDREN'} > $xlratorsettings{'CHILDREN'}) |
363fb6af MT |
3659 | { |
3660 | print FILE "url_rewrite_children $filtersettings{'CHILDREN'}\n\n"; | |
3661 | } else { | |
9fb25b1c | 3662 | print FILE "url_rewrite_children $xlratorsettings{'CHILDREN'}\n\n"; |
363fb6af MT |
3663 | } |
3664 | } else | |
3665 | { | |
9fb25b1c MT |
3666 | |
3667 | if ($proxysettings{'ENABLE_FILTER'} eq 'on') | |
3668 | { | |
3669 | print FILE <<END | |
f1baee3e | 3670 | url_rewrite_program /usr/bin/squidGuard |
363fb6af | 3671 | url_rewrite_children $filtersettings{'CHILDREN'} |
ed38f89d MT |
3672 | |
3673 | END | |
9fb25b1c | 3674 | ; |
ed38f89d | 3675 | } |
9fb25b1c MT |
3676 | if ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on') |
3677 | { | |
3678 | print FILE <<END | |
363fb6af | 3679 | url_rewrite_program /usr/sbin/updxlrator |
9fb25b1c | 3680 | url_rewrite_children $xlratorsettings{'CHILDREN'} |
ed38f89d MT |
3681 | |
3682 | END | |
9fb25b1c | 3683 | ; |
ed38f89d MT |
3684 | } |
3685 | } | |
ed38f89d MT |
3686 | close FILE; |
3687 | } | |
3688 | ||
3689 | # ------------------------------------------------------------------- | |
3690 | ||
3691 | sub adduser | |
3692 | { | |
3693 | my ($str_user, $str_pass, $str_group) = @_; | |
3694 | my @groupmembers=(); | |
3695 | ||
3696 | if ($str_pass eq 'lEaVeAlOnE') | |
3697 | { | |
3698 | open(FILE, "$userdb"); | |
3699 | @groupmembers = <FILE>; | |
3700 | close(FILE); | |
3701 | foreach $line (@groupmembers) { if ($line =~ /^$str_user:/i) { $str_pass = substr($line,index($line,":")); } } | |
3702 | &deluser($str_user); | |
3703 | open(FILE, ">>$userdb"); | |
3704 | flock FILE,2; | |
3705 | print FILE "$str_user$str_pass"; | |
3706 | close(FILE); | |
3707 | } else { | |
3708 | &deluser($str_user); | |
3709 | system("/usr/bin/htpasswd -b $userdb $str_user $str_pass"); | |
3710 | } | |
3711 | ||
3712 | if ($str_group eq 'standard') { open(FILE, ">>$stdgrp"); | |
3713 | } elsif ($str_group eq 'extended') { open(FILE, ">>$extgrp"); | |
3714 | } elsif ($str_group eq 'disabled') { open(FILE, ">>$disgrp"); } | |
3715 | flock FILE, 2; | |
3716 | print FILE "$str_user\n"; | |
3717 | close(FILE); | |
3718 | ||
3719 | return; | |
3720 | } | |
3721 | ||
3722 | # ------------------------------------------------------------------- | |
3723 | ||
3724 | sub deluser | |
3725 | { | |
3726 | my ($str_user) = @_; | |
3727 | my $groupfile=''; | |
3728 | my @groupmembers=(); | |
3729 | my @templist=(); | |
3730 | ||
3731 | foreach $groupfile ($stdgrp, $extgrp, $disgrp) | |
3732 | { | |
3733 | undef @templist; | |
3734 | open(FILE, "$groupfile"); | |
3735 | @groupmembers = <FILE>; | |
3736 | close(FILE); | |
3737 | foreach $line (@groupmembers) { if (!($line =~ /^$str_user$/i)) { push(@templist, $line); } } | |
3738 | open(FILE, ">$groupfile"); | |
3739 | flock FILE, 2; | |
3740 | print FILE @templist; | |
3741 | close(FILE); | |
3742 | } | |
3743 | ||
3744 | undef @templist; | |
3745 | open(FILE, "$userdb"); | |
3746 | @groupmembers = <FILE>; | |
3747 | close(FILE); | |
3748 | foreach $line (@groupmembers) { if (!($line =~ /^$str_user:/i)) { push(@templist, $line); } } | |
3749 | open(FILE, ">$userdb"); | |
3750 | flock FILE, 2; | |
3751 | print FILE @templist; | |
3752 | close(FILE); | |
3753 | ||
3754 | return; | |
3755 | } | |
ac1cfefa | 3756 | |
ed38f89d | 3757 | # ------------------------------------------------------------------- |