Sendmail filtering for spams with access file
Issue
- It is possible to reject accessing from particuler hosts/IP(s) to a sendmail server by those ways?
1.Adding lines into /etc/mail/access file as follows.
# vi /etc/mail/access
abc.example.com RELAY
def.example.com RELAY
* REJECT
The above setting expects that only 'abc.example.com' and 'def.example.com' are allowed to access the sendmail server, and any other host is rejected.
2.Setting iptables' rules as follows.
# iptables -I INPUT -p tcp --dport 25 -j REJECT
# iptables -I INPUT -p -s 'IP ADDRESS1' --dport 25 -j ACCEPT
# iptables -I INPUT -p -s 'IP ADDRESS2' --dport 25 -j ACCEPT
This iptables setting is also similar meaming of the first one, which means that only the 'IP ADDRESS1' and 'IP ADDRESS2' can be accessed to the sendmail server, and any other host(IP ADDRESS) is rejected.
Environment
-
Red Hat Enterprise Linux 5
-
Red Hat Enterprise Linux 6
- sendmail
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.