-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
168 additions
and
67 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
|
||
domain=$1 | ||
containers_and_cmd=$2 | ||
|
||
if [ ! -S /var/run/docker.sock ]; then | ||
echo "ERROR: /var/run/docker.sock socket is missing." | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d /etc/letsencrypt/archive/$domain ]; then | ||
echo "ERROR: /etc/letsencrypt/archive/$domain directory is missing." | ||
fi | ||
|
||
# Load hash of the certificate | ||
current_hash=`md5sum /etc/letsencrypt/live/$domain/cert.pem | awk '{ print $1 }'` | ||
while true; do | ||
new_hash=`md5sum /etc/letsencrypt/live/$domain/cert.pem | awk '{ print $1 }'` | ||
|
||
if [ "$current_hash" != "$new_hash" ]; then | ||
# Extract container name and its command | ||
IFS=','; for container_and_cmd in $containers_and_cmd; do | ||
# Extract container name and its command | ||
container_name="" | ||
command="" | ||
IFS=':'; for entry in $container_and_cmd; do | ||
if [ -z $container_name ]; then | ||
container_name="$entry" | ||
else | ||
command="$entry" | ||
fi | ||
done; unset IFS | ||
echo ">>> Executing command '$command' for container $container_name because certificate for $domain has been modified." | ||
# Execute it | ||
docker exec $container_name $command | ||
done; unset IFS | ||
|
||
# Keep new hash version | ||
current_hash="$new_hash" | ||
fi | ||
|
||
# Wait 1s for next iteration | ||
sleep 1 | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
# Construct PFX file for new cert if needed | ||
if [ "$PFX_EXPORT" = "true" ]; then | ||
openssl pkcs12 -export \ | ||
-out $RENEWED_LINEAGE/cert.pfx \ | ||
-inkey $RENEWED_LINEAGE/privkey.pem \ | ||
-in $RENEWED_LINEAGE/cert.pem \ | ||
-certfile $RENEWED_LINEAGE/chain.pem \ | ||
-password pass:$PFX_EXPORT_PASSPHRASE | ||
fi | ||
|
||
# Synchronize mode and user/group for new certificate files | ||
chmod $CERTS_DIRS_MODE $(find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type d) | ||
chmod $CERTS_FILES_MODE $(find $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} -type f) | ||
chown -R $CERTS_USER_OWNER:$CERTS_GROUP_OWNER $RENEWED_LINEAGE ${RENEWED_LINEAGE/live/archive} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,4 @@ | ||
#!/bin/sh | ||
|
||
echo "Launch renew test" | ||
|
||
hooks="" | ||
if [ "$PFX_EXPORT" = "true" ]; then | ||
hooks="$hooks --deploy-hook pfx-export-hook.sh" | ||
fi | ||
|
||
certbot renew -n $hooks | ||
certbot renew -n --deploy-hook deploy-hook.sh |
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
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