Skip to content

Commit

Permalink
Fix CERTPATH assign
Browse files Browse the repository at this point in the history
  • Loading branch information
maxxer committed Aug 31, 2018
1 parent 92d5761 commit 1d011f6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions certbot_zimbra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ function request_certificate() {
done
fi

# Set variable for use in prepare_certificate
CERTPATH="/etc/letsencrypt/live/$DOMAIN"
if [ "$RENEW_ONLY" == "yes" ]; then
return
fi
Expand Down Expand Up @@ -346,13 +348,17 @@ function find_additional_public_hostnames() {

# copies stuff ready for zimbra deployment and test them
function prepare_certificate () {
if [ -z "$CERTPATH" ] ; then
echo "Empty CERTPATH"
exit 1;
fi
# Make zimbra accessible files
mkdir /opt/zimbra/ssl/letsencrypt 2>/dev/null
cp $CERTPATH/$ZMHOSTNAME/* /opt/zimbra/ssl/letsencrypt/
cp $CERTPATH/* /opt/zimbra/ssl/letsencrypt/
chown -R zimbra:zimbra /opt/zimbra/ssl/letsencrypt/

# Now we should have the chain. Let's create the "patched" chain suitable for Zimbra
cat $CERTPATH/$ZMHOSTNAME/chain.pem > /opt/zimbra/ssl/letsencrypt/zimbra_chain.pem
cat $CERTPATH/chain.pem > /opt/zimbra/ssl/letsencrypt/zimbra_chain.pem
# The cert below comes from https://www.identrust.com/certificates/trustid/root-download-x3.html. It should be better to let the user fetch it?
cat << EOF >> /opt/zimbra/ssl/letsencrypt/zimbra_chain.pem
-----BEGIN CERTIFICATE-----
Expand Down

0 comments on commit 1d011f6

Please sign in to comment.