Skip to content

Commit a7a9d84

Browse files
ckujauawaw
authored andcommitted
Disable warning when reading CSRs from stdin.
Coming across the same warning that was reported in [PR#929](dehydrated-io#929 "Suppress openssl warning about reading from stdin") this is my attempt to disable this warning. Instead of discarding stderr in total (this can still be useful), we just use the "-in" parameter as hinted in the warning: $ foo=$(cat req.csr) $ <<<${foo} openssl req -noout -verify > /dev/null; echo $? Warning: Will read cert request from stdin since no -in option is given 0 $ <<<${foo} openssl req -in - -noout -verify > /dev/null; echo $? 0
1 parent 5052052 commit a7a9d84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dehydrated

+3-3
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,11 @@ signed_request() {
10111011
extract_altnames() {
10121012
csr="${1}" # the CSR itself (not a file)
10131013

1014-
if ! <<<"${csr}" "${OPENSSL}" req -verify -noout >/dev/null 2>&1; then
1014+
if ! <<<"${csr}" "${OPENSSL}" req -in - -verify -noout >/dev/null; then
10151015
_exiterr "Certificate signing request isn't valid"
10161016
fi
10171017

1018-
reqtext="$( <<<"${csr}" "${OPENSSL}" req -noout -text )"
1018+
reqtext="$( <<<"${csr}" "${OPENSSL}" req -in - -noout -text )"
10191019
if <<<"${reqtext}" grep -q '^[[:space:]]*X509v3 Subject Alternative Name:[[:space:]]*$'; then
10201020
# SANs used, extract these
10211021
altnames="$( <<<"${reqtext}" awk '/X509v3 Subject Alternative Name:/{print;getline;print;}' | tail -n1 )"
@@ -1268,7 +1268,7 @@ sign_csr() {
12681268

12691269
# Finally request certificate from the acme-server and store it in cert-${timestamp}.pem and link from cert.pem
12701270
echo " + Requesting certificate..."
1271-
csr64="$( <<<"${csr}" "${OPENSSL}" req -config "${OPENSSL_CNF}" -outform DER | urlbase64)"
1271+
csr64="$( <<<"${csr}" "${OPENSSL}" req -in - -config "${OPENSSL_CNF}" -outform DER | urlbase64)"
12721272
if [[ ${API} -eq 1 ]]; then
12731273
crt64="$(signed_request "${CA_NEW_CERT}" '{"resource": "new-cert", "csr": "'"${csr64}"'"}' | "${OPENSSL}" base64 -e)"
12741274
crt="$( printf -- '-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n' "${crt64}" )"

0 commit comments

Comments
 (0)