From c1cfa766f29016fe79b91b28fa63286811720a46 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 31 Jul 2018 10:09:56 +0200 Subject: [PATCH] Generate subject alt name in local certificate. Closes gh-274. --- src/test/bash/create_certificates.sh | 4 +++- src/test/bash/openssl.cnf | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/test/bash/create_certificates.sh b/src/test/bash/create_certificates.sh index 103883d9..dddf2b69 100755 --- a/src/test/bash/create_certificates.sh +++ b/src/test/bash/create_certificates.sh @@ -66,7 +66,9 @@ chmod 400 ${CA_DIR}/private/localhost.key.pem chmod 400 ${CA_DIR}/private/localhost.decrypted.key.pem echo "[INFO] Generating server certificate request" -openssl req -config ${DIR}/openssl.cnf \ +openssl req -config <(cat ${DIR}/openssl.cnf \ + <(printf "\n[SAN]\nsubjectAltName=DNS:localhost,IP:127.0.0.1")) \ + -reqexts SAN \ -key ${CA_DIR}/private/localhost.key.pem \ -passin pass:changeit \ -new -sha256 -out ${CA_DIR}/csr/localhost.csr.pem \ diff --git a/src/test/bash/openssl.cnf b/src/test/bash/openssl.cnf index fdf9064d..721bd488 100644 --- a/src/test/bash/openssl.cnf +++ b/src/test/bash/openssl.cnf @@ -30,6 +30,7 @@ cert_opt = ca_default default_days = 375 preserve = no policy = policy_strict +copy_extensions = copy [ policy_strict ] # The root CA should only sign intermediate certificates that match. @@ -103,4 +104,4 @@ nsComment = "OpenSSL Generated Server Certificate" subjectKeyIdentifier = hash authorityKeyIdentifier = keyid,issuer:always keyUsage = critical, digitalSignature, keyEncipherment -extendedKeyUsage = serverAuth \ No newline at end of file +extendedKeyUsage = serverAuth