Blacklist an IP?

I have an IP that I’m repeatedly getting spam from. I added it to iptables like this:

iptables -I INPUT -s -j DROP

This successfully seems to block any communication coming from that IP address (including their emails), but the setting doesn’t survive a reboot. Any other recommended method to explicitly prevent an IP from sending emails to my domain?

I read multiple community topics and Github notes and couldn’t get a clear answer what the current best way to do this is.

@stevetoza I see your chiming in on

Any luck getting more custom settings set up for spam filtering?

I used ufw to block an annoying ip address. It came installed for me.

ufw deny from xx.xx.xx.xx

ufw status to check what is set up.

@phildar that worked and survived a reboot! Thanks so much. Hopefully that other discussion I sent you was of use. Thanks for chiming in and helping with this.

Update: Adding the ufw rule to deny held fine after a reboot but that remote junk mail server was still able to connect and I received an email from them. It seems I needed to reorder my ufw rules to putting that deny at the top. I followed the instructions found here.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.