Skip to content

Instantly share code, notes, and snippets.

@EthraZa
Last active October 6, 2017 19:58
Show Gist options
  • Save EthraZa/5d157466a33eb97b465d9db2776c4d80 to your computer and use it in GitHub Desktop.
Save EthraZa/5d157466a33eb97b465d9db2776c4d80 to your computer and use it in GitHub Desktop.
Issue a LetsEncrypt SSL certificate using acme.sh
#!/bin/bash
# Issue a LetsEncrypt SSL certificate using acme.sh
#
# ISPConfig 3 preparation:
# Enable the SSL option and Add a self-signed certificate on SSL tab within Sites/Domains to create the needed configurations.
#
if [ -z "$*" ]; then
printf "\n issue-cert.sh domain.com \n\n"
exit 0
fi
acme="/usr/local/acme.sh/acme.sh"
webroot="/usr/local/ispconfig/interface/acme"
webssl="/var/www/${1}/ssl"
sslfilename="${1}"
#reloadcmd="service apache2 restart"
reloadcmd=""
issueargs="--issue -d ${1} -d webmail.${1} -d www.${1} -w ${webroot}"
installargs="--install-cert -d ${1} --cert-file ${webssl}/${sslfilename}.crt --key-file ${webssl}/${sslfilename}.key --fullchain-file ${webssl}/${sslfilename}.bundle --reloadcmd ${reloadcmd}"
echo ">${acme} ${issueargs}"
${acme} ${issueargs}
echo ">${acme} ${installargs}"
${acme} ${installargs}
@EthraZa
Copy link
Author

EthraZa commented Oct 6, 2017

Install acme.sh:

git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --home /usr/local/acme.sh --certhome /etc/acme.sh --accountemail "[email protected]"

Fix crontab:
54 0 * * * /usr/local/acme.sh/acme.sh --cron --home /usr/local/acme.sh > /dev/null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment