Skip to content

Commit aeec02b

Browse files
Stop requiring TLS 1.3 for ECDSA so curl HTTP/1.1 can handshake, and put the curl origin back on RSA TLS 1.2.
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 755aa17 commit aeec02b

2 files changed

Lines changed: 8 additions & 29 deletions

File tree

‎src/XrdTls/XrdTlsContext.cc‎

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -464,36 +464,20 @@ bool PkeyIsRsa(EVP_PKEY *pkey)
464464
;
465465
}
466466

467-
bool PkeyIsEc(EVP_PKEY *pkey)
468-
{
469-
if (!pkey)
470-
return false;
471-
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
472-
if (EVP_PKEY_is_a(pkey, "EC"))
473-
return true;
474-
#endif
475-
return EVP_PKEY_base_id(pkey) == EVP_PKEY_EC;
476-
}
477-
478467
// RHEL crypto-policies omit rsa_pss_rsae_* from the client's
479468
// signature_algorithms, so TLS 1.3 with an RSA host cert fails
480469
// tls_choose_sigalg. SSL_CTX_set1_sigalgs* aborts after HTTPS plugin
481-
// init. Cap RSA at TLS 1.2 (rsa_pkcs1). ECDSA hosts require TLS 1.3
482-
// so curl --http1.1 cannot fall back to a TLS 1.2 cipher mismatch.
470+
// init. Cap RSA at TLS 1.2 (rsa_pkcs1). Do not raise the floor for
471+
// ECDSA: curl --http1.1 on this platform still sends TLS 1.2.
483472
void LimitServerProtoByKey(SSL_CTX *ctx)
484473
{
485474
#ifdef TLS1_2_VERSION
486-
EVP_PKEY *pkey = ServerPkey(ctx);
487-
if (PkeyIsRsa(pkey)) {
475+
if (PkeyIsRsa(ServerPkey(ctx))) {
488476
SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION);
489477
#ifdef SSL_OP_NO_TLSv1_3
490478
SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1_3);
491479
#endif
492480
}
493-
#ifdef TLS1_3_VERSION
494-
else if (PkeyIsEc(pkey))
495-
SSL_CTX_set_min_proto_version(ctx, TLS1_3_VERSION);
496-
#endif
497481
#else
498482
(void)ctx;
499483
#endif
@@ -515,10 +499,6 @@ void LimitSessionProtoByKey(SSL *ssl)
515499
SSL_set_options(ssl, SSL_OP_NO_TLSv1_3);
516500
#endif
517501
}
518-
#ifdef TLS1_3_VERSION
519-
else if (PkeyIsEc(pkey))
520-
SSL_set_min_proto_version(ssl, TLS1_3_VERSION);
521-
#endif
522502
#else
523503
(void)ssl;
524504
#endif

‎tests/XrdClHttp/setup.sh‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ if ! "$OPENSSL_BIN" req -x509 -key tlscakey.pem -config tlsca.ini -out tlsca.pem
105105
exit 1
106106
fi
107107

108-
# ECDSA P-256 host cert: TLS 1.3 uses ecdsa_secp256r1_sha256 (works on
109-
# this RHEL policy). RSA host certs fail TLS 1.3 tls_choose_sigalg.
110-
# The server requires TLS 1.3 for EC keys so curl --http1.1 cannot
111-
# fall back to a TLS 1.2 cipher mismatch.
112-
"$OPENSSL_BIN" ecparam -name prime256v1 -genkey -noout -out tls.key
108+
# RSA host cert: curl --http1.1 on this platform speaks TLS 1.2.
109+
# The server caps RSA at TLS 1.2 so tls_choose_sigalg cannot fire.
110+
# httph2 keeps host-ec.pem for TLS 1.3 / HTTP/2.
111+
"$OPENSSL_BIN" genrsa -out tls.key 2048
113112
chmod 0400 tls.key
114113
if ! "$OPENSSL_BIN" req -new -key tls.key -config tlsca.ini -out tls.csr -outform PEM -subj /CN=localhost 0<&-; then
115114
echo "Failed to generate host certificate request"
@@ -427,7 +426,7 @@ echo "Origin started at port $ORIGIN_PORT"
427426
# Confirm origin is accepting HTTPS before starting the cache. If this
428427
# fails the cache Stat of https://127.0.0.1:9443 becomes connection-refused
429428
# and checksum tests hang dumping a growing log.
430-
if ! curl --http1.1 --tlsv1.3 --max-time 5 --cacert "$CA_DIR/tlsca.pem" \
429+
if ! curl --http1.1 --tls-max 1.2 --max-time 5 --cacert "$CA_DIR/tlsca.pem" \
431430
"https://localhost:${ORIGIN_PORT}/.well-known/openid-configuration" \
432431
-o /dev/null; then
433432
echo "Origin is not serving HTTPS on port ${ORIGIN_PORT}"

0 commit comments

Comments
 (0)