Make a backup of the existing SSL key and certificate file
cd /etc/pki/dovecot cp -a certs/dovecot.pem certs/dovecot.pem.old cp -a private/dovecot.pem private/dovecot.pem.old
Create the new SSL certificate for two years:
openssl genrsa -out private/dovecot.pem 1024 openssl req -new -x509 -key private/dovecot.pem -out certs/dovecot.pem -days 730
Restart Dovecot and Postfix
sudo systemctl restart dovecot sudo systemctl restart postfix
Check the start and end dates for the certificate:
openssl x509 -dates -in certs/dovecot.pem