From 3ece41a4245936ad8773c5ac68c62f7fcb1e3987 Mon Sep 17 00:00:00 2001 From: Colin Gagnaire Date: Thu, 3 Jan 2019 15:06:55 +0100 Subject: [PATCH] enh protocols x509 certificate mode --- apps/protocols/x509/mode/certificate.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/protocols/x509/mode/certificate.pm b/apps/protocols/x509/mode/certificate.pm index f563eff43..fe4163da3 100644 --- a/apps/protocols/x509/mode/certificate.pm +++ b/apps/protocols/x509/mode/certificate.pm @@ -109,6 +109,7 @@ sub new { "port:s" => { name => 'port' }, "servername:s" => { name => 'servername' }, "ssl-opt:s@" => { name => 'ssl_opt' }, + "timeout:s" => { name => 'timeout', default => '3' }, "warning-status:s" => { name => 'warning_status', default => '%{expiration} < 60' }, "critical-status:s" => { name => 'critical_status', default => '%{expiration} < 30' }, }); @@ -169,7 +170,8 @@ sub manage_selection { $socket = IO::Socket::SSL->new( PeerHost => $self->{option_results}->{hostname}, PeerPort => $self->{option_results}->{port}, - $self->{option_results}->{servername} ? ( SSL_hostname => $self->{option_results}->{servername} ):(), + $self->{option_results}->{servername} ? ( SSL_hostname => $self->{option_results}->{servername} ) : '', + $self->{option_results}->{timeout} ? ( Timeout => $self->{option_results}->{timeout} ) : '', ); }; if ($@) { @@ -252,6 +254,10 @@ Do not verify certificate: --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE" Verify certificate: --ssl-opt="SSL_verify_mode => SSL_VERIFY_PEER" --ssl-opt="SSL_version => TLSv1" +=item B<--timeout> + +Set timeout in seconds for SSL connection (Default: '3') (only with IO::Socket::SSL >= 1.984). + =item B<--warning-status> Set warning threshold for status. (Default: '%{expiration} < 60').