From 46b27fbe45aeb5d50383d3faa2209b98bd06c7ab Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Sun, 8 Sep 2019 16:26:03 +0200 Subject: [PATCH] =?UTF-8?q?[Firewall]=20[Filtrage=20Port]=20Emp=C3=AAche?= =?UTF-8?q?=20la=20g=C3=A9n=C3=A9ration=20du=20pare-feu=20de=20crasher=20l?= =?UTF-8?q?orsqu'aucune=20IP=20n'est=20assign=C3=A9e=20=C3=A0=20une=20inte?= =?UTF-8?q?rface=20dont=20on=20a=20ouvert=20un=20port.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 8b6896c..294ccc2 100755 --- a/main.py +++ b/main.py @@ -285,7 +285,8 @@ class iptables: def add_specific_rule(ports, ip_type, chain, interface, subnet, protocol, direction): """Règles spécifique, fonction de factorisation""" if ip_type == '4': - self.add_in_subtable(chain, subtable, """-%s %s -p %s -m multiport --dports %s -j RETURN""" % (direction[0], interface['ipv4'], protocol, ports)) + if interface['ipv4']: + self.add_in_subtable(chain, subtable, """-%s %s -p %s -m multiport --dports %s -j RETURN""" % (direction[0], interface['ipv4'], protocol, ports)) if ip_type == '6': for ipv6_addr in interface['ipv6']: self.add_in_subtable(chain, subtable, """-%s %s -p %s -m multiport --dports %s -j RETURN""" % (direction[0], ipv6_addr['ipv6'], protocol, ports))