NaviServer Programmable Web Server

ns_certctl(n)

NaviServer Built-in Commands – 5.1.0


[ Main Table Of Contents | Table Of Contents | Keyword Index ]

Name

ns_certctl - ADP control command

Table Of Contents

Synopsis

Description

This command is used for managing (server) certificates loaded into NaviServer.

COMMANDS

ns_certctl info cert

Return information about an X.509 certificate.

The argument cert specifies the certificate and can be either:

  • the name of a file containing a PEM-encoded certificate, or

  • a string containing the PEM-encoded certificate itself.

The command returns a Tcl dictionary with information extracted from the certificate. The returned fields include:

subject

Textual representation of the certificate subject distinguished name.

issuer

Textual representation of the issuer distinguished name.

serial

Serial number of the certificate (hex-encoded).

notbefore

Start of the certificate validity period.

notafter

End of the certificate validity period.

fingerprint

SHA-256 fingerprint of the certificate (hex-encoded).

san

Dictionary containing subjectAltName entries, when present. Possible keys include:

  • dns - list of DNS names

  • email - list of email addresses

  • uri - list of URIs (e.g., SPIFFE IDs)

  • ip - list of IP addresses

The values of notbefore and notafter are formatted using OpenSSL and can be parsed via Tcl's clock scan.

 set info [ns_certctl info /path/to/cert.pem]
 set days [expr {
     ([clock scan [dict get $info notafter]] - [clock seconds]) / 86400.0
 }]

In contrast to ns_conn clientcert, this command operates on static certificate data and does not include connection-specific fields such as present or verified.

ns_certctl list

List the loaded certificates and their expiry dates.

ns_certctl reload

Reload the used certificates from the disk. This is e.g. needed, when expired certificates are renewed and should be loaded into a running NaviServer instance.

See Also

ns_conn

Keywords

HTTPS, TLS, certificate, server built-in