With courier-imap, if the self signed certificate used by IMAPS or POPS expires then use this procedure to issue a new certificate:
1. Edit /usr/share/courier-imap/mkimapdcert and add a -set-serial option to the openssl “req” line like “-set_serial 2”.
2. Optional: On the same line change “-days 365” to increase the validity period for the certificate.
3. Optional: Edit /etc/courier-imap/imapd.cnf to set certificate contents.
4. Remove the old certificate at /usr/share/courier-imap/imapd.pem
5. Run /usr/sbin/mkimapdcert
6. Restart courier with “/sbin/service courier-imap restart”
7. Edit /usr/share/courier-imap/mkpop3dcert and add a -set-serial option to the openssl “req” line like “-set_serial 2”.
8. Optional: On the same line change “-days 365” to increase the validity period for the certificate.
9. Optional: Edit /etc/courier-imap/pop3d.cnf to set certificate contents.
10. Remove the old certificate at /usr/share/courier-imap/pop3d.pem
11. Run /usr/sbin/mkpop3dcert
12. Restart courier with “/sbin/service courier-imap restart”