-
-
Save scysys/bc12fa0e1415bc29d0e2117ea740a8fa to your computer and use it in GitHub Desktop.
Secure Plesk 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}" \ | |
--email YOUR-EMAIL-ADRESS \ | |
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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace "YOUR-EMAIL-ADRESS" with your E-Mail-Adress, when using it.