0

I have set up fail2ban on ubuntu Linux web server 16.04 lts. I have set it up so that the denied ip (jailed) is always remembered and the same for the iptable - it is set up to remember the denied address. I did this for no other reason to see how many attempts are made to break in. I could have set it up to not remember these IP addresses and just give them a jail term of 24 hours. Maybe I was too paranoid about the hackers out there trying to break in. I have seen the number of attempts to break in (based on the rules set up) grow daily by 100-150 attempts, all unique IP addresses. Most of these IP addresses are from outside of the US. I have to believe that at some point the count will reach several thousand bad IP addresses that I have marked as do not allow access. I am concerned that the server can get over loaded and degraded to the point of it not being useful. Are there some good practices to follow that I should implement with fail2ban and iptables to deal with these bad IP addresses who are trying to break in?

Update: I have set up fail2ban and created the following jail:

##To stop DOS attack from remote host.

[http-get-dos]

enabled = true

port = http,https

filter = http-get-dos

logpath = /var/log/apache*/access.log

maxretry = 1

findtime = 86400

bantime = -1

ignoreip = 111.222.333.12

## action = iptables[name=HTTP, port=http, protocol=tcp]

banaction=iptables-ipset-proto4

I have ipset and iptables configured as follows:

sudo iptables -I INPUT -m set --match-set f2b-http-get-dos src -j DROP

sudo iptables -I FORWARD -m set --match-set f2b-http-get-dos src -j DROP

When I query the ipset set name, I see the members listed.

When I query iptables I see the set name.

How do I know and confirm that the banned IP addresses that are listed in the set named in ipset are being firewalled by iptables?

Jack Stein
  • 11
  • 3
  • 1
    When you use an `ipset` (with firewallcmd-ipset ) back-end with the blocked IP-addresses rather than an separate iptables rule for every blocked IP-address you can easily scale to many thousands of blocked ip-addresses with only a negligible impact on valid users. – HBruijn Jul 08 '19 at 13:23
  • Thanks for the response. I need some clarification. I use fail2ban defining the following: banaction = iptables How would I make it so each jailed IP address detected by fail2ban from log files can dynamically get added to the IPSET and intercepted immediately. – Jack Stein Jul 09 '19 at 00:20

0 Answers0