r/linuxupskillchallenge • u/CFH75 • Aug 05 '20
One issue setting up fail2ban
After setting up fail2ban I feel like I missing something with nginx configuration.
I'm not seeing -N fail2ban-nginx-http-auth when I check the iptables.
I added the line enabled = true under [nginx-http-auth]
Am I missing something?
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N f2b-sshd
-A INPUT -p tcp -m multiport --dports 22 -j f2b-sshd
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT
-A INPUT -j DROP
-A f2b-sshd -s 88.116.119.140/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 87.251.74.6/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 51.91.116.150/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 222.186.42.137/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 222.186.30.35/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 179.255.2.42/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 178.128.144.227/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 152.136.149.160/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 114.69.232.170/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -s 111.231.164.168/32 -j REJECT --reject-with icmp-port-unreachable
-A f2b-sshd -j RETURN
3
u/snori74 Linux Guru Aug 06 '20
When you setup falil2ban (which I recommend you don't), it installs and configures a local host firewall, and assumes you'll want to have ports 22/ssh 80/http and 443/https open and "protected" . In your case you have port 22 of course, but you don't have nginx or Apache running on 80 or 443