1UPSCLI_INIT(3)                    NUT Manual                    UPSCLI_INIT(3)
2
3
4

NAME

6       upscli_init - Initialize upsclient module specifying security
7       properties.
8

SYNOPSIS

10       #include <upsclient.h>
11
12       int upscli_init(int certverify, const char *certpath,
13                              const char *certname, const char *certpasswd);
14

DESCRIPTION

16       The upscli_init() function initialize upsclient module and set many
17       SSL-related properties: certverify to 1 makes certificate verification
18       required for all SSL connections and certpath is the location of
19       certificate database.
20
21       If compiled with OpenSSL, certpath refers to directory containing
22       certificates where the certificates must be named according to their
23       hash values ending in a ".0" extension. If two certificates result in
24       the same hash value (thus file name), the ".0" can be incremented to
25       ".1" and so on, as needed. The bash command for creating links in this
26       manner would be:
27
28           ln -s ca.pem ./$(openssl x509 -hash -noout -in ca.pem).0
29
30       Alternatively, the c_rehash utility (provided by openssl-perl) can take
31       a directory and iterate it to link all certificates found in that
32       directory, in the manner described above.
33
34       If compiled with NSS, certpath refers to a directory containing
35       database files.
36
37       If compiled with NSS and using SSL, you can specify certname the name
38       of the certificate to send to upsd and certpasswd the password used to
39       decrypt certificate private key.
40
41       You can call upscli_add_host_cert(3) to register specific host security
42       policy before initialize connections to them.
43
44       You must call upscli_cleanup(3) when exiting application.
45

RETURN VALUE

47       The upscli_init() function returns 1 on success, or -1 if an error
48       occurs.
49

SEE ALSO

51       upscli_add_host_cert(3), upscli_cleanup(3), upscli_disconnect(3),
52       upscli_fd(3), upscli_splitaddr(3), upscli_splitname(3), upscli_ssl(3),
53       upscli_strerror(3), upscli_upserror(3)
54
55
56
57Network UPS Tools 2.8.0           04/26/2022                    UPSCLI_INIT(3)
Impressum