Skip to content

Commit b6a913a

Browse files
committed
Updates wildcard renew script
1 parent c92fe35 commit b6a913a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Diff for: config/openresty/scripts/renew-wildcard-ssl.sh

+13-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
ACME=/usr/local/bin/acme-nginx
55

66
# Sources the environment variables required
7-
source /etc/blot/secrets.env
7+
. /etc/blot/wildcard-ssl-env.sh
88

99
if [ -z "$BLOT_HOST" ]; then
1010
echo "BLOT_HOST variable missing, pass the hostname of the blot instance as an argument to this script"
@@ -16,6 +16,16 @@ if [ -z "$BLOT_REDIS_HOST" ]; then
1616
exit 1
1717
fi
1818

19+
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
20+
echo "AWS_ACCESS_KEY_ID variable missing, pass the aws access key as an argument to this script"
21+
exit 1
22+
fi
23+
24+
if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
25+
echo "AWS_SECRET_ACCESS_KEY variable missing, pass the aws access key as an argument to this script"
26+
exit 1
27+
fi
28+
1929
HASH_OF_KEY_BEFORE=$(cat /etc/ssl/private/letsencrypt-domain.key | openssl md5 | cut -d' ' -f2)
2030
HASH_OF_PEM_BEFORE=$(cat /etc/ssl/private/letsencrypt-domain.pem | openssl md5 | cut -d' ' -f2)
2131

@@ -39,7 +49,7 @@ if [ "$HASH_OF_PEM_BEFORE" = "$HASH_OF_PEM_AFTER" ]; then
3949
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] Pem changed after renewal, hash after: $HASH_OF_PEM_AFTER hash before: $HASH_OF_PEM_BEFORE"
4050
fi
4151

42-
# We need to store the key and pem in redis so that the openresty reload script can fetch them
52+
# We store the key and pem in redis so that the openresty reload script can fetch them
4353
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] Beginning storage of key and pem in redis"
4454

4555
cat /etc/ssl/private/letsencrypt-domain.key | redis-cli -h $BLOT_REDIS_HOST -x set 'blot:openresty:ssl:key'
@@ -48,4 +58,4 @@ cat /etc/ssl/private/letsencrypt-domain.pem | redis-cli -h $BLOT_REDIS_HOST -x s
4858
redis-cli -h $BLOT_REDIS_HOST set 'blot:openresty:ssl:updated' $(date -u +%s)
4959

5060
# Restart openresty to use the new cert
51-
sudo openresty -s reload
61+
openresty -s reload

0 commit comments

Comments
 (0)