diff --git a/templates/requestCertificate.sh.j2 b/templates/requestCertificate.sh.j2 index b035908..4d98c09 100644 --- a/templates/requestCertificate.sh.j2 +++ b/templates/requestCertificate.sh.j2 @@ -12,12 +12,16 @@ $VAULT_ADDR/v1/rootca_store/issue/{{vaultStoreRole}} > certificateResult.txt jq .data.private_key certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" > cert.pem jq .data.certificate certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" > cert.crt -jq .data.ca_chain[0] certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" > ca.crt -jq .data.ca_chain[1] certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" >> ca.crt + +jq .data.ca_chain certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" > ca.crt.tmp +jq .data.issuing_ca certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" >> ca.crt.tmp +jq .data.ca_chain[0] certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" >> ca.crt.tmp +jq .data.ca_chain[1] certificateResult.txt | sed "s/\"//g" | sed "s/\\\n/\n/g" >> ca.crt.tmp +grep ca.crt.tmp -v -e null > ca.crt mv cert.pem /etc/ssl/private/$(hostname).{{local_domainname}}.key mv cert.crt /etc/ssl/certs/$(hostname).{{local_domainname}}.crt mv ca.crt /etc/ssl/certs/{{local_domainname}}-CA-chain.crt -rm certificateResult.txt +#rm certificateResult.txt