mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-18 19:40:57 +00:00
Mark the test root CA as a CA explicitly instead of picking a cert version by openssl version (#2681)
gen-certs.sh and test/CMakeLists.txt chose between -x509v1 and -x509 by the openssl version. When the default openssl changed (macOS runner image 20261112), the root was generated as v3 without basicConstraints, openssl rejected it as 'invalid CA certificate', and every client certificate test failed. Add basicConstraints CA:TRUE to test.rootCA.conf, drop the version branching, and verify the client certs against the root in gen-certs.sh.
This commit is contained in:
1 parent
748dbfade6
commit
eb364f1167
3 files changed
+13
-14
No files matched your search
+5
-7
@@ -1,15 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
if [[ $(openssl version) =~ 3\.[2-9]\.[0-9]+ ]]; then
|
||||
OPENSSL_X509_FLAG='-x509v1'
|
||||
else
|
||||
OPENSSL_X509_FLAG='-x509'
|
||||
fi
|
||||
|
||||
openssl genrsa 2048 > key.pem
|
||||
openssl req -new -batch -config test.conf -key key.pem | openssl x509 -days 3650 -req -signkey key.pem > cert.pem
|
||||
openssl req -x509 -config test.conf -key key.pem -sha256 -days 3650 -nodes -out cert2.pem -extensions SAN
|
||||
openssl genrsa 2048 > rootCA.key.pem
|
||||
openssl req $OPENSSL_X509_FLAG -new -batch -config test.rootCA.conf -key rootCA.key.pem -days 1024 > rootCA.cert.pem
|
||||
openssl req -x509 -new -batch -config test.rootCA.conf -key rootCA.key.pem -days 1024 > rootCA.cert.pem
|
||||
openssl genrsa 2048 > client.key.pem
|
||||
openssl req -new -batch -config test.conf -key client.key.pem | openssl x509 -days 370 -req -CA rootCA.cert.pem -CAkey rootCA.key.pem -CAcreateserial > client.cert.pem
|
||||
openssl genrsa -passout pass:test123! 2048 > key_encrypted.pem
|
||||
@@ -47,3 +41,7 @@ openssl req -x509 -key key.pem -sha256 -days 3650 -nodes -subj "/CN=localhost" -
|
||||
# "*.leftmost.example.test" matches a single label; the
|
||||
# wildcard in "www.*.example.test" must not be honoured.
|
||||
openssl req -x509 -key key.pem -sha256 -days 3650 -nodes -subj "/CN=wildcard-san" -addext "subjectAltName=DNS:*.leftmost.example.test,DNS:www.*.example.test" -out cert_wildcard_san.pem
|
||||
|
||||
# The client certs must chain to a root that openssl accepts as a CA; a root
|
||||
# without basicConstraints CA:TRUE makes every client-cert test fail.
|
||||
openssl verify -CAfile rootCA.cert.pem client.cert.pem client_encrypted.cert.pem
|
||||
Reference in new issue
Block a user