PDA

View Full Version : ISP blocking port 25? - What to do.


Lloyd
02-04-2008, 06:24 AM
Does your ISP block port 25? That's the default SMTP (outgoing email) port. Many ISP's block port 25 and force users to use their SMTP server to send email.

This is easy to work around if you run your own mail server as a "smart host" relay on a Rimuhosting VPS or dedicated server. You can configure your mail server to listen on another port, in addition to port 25. This should allow you to send out your mail to your mail server.

Postfix is my favorite mail server. These instructions make Postfix listen on an additional port of your choice. For these instructions I have chosen port 2525. Any unused port should work OK.

Instructions are given for a Debian Etch installation running chrooted (the Etch default). Adapt if you are unlucky enough to use a different distro. :)

1. Open /etc/postfix/master.cf Add the following line, below the "smtp" line:
2525 inet n - - - - smtpd
Restart your Postfix server:
/etc/init.d/postfix restart

2. Open port 2525 in your firewall, if you use one. Webmin offers an easy, powerful IPTABLES-based firewall. For instructions on how to set it up, see this Rimuhosting how-to: http://rimuhosting.com/howto/firewall.jsp.

3. Configure your email client program to send email to your mail server on port 2525.

Lloyd Standish
http://seedsofthought.net

jgbillings
02-05-2008, 12:38 AM
Nice tip. We always setup an iptables rule to redirect traffic from port 2525, to 25, but this is a nice way to set it up also. Thanks!

Lloyd
02-05-2008, 03:24 AM
Nice tip. We always setup an iptables rule to redirect traffic from port 2525, to 25, but this is a nice way to set it up also. Thanks!

I think the iptables way it better, since it works for any mail server that may be running! I'd like to try it on my server for educational purposes, but I'd like to use the Webmin iptables "Linux firewall" interface, rather than add the IP tables rule directly. I am afraid to add this nat rule without fulling understanding how to do it in Webmin.

I think the iptables rule to do this would be:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2525 -j REDIRECT --to-port 25


To use this rule with Webmin Linux firewall, I'd add a rule to the prerouting nat table, right? Should the default action be "exit chain"?

After I click on "add rule," I am not sure which Webmin settings will create the desired iptables rule. Would you please tell me what to specify for "target ports for redirect," etc.?

Regards,
Lloyd

dblevitan
07-11-2008, 07:50 PM
There actually already is an officially specified alternate port used specifically for message sending. The port is 587, also known as the submission port. It should already be configured in postfix (maybe commented out) and should be used instead of 2525 or any other port number.

I also hope everyone here has properly secured their postfix against open relay on any of these ports. You should, at a minimum, use SASL authentication before allowing relay access and preferably TLS and SASL for complete security.