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.