From e06b757c1be6db8d03f4cc652a26392eef9d16cb Mon Sep 17 00:00:00 2001 From: Olivier Huber Date: Sat, 3 Oct 2009 00:52:56 +0200 Subject: [PATCH] [./gestion/gen_confs/firewall.py] On evite le ssh-bruteforcing darcs-hash:20091002225256-8fbb1-6adea8206e8971f754cd042fa86378e29e81b80f.gz --- gestion/gen_confs/firewall.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gestion/gen_confs/firewall.py b/gestion/gen_confs/firewall.py index ad966af8..86d73a09 100644 --- a/gestion/gen_confs/firewall.py +++ b/gestion/gen_confs/firewall.py @@ -867,6 +867,12 @@ class firewall_komaz(firewall_crans) : if not self.build_chaine('EXT_VERS_SERVEURS', self.__ext_vers_serveurs) : self.anim.reinit() print OK + # Attention les règles sont à l'envers. Hint '-I' + iptables("-I EXT_VERS_SERVEURS -p tcp --dport ssh -m state --state NEW -j ACCEPT") + iptables("-I EXT_VERS_SERVEURS -p tcp --dport ssh -m state --state NEW\ + -m recent --name SSH --update --seconds 60 --hitcount 4 --rttl -j DROP") + iptables("-I EXT_VERS_SERVEURS -p tcp --dport ssh -m state --state NEW\ + -m recent --name SSH --set") def crans_vers_ext(self) : """ Reconstruit la chaîne CRANS_VERS_EXT """ @@ -875,6 +881,12 @@ class firewall_komaz(firewall_crans) : def ext_vers_crans(self) : """ Reconstruit la chaîne EXT_VERS_CRANS """ self.build_chaine_adherent('EXT_VERS_CRANS',self.__ext_vers_crans) + # Attention les règles sont à l'envers. Hint '-I' + iptables("-I EXT_VERS_CRANS -p tcp --dport ssh -m state --state NEW -j ACCEPT") + iptables("-I EXT_VERS_CRANS -p tcp --dport ssh -m state --state NEW\ + -m recent --name SSH --update --seconds 60 --hitcount 4 --rttl -j DROP") + iptables("-I EXT_VERS_CRANS -p tcp --dport ssh -m state --state NEW\ + -m recent --name SSH --set") def admin_vlan(self) : """ Reconstruit la chaîne ADMIN_VLAN """