#!/usr/bin/perl
#
-# IPCop CGIs
+# (c) 2004-2007 marco.s - http://www.advproxy.net
#
# This code is distributed under the terms of the GPL
#
-# $Id: advproxy.cgi,v 2.0.0 [beta] 2006/09/03 00:00:00 marco.s Exp $
+# $Id: advproxy.cgi,v 2.1.0 2007/03/06 00:00:00 marco.s Exp $
#
use strict;
# enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
my $http_port='81';
my $https_port='444';
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
my %proxysettings=();
my %netsettings=();
my %filtersettings=();
-my %updaccelsettings=();
+my %xlratorsettings=();
my %stdproxysettings=();
my %mainsettings=();
-my $urlfilter_addon=0;
-my $updaccel_addon=0;
my %checked=();
my %selected=();
my $identhosts = "$identdir/hosts";
-my $authdir = "/usr/lib/squid/advproxy/auth";
-my $errordir = "/usr/lib/squid/advproxy/errors";
+my $authdir = "/usr/lib/squid/auth";
+my $errordir = "/usr/lib/squid/errors";
my $acl_src_subnets = "$acldir/src_subnets.acl";
my $acl_src_banned_ip = "$acldir/src_banned_ip.acl";
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
-if (-e "${General::swroot}/urlfilter/version") { $urlfilter_addon = 1; }
-if (-e "${General::swroot}/updatexlrator/version") { $updaccel_addon = 1; }
-
-if ($urlfilter_addon) {
- $filtersettings{'CHILDREN'} = '5';
- if (-e "${General::swroot}/urlfilter/settings") {
- &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings);
- }
- $urlfilterversion = `cat ${General::swroot}/urlfilter/version`;
- $urlfilterversion =~ s/([^\s]+).*/$1/;
+$filtersettings{'CHILDREN'} = '5';
+if (-e "${General::swroot}/urlfilter/settings") {
+ &General::readhash("${General::swroot}/urlfilter/settings", \%filtersettings);
}
-if ($updaccel_addon) {
- $updaccelsettings{'CHILDREN'} = '10';
- if (-e "${General::swroot}/updatexlrator/settings") {
- &General::readhash("${General::swroot}/updatexlrator/settings", \%updaccelsettings);
- }
- $updaccelversion = `cat ${General::swroot}/updatexlrator/version`;
- $updaccelversion =~ s/([^\s]+).*/$1/;
+$xlratorsettings{'CHILDREN'} = '5';
+if (-e "${General::swroot}/updatexlrator/settings") {
+ &General::readhash("${General::swroot}/updatexlrator/settings", \%xlratorsettings);
}
&Header::showhttpheaders();
$proxysettings{'PROXY_PORT'} = '800';
$proxysettings{'VISIBLE_HOSTNAME'} = '';
$proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
-$proxysettings{'ERR_LANGUAGE'} = 'English';
-$proxysettings{'ERR_DESIGN'} = 'IPCop';
+$proxysettings{'ERR_LANGUAGE'} = 'German';
+$proxysettings{'ERR_DESIGN'} = 'ipfire';
$proxysettings{'SUPPRESS_VERSION'} = 'off';
$proxysettings{'FORWARD_VIA'} = 'off';
$proxysettings{'FORWARD_IPADDRESS'} = 'off';
$proxysettings{'OFFLINE_MODE'} = 'off';
$proxysettings{'CLASSROOM_EXT'} = 'off';
$proxysettings{'SUPERVISOR_PASSWORD'} = '';
+$proxysettings{'NO_PROXY_LOCAL'} = 'off';
+$proxysettings{'NO_PROXY_LOCAL_BLUE'} = 'off';
$proxysettings{'TIME_ACCESS_MODE'} = 'allow';
$proxysettings{'TIME_FROM_HOUR'} = '00';
$proxysettings{'TIME_FROM_MINUTE'} = '00';
$proxysettings{'IDENT_TIMEOUT'} = '10';
$proxysettings{'IDENT_ENABLE_ACL'} = 'off';
$proxysettings{'IDENT_USER_ACL'} = 'positive';
-
-if ($urlfilter_addon) {
- $proxysettings{'ENABLE_FILTER'} = 'off';
-}
-
-if ($updaccel_addon) {
- $proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
-}
+$proxysettings{'ENABLE_FILTER'} = 'off';
+$proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
$ncsa_buttontext = $Lang::tr{'advproxy NCSA create user'};
&deluser($proxysettings{'ID'});
}
+$checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
+$checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
+$checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
+
if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'})
{
$proxysettings{'NCSA_EDIT_MODE'} = 'yes';
{
chomp;
@useragent = split(/,/);
- if ($proxysettings{'UA_'.@useragent[0]} eq 'on') { $browser_regexp .= "@useragent[2]|"; }
+ if ($proxysettings{'UA_'.$useragent[0]} eq 'on') { $browser_regexp .= "$useragent[2]|"; }
}
chop($browser_regexp);
if (!$browser_regexp)
if (-e "${General::swroot}/proxy/settings") { &General::readhash("${General::swroot}/proxy/settings", \%stdproxysettings); }
$stdproxysettings{'PROXY_PORT'} = $proxysettings{'PROXY_PORT'};
- if ($urlfilter_addon) { $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'}; }
- if ($updaccel_addon) { $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'}; }
+ $stdproxysettings{'ENABLE_FILTER'} = $proxysettings{'ENABLE_FILTER'};
+ $stdproxysettings{'ENABLE_UPDXLRATOR'} = $proxysettings{'ENABLE_UPDXLRATOR'};
&General::writehash("${General::swroot}/proxy/settings", \%stdproxysettings);
&writeconfig;
&writepacfile;
+ system ('/usr/local/bin/squidctrl', 'disable');
unlink "${General::swroot}/proxy/enable";
unlink "${General::swroot}/proxy/transparent";
unlink "${General::swroot}/proxy/enable_blue";
unlink "${General::swroot}/proxy/transparent_blue";
if ($proxysettings{'ENABLE'} eq 'on') {
- system ('/bin/touch', "${General::swroot}/proxy/enable"); }
+ system ('/usr/bin/touch', "${General::swroot}/proxy/enable");
+ system ('/usr/local/bin/squidctrl', 'enable'); }
if ($proxysettings{'TRANSPARENT'} eq 'on') {
- system ('/bin/touch', "${General::swroot}/proxy/transparent"); }
+ system ('/usr/bin/touch', "${General::swroot}/proxy/transparent"); }
if ($proxysettings{'ENABLE_BLUE'} eq 'on') {
- system ('/bin/touch', "${General::swroot}/proxy/enable_blue"); }
+ system ('/usr/bin/touch', "${General::swroot}/proxy/enable_blue");
+ system ('/usr/local/bin/squidctrl', 'enable'); }
if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') {
- system ('/bin/touch', "${General::swroot}/proxy/transparent_blue"); }
+ system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); }
- if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/restartsquid'); }
+ if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/squidctrl restart >/dev/null 2>&1'); }
}
}
if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy clear cache'})
{
- system('/usr/local/bin/restartsquid','-f');
+ system('/usr/local/bin/squidctrl flush >/dev/null 2>&1');
}
if (!$errormessage)
$selected{'ERR_LANGUAGE'}{$proxysettings{'ERR_LANGUAGE'}} = "selected='selected'";
$selected{'ERR_DESIGN'}{$proxysettings{'ERR_DESIGN'}} = "selected='selected'";
+$checked{'NO_PROXY_LOCAL'}{'off'} = '';
+$checked{'NO_PROXY_LOCAL'}{'on'} = '';
+$checked{'NO_PROXY_LOCAL'}{$proxysettings{'NO_PROXY_LOCAL'}} = "checked='checked'";
+$checked{'NO_PROXY_LOCAL_BLUE'}{'off'} = '';
+$checked{'NO_PROXY_LOCAL_BLUE'}{'on'} = '';
+$checked{'NO_PROXY_LOCAL_BLUE'}{$proxysettings{'NO_PROXY_LOCAL_BLUE'}} = "checked='checked'";
+
$checked{'CLASSROOM_EXT'}{'off'} = '';
$checked{'CLASSROOM_EXT'}{'on'} = '';
$checked{'CLASSROOM_EXT'}{$proxysettings{'CLASSROOM_EXT'}} = "checked='checked'";
foreach (@useragentlist) {
@useragent = split(/,/);
- $checked{'UA_'.@useragent[0]}{'off'} = '';
- $checked{'UA_'.@useragent[0]}{'on'} = '';
- $checked{'UA_'.@useragent[0]}{$proxysettings{'UA_'.@useragent[0]}} = "checked='checked'";
+ $checked{'UA_'.$useragent[0]}{'off'} = '';
+ $checked{'UA_'.$useragent[0]}{'on'} = '';
+ $checked{'UA_'.$useragent[0]}{$proxysettings{'UA_'.$useragent[0]}} = "checked='checked'";
}
$checked{'AUTH_METHOD'}{'none'} = '';
$checked{'IDENT_USER_ACL'}{'negative'} = '';
$checked{'IDENT_USER_ACL'}{$proxysettings{'IDENT_USER_ACL'}} = "checked='checked'";
-if ($urlfilter_addon) {
- $checked{'ENABLE_FILTER'}{'off'} = '';
- $checked{'ENABLE_FILTER'}{'on'} = '';
- $checked{'ENABLE_FILTER'}{$proxysettings{'ENABLE_FILTER'}} = "checked='checked'";
-}
+$checked{'ENABLE_FILTER'}{'off'} = '';
+$checked{'ENABLE_FILTER'}{'on'} = '';
+$checked{'ENABLE_FILTER'}{$proxysettings{'ENABLE_FILTER'}} = "checked='checked'";
-if ($updaccel_addon) {
- $checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
- $checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
- $checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
-}
+$checked{'ENABLE_UPDXLRATOR'}{'off'} = '';
+$checked{'ENABLE_UPDXLRATOR'}{'on'} = '';
+$checked{'ENABLE_UPDXLRATOR'}{$proxysettings{'ENABLE_UPDXLRATOR'}} = "checked='checked'";
&Header::openpage($Lang::tr{'advproxy advanced web proxy configuration'}, 1, '');
<td><input type='checkbox' name='SUPPRESS_VERSION' $checked{'SUPPRESS_VERSION'}{'on'} /></td>
<td class='base'>$Lang::tr{'advproxy error design'}:</td>
<td class='base'><select name='ERR_DESIGN'>
- <option value='ipcop' $selected{'ERR_DESIGN'}{'ipcop'}>IPCop</option>
+ <option value='ipfire' $selected{'ERR_DESIGN'}{'ipfire'}>IPFire</option>
<option value='squid' $selected{'ERR_DESIGN'}{'squid'}>$Lang::tr{'advproxy standard'}</option>
</select></td>
</tr>
</table>
<hr size='1'>
<table width='100%'>
+<tr>
+ <td class='base' width='50%'><b>$Lang::tr{'advproxy url filter'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
+ <td class='base' width='50%'><b>$Lang::tr{'advproxy update accelerator'}</b> $Lang::tr{'advproxy enabled'}<input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td>
+</tr>
+</table>
+<hr size='1'>
+<table width='100%'>
<tr>
<td colspan='4' class='base'><b>$Lang::tr{'advproxy upstream proxy'}</b></td>
</tr>
<tr>
- <td width='25%' class='base'>$Lang::tr{'advproxy via forwarding'}:</td>
- <td width='20%'><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td>
- <td width='25%' class='base'>$Lang::tr{'advproxy upstream proxy host:port'} <img src='/blob.gif' alt='*' /></td>
- <td width='30%'><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td>
+ <td class='base'>$Lang::tr{'advproxy via forwarding'}:</td><td><input type='checkbox' name='FORWARD_VIA' $checked{'FORWARD_VIA'}{'on'} /></td>
+ <td class='base'>$Lang::tr{'advproxy upstream proxy host:port'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_PROXY' value='$proxysettings{'UPSTREAM_PROXY'}' /></td>
</tr>
<tr>
- <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td>
- <td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td>
- <td class='base'>$Lang::tr{'advproxy upstream username'}: <img src='/blob.gif' alt='*' /></td>
- <td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td>
+ <td class='base'>$Lang::tr{'advproxy client IP forwarding'}:</td><td><input type='checkbox' name='FORWARD_IPADDRESS' $checked{'FORWARD_IPADDRESS'}{'on'} /></td>
+ <td class='base'>$Lang::tr{'advproxy upstream username'}<img src='/blob.gif' alt='*' /></td><td><input type='text' name='UPSTREAM_USER' value='$proxysettings{'UPSTREAM_USER'}' /></td>
</tr>
<tr>
- <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td>
- <td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} /></td>
- <td class='base'>$Lang::tr{'advproxy upstream password'}: <img src='/blob.gif' alt='*' /></td>
- <td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td>
+ <td class='base'>$Lang::tr{'advproxy username forwarding'}:</td><td><input type='checkbox' name='FORWARD_USERNAME' $checked{'FORWARD_USERNAME'}{'on'} />
+ <td class='base'>$Lang::tr{'advproxy upstream password'}:<img src='/blob.gif' alt='*' /></td><td><input type='password' name='UPSTREAM_PASSWORD' value='$proxysettings{'UPSTREAM_PASSWORD'}' /></td>
</tr>
<tr>
- <td class='base'>$Lang::tr{'advproxy no connection auth'}:</td>
- <td><input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td>
- <td> </td>
- <td> </td>
+ <td class='base' colspan='4'>$Lang::tr{'advproxy no connection auth'}:<input type='checkbox' name='NO_CONNECTION_AUTH' $checked{'NO_CONNECTION_AUTH'}{'on'} /></td>
</tr>
</table>
<hr size='1'>
<td colspan='4' class='base'><b>$Lang::tr{'advproxy log settings'}</b></td>
</tr>
<tr>
- <td width='25%' class='base'>$Lang::tr{'advproxy log enabled'}:</td>
- <td width='20%'><input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
- <td width='25%'class='base'>$Lang::tr{'advproxy log query'}:</td>
- <td width='30%'><input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td>
-</tr>
-<tr>
- <td> </td>
- <td> </td>
- <td class='base'>$Lang::tr{'advproxy log useragent'}:</td>
- <td><input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td>
+ <td class='base'>$Lang::tr{'advproxy log enabled'}:<input type='checkbox' name='LOGGING' $checked{'LOGGING'}{'on'} /></td>
+ <td class='base'>$Lang::tr{'advproxy log query'}:<input type='checkbox' name='LOGQUERY' $checked{'LOGQUERY'}{'on'} /></td>
+ <td class='base'>$Lang::tr{'advproxy log useragent'}:<input type='checkbox' name='LOGUSERAGENT' $checked{'LOGUSERAGENT'}{'on'} /></td>
</tr>
</table>
<hr size='1'>
<td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td>
</tr>
<tr>
- <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
+ <td width='35%'></td><td width='15%'></td><td width='35%'></td><td width='15%'></td>
</tr>
<tr>
<td class='base'>$Lang::tr{'advproxy ram cache size'}:</td>
<!-- intentionally left empty -->
</tr>
<tr>
- <td><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
+ <td align=center><textarea name='DST_NOCACHE' cols='32' rows='6' wrap='off'>
END
;
<td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td>
</tr>
<tr>
- <td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
+ <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
</tr>
<tr>
<td colspan='2' class='base'>$Lang::tr{'advproxy standard ports'}:</td>
<td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
</tr>
<tr>
- <td colspan='2' class='base'>$Lang::tr{'advproxy allowed subnets'}:</td>
- <td colspan='2'> </td>
+ <td colspan='4' class='base'>$Lang::tr{'advproxy allowed subnets'}:</td>
</tr>
<tr>
- <td colspan='2'><textarea name='SRC_SUBNETS' cols='32' rows='6' wrap='off'>
+ <td colspan='2' rowspan='4'><textarea name='SRC_SUBNETS' cols='32' rows='3' wrap='off'>
END
;
print <<END
</textarea></td>
+END
+;
+
+$line = $Lang::tr{'advproxy no internal proxy on green'};
+$line =~ s/Green/<font color="$Header::colourgreen">Green<\/font>/i;
+print "<td class='base'>$line:</td>\n";
+print <<END
+ <td><input type='checkbox' name='NO_PROXY_LOCAL' $checked{'NO_PROXY_LOCAL'}{'on'} /></td>
+</tr>
+END
+;
+if ($netsettings{'BLUE_DEV'}) {
+ $line = $Lang::tr{'advproxy no internal proxy on blue'};
+ $line =~ s/Blue/<font color="$Header::colourblue">Blue<\/font>/i;
+ print "<tr>\n";
+ print "<td class='base'>$line:</td>\n";
+ print <<END
+ <td><input type='checkbox' name='NO_PROXY_LOCAL_BLUE' $checked{'NO_PROXY_LOCAL_BLUE'}{'on'} /></td>
+</tr>
+END
+;
+}
+print <<END
+<tr>
+ <td colspan='2'> </td>
+</tr>
+<tr>
<td colspan='2'> </td>
</tr>
</table>
<td colspan='2' class='base'>$Lang::tr{'advproxy unrestricted mac clients'}: <img src='/blob.gif' alt='*' /></td>
</tr>
<tr>
- <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='6' wrap='off'>
+ <td colspan='2'><textarea name='SRC_UNRESTRICTED_IP' cols='32' rows='3' wrap='off'>
END
;
print <<END
</textarea></td>
- <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='6' wrap='off'>
+ <td colspan='2'><textarea name='SRC_UNRESTRICTED_MAC' cols='32' rows='3' wrap='off'>
END
;
<td colspan='2' class='base'>$Lang::tr{'advproxy banned mac clients'}: <img src='/blob.gif' alt='*' /></td>
</tr>
<tr>
- <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='6' wrap='off'>
+ <td colspan='2'><textarea name='SRC_BANNED_IP' cols='32' rows='3' wrap='off'>
END
;
print <<END
</textarea></td>
- <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='6' wrap='off'>
+ <td colspan='2'><textarea name='SRC_BANNED_MAC' cols='32' rows='3' wrap='off'>
END
;
<table width='100%'>
<tr>
- <td colspan='4'><b>$Lang::tr{'advproxy classroom extensions'}</b></td>
+ <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>
</tr>
<tr>
<td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
</tr>
<tr>
- <td class='base'>$Lang::tr{'advproxy enabled'}:</td>
- <td><input type='checkbox' name='CLASSROOM_EXT' $checked{'CLASSROOM_EXT'}{'on'} /></td>
+
+END
+;
+if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){
+print <<END
<td class='base'>$Lang::tr{'advproxy supervisor password'}: <img src='/blob.gif' alt='*' /></td>
<td><input type='password' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' size='12' /></td>
</tr>
<tr>
<td colspan='2' class='base'>$Lang::tr{'advproxy cre group definitions'}:</td>
<td colspan='2' class='base'>$Lang::tr{'advproxy cre supervisors'}: <img src='/blob.gif' alt='*' /></td>
-</tr>
+END
+;
+}
+print "</tr>";
+if ($proxysettings{'CLASSROOM_EXT'} eq 'on'){
+print <<END
<tr>
<td colspan='2'><textarea name='CRE_GROUPS' cols='32' rows='6' wrap='off'>
END
print <<END
</textarea></td>
</tr>
-
-</table>
-
-<hr size='1'>
END
;
+}
+print "</table><hr size='1'>";
+
} else {
print <<END
<input type='hidden' name='SUPERVISOR_PASSWORD' value='$proxysettings{'SUPERVISOR_PASSWORD'}' />
<hr size='1'>
<table width='100%'>
<tr>
- <td colspan='4'><b>$Lang::tr{'advproxy MIME filter'}</b></td>
-</tr>
-<tr>
- <td width='25%' class='base'>$Lang::tr{'advproxy enabled'}:</td>
- <td width='20%'><input type='checkbox' name='ENABLE_MIME_FILTER' $checked{'ENABLE_MIME_FILTER'}{'on'} /></td>
+ <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>
</tr>
+END
+;
+if ( $proxysettings{'ENABLE_MIME_FILTER'} eq 'on' ){
+print <<END
<tr>
<td colspan='2' class='base'>$Lang::tr{'advproxy MIME block types'}: <img src='/blob.gif' alt='*' /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
+END
+;
+}
+print <<END
</table>
+
<hr size='1'>
<table width='100%'>
<tr>
- <td colspan='4'><b>$Lang::tr{'advproxy web browser'}</b></td>
-</tr>
-<tr>
- <td width='25%' class='base'>$Lang::tr{'advproxy UA enable filter'}:</td>
- <td width='20%'><input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td>
- <td> </td>
- <td> </td>
+ <td colspan='4'><b>$Lang::tr{'advproxy web browser'}</b> $Lang::tr{'advproxy UA enable filter'}:<input type='checkbox' name='ENABLE_BROWSER_CHECK' $checked{'ENABLE_BROWSER_CHECK'}{'on'} /></td>
</tr>
+END
+;
+if ( $proxysettings{'ENABLE_BROWSER_CHECK'} eq 'on' ){
+print <<END
<tr>
<td colspan='4'><i>
END
if ($i eq 0) { print "<tr>\n"; }
if (($n+$i) < @useragentlist) {
@useragent = split(/,/,@useragentlist[$n+$i]);
- print "<td width='15%'>@useragent[1]:<\/td>\n";
- print "<td width='10%'><input type='checkbox' name='UA_@useragent[0]' $checked{'UA_'.@useragent[0]}{'on'} /></td>\n";
+ print "<td width='15%'>$useragent[1]:<\/td>\n";
+ print "<td width='10%'><input type='checkbox' name='UA_$useragent[0]' $checked{'UA_'.$useragent[0]}{'on'} /></td>\n";
}
if ($i eq 3) { print "<\/tr>\n"; }
}
}
-
+}
print <<END
</table>
<hr size='1'>
</tr>
<tr>
<td class='base'>$Lang::tr{'advproxy fake useragent'}: <img src='/blob.gif' alt='*' /></td>
-</tr>
-<tr>
- <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td>
-</tr>
-<tr>
<td class='base'>$Lang::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td>
</tr>
<tr>
+ <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td>
<td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='56' /></td>
</tr>
</table>
END
;
-if ($urlfilter_addon) {
- print <<END
-<table width='100%'>
-<tr>
- <td class='base' colspan='4'><b>$Lang::tr{'advproxy url filter'}</b> [<font color='$Header::colourred'> $urlfilterversion </font>]</td>
-</tr>
-<tr>
- <td class='base' width='25%'>$Lang::tr{'advproxy enabled'}:</td>
- <td class='base' width='20%'><input type='checkbox' name='ENABLE_FILTER' $checked{'ENABLE_FILTER'}{'on'} /></td>
- <td> </td>
- <td> </td>
-</tr>
-</table>
-<hr size='1'>
-END
-; }
-
-if ($updaccel_addon) {
- print <<END
-<table width='100%'>
-<tr>
- <td class='base' colspan='4'><b>$Lang::tr{'advproxy update accelerator'}</b> [<font color='$Header::colourred'> $updaccelversion </font>]</td>
-</tr>
-<tr>
- <td class='base' width='25%'>$Lang::tr{'advproxy enabled'}:</td>
- <td class='base' width='20%'><input type='checkbox' name='ENABLE_UPDXLRATOR' $checked{'ENABLE_UPDXLRATOR'}{'on'} /></td>
- <td> </td>
- <td> </td>
-</tr>
-</table>
-<hr size='1'>
-END
-; }
-
print <<END
<table width='100%'>
<tr>
# If the password file contains entries, print entries and action icons
-if (! -z "$userdb") {
+if ( $userdb ne "" ) {
print <<END
<tr>
<td width='30%' class='boldbase' align='center'><b><i>$Lang::tr{'advproxy NCSA username'}</i></b></td>
if($proxysettings{'ACTION'} eq $Lang::tr{'edit'} && $proxysettings{'ID'} eq $line) {
print "<tr bgcolor='$Header::colouryellow'>\n"; }
elsif ($id % 2) {
- print "<tr bgcolor='$Header::table1colour'>\n"; }
+ print "<tr bgcolor='$color{'color20'}'>\n"; }
else {
- print "<tr bgcolor='$Header::table2colour'>\n"; }
+ print "<tr bgcolor='$color{'color22'}'>\n"; }
print <<END
<td align='center'>$temp[0]</td>
print <<END
</table>
<br>
-<table width='100%'>
+<table>
<tr>
<td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
<td> <img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
sub writepacfile
{
- open(FILE, ">/home/httpd/html/proxy.pac");
+ open(FILE, ">/srv/web/ipfire/html/proxy.pac");
flock(FILE, 2);
print FILE "function FindProxyForURL(url, host)\n";
print FILE "{\n";
;
if ($proxysettings{'ENABLE'} eq 'on')
{
+ print FILE "if (\n";
+ print FILE " (isInNet(myIpAddress(), \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\"))";
+
+ undef @templist;
+ if (-e "$acl_src_subnets") {
+ open(SUBNETS,"$acl_src_subnets");
+ @templist = <SUBNETS>;
+ close(SUBNETS);
+ }
+
+ foreach (@templist)
+ {
+ @temp = split(/\//);
+ if (
+ ($temp[0] ne $netsettings{'GREEN_NETADDRESS'}) && ($temp[1] ne $netsettings{'GREEN_NETMASK'}) &&
+ ($temp[0] ne $netsettings{'BLUE_NETADDRESS'}) && ($temp[1] ne $netsettings{'BLUE_NETMASK'})
+ )
+ {
+ chomp $temp[1];
+ print FILE " ||\n (isInNet(myIpAddress(), \"$temp[0]\", \"$temp[1]\"))";
+ }
+ }
+
+ print FILE "\n";
+
print FILE <<END
-if (
- (isInNet(myIpAddress(), "$netsettings{'GREEN_NETADDRESS'}", "$netsettings{'GREEN_NETMASK'}"))
+
+
)
return "PROXY $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
END
END
;
- if (($proxysettings{'ERR_DESIGN'} eq 'ipcop') && ($proxysettings{'VISIBLE_HOSTNAME'} eq ''))
+ if (($proxysettings{'ERR_DESIGN'} eq 'ipfire' ))
{
- print FILE "error_directory $errordir.ipcop/$proxysettings{'ERR_LANGUAGE'}\n\n";
+ print FILE "error_directory $errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}\n\n";
} else {
print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n";
}
acl IPCop_https port $https_port
acl IPCop_ips dst $netsettings{'GREEN_ADDRESS'}
acl IPCop_networks src "$acl_src_subnets"
+acl IPCop_servers dst "$acl_src_subnets"
acl IPCop_green_network src $netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'}
+acl IPCop_green_servers dst $netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'}
END
;
if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPCop_blue_network src $netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}\n"; }
+ if ($netsettings{'BLUE_DEV'}) { print FILE "acl IPCop_blue_servers dst $netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}\n"; }
if (!-z $acl_src_banned_ip) { print FILE "acl IPCop_banned_ips src \"$acl_src_banned_ip\"\n"; }
if (!-z $acl_src_banned_mac) { print FILE "acl IPCop_banned_mac arp \"$acl_src_banned_mac\"\n"; }
if (!-z $acl_src_unrestricted_ip) { print FILE "acl IPCop_unrestricted_ips src \"$acl_src_unrestricted_ip\"\n"; }
END
;
print FILE "deny_info ";
- if ((($proxysettings{'ERR_DESIGN'} eq 'ipcop') && (-e "$errordir.ipcop/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
+ if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
(($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")))
{
print FILE "ERR_ACCESS_DISABLED";
}
print FILE " IPCop_no_access_ips\n";
print FILE "deny_info ";
- if ((($proxysettings{'ERR_DESIGN'} eq 'ipcop') && (-e "$errordir.ipcop/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
+ if ((($proxysettings{'ERR_DESIGN'} eq 'ipfire') && (-e "$errordir.ipfire/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")) ||
(($proxysettings{'ERR_DESIGN'} eq 'squid') && (-e "$errordir/$proxysettings{'ERR_LANGUAGE'}/ERR_ACCESS_DISABLED")))
{
print FILE "ERR_ACCESS_DISABLED";
print FILE "delay_access 2 deny all\n";
}
- print FILE "delay_initial_bucket_level 100%\n";
+ print FILE "delay_initial_bucket_level 100\n";
print FILE "\n";
}
+
+if ($proxysettings{'NO_PROXY_LOCAL'} eq 'on')
+{
+ print FILE "#Prevent internal proxy access to Green\n";
+ print FILE "http_access deny IPCop_green_servers !IPCop_green_network\n\n";
+}
+
+if ($proxysettings{'NO_PROXY_LOCAL_BLUE'} eq 'on')
+{
+ print FILE "#Prevent internal proxy access from Blue\n";
+ print FILE "http_access allow IPCop_blue_network IPCop_blue_servers\n";
+ print FILE "http_access deny IPCop_blue_network IPCop_servers\n\n";
+}
+
print FILE <<END
#Set custom configured ACLs
END
print FILE "\nnever_direct allow all\n\n";
}
- if (($urlfilter_addon) && ($updaccel_addon) && ($proxysettings{'ENABLE_FILTER'} eq 'on') && ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on'))
+ if (($proxysettings{'ENABLE_FILTER'} eq 'on') && ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on'))
{
print FILE "url_rewrite_program /usr/sbin/redirect_wrapper\n";
- if ($filtersettings{'CHILDREN'} > $updaccelsettings{'CHILDREN'})
+ if ($filtersettings{'CHILDREN'} > $xlratorsettings{'CHILDREN'})
{
print FILE "url_rewrite_children $filtersettings{'CHILDREN'}\n\n";
} else {
- print FILE "url_rewrite_children $updaccelsettings{'CHILDREN'}\n\n";
+ print FILE "url_rewrite_children $xlratorsettings{'CHILDREN'}\n\n";
}
} else
{
- if ($urlfilter_addon) {
- if ($proxysettings{'ENABLE_FILTER'} eq 'on')
- {
- print FILE <<END
-url_rewrite_program /usr/sbin/squidGuard
+
+ if ($proxysettings{'ENABLE_FILTER'} eq 'on')
+ {
+ print FILE <<END
+url_rewrite_program /usr/bin/squidGuard
url_rewrite_children $filtersettings{'CHILDREN'}
END
- ;
- }
+ ;
}
- if ($updaccel_addon) {
- if ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on')
- {
- print FILE <<END
+ if ($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on')
+ {
+ print FILE <<END
url_rewrite_program /usr/sbin/updxlrator
-url_rewrite_children $updaccelsettings{'CHILDREN'}
+url_rewrite_children $xlratorsettings{'CHILDREN'}
END
- ;
- }
+ ;
}
}
close FILE;