mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-04-28 11:17:04 +02:00
output CA cert for signcsr command (fixes #150)
This commit is contained in:
@@ -667,7 +667,28 @@ command_sign_csr() {
|
|||||||
_exiterr "Could not read certificate signing request ${csrfile}"
|
_exiterr "Could not read certificate signing request ${csrfile}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sign_csr "$(< "${csrfile}" )"
|
# gen cert
|
||||||
|
certfile="$(_mktemp)"
|
||||||
|
sign_csr "$(< "${csrfile}" )" 3> "${certfile}"
|
||||||
|
|
||||||
|
# get and convert ca cert
|
||||||
|
chainfile="$(_mktemp)"
|
||||||
|
http_request get "$(openssl x509 -in "${certfile}" -noout -text | grep 'CA Issuers - URI:' | cut -d':' -f2-)" > "${chainfile}"
|
||||||
|
|
||||||
|
if ! grep -q "BEGIN CERTIFICATE" "${chainfile}"; then
|
||||||
|
openssl x509 -inform DER -in "${chainfile}" -outform PEM -out "${chainfile}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# output full chain
|
||||||
|
echo "# CERT #" >&3
|
||||||
|
cat "${certfile}" >&3
|
||||||
|
echo >&3
|
||||||
|
echo "# CHAIN #" >&3
|
||||||
|
cat "${chainfile}" >&3
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm "${certfile}"
|
||||||
|
rm "${chainfile}"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user