LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Block all incoming mail traffic except certain addresses (https://www.linuxquestions.org/questions/linux-networking-3/block-all-incoming-mail-traffic-except-certain-addresses-696811/)

jennyzon 01-12-2009 02:30 PM

Block all incoming mail traffic except certain addresses
 
hi folks,
can you please assist me in using the iptables firewall to block all incoming mail traffic (SMTP port 25) except that of a certain IP(s)? the situation is that we have a server that we only want to receive mail from a particular sender.

thanks,
jenny z.

junpa 01-13-2009 06:35 AM

Code:

iptables -A INPUT -m tcp -p tcp --dport 25 -s 1.2.3.4 -j ACCEPT
iptables -A INPUT -m tcp -p tcp --dport 25 -s 1.2.3.5 -j ACCEPT
iptables -A INPUT -m tcp -p tcp --dport 25 -s 1.2.3.6 -j ACCEPT
iptables -A INPUT -m tcp -p tcp --dport 25 -j REJECT

change 1.2.3.x to the ip(s) that you want to allow.

keep in mind that this will append to your already existing
INPUT chain and can be negated by the rules above it.


All times are GMT -5. The time now is 07:14 PM.