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.
(cherry picked from commit
c52d69cc785c039c0b665a229350fff11cfeda13)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
a96a1ef0a48a9b5b3883346bb21c79b95fa653eb)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit
8c014f305e7fd6ad9123f38067262c457fbe488f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>