Wiki-Zimbra-Com-Wiki-Installing A LetsEncrypt SSL Certificate
Wiki-Zimbra-Com-Wiki-Installing A LetsEncrypt SSL Certificate
Wiki-Zimbra-Com-Wiki-Installing A LetsEncrypt SSL Certificate
Installing a Let's Encrypt SSL
Certificate
KB 22434 Last updated on 20221125 Contents
5.00 (one vote)
[hide]
1 Installing a Let's
This article is a Community contribution and may
Encrypt SSL
include unsupported customizations. Certificate
2 Prerequisites
This article is a stepbystep instruction on setting up a Zimbra with Let’s 3 Installing
Encrypt certificates. Certbot
4 Zimbra
If you are running a multi server installation of Zimbra it is recommended deployment
you setup a dedicated VM for obtaining the Let’s Encrypt certificate and 5 Manual
follow the steps under installation of
Manual installation of Let’s Encrypt on Zimbra . Let’s Encrypt on
Zimbra
Prerequisites 6 Using DANE
7 Using multiple
This guide assumes you are using Ubuntu 20 and you have set up a https domains
correct hostname and DNS, to check run the following as user zimbra with SNI
and verify zmhostname is the same as hostname ‐‐fqdn : 8 Further reading
zimbra@le‐test:~$ source ~/bin/zmshutil; zmsetvars
zimbra@le‐test:~$ zmhostname
le‐test.zimbra.tech
zimbra@le‐test:~$ hostname ‐‐fqdn
le‐test.zimbra.tech
Next you should have set up a CAA DNS record so that Let’s Encrypt can issue certificates for
your domain, to check run the following and make sure 0 issue "letsencrypt.org" is in the
output of the command:
zimbra@le‐test:~$ sudo apt install ‐y net‐tools dnsutils
zimbra@le‐test:~$ dig +short type257 $(hostname ‐‐d)
0 issuewild "letsencrypt.org"
0 issue "letsencrypt.org"
Next check if Zimbra listens on port 80, Let’s Encrypt needs to be able to run a temporary
webserver on port 80, so it can not be used by Zimbra. This is not an issue as most browsers
now try https first. The following command should not have any output:
netstat ‐tulpn | grep ":80 "
In case your Zimbra is listening on port 80, you have to switch the proxy mode like this:
sudo su zimbra ‐
zmprov ms `zmhostname` zimbraReverseProxyMailMode https
zmprov ms `zmhostname` zimbraMailMode https
/opt/zimbra/bin/zmtlsctl https
/opt/zimbra/libexec/zmproxyconfig ‐e ‐w ‐o ‐a 8080:80:8443:443 ‐x https ‐H `zmhostname`
If you are having trouble setting up Zimbra you can use our automated installer that will take
care of Let’s Encrypt also: https://github.com/Zimbra/zinstaller
Further reading:
https://wiki.zimbra.com/wiki/CLI_zmtlsctl_to_set_Web_Server_Mode
https://wiki.zimbra.com/wiki/Enabling_Zimbra_Proxy_and_memcached
Installing Certbot
Certbot in the Ubuntu repositories is too old and cannot be used for Zimbra. The newer version
can be installed via snap or pip. Run below commands to install Cerbot and obtain a certificate:
apt install ‐y python3 python3‐venv libaugeas0
python3 ‐m venv /opt/certbot/
/opt/certbot/bin/pip install ‐‐upgrade pip
/opt/certbot/bin/pip install certbot
ln ‐s /opt/certbot/bin/certbot /usr/local/sbin/certbot
/usr/local/sbin/certbot certonly ‐d $(hostname ‐‐fqdn) ‐‐standalone ‐‐preferred‐chain "IS
Zimbra deployment
Create the following script that deploys the Let’s Encrypt certificate on Zimbra:
cat >> /usr/local/sbin/letsencrypt‐zimbra << EOF
#!/bin/bash
/usr/local/sbin/certbot certonly ‐d $(hostname ‐‐fqdn) ‐‐standalone ‐‐manual‐public‐ip‐log
cp "/etc/letsencrypt/live/$(hostname ‐‐fqdn)/privkey.pem" /opt/zimbra/ssl/zimbra/commercia
chown zimbra:zimbra /opt/zimbra/ssl/zimbra/commercial/commercial.key
wget ‐O /tmp/ISRG‐X1.pem https://letsencrypt.org/certs/isrgrootx1.pem.txt
rm ‐f "/etc/letsencrypt/live/$(hostname ‐‐fqdn)/chainZimbra.pem"
cp "/etc/letsencrypt/live/$(hostname ‐‐fqdn)/chain.pem" "/etc/letsencrypt/live/$(hostname
cat /tmp/ISRG‐X1.pem >> "/etc/letsencrypt/live/$(hostname ‐‐fqdn)/chainZimbra.pem"
chown zimbra:zimbra /etc/letsencrypt ‐R
cd /tmp
su zimbra ‐c '/opt/zimbra/bin/zmcertmgr deploycrt comm "/etc/letsencrypt/live/$(hostname ‐
rm ‐f "/etc/letsencrypt/live/$(hostname ‐‐fqdn)/chainZimbra.pem"
rm ‐f "/etc/letsencrypt/live/$(hostname ‐‐fqdn)/chainZimbra.pem"
EOF
Set the correct permission, set up a cron job and run the deployment:
chmod +rx /usr/local/sbin/letsencrypt‐zimbra
ln ‐s /usr/local/sbin/letsencrypt‐zimbra /etc/cron.daily/letsencrypt‐zimbra
/etc/cron.daily/letsencrypt‐zimbra
Finally restart Zimbra to load the new certificate:
sudo su zimbra ‐c '/opt/zimbra/bin/zmcontrol restart'
The cron job will renew your certificate about 1 month prior to the expiration date, you
need to manually restart Zimbra before the renewal date to load the new certificate.
Manual installation of Let’s Encrypt on
Zimbra
Make sure to request a certificate with the ‐‐preferred‐chain "ISRG Root X1" option. In case
you already have a certificate but you have not used the option, you have to do a force renewal
with the ‐‐force‐renewal ‐‐preferred‐chain "ISRG Root X1" options.
After you have received the certificate from Let’s Encrypt you can deploy it on Zimbra like this:
As user root or sudo:
cp /etc/letsencrypt/live/barrydegraaff.nl/privkey.pem /opt/zimbra/ssl/zimbra/commercial/co
chown zimbra:zimbra /opt/zimbra/ssl/zimbra/commercial/commercial.key
wget ‐O /tmp/ISRG‐X1.pem https://letsencrypt.org/certs/isrgrootx1.pem.txt
cat /tmp/ISRG‐X1.pem >> /etc/letsencrypt/live/barrydegraaff.nl/chain.pem
As user zimbra or sudo su zimbra ‐ :
cd ~
/opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key
/opt/zimbra/bin/zmcertmgr deploycrt comm /etc/letsencrypt/live/barrydegraaff.nl/cert.pem /
The output should be similar to:
root@zimbra9:~# su zimbra ‐
zimbra@zimbra9:/root$ /opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/comm
** Verifying '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' against '/opt/zimbra/ssl/zi
Certificate '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' and private key '/opt/zimbra
** Verifying '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' against '/etc/letsencrypt/l
Valid certificate chain: /etc/letsencrypt/live/barrydegraaff.nl/cert.pem: OK
zimbra@zimbra9:/root$ cd ~
zimbra@zimbra9:~$ /opt/zimbra/bin/zmcertmgr deploycrt comm /etc/letsencrypt/live/barrydegr
** Verifying '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' against '/opt/zimbra/ssl/zi
** Verifying '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' against '/opt/zimbra/ssl/zi
Certificate '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' and private key '/opt/zimbra
** Verifying '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' against '/etc/letsencrypt/l
Valid certificate chain: /etc/letsencrypt/live/barrydegraaff.nl/cert.pem: OK
** Copying '/etc/letsencrypt/live/barrydegraaff.nl/cert.pem' to '/opt/zimbra/ssl/zimbra/co
** Copying '/etc/letsencrypt/live/barrydegraaff.nl/chain.pem' to '/opt/zimbra/ssl/zimbra/c
** Appending ca chain '/etc/letsencrypt/live/barrydegraaff.nl/chain.pem' to '/opt/zimbra/s
** Importing cert '/opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt' as 'zcs‐user‐comme
** NOTE: restart mailboxd to use the imported certificate.
** Saving config key 'zimbraSSLCertificate' via zmprov modifyServer zimbra9.barrydegraaff.
** Saving config key 'zimbraSSLPrivateKey' via zmprov modifyServer zimbra9.barrydegraaff.n
** Installing imapd certificate '/opt/zimbra/conf/imapd.crt' and key '/opt/zimbra/conf/ima
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.crt' to '/opt/zimbra/conf/imapd.c
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.key' to '/opt/zimbra/conf/imapd.k
** Creating file '/opt/zimbra/ssl/zimbra/jetty.pkcs12'
** Creating keystore '/opt/zimbra/conf/imapd.keystore'
** Installing ldap certificate '/opt/zimbra/conf/slapd.crt' and key '/opt/zimbra/conf/slap
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.crt' to '/opt/zimbra/conf/slapd.c
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.key' to '/opt/zimbra/conf/slapd.k
** Creating file '/opt/zimbra/ssl/zimbra/jetty.pkcs12'
** Creating keystore '/opt/zimbra/mailboxd/etc/keystore'
** Installing mta certificate '/opt/zimbra/conf/smtpd.crt' and key '/opt/zimbra/conf/smtpd
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.crt' to '/opt/zimbra/conf/smtpd.c
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.key' to '/opt/zimbra/conf/smtpd.k
** Installing proxy certificate '/opt/zimbra/conf/nginx.crt' and key '/opt/zimbra/conf/ngi
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.crt' to '/opt/zimbra/conf/nginx.c
** Copying '/opt/zimbra/ssl/zimbra/commercial/commercial.key' to '/opt/zimbra/conf/nginx.k
** NOTE: restart services to use the new certificates.
** Cleaning up 3 files from '/opt/zimbra/conf/ca'
** Removing /opt/zimbra/conf/ca/ca.key
** Removing /opt/zimbra/conf/ca/e50a23da.0
** Removing /opt/zimbra/conf/ca/ca.pem
** Copying CA to /opt/zimbra/conf/ca
** Copying '/opt/zimbra/ssl/zimbra/ca/ca.key' to '/opt/zimbra/conf/ca/ca.key'
** Copying '/opt/zimbra/ssl/zimbra/ca/ca.pem' to '/opt/zimbra/conf/ca/ca.pem'
** Creating CA hash symlink 'e50a23da.0' ‐> 'ca.pem'
** Creating /opt/zimbra/conf/ca/commercial_ca_1.crt
** Creating CA hash symlink '8d33f237.0' ‐> 'commercial_ca_1.crt'
** Creating /opt/zimbra/conf/ca/commercial_ca_2.crt
** Creating CA hash symlink '4042bcee.0' ‐> 'commercial_ca_2.crt'
Finally restart Zimbra as user zimbra or sudo su zimbra ‐ :
zmcontrol restart
Using DANE
You have to use Certbot with the ‐‐reuse‐key option, see
https://blog.zimbra.com/2022/04/zimbraskillzenabledaneverificationforincomingemailin
zimbra/
Using multiple https domains with SNI
Refer to: https://blog.zimbra.com/2022/06/zimbraskillzhowtousezimbrawithmultiplehttps
domainsservernameindicationsni/
Further reading
https://techcrunch.com/2021/09/21/letsencryptrootexpiry
Date Created:
Verified Against: Zimbra Collaboration 9.0, 8.8
22/09/2022
Article ID: https://wiki.zimbra.com/index.php? Date Modified:
title=Installing_a_LetsEncrypt_SSL_Certificate 20221125
Try Zimbra
Try Zimbra Collaboration with a 60day free trial.
Get it now »
Want to get involved?
You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »
Other help Resources
User Help Page »
Official Forums »
Zimbra Documentation Page »
Looking for a Video?
Visit our YouTube channel to get the latest webinars, technology news, product
overviews, and so much more.
Go to the YouTube channel »
Copyright © 2005 2022 Zimbra, Inc. All rights reserved.
Legal Information | Privacy Policy | Do Not Sell My Personal Information | CCPA Disclosures