Make a backup of the old key and certificate file
mv /etc/ssl/certs/dovecot.pem /etc/ssl/certs/dovecot.pem.old mv /etc/ssl/private/dovecot.key /etc/ssl/private/dovecot.key.old
Create the new SSL certificate
openssl genrsa -out /etc/ssl/private/dovecot.key 1024 openssl req -new -x509 -key /etc/ssl/private/dovecot.key -out /etc/ssl/certs/dovecot.pem -days 730
Restart Dovecot:
service dovecot restart