Next we need to setup Let's Encrypt as our free SSL Certificate provider:
There are ssl certificates that come with iRedMail, but they are not recognized as secure, so we need to setup Let's Encrypt to do our SSL certs. Then we won't
have to deal with that "connection not secure" warning, and have to add an exception to enter the site.
The first thing is to install certbot. On Rocky Linux I do a "dnf install certbot". Certbot is the Let's Encrypt program for requesting and renewing ssl certs.
Then I go ahead and do a test with the --dry-run argument to see if it will be successful: "certbot certonly --webroot --dry-run -w /var/www/html -d server1.wjack.com -d www.wjack.com -d wjack.com"
My web root is in /var/www/html, so set yours where your web root is at. I requsted certs for multiple domains with the -d argument so the certs will work if my server is accessed by any of those 3
domain names.
If the above --dry-run was successful then I go ahead and run it for real: "certbot certonly --webroot -w /var/www/html -d server1.wjack.com -d www.wjack.com -d wjack.com".
You'll then need to change permissions for two of the Let's Encrypt directories so Postfix/Dovecot/OpenLDAP/MariaDB/PostgreSQL will be able to access them. Run the command
"chmod 0755 /etc/letsencrypt/{live,archive}".
I then need to rename the iRedMail certs and link the new Let's Encrypt certs to that location with: "mv /etc/pki/tls/certs/iRedMail.crt{,.bak}" and "mv /etc/pki/tls/private/iRedMail.key{,.bak}".
Then "ln -s /etc/letsencrypt/live/server1.wjack.com/fullchain.pem /etc/pki/tls/certs/iRedMail.crt" and "ln -s /etc/letsencrypt/live/server1.wjack.com/privkey.pem /etc/pki/tls/private/iRedMail.key".
*Notice - The certs for the three domains I requested from Let's Encrypt where put into one directory named after the first domain I requested server1.wjack.org.
Reboot your server, and your Let's Encrypt certs should be in effect now, and you won't have to bother with adding an exception to enter your mail server anymore.
Let's Encrypt certs are good for 3 months and have to be renewed, but certbot is configured for auto-renewal, so you shouldn't have to worry much about that, but
I would check occasionally with the command "certbot certificates" to check the expiration date of the certs.
If you installed webmin you can use your letsencrypt certs with it instead of the default certs, so you won't have to add an exception to get to webmin. Just edit the
/etc/webmin/miniserv.conf file and add these two lines referencing your letsencrypt key and cert:
keyfile=/etc/letsencrypt/live/server1.wjack.com/privkey.pem
certfile=/etc/letsencrypt/live/server1.wjack.com/fullchain.pem
The Email Server should be ready for real world use now. Have Fun!