From 8a29254656b3346c596f446d6a4617c113c21631 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 12 Feb 2019 14:18:49 +0100 Subject: [PATCH] Fix linking /run/secrets These are to be linked only if they exists. --- container_files/usr-local-bin/start-httpd.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/container_files/usr-local-bin/start-httpd.sh b/container_files/usr-local-bin/start-httpd.sh index 0bc2028..96ad214 100755 --- a/container_files/usr-local-bin/start-httpd.sh +++ b/container_files/usr-local-bin/start-httpd.sh @@ -1,8 +1,16 @@ #!/bin/bash -echo "Linking secrets and config files; using authentication: $AUTHENTICATION" -ln -sf /run/secrets/mp_sp-key.pem /etc/shibboleth/sp-key.pem -ln -sf /run/secrets/mp_host-key.pem /etc/pki/tls/private/host-key.pem +echo "Linking secrets" +for filepath in /run/secrets/*; do + label_file=`basename $filepath` + if [ "$label_file" == "mp_sp-key.pem" ]; then + ln -sf /run/secrets/mp_sp-key.pem /etc/shibboleth/sp-key.pem + elif [ "$label_file" == "mp_host-key.pem" ]; then + ln -sf /run/secrets/mp_host-key.pem /etc/pki/tls/private/host-key.pem + fi +done + +echo "Linking config files; using authentication: $AUTHENTICATION" ln -sf /etc/httpd/conf.d/midpoint.conf.auth.$AUTHENTICATION /etc/httpd/conf.d/midpoint.conf ln -sf /etc/httpd/conf.d/shib.conf.auth.$AUTHENTICATION /etc/httpd/conf.d/shib.conf ln -sf /etc/httpd/conf.modules.d/00-shib.conf.auth.$AUTHENTICATION /etc/httpd/conf.modules.d/00-shib.conf