RE: mail relay

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I would like to know how can I filter the mail relay received 
> in my port 25 with the firewall,..  I want only accept the 
> packets from only one ip, my ISP. 

iptables -P INPUT DROP
# Maybe you don't need it, but I'll add it anyway
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i <eth_inet> -s <isp_mailserver_ip> -p tcp --dport 25
-j ACCEPT

However, this way you will be blocking *everything* else from coming in.
You probably want to accept local traffic, something like this :

iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i <eth_lan> -s <net_lan> -j ACCEPT

If you're running other servers on the box too (e.g. a webserver), you
also need rules for those servers.

Or you could do simply this, dropping all traffic *not* coming from your
isp's mailserver :

iptables -A INPUT -i <eth_inet> -s <! isp_mailserver_ip> -p tcp --dport
25 -j DROP


Rob



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux