From 74bda1b1be494907f78e76b8d6a3e3e9c3b1beb9 Mon Sep 17 00:00:00 2001 From: lars-hagen Date: Wed, 19 Feb 2020 12:34:50 +0100 Subject: [PATCH] Ability to issue certs using acme.sh --- bin/acme.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/bin/acme.sh b/bin/acme.sh index d9b3195..87b4264 100755 --- a/bin/acme.sh +++ b/bin/acme.sh @@ -2,23 +2,28 @@ EMAIL='' NO_EMAIL='' INSTAL='' +DOMAIN='' help_message(){ - echo 'Command [-domain XX] [-php lsphpXX]' + echo 'Command [-domain XX]' + echo 'Command --install [--email XX]' + echo 'Command --install --no-email' echo 'Example: acme.sh -domain ' + echo 'Example: acme.sh --install --email example@example.com' + echo 'Example: acme.sh --install --no-email' } check_input(){ if [ -z "${1}" ]; then help_message - echo "${1}" exit 1 fi } ck_acme(){ - if ! docker-compose exec litespeed su -c "test -f /root/acme/acme.sh"; then - echo "It seems like you didn't install /root/acme/acme.sh, please run bin/acme.sh --install" + if ! docker-compose exec litespeed su -c "test -f /root/.acme.sh/acme.sh"; then + echo "It seems like you didn't install /root/.acme.sh/acme.sh, please run bin/acme.sh --install" + help_message exit 1 fi } @@ -33,6 +38,7 @@ install_acme(){ else if [ -z ${EMAIL} ]; then echo "Error: You didn't specify the email you want to receive lets encrypt notifications on. Please add --email EMAIL" + exit else docker-compose exec litespeed su -c "cd;\ wget https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh; chmod 755 acme.sh; \ @@ -45,13 +51,20 @@ install_acme(){ } +install_cert(){ + docker-compose exec litespeed su -c "/root/.acme.sh/acme.sh --issue -d ${DOMAIN} -w /var/www/vhosts/${DOMAIN}/html/" + +} main(){ if [ -z "${INSTALL}" ]; then ck_acme else install_acme ${EMAIL} ${NO_EMAIL} + echo 'Acme installed, you can now issue your cert with bin/acme.sh -domain ' + exit 1 fi + install_cert ${DOMAIN} } check_input ${1}