diff options
-rw-r--r-- | plugins/Makefile.am | 23 | ||||
-rw-r--r-- | plugins/netutils.c | 127 | ||||
-rw-r--r-- | plugins/sslutils.c | 162 |
3 files changed, 175 insertions, 137 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index beefb32..9222771 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am | |||
@@ -24,13 +24,15 @@ EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | |||
24 | check_nagios check_by_ssh check_dns check_nt check_ide_smart \ | 24 | check_nagios check_by_ssh check_dns check_nt check_ide_smart \ |
25 | check_procs | 25 | check_procs |
26 | 26 | ||
27 | EXTRA_DIST = t utils.c netutils.c popen.c utils.h netutils.h popen.h common.h \ | 27 | EXTRA_DIST = t utils.c netutils.c sslutils.c popen.c utils.h netutils.h \ |
28 | getaddrinfo.c getaddrinfo.h gethostbyname.c gethostbyname.h | 28 | popen.h common.h getaddrinfo.c getaddrinfo.h \ |
29 | gethostbyname.c gethostbyname.h | ||
29 | 30 | ||
30 | PLUGINHDRS = common.h | 31 | PLUGINHDRS = common.h |
31 | 32 | ||
32 | BASEOBJS = utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a | 33 | BASEOBJS = utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a |
33 | NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS) | 34 | NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS) |
35 | SSLOBJS = sslutils.o | ||
34 | NETLIBS = $(NETOBJS) $(SOCKETLIBS) | 36 | NETLIBS = $(NETOBJS) $(SOCKETLIBS) |
35 | 37 | ||
36 | TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) | 38 | TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) |
@@ -51,7 +53,7 @@ check_dns_LDADD = $(NETLIBS) popen.o | |||
51 | check_dummy_LDADD = $(BASEOBJS) | 53 | check_dummy_LDADD = $(BASEOBJS) |
52 | check_fping_LDADD = $(NETLIBS) popen.o | 54 | check_fping_LDADD = $(NETLIBS) popen.o |
53 | check_game_LDADD = $(BASEOBJS) popen.o | 55 | check_game_LDADD = $(BASEOBJS) popen.o |
54 | check_http_LDADD = $(NETLIBS) | 56 | check_http_LDADD = $(SSLOBJS) $(NETLIBS) |
55 | check_hpjd_LDADD = $(NETLIBS) popen.o | 57 | check_hpjd_LDADD = $(NETLIBS) popen.o |
56 | check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) | 58 | check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) |
57 | check_load_LDADD = $(BASEOBJS) popen.o | 59 | check_load_LDADD = $(BASEOBJS) popen.o |
@@ -68,12 +70,12 @@ check_procs_LDADD = $(BASEOBJS) popen.o | |||
68 | check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) | 70 | check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) |
69 | check_real_LDADD = $(NETLIBS) | 71 | check_real_LDADD = $(NETLIBS) |
70 | check_snmp_LDADD = $(BASEOBJS) popen.o | 72 | check_snmp_LDADD = $(BASEOBJS) popen.o |
71 | check_smtp_LDADD = $(NETLIBS) | 73 | check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) |
72 | check_ssh_LDADD = $(NETLIBS) | 74 | check_ssh_LDADD = $(NETLIBS) |
73 | check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o | 75 | check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o |
74 | check_tcp_LDADD = $(NETLIBS) | 76 | check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) |
75 | check_time_LDADD = $(NETLIBS) | 77 | check_time_LDADD = $(NETLIBS) |
76 | check_udp_LDADD = $(NETLIBS) | 78 | check_udp_LDADD = $(SSLOBJS) $(NETLIBS) |
77 | check_ups_LDADD = $(NETLIBS) | 79 | check_ups_LDADD = $(NETLIBS) |
78 | check_users_LDADD = $(BASEOBJS) popen.o | 80 | check_users_LDADD = $(BASEOBJS) popen.o |
79 | check_by_ssh_LDADD = $(NETLIBS) popen.o | 81 | check_by_ssh_LDADD = $(NETLIBS) popen.o |
@@ -87,7 +89,7 @@ check_dns_DEPENDENCIES = check_dns.c $(NETOBJS) popen.o $(DEPLIBS) | |||
87 | check_dummy_DEPENDENCIES = check_dummy.c $(DEPLIBS) | 89 | check_dummy_DEPENDENCIES = check_dummy.c $(DEPLIBS) |
88 | check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) popen.o $(DEPLIBS) | 90 | check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) popen.o $(DEPLIBS) |
89 | check_game_DEPENDENCIES = check_game.c $(DEPLIBS) | 91 | check_game_DEPENDENCIES = check_game.c $(DEPLIBS) |
90 | check_http_DEPENDENCIES = check_http.c $(NETOBJS) $(DEPLIBS) | 92 | check_http_DEPENDENCIES = check_http.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) |
91 | check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS) | 93 | check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS) |
92 | check_ide_smart_DEPENDENCIES = check_ide_smart.c $(BASEOBJS) $(DEPLIBS) | 94 | check_ide_smart_DEPENDENCIES = check_ide_smart.c $(BASEOBJS) $(DEPLIBS) |
93 | check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS) | 95 | check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS) |
@@ -105,12 +107,12 @@ check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS) | |||
105 | check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS) | 107 | check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS) |
106 | check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS) | 108 | check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS) |
107 | check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS) | 109 | check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS) |
108 | check_smtp_DEPENDENCIES = check_smtp.c $(NETOBJS) $(DEPLIBS) | 110 | check_smtp_DEPENDENCIES = check_smtp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) |
109 | check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS) | 111 | check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS) |
110 | check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS) | 112 | check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS) |
111 | check_tcp_DEPENDENCIES = check_tcp.c $(NETOBJS) $(DEPLIBS) | 113 | check_tcp_DEPENDENCIES = check_tcp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) |
112 | check_time_DEPENDENCIES = check_time.c $(NETOBJS) $(DEPLIBS) | 114 | check_time_DEPENDENCIES = check_time.c $(NETOBJS) $(DEPLIBS) |
113 | check_udp_DEPENDENCIES = check_udp.c $(NETOBJS) $(DEPLIBS) | 115 | check_udp_DEPENDENCIES = check_udp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) |
114 | check_ups_DEPENDENCIES = check_ups.c $(NETOBJS) $(DEPLIBS) | 116 | check_ups_DEPENDENCIES = check_ups.c $(NETOBJS) $(DEPLIBS) |
115 | check_users_DEPENDENCIES = check_users.c $(BASEOBJS) popen.o $(DEPLIBS) | 117 | check_users_DEPENDENCIES = check_users.c $(BASEOBJS) popen.o $(DEPLIBS) |
116 | check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) popen.o $(DEPLIBS) | 118 | check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) popen.o $(DEPLIBS) |
@@ -125,6 +127,7 @@ popen.o: popen.c popen.h $(PLUGINHDRS) | |||
125 | utils.o: utils.c utils.h $(PLUGINHDRS) | 127 | utils.o: utils.c utils.h $(PLUGINHDRS) |
126 | 128 | ||
127 | netutils.o: netutils.c netutils.h $(PLUGINHDRS) | 129 | netutils.o: netutils.c netutils.h $(PLUGINHDRS) |
130 | sslutils.o: sslutils.c netutils.h $(PLUGINHDRS) | ||
128 | 131 | ||
129 | getaddrinfo.o: getaddrinfo.h $(PLUGINHDRS) | 132 | getaddrinfo.o: getaddrinfo.h $(PLUGINHDRS) |
130 | 133 | ||
diff --git a/plugins/netutils.c b/plugins/netutils.c index 2678f91..db64ef0 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -234,133 +234,6 @@ np_net_connect (const char *host_name, int port, int *sd, int proto) | |||
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | #ifdef HAVE_SSL | ||
238 | static SSL_CTX *c=NULL; | ||
239 | static SSL *s=NULL; | ||
240 | |||
241 | int np_net_ssl_init (int sd){ | ||
242 | SSL_METHOD *m=NULL; | ||
243 | /* Initialize SSL context */ | ||
244 | SSLeay_add_ssl_algorithms (); | ||
245 | m = SSLv23_client_method (); | ||
246 | SSL_load_error_strings (); | ||
247 | OpenSSL_add_all_algorithms(); | ||
248 | if ((c = SSL_CTX_new (m)) == NULL) { | ||
249 | printf (_("CRITICAL - Cannot create SSL context.\n")); | ||
250 | return STATE_CRITICAL; | ||
251 | } | ||
252 | if ((s = SSL_new (c)) != NULL){ | ||
253 | SSL_set_fd (s, sd); | ||
254 | if (SSL_connect(s) == 1){ | ||
255 | return OK; | ||
256 | } else { | ||
257 | printf (_("CRITICAL - Cannot make SSL connection ")); | ||
258 | #ifdef USE_OPENSSL /* XXX look into ERR_error_string */ | ||
259 | ERR_print_errors_fp (stdout); | ||
260 | #endif /* USE_OPENSSL */ | ||
261 | } | ||
262 | } else { | ||
263 | printf (_("CRITICAL - Cannot initiate SSL handshake.\n")); | ||
264 | } | ||
265 | return STATE_CRITICAL; | ||
266 | } | ||
267 | |||
268 | void np_net_ssl_cleanup (){ | ||
269 | if(s){ | ||
270 | SSL_shutdown (s); | ||
271 | SSL_free (s); | ||
272 | if(c) SSL_CTX_free (c); | ||
273 | } | ||
274 | } | ||
275 | |||
276 | int np_net_ssl_write(const void *buf, int num){ | ||
277 | return SSL_write(s, buf, num); | ||
278 | } | ||
279 | |||
280 | int np_net_ssl_read(void *buf, int num){ | ||
281 | return SSL_read(s, buf, num); | ||
282 | } | ||
283 | |||
284 | int np_net_ssl_check_cert(int days_till_exp){ | ||
285 | # ifdef USE_OPENSSL | ||
286 | X509 *certificate=NULL; | ||
287 | ASN1_STRING *tm; | ||
288 | int offset; | ||
289 | struct tm stamp; | ||
290 | int days_left; | ||
291 | char timestamp[17] = ""; | ||
292 | |||
293 | certificate=SSL_get_peer_certificate(s); | ||
294 | if(! certificate){ | ||
295 | printf (_("CRITICAL - Cannot retrieve server certificate.\n")); | ||
296 | return STATE_CRITICAL; | ||
297 | } | ||
298 | |||
299 | /* Retrieve timestamp of certificate */ | ||
300 | tm = X509_get_notAfter (certificate); | ||
301 | |||
302 | /* Generate tm structure to process timestamp */ | ||
303 | if (tm->type == V_ASN1_UTCTIME) { | ||
304 | if (tm->length < 10) { | ||
305 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | ||
306 | return STATE_CRITICAL; | ||
307 | } else { | ||
308 | stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | ||
309 | if (stamp.tm_year < 50) | ||
310 | stamp.tm_year += 100; | ||
311 | offset = 0; | ||
312 | } | ||
313 | } else { | ||
314 | if (tm->length < 12) { | ||
315 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | ||
316 | return STATE_CRITICAL; | ||
317 | } else { | ||
318 | stamp.tm_year = | ||
319 | (tm->data[0] - '0') * 1000 + (tm->data[1] - '0') * 100 + | ||
320 | (tm->data[2] - '0') * 10 + (tm->data[3] - '0'); | ||
321 | stamp.tm_year -= 1900; | ||
322 | offset = 2; | ||
323 | } | ||
324 | } | ||
325 | stamp.tm_mon = | ||
326 | (tm->data[2 + offset] - '0') * 10 + (tm->data[3 + offset] - '0') - 1; | ||
327 | stamp.tm_mday = | ||
328 | (tm->data[4 + offset] - '0') * 10 + (tm->data[5 + offset] - '0'); | ||
329 | stamp.tm_hour = | ||
330 | (tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0'); | ||
331 | stamp.tm_min = | ||
332 | (tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0'); | ||
333 | stamp.tm_sec = 0; | ||
334 | stamp.tm_isdst = -1; | ||
335 | |||
336 | days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
337 | snprintf | ||
338 | (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
339 | stamp.tm_mon + 1, | ||
340 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
341 | |||
342 | if (days_left > 0 && days_left <= days_till_exp) { | ||
343 | printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
344 | return STATE_WARNING; | ||
345 | } else if (days_left < 0) { | ||
346 | printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
347 | return STATE_CRITICAL; | ||
348 | } else if (days_left == 0) { | ||
349 | printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); | ||
350 | return STATE_WARNING; | ||
351 | } | ||
352 | |||
353 | printf (_("OK - Certificate will expire on %s.\n"), timestamp); | ||
354 | X509_free (certificate); | ||
355 | return STATE_OK; | ||
356 | # else /* ifndef USE_OPENSSL */ | ||
357 | printf (_("WARNING - Plugin does not support checking certificates.\n")); | ||
358 | return STATE_WARNING; | ||
359 | # endif /* USE_OPENSSL */ | ||
360 | } | ||
361 | |||
362 | #endif /* HAVE_SSL */ | ||
363 | |||
364 | int | 237 | int |
365 | send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int recv_size) | 238 | send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int recv_size) |
366 | { | 239 | { |
diff --git a/plugins/sslutils.c b/plugins/sslutils.c new file mode 100644 index 0000000..d785fb7 --- /dev/null +++ b/plugins/sslutils.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /**************************************************************************** | ||
2 | * | ||
3 | * Nagios plugins SSL utilities | ||
4 | * | ||
5 | * License: GPL | ||
6 | * Copyright (c) 2005 nagios-plugins team | ||
7 | * | ||
8 | * Last Modified: $Date$ | ||
9 | * | ||
10 | * Description: | ||
11 | * | ||
12 | * This file contains common functions for plugins that require SSL. | ||
13 | * | ||
14 | * License Information: | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License as published by | ||
18 | * the Free Software Foundation; either version 2 of the License, or | ||
19 | * (at your option) any later version. | ||
20 | * | ||
21 | * This program is distributed in the hope that it will be useful, | ||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
24 | * GNU General Public License for more details. | ||
25 | * | ||
26 | * You should have received a copy of the GNU General Public License | ||
27 | * along with this program; if not, write to the Free Software | ||
28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | * | ||
30 | * $Id$ | ||
31 | * | ||
32 | ****************************************************************************/ | ||
33 | |||
34 | #include "common.h" | ||
35 | #include "netutils.h" | ||
36 | |||
37 | #ifdef HAVE_SSL | ||
38 | static SSL_CTX *c=NULL; | ||
39 | static SSL *s=NULL; | ||
40 | |||
41 | int np_net_ssl_init (int sd){ | ||
42 | SSL_METHOD *m=NULL; | ||
43 | /* Initialize SSL context */ | ||
44 | SSLeay_add_ssl_algorithms (); | ||
45 | m = SSLv23_client_method (); | ||
46 | SSL_load_error_strings (); | ||
47 | OpenSSL_add_all_algorithms(); | ||
48 | if ((c = SSL_CTX_new (m)) == NULL) { | ||
49 | printf (_("CRITICAL - Cannot create SSL context.\n")); | ||
50 | return STATE_CRITICAL; | ||
51 | } | ||
52 | if ((s = SSL_new (c)) != NULL){ | ||
53 | SSL_set_fd (s, sd); | ||
54 | if (SSL_connect(s) == 1){ | ||
55 | return OK; | ||
56 | } else { | ||
57 | printf (_("CRITICAL - Cannot make SSL connection ")); | ||
58 | # ifdef USE_OPENSSL /* XXX look into ERR_error_string */ | ||
59 | ERR_print_errors_fp (stdout); | ||
60 | # endif /* USE_OPENSSL */ | ||
61 | } | ||
62 | } else { | ||
63 | printf (_("CRITICAL - Cannot initiate SSL handshake.\n")); | ||
64 | } | ||
65 | return STATE_CRITICAL; | ||
66 | } | ||
67 | |||
68 | void np_net_ssl_cleanup (){ | ||
69 | if(s){ | ||
70 | SSL_shutdown (s); | ||
71 | SSL_free (s); | ||
72 | if(c) SSL_CTX_free (c); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | int np_net_ssl_write(const void *buf, int num){ | ||
77 | return SSL_write(s, buf, num); | ||
78 | } | ||
79 | |||
80 | int np_net_ssl_read(void *buf, int num){ | ||
81 | return SSL_read(s, buf, num); | ||
82 | } | ||
83 | |||
84 | int np_net_ssl_check_cert(int days_till_exp){ | ||
85 | # ifdef USE_OPENSSL | ||
86 | X509 *certificate=NULL; | ||
87 | ASN1_STRING *tm; | ||
88 | int offset; | ||
89 | struct tm stamp; | ||
90 | int days_left; | ||
91 | char timestamp[17] = ""; | ||
92 | |||
93 | certificate=SSL_get_peer_certificate(s); | ||
94 | if(! certificate){ | ||
95 | printf (_("CRITICAL - Cannot retrieve server certificate.\n")); | ||
96 | return STATE_CRITICAL; | ||
97 | } | ||
98 | |||
99 | /* Retrieve timestamp of certificate */ | ||
100 | tm = X509_get_notAfter (certificate); | ||
101 | |||
102 | /* Generate tm structure to process timestamp */ | ||
103 | if (tm->type == V_ASN1_UTCTIME) { | ||
104 | if (tm->length < 10) { | ||
105 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | ||
106 | return STATE_CRITICAL; | ||
107 | } else { | ||
108 | stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | ||
109 | if (stamp.tm_year < 50) | ||
110 | stamp.tm_year += 100; | ||
111 | offset = 0; | ||
112 | } | ||
113 | } else { | ||
114 | if (tm->length < 12) { | ||
115 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | ||
116 | return STATE_CRITICAL; | ||
117 | } else { | ||
118 | stamp.tm_year = | ||
119 | (tm->data[0] - '0') * 1000 + (tm->data[1] - '0') * 100 + | ||
120 | (tm->data[2] - '0') * 10 + (tm->data[3] - '0'); | ||
121 | stamp.tm_year -= 1900; | ||
122 | offset = 2; | ||
123 | } | ||
124 | } | ||
125 | stamp.tm_mon = | ||
126 | (tm->data[2 + offset] - '0') * 10 + (tm->data[3 + offset] - '0') - 1; | ||
127 | stamp.tm_mday = | ||
128 | (tm->data[4 + offset] - '0') * 10 + (tm->data[5 + offset] - '0'); | ||
129 | stamp.tm_hour = | ||
130 | (tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0'); | ||
131 | stamp.tm_min = | ||
132 | (tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0'); | ||
133 | stamp.tm_sec = 0; | ||
134 | stamp.tm_isdst = -1; | ||
135 | |||
136 | days_left = (mktime (&stamp) - time (NULL)) / 86400; | ||
137 | snprintf | ||
138 | (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | ||
139 | stamp.tm_mon + 1, | ||
140 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
141 | |||
142 | if (days_left > 0 && days_left <= days_till_exp) { | ||
143 | printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); | ||
144 | return STATE_WARNING; | ||
145 | } else if (days_left < 0) { | ||
146 | printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); | ||
147 | return STATE_CRITICAL; | ||
148 | } else if (days_left == 0) { | ||
149 | printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); | ||
150 | return STATE_WARNING; | ||
151 | } | ||
152 | |||
153 | printf (_("OK - Certificate will expire on %s.\n"), timestamp); | ||
154 | X509_free (certificate); | ||
155 | return STATE_OK; | ||
156 | # else /* ifndef USE_OPENSSL */ | ||
157 | printf (_("WARNING - Plugin does not support checking certificates.\n")); | ||
158 | return STATE_WARNING; | ||
159 | # endif /* USE_OPENSSL */ | ||
160 | } | ||
161 | |||
162 | #endif /* HAVE_SSL */ | ||