Rendre Fail2ban persistant

Bonjour

J’ai fail2ban installé sur un reverseproxy qui fonctionne parfaitement

Par contre je voudrais le rendre persistant concernant les IP bannies

J’ai testé deux tutos:

https://mondedie.fr/d/6448-Tuto-Rendre-Fail2ban-persistant-au-redemarrage
et

Mais aprés avoir redémarré fail2ban

iptables -L me retourne:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Donc pas bon pour fail2ban

Si je remet le fichier iptables-multiport.conf d’origine, iptables -L me retourne

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
fail2ban-recidiviste  tcp  --  anywhere             anywhere
fail2ban-postfix  tcp  --  anywhere             anywhere             multiport dports smtp,urd,submission
fail2ban-apache  tcp  --  anywhere             anywhere             multiport dports http,https
fail2ban-apache-multiport  tcp  --  anywhere             anywhere             multiport dports http,https
fail2ban-ssh  tcp  --  anywhere             anywhere             multiport dports ssh

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain fail2ban-apache (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-apache-multiport (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-postfix (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-recidiviste (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain fail2ban-ssh (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Donc la c’est bon pour fail2ban.

Vous avez une solution qui fonctionne pour rendre fail2ban persistant?

Par avance merci

Si tu utilise systemd, il te suffit de te faire deux unit service afin de sauvegarder les règles en place lors de l’arrêt et de réinjecter cette sauvegarde lors du redémarrage à l’aide des ‘target’ adéquates.
Par contre cette méthode va être vraiment très lourde lors d’un rechargement des règles et présentes pas mal de désavantages.

Sinon l’utilisation de table dynamique comme ici devrait grandement simplifier la chose (conjointement à deux unit service pour gérer la sauvegarde et l’injection des règles) : https://www.admin-linux.fr/iptables-utilisation-de-tables-dynamiques/

Merci