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 mail.yourdomain.com
certbot certonly --webroot -w /var/www/html -d mail.yourdomain.com
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/mail.yourdomain.com/fullchain.pem /etc/ssl/certs/iRedMail.crt
ln -s /etc/letsencrypt/live/mail.yourdomain.com/privkey.pem /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