<?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>BigSmoke &#187; postfix</title>
	<atom:link href="http://blog.bigsmoke.us/tag/postfix/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.bigsmoke.us</link>
	<description>Smokes your problems, coughs fresh air.</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:03:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Setting up a postfix fallback MX</title>
		<link>http://blog.bigsmoke.us/2011/05/22/setting-up-a-postfix-fallback-mx</link>
		<comments>http://blog.bigsmoke.us/2011/05/22/setting-up-a-postfix-fallback-mx#comments</comments>
		<pubDate>Sun, 22 May 2011 07:51:48 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[mx]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1957</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>These are some short stepts and pointers to setup a postfix fallback MX. It does not describe postfix basics, nor how to install Mailscanner (a necessisity, because spammers like sending spam to fallback MX&#8217;s because they&#8217;re usually not as well protected).</p>
<p>First, postfix has a special transport, called &#8216;relay&#8217;, which is the same as SMTP, except that it doesn&#8217;t send to the backup MX. In this case, that means it doesn&#8217;t send to itself, avoiding loops. The relay transport is the default for all the domains you specify in the relay_domains parameter. </p>
<p>Should the machine have a relayhost defined, you need to disable that for each of the domains you&#8217;re a backup MX for. You can do that with transport_maps. In my case, the transport_maps is hash:/etc/postfix/transport_maps. That is a key-value file on which you run &#8216;postmap&#8217; after you&#8217;ve edited it. In it, specify this (the comments explain it):</p>
<p><pre class="php"><span style="color: #808080; font-style: italic;"># When you specify a transport without nexthop, it resets the relay to the</span>
<span style="color: #808080; font-style: italic;"># recipient domain (see man 5 transport). And, when the transport is relay,</span>
<span style="color: #808080; font-style: italic;"># postfix will not relay to the backup MX, to prevent loops back to itself. So,</span>
<span style="color: #808080; font-style: italic;"># because this host has a default relayhost, use the folowwing when you want to</span>
<span style="color: #808080; font-style: italic;"># specify a domain for which we are backup MX: </span>
<span style="color: #808080; font-style: italic;"># example.com            relay </span></pre></p>
<p>The next step you want to do is take measures to prevent mails to non-existent users piling up in the queue. Because spam is sent to the backup MX all the time, it will relay it to the primary, which rejects it. Your backup host will then bounce all kinds of spam mails&#8230;</p>
<p>To fix that, we instruct postfix to use <a href="http://www.postfix.org/ADDRESS_VERIFICATION_README.html">recipient address verification</a>. This causes it to probe the primary host to check the address exists (and caches that info) before relaying.</p>
<p>To enable it, do this:</p>
<p><pre class="php">smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, reject_unknown_recipient_domain, reject_unverified_recipient
unverified_recipient_reject_reason = Address lookup failed
<span style="color: #808080; font-style: italic;"># Prevent caching non-existent users, to prevent delivery failures when new users are unknown still.</span>
address_verify_negative_cache = no
<span style="color: #808080; font-style: italic;"># Setting to 550 to make a reject a fatal error, not a defer.</span>
unverified_recipient_reject_code = <span style="color: #cc66cc;">550</span>
<span style="color: #808080; font-style: italic;"># The point of a backup MX is to accept mail when the primary is down, so setting this prevents incoming mail being deferred when the address probe cannot be done.</span>
<span style="color: #808080; font-style: italic;"># TODO: find out how to actually implement it, because it doesn't work; permit it not a valid option here.</span>
<span style="color: #808080; font-style: italic;">#unverified_recipient_tempfail_action = permit </span></pre></p>
<p>The reject_unknown_recipient_domain  prevents probes to domains that don&#8217;t exist.</p>
<p>Some extra options, not strictly related to being a backup MX:</p>
<p><pre class="php">smtpd_sender_restrictions = reject_unknown_sender_domain, reject_unknown_helo_hostname
unknown_address_reject_code = <span style="color: #cc66cc;">550</span>
<span style="color: #808080; font-style: italic;"># Override the default of 5 days, because the point of a backup MX is to keep it around for a while.</span>
maximal_queue_lifetime = 21d</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2011/05/22/setting-up-a-postfix-fallback-mx/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Postfix queue: sender and recipient address</title>
		<link>http://blog.bigsmoke.us/2011/05/04/postfix-queue-sender-and-recipient-address</link>
		<comments>http://blog.bigsmoke.us/2011/05/04/postfix-queue-sender-and-recipient-address#comments</comments>
		<pubDate>Wed, 04 May 2011 09:34:08 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[mailq]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1954</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>I always seem to forget this, and the mailq command is not clear, so here it is:</p>
<p>when you type mailq on a postfix server, the first address listed is the sender, the second the recipient.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2011/05/04/postfix-queue-sender-and-recipient-address/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding SPF support to Postfix</title>
		<link>http://blog.bigsmoke.us/2011/04/28/adding-spf-support-to-postfix</link>
		<comments>http://blog.bigsmoke.us/2011/04/28/adding-spf-support-to-postfix#comments</comments>
		<pubDate>Thu, 28 Apr 2011 13:36:54 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[spf]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1948</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>(Hmm, <a href="http://www.openspf.org/Software">this</a> suggests the python version might be better).</p>
<p><a href="http://www.howtoforge.com/postfix_spf">Source</a>.</p>
<p><pre class="php">aptitude -P install postfix-policyd-spf-perl</pre></p>
<p>Add this to master.cf (but perhaps change the path to the script):</p>
<p><pre class="php">policy  unix  -       n       n       -       -       spawn
        user=nobody argv=/usr/bin/perl /usr/lib/postfix/policyd-spf-perl</pre></p>
<p>Add this to main.cf, directly below/after reject_unauth_destination (if you do it before, you are an open relay):</p>
<p><pre class="php">check_policy_service unix:private/policy</pre></p>
<p>So:</p>
<p><pre class="php">smtpd_recipient_restrictions = permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_destination,
  check_policy_service unix:private/policy
  reject_unauth_pipelining,
  reject_non_fqdn_recipient</pre></p>
<p>The source article has stuff about testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2011/04/28/adding-spf-support-to-postfix/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with a postfix mail queue</title>
		<link>http://blog.bigsmoke.us/2010/09/22/working-with-a-postfix-mail-queue</link>
		<comments>http://blog.bigsmoke.us/2010/09/22/working-with-a-postfix-mail-queue#comments</comments>
		<pubDate>Wed, 22 Sep 2010 12:34:53 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mailq]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1577</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
Some useful commands when working with a postfix mailqueue:
</p>

<ul>
	<li>&#8220;postsuper -r ALL&#8221;. Requeues all messages.</li>
	<li>&#8220;postcat [file]&#8220;. Views queue files in /var/spool/bla.</li>
	<li>&#8220;postqueue&#8221;. Deal with queue.</li>
</ul>


<p>
I believe there were more, but I can&#8217;t remember them. Wish I had blogged earlier&#8230;
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/09/22/working-with-a-postfix-mail-queue/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling authentication and SSL for Postfix on Debian</title>
		<link>http://blog.bigsmoke.us/2010/09/20/enabling-authentication-and-ssl-for-postfix-on-debian</link>
		<comments>http://blog.bigsmoke.us/2010/09/20/enabling-authentication-and-ssl-for-postfix-on-debian#comments</comments>
		<pubDate>Mon, 20 Sep 2010 14:13:55 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1569</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
I used <a href="http://www.postfix.org/SASL_README.html">this document</a> as main source. <a href="http://www.jimmy.co.at/weblog/?p=52">This blogpost</a> is also useful.
</p>

<p>
First install libsasl2 and configure it. Enable it in /etc/default/sasl.
</p>

<p>
First make the sasl config file in /etc/postfix/sasl which says:
</p>

<pre class="php">pwcheck_method: saslauthd
mech_list: PLAIN LOGIN</pre>

<p>
Then configure the ssl paramters in postfix (the following is deprecated. See aforementioned official postfix docs for good way):
</p>

<pre class="php"><span style="color: #808080; font-style: italic;"># According to official docs, this should be in one pem file.</span>
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.<a href="http://www.php.net/key"><span style="color: #000066;">key</span></a>
<span style="color: #808080; font-style: italic;"># This should be smtp_tls_security_level = may, because use_tls is deprecated.</span>
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:$<span style="color: #66cc66;">&#123;</span>queue_directory<span style="color: #66cc66;">&#125;</span>/smtpd_scache
<span style="color: #808080; font-style: italic;"># I don't know if this one is also needed.</span>
smtp_tls_session_cache_database = btree:$<span style="color: #66cc66;">&#123;</span>queue_directory<span style="color: #66cc66;">&#125;</span>/smtp_scache
<span style="color: #808080; font-style: italic;"># When TLS encryption is optional in the Postfix SMTP server, do not announce or accept SASL authentication over unencrypted connections. </span>
smtpd_tls_auth_only=yes</pre>

<p>
Then enable the three smtps lines in master.cf:
</p>

<pre class="php">smtps     inet  n       -       -       -       -       smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes</pre>

<p>
Then you need to do some hacking to get the jailed postfix to access /var/run/saslauthd:
</p>

<pre class="php">rm -r /<span style="color: #000000; font-weight: bold;">var</span>/run/saslauthd/
<a href="http://www.php.net/mkdir"><span style="color: #000066;">mkdir</span></a> -p /<span style="color: #000000; font-weight: bold;">var</span>/spool/postfix/<span style="color: #000000; font-weight: bold;">var</span>/run/saslauthd
ln -s /<span style="color: #000000; font-weight: bold;">var</span>/spool/postfix/<span style="color: #000000; font-weight: bold;">var</span>/run/saslauthd /<span style="color: #000000; font-weight: bold;">var</span>/run
<a href="http://www.php.net/chgrp"><span style="color: #000066;">chgrp</span></a> sasl /<span style="color: #000000; font-weight: bold;">var</span>/spool/postfix/<span style="color: #000000; font-weight: bold;">var</span>/run/saslauthd
<span style="color: #808080; font-style: italic;"># Add user postfix to group sasl</span>
adduser postfix sasl</pre>

<p>
Then you should be good to go. Start all daemons.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/09/20/enabling-authentication-and-ssl-for-postfix-on-debian/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring fetchmail to deliver to Zimbra with custom header added</title>
		<link>http://blog.bigsmoke.us/2010/01/17/configuring-fetchmail-to-deliver-to-zimbra-with-custom-header-added</link>
		<comments>http://blog.bigsmoke.us/2010/01/17/configuring-fetchmail-to-deliver-to-zimbra-with-custom-header-added#comments</comments>
		<pubDate>Sun, 17 Jan 2010 18:36:56 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fetchmail]]></category>
		<category><![CDATA[formail]]></category>
		<category><![CDATA[MDA]]></category>
		<category><![CDATA[POP3]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[zimbra]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1017</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
I needed to fetch mail from a POP3 account and deliver it to a Zimbra account. Because I&#8217;m doing this for multiple POP3 accounts, I want to add a header which I can use in Zimbra to filter. This is what we made:
</p>

<pre class="php">poll server user <span style="color: #ff0000;">&quot;user&quot;</span> pass <span style="color: #ff0000;">&quot;secret&quot;</span> mda <span style="color: #ff0000;">&quot;formail -A 'X-Zimbra-To: user@domain.org'| /opt/zimbra/postfix/sbin/sendmail -i -t service@sicirec.org&quot;</span></pre>

<p>
The <tt>-i</tt> tells sendmail to ignore a single dot on a line, because that would normally mean end of mail. The <tt>-t</tt> is &#8220;to&#8221; (not the header &#8220;<tt>To:</tt>&#8220;).
</p>

<p>
It is a bit unclear why postfix delivers locally to Zimbra, since doing <q><tt>mail user@ourdomain.org</tt></q> routes through an external SMTP server, which is configured in Zimbra to be used as MTA for outgoing mail. It is configured as &#8216;webmail MTA&#8217;.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/01/17/configuring-fetchmail-to-deliver-to-zimbra-with-custom-header-added/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set proper origin domain for Zimbra server</title>
		<link>http://blog.bigsmoke.us/2010/01/12/set-proper-origin-domain-for-zimbra-server</link>
		<comments>http://blog.bigsmoke.us/2010/01/12/set-proper-origin-domain-for-zimbra-server#comments</comments>
		<pubDate>Tue, 12 Jan 2010 14:24:14 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[zimbra]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=994</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
(This turned out not to be how I fixed it. I just configured exim and /etc/mailname as I do always and that fixed it. However, exim does not run as the SMTP server listening on port 25, that is the postfix installed by Zimbra. I don&#8217;t know how and if this exim configuration conflicts with zimbra.)
</p>

<p>
I have a zimbra server fooled into thinking it hosts a particular domain. Part of the fooling involves setting a different SMTP server than localhost for <em>all</em> outgoing mail. Luckily, Zimbra can do that.
</p>

<p>
The downside of that is that when you send mail to &#8220;root&#8221;, the other SMTP server qualifies it with its domain and the mail appears to be coming from the wrong server. 
</p>

<p>
To fix it, specify this in the /opt/zimbra/postfix/conf/main.cf:
</p>

<pre class="php">myorigin = example.com</pre>

<p>
This seems to work without caveats. However, I don&#8217;t know if zimbra overwrites this config file at some point.
</p>

<p>
As always, pick a domain that exists, otherwise a lot of mailservers won&#8217;t accept it. You don&#8217;t even need an MX record, A or CNAME if enough.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/01/12/set-proper-origin-domain-for-zimbra-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

