Updating Let’s Encrypt SSL Certificate in Zimbra 8

As many people know, the Let’s Encrypt DST Root CA X3 certificate, which was also used for Zimbra mail servers, ended yesterday.

I waited until the last one and ran into several problems after it expired, for example, mail from the OTRS ticket processing system and the Spark mail client stopped sending. After some fiddling, a solution was found to renew the certificate with a new root CA.

My configuration is Centos 7.9 and Zimbra 8.8.11

Update instructions

Installing the new certbot

sudo yum install epel-release
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo snap install core
sudo reboot

After rebooting, Zimbra refused to start, citing an incorrect certificate, but just in case, I will give the commands in this order as if it works.

If this is your first time getting a certificate, replace line 3 with this:

certbot certonly --standalone --preferred-chain "ISRG Root X1"

mail.example.com in line 6, you must replace it with the domain name of your mail server

letsencryptCA line 7 contains the file containing the new root certificate. You have to create it yourself and copy this text there:

-----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHC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kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----

Please note that the root certificate, as a result of the command on line 7, is added exactly to the end of the file you received. chain.pem

All commands in this part are executed on behalf of the user root:

su - zimbra -c "/opt/zimbra/bin/zmproxyctl stop"
su - zimbra -c "/opt/zimbra/bin/zmmailboxdctl stop"
certbot renew --standalone --force-renewal --preferred-chain "ISRG Root X1"
rm -f /opt/zimbra/ssl/letsencrypt/* 
rm -f /opt/zimbra/ssl/zimbra/commercial/commercial.key 
cp /etc/letsencrypt/live/mail.example.com/* /opt/zimbra/ssl/letsencrypt/
cat letsencryptCA >> /opt/zimbra/ssl/letsencrypt/chain.pem
cp /opt/zimbra/ssl/letsencrypt/privkey.pem /opt/zimbra/ssl/zimbra/commercial/commercial.key
chown zimbra:zimbra /opt/zimbra/ssl/letsencrypt/*
chown zimbra:zimbra /opt/zimbra/ssl/zimbra/commercial/commercial.key
cd /opt/zimbra/ssl/letsencrypt
su zimbra

At this moment we switch to the user zimbra and do the following:

zmcertmgr verifycrt comm privkey.pem cert.pem chain.pem
zmcertmgr deploycrt comm cert.pem chain.pem
zmcontrol restart

If everything goes smoothly, you will receive a fresh certificate and a working mail system.

Sources of information:

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *