/usr/share/perl5/Munin/Common/TLSClient.pm is in munin-common 2.0.19-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | package Munin::Common::TLSClient;
use base qw(Munin::Common::TLS);
# $Id$
use warnings;
use strict;
use Carp;
use English qw(-no_match_vars);
sub new {
my ($class, $args) = @_;
my $self = $class->SUPER::new($args);
$self->{remote_key} = 0;
return $self;
}
sub start_tls {
my ($self) = @_;
$self->SUPER::_start_tls();
}
sub _initial_communication {
my ($self) = @_;
$self->{write_func}("STARTTLS\n");
my $tlsresponse = $self->{read_func}();
if (!defined $tlsresponse) {
$self->{logger}("[ERROR] Bad TLS response \"\".");
return 0
}
if ($tlsresponse =~ /^TLS OK/) {
$self->{remote_key} = 1;
}
elsif ($tlsresponse !~ /^TLS MAYBE/i) {
$self->{logger}("[ERROR] Bad TLS response \"$tlsresponse\".");
return 0;
}
return 1;
}
sub _use_key_if_present {
my ($self) = @_;
return !$self->{remote_key};
}
sub _on_unverified_cert {
my ($self) = @_;
$self->write("quit\n");
}
1;
__END__
=head1 NAME
Munin::Node::TLSClient - Implements the client side of the STARTTLS protocol
=head1 SYNOPSIS
$tls = Munin::Node::TLSClient->new(...);
$tls->start_tls();
=head1 METHODS
=over
=item B<new>
$tls = Munin::Node::TLSClient->new(...);
See L<Munin::Node::TLS> for documentation for constructor arguments.
=item B<start_tls>
$tls->start_tls();
Begin a STARTTLS request
=back
|