diff options
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | plugins/Makefile.am | 5 | ||||
-rw-r--r-- | plugins/check_by_ssh.c | 4 | ||||
-rw-r--r-- | plugins/check_game.c | 4 | ||||
-rw-r--r-- | plugins/check_http.c | 4 | ||||
-rw-r--r-- | plugins/check_ide_smart.c | 2 | ||||
-rw-r--r-- | plugins/check_ldap.c | 67 | ||||
-rw-r--r-- | plugins/check_snmp.c | 2 | ||||
-rw-r--r-- | plugins/check_tcp.c | 2 |
9 files changed, 79 insertions, 12 deletions
diff --git a/configure.in b/configure.in index 36f86051..65dc698a 100644 --- a/configure.in +++ b/configure.in | |||
@@ -204,6 +204,7 @@ if test "$ac_cv_lib_ldap_main" = "yes"; then | |||
204 | AC_SUBST(LDAPINCLUDE) | 204 | AC_SUBST(LDAPINCLUDE) |
205 | AC_CHECK_FUNCS(ldap_set_option) | 205 | AC_CHECK_FUNCS(ldap_set_option) |
206 | EXTRAS="$EXTRAS check_ldap" | 206 | EXTRAS="$EXTRAS check_ldap" |
207 | AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s) | ||
207 | else | 208 | else |
208 | AC_MSG_WARN([Skipping LDAP plugin]) | 209 | AC_MSG_WARN([Skipping LDAP plugin]) |
209 | AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).]) | 210 | AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).]) |
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index eb67e458..2c0a5c2d 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am | |||
@@ -140,8 +140,9 @@ $(check_tcp_programs): check_tcp | |||
140 | 140 | ||
141 | install-exec-hook: | 141 | install-exec-hook: |
142 | cd $(DESTDIR)$(libexecdir) && \ | 142 | cd $(DESTDIR)$(libexecdir) && \ |
143 | for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done | 143 | for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done ;\ |
144 | 144 | rm -f check_ldaps ; ln -s -f check_ldap check_ldaps | |
145 | |||
145 | clean-local: | 146 | clean-local: |
146 | rm -f $(check_tcp_programs) | 147 | rm -f $(check_tcp_programs) |
147 | 148 | ||
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index dd2230a0..f31c9c61 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -393,13 +393,13 @@ To use passive mode, provide multiple '-C' options, and provide\n\ | |||
393 | all of -O, -s, and -n options (servicelist order must match '-C'\n\ | 393 | all of -O, -s, and -n options (servicelist order must match '-C'\n\ |
394 | options)\n")); | 394 | options)\n")); |
395 | 395 | ||
396 | printf (_("\n\ | 396 | printf ("\n\ |
397 | $ check_by_ssh -H localhost -n lh -s c1:c2:c3 \\\n\ | 397 | $ check_by_ssh -H localhost -n lh -s c1:c2:c3 \\\n\ |
398 | -C uptime -C uptime -C uptime -O /tmp/foo\n\ | 398 | -C uptime -C uptime -C uptime -O /tmp/foo\n\ |
399 | $ cat /tmp/foo\n\ | 399 | $ cat /tmp/foo\n\ |
400 | [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days...\n\ | 400 | [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days...\n\ |
401 | [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days...\n\ | 401 | [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days...\n\ |
402 | [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days...\n")); | 402 | [1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days...\n"); |
403 | 403 | ||
404 | printf (_(UT_SUPPORT)); | 404 | printf (_(UT_SUPPORT)); |
405 | } | 405 | } |
diff --git a/plugins/check_game.c b/plugins/check_game.c index 9a6e53e7..6699c71d 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c | |||
@@ -300,9 +300,9 @@ print_help (void) | |||
300 | print_revision (progname, revision); | 300 | print_revision (progname, revision); |
301 | 301 | ||
302 | printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"); | 302 | printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"); |
303 | printf (_(COPYRIGHT), copyright, email); | 303 | printf (COPYRIGHT, copyright, email); |
304 | 304 | ||
305 | printf (_("This plugin tests game server connections with the specified host."), progname); | 305 | printf (_("This plugin tests game server connections with the specified host.")); |
306 | 306 | ||
307 | print_usage (); | 307 | print_usage (); |
308 | 308 | ||
diff --git a/plugins/check_http.c b/plugins/check_http.c index dd058219..5f96e31e 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -1490,11 +1490,11 @@ the certificate is expired.\n")); | |||
1490 | void | 1490 | void |
1491 | print_usage (void) | 1491 | print_usage (void) |
1492 | { | 1492 | { |
1493 | printf (_("\ | 1493 | printf ("\ |
1494 | Usage: %s -H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\ | 1494 | Usage: %s -H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\ |
1495 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ | 1495 | [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\ |
1496 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ | 1496 | [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\ |
1497 | [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ | 1497 | [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\ |
1498 | [-P string] [-m min_pg_size] [-4|-6] [-N] [-M <age>]\n\ | 1498 | [-P string] [-m min_pg_size] [-4|-6] [-N] [-M <age>]\n\ |
1499 | [-A string] [-k string]\n"), progname); | 1499 | [-A string] [-k string]\n", progname); |
1500 | } | 1500 | } |
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c index 1c0af310..644dc488 100644 --- a/plugins/check_ide_smart.c +++ b/plugins/check_ide_smart.c | |||
@@ -498,7 +498,7 @@ print_help () | |||
498 | printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n"); | 498 | printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n"); |
499 | printf (COPYRIGHT, copyright, email); | 499 | printf (COPYRIGHT, copyright, email); |
500 | 500 | ||
501 | printf (_("\ | 501 | printf ("\ |
502 | Usage: %s [DEVICE] [OPTION]\n\ | 502 | Usage: %s [DEVICE] [OPTION]\n\ |
503 | -d, --device=DEVICE\n\ | 503 | -d, --device=DEVICE\n\ |
504 | Select device DEVICE\n\ | 504 | Select device DEVICE\n\ |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index e77ad308..29bc01b2 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
@@ -57,6 +57,10 @@ double warn_time = UNDEFINED; | |||
57 | double crit_time = UNDEFINED; | 57 | double crit_time = UNDEFINED; |
58 | struct timeval tv; | 58 | struct timeval tv; |
59 | 59 | ||
60 | /* for ldap tls */ | ||
61 | |||
62 | char *SERVICE = "LDAP"; | ||
63 | |||
60 | int | 64 | int |
61 | main (int argc, char *argv[]) | 65 | main (int argc, char *argv[]) |
62 | { | 66 | { |
@@ -69,11 +73,20 @@ main (int argc, char *argv[]) | |||
69 | int status = STATE_UNKNOWN; | 73 | int status = STATE_UNKNOWN; |
70 | long microsec; | 74 | long microsec; |
71 | double elapsed_time; | 75 | double elapsed_time; |
76 | |||
77 | /* for ldap tls */ | ||
78 | |||
79 | int tls; | ||
80 | int version=3; | ||
72 | 81 | ||
73 | setlocale (LC_ALL, ""); | 82 | setlocale (LC_ALL, ""); |
74 | bindtextdomain (PACKAGE, LOCALEDIR); | 83 | bindtextdomain (PACKAGE, LOCALEDIR); |
75 | textdomain (PACKAGE); | 84 | textdomain (PACKAGE); |
76 | 85 | ||
86 | if (strstr(argv[0],"check_ldaps")) { | ||
87 | asprintf (&progname, "check_ldaps"); | ||
88 | } | ||
89 | |||
77 | if (process_arguments (argc, argv) == ERROR) | 90 | if (process_arguments (argc, argv) == ERROR) |
78 | usage4 (_("Could not parse arguments")); | 91 | usage4 (_("Could not parse arguments")); |
79 | 92 | ||
@@ -87,12 +100,19 @@ main (int argc, char *argv[]) | |||
87 | gettimeofday (&tv, NULL); | 100 | gettimeofday (&tv, NULL); |
88 | 101 | ||
89 | /* initialize ldap */ | 102 | /* initialize ldap */ |
103 | #ifdef HAVE_LDAP_INIT | ||
104 | if (!(ld = ldap_init (ld_host, ld_port))) { | ||
105 | printf ("Could not connect to the server at port %i\n", ld_port); | ||
106 | return STATE_CRITICAL; | ||
107 | } | ||
108 | #else | ||
90 | if (!(ld = ldap_open (ld_host, ld_port))) { | 109 | if (!(ld = ldap_open (ld_host, ld_port))) { |
91 | /*ldap_perror(ld, "ldap_open"); */ | 110 | /*ldap_perror(ld, "ldap_open"); */ |
92 | printf (_("Could not connect to the server at port %i\n"), ld_port); | 111 | printf (_("Could not connect to the server at port %i\n"), ld_port); |
93 | return STATE_CRITICAL; | 112 | return STATE_CRITICAL; |
94 | } | 113 | } |
95 | 114 | #endif /* HAVE_LDAP_INIT */ | |
115 | |||
96 | #ifdef HAVE_LDAP_SET_OPTION | 116 | #ifdef HAVE_LDAP_SET_OPTION |
97 | /* set ldap options */ | 117 | /* set ldap options */ |
98 | if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) != | 118 | if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) != |
@@ -101,6 +121,51 @@ main (int argc, char *argv[]) | |||
101 | return STATE_CRITICAL; | 121 | return STATE_CRITICAL; |
102 | } | 122 | } |
103 | #endif | 123 | #endif |
124 | |||
125 | if (strstr(argv[0],"check_ldaps")) { | ||
126 | /* with TLS */ | ||
127 | if ( ld_port == LDAPS_PORT ) { | ||
128 | asprintf (&SERVICE, "LDAPS"); | ||
129 | #if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS) | ||
130 | /* ldaps: set option tls */ | ||
131 | tls = LDAP_OPT_X_TLS_HARD; | ||
132 | |||
133 | if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS) | ||
134 | { | ||
135 | /*ldap_perror(ld, "ldaps_option"); */ | ||
136 | printf ("Could not init TLS at port %i!\n", ld_port); | ||
137 | return STATE_CRITICAL; | ||
138 | } | ||
139 | #else | ||
140 | printf ("TLS not supported by the libraries!\n", ld_port); | ||
141 | return STATE_CRITICAL; | ||
142 | #endif /* LDAP_OPT_X_TLS */ | ||
143 | } else { | ||
144 | asprintf (&SERVICE, "LDAP-TLS"); | ||
145 | #if defined(HAVE_LDAP_SET_OPTION) && defined(HAVE_LDAP_START_TLS_S) | ||
146 | /* ldap with startTLS: set option version */ | ||
147 | if (ldap_get_option(ld,LDAP_OPT_PROTOCOL_VERSION, &version) == LDAP_OPT_SUCCESS ) | ||
148 | { | ||
149 | if (version < LDAP_VERSION3) | ||
150 | { | ||
151 | version = LDAP_VERSION3; | ||
152 | ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version); | ||
153 | } | ||
154 | } | ||
155 | /* call start_tls */ | ||
156 | if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS) | ||
157 | { | ||
158 | /*ldap_perror(ld, "ldap_start_tls"); */ | ||
159 | printf ("Could not init startTLS at port %i!\n", ld_port); | ||
160 | return STATE_CRITICAL; | ||
161 | } | ||
162 | #else | ||
163 | printf ("startTLS not supported by the library, needs LDAPv3!\n"); | ||
164 | return STATE_CRITICAL; | ||
165 | #endif /* HAVE_LDAP_START_TLS_S */ | ||
166 | } | ||
167 | } | ||
168 | |||
104 | /* bind to the ldap server */ | 169 | /* bind to the ldap server */ |
105 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | 170 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != |
106 | LDAP_SUCCESS) { | 171 | LDAP_SUCCESS) { |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index ab110fbd..c1c4ea83 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -656,7 +656,7 @@ validate_arguments () | |||
656 | } | 656 | } |
657 | else if ( strcmp(seclevel, "authPriv") == 0 ) { | 657 | else if ( strcmp(seclevel, "authPriv") == 0 ) { |
658 | if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) { | 658 | if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) { |
659 | printf (("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd ); | 659 | printf (_("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd ); |
660 | print_usage (); | 660 | print_usage (); |
661 | exit (STATE_UNKNOWN); | 661 | exit (STATE_UNKNOWN); |
662 | } | 662 | } |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index ce57631a..7d8d8149 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -479,7 +479,7 @@ process_arguments (int argc, char **argv) | |||
479 | break; | 479 | break; |
480 | case 'H': /* hostname */ | 480 | case 'H': /* hostname */ |
481 | if (is_host (optarg) == FALSE) | 481 | if (is_host (optarg) == FALSE) |
482 | usage2 (_("invalid hostname/address"), optarg); | 482 | usage2 (_("Invalid hostname/address"), optarg); |
483 | server_address = optarg; | 483 | server_address = optarg; |
484 | break; | 484 | break; |
485 | case 'c': /* critical */ | 485 | case 'c': /* critical */ |