summaryrefslogtreecommitdiffstats
path: root/plugins/sslutils.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2023-02-04 16:19:46 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2023-02-04 16:19:46 +0100
commit6f0ce3804a396ce89c09f50123e5f31b5b525b31 (patch)
treec1657f9d9d2d8fa5d4f1de6bb966501cbc86e3ac /plugins/sslutils.c
parentfc8a233854c0d59cf637e982b84c836920d718bd (diff)
downloadmonitoring-plugins-6f0ce38.tar.gz
fallback to SSL_CTX_use_certificate_file for gnutls
Diffstat (limited to 'plugins/sslutils.c')
-rw-r--r--plugins/sslutils.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index 286273f6..d542c499 100644
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
@@ -134,7 +134,18 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int
134 return STATE_CRITICAL; 134 return STATE_CRITICAL;
135 } 135 }
136 if (cert && privkey) { 136 if (cert && privkey) {
137 SSL_CTX_use_certificate_chain_file(c, cert); 137#ifdef USE_OPENSSL
138 if (!SSL_CTX_use_certificate_chain_file(c, cert)) {
139#else
140#if USE_GNUTLS
141 if (!SSL_CTX_use_certificate_file(c, cert, SSL_FILETYPE_PEM)) {
142#else
143#error Unported for unknown SSL library
144#endif
145#endif
146 printf ("%s\n", _("CRITICAL - Unable to open certificate chain file!\n"));
147 return STATE_CRITICAL;
148 }
138 SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM); 149 SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM);
139#ifdef USE_OPENSSL 150#ifdef USE_OPENSSL
140 if (!SSL_CTX_check_private_key(c)) { 151 if (!SSL_CTX_check_private_key(c)) {