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.
I’m getting this error ;
”
** Verifying ‘cert.pem’ against ‘privkey.pem’
Certificate ‘cert.pem’ and private key ‘privkey.pem’ match.
** Verifying ‘cert.pem’ against ‘chain.pem’
ERROR: Unable to validate certificate chain: cert.pem: C = US, O = Internet Security Research Group, CN = ISRG Root X1
error 2 at 2 depth lookup:unable to get issuer certificate
”
on Release 8.7.10.GA.1829.UBUNTU16.64 UBUNTU16_64 FOSS edition. any ideas?
Hi,
Please contact our support through live chat(click on the icon at right-bottom).
Hi.. Im getting trouble after installing certbot. And run certbot – v
File “/usr/lib/python2.7/site-packages/pkg_resources/__init__.py”, line 2687, in load_entry_point
return ep.load()
File “/usr/lib/python2.7/site-packages/pkg_resources/__init__.py”, line 2341, in load
return self.resolve()
File “/usr/lib/python2.7/site-packages/pkg_resources/__init__.py”, line 2347, in resolve
module = __import__(self.module_name, fromlist=[‘__name__’], level=0)
File “/usr/lib/python2.7/site-packages/certbot/main.py”, line 2, in
from certbot._internal import main as internal_main
File “/usr/lib/python2.7/site-packages/certbot/_internal/main.py”, line 17, in
from certbot import crypto_util
File “/usr/lib/python2.7/site-packages/certbot/crypto_util.py”, line 32, in
from certbot import util
File “/usr/lib/python2.7/site-packages/certbot/util.py”, line 24, in
from certbot._internal import constants
File “/usr/lib/python2.7/site-packages/certbot/_internal/constants.py”, line 6, in
from acme import challenges
File “/usr/lib/python2.7/site-packages/acme/challenges.py”, line 11, in
import requests
File “/usr/lib/python2.7/site-packages/requests/__init__.py”, line 58, in
from . import utils
File “/usr/lib/python2.7/site-packages/requests/utils.py”, line 32, in
from .exceptions import InvalidURL
File “/usr/lib/python2.7/site-packages/requests/exceptions.py”, line 10, in
from urllib3.exceptions import HTTPError as BaseHTTPError
File “/usr/lib/python2.7/site-packages/urllib3/__init__.py”, line 10, in from .connectionpool import (
File “/usr/lib/python2.7/site-packages/urllib3/connectionpool.py”, line 31, in
from .connection import (
File “/usr/lib/python2.7/site-packages/urllib3/connection.py”, line 45, in
from .util.ssl_ import (
File “/usr/lib/python2.7/site-packages/urllib3/util/__init__.py”, line 4, in
from .request import make_headers
File “/usr/lib/python2.7/site-packages/urllib3/util/request.py”, line 5, in
from ..exceptions import UnrewindableBodyError
ImportError: cannot import name UnrewindableBodyError
Please help
Hi,
Please contact our support team through live chat (click on the icon at right-bottom).