diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-04 23:28:35 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-04 23:28:35 +0200 |
commit | f43083c6a9d5d9e66d42e7cd0b698b7eb1ecf822 (patch) | |
tree | 51a749e312bd74ffae30f9b2da0bc891350a7299 /plugins/check_http.c | |
parent | a9b02e7affe6d940e1fb4830156d06e4d816458b (diff) | |
download | monitoring-plugins-f43083c6a9d5d9e66d42e7cd0b698b7eb1ecf822.tar.gz |
check_http: Allow for requesting TLSv1.1/TLSv1.2
check_http's -S/--ssl option now allows for requesting the TLSv1.1 and
TLSv1.2 protocols. Apart from that, a '+' suffix can be appended in
oder to also accept newer protocols than the specified version.
Closes #1338, and closes #1354, and closes #1359.
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 51679975..b1a69e55 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -343,9 +343,20 @@ process_arguments (int argc, char **argv) | |||
343 | parameters, like -S and -C combinations */ | 343 | parameters, like -S and -C combinations */ |
344 | use_ssl = TRUE; | 344 | use_ssl = TRUE; |
345 | if (c=='S' && optarg != NULL) { | 345 | if (c=='S' && optarg != NULL) { |
346 | ssl_version = atoi(optarg); | 346 | int got_plus = strchr(optarg, '+') != NULL; |
347 | if (ssl_version < 1 || ssl_version > 3) | 347 | |
348 | usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)")); | 348 | if (!strncmp (optarg, "1.2", 3)) |
349 | ssl_version = got_plus ? MP_TLSv1_2_OR_NEWER : MP_TLSv1_2; | ||
350 | else if (!strncmp (optarg, "1.1", 3)) | ||
351 | ssl_version = got_plus ? MP_TLSv1_1_OR_NEWER : MP_TLSv1_1; | ||
352 | else if (optarg[0] == '1') | ||
353 | ssl_version = got_plus ? MP_TLSv1_OR_NEWER : MP_TLSv1; | ||
354 | else if (optarg[0] == '3') | ||
355 | ssl_version = got_plus ? MP_SSLv3_OR_NEWER : MP_SSLv3; | ||
356 | else if (optarg[0] == '2') | ||
357 | ssl_version = got_plus ? MP_SSLv2_OR_NEWER : MP_SSLv2; | ||
358 | else | ||
359 | usage4 (_("Invalid option - Valid SSL/TLS versions: 2, 3, 1, 1.1, 1.2 (with optional '+' suffix)")); | ||
349 | } | 360 | } |
350 | if (specify_port == FALSE) | 361 | if (specify_port == FALSE) |
351 | server_port = HTTPS_PORT; | 362 | server_port = HTTPS_PORT; |
@@ -1467,9 +1478,10 @@ print_help (void) | |||
1467 | printf (UT_IPv46); | 1478 | printf (UT_IPv46); |
1468 | 1479 | ||
1469 | #ifdef HAVE_SSL | 1480 | #ifdef HAVE_SSL |
1470 | printf (" %s\n", "-S, --ssl=VERSION"); | 1481 | printf (" %s\n", "-S, --ssl=VERSION[+]"); |
1471 | printf (" %s\n", _("Connect via SSL. Port defaults to 443. VERSION is optional, and prevents")); | 1482 | printf (" %s\n", _("Connect via SSL. Port defaults to 443. VERSION is optional, and prevents")); |
1472 | printf (" %s\n", _("auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).")); | 1483 | printf (" %s\n", _("auto-negotiation (2 = SSLv2, 3 = SSLv3, 1 = TLSv1, 1.1 = TLSv1.1,")); |
1484 | printf (" %s\n", _("1.2 = TLSv1.2). With a '+' suffix, newer versions are also accepted.")); | ||
1473 | printf (" %s\n", "--sni"); | 1485 | printf (" %s\n", "--sni"); |
1474 | printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); | 1486 | printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); |
1475 | printf (" %s\n", "-C, --certificate=INTEGER[,INTEGER]"); | 1487 | printf (" %s\n", "-C, --certificate=INTEGER[,INTEGER]"); |