Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@EthraZa
Last active October 6, 2017 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 "me@here.com.br"

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