Converted from: WordPress
On my Debian box the following were used:
/etc/ssl/certs/dovecot.pem and /etc/ssl/certs/dovecot.pem were the default locations check your /etc/dovecot/dovecot.conf before running.
openssl req -new -x509 -nodes -out /etc/ssl/certs/dovecot.pem -keyout /etc/ssl/private/dovecot.pem -days 3650
/etc/init.d/dovecot restart
I got tired of renewing the certificate so I issued one that lasts 10 years. (apparently it does not take that much to make me tired)