line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::TLSRPT::Failure; |
2
|
|
|
|
|
|
|
# ABSTRACT: TLSRPT failure object |
3
|
|
|
|
|
|
|
our $VERSION = '1.20200306.1'; # VERSION |
4
|
8
|
|
|
8
|
|
566
|
use 5.20.0; |
|
8
|
|
|
|
|
31
|
|
5
|
8
|
|
|
8
|
|
45
|
use Moo; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
54
|
|
6
|
8
|
|
|
8
|
|
2620
|
use Carp; |
|
8
|
|
|
|
|
35
|
|
|
8
|
|
|
|
|
452
|
|
7
|
8
|
|
|
8
|
|
59
|
use Mail::TLSRPT::Pragmas; |
|
8
|
|
|
|
|
39
|
|
|
8
|
|
|
|
|
72
|
|
8
|
8
|
|
|
8
|
|
7650
|
use Net::IP; |
|
8
|
|
|
|
|
478590
|
|
|
8
|
|
|
|
|
7641
|
|
9
|
|
|
|
|
|
|
has result_type => (is => 'rw', isa => Enum[ qw( starttls-not-supported certificate-host-mismatch certificate-expired certificate-not-trusted validation-failure tlsa-invalid dnssec-invalid dane-required sts-policy-fetch-error sts-policy-invalid sts-webpki-invalid ) ], required => 1); |
10
|
|
|
|
|
|
|
has sending_mta_ip => (is => 'rw', isa => class_type('Net::IP'), required => 1,coerce => sub{&_coerce_ip}); |
11
|
|
|
|
|
|
|
has receiving_mx_hostname => (is => 'rw', isa => Str, required => 1); |
12
|
|
|
|
|
|
|
has receiving_mx_helo => (is => 'rw', isa => Str, required => 0); |
13
|
|
|
|
|
|
|
has receiving_ip => (is => 'rw', isa => class_type('Net::IP'), required => 0, coerce => sub{&_coerce_ip}); |
14
|
|
|
|
|
|
|
has failed_session_count => (is => 'rw', isa => Int, required => 1); |
15
|
|
|
|
|
|
|
has additional_information => (is => 'rw', isa => Str, required => 0); |
16
|
|
|
|
|
|
|
has failure_reason_code => (is => 'rw', isa => Str, required => 0); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _coerce_ip { |
19
|
49
|
|
|
49
|
|
128
|
my $ip = shift; |
20
|
49
|
100
|
|
|
|
269
|
$ip = Net::IP->new($ip) unless ref $ip eq 'Net::IP'; |
21
|
49
|
|
|
|
|
51663
|
return $ip; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
10
|
|
|
10
|
0
|
5286
|
sub new_from_data($class,$data) { |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
13
|
|
25
|
|
|
|
|
|
|
my $self = $class->new( |
26
|
|
|
|
|
|
|
result_type => $data->{'result-type'}, |
27
|
|
|
|
|
|
|
sending_mta_ip => $data->{'sending-mta-ip'}, |
28
|
|
|
|
|
|
|
receiving_mx_hostname => $data->{'receiving-mx-hostname'}, |
29
|
|
|
|
|
|
|
$data->{'receiving-mx-helo'} ? ( receiving_mx_helo => $data->{'receiving-mx-helo'} ) : (), |
30
|
|
|
|
|
|
|
$data->{'receiving-ip'} ? ( receiving_ip => $data->{'receiving-ip'} ) : (), |
31
|
|
|
|
|
|
|
failed_session_count => $data->{'failed-session-count'} // 0, |
32
|
|
|
|
|
|
|
$data->{'additional-information'} ? ( additional_information => $data->{'additional-information'} ) : (), |
33
|
10
|
100
|
50
|
|
|
234
|
$data->{'failure-reason-code'} ? ( failure_reason_code => $data->{'failure-reason-code'} ) : (), |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
34
|
|
|
|
|
|
|
); |
35
|
10
|
|
|
|
|
354
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
4
|
0
|
911
|
sub as_struct($self) { |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
7
|
|
39
|
|
|
|
|
|
|
return { |
40
|
4
|
50
|
|
|
|
75
|
'result-type' => $self->result_type, |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$self->sending_mta_ip ? ( 'sending-mta-ip' => $self->sending_mta_ip->ip ) : (), |
42
|
|
|
|
|
|
|
'receiving-mx-hostname' => $self->receiving_mx_hostname, |
43
|
|
|
|
|
|
|
$self->receiving_mx_helo ? ( 'receiving-mx-helo' => $self->receiving_mx_helo ) : (), |
44
|
|
|
|
|
|
|
$self->receiving_ip ? ( 'receiving-ip' => $self->receiving_ip->ip ) : (), |
45
|
|
|
|
|
|
|
'failed-session-count' => $self->failed_session_count, |
46
|
|
|
|
|
|
|
$self->additional_information ? ( 'additional-information' => $self->additional_information ) : (), |
47
|
|
|
|
|
|
|
$self->failure_reason_code ? ( 'failure-reason-code' => $self->failure_reason_code ) : (), |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
5
|
|
|
5
|
0
|
11966
|
sub as_string($self) { |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
8
|
|
52
|
5
|
100
|
|
|
|
98
|
my $receiving_ip = $self->receiving_ip ? ' ('.$self->receiving_ip->ip.')' : ''; |
53
|
5
|
50
|
|
|
|
218
|
return join( "\n", |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
54
|
|
|
|
|
|
|
' Failure:', |
55
|
|
|
|
|
|
|
' Result-Type: '.$self->result_type, |
56
|
|
|
|
|
|
|
$self->sending_mta_ip ? (' Sending-MTA-IP: '.$self->sending_mta_ip->ip) : (), |
57
|
|
|
|
|
|
|
' Receiving-MX-Hostname: '.$self->receiving_mx_hostname . $receiving_ip, |
58
|
|
|
|
|
|
|
$self->receiving_mx_helo ? (' Receiving-MX-HELO: '.$self->receiving_mx_helo) : (), |
59
|
|
|
|
|
|
|
' Failed-Session-Count: '.$self->failed_session_count, |
60
|
|
|
|
|
|
|
$self->additional_information ? (' Additional-Information: '.$self->additional_information ) : (), |
61
|
|
|
|
|
|
|
$self->failure_reason_code ? (' Failure-Reason-Code: '.$self->failure_reason_code ) : (), |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
1
|
|
2
|
sub _csv_headers($self) { |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1
|
|
66
|
|
|
|
|
|
|
return ( |
67
|
1
|
|
|
|
|
10
|
'result type', |
68
|
|
|
|
|
|
|
'sending mta ip', |
69
|
|
|
|
|
|
|
'receiving mx hostname', |
70
|
|
|
|
|
|
|
'receiving mx helo', |
71
|
|
|
|
|
|
|
'receiving ip', |
72
|
|
|
|
|
|
|
'failed session count', |
73
|
|
|
|
|
|
|
'additional information', |
74
|
|
|
|
|
|
|
'failure reason code', |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
3
|
|
|
3
|
|
287
|
sub _csv_fragment($self) { |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
4
|
|
79
|
|
|
|
|
|
|
return ( |
80
|
3
|
100
|
50
|
|
|
47
|
$self->result_type, |
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
81
|
|
|
|
|
|
|
$self->sending_mta_ip->ip, |
82
|
|
|
|
|
|
|
$self->receiving_mx_hostname, |
83
|
|
|
|
|
|
|
$self->receiving_mx_helo // '', |
84
|
|
|
|
|
|
|
$self->receiving_ip ? $self->receiving_ip->ip : '', |
85
|
|
|
|
|
|
|
$self->failed_session_count, |
86
|
|
|
|
|
|
|
$self->additional_information // '', |
87
|
|
|
|
|
|
|
$self->failure_reason_code // '', |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding UTF-8 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 NAME |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Mail::TLSRPT::Failure - TLSRPT failure object |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 VERSION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
version 1.20200306.1 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Marc Bradshaw <marc@marcbradshaw.net> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Marc Bradshaw. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |