Last active
December 8, 2020 19:43
-
-
Save dishuostec/615672a1e9be7773b387e466ff2c1663 to your computer and use it in GitHub Desktop.
synology dsm 6.2 deploy wildcard certs
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/bash | |
WORKING_DIR=/usr/syno/etc/certificate | |
ARCHIVE_DIR=${WORKING_DIR}/_archive | |
INFO=`cat ${ARCHIVE_DIR}/INFO` | |
KEYS=`echo $INFO | jq -r 'keys_unsorted|.[]'` | |
for key in ${KEYS}; do | |
SERVICES=`echo $INFO | jq -r --arg key ${key} '.[$key].services | .[] | [.subscriber, .service] | join("/")'` | |
for service in ${SERVICES}; do | |
if [[ -d ${WORKING_DIR}/${service}/ ]]; then | |
cp ${ARCHIVE_DIR}/${key}/{cert,fullchain,privkey}.pem ${WORKING_DIR}/${service}/ | |
fi | |
done | |
done | |
/usr/syno/etc/rc.sysv/nginx.sh reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment