NAME

upscli_add_host_cert, upscli_add_host_port_cert - Register a security rule for a host.

SYNOPSIS

        #include <upsclient.h>

        void upscli_add_host_cert(
                const char* hostname,
                const char* certname,
                int certverify,
                int forcessl);

        void upscli_add_host_port_cert(
                const char* hostname,
                uint16_t port,
                const char* certname,
                int certverify,
                int forcessl)

DESCRIPTION

The upscli_add_host_cert() function registers a security rule associated to the hostname (may spell out a host:port in fact). The upscli_add_host_port_cert() function registers a security rule associated to the exact hostname and port number. If an entry with the same exact hostname and port values already exists, it is not replaced. All connections to this host use this rule.

The rule is composed of the certificate name certname expected for the host, certverify if the certificate must be validated for the host and forcessl if a secured connection must be used to connect to the host. For both of these integer values, 1 means required, 0 means not required, and -1 (the default) means use the global configuration.

Note

This call only functions if libupsclient has been compiled with NSS or OpenSSL support. If instead it was compiled without any SSL support, this method contains an empty definition and will take no action when called.

Prior to NUT v2.8.6 it was also not functional with OpenSSL builds.

Starting with NUT v2.8.5, you can use upscli_ssl_caps(3) from consumer code to query the library about its build circumstances (whether it supports SSL, and which backend(s) and certain features).

RETURN VALUE

upscli_add_host_cert() returns no value.

SEE ALSO