diff --git a/check_email_delivery b/check_email_delivery index 9338988..2c293a9 100755 --- a/check_email_delivery +++ b/check_email_delivery @@ -38,6 +38,7 @@ my $username = ""; my $password = ""; my $ssl = ""; my $imap_ssl = ""; +my $imap_ssl_verify = 1; my $mailto = ""; my $mailfrom = ""; my @header = (); @@ -93,6 +94,7 @@ $ok = Getopt::Long::GetOptions( "imap-mailbox=s"=>\$imap_mailbox, "imap-check-interval=i"=>\$imap_interval,"imap-retries=i"=>\$imap_retries, "imapssl!"=>\$imap_ssl, + "imapsslverify!"=>\$imap_ssl_verify, # Time "hires"=>\$time_hires, ); @@ -201,6 +203,7 @@ $imap_options .= "-U ".shellquote($imap_username)." " if defined $imap_username $imap_options .= "-P ".shellquote($imap_password)." " if defined $imap_password and $imap_password ne ""; $imap_options .= "--mailbox ".shellquote($imap_mailbox)." " if defined $imap_mailbox and $imap_mailbox ne ""; $imap_options .= "--ssl " if defined $imap_ssl and $imap_ssl; +$imap_options .= "--no-verify-ssl " if defined $imap_ssl_verify and !$imap_ssl_verify; # create the report object @@ -693,6 +696,13 @@ Use this to enable or disable SSL for the IMAP plugin. This argument is shell-escaped; special characters or angle brackets around the address are ok. +=item --imapsslverify +=item --noimapsslverify + +Use this to enable or disable SSL verfiy for the IMAP plugin. + +This argument is shell-escaped; special characters or angle brackets around the address are ok. + =item --smtptls =item --nosmtptls diff --git a/check_imap_receive b/check_imap_receive index b2009ca..191e2f1 100755 --- a/check_imap_receive +++ b/check_imap_receive @@ -51,6 +51,7 @@ my $template = ""; my $ssl = 0; my $ssl_ca_file = ""; my $tls = 0; +my $verify_ssl = 1; my $time_hires = ""; my $ok; $ok = Getopt::Long::GetOptions( @@ -62,6 +63,7 @@ $ok = Getopt::Long::GetOptions( "U|username=s"=>\$username,"P|password=s"=>\$password, "m|mailbox=s"=>\$mailbox, "imap-check-interval=i"=>\$interval,"imap-retries=i"=>\$max_retries, "ssl!"=>\$ssl, "ssl-ca-file=s"=>\$ssl_ca_file, "tls!"=>\$tls, + "verify-ssl!"=>\$verify_ssl, # search settings "s|search=s"=>\@search, "search-critical-min=i"=>\$search_critical_min, "search-critical-max=i"=>\$search_critical_max, @@ -135,6 +137,8 @@ eval { $ssl_args{SSL_ca_file} = $ssl_ca_file; $ssl_args{SSL_verifycn_scheme} = 'imap'; $ssl_args{SSL_verifycn_name} = $imap_server; + } elsif ( !$verify_ssl ) { + $ssl_args{SSL_verify_mode} = 0; } my $socket = IO::Socket::SSL->new(PeerAddr=>"$imap_server:$imap_port", %ssl_args); die IO::Socket::SSL::errstr() . " (if you get this only when using both --ssl and --ssl-ca-file, but not when using just --ssl, the server SSL certificate failed validation)" unless $socket; @@ -700,6 +704,12 @@ override this from the command line using the --port option. Use the nossl option to turn off the ssl option. +=item --verifyssl + +=item --noverifyssl + +Enable SSL verfiy when connecting to imap server. + =item --ssl-ca-file Use this to verify the server SSL certificate against a local .pem file. You'll need to