You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

  1. #!/bin/bash
  2. # Zimbra Assumptions:
  3. # 1) acme.sh is installed as Zimbra
  4. # 2) see: https://wiki.zimbra.com/wiki/index.php?curid=2441
  5. # Related Questions to users: JDunphy and seidler in forums.zimbra.org
  6. ######## Public functions #####################
  7. #domain keyfile certfile cafile fullchain
  8. zimbra_deploy() {
  9. _cdomain="$1"
  10. _ckey="$2"
  11. _ccert="$3"
  12. _cca="$4"
  13. _cfullchain="$5"
  14. _debug _cdomain "$_cdomain"
  15. _debug _ckey "$_ckey"
  16. _debug _ccert "$_ccert"
  17. _debug _cca "$_cca"
  18. _debug _cfullchain "$_cfullchain"
  19. # Zimbra's javastore still needs DST Root CA X3 to verify on some versions
  20. _IdentTrust="$(dirname "$_cca")/../IdentTrust.pem"
  21. _debug _IdentTrust "$_IdentTrust"
  22. # grab it if we don't have it
  23. if [ ! -f "$_IdentTrust" ]; then
  24. _debug No "$_IdentTrust"
  25. wget -q "https://ssl-tools.net/certificates/dac9024f54d8f6df94935fb1732638ca6ad77c13.pem" -O "$_IdentTrust" || return 1
  26. fi
  27. # append Intermediate
  28. cat "$_cfullchain" "$(dirname "$_cca")/../IdentTrust.pem" > "${_cca}.real"
  29. /opt/zimbra/bin/zmcertmgr verifycrt comm "$_ckey" "$_ccert" "${_cca}.real" || return 1
  30. #if it verifies we can deploy it
  31. cp -f "$_ckey" /opt/zimbra/ssl/zimbra/commercial/commercial.key
  32. /opt/zimbra/bin/zmcertmgr deploycrt comm "$_ccert" "${_cca}.real" || return 1
  33. /opt/zimbra/bin/zmmailboxdctl reload
  34. /opt/zimbra/bin/zmproxyctl reload
  35. /opt/zimbra/bin/zmmtactl reload
  36. return 0
  37. }