<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>alexalmazan.com: DoveCot SSL</title>
    <link>http://alexalmazan.com/articles/2008/05/03/dovecot-ssl</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>atypical typo tech rhelish</description>
    <item>
      <title>DoveCot SSL</title>
      <description>In order to configure &lt;span class="caps"&gt;SSL&lt;/span&gt; for dovecot, the following is recommended
&lt;pre&gt;
[root@station ]# cd /etc/pki/
[root@station pki]# ls
CA  dovecot  nssdb  rpm-gpg  tls
[root@station pki]# find . -name Makefile
./tls/certs/Makefile
[root@station pki]# cd tls/certs/
[root@station certs]# ls
ca-bundle.crt  localhost.crt  make-dummy-cert  Makefile
[root@station certs]# make
This makefile allows you to create:
  o public/private key pairs
  o SSL certificate signing requests (CSRs)
  o self-signed SSL test certificates

To create a key pair, run "make SOMETHING.key".
To create a CSR, run "make SOMETHING.csr".
To create a test certificate, run "make SOMETHING.crt".
To create a key and a test certificate in one file, run "make SOMETHING.pem".

To create a key for use with Apache, run "make genkey".
To create a CSR for use with Apache, run "make certreq".
To create a test certificate for use with Apache, run "make testcert".

To create a test certificate with serial number other than zero, add
SERIAL=num

Examples:
  make server.key
  make server.csr
  make server.crt
  make stunnel.pem
  make genkey
  make certreq
  make testcert
  make server.crt SERIAL=1
  make stunnel.pem SERIAL=2
  make testcert SERIAL=3
&lt;/pre&gt;

	&lt;p&gt;Dovecot requires a pem, which consists of a key and a cert.
Once generated, place in the location that is outlined in the server
configuration.&lt;/p&gt;


&lt;pre&gt;
[root@station certs]# make dovecot.pem
umask 77 ; \
        PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
        PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
        /usr/bin/openssl req -utf8 -newkey rsa:1024 -keyout $PEM1 -nodes
-x509 -days 365 -out $PEM2 -set_serial 0 ; \
        cat $PEM1 &amp;gt;  dovecot.pem ; \
        echo ""    &amp;gt;&amp;gt; dovecot.pem ; \
        cat $PEM2 &amp;gt;&amp;gt; dovecot.pem ; \
        rm -f $PEM1 $PEM2
Generating a 1024 bit RSA private key
.............++++++
..++++++
writing new private key to '/tmp/openssl.B21904'
&lt;/pre&gt;

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter &amp;#8217;.&amp;#8217;, the field will be left blank.
&lt;pre&gt;
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:Texas
Locality Name (eg, city) [Newbury]:San Antonio
Organization Name (eg, company) [My Company Ltd]: SSL example 
Organizational Unit Name (eg, section) []:3rd shift
Common Name (eg, your name or your server's hostname)
[]:station.rhce.example.com
Email Address []:user@rhce.example.com
[root@station certs]# ls
ca-bundle.crt  dovecot.pem  localhost.crt  make-dummy-cert  Makefile
&lt;/pre&gt;
&lt;span&gt;&lt;strong style="color:red;"&gt;mailtips&lt;/strong&gt;&lt;/span&gt;
for checking email during the test utilize mutt
&lt;pre&gt;
mutt -s imaps://user@@serverhost
&lt;/pre&gt;
&lt;pre&gt;
mutt -f imaps://localhost for checking/displaying:

q:Exit  ?:Help
This certificate belongs to:
   station.rhce.example.com
   Unknown
   SSL example
   3rd shift
   San Antonio

This certificate was issued by:
   station.rhce.example.com
   Unknown
   SSL example
   3rd shift
   San Antonio

This certificate is valid
   from Aug  9 16:52:18 2008 GMT
     to Aug  8 16:52:18 2009 GMT

Fingerprint: B247 62D4 197F 401B 61EA BC83 8733 8D9A
&lt;/pre&gt;
Telnet test to port 110 and &lt;span class="caps"&gt;SSL&lt;/span&gt; mutt foo.
&lt;pre&gt;[root@station etc]# telnet 0 110
Trying 0.0.0.0...
Connected to 0 (0.0.0.0).
Escape character is '^]'.
+OK Dovecot ready.
user mike
+OK
pass redhat
+OK Logged in.
list
+OK 1 messages:
1 472
.
retr 472
-ERR There's no message 472.
retr 1
+OK 472 octets
Return-Path: &amp;lt;root@station.example.com&amp;gt;
X-Original-To: ru@station.example.com
Delivered-To: user@station.example.com
Received: by station.example.com (Postfix, from userid 0)
        id CFB341988BE; Thu,  9 Aug 2007 13:09:10 -0500 (CDT)
To: ru@station.example.com
Subject: maildirdelivery
Message-Id: &amp;lt;20070809180910.CFB341988BE@station13.example.com&amp;gt;
Date: Thu,  9 Aug 2007 13:09:10 -0500 (CDT)
From: root@station.example.com (root)
&lt;/pre&gt;
maildir lab example

	&lt;p&gt;additional notes post lab&lt;/p&gt;


	&lt;p&gt;edits to /etc/dovecot.conf&lt;/p&gt;


	&lt;p&gt;protocols = imap imaps pop3 pop3s&lt;/p&gt;


the pem copied into these locations
&lt;pre&gt;
##
## SSL settings
##

# IP or host address where to listen in for SSL connections. Defaults
# to above if not specified.
#ssl_listen =

# Disable SSL/TLS support.
ssl_disable = no

# PEM encoded X.509 SSL/TLS certificate and private key. They're opened
before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem
ssl_key_file = /etc/pki/dovecot/private/dovecot.pem
&lt;/pre&gt;</description>
      <pubDate>Sat, 03 May 2008 00:42:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9e906420-901f-434a-99cc-69bfe98bede2</guid>
      <author>aalmazan@rackspace.com (alex almazan)</author>
      <link>http://alexalmazan.com/articles/2008/05/03/dovecot-ssl</link>
      <category>Mail Server Tips &amp; Tricks</category>
      <category>dovecot</category>
      <category>ssl</category>
      <category>IMAP</category>
    </item>
  </channel>
</rss>
