line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DNS::Check::Config; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION $AUTOLOAD); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
66
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
668
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
1
|
|
my ($pkg, %param) = @_; |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my $self = {}; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
bless $self, $pkg; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Definizione rootnameservers |
16
|
0
|
|
|
|
|
|
$self->{rootservers} = [ qw( |
17
|
|
|
|
|
|
|
198.41.0.4 |
18
|
|
|
|
|
|
|
128.9.0.107 |
19
|
|
|
|
|
|
|
192.33.4.12 |
20
|
|
|
|
|
|
|
128.8.10.90 |
21
|
|
|
|
|
|
|
192.203.230.10 |
22
|
|
|
|
|
|
|
192.5.5.241 |
23
|
|
|
|
|
|
|
192.112.36.4 |
24
|
|
|
|
|
|
|
128.63.2.53 |
25
|
|
|
|
|
|
|
192.36.148.17 |
26
|
|
|
|
|
|
|
192.58.128.30 |
27
|
|
|
|
|
|
|
193.0.14.129 |
28
|
|
|
|
|
|
|
198.32.64.12 |
29
|
|
|
|
|
|
|
202.12.27.33 ) |
30
|
|
|
|
|
|
|
]; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$self->{debug_default} = 0; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Intervallo di tempo per la ritrasmissione delle query |
37
|
0
|
|
|
|
|
|
$self->{query_retrans} = 5; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Numero di tentativi nelle fare le query |
40
|
0
|
|
|
|
|
|
$self->{query_retry} = 2; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Time out delle connessioni di tipo TCP (default a 120) |
43
|
0
|
|
|
|
|
|
$self->{query_tcp_timeout} = 30; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Time out delle connessioni di tipo UDP (default undef) |
46
|
0
|
|
|
|
|
|
$self->{query_udp_timeout} = undef; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Abilita disabilita le query per i RR::AAAA |
49
|
0
|
|
|
|
|
|
$self->{query_AAAA} = undef; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# $self->{predefined_hosts}->{'dns.nic.it'} = ['193.205.245.5']; |
52
|
|
|
|
|
|
|
# $self->{predefined_hosts}->{'dns2.nic.it'} = ['193.205.245.8']; |
53
|
|
|
|
|
|
|
# $self->{predefined_hosts}->{'dns3.nic.it'} = ['193.205.245.66']; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# list of all available Check (test) |
56
|
|
|
|
|
|
|
# if you add a new Check you should add it to this list |
57
|
0
|
|
|
|
|
|
$self->{test_list} = [ qw( |
58
|
|
|
|
|
|
|
mx_compare |
59
|
|
|
|
|
|
|
mx_present |
60
|
|
|
|
|
|
|
ns_compare |
61
|
|
|
|
|
|
|
ns_vs_delegated |
62
|
|
|
|
|
|
|
ns_count |
63
|
|
|
|
|
|
|
soa_expire_compare |
64
|
|
|
|
|
|
|
soa_expire_range |
65
|
|
|
|
|
|
|
soa_refresh_compare |
66
|
|
|
|
|
|
|
soa_refresh_range |
67
|
|
|
|
|
|
|
soa_retry_compare |
68
|
|
|
|
|
|
|
soa_retry_range |
69
|
|
|
|
|
|
|
soa_serial_compare |
70
|
|
|
|
|
|
|
soa_serial_syntax |
71
|
|
|
|
|
|
|
soa_master_compare |
72
|
|
|
|
|
|
|
soa_master_in_ns |
73
|
|
|
|
|
|
|
host_syntax |
74
|
|
|
|
|
|
|
host_not_cname |
75
|
|
|
|
|
|
|
host_ip_vs_ip_orig |
76
|
|
|
|
|
|
|
host_ip_private |
77
|
|
|
|
|
|
|
) ]; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
$self->{test_level}->{OK} = 'OK'; |
82
|
0
|
|
|
|
|
|
$self->{test_level}->{E} = 'Error'; |
83
|
0
|
|
|
|
|
|
$self->{test_level}->{W} = 'Warning'; |
84
|
0
|
|
|
|
|
|
$self->{test_level}->{I} = 'Ignore'; |
85
|
0
|
|
|
|
|
|
$self->{test_level}->{F} = 'Fatal'; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$self->{ok_status} = 'OK'; |
88
|
0
|
|
|
|
|
|
$self->{error_status} = [qw{E F}]; |
89
|
0
|
|
|
|
|
|
$self->{default_status} = 'E'; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# List of all configured test. This is an hash ref containg |
92
|
|
|
|
|
|
|
# all test used. Default use all available tests. |
93
|
|
|
|
|
|
|
# Default level E (Error) |
94
|
0
|
|
|
|
|
|
$self->{test_configured} = { map { $_ => 'E' } @{ $self->{test_list} } }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# $self->{test_configured}->{soa_serial_syntax} = 'W'; |
97
|
|
|
|
|
|
|
# $self->{test_configured}->{soa_serial_compare} = 'W'; |
98
|
|
|
|
|
|
|
# $self->{test_configured}->{soa_refresh_range} = 'W'; |
99
|
|
|
|
|
|
|
# $self->{test_configured}->{soa_refresh_compare} = 'W'; |
100
|
|
|
|
|
|
|
# $self->{test_configured}->{soa_retry_range} = 'W'; |
101
|
|
|
|
|
|
|
# $self->{test_configured}->{soa_retry_compare} = 'W'; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# If value is '0' |
105
|
0
|
|
|
|
|
|
$self->{ns_min_count} = 2; |
106
|
0
|
|
|
|
|
|
$self->{ns_max_count} = 0; # no max limit |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
$self->{soa_min_retry} = 1800; |
109
|
0
|
|
|
|
|
|
$self->{soa_max_retry} = 28800; |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$self->{soa_min_refresh} = 1800; |
112
|
0
|
|
|
|
|
|
$self->{soa_max_refresh} = 86400; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
$self->{soa_min_expire} = 86400; |
115
|
0
|
|
|
|
|
|
$self->{soa_max_expire} = 0; # no max limit |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
$self->{ip_private} = [ qw( |
118
|
|
|
|
|
|
|
10 |
119
|
|
|
|
|
|
|
127 |
120
|
|
|
|
|
|
|
172.16 |
121
|
|
|
|
|
|
|
172.17 |
122
|
|
|
|
|
|
|
172.18 |
123
|
|
|
|
|
|
|
172.19 |
124
|
|
|
|
|
|
|
172.20 |
125
|
|
|
|
|
|
|
172.21 |
126
|
|
|
|
|
|
|
172.22 |
127
|
|
|
|
|
|
|
172.23 |
128
|
|
|
|
|
|
|
172.24 |
129
|
|
|
|
|
|
|
172.25 |
130
|
|
|
|
|
|
|
172.26 |
131
|
|
|
|
|
|
|
172.27 |
132
|
|
|
|
|
|
|
172.28 |
133
|
|
|
|
|
|
|
172.29 |
134
|
|
|
|
|
|
|
172.30 |
135
|
|
|
|
|
|
|
172.31 |
136
|
|
|
|
|
|
|
192.168 ) |
137
|
|
|
|
|
|
|
]; |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
return $self; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub test_level { |
143
|
0
|
|
|
0
|
1
|
|
my ($self) = shift; |
144
|
0
|
|
|
|
|
|
my ($level) = shift;; |
145
|
|
|
|
|
|
|
|
146
|
0
|
0
|
|
|
|
|
if ( $level ) { |
147
|
0
|
|
|
|
|
|
return $self->{test_level}->{$level}; |
148
|
|
|
|
|
|
|
} else { |
149
|
0
|
|
|
|
|
|
return $self->{test_level}; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub test_conf { |
155
|
0
|
|
|
0
|
1
|
|
my ($self) = shift; |
156
|
0
|
|
|
|
|
|
my (%param) = @_; |
157
|
|
|
|
|
|
|
|
158
|
0
|
0
|
|
|
|
|
return unless $param{test}; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# We should verify if test exists and if level is one of that supported |
161
|
0
|
0
|
|
|
|
|
if ($param{level}) { |
162
|
0
|
|
|
|
|
|
$self->{test_configured}->{$param{test}} = uc $param{level}; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
|
if (defined $self->{test_configured}->{$param{test}} ) { |
166
|
0
|
|
|
|
|
|
return $self->{test_configured}->{$param{test}}; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub AUTOLOAD { |
172
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
my ($name) = $AUTOLOAD =~ m/^.*::(.*)$/; |
175
|
|
|
|
|
|
|
|
176
|
0
|
0
|
|
|
|
|
unless (exists $self->{$name}) { |
177
|
0
|
|
|
|
|
|
Carp::carp(<<"AMEN"); |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
*** |
180
|
|
|
|
|
|
|
*** WARNING!!! Param Doesn't exist |
181
|
|
|
|
|
|
|
*** $AUTOLOAD |
182
|
|
|
|
|
|
|
*** |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
AMEN |
185
|
0
|
|
|
|
|
|
return; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
1
|
|
|
1
|
|
12
|
no strict q/refs/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
124
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
# Build a method in the class. |
191
|
0
|
|
|
|
|
|
*{$AUTOLOAD} = sub { |
192
|
0
|
|
|
0
|
|
|
my ($self, $new_val) = @_; |
193
|
|
|
|
|
|
|
|
194
|
0
|
0
|
|
|
|
|
if (defined $new_val) { |
195
|
0
|
|
|
|
|
|
$self->{$name} = $new_val; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
0
|
|
|
|
|
|
return $self->{$name}; |
199
|
0
|
|
|
|
|
|
}; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
# And jump over to it. |
202
|
0
|
|
|
|
|
|
goto &{$AUTOLOAD}; |
|
0
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
0
|
|
|
0
|
|
|
sub DESTROY {}; |
207
|
|
|
|
|
|
|
1; |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
__END__ |