From ec5fe96ca88a8529bfd8f1a9585d157921bd83d9 Mon Sep 17 00:00:00 2001 From: warroyo Date: Wed, 14 Oct 2020 21:02:05 -0600 Subject: [PATCH] encode cert to handle newlines --- install.sh | 1 + proxy.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index da1d878..3c0805d 100755 --- a/install.sh +++ b/install.sh @@ -3,6 +3,7 @@ set -e source env.sh +export REG_CERT=$(echo "$REG_CERT" | base64 -w 0) #get all supervisor ips, there may be a better way? echo "getting supervisor vm creds" diff --git a/proxy.sh b/proxy.sh index 92c5681..b95ced3 100755 --- a/proxy.sh +++ b/proxy.sh @@ -13,7 +13,6 @@ run_interval=${INTERVAL:=30} function inject_ca() { touch /etc/ssl/certs/regcert.pem - echo "$REG_CERT" > /etc/ssl/certs/regcert.pem.new echo "checking if cert exists" if cmp -s "/etc/ssl/certs/regcert.pem.new" "/etc/ssl/certs/regcert.pem"; then echo "the cert already exists and has not changed" @@ -110,6 +109,7 @@ function run() echo no CA cert providied skipping cert injection... else $(typeset -f inject_ca) + echo "${REG_CERT}" | base64 -d > /etc/ssl/certs/regcert.pem.new inject_ca fi