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.

36 lines
1.9 KiB

3 years ago
  1. #!/bin/bash
  2. su zimbra /opt/zimbra/bin/zmproxyctl stop
  3. /root/.acme.sh/acme.sh --issue --standalone -d replace_host
  4. cd /etc/myacme/replace_host/
  5. mkdir /opt/zimbra/ssl/letsencrypt
  6. echo '-----BEGIN CERTIFICATE-----
  7. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
  8. MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
  9. DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
  10. PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
  11. Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  12. AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
  13. rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
  14. OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
  15. xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
  16. 7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD
  17. aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  18. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG
  19. SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69
  20. ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr
  21. AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz
  22. R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5
  23. JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo
  24. Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  25. -----END CERTIFICATE-----' >> fullchain.cer
  26. cp /etc/myacme/replace_host/* /opt/zimbra/ssl/letsencrypt/
  27. chown zimbra:zimbra /opt/zimbra/ssl/letsencrypt/*
  28. chown zimbra:zimbra /opt/zimbra/ssl/letsencrypt/
  29. cp -a /opt/zimbra/ssl/zimbra /opt/zimbra/ssl/zimbra.$(date "+%Y%m%d")
  30. cp /opt/zimbra/ssl/letsencrypt/replace_host.key /opt/zimbra/ssl/zimbra/commercial/commercial.key
  31. su - zimbra -c "
  32. cd /opt/zimbra/ssl/letsencrypt/
  33. /opt/zimbra/bin/zmcertmgr verifycrt comm replace_host.key replace_host.cer fullchain.cer
  34. /opt/zimbra/bin/zmcertmgr deploycrt comm replace_host.cer fullchain.cer
  35. zmcontrol restart"