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:
- 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 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
NBDKit.peer_tls_dn : unit -> string NBDKit.peer_tls_issuer_dn : unit -> string
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
Copyright
Copyright Red Hat
License
Redistribution and use in source and binary forms, with or without modification, 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 notice, this list of conditions and the following disclaimer in the documentation 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 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).