summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2023-06-19 05:41:15 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2023-06-19 05:41:15 +0000
commit7ea63401a94d49bda47d74feaa9d51c1e79c51c7 (patch)
tree8102ea905559a322c01d5943f1cd6b537835a830
parentStripping empty lines from partial files when using short chain in deploy_cer... (diff)
downloadservice-tools-7ea63401a94d49bda47d74feaa9d51c1e79c51c7.tar.xz
service-tools-7ea63401a94d49bda47d74feaa9d51c1e79c51c7.zip
Generalizing extra file generation for any number of components as needed by redis in deploy_cert.extra dehydrated hook.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-xdehydrated/share/hooks/deploy_cert.extra17
1 files changed, 11 insertions, 6 deletions
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."