<?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>Alex Rodriguez &#187; sendmail pop smtp tls ssl</title>
	<atom:link href="http://www.alexbr.com/wblog/?feed=rss2&#038;tag=sendmail-pop-smtp-tls-ssl" rel="self" type="application/rss+xml" />
	<link>http://www.alexbr.com/wblog</link>
	<description>I don&#039;t play baseball.</description>
	<lastBuildDate>Mon, 07 Jun 2010 14:10:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Securing Sendmail</title>
		<link>http://www.alexbr.com/wblog/?p=54</link>
		<comments>http://www.alexbr.com/wblog/?p=54#comments</comments>
		<pubDate>Wed, 13 May 2009 22:01:41 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[sendmail pop smtp tls ssl]]></category>

		<guid isPermaLink="false">http://www.alexbr.com/wblog/?p=54</guid>
		<description><![CDATA[I recently needed to setup TLS for my company&#8217;s email server. My primary goal was to reconfigure our sendmail server to negotiate TLS with other email servers that supported it. This would allow us to send secure information via email to company&#8217;s that also supported email over TLS.
The first step was to generate certificates. This [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to setup TLS for my company&#8217;s email server. My primary goal was to reconfigure our sendmail server to negotiate TLS with other email servers that supported it. This would allow us to send secure information via email to company&#8217;s that also supported email over TLS.</p>
<p>The first step was to generate certificates. This is easily done with openssl. I already have a key and scripts setup to generate cert requests with all necessary info filled in. The script looks something like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:430px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;Hostname: &quot;</span> <span style="color: #c20cb9; font-weight: bold;">hostname</span><br />
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">365</span> <span style="color: #660033;">-key</span> company.key <span style="color: #660033;">-config</span> csr_config <span style="color: #660033;">-out</span> <span style="color: #007800;">$hostname</span>.csr</div></td></tr></tbody></table></div>
<p>Take the output from that certificate request and provide it to your favorite signer to get a signed certificate. Take the key you used to generate the request and the signed certificate and put it somewhere on your server, say /etc/ssl/crt. Also make sure to put the cacerts bundle, or signing certificate chain, in that directory (or any other for that matter).</p>
<p>Next step is to configure sendmail. The following are the changes I needed to make to my sendmail.mc file under /etc/mail:</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:430px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">define(`confTLS_SRV_OPTIONS', `V')dnl<br />
define(`confAUTH_OPTIONS', `A p y')dnl<br />
define(`CERT_DIR', `/etc/ssl/crt')dnl<br />
define(`confCACERT',`CERT_DIR/cacerts.crt')dnl<br />
define(`confCACERT_PATH', `CERT_DIR/cacerts')dnl<br />
define(`confSERVER_CERT',`CERT_DIR/your_signed_cert.crt')dnl<br />
define(`confSERVER_KEY',`CERT_DIR/your_key.key')dnl<br />
define(`confCLIENT_CERT',`CERT_DIR/your_signed_cert.crt')dnl<br />
define(`confCLIENT_KEY',`CERT_DIR/your_key.key')dnl<br />
define(`confDONT_BLAME_SENDMAIL',`groupreadablekeyfile')dnl</div></td></tr></tbody></table></div>
<p>Most of that config points sendmail to your keys and certificates to be used for server and client mode. The line</p>
<p>define(`confAUTH_OPTIONS&#8217;, `A p y&#8217;)dnl</p>
<p>tells sendmail to perform smtp authentication after TLS negotiation has completed. The line</p>
<p>define(`confTLS_SRV_OPTIONS&#8217;, `V&#8217;)dnl</p>
<p>tells sendmail to skip requests for clients&#8217; certificates.</p>
<p>I would like to thank <a href="http://www.technoids.org/wwstarttls.html#MyPurposes">this site</a> and <a href="http://sial.org/howto/sendmail/tls-relay/">this site</a> for that helpful information.</p>
<p>Next, recompile the config file and restart sendmail with</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:430px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-C</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mail<br />
service <span style="color: #c20cb9; font-weight: bold;">sendmail</span> restart</div></td></tr></tbody></table></div>
<p>You can test your server using openssl:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:430px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">openssl s_client <span style="color: #660033;">-connect</span> localhost:<span style="color: #000000;">25</span> <span style="color: #660033;">-CAfile</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>crt<span style="color: #000000; font-weight: bold;">/</span>cacerts.crt <span style="color: #660033;">-starttls</span> smtp</div></td></tr></tbody></table></div>
<p>You should see &#8220;Verify return code: 0 (ok)&#8221; near the end of the output. Type &#8220;quit&#8221; to end the communication.</p>
<p>To test that sendmail will communicate properly as a client with another server, you can use the great site <a href="http://test.smtp.org">test.smtp.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexbr.com/wblog/?feed=rss2&amp;p=54</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
