In this article, we will see how to Secure the Zimbra Server with Lets Encrypt Certificate

As part of our Server Management Services, we assist our customers with several Zimbra queries.

Moving ahead, let us see how our techs perform this.

 

Secure Zimbra Server with Lets Encrypt Certificate

A free, automated, and open certificate authority, the Let’s Encrypt Certificate is used to secure Zimbra Server.

Our Support Techs recommend the following steps to perform the same.

  • Install certbot tool

Suppose we already have Certbot on the server. In that case, we can skip this step.

Otherwise, we run the following commands respectively.

Ubuntu

sudo apt-get update
sudo apt-get install certbot

CentOS 8

sudo yum -y install epel-release
sudo yum -y install certbot

CentOS 7

sudo yum -y install epel-release
sudo yum -y install certbot
  • Stop Zimbra Proxy Service

After that, we go ahead and stop the proxy service.

$ sudo su – zimbra -c “zmproxyctl stop”
Stopping proxy…done.

$ sudo su – zimbra -c “zmmailboxdctl stop”
Stopping mailboxd…done.
  • Obtain Let’s Encrypt SSL Certificate

Now, we have to obtain the certificate.

[root@zimbra~]# sudo certbot certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate with the ACME CA?

1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)

Here, we answer 1 and enter the server hostname.

IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/yourhostname.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/yourhostname.com/privkey.pem
Your certificate will expire on 2021-0x-0x. To obtain a new or
tweaked version of this certificate in the future, simply run
certbot again. To non-interactively renew *all* of your
certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

We can find all the four files, cert.pem, chain.pem, fullchain.pem and privkey.pem under /etc/letsencrypt/live/yourhostname.com

Next, we edit the chain.pem file and append root CA to it.

Since Let’s Encrypt generate chain.pem file without the root CA, we must use the IdenTrust root Certificate, merge it and append it in the chain.pem.

To get the IdenTrust root Certificate, we go to:

https://letsencrypt.org/certs/trustid-x3-root.pem.txt

We copy the complete text from the above location and paste it under the chain.pem.

  • Verify the certificate

Now we create the directory, /opt/zimbra/ssl/letsencrypt, and copy all the certificate files:

[root@zimbra ~]:~# mkdir /opt/zimbra/ssl/letsencrypt
[root@zimbra ~]# cp /etc/letsencrypt/live/yourhostname.com/* /opt/zimbra/ssl/letsencrypt/

Then, we change the ownership of files:

[root@zimbra ~]:~# # chown zimbra:zimbra /opt/zimbra/ssl/letsencrypt/*
[root@zimbra ~]# ls -la /opt/zimbra/ssl/letsencrypt/

Once done, we switch to Zimbra user and change the working directory:

[root@zimbra ~]:~# su zimbra
[root@zimbra ~]$ cd /opt/zimbra/ssl/letsencrypt/

Finally, we verify the certificate:

[zimbra@zimbra letsencrypt ~]$/opt/zimbra/bin/zmcertmgr verifycrt comm privkey.pem cert.pem chain.pem

** Verifying 'cert.pem' against 'privkey.pem'
Certificate 'cert.pem' and private key 'privkey.pem' match.
** Verifying 'cert.pem' against 'chain.pem'
Valid certificate chain: cert.pem: OK

An OK message is the end of a successful verification.

  • Deploy Certificate

To finish the SSL installation, we execute the following commands:

[zimbra@zimbra letsencrypt~]$ cp /opt/zimbra/ssl/letsencrypt/privkey.pem /opt/zimbra/ssl/zimbra/commercial/commercial.key

[zimbra@zimbra letsencrypt]$ /opt/zimbra/bin/zmcertmgr deploycrt comm cert.pem chain.pem

Eventually, we restart the Zimbra services to reload the newly installed certificate:

[zimbra@zimbra letsencrypt]$ zmcontrol restart

Now, we can see the new SSL certificate in the browser.

  • Test Automatic Renewal

By default, the Certbot packages automatically renew the SSL certificates before expiry.

Unless we change the configuration, we don’t have to execute any command to renew.

However, the below command will simulate the automatic renewal and confirm the working of cron or systemd properly:

[root@zimbra~]#sudo certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/yourhostname.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator standalone, Installer None
Account registered.
Simulating renewal of an existing certificate for yourhostname.com
Performing the following challenges:
http-01 challenge for yourhostname.com
Waiting for verification...
Cleaning up challenges

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/yourhostname.com/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
/etc/letsencrypt/live/yourhostname.com/fullchain.pem

[Need help with any of the above steps? We are here for you]

 

Conclusion

In short, we saw how our Support Techs secure Zimbra using Let’s Encrypt Certificate.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED