Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can fail2ban run in a separate docker container while somehow still implement iptables rules for nginx?

I'd like to "containerize" fail2ban in its own container but suspect it's not possible for it to set iptables rules in other containers. For example: to protect an nginx installation, it would need to set iptables rules in the nginx container? And although I can easily share the necessary log files from the nginx container to the fail2ban container, fail2ban would be unable to apply the iptables banning rules to the nginx container without some highly custom fail2ban action?

like image 846
rgareth Avatar asked Nov 09 '22 07:11

rgareth


1 Answers

Have you tried https://hub.docker.com/r/superitman/fail2ban/? I'm using it and it's blocking ssh attempts with no problem, but I've just saw that it's not working with my nginx containers (it seems that the ip is added to the hosts iptables blacklist but the nginx container but I'm not sure what is the problem)

like image 85
Pablo K Avatar answered Nov 15 '22 07:11

Pablo K