From 2d14c35db85fc547b1489b7500c0625c05e8463a Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sat, 15 May 2021 22:43:32 +0200 Subject: [PATCH] Add CA cert option --- check_json.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/check_json.pl b/check_json.pl index afc17d6..4b1a36a 100755 --- a/check_json.pl +++ b/check_json.pl @@ -18,6 +18,7 @@ my $np = Nagios::Plugin->new( . "[ -d|--divisor ] " . "[ -m|--metadata ] " . "[ -T|--contenttype ] " + . "[ --cacert ] " . "[ --client-cert ] " . "[ --private-key ] " . "[ --ignoressl ] " @@ -95,6 +96,12 @@ $np->add_arg( help => "-T, --contenttype application/json \n " . "Content-type accepted if different from application/json ", ); +$np->add_arg( + spec => 'cacert|C=s', + default => '', + help => "-T, --cacert /foo/ca.crt \n " + . "Ca certificate ", +); $np->add_arg( spec => 'client-cert|J=s', default => '', @@ -130,6 +137,9 @@ $ua->timeout($np->opts->timeout); if ($np->opts->ignoressl) { $ua->ssl_opts(verify_hostname => 0, SSL_verify_mode => 0x00); } +if ($np->opts->{'cacert'}) { + $ua->ssl_opts(SSL_ca_file => $np->opts->{'cacert'}); +} if ($np->opts->httpclientcert) { $ua->ssl_opts( SSL_cert_file => $np->opts->httpclientcert,