From 774a7f32edc54726f9d8a8036f2fb220931e4699 Mon Sep 17 00:00:00 2001 From: Sebastien Date: Wed, 3 Nov 2021 16:23:43 +0100 Subject: [PATCH] Script renew cert zimbra Ver2.1 --- zimbra/certificat/renew_cert_acmesh_zimbra.sh | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/zimbra/certificat/renew_cert_acmesh_zimbra.sh b/zimbra/certificat/renew_cert_acmesh_zimbra.sh index 6e77f92..1c78c8e 100644 --- a/zimbra/certificat/renew_cert_acmesh_zimbra.sh +++ b/zimbra/certificat/renew_cert_acmesh_zimbra.sh @@ -1,8 +1,23 @@ #!/bin/bash -su - zimbra -c "/opt/zimbra/bin/zmproxyctl stop" -/root/.acme.sh/acme.sh --issue --standalone -d dns_host -su - zimbra -c " -/opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key /etc/myacme/dns_host/dns_host.cer -/opt/zimbra/bin/zmcertmgr deploycrt comm /etc/myacme/dns_host/dns_host.cer /opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt -zmcontrol restart" +#Saisir le FQDN +FQDN_1=zimbrapro.altinea.fr +#FQDN_2=smtp.it-nea.eu + +/root/.acme.sh/acme.sh --issue --standalone -d ${FQDN_1} +#/root/.acme.sh/acme.sh --issue --standalone -d ${FQDN_1} -d ${FQDN_2} + +su - zimbra -c "/opt/zimbra/bin/zmcertmgr verifycrt comm /opt/zimbra/ssl/zimbra/commercial/commercial.key /etc/myacme/${FQDN_1}/${FQDN_1}.cer" +VERIF_RCODE=$(su - zimbra -c"echo $?") +if [ $VERIF_RCODE -eq 1 ]; then + echo "erreur dans la vérification du certificat" + exit 1; +fi + +su - zimbra -c "/opt/zimbra/bin/zmcertmgr deploycrt comm /etc/myacme/${FQDN_1}/${FQDN_1}.cer /opt/zimbra/ssl/zimbra/commercial/commercial_ca.crt" +CERT_RCODE=$(su - zimbra -c"echo $?") +if [ $CERT_RCODE -eq 1 ]; then + echo "erreur dans la mise en place du certificat" + exit 1; +fi +su - zimbra -c zmcontrol restart