BUG 11696: VPN Subnets missing from wpad.dat

This patch fixes the behavior in 11696 and adds IPSEC and OpenVPN n2n subnets to wpad.dat so they don't pass through the proxy.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Oliver Fuhrer
2019-05-19 15:30:52 +02:00
committed by Michael Tremer
parent f8f4cd6660
commit bf2a1c524b

View File

@@ -2848,6 +2848,10 @@ sub write_acls
sub writepacfile
{
my %vpnconfig=();
my %ovpnconfig=();
&General::readhasharray("${General::swroot}/vpn/config", \%vpnconfig);
&General::readhasharray("${General::swroot}/ovpn/ovpnconfig", \%ovpnconfig);
open(FILE, ">/srv/web/ipfire/html/proxy.pac");
flock(FILE, 2);
print FILE "function FindProxyForURL(url, host)\n";
@@ -2910,6 +2914,27 @@ END
}
}
foreach my $key (sort { uc($vpnconfig{$a}[1]) cmp uc($vpnconfig{$b}[1]) } keys %vpnconfig) {
if ($vpnconfig{$key}[0] eq 'on' && $vpnconfig{$key}[3] ne 'host') {
my @networks = split(/\|/, $vpnconfig{$key}[11]);
foreach my $network (@networks) {
my ($vpnip, $vpnsub) = split("/", $network);
$vpnsub = &Network::convert_prefix2netmask($vpnsub) || $vpnsub;
print FILE " (isInNet(host, \"$vpnip\", \"$vpnsub\")) ||\n";
}
}
}
foreach my $key (sort { uc($ovpnconfig{$a}[1]) cmp uc($ovpnconfig{$b}[1]) } keys %ovpnconfig) {
if ($ovpnconfig{$key}[0] eq 'on' && $ovpnconfig{$key}[3] ne 'host') {
my @networks = split(/\|/, $ovpnconfig{$key}[11]);
foreach my $network (@networks) {
my ($vpnip, $vpnsub) = split("/", $network);
print FILE " (isInNet(host, \"$vpnip\", \"$vpnsub\")) ||\n";
}
}
}
print FILE <<END
(isInNet(host, "169.254.0.0", "255.255.0.0"))
)