Creating Keys for Dovecot
Creating a Keys
First edit the file /etc/pki/dovecot-openssl.cnf. In this file create all of the settings for your site. Now move into the /usr/share/doc/dovecot-1.0/examples folder and you will see an executable called mkcert.sh. Run that executable to create the necessary keys.
./mkcert.sh
Copy the keys to the correct location, deleting the default keys.
cp dovecot.pem /etc/pki/dovecot/certs
cp dovecot.pem /etc/pki/dovecot/private
chmod 600 /etc/pki/dovecot/certs
chmod 600 /etc/pki/dovecot/private
Restart Dovecot and Postfix.
Creating a Private Key – Second Method
Move into the /etc/pki/tls/certs directory and run the command below. You will be asked to provide information about the location and name of your company as well as contacts. This private key can be used to create a self-signed certificate. The certificate functions much like a public key.
# make dovecot.pem
umask 77 ; \
PEM1=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
PEM2=`/bin/mktemp /tmp/openssl.XXXXXX` ; \
/usr/bin/openssl req -newkey rsa:1024 -keyout $PEM1 -nodes -x509 -days 365 -out $PEM2 -set_serial 0 ; \
cat $PEM1 > dovecot.pem ; \
echo “” >> dovecot.pem ; \
cat $PEM2 >> dovecot.pem ; \
rm -f $PEM1 $PEM2
Generating a 1024 bit RSA private key
……..++++++
…………………………++++++
writing new private key to ‘/tmp/openssl.pM9442′
—–
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 ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:Montana
Locality Name (eg, city) [Newbury]:Trout Creek
Organization Name (eg, company) [My Company Ltd]:My Company
Organizational Unit Name (eg, section) []:Sales
Common Name (eg, your name or your server’s hostname) []:mail
Email Address []:mike@somewhere.com
Posted by mike 

Trackbacks
Thursday, 18 February, 2010
Social comments and analytics for this post…
This post was mentioned on Twitter by postfixmail: How to create keys for Dovecot to provide security on Postfix. http://bit.ly/4suxf8...
You must be logged in to post a comment.