]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Implement Windows CA template match for Crypto-API selector
authorHeiko Wundram <heiko.wundram@gehrkens.it>
Thu, 6 Jun 2024 10:34:41 +0000 (12:34 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 6 Jun 2024 11:19:17 +0000 (13:19 +0200)
commit13ee7f902f18e27b981f8e440facd2e6515c6c83
treed51a905b8ec55a38c862c192772c2221ca41b9ad
parentbf887c95e46c6892ac1f68be5559525f8d975530
Implement Windows CA template match for Crypto-API selector

The certificate selection process for the Crypto API certificates
is currently fixed to match on subject or identifier. Especially
if certificates that are used for OpenVPN are managed by a Windows CA,
it is appropriate to select the certificate to use by the template
that it is generated from, especially on domain-joined clients which
automatically acquire/renew the corresponding certificate.

The attached match implements the match on TMPL: with either a template
name (which is looked up through CryptFindOIDInfo) or by specifying the
OID of the template directly, which then is matched against the
corresponding X509 extensions specifying the template that the certificate
was generated from.

The logic requires to walk all certificates in the underlying store and
to match the certificate extensions directly. The hook which is
implemented in the certificate selection logic is generic to allow
other Crypto-API certificate matches to also be implemented at some
point in the future.

The logic to match the certificate template is taken from the
implementation in the .NET core runtime, see Pal.Windows/FindPal.cs in
in the implementation of System.Security.Cryptography.X509Certificates.

Change-Id: Ia2c3e4c5c83ecccce1618c43b489dbe811de5351
Signed-off-by: Heiko Wundram <heiko.wundram@gehrkens.it>
Signed-off-by: Hannes Domani <ssbssa@yahoo.de>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20240606103441.26598-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28726.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
doc/man-sections/windows-options.rst
src/openvpn/cryptoapi.c