Last active
October 26, 2020 17:02
-
-
Save bodziek666/1c764181f2ca3cb9bcd0d823ef1ec7b9 to your computer and use it in GitHub Desktop.
let's encrypt hook for reloading murmurd ssl certificates
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 | |
LETSENCRYPT_DIR="/etc/letsencrypt/live/mumble.domain.tld" | |
MUMBLE_CERT_DIR="/opt/docker/murmur/cert" | |
DOCKER_CONTAINER="murmur" | |
DOCKER_MUMBLE_UID=2137 | |
DOCKER_MUMBLE_GID=2137 | |
# cleanup | |
rm -f "${MUMBLE_CERT_DIR}"/{privkey*,fullchain*}.pem | |
# copy newly generated certs | |
cp $(readlink -f "${LETSENCRYPT_DIR}"/{privkey*,fullchain*}.pem) "${MUMBLE_CERT_DIR}" | |
# rename certificates accordingly | |
for i in "${MUMBLE_CERT_DIR}"/*.pem | |
do | |
mv "${i}" "$(echo "${i}" | sed 's#\([a-zA-Z]*\)\([0-9]*\)\.pem#\1\.pem#g')" | |
done | |
# set proper permissions | |
chown "${DOCKER_MUMBLE_UID}":"${DOCKER_MUMBLE_GID}" "${MUMBLE_CERT_DIR}"/{privkey,fullchain}.pem | |
# reload certificates | |
docker exec -dt "${DOCKER_CONTAINER}" /usr/bin/killall -SIGUSR1 murmur.x86 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment