From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Henry Kleynhans <henry.kleynhans@gmail.com>,
qemu-devel@nongnu.org,
"Daniel P . Berrange" <berrange@redhat.com>
Cc: Henry Kleynhans <hkleynhans@fb.com>, henry.kleynhans@fb.com
Subject: Re: [PATCH] Relax X509 CA cert sanity checking
Date: Tue, 14 Dec 2021 14:04:17 +0100 [thread overview]
Message-ID: <dfaa65b0-bc06-e8c4-2d09-4385c79d99a4@redhat.com> (raw)
In-Reply-To: <20211214113930.9205-1-henry.kleynhans@gmail.com>
Hi Henry,
Please Cc maintainers:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#cc-the-relevant-maintainer
(doing it for you now).
On 12/14/21 12:39, Henry Kleynhans wrote:
> From: Henry Kleynhans <hkleynhans@fb.com>
>
> The sanity checking function attempts to validate all the certificates
> in the provided CA file. These checks are performed on certificates
> which may or may not be part of the signing chain and duplicates checks
> that should be performed by the TLS library.
>
> In real life this causes a problem if the certificate chain I want to
> use is valid, but there exist another expired certificate in the CA
> file.
>
> This patch relaxes the sanity checks to only ensure we have at least one
> valid certificate in the CA certificate file and leave the actual
> validation to the TLS library.
Since nobody complained so far, should we add this change as a boolean
property such "allow-expired-ca-certificate", default to false?
> Signed-off-by: Henry Kleynhans <hkleynhans@fb.com>
> ---
> crypto/tlscredsx509.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c
> index 32948a6bdc..fb056f96a2 100644
> --- a/crypto/tlscredsx509.c
> +++ b/crypto/tlscredsx509.c
> @@ -473,6 +473,7 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
> gnutls_x509_crt_t cert = NULL;
> gnutls_x509_crt_t cacerts[MAX_CERTS];
> size_t ncacerts = 0;
> + size_t nvalidca = 0;
> size_t i;
> int ret = -1;
>
> @@ -505,11 +506,15 @@ qcrypto_tls_creds_x509_sanity_check(QCryptoTLSCredsX509 *creds,
> for (i = 0; i < ncacerts; i++) {
> if (qcrypto_tls_creds_check_cert(creds,
> cacerts[i], cacertFile,
> - isServer, true, errp) < 0) {
> - goto cleanup;
> + isServer, true, errp) == 0) {
> + ++nvalidca;
> }
> }
>
> + if (nvalidca == 0) {
> + goto cleanup;
> + }
> +
> if (cert && ncacerts &&
> qcrypto_tls_creds_check_cert_pair(cert, certFile, cacerts,
> ncacerts, cacertFile,
>
next prev parent reply other threads:[~2021-12-14 13:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 11:39 [PATCH] Relax X509 CA cert sanity checking Henry Kleynhans
2021-12-14 13:04 ` Philippe Mathieu-Daudé [this message]
2021-12-14 13:16 ` Daniel P. Berrangé
2021-12-14 14:55 ` Henry Kleynhans
2021-12-14 15:00 ` Daniel P. Berrangé
-- strict thread matches above, loose matches on Subject: below --
2021-12-14 10:03 Henry Kleynhans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfaa65b0-bc06-e8c4-2d09-4385c79d99a4@redhat.com \
--to=philmd@redhat.com \
--cc=berrange@redhat.com \
--cc=henry.kleynhans@fb.com \
--cc=henry.kleynhans@gmail.com \
--cc=hkleynhans@fb.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.