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