mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-11 11:35:54 +02:00
ipsec: Add block rules to avoid conntrack entries
If an IPsec VPN connections is not established, there are rare cases when packets are supposed to be sent through that said tunnel and incorrectly handled. Those packets are sent to the default gateway an entry for this connection is created in the connection tracking table (usually only happens to UDP). All following packets are sent the same route even after the tunnel has been brought up. That leads to SIP phones not being able to register among other things. This patch adds firewall rules that these packets are rejected. That will sent a notification to the client that the tunnel is not up and avoid the connection to be added to the connection tracking table. Apart from a small performance penalty there should be no other side-effects. Fixes: #10908 Signed-off-by: Michael Tremer <michael.tremer@ipfire.org> Cc: tomvend@rymes.com Cc: daniel.weismueller@ipfire.org Cc: morlix@morlix.de Reviewed-by: Timo Eissler <timo.eissler@ipfire.org>
This commit is contained in:
@@ -115,6 +115,11 @@ iptables_init() {
|
||||
iptables -A INPUT -j GUARDIAN
|
||||
iptables -A FORWARD -j GUARDIAN
|
||||
|
||||
# Block non-established IPsec networks
|
||||
iptables -N IPSECBLOCK
|
||||
iptables -A FORWARD -m policy --dir out --pol none -j IPSECBLOCK
|
||||
iptables -A OUTPUT -m policy --dir out --pol none -j IPSECBLOCK
|
||||
|
||||
# Block OpenVPN transfer networks
|
||||
iptables -N OVPNBLOCK
|
||||
iptables -A INPUT -i tun+ -j OVPNBLOCK
|
||||
@@ -270,6 +275,9 @@ iptables_init() {
|
||||
iptables -t nat -N REDNAT
|
||||
iptables -t nat -A POSTROUTING -j REDNAT
|
||||
|
||||
# Populate IPsec block chain
|
||||
/usr/lib/firewall/ipsec-block
|
||||
|
||||
# Apply OpenVPN firewall rules
|
||||
/usr/local/bin/openvpnctrl --firewall-rules
|
||||
|
||||
|
||||
Reference in New Issue
Block a user