Last active
July 17, 2019 12:00
-
-
Save whs/4dfaec165c2807a4957f to your computer and use it in GitHub Desktop.
Dumb bulk cert generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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