[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/18] crypto: mandate a hostname when checking x509 creds on a c
From: |
Daniel P . Berrangé |
Subject: |
[PATCH 06/18] crypto: mandate a hostname when checking x509 creds on a client |
Date: |
Wed, 2 Mar 2022 17:49:20 +0000 |
Currently the TLS session object assumes that the caller will always
provide a hostname when using x509 creds on a client endpoint. This
relies on the caller to detect and report an error if the user has
configured QEMU with x509 credentials on a UNIX socket. The migration
code has such a check, but it is too broad, reporting an error when
the user has configured QEMU with PSK credentials on a UNIX socket,
where hostnames are irrelevant.
Putting the check into the TLS session object credentials validation
code ensures we report errors in only the scenario that matters.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
crypto/tlssession.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/crypto/tlssession.c b/crypto/tlssession.c
index a8db8c76d1..b302d835d2 100644
--- a/crypto/tlssession.c
+++ b/crypto/tlssession.c
@@ -373,6 +373,12 @@ qcrypto_tls_session_check_certificate(QCryptoTLSSession
*session,
session->hostname);
goto error;
}
+ } else {
+ if (session->creds->endpoint ==
+ QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) {
+ error_setg(errp, "No hostname for certificate validation");
+ goto error;
+ }
}
}
--
2.34.1
- [PATCH 00/18] tests: introduce testing coverage for TLS with migration, Daniel P . Berrangé, 2022/03/02
- [PATCH 01/18] tests: fix encoding of IP addresses in x509 certs, Daniel P . Berrangé, 2022/03/02
- [PATCH 02/18] tests: improve error message when saving TLS PSK file fails, Daniel P . Berrangé, 2022/03/02
- [PATCH 03/18] tests: support QTEST_TRACE env variable, Daniel P . Berrangé, 2022/03/02
- [PATCH 05/18] tests: add more helper macros for creating TLS x509 certs, Daniel P . Berrangé, 2022/03/02
- [PATCH 06/18] crypto: mandate a hostname when checking x509 creds on a client,
Daniel P . Berrangé <=
- [PATCH 07/18] migration: fix use of TLS PSK credentials with a UNIX socket, Daniel P . Berrangé, 2022/03/02
- [PATCH 08/18] tests: merge code for UNIX and TCP migration pre-copy tests, Daniel P . Berrangé, 2022/03/02
- [PATCH 09/18] tests: introduce ability to provide hooks for migration precopy test, Daniel P . Berrangé, 2022/03/02
- [PATCH 10/18] tests: switch migration FD passing test to use common precopy helper, Daniel P . Berrangé, 2022/03/02