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