Revert "Refs #6202 - Add possibility to send a certificate"

This reverts commit ce6dde2dd4.
This commit is contained in:
Mathieu Cinquin 2015-04-23 18:23:20 +02:00
parent 2dd9f38d50
commit bcbfd1c3cf
2 changed files with 58 additions and 91 deletions

View File

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright 2005-2015 CENTREON # Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under # Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0. # GPL Licence 2.0.
# #
@ -18,19 +18,18 @@
# combined work based on this program. Thus, the terms and conditions of the GNU # combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination. # General Public License cover the whole combination.
# #
# As a special exception, the copyright holders of this program give CENTREON # As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable, # permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and # regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that # distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions # MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not # of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this # derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you # exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version. # do not wish to do so, delete this exception statement from your version.
# #
# For more information : contact@centreon.com # For more information : contact@centreon.com
# Authors : Simon BOMM <sbomm@merethis.com> # Author : Simon BOMM <sbomm@merethis.com>
# Mathieu Cinquin <mcinquin@centreon.com>
# #
# Based on De Bodt Lieven plugin # Based on De Bodt Lieven plugin
#################################################################################### ####################################################################################
@ -49,7 +48,7 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options); my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class; bless $self, $class;
$self->{version} = '1.1'; $self->{version} = '1.0';
$options{options}->add_options(arguments => $options{options}->add_options(arguments =>
{ {
"hostname:s" => { name => 'hostname' }, "hostname:s" => { name => 'hostname' },
@ -65,9 +64,6 @@ sub new {
"critical:s" => { name => 'critical' }, "critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' }, "timeout:s" => { name => 'timeout', default => '3' },
"ssl:s" => { name => 'ssl', }, "ssl:s" => { name => 'ssl', },
"cert-file:s" => { name => 'cert_file' },
"cert-pwd:s" => { name => 'cert_pwd' },
"cert-pkcs12" => { name => 'cert_pkcs12' },
}); });
return $self; return $self;
} }
@ -98,10 +94,6 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used"); $self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit(); $self->{output}->option_exit();
} }
if ((defined($self->{option_results}->{pkcs12})) && (!defined($self->{option_results}->{cert_file}) && !defined($self->{option_results}->{cert_pwd}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --cert-file= and --cert-pwd= options when --pkcs12 is used");
$self->{output}->option_exit();
}
} }
sub run { sub run {
@ -194,18 +186,6 @@ Threshold warning in seconds (Webpage response time)
Threshold critical in seconds (Webpage response time) Threshold critical in seconds (Webpage response time)
=item B<--cert-file>
Specify certificate to send to the webserver
=item B<--cert-pwd>
Specify certificate's password
=item B<--cert-pkcs12>
Specify type of certificate (PKCS12)
=back =back
=cut =cut

View File

@ -1,5 +1,5 @@
############################################################################### ###############################################################################
# Copyright 2005-2015 CENTREON # Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under # Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0. # GPL Licence 2.0.
# #
@ -18,19 +18,18 @@
# combined work based on this program. Thus, the terms and conditions of the GNU # combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination. # General Public License cover the whole combination.
# #
# As a special exception, the copyright holders of this program give CENTREON # As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable, # permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and # regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that # distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions # MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not # of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this # derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you # exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version. # do not wish to do so, delete this exception statement from your version.
# #
# For more information : contact@centreon.com # For more information : contact@centreon.com
# Authors : Simon BOMM <sbomm@merethis.com> # Author : Simon BOMM <sbomm@merethis.com>
# Mathieu Cinquin <mcinqui@centreon.com>
# #
# Based on De Bodt Lieven plugin # Based on De Bodt Lieven plugin
#################################################################################### ####################################################################################
@ -39,7 +38,6 @@ package centreon::plugins::httplib;
use strict; use strict;
use warnings; use warnings;
use LWP::UserAgent; use LWP::UserAgent;
use HTTP::Cookies; use HTTP::Cookies;
use URI; use URI;
@ -127,17 +125,6 @@ sub connect {
IO::Socket::SSL::set_default_context($context); IO::Socket::SSL::set_default_context($context);
} }
if (defined($self->{option_results}->{cert_pkcs12}) && $self->{option_results}->{cert_file} ne '' && $self->{option_results}->{cert_pwd} ne '') {
use Net::SSL;
$ENV{HTTPS_PKCS12_FILE} = $self->{option_results}->{cert_file};
$ENV{HTTPS_PKCS12_PASSWORD} = $self->{option_results}->{cert_pwd};
}
if (defined($self->{option_results}->{cert_file}) && !defined($self->{option_results}->{cert_pkcs12})) {
use Net::SSL;
$ENV{HTTPS_CERT_FILE} = $self->{option_results}->{cert_file};
}
$response = $ua->request($req); $response = $ua->request($req);
if ($response->is_success) { if ($response->is_success) {