Skip to content

Instantly share code, notes, and snippets.

@whs

whs/enroll.sh

Last active Jul 17, 2019
Embed
What would you like to do?
Dumb bulk cert generator
#!/bin/sh
BIN=/home/whs/.local/share/letsencrypt/bin/letsencrypt
SHUT_SVC=1
if [ "$SHUT_SVC" = "1" ]; then
sudo service nginx stop
sudo service apache2 stop
fi
SITES=certs/*
if [ "$*" != "" ]; then
SITES=$*
fi
for i in $SITES; do
DOMAINS=""
CONTENTS=`cat $i`
if [ "$?" != 0 ]; then
exit $?
fi
for line in $CONTENTS; do
DOMAINS=$DOMAINS" -d $line"
done
sudo $BIN certonly --agree-tos -a standalone --standalone-supported-challenges http-01 $DOMAINS
done
if [ "$SHUT_SVC" = "1" ]; then
sudo service apache2 start
sudo service nginx start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.