Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

You need a rule to allow the traffic back.

-A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
share|improve this answer

If this is a gateway (forwards traffic for other machines from LAN to internet) then you should move your rules on FORWARD chain. INPUT and OUTPUT are only for traffic of local machine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.