]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: ssl: add ssl_c_policies sample fetch
authorJuan Pablo Mora <juan.mora.carbonell@gmail.com>
Thu, 6 Aug 2026 15:07:55 +0000 (17:07 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 10 Aug 2026 13:34:29 +0000 (15:34 +0200)
commite092ed7a6a80cadd6ddf2706724af685d1302cdc
tree99340732c82c1a21283e97e4f40ffb22decb37cc
parent0974583fe37f9ebe6a2826bced91dc1f81aa9bab
MINOR: ssl: add ssl_c_policies sample fetch

Until now there was no way in HAProxy to inspect the "Certificate
Policies" X509v3 extension of a client certificate presented during
mTLS client auth. This is needed to take routing/access decisions
based on the policy under which the certificate was issued, e.g. to
tell apart eIDAS qualified certificates whose private key is held in
a QSCD (policy OID 0.4.0.1862.1.4, id-etsi-qcp-legal-qscd) from other
client certificates.

This adds ssl_c_policies([<oid>]), following the same extraction
pattern already used by ssl_c_san (X509_get_ext_d2i() +
comma-separated list built in a trash chunk):

  - with no argument, it returns the full comma-separated list of
    policy OIDs (numeric dotted form) found in the certificate ;
  - with an <oid> argument, it only returns a sample when this
    specific OID is present among the certificate's policies, which
    allows using the "found" match method to take a decision, eg:

      acl qualified_qscd ssl_c_policies(0.4.0.1862.1.4) -m found
      http-request deny unless qualified_qscd

doc/configuration.txt is updated accordingly.

This is a pure addition, it does not touch any existing code path.
Built with -Wall -Wextra -Werror (no warnings) and validated against
doc/coding-style.txt's checkpatch.pl invocation: clean except for one
expected hit on the missing space in "ARG1(0,STR)", which matches the
pre-existing convention used by the other 22 entries of the same
sample_fetch_keywords table in this file.
doc/configuration.txt
include/haproxy/openssl-compat.h
src/ssl_sample.c