I have to send emails (and only send, not receive) from a linux server (SUSE Linux Enterprise Server 11) and I think I should add kind of the following rule to the iptables:
iptables -A OUTPUT -p tcp --dport 25 -j ACCEPT
But I am not quite sure, since my OUTPUT iptables rules suggest to me that with the current rules I should be able to send emails, but actually I can't.
This are my OUTPUT iptables rules:
Chain OUTPUT (policy ACCEPT XXM packets, XXM bytes) pkts bytes target prot opt in out source destination xxM xxG ACCEPT all -- any lo anywhere anywhere xxM xxM SST-OUTPUT all -- any any anywhere anywhere
I have always felt reluctant to change the rules in the bare iptables, but I think that if the default policy is "ACCEPT" I should be able to send emails just with the current rules, am I wrong?
The error I get is:
Name service error for name=xxxxx.xxx type=MX: Host not found, try again what makes me think that the problem must be in the /etc/resolv.conf or somewhere else.
The INPUT rules are:
Chain INPUT (policy DROP) target prot opt in out source destination ACCEPT all -- lo any anywhere anywhere ACCEPT all -- any any anywhere anywhere state ESTABLISHED ACCEPT icmp -- any any anywhere anywhere state RELATED ACCEPT tcp -- any any anywhere anywhere state RELATED,ESTABLISHED tcp spt:smtp LOG all -- any any anywhere anywhere limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-IN-ILL-TARGET ' DROP all -- any any anywhere anywhere
Note: I added the INPUT rule suggested by @Otheus in the 4th place.