<?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>Erics Tech Blog &#187; dkim</title>
	<atom:link href="http://eric.lubow.org/tag/dkim/feed/" rel="self" type="application/rss+xml" />
	<link>http://eric.lubow.org</link>
	<description>Thoughts, musings, and other idealistic (sometimes useful) systems and development hoopla.</description>
	<lastBuildDate>Fri, 18 Nov 2011 14:56:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Setting Up DKIM and Postfix on CentOS 5.2</title>
		<link>http://eric.lubow.org/2009/mail/setting-up-dkim-and-postfix/</link>
		<comments>http://eric.lubow.org/2009/mail/setting-up-dkim-and-postfix/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 13:30:06 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[Mail]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[dkim]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[SPAM]]></category>

		<guid isPermaLink="false">http://eric.lubow.org/?p=106</guid>
		<description><![CDATA[I spent a while trying to set up DKIM with Postfix on CentOS 5.2. I read the HOWTOs on HOWToForge written by Andrew Colin Kissa (aka TopDog) who subsequently helped me towards getting this setup working. My setup is that I have a mail spooler and multiple mail senders. This is to say that the [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a while trying to set up DKIM with Postfix on CentOS 5.2.  I read the <a href="http://www.howtoforge.com/set-up-dkim-on-postfix-with-dkim-milter-centos-5.2">HOWTOs</a> on <a href="http://www.howtoforge.com/">HOWToForge</a> written by Andrew Colin Kissa (aka TopDog) who subsequently helped me towards getting this setup working.</p>
<p>My setup is that I have a mail spooler and multiple mail senders.  This is to say that the emails are created on spooler.domain.com and sent via sender1.domain.com and sender2.domain.com.  I will walk through how to setup DKIM on the sender machines so that all mail spooled from the spooler still gets signed.</p>
<p>First start out by installing DKIM. At the time the HOWTO was published, I downloaded the RPM from Topdog.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@sender1 dkim]# wget http://www.topdog-software.com/oss/dkim-milter/dkim-milter-2.8.2-0.$(uname -i).rpm<br />
...<br />
[root@sender1 dkim]# rpm -Uvh dkim-milter-2.8.2-0.x86_64.rpm <br />
warning: dkim-milter-2.8.2-0.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 990dd808<br />
Preparing... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;########################################### [100%]<br />
&nbsp; &nbsp;1:dkim-milter &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;########################################### [100%]</div></div>
<p>Once you have installed DKIM you have to create the public and private keys.  Do this using the <em>dkim-genkey.sh</em> shell script.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@sender1 dkim]# sh /usr/share/doc/dkim-milter-2.8.2/dkim-genkey.sh -r -d yourdomain.com</div></div>
<p>By running this script, 2 files will be generated; <strong>default.txt</strong>: the public key which gets published via DNS; <strong>default.private</strong>: private key used for signing the emails.</p>
<p>Move the private key to the dkim directory and secure it.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@sender1 dkim]# mv default.private /etc/mail/dkim/default.key.pem<br />
[root@sender1 dkim]# chmod 600 /etc/mail/dkim/default.key.pem<br />
[root@sender1 dkim]# chown dkim-milt.dkim-milt /etc/mail/dkim/default.key.pem</div></div>
<p>Now create the DNS entries.  The <strong>p=</strong> section is the public key created using the <em>dkim-genkey.sh</em> script.  Don&#8217;t forget to increment the SOA and reload DNS.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">_ssp._domainkey.yourdomain.com &nbsp; &nbsp; &nbsp;TXT t=y; o=-<br />
default._domainkey.yourdomain.com &nbsp; TXT v=DKIM1; g=*; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GWETBNiQKBgQC5KT1eN2lqCRQGDX+20I4liM2mktrtjWkV6mW9WX7q46cZAYgNrus53vgfl2z1Y/95mBv6Bx9WOS56OAVBQw62+ksXPT5cRUAUN9GkENPdOoPdpvrU1KdAMW5c3zmGOvEOa4jAlB4/wYTV5RkLq/1XLxXfTKNy58v+CKETLQS/eQIDAQAB</div></div>
<p>The reason for this <strong>peer_list</strong> file is so that the senders know that its ok for them to sign emails relayed via the spooler.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@sender1 dkim]# cat /etc/mail/dkim/peer_list <br />
mail.yourdomain.com<br />
spooler.yourdomain.com<br />
sender2.yourdomain.com<br />
1.2.4.7<br />
1.2.4.5<br />
localhost<br />
localhost.localdomain<br />
127.0.0.1</div></div>
<p>Onto the configuring of the system.  It should look something like the following.  I chose to have the port be a local port, but it could be done via a network connection as well.  Ensure you change the <em>SIGNING_DOMAIN</em> variable and be sure to note the <em>EXTRA_ARGS</em> variable and where <em>PEER_LIST</em> is used.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@sender1 dkim]# cat /etc/sysconfig/dkim-milter <br />
# Default values<br />
<br />
USER=&quot;dkim-milt&quot;<br />
PORT=&quot;local:/var/run/dkim-milter/dkim.sock&quot;<br />
SIGNING_DOMAIN=&quot;yourdomain.com&quot;<br />
SELECTOR_NAME=&quot;default&quot;<br />
KEYFILE=&quot;/etc/mail/dkim/default.key.pem&quot;<br />
SIGNER=yes<br />
VERIFIER=yes<br />
CANON=simple<br />
SIGALG=rsa-sha1<br />
REJECTION=&quot;bad=r,dns=t,int=t,no=a&quot;<br />
<br />
PEER_LIST=&quot;/etc/mail/dkim/peer_list&quot;<br />
<br />
EXTRA_ARGS=&quot;-h -l -D -i ${PEER_LIST} -I ${PEER_LIST}&quot;</div></div>
<p>Let&#8217;s start up dkim.  Since it is a daemon running separately from Postfix, running it and restarting it won&#8217;t affect mail (yet).</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@sender1 dkim]# /etc/init.d/dkim-filter start</div></div>
<p>And it&#8217;s finally time for Postfix.  You need to add 2 simple lines to your Postfix <strong>main.cf</strong>.  These 2 lines should match the <em>PORT</em> variable in the <strong>dkim-milter.conf</strong> sysconfig file.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">smtpd_milters = local:/var/run/dkim-milter/dkim.sock<br />
non_smtpd_milters = local:/var/run/dkim-milter/dkim.sock</div></div>
<p>Now you&#8217;re asking yourself, how do I test this?  The easy answer is to use a Gmail account.  When you receive an email, click on the <em>show details</em> link on the right hand side of the screen (to the left of the time).  If you have performed this sequence correctly, you will see a line that says:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">signed-by &nbsp; yourdomain.com</div></div>
<p>Another way to test the success of this is to view the source of the email.  You should have some lines that look similar to this:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">X-DKIM: Sendmail DKIM Filter v2.8.2 sender1.yourdomain.com 75866730012<br />
DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=yourdomain.com;<br />
&nbsp; &nbsp; s=default; t=1239981026; bh=+NNkD6jOlYKtY2AIGNRToH2tkm0=;<br />
&nbsp; &nbsp; h=Date:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:<br />
&nbsp; &nbsp; &nbsp;List-Post:From:Reply-To:To:Subject:MIME-Version:Content-Type:<br />
&nbsp; &nbsp; &nbsp;Message-Id;<br />
&nbsp; &nbsp; b=MrjXBShjNexWy62fC4Uu7xS3Hxav+cHtqIBzwMlcufadsffLtW9KmF5sO58+yHjyy<br />
&nbsp; &nbsp; &nbsp;I3SiX0TNyEbvXtSHvRKm9z630zDiN0dxVXGqhgEfdklaj4jlkfhR6GrsRgzW2YOW6/9<br />
&nbsp; &nbsp; &nbsp;sKFnz214AkhAPrFBD30hNmZfRfY75v5q94FnGDUo=</div></div>
<p>Congratulations, you have a working DKIM installation.</p>


<p>Related posts:<ol><li><a href='http://eric.lubow.org/2010/mail/a-few-words-about-setting-up-postfix-multi-instance/' rel='bookmark' title='A Few Words About Setting Up Postfix Multi Instance'>A Few Words About Setting Up Postfix Multi Instance</a></li>
<li><a href='http://eric.lubow.org/2009/spam/deploying-amavisd-logwatch/' rel='bookmark' title='Deploying Amavisd-logwatch'>Deploying Amavisd-logwatch</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://eric.lubow.org/2009/mail/setting-up-dkim-and-postfix/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

