Created
January 4, 2016 07:29
-
-
Save xgin/fbfa4577ad46955f472c to your computer and use it in GitHub Desktop.
Secure plesk clean installation with hostname certificate by Let's Encrypt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
### Copyright 1999-2015. Parallels IP Holdings GmbH. All Rights Reserved. | |
### Secure plesk clean installation with hostname certificate by Let's Encrypt | |
export PYTHONWARNINGS="ignore:Non-standard path" | |
LE_HOME=${LE_HOME:-"/usr/local/psa/var/modules/letsencrypt"} | |
HOSTNAME=$(hostname) | |
# Use staging server for testing | |
# --server https://acme-staging.api.letsencrypt.org/directory | |
# --server http://letsencrypt.pp.plesk.ru/directory | |
"${LE_HOME}/venv/bin/letsencrypt" \ | |
--renew-by-default \ | |
--no-redirect \ | |
--agree-tos \ | |
--text \ | |
--config-dir "${LE_HOME}/root/etc" \ | |
--work-dir "${LE_HOME}/root/lib" \ | |
--logs-dir "${LE_HOME}/root/logs" \ | |
--webroot \ | |
--webroot-path "/var/www/vhosts/default/htdocs/" \ | |
-d "${HOSTNAME}" \ | |
--register-unsafely-without-email \ | |
certonly | |
CERT_PATH="${LE_HOME}/root/etc/live/${HOSTNAME}" | |
TMP_PATH=$(mktemp "${CERT_PATH}/plesk.XXXXX") | |
cat "${CERT_PATH}/privkey.pem" <(echo) \ | |
"${CERT_PATH}/cert.pem" <(echo) \ | |
"${CERT_PATH}/chain.pem" > "${TMP_PATH}" | |
echo "Let's Encrypt certificate for Plesk was created: ${TMP_PATH}" | |
/usr/local/psa/admin/bin/certmng --setup-cp-certificate --certificate="${TMP_PATH}" | |
echo "Certificate installation was finished successfully" |
I think on Onyx letsencrypt won't accept the --register-unsafely-without-email option, and this script spews an error. No huge deal, switched it for -m our@email and it seems to be working fine.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great!