Skip to content

Commit 8dd6721

Browse files
author
Neil
committed
Merge pull request #6 from Neilpang/dev
Opps, fix cert format
2 parents 71851c2 + a889d68 commit 8dd6721

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

le.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,16 +382,16 @@ issue() {
382382
done
383383

384384
_info "Verify finished, start to sign."
385-
der=$(openssl req -in $CSR_PATH -outform DER | base64 | _b64)
385+
der="$(openssl req -in $CSR_PATH -outform DER | base64 | _b64)"
386386
_send_signed_request "$API/acme/new-cert" "{\"resource\": \"new-cert\", \"csr\": \"$der\"}"
387387

388388

389-
Le_LinkCert=$(grep -i '^Location' $CURL_HEADER | cut -d " " -f 2)
389+
Le_LinkCert="$(grep -i -o '^Location.*' $CURL_HEADER |sed 's/\r//g'| cut -d " " -f 2)"
390390
_setopt $DOMAIN_CONF "Le_LinkCert" "=" "$Le_LinkCert"
391391

392-
if [ "$Le_LinkCert" ] ; then
392+
if [ "$Le_LinkCert" ] ; then
393393
echo -----BEGIN CERTIFICATE----- > $CERT_PATH
394-
echo $response | base64 | sed "s/ /\n/g" >> $CERT_PATH
394+
curl --silent $Le_LinkCert | base64 >> $CERT_PATH
395395
echo -----END CERTIFICATE----- >> $CERT_PATH
396396
_info "Cert success."
397397
cat $CERT_PATH
@@ -415,7 +415,7 @@ issue() {
415415
if [ "$Le_LinkIssuer" ] ; then
416416
_get "$Le_LinkIssuer"
417417
echo -----BEGIN CERTIFICATE----- > $CA_CERT_PATH
418-
echo $response | base64 | sed "s/ /\n/g" >> $CA_CERT_PATH
418+
curl --silent $Le_LinkIssuer | base64 >> $CA_CERT_PATH
419419
echo -----END CERTIFICATE----- >> $CA_CERT_PATH
420420
_info "The intermediate CA cert is in $CA_CERT_PATH"
421421
fi

0 commit comments

Comments
 (0)