diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-09-15 01:58:07 +0200 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-09-15 01:58:07 +0200 |
commit | afa81204dc2f7cadb63c23aa47a0262dbf654139 (patch) | |
tree | ad95fd124805cfe231e258358f64f694985a6b0a /plugins | |
parent | f5f4a021a2760d553e3e4cdedd291eb815750369 (diff) | |
download | monitoring-plugins-afa81204dc2f7cadb63c23aa47a0262dbf654139.tar.gz |
check_curl: use new cert check function
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_curl.d/check_curl_helpers.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/check_curl.d/check_curl_helpers.c b/plugins/check_curl.d/check_curl_helpers.c index f0a4d265..ab43a1e1 100644 --- a/plugins/check_curl.d/check_curl_helpers.c +++ b/plugins/check_curl.d/check_curl_helpers.c | |||
@@ -134,10 +134,12 @@ check_curl_configure_curl(const check_curl_static_curl_config config, | |||
134 | _("Unable to lookup IP address for '%s': getaddrinfo returned %d - %s"), | 134 | _("Unable to lookup IP address for '%s': getaddrinfo returned %d - %s"), |
135 | working_state.server_address, res, gai_strerror(res)); | 135 | working_state.server_address, res, gai_strerror(res)); |
136 | } | 136 | } |
137 | |||
137 | snprintf(dnscache, DEFAULT_BUFFER_SIZE, "%s:%d:%s", working_state.host_name, | 138 | snprintf(dnscache, DEFAULT_BUFFER_SIZE, "%s:%d:%s", working_state.host_name, |
138 | working_state.serverPort, addrstr); | 139 | working_state.serverPort, addrstr); |
139 | result.curl_state.host = curl_slist_append(NULL, dnscache); | 140 | result.curl_state.host = curl_slist_append(NULL, dnscache); |
140 | curl_easy_setopt(result.curl_state.curl, CURLOPT_RESOLVE, result.curl_state.host); | 141 | curl_easy_setopt(result.curl_state.curl, CURLOPT_RESOLVE, result.curl_state.host); |
142 | |||
141 | if (verbose >= 1) { | 143 | if (verbose >= 1) { |
142 | printf("* curl CURLOPT_RESOLVE: %s\n", dnscache); | 144 | printf("* curl CURLOPT_RESOLVE: %s\n", dnscache); |
143 | } | 145 | } |
@@ -1155,7 +1157,7 @@ void test_file(char *path) { | |||
1155 | usage2(_("file does not exist or is not readable"), path); | 1157 | usage2(_("file does not exist or is not readable"), path); |
1156 | } | 1158 | } |
1157 | 1159 | ||
1158 | mp_subcheck np_net_ssl_check_certificate(X509 *certificate, int days_till_exp_warn, | 1160 | mp_subcheck mp_net_ssl_check_certificate(X509 *certificate, int days_till_exp_warn, |
1159 | int days_till_exp_crit); | 1161 | int days_till_exp_crit); |
1160 | 1162 | ||
1161 | mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_till_exp, | 1163 | mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_till_exp, |
@@ -1169,7 +1171,7 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_ | |||
1169 | /* check certificate with OpenSSL functions, curl has been built against OpenSSL | 1171 | /* check certificate with OpenSSL functions, curl has been built against OpenSSL |
1170 | * and we actually have OpenSSL in the monitoring tools | 1172 | * and we actually have OpenSSL in the monitoring tools |
1171 | */ | 1173 | */ |
1172 | return np_net_ssl_check_certificate(cert, warn_days_till_exp, crit_days_till_exp); | 1174 | return mp_net_ssl_check_certificate(cert, warn_days_till_exp, crit_days_till_exp); |
1173 | # else /* USE_OPENSSL */ | 1175 | # else /* USE_OPENSSL */ |
1174 | xasprintf(&result.output, "HTTP CRITICAL - Cannot retrieve certificates - OpenSSL " | 1176 | xasprintf(&result.output, "HTTP CRITICAL - Cannot retrieve certificates - OpenSSL " |
1175 | "callback used and not linked against OpenSSL\n"); | 1177 | "callback used and not linked against OpenSSL\n"); |
@@ -1227,7 +1229,7 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_ | |||
1227 | } | 1229 | } |
1228 | 1230 | ||
1229 | BIO_free(cert_BIO); | 1231 | BIO_free(cert_BIO); |
1230 | return np_net_ssl_check_certificate(cert, warn_days_till_exp, crit_days_till_exp); | 1232 | return mp_net_ssl_check_certificate(cert, warn_days_till_exp, crit_days_till_exp); |
1231 | # else /* USE_OPENSSL */ | 1233 | # else /* USE_OPENSSL */ |
1232 | /* We assume we don't have OpenSSL and np_net_ssl_check_certificate at our | 1234 | /* We assume we don't have OpenSSL and np_net_ssl_check_certificate at our |
1233 | * disposal, so we use the libcurl CURLINFO data | 1235 | * disposal, so we use the libcurl CURLINFO data |