IPTables Rule for Google Apps SMTP
Posted
by
XpresServers
on Server Fault
See other posts from Server Fault
or by XpresServers
Published on 2012-10-05T06:39:57Z
Indexed on
2012/10/05
9:39 UTC
Read the original article
Hit count: 279
I am trying to add iptables rule to allow traffic on ports 465 & 587 to google apps smtp servers. But I got not luck. My WHMCS installation works fine with google apps when I turn off iptables but iptables turn on itself again and email stop working. Please add rules to allow traffic from port 465 and 587.
Following are my IPTables rules grabbed from /etc/sysconfig/iptables
# Generated by iptables-save v1.3.5 on Fri Oct 5 01:33:52 2012
*filter
:INPUT ACCEPT [2191:434537]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2390:987151]
:acctboth - [0:0]
-A INPUT -j acctboth
-A OUTPUT -p tcp -m multiport --dports 25,465,587 -m owner --gid-owner mailman -j ACCEPT
-A OUTPUT -p tcp -m multiport --dports 25,465,587 -m owner --gid-owner mail -j ACCEPT
-A OUTPUT -d 127.0.0.1 -p tcp -m multiport --dports 25,465,587 -m owner --uid-owner cpanel -j ACCEPT
-A OUTPUT -p tcp -m multiport --dports 25,465,587 -m owner --uid-owner root -j ACCEPT
-A OUTPUT -j acctboth
-A OUTPUT -o eth0 -p tcp -m tcp --sport 587 -m state --state ESTABLISHED -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m tcp --sport 465 -m state --state ESTABLISHED -j ACCEPT
<<IN THIS SPACE RULES ARE RELATED TO SPECIFIC IPS ONLY>>
-A acctboth -i ! lo
COMMIT
# Completed on Fri Oct 5 01:33:52 2012
# Generated by iptables-save v1.3.5 on Fri Oct 5 01:33:52 2012
*nat
:PREROUTING ACCEPT [196:12398]
:POSTROUTING ACCEPT [191:15070]
:OUTPUT ACCEPT [190:15010]
-A OUTPUT -p tcp -m multiport --dports 25,465,587 -m owner --gid-owner mailman -j RETURN
-A OUTPUT -p tcp -m multiport --dports 25,465,587 -m owner --gid-owner mail -j RETURN
-A OUTPUT -d 127.0.0.1 -p tcp -m multiport --dports 25,465,587 -m owner --uid-owner cpanel -j RETURN
-A OUTPUT -p tcp -m multiport --dports 25,465,587 -m owner --uid-owner root -j RETURN
-A OUTPUT -p tcp -m multiport --dports 25,465,587 -j REDIRECT
COMMIT
# Completed on Fri Oct 5 01:33:52 2012
Thanks
Hassan
© Server Fault or respective owner