line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# audit::https Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Audit::Https; |
7
|
1
|
|
|
1
|
|
627
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
7
|
use base qw(Metabrik::Shell::Command); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
498
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable ssl openssl) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
uri => [ qw(uri) ], |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
commands => { |
22
|
|
|
|
|
|
|
check_ssl3_support => [ qw(uri|OPTIONAL) ], |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
require_modules => { |
25
|
|
|
|
|
|
|
'Metabrik::String::Uri' => [ ], |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
require_binaries => { |
28
|
|
|
|
|
|
|
'printf' => [ ], |
29
|
|
|
|
|
|
|
'openssl' => [ ], |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# Poodle: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566 |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
sub check_ssl3_support { |
38
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
39
|
0
|
|
|
|
|
|
my ($uri) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
0
|
|
|
|
$uri ||= $self->uri; |
42
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('check_ssl3_support', $uri) or return; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if ($uri !~ /^https:\/\//) { |
45
|
0
|
|
|
|
|
|
return $self->log->error("check_ssl3_support: uri [$uri] invalid format"); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
my $su = Metabrik::String::Uri->new_from_brik_init($self) or return; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
my $hash = $su->parse($uri) or return; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $host = $hash->{host}; |
53
|
0
|
|
|
|
|
|
my $port = $hash->{port}; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $cmd = "printf \"GET / HTTP/1.0\r\n\r\n\" | openssl s_client -host $host -port $port -ssl3"; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$self->as_array(1); |
58
|
0
|
|
|
|
|
|
$self->as_matrix(0); |
59
|
0
|
|
|
|
|
|
$self->capture_stderr(1); |
60
|
0
|
0
|
|
|
|
|
my $buf = $self->capture($cmd) or return; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $check = { |
63
|
|
|
|
|
|
|
ssl_version3_support => 1, |
64
|
|
|
|
|
|
|
cmd => $cmd, |
65
|
|
|
|
|
|
|
raw => $buf, |
66
|
|
|
|
|
|
|
}; |
67
|
0
|
|
|
|
|
|
for (@$buf) { |
68
|
0
|
0
|
|
|
|
|
if (/sslv3 alert handshake failure/s) { |
69
|
0
|
|
|
|
|
|
$check->{ssl_version3_support} = 0; |
70
|
0
|
|
|
|
|
|
last; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
return $check; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |