mirror of
https://github.com/c-kr/check_json.git
synced 2024-11-23 19:03:49 +01:00
Add client certificate support
This commit is contained in:
parent
2e8e519493
commit
36f30b8151
@ -18,6 +18,8 @@ my $np = Nagios::Plugin->new(
|
|||||||
. "[ -d|--divisor <divisor> ] "
|
. "[ -d|--divisor <divisor> ] "
|
||||||
. "[ -m|--metadata <content> ] "
|
. "[ -m|--metadata <content> ] "
|
||||||
. "[ -T|--contenttype <content-type> ] "
|
. "[ -T|--contenttype <content-type> ] "
|
||||||
|
. "[ --client-cert ] "
|
||||||
|
. "[ --private-key ] "
|
||||||
. "[ --ignoressl ] "
|
. "[ --ignoressl ] "
|
||||||
. "[ -h|--help ] ",
|
. "[ -h|--help ] ",
|
||||||
version => '0.5',
|
version => '0.5',
|
||||||
@ -93,6 +95,18 @@ $np->add_arg(
|
|||||||
help => "-T, --contenttype application/json \n "
|
help => "-T, --contenttype application/json \n "
|
||||||
. "Content-type accepted if different from application/json ",
|
. "Content-type accepted if different from application/json ",
|
||||||
);
|
);
|
||||||
|
$np->add_arg(
|
||||||
|
spec => 'client-cert|J=s',
|
||||||
|
default => '',
|
||||||
|
help => "-T, --httpclientcert /foo/bar.crt \n "
|
||||||
|
. "Client certificate ",
|
||||||
|
);
|
||||||
|
$np->add_arg(
|
||||||
|
spec => 'private-key|K=s',
|
||||||
|
default => '',
|
||||||
|
help => "-T, --httpprivatekey /foo/bar.key \n "
|
||||||
|
. "Client certificate keyfile",
|
||||||
|
);
|
||||||
|
|
||||||
$np->add_arg(
|
$np->add_arg(
|
||||||
spec => 'ignoressl',
|
spec => 'ignoressl',
|
||||||
@ -116,6 +130,13 @@ $ua->timeout($np->opts->timeout);
|
|||||||
if ($np->opts->ignoressl) {
|
if ($np->opts->ignoressl) {
|
||||||
$ua->ssl_opts(verify_hostname => 0, SSL_verify_mode => 0x00);
|
$ua->ssl_opts(verify_hostname => 0, SSL_verify_mode => 0x00);
|
||||||
}
|
}
|
||||||
|
if ($np->opts->httpclientcert) {
|
||||||
|
$ua->ssl_opts(
|
||||||
|
SSL_cert_file => $np->opts->httpclientcert,
|
||||||
|
SSL_key_file => $np->opts->httpprivatekey,
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ($np->opts->verbose) { (print Dumper ($ua))};
|
if ($np->opts->verbose) { (print Dumper ($ua))};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user