Skip to content
This repository was archived by the owner on Feb 5, 2018. It is now read-only.

Commit 22d5a14

Browse files
committed
Split certificate in certificate and chain certificate
1 parent d2ee019 commit 22d5a14

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

usr/local/bin/lego-platform.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ set +x
44

55
. /etc/container_environment.sh
66

7+
TMPDIR=$(mktemp -d)
8+
9+
cleanup() {
10+
rm -rf "${TMPDIR}"
11+
}
12+
13+
trap cleanup EXIT
14+
715
IFS=' ' read -r -a domains <<< "${DOMAINS}"
816
LEGOPATH=/data
917
export HOME=/root
@@ -62,9 +70,12 @@ upload_certificates () {
6270

6371
upload_certificate () {
6472
local domain=$1
65-
local cert=${LEGOPATH}/certificates/${domain}.crt
73+
74+
csplit -f ${TMPDIR}/cert- ${LEGOPATH}/certificates/${domain}.crt '/-----BEGIN CERTIFICATE-----/' '{*}'
75+
76+
local cert=${TMPDIR}/cert-01
6677
local key=${LEGOPATH}/certificates/${domain}.key
67-
local chain=${LEGOPATH}/certificates/${domain}.crt
78+
local chain=${TMPDIR}/cert-02
6879
platform domain:update --yes --cert=${cert} --key=${key} --chain=${chain} --project="${PLATFORMSH_PROJECT_ID}" "${domain}"
6980
}
7081

0 commit comments

Comments
 (0)