Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
nbdkit_peer_tls_dn(3)		     NBDKIT		   nbdkit_peer_tls_dn(3)

NAME
     nbdkit_peer_tls_dn, nbdkit_peer_tls_issuer_dn - 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:

     *	 the client connects over TLS (see nbdkit-tls(1))

     *	 the TLS connection is using X.509 certificates

     *	 the client presents a client certificate

     *	 the nbdkit --tls-verify-peer option is used

     then these APIs can be used to get the Distinguished Name (DN) of the cer-
     tificate or the certificate's issuer.  The issuer is the Certificate Au-
     thority (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 certifi-
     cates.  Following those instructions, if you were to generate a client cer-
     tificate 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 nbd-
     kit 1.40.

SEE ALSO
     nbdkit(1), nbdkit-plugin(3), nbdkit-filter(3), nbdkit-tls(1), nbd-
     kit-ip-filter(1), nbdkit_is_tls(3), nbdkit_peer_name(3).

AUTHORS
     Richard W.M. Jones

COPYRIGHT
     Copyright Red Hat

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

     *	 Redistributions of source code must retain the above copyright notice,
	 this list of conditions and the following disclaimer.

     *	 Redistributions in binary form must reproduce the above copyright no-
	 tice, this list of conditions and the following disclaimer in the docu-
	 mentation and/or other materials provided with the distribution.

     *	 Neither the name of Red Hat nor the names of its contributors may be
	 used to endorse or promote products derived from this software without
	 specific prior written permission.

     THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EX-
     PRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS-
     CLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DI-
     RECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SER-
     VICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABIL-
     ITY, 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 DAM-
     AGE.

nbdkit-1.46.2			   2026-08-30		   nbdkit_peer_tls_dn(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=nbdkit_peer_tls_dn&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help