nbdkit_peer_tls_dn - Man Page

read the client TLS X.509 Distinguished Name

Synopsis

 #include <nbdkit-plugin.h>

 char *nbdkit_peer_tls_dn (void);
 char *nbdkit_peer_tls_issuer_dn (void);

Description

If all of these conditions are met:

then these APIs can be used to get the Distinguished Name (DN) of the certificate or the certificate's issuer.  The issuer is the Certificate Authority (CA) that issued the client certificate.

The DN is returned as a string of the form "CN=xx,O=yy,[...]C=zz" (see RFC 4514 for the exact format).

If the DN is not available, "" is returned (this is not an error).

nbdkit-ip-filter(1) can be used to filter client connections by the DN.

Example Certificate and Distinguished Name

Please see nbdkit-tls(1) for details of how to generate client certificates.  Following those instructions, if you were to generate a client certificate from this client.info input:

 country = US
 state = New York
 locality = New York
 organization = BigCo
 cn = client.example.com
 tls_www_client
 encryption_key
 signing_key

and sign it with this Certificate Authority ca.info:

 cn = BigCo
 ca
 cert_signing_key

then the client certificate DN would be:

 CN=client.example.com,O=BigCo,L=New York,ST=New York,C=US

and the issuer DN would be:

 CN=BigCo

Return Value

On success both of these functions return a TLS Distinguished Name as a string, or "".  The caller must free this string.

If there is an error they call nbdkit_error(3) and return NULL.

Language Bindings

In nbdkit-ocaml-plugin(3):

 NBDKit.peer_tls_dn : unit -> string
 NBDKit.peer_tls_issuer_dn : unit -> string

In nbdkit-python-plugin(3):

 import nbdkit
 dn = nbdkit.peer_tls_dn()
 dn = nbdkit.peer_tls_issuer_dn()

History

nbdkit_peer_tls_dn and nbdkit_peer_tls_issuer_dn were added in nbdkit 1.40.

See Also

nbdkit(1), nbdkit-plugin(3), nbdkit-filter(3), nbdkit-tls(1), nbdkit-ip-filter(1), nbdkit_is_tls(3), nbdkit_peer_name(3).

Authors

Richard W.M. Jones

License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Referenced By

nbdkit-ip-filter(1), nbdkit-plugin(3), nbdkit-python-plugin(3), nbdkit-release-notes-1.40(1), nbdkit-tls(1).

The man page nbdkit_peer_tls_issuer_dn(3) is an alias of nbdkit_peer_tls_dn(3).

2024-09-25 nbdkit-1.41.6