From 258a1ce7f729744fbb2bcff42787e784d2627a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20L=C3=BCscher?= Date: Thu, 4 May 2023 17:04:24 +0000 Subject: [PATCH] fix: ini container fails on normal startup --- minica/certificates.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/minica/certificates.sh b/minica/certificates.sh index a287b2e..d1e5a02 100644 --- a/minica/certificates.sh +++ b/minica/certificates.sh @@ -9,7 +9,6 @@ if [ ! -f ${CERTIFICATE_DIRECTORY}/ssh/${SSH_KEY_NAME} ]; then echo "uBlue Forge SSH key not present. Creating new key..." mkdir ${CERTIFICATE_DIRECTORY}/ssh -p - mkdir ${CERTIFICATE_DIRECTORY}/tls -p # Generate SSH key ssh-keygen -o -a 100 -t ed25519 -f ${CERTIFICATE_DIRECTORY}/ssh/${SSH_KEY_NAME} -C "forge@ublue.local" else @@ -17,5 +16,12 @@ else fi # Creating TLS certificates -echo "Creating / Updating TLS certificate..." -minica --domains "*.ublue.local,ublue.local,localhost" --ip-addresses 127.0.0.1 -ca-cert "${CERTIFICATE_DIRECTORY}/tls/${TLS_ROOT_CERTIFICATE_NAME}.pem" -ca-key "${CERTIFICATE_DIRECTORY}/tls/${TLS_ROOT_CERTIFICATE_NAME}-key.pem" +if [ ! -f ${CERTIFICATE_DIRECTORY}/tls/${TLS_ROOT_CERTIFICATE_NAME}.pem ]; +then + echo "uBlue Forge TLS root not certificate present. Creating new certificates..." + mkdir ${CERTIFICATE_DIRECTORY}/tls -p + # Generate TLS certificates + minica --domains "*.ublue.local,ublue.local,localhost" --ip-addresses 127.0.0.1 -ca-cert "${CERTIFICATE_DIRECTORY}/tls/${TLS_ROOT_CERTIFICATE_NAME}.pem" -ca-key "${CERTIFICATE_DIRECTORY}/tls/${TLS_ROOT_CERTIFICATE_NAME}-key.pem" +else + echo "Existing uBlue Forge TLS root certificate found. Nothing to do..." +fi