]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: ssl: ca-file directory mode must read every certificates of a file
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 26 Sep 2025 07:22:55 +0000 (09:22 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 26 Sep 2025 07:36:55 +0000 (09:36 +0200)
commitc52d69cc785c039c0b665a229350fff11cfeda13
treee83ca3d46a5820a1cfe2f23ded79f5a279c55a5e
parent230a0721027ba55cf9fea5d25f14c9bb590cc3f3
BUG/MEDIUM: ssl: ca-file directory mode must read every certificates of a file

The httpclient is configured with @system-ca by default, which uses the
directory returned by X509_get_default_cert_dir().

On debian/ubuntu systems, this directory contains multiple certificate
files that are loaded successfully. However it seems that on other
systems the files in this directory is the direct result of
ca-certificates instead of its source. Meaning that you would only have
a bundle file with every certificates in it.

The loading was not done correctly in case of directory loading, and was
only loading the first certificate of each file.

This patch fixes the issue by using X509_STORE_load_locations() on each
file from the scandir instead of trying to load it manually with BIO.

Not that we can't use X509_STORE_load_locations with the `dir` argument,
which would be simpler, because it uses X509_LOOKUP_hash_dir() which
requires a directory in hash form. That wouldn't be suited for this use
case.

Must be backported in every stable branches.

Fix issue #3137.
src/ssl_ckch.c