tls: fix incomplete mTLS config in conn reuse and session cache

cert_type, key, key_type, key_passwd and key_blob lived in
ssl_config_data but not in ssl_primary_config, so they were invisible to
match_ssl_primary_config() and to the TLS session cache peer key.

Two easy handles sharing a connection pool could reuse each other's
authenticated connections when they differed only on SSLKEY, SSLKEYTYPE,
KEYPASSWD, SSLCERTTYPE or SSLKEYBLOB. The second handle would silently
inherit the first handle's authenticated identity.

Promote all five fields into ssl_primary_config so the conn-reuse
predicate and session cache key cover the complete client credential
set. Also replace the fixed ":CCERT" session cache marker with the
actual clientcert path so sessions are not shared across different
client certificates.

Verified by test 3303 and 3304

Reported-By: Joshua Rogers (AISLE Research)
Closes #21667
This commit is contained in:
Joshua Rogers 2026-05-19 11:47:50 +02:00 committed by Daniel Stenberg
parent a4dca608e1
commit 7541ae569d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
19 changed files with 512 additions and 81 deletions

View file

@ -287,7 +287,7 @@ test3200 test3201 test3202 test3203 test3204 test3205 test3206 test3207 \
test3208 test3209 test3210 test3211 test3212 test3213 test3214 test3215 \
test3216 test3217 test3218 test3219 test3220 \
\
test3300 test3301 test3302 \
test3300 test3301 test3302 test3303 test3304 \
\
test4000 test4001

20
tests/data/test3303 Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
unittest
TLS
mTLS
</keywords>
</info>
# Client-side
<client>
<features>
unittest
</features>
<name>
conn-reuse match distinguishes mTLS key, cert_type, key_type and key_passwd fields
</name>
</client>
</testcase>

20
tests/data/test3304 Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
unittest
TLS
mTLS
</keywords>
</info>
# Client-side
<client>
<features>
unittest
</features>
<name>
TLS session cache peer key discriminates on mTLS key, key_type and cert_type fields
</name>
</client>
</testcase>