From 7ea63401a94d49bda47d74feaa9d51c1e79c51c7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 19 Jun 2023 07:41:15 +0200 Subject: Generalizing extra file generation for any number of components as needed by redis in deploy_cert.extra dehydrated hook. Signed-off-by: Daniel Baumann --- dehydrated/share/hooks/deploy_cert.extra | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'dehydrated') diff --git a/dehydrated/share/hooks/deploy_cert.extra b/dehydrated/share/hooks/deploy_cert.extra index 3f6541a..b0d8737 100755 --- a/dehydrated/share/hooks/deploy_cert.extra +++ b/dehydrated/share/hooks/deploy_cert.extra @@ -70,14 +70,19 @@ case "${CHAIN}" in esac # extra certificate permutations: -# * privkey_fullchain.pem: postfix -for EXTRA in fullchain_privkey privkey_fullchain +# * privkey_fullchain.pem: postfix +# * root_intermediate_cert.pem: redis + +for EXTRA in fullchain_privkey privkey_fullchain root_intermediate_cert do - EXTRA1="$(echo ${EXTRA} | awk -F_ '{ print $1 }')" - EXTRA2="$(echo ${EXTRA} | awk -F_ '{ print $2 }')" + rm -f "${DIRECTORY}/${EXTRA}-${TIMESTAMP}.pem" + + for FILE in $(echo ${EXTRA} | sed -e 's|_| |g') + do + cat "${DIRECTORY}/${FILE}-${TIMESTAMP}.pem" >> "${DIRECTORY}/${EXTRA}-${TIMESTAMP}.pem" + done - cat "${DIRECTORY}/${EXTRA1}-${TIMESTAMP}.pem" "${DIRECTORY}/${EXTRA2}-${TIMESTAMP}.pem" > "${DIRECTORY}/${EXTRA1}_${EXTRA2}-${TIMESTAMP}.pem" - ln -sf "${EXTRA1}_${EXTRA2}-${TIMESTAMP}.pem" "${DIRECTORY}/${EXTRA1}_${EXTRA2}.pem" + ln -sf "${EXTRA}-${TIMESTAMP}.pem" "${DIRECTORY}/${EXTRA}.pem" done echo " done." -- cgit v1.2.3