Merge pull request #94 from Shini31/https
Add key and root cert files options
This commit is contained in:
commit
8f8eab6884
|
@ -48,7 +48,7 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.1';
|
||||
$self->{version} = '1.2';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
|
@ -64,6 +64,8 @@ sub new {
|
|||
"timeout:s" => { name => 'timeout', default => '3' },
|
||||
"ssl:s" => { name => 'ssl', },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
"cacert-file:s" => { name => 'cacert_file' },
|
||||
"cert-pwd:s" => { name => 'cert_pwd' },
|
||||
"cert-pkcs12" => { name => 'cert_pkcs12' },
|
||||
});
|
||||
|
@ -175,6 +177,14 @@ Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
|||
|
||||
Specify certificate to send to the webserver
|
||||
|
||||
=item B<--key-file>
|
||||
|
||||
Specify key to send to the webserver
|
||||
|
||||
=item B<--cacert-file>
|
||||
|
||||
Specify root certificate to send to the webserver
|
||||
|
||||
=item B<--cert-pwd>
|
||||
|
||||
Specify certificate's password
|
||||
|
|
|
@ -51,7 +51,7 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.1';
|
||||
$self->{version} = '1.2';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"data:s" => { name => 'data' },
|
||||
|
@ -70,6 +70,8 @@ sub new {
|
|||
"timeout:s" => { name => 'timeout', default => 10 },
|
||||
"ssl:s" => { name => 'ssl', },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
"cacert-file:s" => { name => 'cacert_file' },
|
||||
"cert-pwd:s" => { name => 'cert_pwd' },
|
||||
"cert-pkcs12" => { name => 'cert_pkcs12' },
|
||||
|
||||
|
@ -454,6 +456,14 @@ Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
|||
|
||||
Specify certificate to send to the webserver
|
||||
|
||||
=item B<--key-file>
|
||||
|
||||
Specify key to send to the webserver
|
||||
|
||||
=item B<--cacert-file>
|
||||
|
||||
Specify root certificate to send to the webserver
|
||||
|
||||
=item B<--cert-pwd>
|
||||
|
||||
Specify certificate's password
|
||||
|
|
|
@ -53,22 +53,24 @@ sub new {
|
|||
$self->{version} = '1.1';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"port:s" => { name => 'port', },
|
||||
"proto:s" => { name => 'proto', default => "http" },
|
||||
"urlpath:s" => { name => 'url_path', default => "/" },
|
||||
"credentials" => { name => 'credentials' },
|
||||
"ntlm" => { name => 'ntlm' },
|
||||
"username:s" => { name => 'username' },
|
||||
"password:s" => { name => 'password' },
|
||||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
"warning:s" => { name => 'warning' },
|
||||
"critical:s" => { name => 'critical' },
|
||||
"timeout:s" => { name => 'timeout', default => '3' },
|
||||
"ssl:s" => { name => 'ssl', },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"cert-pwd:s" => { name => 'cert_pwd' },
|
||||
"cert-pkcs12" => { name => 'cert_pkcs12' },
|
||||
"hostname:s" => { name => 'hostname' },
|
||||
"port:s" => { name => 'port', },
|
||||
"proto:s" => { name => 'proto', default => "http" },
|
||||
"urlpath:s" => { name => 'url_path', default => "/" },
|
||||
"credentials" => { name => 'credentials' },
|
||||
"ntlm" => { name => 'ntlm' },
|
||||
"username:s" => { name => 'username' },
|
||||
"password:s" => { name => 'password' },
|
||||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
"warning:s" => { name => 'warning' },
|
||||
"critical:s" => { name => 'critical' },
|
||||
"timeout:s" => { name => 'timeout', default => '3' },
|
||||
"ssl:s" => { name => 'ssl' },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
"cacert-file:s" => { name => 'cacert_file' },
|
||||
"cert-pwd:s" => { name => 'cert_pwd' },
|
||||
"cert-pkcs12" => { name => 'cert_pkcs12' },
|
||||
});
|
||||
return $self;
|
||||
}
|
||||
|
@ -199,6 +201,14 @@ Threshold critical in seconds (Webpage response time)
|
|||
|
||||
Specify certificate to send to the webserver
|
||||
|
||||
=item B<--key-file>
|
||||
|
||||
Specify key to send to the webserver
|
||||
|
||||
=item B<--cacert-file>
|
||||
|
||||
Specify root certificate to send to the webserver
|
||||
|
||||
=item B<--cert-pwd>
|
||||
|
||||
Specify certificate's password
|
||||
|
|
|
@ -50,7 +50,7 @@ sub new {
|
|||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$self->{version} = '1.1';
|
||||
$self->{version} = '1.2';
|
||||
$options{options}->add_options(arguments =>
|
||||
{
|
||||
"service-soap:s" => { name => 'service_soap' },
|
||||
|
@ -69,6 +69,8 @@ sub new {
|
|||
"timeout:s" => { name => 'timeout', default => 10 },
|
||||
"ssl:s" => { name => 'ssl', },
|
||||
"cert-file:s" => { name => 'cert_file' },
|
||||
"key-file:s" => { name => 'key_file' },
|
||||
"cacert-file:s" => { name => 'cacert_file' },
|
||||
"cert-pwd:s" => { name => 'cert_pwd' },
|
||||
"cert-pkcs12" => { name => 'cert_pkcs12' },
|
||||
|
||||
|
@ -449,6 +451,14 @@ Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
|||
|
||||
Specify certificate to send to the webserver
|
||||
|
||||
=item B<--key-file>
|
||||
|
||||
Specify key to send to the webserver
|
||||
|
||||
=item B<--cacert-file>
|
||||
|
||||
Specify root certificate to send to the webserver
|
||||
|
||||
=item B<--cert-pwd>
|
||||
|
||||
Specify certificate's password
|
||||
|
|
|
@ -133,8 +133,14 @@ sub connect {
|
|||
}
|
||||
|
||||
if (defined($self->{option_results}->{cert_file}) && !defined($self->{option_results}->{cert_pkcs12})) {
|
||||
eval "use Net::SSL"; die $@ if $@;
|
||||
$ENV{HTTPS_CERT_FILE} = $self->{option_results}->{cert_file};
|
||||
use IO::Socket::SSL;
|
||||
my $context = new IO::Socket::SSL::SSL_Context(
|
||||
SSL_use_cert => 1,
|
||||
SSL_cert_file => $self->{option_results}->{cert_file},
|
||||
$self->{option_results}->{key_file} ? ( SSL_key_file => $self->{option_results}->{key_file} ):(),
|
||||
$self->{option_results}->{cacert_file} ? ( SSL_ca_file => $self->{option_results}->{cacert_file} ):(),
|
||||
);
|
||||
IO::Socket::SSL::set_default_context($context);
|
||||
}
|
||||
|
||||
$response = $ua->request($req);
|
||||
|
|
Loading…
Reference in New Issue