diff --git a/plugins/check_http.c b/plugins/check_http.c index 516799759..a9f29e296 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -57,7 +57,7 @@ enum { #ifdef HAVE_SSL int check_cert = FALSE; -int ssl_version = 0; +double ssl_version = 0; int days_till_exp_warn, days_till_exp_crit; char *randbuff; X509 *server_cert; @@ -343,9 +343,17 @@ process_arguments (int argc, char **argv) parameters, like -S and -C combinations */ use_ssl = TRUE; if (c=='S' && optarg != NULL) { - ssl_version = atoi(optarg); + ssl_version = atof(optarg); if (ssl_version < 1 || ssl_version > 3) - usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)")); + usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 1.1 (TLSv1.1), 1.2 (TLSv1.2), 2 (SSLv2), or 3 (SSLv3)")); + if (ssl_version > 1 && ssl_version < 2) { + if (ssl_version == 1.1) + ssl_version = 4; + else if (ssl_version == 1.2) + ssl_version = 5; + else + usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 1.1 (TLSv1.1), 1.2 (TLSv1.2), 2 (SSLv2), or 3 (SSLv3)")); + } } if (specify_port == FALSE) server_port = HTTPS_PORT; @@ -1469,7 +1477,7 @@ print_help (void) #ifdef HAVE_SSL printf (" %s\n", "-S, --ssl=VERSION"); printf (" %s\n", _("Connect via SSL. Port defaults to 443. VERSION is optional, and prevents")); - printf (" %s\n", _("auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).")); + printf (" %s\n", _("auto-negotiation (1 = TLSv1, 1.1 = TLSv1.1, 1.2 = TLSv1.2, 2 = SSLv2, 3 = SSLv3.)")); printf (" %s\n", "--sni"); printf (" %s\n", _("Enable SSL/TLS hostname extension support (SNI)")); printf (" %s\n", "-C, --certificate=INTEGER[,INTEGER]"); diff --git a/plugins/sslutils.c b/plugins/sslutils.c index d0ae47418..cb9ebe42e 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c @@ -68,6 +68,12 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int case 3: /* SSLv3 protocol */ method = SSLv3_client_method(); break; + case 4: /* TLSv1.1 protocol */ + method = TLSv1_1_client_method(); + break; + case 5: /* TLSv1.2 protocol */ + method = TLSv1_2_client_method(); + break; default: /* Unsupported */ printf("%s\n", _("CRITICAL - Unsupported SSL protocol version.")); return STATE_CRITICAL;