How To Install Let’s Encrypt SSL Certificate on iRedMail

install ssl on iredmail

In our previous tutorial, we saw How to install iRedMail Server on Ubuntu. In This lecture we discuss about how to install Let’s Encrypt SSL on iRedMail. We will use a free Let’s Encrypt SSL certificate to secure our iRedMail services.

Install certbot tool that will be used to obtain a Let’s Encrypt SSL certificate.

apt install certbot

certbot certonly --webroot --dry-run -w /var/www/html -d

certbot certonly --webroot -w /var/www/html -d

Folder Premission Change

chmod 0644 /etc/letsencrypt/{live,archive}

Move Backup File

mv /etc/ssl/certs/iRedMail.crt{,.bak}   
mv /etc/ssl/private/iRedMail.key{,.bak}

Create a symlink for the Let’s Encrypt certificate and private key.

ln -s /etc/letsencrypt/live/ /etc/ssl/certs/iRedMail.crt
ln -s /etc/letsencrypt/live/ /etc/ssl/private/iRedMail.key

To apply the changes, restart Dovecot, Postfix, Apache2 and make sure that they are successfully launched:

systemctl restart dovecot
systemctl restart postfix
systemctl restart nginx
systemctl restart slapd

Auto Renewal

Install crontab

crontab -e

After Run This Command . Type a then copy this line and past.

1   3   *   *   *   certbot renew --post-hook '/usr/sbin/service postfix restart; /usr/sbin/service nginx restart; /usr/sbin/service dovecot restart'

After the close the editor with esc + :wq