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