mirror of
https://github.com/10h30/ols-docker-env.git
synced 2026-05-12 23:31:35 +09:00
Ability to issue certs using acme.sh
This commit is contained in:
+17
-4
@@ -2,23 +2,28 @@
|
|||||||
EMAIL=''
|
EMAIL=''
|
||||||
NO_EMAIL=''
|
NO_EMAIL=''
|
||||||
INSTAL=''
|
INSTAL=''
|
||||||
|
DOMAIN=''
|
||||||
|
|
||||||
help_message(){
|
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 -domain '
|
||||||
|
echo 'Example: acme.sh --install --email example@example.com'
|
||||||
|
echo 'Example: acme.sh --install --no-email'
|
||||||
}
|
}
|
||||||
|
|
||||||
check_input(){
|
check_input(){
|
||||||
if [ -z "${1}" ]; then
|
if [ -z "${1}" ]; then
|
||||||
help_message
|
help_message
|
||||||
echo "${1}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ck_acme(){
|
ck_acme(){
|
||||||
if ! docker-compose exec litespeed su -c "test -f /root/acme/acme.sh"; then
|
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/acme.sh, please run bin/acme.sh --install"
|
echo "It seems like you didn't install /root/.acme.sh/acme.sh, please run bin/acme.sh --install"
|
||||||
|
help_message
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -33,6 +38,7 @@ install_acme(){
|
|||||||
else
|
else
|
||||||
if [ -z ${EMAIL} ]; then
|
if [ -z ${EMAIL} ]; then
|
||||||
echo "Error: You didn't specify the email you want to receive lets encrypt notifications on. Please add --email EMAIL"
|
echo "Error: You didn't specify the email you want to receive lets encrypt notifications on. Please add --email EMAIL"
|
||||||
|
exit
|
||||||
else
|
else
|
||||||
docker-compose exec litespeed su -c "cd;\
|
docker-compose exec litespeed su -c "cd;\
|
||||||
wget https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh; chmod 755 acme.sh; \
|
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(){
|
main(){
|
||||||
if [ -z "${INSTALL}" ]; then
|
if [ -z "${INSTALL}" ]; then
|
||||||
ck_acme
|
ck_acme
|
||||||
else
|
else
|
||||||
install_acme ${EMAIL} ${NO_EMAIL}
|
install_acme ${EMAIL} ${NO_EMAIL}
|
||||||
|
echo 'Acme installed, you can now issue your cert with bin/acme.sh -domain '
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
install_cert ${DOMAIN}
|
||||||
}
|
}
|
||||||
|
|
||||||
check_input ${1}
|
check_input ${1}
|
||||||
|
|||||||
Reference in New Issue
Block a user