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