IPTables Rule for Google Apps SMTP
- by XpresServers
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