-3

I'm trying to allow an external server to use my webserver (running postfix) to relay email through. I've gone through several articles on setting up iptables and I think I have it, but I still can't get email to flow. I can't do a telnet to port 25 on the webserver either. Below is my iptables. Anyone see anything I missed?

-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p udp -m udp --dport 123 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s X.X.X.X/32 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -s X.X.X.X/32 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --sport 20 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -p icmp -j ACCEPT
-A FORWARD -i lo -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -p udp -m udp --sport 123 -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m tcp --sport 25 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m tcp --dport 25 -m state --state NEW,ESTABLISHED -j ACCEPT

1 Answer 1

3

By default postfix is set to listen on 127.0.0.1 in most distro's

  1. open /etc/postfix/main.cf
  2. Look for a group of lines that start with inet_interfaces

You might see the one uncommented like

inet_interfaces = localhost

That means its only listening on localhost or 127.0.0.1. Change it to

inet_interfaces = all

Then restart postfix and it should work.

2
  • OK, I did that, however I still can't telnet to it from the outside. It works internally, but not from the outside. Any other ideas?
    – rcraig114
    Aug 22, 2015 at 14:06
  • Wait a second, I just did a test from mxtoolbox.com and its now responding. Looks like I have some troubleshooting to do on my pc now.
    – rcraig114
    Aug 22, 2015 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .