Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart fail2ban after ferm restart #2465

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timdiels
Copy link

@timdiels timdiels commented Dec 28, 2023

After a ferm restart, the fail2ban iptables rules are not restored. There is already some code to reload fail2ban after a ferm restart but that doesn't seem to work. fail2ban-client reload/restart and systemctl reload fail2ban do not restore its iptables rules after a ferm restart; but systemctl restart fail2ban does.

$ sudo systemctl restart ferm
$ sudo iptables-save | grep fail2ban
$ sudo fail2ban-client reload
2023-12-28 18:46:07,716 fail2ban.configreader   [16590]: WARNING 'allowipv6' not defined in 'Definition'. Using default one: 'auto'
OK
$ sudo iptables-save | grep fail2ban
$ sudo fail2ban-client restart
Shutdown successful
2023-12-28 18:46:20,581 fail2ban.configreader   [16597]: WARNING 'allowipv6' not defined in 'Definition'. Using default one: 'auto'
Server ready
$ sudo iptables-save | grep fail2ban
$ sudo systemctl reload fail2ban
$ sudo iptables-save | grep fail2ban
$ sudo systemctl restart fail2ban
$ sudo iptables-save | grep fail2ban
-A INPUT -m recent --update --seconds 7200 --name fail2ban-sshd --mask 255.255.255.255 --rsource -j REJECT --reject-with icmp-admin-prohibited

I am assuming the host is using systemd, however. Not sure if that's a problem, but this fixes it for me.

fail2ban reload/restart and systemctl reload fail2ban do not restore its
iptables rules after a ferm restart; but systemctl restart fail2ban does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant