How do I block inbound mail to a Linux server?


To temporarily block inbound mail to a mail server by  blocking access to port 25 on the server use the following iptables command (this allows you the mail server process to continue to run so you can sort resolve any problems before allowing access):

iptables -A INPUT -p tcp -d <SERVER_IP> --dport 25 -j REJECT

This assumes your input rule is called INPUT, if you have existing custom chains/rules you may need to update this command to fit your configuration.

To allow mail back into the server delete the rule using:

iptables -D INPUT -p tcp -d 64.22.86.210 --dport 25 -j REJECT

You can view existing rules using

iptables-save

or

iptables -L -n
Tags: block, email, iptables, linux
Last update:
2014-12-16 21:44
Author:
Chris Burton
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags