I had looked at this https://wiki.zimbra.com/wiki/Installing ... ertificate but wanted a less intrusive method.
UPDATE: 7/19/2018 This is condensed into a wiki article - https://wiki.zimbra.com/wiki/JDunphy-Letsencrypt
BEGIN: TL;DR All in one method using automatic dns validation. Can use any validation method in place of DNS.
Code: Select all
% su - zimbra
# This will append a cron entry to zimbra's crontab and create /opt/zimbra/.acme.sh with the acme.sh bash script.
% wget -O - https://get.acme.sh | sh
% cd .acme.sh
#will create or renew certs in /opt/zimbra/.acme.sh/
% ./acme.sh --issue --dns dns_cf -d mail.example.com -d mail.example.net -d mail.example.org -d '*.wildcard.com'
# will deploy into zimbra
% ./acme.sh --issue --deploy --deploy-hook zimbra -d mail.example.com
END: TL;DR
This method requires very little software to be installed (bash script only) and can be done on an external machine if you want. It uses the acme protocol with the DNS method for verification. The first time you run it, it will provide some DNS entries you are required to add and then can verify against that. After this initial verification step, one can remove those dns entries. See this https://github.com/Neilpang/acme.sh for full documentation and other methods such as stand alone.
The process goes like this.
Code: Select all
git clone https://github.com/Neilpang/acme.sh
cd acme.sh
./acme.sh --install
You can copy this .acme.sh directory to your production machines later if you are simply testing the methodology. I tend to test everything on a staging server first so that is my method.
Continuing...
Code: Select all
cd ..
source $home/.acme.sh/acme.sh.csh or simply login/logout first time if you are not sure. I just source .cshrc myself.
acme.sh --issue --dns -d mail.example.com -d mail.example.net -d mail.example.org -d tmail.example.com
Continuing...
UPDATE 3/29/2018: If you renew within 29 days, you will not go through the request/challenge. See my post on page 3 and 7 later explaining why and options. If you do that, you will need to add --force because acme.sh doesn't think it is time to renew. The Certificates are still good for 90 days. With the newer acme.sh software from 2018 or later it now requires you to add this switch --yes-I-know-dns-manual-mode-enough-go-ahead-please. The author wants to alert you to these changes by letsencrypt. Long term solution: use one of the 2 automatic DNS methods or the standalone server verification methods.
Code: Select all
acme.sh --renew -d mail.example.com -d mail.example.net -d mail.example.org -d tmail.example.com
Here is what the directory structure looks like after you have executed the acme.sh script:
Code: Select all
testmail:~:43> cd .acme.sh
testmail:~/.acme.sh:44> ls
account.conf acme.sh.csh ca dnsapi
acme.sh acme.sh.env deploy http.header mail.example.com
testmail:~/.acme.sh:45> cd mail.example.com/
testmail:~/.acme.sh/mail.example.com:46> ls
ca.cer mail.example.com.conf mail.example.com.key
fullchain.cer mail.example.com.csr
mail.example.com.cer mail.example.com.csr.conf
Continuing...
First time, we need to create a cross-signed IdentTrust CERT so that zimbra can verify our certificate chain properly. It is who gives LetEncrypt authority to sign these free certs.
I put the following CERT into a file named IdentTrust.pem so I can use this the next time I have to renew my certs. It comes from here: https://www.identrust.com/certificates/ ... ad-x3.html
Clarification of why this extra step:
Continuing...Our intermediate is signed by ISRG Root X1. However, since we are a very new certificate authority, ISRG Root X1 is not yet trusted in most browsers. In order to be broadly trusted right away, our intermediate is also cross-signed by another certificate authority, IdenTrust, whose root is already trusted in all major browsers. Specifically, IdenTrust has cross-signed our intermediate using their DST Root CA X3.
Code: Select all
Create a file called $home/.acme.sh/IdentTrust.pem
-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD
aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG
SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69
ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr
AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz
R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5
JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo
Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
-----END CERTIFICATE-----
Continuing...
Code: Select all
cd $home/.acme.sh/mail.example.com
cat ../IdentTrust.pem >> fullchain.cer
Code: Select all
testmail:~/.acme.sh:47> ls
account.conf acme.sh.csh ca dnsapi IdentTrust.pem
acme.sh acme.sh.env deploy http.header mail.example.com
Code: Select all
$home/.acme.sh/acme.sh --cron --home $home/.acme.sh # this could generate a new cert if its time
cd $home/.acme.sh/mail.example.com
cat ../IdentTrust.pem >> fullchain.cer # only if you have new or renewed certs in mail.example.com directory
su zimbra -c "/opt/zimbra/bin/zmcertmgr verifycrt comm mail.example.com.key mail.example.com.cer fullchain.cer"
If that looks like zimbra likes the cert than you can deploy it as in:
I like to backup first.
Code: Select all
# do this as the zimbra user
cd /opt/zimbra/ssl
tar cvf zimbra.tar.$(date "+%Y%m%d") zimbra

Note: zmcertmgr is running as zimbra for 8.7+ ... While I haven't tested with 8.6, you would run it as root for those earlier releases.
WARNING: Because zmcertmgr is running as zimbra, make sure that zimbra can read the $home/.acme.sh and its associated files.
Code: Select all
cd $home/.acme.sh
su zimbra -c "cp mail.example.key /opt/zimbra/ssl/zimbra/commercial/commercial.key"
su zimbra -c "/opt/zimbra/bin/zmcertmgr deploycrt comm mail.example.cer fullchain.cer"
zmcontrol restart
Code: Select all
$home/.acme.sh/acme.sh --cron --home $home/.acme.sh
I know this is long but its fairly simple and you don't need to be root or be on the same production host to try it out. You can copy the .acme.sh to your production machine and see if zimbra likes your cert.
The days of self-signed certs are gone. I think it took me more time to write this than create a simple script to do all this.

BTW, You should also do this: https://wiki.zimbra.com/wiki/How_to_obt ... urity_Test so that sslabs gives you an A+ score for your cert.
Code: Select all
zmprov mcf +zimbraResponseHeader "Strict-Transport-Security: max-age=31536000"
% zmprov mcf zimbraReverseProxySSLCiphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128:AES256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4'
% zmcontrol restart
UPDATE: 2/7/2017. See: https://github.com/JimDunphy/deploy-zim ... encrypt.sh for updated method that is simpler and allows other acme.sh methods including standalone that makes deploying these certificates easier to learn.