Firewall needs more robust rules and rule processing

October 21, 2017 160 views
Firewall CentOS

After creating a DO firewall, I am allowed to create rules and as part of this process, I have the option to allow all TCP, allow all UDP, or allow specific IP addresses or IP address ranges in both IPv4 or IPv6. And in many cases this is sufficient.

The issue I am having is SMTP DDOS or brute force attacks coming from specific IP address ranges in massive quantities. The current rule definition for the firewall does not provide the ability to specify the order in which the IP addresses or ranges are processed. It also does not allow for a "negated allow (or block) rule" where I can specify something like !45.45.45.0/24 or !45.0.0.0/8 to drop all packets originating from this range. This type of rule would allow me to specify the ranges of IP addresses I want to block BEFORE I get to my allow all TCP rule that allows my mobile phone to send into my SMTP server no matter the IP address the phone has.

I have to believe that other customers are experiencing similar needs and may not have expressed them.

Thanks!

Need other tags such as email, smtp, DDOS attack, SPAM

1 Answer

You might have more luck setting up something like fail2ban or sshguard so that the failed attempts trigger a local firewall change, that way you won't have to manually adjust the rules when the attackers switch IP.

  • Already tried those. but once the packet passes from the DO switch to your Droplet, you get billed for it. Their firewall service stops the packets BEFORE they reach the switch port you are connected to and as such you are not billed for the traffic.

    • I didn't know DO firewalls work that way. That's cool.

      You could likely convince fail2ban to add DO firewall rules via the API. From the API docs it looks like you can drop traffic from individual IPs, so you could likely replace the commands in pf.conf with curls that poke the DO api.

Have another answer? Share your knowledge.