Skip to content

Commit 5d712cf

Browse files
mrc0mmandbluca
authored andcommitted
test: make sure the dummy CA certificate is marked as such
With OpenSSL 3.2.0+ this is necessary, otherwise the verification of such CA certificate fails badly: $ openssl s_client -CAfile /run/systemd/remote-pki/ca.crt -connect localhost:19532 ... Connecting to ::1 CONNECTED(00000003) Can't use SSL_get_servername depth=1 C=CZ, L=Brno, O=Foo, OU=Bar, CN=Test CA verify error:num=79:invalid CA certificate verify return:1 depth=1 C=CZ, L=Brno, O=Foo, OU=Bar, CN=Test CA verify error:num=26:unsuitable certificate purpose verify return:1 ... --- SSL handshake has read 1566 bytes and written 409 bytes Verification error: unsuitable certificate purpose --- New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384 Server public key is 2048 bit This TLS version forbids renegotiation. Compression: NONE Expansion: NONE No ALPN negotiated Early data was not sent Verify return code: 26 (unsuitable certificate purpose) (cherry picked from commit 4e5984f) (cherry picked from commit 2ea5ddf)
1 parent 91ef703 commit 5d712cf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/units/testsuite-04.journal-remote.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ L = Brno
109109
O = Foo
110110
OU = Bar
111111
CN = Test CA
112+
113+
[ v3_ca ]
114+
subjectKeyIdentifier = hash
115+
authorityKeyIdentifier = keyid:always,issuer:always
116+
basicConstraints = CA:true
112117
EOF
113118
cat >/run/systemd/remote-pki/client.conf <<EOF
114119
[ req ]
@@ -136,9 +141,11 @@ CN = localhost
136141
EOF
137142
# Generate a dummy CA
138143
openssl req -x509 -nodes -newkey rsa:2048 -sha256 -days 7 \
144+
-extensions v3_ca \
139145
-config /run/systemd/remote-pki/ca.conf \
140146
-keyout /run/systemd/remote-pki/ca.key \
141147
-out /run/systemd/remote-pki/ca.crt
148+
openssl x509 -in /run/systemd/remote-pki/ca.crt -noout -text
142149
echo 01 >/run/systemd/remote-pki/ca.srl
143150
# Generate a client key and signing request
144151
openssl req -nodes -newkey rsa:2048 -sha256 \

0 commit comments

Comments
 (0)