&General::readhash("${General::swroot}/main/settings", \%mainsettings);
my $green_cidr = &General::ipcidr("$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}");
-my $blue_cidr = "# Blue not defined";
-if ($netsettings{'BLUE_DEV'}) {
+my $blue_cidr = "";
+if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) {
$blue_cidr = &General::ipcidr("$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}");
}
$proxysettings{'TRANSPARENT'} = 'off';
$proxysettings{'TRANSPARENT_BLUE'} = 'off';
$proxysettings{'PROXY_PORT'} = '800';
+$proxysettings{'TRANSPARENT_PORT'} = '3128';
$proxysettings{'VISIBLE_HOSTNAME'} = '';
$proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
$proxysettings{'ADMIN_PASSWORD'} = '';
$proxysettings{'CACHEMGR'} = 'off';
$proxysettings{'LOGQUERY'} = 'off';
$proxysettings{'LOGUSERAGENT'} = 'off';
-$proxysettings{'FILEDESCRIPTORS'} = '4096';
+$proxysettings{'FILEDESCRIPTORS'} = '16384';
$proxysettings{'CACHE_MEM'} = '2';
$proxysettings{'CACHE_SIZE'} = '50';
$proxysettings{'MAX_SIZE'} = '4096';
$errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'};
goto ERROR;
}
+ if (!(&General::validport($proxysettings{'TRANSPARENT_PORT'})))
+ {
+ $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'};
+ goto ERROR;
+ }
+ if ($proxysettings{'PROXY_PORT'} eq $proxysettings{'TRANSPARENT_PORT'}) {
+ $errormessage = $Lang::tr{'advproxy errmsg proxy ports equal'};
+ goto ERROR;
+ }
if (!($proxysettings{'UPSTREAM_PROXY'} eq ''))
{
my @temp = split(/:/,$proxysettings{'UPSTREAM_PROXY'});
}
}
if (!($proxysettings{'FILEDESCRIPTORS'} =~ /^\d+/) ||
- ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 65536))
+ ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 1048576))
{
$errormessage = $Lang::tr{'proxy errmsg filedescriptors'};
goto ERROR;
<tr>
<td class='base'>$Lang::tr{'advproxy transparent on'} <font color="$Header::colourgreen">Green</font>:</td>
<td><input type='checkbox' name='TRANSPARENT' $checked{'TRANSPARENT'}{'on'} /></td>
- <td class='base'>$Lang::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
- <td><input type='text' name='VISIBLE_HOSTNAME' value='$proxysettings{'VISIBLE_HOSTNAME'}' /></td>
+ <td width='25%' class='base'>$Lang::tr{'advproxy proxy port transparent'}:</td>
+ <td width='30%'><input type='text' name='TRANSPARENT_PORT' value='$proxysettings{'TRANSPARENT_PORT'}' size='5' /></td>
</tr>
<tr>
END
print "<td colspan='2'> </td>";
}
print <<END
- <td colspan='2'> </td>
+ <td class='base'>$Lang::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
+ <td><input type='text' name='VISIBLE_HOSTNAME' value='$proxysettings{'VISIBLE_HOSTNAME'}' /></td>
</tr>
<tr>
END
<td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td>
</tr>
<tr>
- <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></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 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>
+ <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='40%' /></td>
+ <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='40%' /></td>
</tr>
</table>
<hr size='1'>
<td width='25%'><input type='text' name='NCSA_USERNAME' value='$proxysettings{'NCSA_USERNAME'}' size='12'
END
;
- if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly "; }
+ if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly='readonly' "; }
print <<END
/></td>
<td width='25%' class='base'>$Lang::tr{'advproxy NCSA group'}:</td>
print FILE <<END
if (
(isPlainHostName(host)) ||
- (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) ||
(isInNet(host, "127.0.0.1", "255.0.0.0")) ||
- (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
- (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
- (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
+END
+;
+
+ if ($netsettings{'GREEN_DEV'}) {
+ print FILE " (isInNet(host, \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\")) ||\n";
+ }
+
+ if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) {
+ print FILE " (isInNet(host, \"$netsettings{'BLUE_NETADDRESS'}\", \"$netsettings{'BLUE_NETMASK'}\")) ||\n";
+ }
+
+ if (&Header::orange_used() && $netsettings{'ORANGE_DEV'}) {
+ print FILE " (isInNet(host, \"$netsettings{'ORANGE_NETADDRESS'}\", \"$netsettings{'ORANGE_NETMASK'}\")) ||\n";
+ }
+
+ print FILE <<END
(isInNet(host, "169.254.0.0", "255.255.0.0"))
)
return "DIRECT";
}
print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
- if ($proxysettings{'TRANSPARENT'} eq 'on') { print FILE " transparent" }
if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
print FILE "\n";
+ if ($proxysettings{'TRANSPARENT'} eq 'on') {
+ print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept";
+ if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
+ print FILE "\n";
+ }
+
if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') {
print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
- if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { print FILE " transparent" }
if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
print FILE "\n";
+
+ if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') {
+ print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept";
+ if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
+ print FILE "\n";
+ }
}
if ($proxysettings{'CACHE_SIZE'} > 0)
}
open (PORTS,"$acl_ports_ssl");
-@temp = <PORTS>;
+my @ssl_ports = <PORTS>;
close PORTS;
-if (@temp)
-{
- foreach (@temp) { print FILE "acl SSL_ports port $_"; }
+
+if (@ssl_ports) {
+ foreach (@ssl_ports) {
+ print FILE "acl SSL_ports port $_";
+ }
}
+
open (PORTS,"$acl_ports_safe");
-@temp = <PORTS>;
+my @safe_ports = <PORTS>;
close PORTS;
-if (@temp)
-{
- foreach (@temp) { print FILE "acl Safe_ports port $_"; }
+
+if (@safe_ports) {
+ foreach (@safe_ports) {
+ print FILE "acl Safe_ports port $_";
+ }
}
+
print FILE <<END
acl IPFire_http port $http_port
# Check if squidclamav is enabled.
if ($proxysettings{'ENABLE_CLAMAV'} eq 'on') {
print FILE "\n#Settings for squidclamav:\n";
- print FILE "http_port 127.0.0.1:$proxysettings{'PROXY_PORT'} transparent\n";
+ print FILE "http_port 127.0.0.1:$proxysettings{'PROXY_PORT'}\n";
print FILE "acl purge method PURGE\n";
print FILE "http_access deny to_localhost\n";
print FILE "http_access allow localhost\n";
print FILE "http_access deny purge\n";
print FILE "url_rewrite_access deny localhost\n";
}
- print FILE <<END
+ print FILE <<END;
#Access to squid:
#local machine, no restriction
http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
#Deny not web services
-http_access deny !Safe_ports
-http_access deny CONNECT !SSL_ports
-
END
- ;
+
+if (@safe_ports) {
+ print FILE "http_access deny !Safe_ports\n";
+}
+
+if (@ssl_ports) {
+ print FILE "http_access deny CONNECT !SSL_ports\n";
+}
if ($proxysettings{'AUTH_METHOD'} eq 'ident')
{