<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andy Fletcher &#187; postfix</title>
	<atom:link href="http://ams1.x31.com/~andy/tag/postfix/feed/" rel="self" type="application/rss+xml" />
	<link>http://ams1.x31.com/~andy</link>
	<description>Telecommunications Consultant</description>
	<lastBuildDate>Sun, 01 Aug 2010 02:25:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>When your ISP blocks incoming SMTP Connections</title>
		<link>http://ams1.x31.com/~andy/2010/01/when-your-isp-blocks-incoming-smtp-connections/</link>
		<comments>http://ams1.x31.com/~andy/2010/01/when-your-isp-blocks-incoming-smtp-connections/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 10:34:09 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[Qatar]]></category>

		<guid isPermaLink="false">http://ams1.x31.com/~andy/?p=2291</guid>
		<description><![CDATA[Things keep changing in Qatar. Just before Christmas the local ISP (QTEL) decided to start blocking inbound port 25 connections to the DSL line I use for work. This posed a problem for me as I run a mail server &#8230; <a href="http://ams1.x31.com/~andy/2010/01/when-your-isp-blocks-incoming-smtp-connections/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Things keep changing in Qatar. Just before Christmas the local ISP (QTEL) decided to start blocking inbound port 25 connections to the DSL line I use for work.  This posed a problem for me as I run a mail server on it using Dynamic DNS for about 80 users. What was particularly irksome was they blocked incoming connections only for locations outside Qatar, not other DSL connections in country.</p>
<p>I don&#8217;t have a problem with ISPs blocking outbound port 25 other than their own mail servers &#8211; that is a sensible anti-spam precaution. However blocking inbound connections can only be used to prevent the running of mail servers and the only reason I can think of for them preventing this is to force people to use their MPLS based Internet leased line which cost over USD 1500/month for 512K last time I looked at the price.</p>
<p>Using <a href="http://nmap.org/">nmap </a> on a server in Amsterdam I quickly discovered it was only port 25 which was blocked. Other ports remained unaffected.</p>
<p>So my problem was to find a way of getting mail into my server using a port other than 25 (SMTP).  Internet mail requires access to port 25 so I had to find another machine to forward mail into my ADSL line in Qatar. Fortunately I have access to such machines running <a href="http://www.debian.org/">Debian </a> and <a href="http://www.postfix.org/">postfix </a>in Amsterdam.</p>
<p>The solution turned out to be surprisingly easy:</p>
<p>1. Arrange for the ADSL link gateway to port forward traffic from a free port (I chose 200) to port 25 on the  internal mail server.  I used <a href="http://www.netfilter.org/">IPTABLES </a>to do this but the same can be done with almost any ADSL gateway &#8211; look for &#8220;Application Sharing&#8221;.   This can be tested by using <a href="http://netcat.sourceforge.net/">netcat </a>(nc) to the gateway from a machine in the outside world (some names obscured):</p>
<p><code> ams1:~# nc www.mydomain.com 200<br />
220 www.mydomain.com ESMTP Postfix (Debian/GNU)<br />
helo www.x31.com<br />
250 www.mydomain.com<br />
quit<br />
221 2.0.0 Bye</code></p>
<p>2. Configure the relay machine (mine is in Amsterdam) to accept mail for the ADSL connected system (my system in Qatar). To do this edit /etc/postfix/main.cf and add the domain to the end of the line (note the use of the comma &#8216;,&#8217;):</p>
<p><code>relay_domains = $mydestination, mydomain.com</code></p>
<p>3. Setup a special delivery transport for mydomain.com. To do this edit /etc/postfix/transport and add the following lines (myddnshost.dyndns.org is the dynamic dns hostname for my system in Qatar and the 200 is the port number I am using):</p>
<p><code>mydomain.com       smtp:[myddnshost.dyndns.org]:200<br />
.mydomain.com      smtp:[myddnshost.dyndns.org]:200<br />
</code></p>
<p>Now rebuild the map file:<br />
<code>$ postmap /etc/postfix/transport<br />
</code></p>
<p>and edit /etc/postfix/main.cf again. Ensure the following line is present:<br />
<code>transport_maps = hash:/etc/postfix/transport</code></p>
<p>Finally restart postfix:<br />
<code>$ /etc/init.d/postfix restart</code></p>
<p>4. Now update your DNS and point the MX record at the relay machine. Wait for things to settle down (can take a few hours) and your mail will start to be delivered into your ADSL connected server.</p>
<p>I run Debian Etch and Lenny systems with a mostly standard postfix configuration which uses hash tables. If your system is different then you may need to specify a different format. The /etc/postfix/transport file is extremely powerful and I recommend you look at &#8220;man transport&#8221; before making changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://ams1.x31.com/~andy/2010/01/when-your-isp-blocks-incoming-smtp-connections/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
