<?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>debian &#8211; Tjitjing Blog</title>
	<atom:link href="http://localhost/index.php/tag/debian/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.tjitjing.com/</link>
	<description>This is my blog on technology related stuff and on occation other things too...</description>
	<lastBuildDate>Mon, 12 Mar 2012 13:58:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.16</generator>
	<item>
		<title>Guide to Install OpenDKIM for multiple domains with Postfix and Debian</title>
		<link>https://blog.tjitjing.com/index.php/2012/03/guide-to-install-opendkim-for-multiple-domains-with-postfix-and-debian.html</link>
					<comments>https://blog.tjitjing.com/index.php/2012/03/guide-to-install-opendkim-for-multiple-domains-with-postfix-and-debian.html#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Mon, 12 Mar 2012 13:58:26 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[DKIM]]></category>
		<category><![CDATA[opendkim]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[unix]]></category>
		<guid isPermaLink="false">http://blog.tjitjing.com/?p=505</guid>

					<description><![CDATA[This is a guide to installing OpenDKIM for multiple domains on a Postfix-installtion on Debian. I tried some other guides but kept running into problems, so this is how I did it. Among others, Google Gmail and Yahoo mail check your email for a DKIM signature. Install and Configure OpenDKIM 1. Install OpenDKIM [code]apt-get install&#8230; <a class="more-link" href="https://blog.tjitjing.com/index.php/2012/03/guide-to-install-opendkim-for-multiple-domains-with-postfix-and-debian.html">Continue reading <span class="screen-reader-text">Guide to Install OpenDKIM for multiple domains with Postfix and Debian</span></a>]]></description>
										<content:encoded><![CDATA[<p>This is a guide to installing OpenDKIM for multiple domains on a Postfix-installtion on Debian. I tried some other guides but kept running into problems, so this is how I did it.</p>
<p>Among others, Google Gmail and Yahoo mail check your email for a DKIM signature.</p>
<h2>Install and Configure OpenDKIM</h2>
<p><strong>1. Install OpenDKIM</strong></p>
<p>[code]apt-get install opendkim[/code]</p>
<p>Comment: This will install the <a href="http://packages.debian.org/source/squeeze/opendkim" target="_blank" rel="noopener noreferrer">latest available stable Debian packaged version of OpenDKIM</a> which is currently 2.0.1. This version is already a couple of years old (2010).<br />
If you know how/want to compile sources yourself, then the <a href="http://sourceforge.net/projects/opendkim/files/" target="_blank" rel="noopener noreferrer">latest version</a> is 2.4.3 (and 2.5.0 is right around the corner)</p>
<p><strong>2. Edit the OpenDKIM config file</strong></p>
<p>[code]nano /etc/opendkim.conf[/code]</p>
<p>Add these rows:</p>
<p>[code]<br />
KeyTable           /etc/opendkim/KeyTable<br />
SigningTable       /etc/opendkim/SigningTable<br />
ExternalIgnoreList /etc/opendkim/TrustedHosts<br />
InternalHosts      /etc/opendkim/TrustedHosts<br />
[/code]</p>
<p>Note: If you run multiple instances of Postfix you need to add this to the opendkim.conf for each instance (or the ones you want to use opendkim)</p>
<p><strong>3.  Edit /etc/opendkim/TrustedHosts</strong></p>
<p>[code]nano /etc/opendkim/TrustedHosts[/code]</p>
<p>Add domains, hostnames and/or ip&#8217;s that should be handled by OpenDKIM. Don&#8217;t forget localhost.</p>
<p>[code]<br />
127.0.0.1<br />
localhost<br />
x.253.204.64<br />
x.253.204.32/27<br />
[/code]</p>
<p><strong>4. Edit /etc/default/opendkim</strong></p>
<p>[code]nano /etc/default/opendkim[/code]</p>
<p>Uncomment this row:</p>
<p>[code]SOCKET=&quot;inet:12345@localhost&quot; # listen on loopback on port 12345[/code]</p>
<h2>Generate keys</h2>
<p>Repeat these steps to generate keys for each domain you will send email from. Replace mydomain.com with your domain name in examples below.</p>
<p><strong>1. Generate key</strong></p>
<p>[code]<br />
mkdir -p /etc/opendkim/keys/mydomain.com<br />
cd /etc/opendkim/keys/mydomain.com<br />
opendkim-genkey -r -d mydomain.com<br />
chown opendkim:opendkim default.private<br />
[/code]</p>
<p><strong>2. Add domain to KeyTable /etc/opendkim/KeyTable</strong></p>
<p>[code]nano /etc/opendkim/KeyTable[/code]</p>
<p>Add line:</p>
<p>[code]default._domainkey.mydomain.com mydomain.com:default:/etc/opendkim/keys/mydomain.com/default.private[/code]</p>
<p><strong>3. Add domain to SigningTable /etc/opendkim/SigningTable</strong></p>
<p>[code]nano /etc/opendkim/SigningTable[/code]</p>
<p>Add line:</p>
<p>[code]mydomain.com default._domainkey.mydomain.com[/code]</p>
<p>Note that in OpenDKIM 2.0.1 domain names are case sensitive (supposed to be fixed from 2.3.1 but I have not tested).<br />
This means that in the above example an email from info@mydomain.com will be signed, but an email from info@MyDomain.com will not be signed. The workaround is to add one extra entry for MyDomain.com to SigningTable.</p>
<p><strong>4. Add to DKIM public key to DNS</strong></p>
<p>Add an entry for the public key to the DNS server you are using for your domain. You find the public key here:</p>
<p>[code]cat /etc/opendkim/keys/mydomain.com/default.txt[/code]</p>
<h2>Start OpenDKIM</h2>
<p>[code]/etc/init.d/opendkim start[/code]</p>
<p>In the future, if you make any changes to configuration remember to restart: /etc/init.d/opendkim restart</p>
<h2>Configure and Restart Postifx</h2>
<p><strong>1. Configure Postfix</strong></p>
<p>[code]nano /etc/postfix/main.cf[/code]</p>
<p>Add or edit these lines:</p>
<p>[code]<br />
milter_default_action = accept<br />
milter_protocol = 6<br />
smtpd_milters = inet:localhost:12345<br />
non_smtpd_milters = inet:localhost:12345<br />
[/code]</p>
<p><strong>2. Restart Postfix</strong></p>
<p>[code]/etc/init.d/postfix reload[/code]</p>
<p>Or in my case as i run postfix multi instance:</p>
<p>[code]/etc/init.d/postfix-multi restart[/code]</p>
<h2>Other</h2>
<p><strong>Log files are in the /var/log directory</strong></p>
<p>[code]<br />
cat /var/log/mail.log<br />
cat /var/log/mail.warn<br />
cat /var/log/mail.err<br />
[/code]</p>
<p><strong>Log more info</strong></p>
<p>[code]nano /etc/opendkim.conf[/code]</p>
<p>Add this line:</p>
<p>[code]LogWhy yes[/code]</p>
<p><strong>Credits</strong></p>
<p>Guides that have helped me along the way: <a href="http://www.debiantutorials.com/setup-domainkeys-identified-mail-dkim-in-postfix/" target="_blank" rel="noopener noreferrer">Debian Tutorials</a> and <a href="http://syslog.tv/2010/01/11/dkim-on-debian-with-postfix/" target="_blank" rel="noopener noreferrer">Syslog</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.tjitjing.com/index.php/2012/03/guide-to-install-opendkim-for-multiple-domains-with-postfix-and-debian.html/feed</wfw:commentRss>
			<slash:comments>22</slash:comments>
		
		
			</item>
		<item>
		<title>OpenDKIM: error loading key `default._domainkey.mydomain.com&#8217;</title>
		<link>https://blog.tjitjing.com/index.php/2012/02/opendkim-error-loading-key-default-_domainkey-mydomain-com.html</link>
					<comments>https://blog.tjitjing.com/index.php/2012/02/opendkim-error-loading-key-default-_domainkey-mydomain-com.html#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Tue, 28 Feb 2012 11:13:46 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[opendkim]]></category>
		<category><![CDATA[postix]]></category>
		<guid isPermaLink="false">http://blog.tjitjing.com/?p=510</guid>

					<description><![CDATA[I have been pulling my hair with getting OpenDKIM to work on a Debian machine with Postfix. I have been changing my KeyTable, SigningTable, ExternalIgnoreList, InternalHosts files and references like a madman. I have kept getting errors like this in /var/log/mail.log [code]Feb 28 11:21:43 06-135-D2 opendkim[27826]: 5EADD532313: dkim_eom(): resource unavailable: d2i_PrivateKey_bio() failed Feb 28 11:24:00&#8230; <a class="more-link" href="https://blog.tjitjing.com/index.php/2012/02/opendkim-error-loading-key-default-_domainkey-mydomain-com.html">Continue reading <span class="screen-reader-text">OpenDKIM: error loading key `default._domainkey.mydomain.com&#8217;</span></a>]]></description>
										<content:encoded><![CDATA[<p>I have been pulling my hair with getting <a href="http://opendkim.org/" target="_blank" rel="noopener noreferrer">OpenDKIM</a> to work on a Debian machine with Postfix. I have been changing my KeyTable, SigningTable, ExternalIgnoreList, InternalHosts files and references like a madman.</p>
<p>I have kept getting errors like this in /var/log/mail.log</p>
<p>[code]Feb 28 11:21:43 06-135-D2 opendkim[27826]: 5EADD532313: dkim_eom(): resource unavailable: d2i_PrivateKey_bio() failed</p>
<p>Feb 28 11:24:00 06-135-D2 opendkim[27955]: D2560532313 error loading key `default._domainkey.mydomain.com'[/code]</p>
<p>Unfortunately OpenDKIM does not give more info than this and Googling did not provide many hints mor than possibly being a directory access problem. I checked directory and file access and realized that the key file was only readable by root.</p>
<p>[code]-rw&#8212;&#8212;- 1 root root 891 Feb 28 00:14 default.private[/code]</p>
<h2><strong>Testing Permissions<br />
(you can skip straight to Solution below)</strong></h2>
<p><em>[Edit: Renamed this part from &#8220;Solution&#8221; to &#8220;Testing Permissions&#8221; and added a better Solution below. Thanks to Andreas Schultze on the <a href="http://lists.opendkim.org/" target="_blank" rel="noopener noreferrer">OpenDKIM mailing list</a> for getting me on the right track to finding the correct solution]</em></p>
<p>As I used <a href="http://www.opendkim.org/opendkim-genkey.8.html" target="_blank" rel="noopener noreferrer">opendkim-genkey</a> to generate my key I would have thought permissions would be set ok from the start but I anyway tried doing <a href="http://www.thinkplexx.com/learn/article/unix/command/chmod-permissions-flags-explained-600-0600-700-777-100-etc" target="_blank" rel="noopener noreferrer">chmod </a>644 on the key file</p>
<p>[code]chmod 644 default.private[/code]<br />
[code]-rw-r&#8211;r&#8211; 1 root root 891 Feb 28 00:14 default.private[/code]</p>
<p><strong>And finally &#8211; success!<br />
</strong>In /var/log/mail.log:</p>
<p>[code]Feb 28 11:30:28 06-135-D2 opendkim[27955]: 5E811532313 &quot;DKIM-Signature&quot; header added[/code]</p>
<p>To me it seems a little unsecure to do chmod 644 on the file as this means anyone with access to the system can read the private key. <del>In my case I consider my system secure as it is only used for SMTP/Postfix so I am happy that is working.</del><br />
<del> <em></em></del></p>
<p><del>As I am all new to Debian, OpenDKIM and Postfix (The last time I touched Unix was when I worked with IBM&#8217;s AIX on their RS/6000 systems in the early 90s&#8230;) so I would be happy to hear any thoughts on this.</del></p>
<h2>Solution</h2>
<p>To set permissions to allow OpenDKIM but no unauthorized users to access the private key, change owner of the private key file to user and group opendkim with the following command:</p>
<p>[code]chown opendkim:opendkim default.private[/code]</p>
<p>(To check what user opendkim is running as, check the running processes once you have started opendkim: ps -f -A<br />
This command shows what groups the user opendkim belongs to: group opendkim)</p>
<p>Maybe this is fixed to set file permissions correctly in a later version of opendkim-genkey, I am running the old <a href="http://packages.debian.org/source/squeeze/opendkim" target="_blank" rel="noopener noreferrer">2.0.1 apt-get package</a> that is currently available for Debian.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.tjitjing.com/index.php/2012/02/opendkim-error-loading-key-default-_domainkey-mydomain-com.html/feed</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
	</channel>
</rss>
