| 1 | package Zonemaster::Engine::Test::DNSSEC; | ||
| 2 | |||
| 3 | use v5.16.0; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use version; our $VERSION = version->declare( "v1.1.58" ); | ||
| 7 | |||
| 8 | use Carp; | ||
| 9 | use List::Compare; | ||
| 10 | use List::MoreUtils qw[any uniq]; | ||
| 11 | use List::Util qw[min]; | ||
| 12 | use Locale::TextDomain qw[Zonemaster-Engine]; | ||
| 13 | use Readonly; | ||
| 14 | |||
| 15 | use Zonemaster::LDNS::RR; | ||
| 16 | use Zonemaster::Engine::Profile; | ||
| 17 | use Zonemaster::Engine::Constants qw[:algo :soa :ip]; | ||
| 18 | use Zonemaster::Engine::Util qw[name should_run_test]; | ||
| 19 | use Zonemaster::Engine::TestMethods; | ||
| 20 | use Zonemaster::Engine::TestMethodsV2; | ||
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | Zonemaster::Engine::Test::DNSSEC - Module implementing tests focused on DNSSEC | ||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | my @results = Zonemaster::Engine::Test::DNSSEC->all( $zone ); | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | ### Table fetched from IANA on 2025-07-15 | ||
| 33 | Readonly::Hash our %algo_properties => ( | ||
| 34 | 0 => { | ||
| 35 | status => $ALGO_STATUS_NOT_ZONE_SIGN, | ||
| 36 | description => q{Delete DS}, | ||
| 37 | mnemonic => q{DELETE}, | ||
| 38 | sig => 0, | ||
| 39 | }, | ||
| 40 | 1 => { | ||
| 41 | status => $ALGO_STATUS_DEPRECATED, | ||
| 42 | description => q{RSA/MD5}, | ||
| 43 | mnemonic => q{RSAMD5}, | ||
| 44 | sig => 0, | ||
| 45 | }, | ||
| 46 | 2 => { | ||
| 47 | status => $ALGO_STATUS_NOT_ZONE_SIGN, | ||
| 48 | description => q{Diffie-Hellman}, | ||
| 49 | mnemonic => q{DH}, | ||
| 50 | sig => 0, | ||
| 51 | }, | ||
| 52 | 3 => { | ||
| 53 | status => $ALGO_STATUS_DEPRECATED, | ||
| 54 | description => q{DSA/SHA1}, | ||
| 55 | mnemonic => q{DSA}, | ||
| 56 | sig => 1, | ||
| 57 | }, | ||
| 58 | 4 => { | ||
| 59 | status => $ALGO_STATUS_RESERVED, | ||
| 60 | description => q{Reserved}, | ||
| 61 | mnemonic => q{RESERVED}, | ||
| 62 | }, | ||
| 63 | 5 => { | ||
| 64 | status => $ALGO_STATUS_DEPRECATED, | ||
| 65 | description => q{RSA/SHA1}, | ||
| 66 | mnemonic => q{RSASHA1}, | ||
| 67 | sig => 1, | ||
| 68 | }, | ||
| 69 | 6 => { | ||
| 70 | status => $ALGO_STATUS_DEPRECATED, | ||
| 71 | description => q{DSA-NSEC3-SHA1}, | ||
| 72 | mnemonic => q{DSA-NSEC3-SHA1}, | ||
| 73 | sig => 1, | ||
| 74 | }, | ||
| 75 | 7 => { | ||
| 76 | status => $ALGO_STATUS_DEPRECATED, | ||
| 77 | description => q{RSASHA1-NSEC3-SHA1}, | ||
| 78 | mnemonic => q{RSASHA1-NSEC3-SHA1}, | ||
| 79 | sig => 1, | ||
| 80 | }, | ||
| 81 | 8 => { | ||
| 82 | status => $ALGO_STATUS_OTHER, | ||
| 83 | description => q{RSA/SHA-256}, | ||
| 84 | mnemonic => q{RSASHA256}, | ||
| 85 | sig => 1, | ||
| 86 | }, | ||
| 87 | 9 => { | ||
| 88 | status => $ALGO_STATUS_RESERVED, | ||
| 89 | description => q{Reserved}, | ||
| 90 | mnemonic => q{RESERVED}, | ||
| 91 | }, | ||
| 92 | 10 => { | ||
| 93 | status => $ALGO_STATUS_NOT_RECOMMENDED, | ||
| 94 | description => q{RSA/SHA-512}, | ||
| 95 | mnemonic => q{RSASHA512}, | ||
| 96 | sig => 1, | ||
| 97 | }, | ||
| 98 | 11 => { | ||
| 99 | status => $ALGO_STATUS_RESERVED, | ||
| 100 | description => q{Reserved}, | ||
| 101 | mnemonic => q{RESERVED}, | ||
| 102 | }, | ||
| 103 | 12 => { | ||
| 104 | status => $ALGO_STATUS_DEPRECATED, | ||
| 105 | description => q{GOST R 34.10-2001}, | ||
| 106 | mnemonic => q{ECC-GOST}, | ||
| 107 | sig => 1, | ||
| 108 | }, | ||
| 109 | 13 => { | ||
| 110 | status => $ALGO_STATUS_OTHER, | ||
| 111 | description => q{ECDSA Curve P-256 with SHA-256}, | ||
| 112 | mnemonic => q{ECDSAP256SHA256}, | ||
| 113 | sig => 1, | ||
| 114 | }, | ||
| 115 | 14 => { | ||
| 116 | status => $ALGO_STATUS_OTHER, | ||
| 117 | description => q{ECDSA Curve P-384 with SHA-384}, | ||
| 118 | mnemonic => q{ECDSAP384SHA384}, | ||
| 119 | sig => 1, | ||
| 120 | }, | ||
| 121 | 15 => { | ||
| 122 | status => $ALGO_STATUS_OTHER, | ||
| 123 | description => q{Ed25519}, | ||
| 124 | mnemonic => q{ED25519}, | ||
| 125 | sig => 1, | ||
| 126 | }, | ||
| 127 | 16 => { | ||
| 128 | status => $ALGO_STATUS_OTHER, | ||
| 129 | description => q{Ed448}, | ||
| 130 | mnemonic => q{ED448}, | ||
| 131 | sig => 1, | ||
| 132 | }, | ||
| 133 | 17 => { | ||
| 134 | status => $ALGO_STATUS_OTHER, | ||
| 135 | description => q{SM2 signing algo w SM3 hash algo}, | ||
| 136 | mnemonic => q{SM2SM3}, | ||
| 137 | sig => 1, | ||
| 138 | }, | ||
| 139 | ( | ||
| 140 | map { $_ => { status => $ALGO_STATUS_UNASSIGNED, description => q{Unassigned}, mnemonic => q{UNASSIGNED} } } ( 18 .. 22 ) | ||
| 141 | ), | ||
| 142 | 23 => { | ||
| 143 | status => $ALGO_STATUS_OTHER, | ||
| 144 | description => q{GOST R 34.10-2012}, | ||
| 145 | mnemonic => q{ECC-GOST12}, | ||
| 146 | sig => 1, | ||
| 147 | }, | ||
| 148 | ( | ||
| 149 | map { $_ => { status => $ALGO_STATUS_UNASSIGNED, description => q{Unassigned}, mnemonic => q{UNASSIGNED} } } ( 24 .. 122 ) | ||
| 150 | ), | ||
| 151 | ( | ||
| 152 | map { $_ => { status => $ALGO_STATUS_RESERVED, description => q{Reserved}, mnemonic => q{RESERVED} } } ( 123 .. 251 ) | ||
| 153 | ), | ||
| 154 | 252 => { | ||
| 155 | status => $ALGO_STATUS_NOT_ZONE_SIGN, | ||
| 156 | description => q{Reserved for Indirect Keys}, | ||
| 157 | mnemonic => q{INDIRECT}, | ||
| 158 | sig => 0, | ||
| 159 | }, | ||
| 160 | 253 => { | ||
| 161 | status => $ALGO_STATUS_PRIVATE, | ||
| 162 | description => q{private algorithm}, | ||
| 163 | mnemonic => q{PRIVATEDNS}, | ||
| 164 | sig => 1, | ||
| 165 | }, | ||
| 166 | 254 => { | ||
| 167 | status => $ALGO_STATUS_PRIVATE, | ||
| 168 | description => q{private algorithm OID}, | ||
| 169 | mnemonic => q{PRIVATEOID}, | ||
| 170 | sig => 1, | ||
| 171 | }, | ||
| 172 | 255 => { | ||
| 173 | status => $ALGO_STATUS_RESERVED, | ||
| 174 | description => q{Reserved}, | ||
| 175 | mnemonic => q{RESERVED}, | ||
| 176 | }, | ||
| 177 | ); | ||
| 178 | |||
| 179 | Readonly::Hash our %rsa_key_size_details => ( | ||
| 180 | 5 => { | ||
| 181 | min_size => 512, | ||
| 182 | max_size => 4096, | ||
| 183 | rec_size => 2048, | ||
| 184 | reference => q{RFC 3110}, | ||
| 185 | }, | ||
| 186 | 7 => { | ||
| 187 | min_size => 512, | ||
| 188 | max_size => 4096, | ||
| 189 | rec_size => 2048, | ||
| 190 | reference => q{RFC 5155}, | ||
| 191 | }, | ||
| 192 | 8 => { | ||
| 193 | min_size => 512, | ||
| 194 | max_size => 4096, | ||
| 195 | rec_size => 2048, | ||
| 196 | reference => q{RFC 5702}, | ||
| 197 | }, | ||
| 198 | 10 => { | ||
| 199 | min_size => 1024, | ||
| 200 | max_size => 4096, | ||
| 201 | rec_size => 2048, | ||
| 202 | reference => q{RFC 5702}, | ||
| 203 | }, | ||
| 204 | ); | ||
| 205 | |||
| 206 | Readonly::Hash our %digest_algorithms => ( | ||
| 207 | 0 => q{Reserved}, | ||
| 208 | 1 => q{SHA-1}, | ||
| 209 | 2 => q{SHA-256}, | ||
| 210 | 3 => q{GOST R 34.11-94}, | ||
| 211 | 4 => q{SHA-384}, | ||
| 212 | 5 => q{GOST R 34.11-2012}, | ||
| 213 | 6 => q{SM3}, | ||
| 214 | ( | ||
| 215 | map { $_ => q{Unassigned} } ( 7 .. 127 ) | ||
| 216 | ), | ||
| 217 | ( | ||
| 218 | map { $_ => q{Reserved} } ( 128 .. 252 ) | ||
| 219 | ), | ||
| 220 | ( | ||
| 221 | map { $_ => q{Reserved for Private Use} } ( 253 .. 254 ) | ||
| 222 | ), | ||
| 223 | 255 => q{Unassigned}, | ||
| 224 | ); | ||
| 225 | |||
| 226 | Readonly::Hash our %LDNS_digest_algorithms_supported => ( | ||
| 227 | 1 => q{sha1}, | ||
| 228 | 2 => q{sha256}, | ||
| 229 | 3 => q{gost}, | ||
| 230 | 4 => q{sha384}, | ||
| 231 | ); | ||
| 232 | |||
| 233 | Readonly::Hash our %dnssec01_tags_mapping => ( | ||
| 234 | 0 => q{DS01_DS_ALGO_NOT_DS}, | ||
| 235 | 1 => q{DS01_DS_ALGO_DEPRECATED}, | ||
| 236 | 2 => q{DS01_DS_ALGO_OK}, | ||
| 237 | 3 => q{DS01_DS_ALGO_DEPRECATED}, | ||
| 238 | 4 => q{DS01_DS_ALGO_OK}, | ||
| 239 | 5 => q{DS01_DS_ALGO_OK}, | ||
| 240 | 6 => q{DS01_DS_ALGO_OK}, | ||
| 241 | ( | ||
| 242 | map { $_ => q{DS01_DS_ALGO_UNASSIGNED} } ( 7 .. 127 ) | ||
| 243 | ), | ||
| 244 | ( | ||
| 245 | map { $_ => q{DS01_DS_ALGO_RESERVED} } ( 128 .. 252 ) | ||
| 246 | ), | ||
| 247 | ( | ||
| 248 | map { $_ => q{DS01_DS_ALGO_PRIVATE} } ( 253 .. 254 ) | ||
| 249 | ), | ||
| 250 | 255 => q{DS01_DS_ALGO_UNASSIGNED}, | ||
| 251 | ); | ||
| 252 | |||
| 253 | Readonly::Hash our %dnssec05_tags_mapping => ( | ||
| 254 | 0 => q{DS05_ALGO_NOT_ZONE_SIGN}, | ||
| 255 | 1 => q{DS05_ALGO_DEPRECATED}, | ||
| 256 | 2 => q{DS05_ALGO_NOT_ZONE_SIGN}, | ||
| 257 | 3 => q{DS05_ALGO_DEPRECATED}, | ||
| 258 | 4 => q{DS05_ALGO_RESERVED}, | ||
| 259 | 5 => q{DS05_ALGO_DEPRECATED}, | ||
| 260 | 6 => q{DS05_ALGO_DEPRECATED}, | ||
| 261 | 7 => q{DS05_ALGO_DEPRECATED}, | ||
| 262 | 8 => q{DS05_ALGO_OK}, | ||
| 263 | 9 => q{DS05_ALGO_RESERVED}, | ||
| 264 | 10 => q{DS05_ALGO_NOT_RECOMMENDED}, | ||
| 265 | 11 => q{DS05_ALGO_RESERVED}, | ||
| 266 | 12 => q{DS05_ALGO_DEPRECATED}, | ||
| 267 | 13 => q{DS05_ALGO_OK}, | ||
| 268 | 14 => q{DS05_ALGO_OK}, | ||
| 269 | 15 => q{DS05_ALGO_OK}, | ||
| 270 | 16 => q{DS05_ALGO_OK}, | ||
| 271 | 17 => q{DS05_ALGO_OK}, | ||
| 272 | ( | ||
| 273 | map { $_ => q{DS05_ALGO_UNASSIGNED} } ( 18 .. 22 ) | ||
| 274 | ), | ||
| 275 | 23 => q{DS05_ALGO_OK}, | ||
| 276 | ( | ||
| 277 | map { $_ => q{DS05_ALGO_UNASSIGNED} } ( 24 .. 122 ) | ||
| 278 | ), | ||
| 279 | ( | ||
| 280 | map { $_ => q{DS05_ALGO_RESERVED} } ( 123 .. 251 ) | ||
| 281 | ), | ||
| 282 | 252 => q{DS05_ALGO_NOT_ZONE_SIGN}, | ||
| 283 | 253 => q{DS05_ALGO_PRIVATE}, | ||
| 284 | 254 => q{DS05_ALGO_PRIVATE}, | ||
| 285 | 255 => q{DS05_ALGO_RESERVED}, | ||
| 286 | ); | ||
| 287 | |||
| 288 | =head1 METHODS | ||
| 289 | |||
| 290 | =over | ||
| 291 | |||
| 292 | =item all() | ||
| 293 | |||
| 294 | my @logentry_array = all( $zone ); | ||
| 295 | |||
| 296 | Runs the default set of tests for that module, i.e. between L<one and seventeen tests|/TESTS> depending on the tested zone. | ||
| 297 | If L<DNSSEC07|/dnssec07()> finds no DNSKEY nor DS RRs, no other test is run. If L<DNSSEC07|/dnssec07()> finds a DNSKEY RR, L<DNSSEC06|/dnssec06()> is run. | ||
| 298 | |||
| 299 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 300 | |||
| 301 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 302 | |||
| 303 | =back | ||
| 304 | |||
| 305 | =cut | ||
| 306 | |||
| 307 | sub all { | ||
| 308 | my ( $class, $zone ) = @_; | ||
| 309 | my @results; | ||
| 310 | |||
| 311 | if ( should_run_test( q{dnssec07} ) ) { | ||
| 312 | push @results, $class->dnssec07( $zone ); | ||
| 313 | } | ||
| 314 | |||
| 315 | if ( should_run_test( q{dnssec11} ) ) { | ||
| 316 | push @results, $class->dnssec11( $zone ); | ||
| 317 | } | ||
| 318 | |||
| 319 | if ( any { $_->tag eq 'DS07_NOT_SIGNED' } @results ) { | ||
| 320 | return @results; | ||
| 321 | } | ||
| 322 | |||
| 323 | if ( should_run_test( q{dnssec01} ) ) { | ||
| 324 | push @results, $class->dnssec01( $zone ); | ||
| 325 | } | ||
| 326 | |||
| 327 | if ( should_run_test( q{dnssec02} ) ) { | ||
| 328 | push @results, $class->dnssec02( $zone ); | ||
| 329 | } | ||
| 330 | |||
| 331 | if ( should_run_test( q{dnssec03} ) ) { | ||
| 332 | push @results, $class->dnssec03( $zone ); | ||
| 333 | } | ||
| 334 | |||
| 335 | if ( should_run_test( q{dnssec04} ) ) { | ||
| 336 | push @results, $class->dnssec04( $zone ); | ||
| 337 | } | ||
| 338 | |||
| 339 | if ( should_run_test( q{dnssec05} ) ) { | ||
| 340 | push @results, $class->dnssec05( $zone ); | ||
| 341 | } | ||
| 342 | |||
| 343 | if ( should_run_test( q{dnssec06} ) ) { | ||
| 344 | push @results, $class->dnssec06( $zone ); | ||
| 345 | } | ||
| 346 | |||
| 347 | if ( should_run_test( q{dnssec08} ) ) { | ||
| 348 | push @results, $class->dnssec08( $zone ); | ||
| 349 | } | ||
| 350 | |||
| 351 | if ( should_run_test( q{dnssec09} ) ) { | ||
| 352 | push @results, $class->dnssec09( $zone ); | ||
| 353 | } | ||
| 354 | |||
| 355 | if ( should_run_test( q{dnssec10} ) ) { | ||
| 356 | push @results, $class->dnssec10( $zone ); | ||
| 357 | } | ||
| 358 | |||
| 359 | if ( should_run_test( q{dnssec13} ) ) { | ||
| 360 | push @results, $class->dnssec13( $zone ); | ||
| 361 | } | ||
| 362 | |||
| 363 | if ( should_run_test( q{dnssec14} ) ) { | ||
| 364 | push @results, $class->dnssec14( $zone ); | ||
| 365 | } | ||
| 366 | |||
| 367 | if ( should_run_test( q{dnssec15} ) ) { | ||
| 368 | push @results, $class->dnssec15( $zone ); | ||
| 369 | } | ||
| 370 | |||
| 371 | if ( should_run_test( q{dnssec16} ) ) { | ||
| 372 | push @results, $class->dnssec16( $zone ); | ||
| 373 | } | ||
| 374 | |||
| 375 | if ( should_run_test( q{dnssec17} ) ) { | ||
| 376 | push @results, $class->dnssec17( $zone ); | ||
| 377 | } | ||
| 378 | |||
| 379 | if ( should_run_test( q{dnssec18} ) ) { | ||
| 380 | push @results, $class->dnssec18( $zone ); | ||
| 381 | } | ||
| 382 | |||
| 383 | return @results; | ||
| 384 | } ## end sub all | ||
| 385 | |||
| 386 | =over | ||
| 387 | |||
| 388 | =item metadata() | ||
| 389 | |||
| 390 | my $hash_ref = metadata(); | ||
| 391 | |||
| 392 | Returns a reference to a hash, the keys of which are the names of all Test Cases in the module, and the corresponding values are references to | ||
| 393 | an array containing all the message tags that the Test Case can use in L<log entries|Zonemaster::Engine::Logger::Entry>. | ||
| 394 | |||
| 395 | =back | ||
| 396 | |||
| 397 | =cut | ||
| 398 | |||
| 399 | sub metadata { | ||
| 400 | my ( $class ) = @_; | ||
| 401 | |||
| 402 | return { | ||
| 403 | dnssec01 => [ | ||
| 404 | qw( | ||
| 405 | DS01_DS_ALGO_2_MISSING | ||
| 406 | DS01_DS_ALGO_DEPRECATED | ||
| 407 | DS01_DS_ALGO_NOT_DS | ||
| 408 | DS01_DS_ALGO_OK | ||
| 409 | DS01_DS_ALGO_PRIVATE | ||
| 410 | DS01_DS_ALGO_RESERVED | ||
| 411 | DS01_DS_ALGO_UNASSIGNED | ||
| 412 | DS01_NO_RESPONSE | ||
| 413 | DS01_PARENT_SERVER_NO_DS | ||
| 414 | DS01_PARENT_ZONE_NO_DS | ||
| 415 | DS01_ROOT_N_NO_UNDEL_DS | ||
| 416 | DS01_UNDEL_N_NO_UNDEL_DS | ||
| 417 | ) | ||
| 418 | ], | ||
| 419 | dnssec02 => [ | ||
| 420 | qw( | ||
| 421 | DS02_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 422 | DS02_DNSKEY_NOT_FOR_ZONE_SIGNING | ||
| 423 | DS02_DNSKEY_NOT_SEP | ||
| 424 | DS02_DNSKEY_NOT_SIGNED_BY_ANY_DS | ||
| 425 | DS02_NO_DNSKEY_FOR_DS | ||
| 426 | DS02_NO_MATCHING_DNSKEY_RRSIG | ||
| 427 | DS02_NO_MATCH_DS_DNSKEY | ||
| 428 | DS02_NO_VALID_DNSKEY_FOR_ANY_DS | ||
| 429 | DS02_RRSIG_NOT_VALID_BY_DNSKEY | ||
| 430 | ) | ||
| 431 | ], | ||
| 432 | dnssec03 => [ | ||
| 433 | qw( | ||
| 434 | DS03_ERR_MULT_NSEC3 | ||
| 435 | DS03_ILLEGAL_HASH_ALGO | ||
| 436 | DS03_ILLEGAL_ITERATION_VALUE | ||
| 437 | DS03_ILLEGAL_SALT_LENGTH | ||
| 438 | DS03_INCONSISTENT_HASH_ALGO | ||
| 439 | DS03_INCONSISTENT_ITERATION | ||
| 440 | DS03_INCONSISTENT_NSEC3_FLAGS | ||
| 441 | DS03_INCONSISTENT_SALT_LENGTH | ||
| 442 | DS03_LEGAL_EMPTY_SALT | ||
| 443 | DS03_LEGAL_HASH_ALGO | ||
| 444 | DS03_LEGAL_ITERATION_VALUE | ||
| 445 | DS03_NO_DNSSEC_SUPPORT | ||
| 446 | DS03_NO_NSEC3 | ||
| 447 | DS03_NSEC3_OPT_OUT_DISABLED | ||
| 448 | DS03_NSEC3_OPT_OUT_ENABLED_NON_TLD | ||
| 449 | DS03_NSEC3_OPT_OUT_ENABLED_TLD | ||
| 450 | DS03_SERVER_NO_DNSSEC_SUPPORT | ||
| 451 | DS03_SERVER_NO_NSEC3 | ||
| 452 | DS03_UNASSIGNED_FLAG_USED | ||
| 453 | ) | ||
| 454 | ], | ||
| 455 | dnssec04 => [ | ||
| 456 | qw( | ||
| 457 | RRSIG_EXPIRATION | ||
| 458 | RRSIG_EXPIRED | ||
| 459 | REMAINING_SHORT | ||
| 460 | REMAINING_LONG | ||
| 461 | DURATION_LONG | ||
| 462 | DURATION_OK | ||
| 463 | TEST_CASE_END | ||
| 464 | TEST_CASE_START | ||
| 465 | ) | ||
| 466 | ], | ||
| 467 | dnssec05 => [ | ||
| 468 | qw( | ||
| 469 | DS05_ALGO_DEPRECATED | ||
| 470 | DS05_ALGO_NOT_RECOMMENDED | ||
| 471 | DS05_ALGO_NOT_ZONE_SIGN | ||
| 472 | DS05_ALGO_OK | ||
| 473 | DS05_ALGO_PRIVATE | ||
| 474 | DS05_ALGO_RESERVED | ||
| 475 | DS05_ALGO_UNASSIGNED | ||
| 476 | DS05_NO_RESPONSE | ||
| 477 | DS05_SERVER_NO_DNSSEC | ||
| 478 | DS05_ZONE_NO_DNSSEC | ||
| 479 | ) | ||
| 480 | ], | ||
| 481 | dnssec06 => [ | ||
| 482 | qw( | ||
| 483 | EXTRA_PROCESSING_OK | ||
| 484 | EXTRA_PROCESSING_BROKEN | ||
| 485 | TEST_CASE_END | ||
| 486 | TEST_CASE_START | ||
| 487 | ) | ||
| 488 | ], | ||
| 489 | dnssec07 => [ | ||
| 490 | qw( | ||
| 491 | DS07_DS_FOR_SIGNED_ZONE | ||
| 492 | DS07_DS_ON_PARENT_SERVER | ||
| 493 | DS07_INCONSISTENT_DS | ||
| 494 | DS07_INCONSISTENT_SIGNED | ||
| 495 | DS07_NON_AUTH_RESPONSE_DNSKEY | ||
| 496 | DS07_NOT_SIGNED | ||
| 497 | DS07_NOT_SIGNED_ON_SERVER | ||
| 498 | DS07_NO_DS_ON_PARENT_SERVER | ||
| 499 | DS07_NO_DS_FOR_SIGNED_ZONE | ||
| 500 | DS07_NO_RESPONSE_DNSKEY | ||
| 501 | DS07_SIGNED | ||
| 502 | DS07_SIGNED_ON_SERVER | ||
| 503 | DS07_UNEXP_RCODE_RESP_DNSKEY | ||
| 504 | ) | ||
| 505 | ], | ||
| 506 | dnssec08 => [ | ||
| 507 | qw( | ||
| 508 | DS08_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 509 | DS08_DNSKEY_RRSIG_EXPIRED | ||
| 510 | DS08_DNSKEY_RRSIG_NOT_YET_VALID | ||
| 511 | DS08_MISSING_RRSIG_IN_RESPONSE | ||
| 512 | DS08_NO_MATCHING_DNSKEY | ||
| 513 | DS08_RRSIG_NOT_VALID_BY_DNSKEY | ||
| 514 | ) | ||
| 515 | ], | ||
| 516 | dnssec09 => [ | ||
| 517 | qw( | ||
| 518 | DS09_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 519 | DS09_MISSING_RRSIG_IN_RESPONSE | ||
| 520 | DS09_NO_MATCHING_DNSKEY | ||
| 521 | DS09_RRSIG_NOT_VALID_BY_DNSKEY | ||
| 522 | DS09_SOA_RRSIG_EXPIRED | ||
| 523 | DS09_SOA_RRSIG_NOT_YET_VALID | ||
| 524 | ) | ||
| 525 | ], | ||
| 526 | dnssec10 => [ | ||
| 527 | qw( | ||
| 528 | DS10_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 529 | DS10_ERR_MULT_NSEC | ||
| 530 | DS10_ERR_MULT_NSEC3 | ||
| 531 | DS10_ERR_MULT_NSEC3PARAM | ||
| 532 | DS10_EXPECTED_NSEC_NSEC3_MISSING | ||
| 533 | DS10_HAS_NSEC | ||
| 534 | DS10_HAS_NSEC3 | ||
| 535 | DS10_INCONSISTENT_NSEC | ||
| 536 | DS10_INCONSISTENT_NSEC3 | ||
| 537 | DS10_INCONSISTENT_NSEC_NSEC3 | ||
| 538 | DS10_MIXED_NSEC_NSEC3 | ||
| 539 | DS10_NSEC3PARAM_GIVES_ERR_ANSWER | ||
| 540 | DS10_NSEC3PARAM_MISMATCHES_APEX | ||
| 541 | DS10_NSEC3PARAM_QUERY_RESPONSE_ERR | ||
| 542 | DS10_NSEC3_ERR_TYPE_LIST | ||
| 543 | DS10_NSEC3_MISMATCHES_APEX | ||
| 544 | DS10_NSEC3_MISSING_SIGNATURE | ||
| 545 | DS10_NSEC3_NODATA_MISSING_SOA | ||
| 546 | DS10_NSEC3_NODATA_WRONG_SOA | ||
| 547 | DS10_NSEC3_NO_VERIFIED_SIGNATURE | ||
| 548 | DS10_NSEC3_RRSIG_EXPIRED | ||
| 549 | DS10_NSEC3_RRSIG_NOT_YET_VALID | ||
| 550 | DS10_NSEC3_RRSIG_NO_DNSKEY | ||
| 551 | DS10_NSEC3_RRSIG_VERIFY_ERROR | ||
| 552 | DS10_NSEC_ERR_TYPE_LIST | ||
| 553 | DS10_NSEC_GIVES_ERR_ANSWER | ||
| 554 | DS10_NSEC_MISMATCHES_APEX | ||
| 555 | DS10_NSEC_MISSING_SIGNATURE | ||
| 556 | DS10_NSEC_NODATA_MISSING_SOA | ||
| 557 | DS10_NSEC_NODATA_WRONG_SOA | ||
| 558 | DS10_NSEC_NO_VERIFIED_SIGNATURE | ||
| 559 | DS10_NSEC_QUERY_RESPONSE_ERR | ||
| 560 | DS10_NSEC_RRSIG_EXPIRED | ||
| 561 | DS10_NSEC_RRSIG_NOT_YET_VALID | ||
| 562 | DS10_NSEC_RRSIG_NO_DNSKEY | ||
| 563 | DS10_NSEC_RRSIG_VERIFY_ERROR | ||
| 564 | DS10_SERVER_NO_DNSSEC | ||
| 565 | DS10_ZONE_NO_DNSSEC | ||
| 566 | ) | ||
| 567 | ], | ||
| 568 | dnssec11 => [ | ||
| 569 | qw( | ||
| 570 | DS11_INCONSISTENT_DS | ||
| 571 | DS11_INCONSISTENT_SIGNED_ZONE | ||
| 572 | DS11_UNDETERMINED_DS | ||
| 573 | DS11_UNDETERMINED_SIGNED_ZONE | ||
| 574 | DS11_PARENT_WITHOUT_DS | ||
| 575 | DS11_PARENT_WITH_DS | ||
| 576 | DS11_NS_WITH_SIGNED_ZONE | ||
| 577 | DS11_NS_WITH_UNSIGNED_ZONE | ||
| 578 | DS11_DS_BUT_UNSIGNED_ZONE | ||
| 579 | ), | ||
| 580 | ], | ||
| 581 | dnssec13 => [ | ||
| 582 | qw( | ||
| 583 | DS13_ALGO_NOT_SIGNED_DNSKEY | ||
| 584 | DS13_ALGO_NOT_SIGNED_NS | ||
| 585 | DS13_ALGO_NOT_SIGNED_SOA | ||
| 586 | ), | ||
| 587 | ], | ||
| 588 | dnssec14 => [ | ||
| 589 | qw( | ||
| 590 | NO_RESPONSE | ||
| 591 | NO_RESPONSE_DNSKEY | ||
| 592 | DNSKEY_SMALLER_THAN_REC | ||
| 593 | DNSKEY_TOO_SMALL_FOR_ALGO | ||
| 594 | DNSKEY_TOO_LARGE_FOR_ALGO | ||
| 595 | IPV4_DISABLED | ||
| 596 | IPV6_DISABLED | ||
| 597 | KEY_SIZE_OK | ||
| 598 | TEST_CASE_END | ||
| 599 | TEST_CASE_START | ||
| 600 | ), | ||
| 601 | ], | ||
| 602 | dnssec15 => [ | ||
| 603 | qw( | ||
| 604 | DS15_HAS_CDNSKEY_NO_CDS | ||
| 605 | DS15_HAS_CDS_AND_CDNSKEY | ||
| 606 | DS15_HAS_CDS_NO_CDNSKEY | ||
| 607 | DS15_INCONSISTENT_CDNSKEY | ||
| 608 | DS15_INCONSISTENT_CDS | ||
| 609 | DS15_MISMATCH_CDS_CDNSKEY | ||
| 610 | DS15_NO_CDS_CDNSKEY | ||
| 611 | ), | ||
| 612 | ], | ||
| 613 | dnssec16 => [ | ||
| 614 | qw( | ||
| 615 | DS16_CDS_INVALID_RRSIG | ||
| 616 | DS16_CDS_MATCHES_NON_SEP_DNSKEY | ||
| 617 | DS16_CDS_MATCHES_NON_ZONE_DNSKEY | ||
| 618 | DS16_CDS_MATCHES_NO_DNSKEY | ||
| 619 | DS16_CDS_NOT_SIGNED_BY_CDS | ||
| 620 | DS16_CDS_SIGNED_BY_UNKNOWN_DNSKEY | ||
| 621 | DS16_CDS_UNSIGNED | ||
| 622 | DS16_CDS_WITHOUT_DNSKEY | ||
| 623 | DS16_DELETE_CDS | ||
| 624 | DS16_DNSKEY_NOT_SIGNED_BY_CDS | ||
| 625 | DS16_MIXED_DELETE_CDS | ||
| 626 | ), | ||
| 627 | ], | ||
| 628 | dnssec17 => [ | ||
| 629 | qw( | ||
| 630 | DS17_CDNSKEY_INVALID_RRSIG | ||
| 631 | DS17_CDNSKEY_IS_NON_SEP | ||
| 632 | DS17_CDNSKEY_IS_NON_ZONE | ||
| 633 | DS17_CDNSKEY_MATCHES_NO_DNSKEY | ||
| 634 | DS17_CDNSKEY_NOT_SIGNED_BY_CDNSKEY | ||
| 635 | DS17_CDNSKEY_SIGNED_BY_UNKNOWN_DNSKEY | ||
| 636 | DS17_CDNSKEY_UNSIGNED | ||
| 637 | DS17_CDNSKEY_WITHOUT_DNSKEY | ||
| 638 | DS17_DELETE_CDNSKEY | ||
| 639 | DS17_DNSKEY_NOT_SIGNED_BY_CDNSKEY | ||
| 640 | DS17_MIXED_DELETE_CDNSKEY | ||
| 641 | ), | ||
| 642 | ], | ||
| 643 | dnssec18 => [ | ||
| 644 | qw( | ||
| 645 | DS18_NO_MATCH_CDS_RRSIG_DS | ||
| 646 | DS18_NO_MATCH_CDNSKEY_RRSIG_DS | ||
| 647 | ), | ||
| 648 | ], | ||
| 649 | }; | ||
| 650 | } ## end sub metadata | ||
| 651 | |||
| 652 | Readonly my %TAG_DESCRIPTIONS => ( | ||
| 653 | DNSSEC01 => sub { | ||
| 654 | __x # DNSSEC:DNSSEC01 | ||
| 655 | "Legal values for the DS hash digest algorithm"; | ||
| 656 | }, | ||
| 657 | DNSSEC02 => sub { | ||
| 658 | __x # DNSSEC:DNSSEC02 | ||
| 659 | "DS must match a valid DNSKEY in the child zone"; | ||
| 660 | }, | ||
| 661 | DNSSEC03 => sub { | ||
| 662 | __x # DNSSEC:DNSSEC03 | ||
| 663 | "Verify NSEC3 parameters"; | ||
| 664 | }, | ||
| 665 | DNSSEC04 => sub { | ||
| 666 | __x # DNSSEC:DNSSEC04 | ||
| 667 | "Check for too short or too long RRSIG lifetimes"; | ||
| 668 | }, | ||
| 669 | DNSSEC05 => sub { | ||
| 670 | __x # DNSSEC:DNSSEC05 | ||
| 671 | "Check for invalid DNSKEY algorithms"; | ||
| 672 | }, | ||
| 673 | DNSSEC06 => sub { | ||
| 674 | __x # DNSSEC:DNSSEC06 | ||
| 675 | "Verify DNSSEC additional processing"; | ||
| 676 | }, | ||
| 677 | DNSSEC07 => sub { | ||
| 678 | __x # DNSSEC:DNSSEC07 | ||
| 679 | "DNSSEC signed zone and DS in parent for signed zone"; | ||
| 680 | }, | ||
| 681 | DNSSEC08 => sub { | ||
| 682 | __x # DNSSEC:DNSSEC08 | ||
| 683 | "Valid RRSIG for DNSKEY"; | ||
| 684 | }, | ||
| 685 | DNSSEC09 => sub { | ||
| 686 | __x # DNSSEC:DNSSEC09 | ||
| 687 | "RRSIG(SOA) must be valid and created by a valid DNSKEY"; | ||
| 688 | }, | ||
| 689 | DNSSEC10 => sub { | ||
| 690 | __x # DNSSEC:DNSSEC10 | ||
| 691 | "Zone contains NSEC or NSEC3 records"; | ||
| 692 | }, | ||
| 693 | DNSSEC11 => sub { | ||
| 694 | __x # DNSSEC:DNSSEC11 | ||
| 695 | "DS in delegation requires signed zone"; | ||
| 696 | }, | ||
| 697 | DNSSEC12 => sub { | ||
| 698 | __x # DNSSEC:DNSSEC12 | ||
| 699 | "Test for DNSSEC Algorithm Completeness"; | ||
| 700 | }, | ||
| 701 | DNSSEC13 => sub { | ||
| 702 | __x # DNSSEC:DNSSEC13 | ||
| 703 | "All DNSKEY algorithms used to sign the zone"; | ||
| 704 | }, | ||
| 705 | DNSSEC14 => sub { | ||
| 706 | __x # DNSSEC:DNSSEC14 | ||
| 707 | "Check for valid RSA DNSKEY key size"; | ||
| 708 | }, | ||
| 709 | DNSSEC15 => sub { | ||
| 710 | __x # DNSSEC:DNSSEC15 | ||
| 711 | "Existence of CDS and CDNSKEY"; | ||
| 712 | }, | ||
| 713 | DNSSEC16 => sub { | ||
| 714 | __x # DNSSEC:DNSSEC16 | ||
| 715 | "Validate CDS"; | ||
| 716 | }, | ||
| 717 | DNSSEC17 => sub { | ||
| 718 | __x # DNSSEC:DNSSEC17 | ||
| 719 | "Validate CDNSKEY"; | ||
| 720 | }, | ||
| 721 | DNSSEC18 => sub { | ||
| 722 | __x # DNSSEC:DNSSEC18 | ||
| 723 | "Validate trust from DS to CDS and CDNSKEY"; | ||
| 724 | }, | ||
| 725 | DNSKEY_SMALLER_THAN_REC => sub { | ||
| 726 | __x # DNSSEC:DNSKEY_SMALLER_THAN_REC | ||
| 727 | 'DNSKEY with tag {keytag} and using algorithm {algo_num} ' | ||
| 728 | . '({algo_descr}) has a size ({keysize}) smaller than the ' | ||
| 729 | . 'recommended one ({keysizerec}).', | ||
| 730 | @_; | ||
| 731 | }, | ||
| 732 | DNSKEY_TOO_SMALL_FOR_ALGO => sub { | ||
| 733 | __x # DNSSEC:DNSKEY_TOO_SMALL_FOR_ALGO | ||
| 734 | 'DNSKEY with tag {keytag} and using algorithm {algo_num} ' | ||
| 735 | . '({algo_descr}) has a size ({keysize}) smaller than the minimum ' | ||
| 736 | . 'one ({keysizemin}).', | ||
| 737 | @_; | ||
| 738 | }, | ||
| 739 | DNSKEY_TOO_LARGE_FOR_ALGO => sub { | ||
| 740 | __x # DNSSEC:DNSKEY_TOO_LARGE_FOR_ALGO | ||
| 741 | 'DNSKEY with tag {keytag} and using algorithm {algo_num} ' | ||
| 742 | . '({algo_descr}) has a size ({keysize}) larger than the maximum one ' | ||
| 743 | . '({keysizemax}).', | ||
| 744 | @_; | ||
| 745 | }, | ||
| 746 | DS01_DS_ALGO_2_MISSING => sub { | ||
| 747 | __x # DNSSEC:DS01_DS_ALGO_2_MISSING | ||
| 748 | 'There is a DS record with keytag {keytag}. A DS record using digest algorithm 2 (SHA-256) ' | ||
| 749 | . 'is missing. Fetched from parent name servers "{ns_list}".', | ||
| 750 | @_; | ||
| 751 | }, | ||
| 752 | DS01_DS_ALGO_DEPRECATED => sub { | ||
| 753 | __x # DNSSEC:DS01_DS_ALGO_DEPRECATED | ||
| 754 | 'The DS record with keytag {keytag} uses a deprecated digest algorithm {ds_algo_num} ' | ||
| 755 | . '({ds_algo_descr}). Fetched from parent name servers "{ns_list}".', | ||
| 756 | @_; | ||
| 757 | }, | ||
| 758 | DS01_DS_ALGO_NOT_DS => sub { | ||
| 759 | __x # DNSSEC:DS01_DS_ALGO_NOT_DS | ||
| 760 | 'The DS record with keytag {keytag} uses a digest algorithm {ds_algo_num} ({ds_algo_descr}) ' | ||
| 761 | . 'not meant for DS records. Fetched from parent name servers "{ns_list}".', | ||
| 762 | @_; | ||
| 763 | }, | ||
| 764 | DS01_DS_ALGO_PRIVATE => sub { | ||
| 765 | __x # DNSSEC:DS01_DS_ALGO_PRIVATE | ||
| 766 | 'The DS record with keytag {keytag} uses a digest algorithm {ds_algo_num} for private use. ' | ||
| 767 | . 'Fetched from parent name servers "{ns_list}".', | ||
| 768 | @_; | ||
| 769 | }, | ||
| 770 | DS01_DS_ALGO_RESERVED => sub { | ||
| 771 | __x # DNSSEC:DS01_DS_ALGO_RESERVED | ||
| 772 | 'The DS record with keytag {keytag} uses a reserved digest algorithm {ds_algo_num} on name ' | ||
| 773 | . 'servers "{ns_list}".', | ||
| 774 | @_; | ||
| 775 | }, | ||
| 776 | DS01_DS_ALGO_UNASSIGNED => sub { | ||
| 777 | __x # DNSSEC:DS01_DS_ALGO_UNASSIGNED | ||
| 778 | 'The DS record with keytag {keytag} uses an unassigned digest algorithm {ds_algo_num} on parent ' | ||
| 779 | . 'name servers "{ns_list}".', | ||
| 780 | @_; | ||
| 781 | }, | ||
| 782 | DS01_NO_RESPONSE => sub { | ||
| 783 | __x # DNSSEC:DS01_NO_RESPONSE | ||
| 784 | 'No response or error in response from all parent name servers on the DS query. Name servers ' | ||
| 785 | . 'are "{ns_list}".', | ||
| 786 | @_; | ||
| 787 | }, | ||
| 788 | DS01_PARENT_SERVER_NO_DS => sub { | ||
| 789 | __x # DNSSEC:DS01_PARENT_SERVER_NO_DS | ||
| 790 | 'The following name servers do not provide DS record or have not been properly configured. ' | ||
| 791 | . 'Fetched from parent name servers "{ns_list}".', | ||
| 792 | @_; | ||
| 793 | }, | ||
| 794 | DS01_PARENT_ZONE_NO_DS => sub { | ||
| 795 | __x # DNSSEC:DS01_PARENT_ZONE_NO_DS | ||
| 796 | 'The parent zone provides no DS records for the child zone. Fetched from parent name ' | ||
| 797 | . 'servers "{ns_list}".', | ||
| 798 | @_; | ||
| 799 | }, | ||
| 800 | DS01_ROOT_N_NO_UNDEL_DS => sub { | ||
| 801 | __x # DNSSEC:DS01_ROOT_N_NO_UNDEL_DS | ||
| 802 | 'Tested zone is the root zone, but no undelegated DS has been provided. DS is not tested.', | ||
| 803 | @_; | ||
| 804 | }, | ||
| 805 | DS01_UNDEL_N_NO_UNDEL_DS => sub { | ||
| 806 | __x # DNSSEC:DS01_UNDEL_N_NO_UNDEL_DS | ||
| 807 | 'Tested zone is undelegated, but no undelegated DS has been provided. DS is not tested.', | ||
| 808 | @_; | ||
| 809 | }, | ||
| 810 | DS02_ALGO_NOT_SUPPORTED_BY_ZM => sub { | ||
| 811 | __x # DNSSEC:DS02_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 812 | 'DNSKEY with tag {keytag} uses unsupported algorithm {algo_num} ' | ||
| 813 | . '({algo_mnemo}) by this installation of Zonemaster. Fetched from ' | ||
| 814 | . 'the nameservers with IP addresses "{ns_ip_list}".', | ||
| 815 | @_; | ||
| 816 | }, | ||
| 817 | DS02_DNSKEY_NOT_FOR_ZONE_SIGNING => sub { | ||
| 818 | __x # DNSSEC:DS02_DNSKEY_NOT_FOR_ZONE_SIGNING | ||
| 819 | 'Flags field of DNSKEY record with tag {keytag} has not ZONE bit set ' | ||
| 820 | . 'although DS with same tag is present in parent. Fetched from ' | ||
| 821 | . 'the nameservers with IP addresses "{ns_ip_list}".', | ||
| 822 | @_; | ||
| 823 | }, | ||
| 824 | DS02_DNSKEY_NOT_SEP => sub { | ||
| 825 | __x # DNSSEC:DS02_DNSKEY_NOT_SEP | ||
| 826 | 'Flags field of DNSKEY record with tag {keytag} has not SEP bit set ' | ||
| 827 | . 'although DS with same tag is present in parent. Fetched from ' | ||
| 828 | . 'the nameservers with IP addresses "{ns_ip_list}".', | ||
| 829 | @_; | ||
| 830 | }, | ||
| 831 | DS02_DNSKEY_NOT_SIGNED_BY_ANY_DS => sub { | ||
| 832 | __x # DNSSEC:DS02_DNSKEY_NOT_SIGNED_BY_ANY_DS | ||
| 833 | 'The DNSKEY RRset has not been signed by any DNSKEY matched by a DS record. ' | ||
| 834 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 835 | @_; | ||
| 836 | }, | ||
| 837 | DS02_NO_DNSKEY_FOR_DS => sub { | ||
| 838 | __x # DNSSEC:DS02_NO_DNSKEY_FOR_DS | ||
| 839 | 'The DNSKEY record with tag {keytag} that the DS refers to does not ' | ||
| 840 | . 'exist in the DNSKEY RRset. Fetched from the nameservers with IP ' | ||
| 841 | . '"{ns_ip_list}".', | ||
| 842 | @_; | ||
| 843 | }, | ||
| 844 | DS02_NO_MATCHING_DNSKEY_RRSIG => sub { | ||
| 845 | __x # DNSSEC:DS02_NO_MATCHING_DNSKEY_RRSIG | ||
| 846 | 'The DNSKEY RRset is not signed by the DNSKEY with tag {keytag} that ' | ||
| 847 | . 'the DS record refers to. Fetched from the nameservers with IP ' | ||
| 848 | . '"{ns_ip_list}".', | ||
| 849 | @_; | ||
| 850 | }, | ||
| 851 | DS02_NO_MATCH_DS_DNSKEY => sub { | ||
| 852 | __x # DNSSEC:DS02_NO_MATCH_DS_DNSKEY | ||
| 853 | 'The DS record does not match the DNSKEY with tag {keytag} by algorithm ' | ||
| 854 | . 'or digest. Fetched from the nameservers with IP "{ns_ip_list}".', | ||
| 855 | @_; | ||
| 856 | }, | ||
| 857 | DS02_NO_VALID_DNSKEY_FOR_ANY_DS => sub { | ||
| 858 | __x # DNSSEC:DS02_NO_VALID_DNSKEY_FOR_ANY_DS | ||
| 859 | 'There is no valid DNSKEY matched by any of the DS records. ' | ||
| 860 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 861 | @_; | ||
| 862 | }, | ||
| 863 | DS02_RRSIG_NOT_VALID_BY_DNSKEY => sub { | ||
| 864 | __x # DNSSEC:DS02_RRSIG_NOT_VALID_BY_DNSKEY | ||
| 865 | 'The DNSKEY RRset is signed with an RRSIG with tag {keytag} which cannot ' | ||
| 866 | . 'be validated by the matching DNSKEY. Fetched from the nameservers with IP ' | ||
| 867 | . 'addresses "{ns_ip_list}".', | ||
| 868 | @_; | ||
| 869 | }, | ||
| 870 | DS03_ERROR_RESPONSE_NSEC_QUERY => sub { | ||
| 871 | __x # DNSSEC:DS03_ERROR_RESPONSE_NSEC_QUERY | ||
| 872 | 'The following servers give erroneous response to NSEC query. Fetched from name servers "{ns_list}".', @_; | ||
| 873 | }, | ||
| 874 | DS03_ERR_MULT_NSEC3 => sub { | ||
| 875 | __x # DNSSEC:DS03_ERR_MULT_NSEC3 | ||
| 876 | 'Multiple NSEC3 records when one is expected. Fetched from name servers "{ns_list}".', @_; | ||
| 877 | }, | ||
| 878 | DS03_ILLEGAL_HASH_ALGO => sub { | ||
| 879 | __x # DNSSEC:DS03_ILLEGAL_HASH_ALGO | ||
| 880 | 'The following servers respond with an illegal hash algorithm for NSEC3 ({algo_num}). ' | ||
| 881 | . 'Fetched from name servers "{ns_list}".', | ||
| 882 | @_; | ||
| 883 | }, | ||
| 884 | DS03_ILLEGAL_ITERATION_VALUE => sub { | ||
| 885 | __x # DNSSEC:DS03_ILLEGAL_ITERATION_VALUE | ||
| 886 | 'The following servers respond with the NSEC3 iteration value {int}. ' | ||
| 887 | . 'The recommended practice is to set this value to 0. ' | ||
| 888 | . 'Fetched from name servers "{ns_list}".', | ||
| 889 | @_; | ||
| 890 | }, | ||
| 891 | DS03_ILLEGAL_SALT_LENGTH => sub { | ||
| 892 | __x # DNSSEC:DS03_ILLEGAL_SALT_LENGTH | ||
| 893 | 'The following servers respond with a non-empty salt in NSEC3 ({int} octets). ' | ||
| 894 | . 'The recommended practice is to use an empty salt. ' | ||
| 895 | . 'Fetched from name servers "{ns_list}".', | ||
| 896 | @_; | ||
| 897 | }, | ||
| 898 | DS03_INCONSISTENT_HASH_ALGO => sub { | ||
| 899 | __x # DNSSEC:DS03_INCONSISTENT_HASH_ALGO | ||
| 900 | 'Inconsistent hash algorithm in NSEC3 in responses for the child zone from different name servers.', @_; | ||
| 901 | }, | ||
| 902 | DS03_INCONSISTENT_ITERATION => sub { | ||
| 903 | __x # DNSSEC:DS03_INCONSISTENT_ITERATION | ||
| 904 | 'Inconsistent NSEC3 iteration value in responses for the child zone from different name servers.', @_; | ||
| 905 | }, | ||
| 906 | DS03_INCONSISTENT_NSEC3_FLAGS => sub { | ||
| 907 | __x # DNSSEC:DS03_INCONSISTENT_NSEC3_FLAGS | ||
| 908 | 'Inconsistent NSEC3 flag list in responses for the child zone from different name servers.', @_; | ||
| 909 | }, | ||
| 910 | DS03_INCONSISTENT_SALT_LENGTH => sub { | ||
| 911 | __x # DNSSEC:DS03_INCONSISTENT_SALT_LENGTH | ||
| 912 | 'Inconsistent salt length in NSEC3 in responses for the child zone from different name servers.', @_; | ||
| 913 | }, | ||
| 914 | DS03_LEGAL_EMPTY_SALT => sub { | ||
| 915 | __x # DNSSEC:DS03_LEGAL_EMPTY_SALT | ||
| 916 | 'The following servers respond with a legal empty salt in NSEC3. ' | ||
| 917 | . 'Fetched from name servers "{ns_list}".', | ||
| 918 | @_; | ||
| 919 | }, | ||
| 920 | DS03_LEGAL_HASH_ALGO => sub { | ||
| 921 | __x # DNSSEC:DS03_LEGAL_HASH_ALGO | ||
| 922 | 'The following servers respond with a legal hash algorithm in NSEC3. ' | ||
| 923 | . 'Fetched from name servers "{ns_list}".', | ||
| 924 | @_; | ||
| 925 | }, | ||
| 926 | DS03_LEGAL_ITERATION_VALUE => sub { | ||
| 927 | __x # DNSSEC:DS03_LEGAL_ITERATION_VALUE | ||
| 928 | 'The following servers respond with NSEC3 iteration value set to zero (as recommended). ' | ||
| 929 | . 'Fetched from name servers "{ns_list}".', | ||
| 930 | @_; | ||
| 931 | }, | ||
| 932 | DS03_NO_DNSSEC_SUPPORT => sub { | ||
| 933 | __x # DNSSEC:DS03_NO_DNSSEC_SUPPORT | ||
| 934 | 'The zone is not DNSSEC signed or not properly DNSSEC signed. Testing for NSEC3 has been skipped. ' | ||
| 935 | . 'Fetched from name servers "{ns_list}".', | ||
| 936 | @_; | ||
| 937 | }, | ||
| 938 | DS03_NO_NSEC3 => sub { | ||
| 939 | __x # DNSSEC:DS03_NO_NSEC3 | ||
| 940 | 'The zone does not use NSEC3. Testing for NSEC3 has been skipped. ' | ||
| 941 | . 'Fetched from name servers "{ns_list}".', | ||
| 942 | @_; | ||
| 943 | }, | ||
| 944 | DS03_NO_RESPONSE_NSEC_QUERY => sub { | ||
| 945 | __x # DNSSEC:DS03_NO_RESPONSE_NSEC_QUERY | ||
| 946 | 'The following servers do not respond to NSEC query. Fetched from name servers "{ns_list}".', @_; | ||
| 947 | }, | ||
| 948 | DS03_NSEC3_OPT_OUT_DISABLED => sub { | ||
| 949 | __x # DNSSEC:DS03_NSEC3_OPT_OUT_DISABLED | ||
| 950 | 'The following servers respond with NSEC3 opt-out disabled (as recommended). ' | ||
| 951 | . 'Fetched from name servers "{ns_list}".', | ||
| 952 | @_; | ||
| 953 | }, | ||
| 954 | DS03_NSEC3_OPT_OUT_ENABLED_NON_TLD => sub { | ||
| 955 | __x # DNSSEC:DS03_NSEC3_OPT_OUT_ENABLED_NON_TLD | ||
| 956 | 'The following servers respond with NSEC3 opt-out enabled. ' | ||
| 957 | . 'The recommended practice is to disable opt-out. ' | ||
| 958 | . 'Fetched from name servers "{ns_list}".', | ||
| 959 | @_; | ||
| 960 | }, | ||
| 961 | DS03_NSEC3_OPT_OUT_ENABLED_TLD => sub { | ||
| 962 | __x # DNSSEC:DS03_NSEC3_OPT_OUT_ENABLED_TLD | ||
| 963 | 'The following servers respond with NSEC3 opt-out enabled. ' | ||
| 964 | . 'Fetched from name servers "{ns_list}".', | ||
| 965 | @_; | ||
| 966 | }, | ||
| 967 | DS03_SERVER_NO_DNSSEC_SUPPORT => sub { | ||
| 968 | __x # DNSSEC:DS03_SERVER_NO_DNSSEC_SUPPORT | ||
| 969 | 'The following name servers do not support DNSSEC or have not been properly configured. ' | ||
| 970 | . 'Testing for NSEC3 has been skipped on those servers. ' | ||
| 971 | . 'Fetched from name servers "{ns_list}".', | ||
| 972 | @_; | ||
| 973 | }, | ||
| 974 | DS03_SERVER_NO_NSEC3 => sub { | ||
| 975 | __x # DNSSEC:DS03_SERVER_NO_NSEC3 | ||
| 976 | 'The following name servers do not use NSEC3, but others do. ' | ||
| 977 | . 'Testing for NSEC3 has been skipped on the following servers. ' | ||
| 978 | . 'Fetched from name servers "{ns_list}".', | ||
| 979 | @_; | ||
| 980 | }, | ||
| 981 | DS03_UNASSIGNED_FLAG_USED => sub { | ||
| 982 | __x # DNSSEC:DS03_UNASSIGNED_FLAG_USED | ||
| 983 | 'The following servers respond with an NSEC3 record where an unassigned flag is used (bit {int}). ' | ||
| 984 | . 'Fetched from name servers "{ns_list}".', | ||
| 985 | @_; | ||
| 986 | }, | ||
| 987 | DS05_ALGO_DEPRECATED => sub { | ||
| 988 | __x # DNSSEC:DS05_ALGO_DEPRECATED | ||
| 989 | 'The DNSKEY with tag {keytag} uses deprecated algorithm number {algo_num} ("{algo_descr}", {algo_mnemo}). ' | ||
| 990 | . 'Fetched from name servers "{ns_list}".', | ||
| 991 | @_; | ||
| 992 | }, | ||
| 993 | DS05_ALGO_NOT_RECOMMENDED => sub { | ||
| 994 | __x # DNSSEC:DS05_ALGO_NOT_RECOMMENDED | ||
| 995 | 'The DNSKEY with tag {keytag} uses unrecommended algorithm number {algo_num} ("{algo_descr}", {algo_mnemo}). ' | ||
| 996 | . 'Fetched from name servers "{ns_list}".', | ||
| 997 | @_; | ||
| 998 | }, | ||
| 999 | DS05_ALGO_NOT_ZONE_SIGN => sub { | ||
| 1000 | __x # DNSSEC:DS05_ALGO_NOT_ZONE_SIGN | ||
| 1001 | 'The DNSKEY with tag {keytag} uses algorithm number {algo_num} ("{algo_descr}", {algo_mnemo}) which is ' | ||
| 1002 | . 'not meant for zone signing. Fetched from name servers "{ns_list}".', | ||
| 1003 | @_; | ||
| 1004 | }, | ||
| 1005 | DS05_ALGO_OK => sub { | ||
| 1006 | __x # DNSSEC:DS05_ALGO_OK | ||
| 1007 | 'The DNSKEY with tag {keytag} uses algorithm number {algo_num} ("{algo_descr}", {algo_mnemo}). ' | ||
| 1008 | . 'Fetched from name servers "{ns_list}".', | ||
| 1009 | @_; | ||
| 1010 | }, | ||
| 1011 | DS05_ALGO_PRIVATE => sub { | ||
| 1012 | __x # DNSSEC:DS05_ALGO_PRIVATE | ||
| 1013 | 'The DNSKEY with tag {keytag} uses algorithm number {algo_num} which is ' | ||
| 1014 | . 'reserved for private use. Fetched from name servers "{ns_list}".', | ||
| 1015 | @_; | ||
| 1016 | }, | ||
| 1017 | DS05_ALGO_RESERVED => sub { | ||
| 1018 | __x # DNSSEC:DS05_ALGO_RESERVED | ||
| 1019 | 'The DNSKEY with tag {keytag} uses reserved algorithm number {algo_num}. ' | ||
| 1020 | . 'Fetched from name servers "{ns_list}".', | ||
| 1021 | @_; | ||
| 1022 | }, | ||
| 1023 | DS05_ALGO_UNASSIGNED => sub { | ||
| 1024 | __x # DNSSEC:DS05_ALGO_UNASSIGNED | ||
| 1025 | 'The DNSKEY with tag {keytag} uses unassigned algorithm number {algo_num}. ' | ||
| 1026 | . 'Fetched from name servers "{ns_list}".', | ||
| 1027 | @_; | ||
| 1028 | }, | ||
| 1029 | DS05_NO_RESPONSE => sub { | ||
| 1030 | __x # DNSSEC:DS05_NO_RESPONSE | ||
| 1031 | 'No response or error in response from all name servers on the DNSKEY query. Failing name servers: "{ns_list}".', | ||
| 1032 | @_; | ||
| 1033 | }, | ||
| 1034 | DS05_SERVER_NO_DNSSEC => sub { | ||
| 1035 | __x # DNSSEC:DS05_SERVER_NO_DNSSEC | ||
| 1036 | 'Some name servers do not support DNSSEC or have not been properly configured. DNSKEY cannot be tested on ' | ||
| 1037 | . 'those servers. Fetched from name servers "{ns_list}".', | ||
| 1038 | @_; | ||
| 1039 | }, | ||
| 1040 | DS05_ZONE_NO_DNSSEC => sub { | ||
| 1041 | __x # DNSSEC:DS05_ZONE_NO_DNSSEC | ||
| 1042 | 'The zone is not DNSSEC signed or not properly DNSSEC signed. DNSKEY cannot be tested. Fetched from name ' | ||
| 1043 | . 'servers "{ns_list}".', | ||
| 1044 | @_; | ||
| 1045 | }, | ||
| 1046 | DS07_DS_FOR_SIGNED_ZONE => sub { | ||
| 1047 | __x # DNSSEC:DS07_DS_FOR_SIGNED_ZONE | ||
| 1048 | 'The parent zone has DS record or records for the signed child zone.'; | ||
| 1049 | }, | ||
| 1050 | DS07_DS_ON_PARENT_SERVER => sub { | ||
| 1051 | __x # DNSSEC:DS07_DS_ON_PARENT_SERVER | ||
| 1052 | 'The following parent name servers respond with DS record or records for the child ' | ||
| 1053 | . 'zone. Name servers: "{ns_list}".', | ||
| 1054 | @_; | ||
| 1055 | }, | ||
| 1056 | DS07_INCONSISTENT_DS => sub { | ||
| 1057 | __x # DNSSEC:DS07_INCONSISTENT_DS | ||
| 1058 | 'Inconsistent responses from parent name servers. Some include DS, others do not.'; | ||
| 1059 | }, | ||
| 1060 | DS07_INCONSISTENT_SIGNED => sub { | ||
| 1061 | __x # DNSSEC:DS07_INCONSISTENT_SIGNED | ||
| 1062 | 'Inconsistent responses from name servers. Some include signed responses, others do not.'; | ||
| 1063 | }, | ||
| 1064 | DS07_NON_AUTH_RESPONSE_DNSKEY => sub { | ||
| 1065 | __x # DNSSEC:DS07_NON_AUTH_RESPONSE_DNSKEY | ||
| 1066 | 'The following name servers give a non authoritative response on DNSKEY query with DO bit set. ' | ||
| 1067 | . 'Name servers: "{ns_list}".', | ||
| 1068 | @_; | ||
| 1069 | }, | ||
| 1070 | DS07_NOT_SIGNED => sub { | ||
| 1071 | __x # DNSSEC:DS07_NOT_SIGNED | ||
| 1072 | 'The zone is not signed.'; | ||
| 1073 | }, | ||
| 1074 | DS07_NOT_SIGNED_ON_SERVER => sub { | ||
| 1075 | __x # DNSSEC:DS07_NOT_SIGNED_ON_SERVER | ||
| 1076 | 'The following name servers respond with no DNSKEY (unsigned child zone). ' | ||
| 1077 | . 'Name servers: "{ns_list}".', | ||
| 1078 | @_; | ||
| 1079 | }, | ||
| 1080 | DS07_NO_DS_ON_PARENT_SERVER => sub { | ||
| 1081 | __x # DNSSEC:DS07_NO_DS_ON_PARENT_SERVER | ||
| 1082 | 'The following parent name servers respond without DS record for the child zone. ' | ||
| 1083 | . 'Name servers: "{ns_list}".', | ||
| 1084 | @_; | ||
| 1085 | }, | ||
| 1086 | DS07_NO_DS_FOR_SIGNED_ZONE => sub { | ||
| 1087 | __x # DNSSEC:DS07_NO_DS_FOR_SIGNED_ZONE | ||
| 1088 | 'The parent zone has no DS record for the signed child zone.'; | ||
| 1089 | }, | ||
| 1090 | DS07_NO_RESPONSE_DNSKEY => sub { | ||
| 1091 | __x # DNSSEC:DS07_NO_RESPONSE_DNSKEY | ||
| 1092 | 'The following name servers do not respond on DNSKEY query with DO bit set. ' | ||
| 1093 | . 'Name servers: "{ns_list}".', | ||
| 1094 | @_; | ||
| 1095 | }, | ||
| 1096 | DS07_SIGNED => sub { | ||
| 1097 | __x # DNSSEC:DS07_SIGNED | ||
| 1098 | 'The zone is signed.'; | ||
| 1099 | }, | ||
| 1100 | DS07_SIGNED_ON_SERVER => sub { | ||
| 1101 | __x # DNSSEC:DS07_SIGNED_ON_SERVER | ||
| 1102 | 'The following name servers respond with DNSKEY (signed child zone). ' | ||
| 1103 | . 'Name servers: "{ns_list}".', | ||
| 1104 | @_; | ||
| 1105 | }, | ||
| 1106 | DS07_UNEXP_RCODE_RESP_DNSKEY => sub { | ||
| 1107 | __x # DNSSEC:DS07_UNEXP_RCODE_RESP_DNSKEY | ||
| 1108 | 'The following name servers respond with RCODE "{rcode}" instead of expected "NOERROR" ' | ||
| 1109 | . 'on DNSKEY query with DO bit set. Name servers: "{ns_list}".', | ||
| 1110 | @_; | ||
| 1111 | }, | ||
| 1112 | DS08_ALGO_NOT_SUPPORTED_BY_ZM => sub { | ||
| 1113 | __x # DNSSEC:DS08_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 1114 | 'DNSKEY with tag {keytag} uses unsupported algorithm {algo_num} ' | ||
| 1115 | . '({algo_mnemo}) by this installation of Zonemaster. Fetched from ' | ||
| 1116 | . 'the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1117 | @_; | ||
| 1118 | }, | ||
| 1119 | DS08_DNSKEY_RRSIG_EXPIRED => sub { | ||
| 1120 | __x # DNSSEC:DS08_DNSKEY_RRSIG_EXPIRED | ||
| 1121 | 'RRSIG with keytag {keytag} and covering type DNSKEY has already expired. ' | ||
| 1122 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1123 | @_; | ||
| 1124 | }, | ||
| 1125 | DS08_DNSKEY_RRSIG_NOT_YET_VALID => sub { | ||
| 1126 | __x # DNSSEC:DS08_DNSKEY_RRSIG_NOT_YET_VALID | ||
| 1127 | 'RRSIG with keytag {keytag} and covering type DNSKEY has inception date in ' | ||
| 1128 | . 'the future. Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1129 | @_; | ||
| 1130 | }, | ||
| 1131 | DS08_MISSING_RRSIG_IN_RESPONSE => sub { | ||
| 1132 | __x # DNSSEC:DS08_MISSING_RRSIG_IN_RESPONSE | ||
| 1133 | 'The DNSKEY RRset is not signed, which is against expectation. Fetched ' | ||
| 1134 | . 'from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1135 | @_; | ||
| 1136 | }, | ||
| 1137 | DS08_NO_MATCHING_DNSKEY => sub { | ||
| 1138 | __x # DNSSEC:DS08_NO_MATCHING_DNSKEY | ||
| 1139 | 'The DNSKEY RRset is signed with an RRSIG with tag {keytag} which does ' | ||
| 1140 | . 'not match any DNSKEY record. Fetched from the nameservers with IP ' | ||
| 1141 | . 'addresses "{ns_ip_list}".', | ||
| 1142 | @_; | ||
| 1143 | }, | ||
| 1144 | DS08_RRSIG_NOT_VALID_BY_DNSKEY => sub { | ||
| 1145 | __x # DNSSEC:DS08_RRSIG_NOT_VALID_BY_DNSKEY | ||
| 1146 | 'The DNSKEY RRset is signed with an RRSIG with tag {keytag} which cannot ' | ||
| 1147 | . 'be validated by the matching DNSKEY. Fetched from the nameservers with IP ' | ||
| 1148 | . 'addresses "{ns_ip_list}".', | ||
| 1149 | @_; | ||
| 1150 | }, | ||
| 1151 | DS09_ALGO_NOT_SUPPORTED_BY_ZM => sub { | ||
| 1152 | __x # DNSSEC:DS09_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 1153 | 'DNSKEY with tag {keytag} uses unsupported algorithm {algo_num} ' | ||
| 1154 | . '({algo_mnemo}) by this installation of Zonemaster. Fetched from ' | ||
| 1155 | . 'the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1156 | @_; | ||
| 1157 | }, | ||
| 1158 | DS09_MISSING_RRSIG_IN_RESPONSE => sub { | ||
| 1159 | __x # DNSSEC:DS09_MISSING_RRSIG_IN_RESPONSE | ||
| 1160 | 'The SOA RRset is not signed, which is against expectation. Fetched ' | ||
| 1161 | . 'from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1162 | @_; | ||
| 1163 | }, | ||
| 1164 | DS09_NO_MATCHING_DNSKEY => sub { | ||
| 1165 | __x # DNSSEC:DS09_NO_MATCHING_DNSKEY | ||
| 1166 | 'The SOA RRset is signed with an RRSIG with tag {keytag} which does ' | ||
| 1167 | . 'not match any DNSKEY record. Fetched from the nameservers with IP ' | ||
| 1168 | . 'addresses "{ns_ip_list}".', | ||
| 1169 | @_; | ||
| 1170 | }, | ||
| 1171 | DS09_RRSIG_NOT_VALID_BY_DNSKEY => sub { | ||
| 1172 | __x # DNSSEC:DS09_RRSIG_NOT_VALID_BY_DNSKEY | ||
| 1173 | 'The SOA RRset is signed with an RRSIG with tag {keytag} which cannot ' | ||
| 1174 | . 'be validated by the matching DNSKEY. Fetched from the nameservers with IP ' | ||
| 1175 | . 'addresses "{ns_ip_list}".', | ||
| 1176 | @_; | ||
| 1177 | }, | ||
| 1178 | DS09_SOA_RRSIG_EXPIRED => sub { | ||
| 1179 | __x # DNSSEC:DS09_SOA_RRSIG_EXPIRED | ||
| 1180 | 'RRSIG with keytag {keytag} and covering type SOA has already expired. ' | ||
| 1181 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1182 | @_; | ||
| 1183 | }, | ||
| 1184 | DS09_SOA_RRSIG_NOT_YET_VALID => sub { | ||
| 1185 | __x # DNSSEC:DS09_SOA_RRSIG_NOT_YET_VALID | ||
| 1186 | 'RRSIG with keytag {keytag} and covering type SOA has inception date in ' | ||
| 1187 | . 'the future. Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1188 | @_; | ||
| 1189 | }, | ||
| 1190 | DS10_ALGO_NOT_SUPPORTED_BY_ZM => sub { | ||
| 1191 | __x # DNSSEC:DS10_ALGO_NOT_SUPPORTED_BY_ZM | ||
| 1192 | 'DNSKEY with tag {keytag} uses unsupported algorithm {algo_num} ' | ||
| 1193 | . '({algo_mnemo}) by this installation of Zonemaster. Fetched from ' | ||
| 1194 | . 'name servers "{ns_ip_list}".', | ||
| 1195 | @_; | ||
| 1196 | }, | ||
| 1197 | DS10_ERR_MULT_NSEC => sub { | ||
| 1198 | __x # DNSSEC:DS10_ERR_MULT_NSEC | ||
| 1199 | 'Multiple NSEC records when one is expected. Fetched from name servers "{ns_list}".', | ||
| 1200 | @_; | ||
| 1201 | }, | ||
| 1202 | DS10_ERR_MULT_NSEC3 => sub { | ||
| 1203 | __x # DNSSEC:DS10_ERR_MULT_NSEC3 | ||
| 1204 | 'Multiple NSEC3 records when one is expected. Fetched from name servers "{ns_list}".', | ||
| 1205 | @_; | ||
| 1206 | }, | ||
| 1207 | DS10_ERR_MULT_NSEC3PARAM => sub { | ||
| 1208 | __x # DNSSEC:DS10_ERR_MULT_NSEC3PARAM | ||
| 1209 | 'Multiple NSEC3PARAM records when one is expected. Fetched from name servers "{ns_list}".', | ||
| 1210 | @_; | ||
| 1211 | }, | ||
| 1212 | DS10_EXPECTED_NSEC_NSEC3_MISSING => sub { | ||
| 1213 | __x # DNSSEC:DS10_EXPECTED_NSEC_NSEC3_MISSING | ||
| 1214 | 'The server responded with DNSKEY but not with expected NSEC or NSEC3. ' | ||
| 1215 | . 'Fetched from name servers "{ns_list}".', | ||
| 1216 | @_; | ||
| 1217 | }, | ||
| 1218 | DS10_HAS_NSEC => sub { | ||
| 1219 | __x # DNSSEC:DS10_HAS_NSEC | ||
| 1220 | 'The zone has NSEC records. Fetched from name servers "{ns_list}".', | ||
| 1221 | @_; | ||
| 1222 | }, | ||
| 1223 | DS10_HAS_NSEC3 => sub { | ||
| 1224 | __x # DNSSEC:DS10_HAS_NSEC3 | ||
| 1225 | 'The zone has NSEC3 records. Fetched from name servers "{ns_list}".', | ||
| 1226 | @_; | ||
| 1227 | }, | ||
| 1228 | DS10_INCONSISTENT_NSEC => sub { | ||
| 1229 | __x # DNSSEC:DS10_INCONSISTENT_NSEC | ||
| 1230 | 'Inconsistent responses from zone with NSEC. Fetched from name servers "{ns_list}".', | ||
| 1231 | @_; | ||
| 1232 | }, | ||
| 1233 | DS10_INCONSISTENT_NSEC3 => sub { | ||
| 1234 | __x # DNSSEC:DS10_INCONSISTENT_NSEC3 | ||
| 1235 | 'Inconsistent responses from zone with NSEC3. Fetched from name servers "{ns_list}".', | ||
| 1236 | @_; | ||
| 1237 | }, | ||
| 1238 | DS10_INCONSISTENT_NSEC_NSEC3 => sub { | ||
| 1239 | __x # DNSSEC:DS10_INCONSISTENT_NSEC_NSEC3 | ||
| 1240 | 'The zone is inconsistent on NSEC and NSEC3. NSEC is fetched from name servers ' | ||
| 1241 | . '"{ns_list_nsec}". NSEC3 is fetched from name servers "{ns_list_nsec3}".', | ||
| 1242 | @_; | ||
| 1243 | }, | ||
| 1244 | DS10_MIXED_NSEC_NSEC3 => sub { | ||
| 1245 | __x # DNSSEC:DS10_MIXED_NSEC_NSEC3 | ||
| 1246 | 'The zone responds with both NSEC and NSEC3, where only one of them is expected. ' | ||
| 1247 | . 'Fetched from name servers "{ns_list}".', | ||
| 1248 | @_; | ||
| 1249 | }, | ||
| 1250 | DS10_NSEC3PARAM_GIVES_ERR_ANSWER => sub { | ||
| 1251 | __x # DNSSEC:DS10_NSEC3PARAM_GIVES_ERR_ANSWER | ||
| 1252 | 'Unexpected DNS record in the answer section on an NSEC3PARAM query. Fetched ' | ||
| 1253 | . 'from name servers "{ns_list}".', | ||
| 1254 | @_; | ||
| 1255 | }, | ||
| 1256 | DS10_NSEC3PARAM_MISMATCHES_APEX => sub { | ||
| 1257 | __x # DNSSEC:DS10_NSEC3PARAM_MISMATCHES_APEX | ||
| 1258 | 'The returned NSEC3PARAM record has an unexpected non-apex owner name. ' | ||
| 1259 | . 'Fetched from name servers "{ns_list}".', | ||
| 1260 | @_; | ||
| 1261 | }, | ||
| 1262 | DS10_NSEC3PARAM_QUERY_RESPONSE_ERR => sub { | ||
| 1263 | __x # DNSSEC:DS10_NSEC3PARAM_QUERY_RESPONSE_ERR | ||
| 1264 | 'No response or error in response on query for NSEC3PARAM. Fetched from ' | ||
| 1265 | . 'name servers "{ns_list}".', | ||
| 1266 | @_; | ||
| 1267 | }, | ||
| 1268 | DS10_NSEC3_ERR_TYPE_LIST => sub { | ||
| 1269 | __x # DNSSEC:DS10_NSEC3_ERR_TYPE_LIST | ||
| 1270 | 'NSEC3 record for the zone apex with incorrect type list. Fetched from ' | ||
| 1271 | . 'name servers "{ns_list}".', | ||
| 1272 | @_; | ||
| 1273 | }, | ||
| 1274 | DS10_NSEC3_MISMATCHES_APEX => sub { | ||
| 1275 | __x # DNSSEC:DS10_NSEC3_MISMATCHES_APEX | ||
| 1276 | 'The returned NSEC3 record unexpectedly does not match the zone name. ' | ||
| 1277 | . 'Fetched from name servers "{ns_list}".', | ||
| 1278 | @_; | ||
| 1279 | }, | ||
| 1280 | DS10_NSEC3_MISSING_SIGNATURE => sub { | ||
| 1281 | __x # DNSSEC:DS10_NSEC3_MISSING_SIGNATURE | ||
| 1282 | 'Missing RRSIG (signature) for the NSEC3 record or records. Fetched ' | ||
| 1283 | . 'from name servers "{ns_list}".', | ||
| 1284 | @_; | ||
| 1285 | }, | ||
| 1286 | DS10_NSEC3_NODATA_MISSING_SOA => sub { | ||
| 1287 | __x # DNSSEC:DS10_NSEC3_NODATA_MISSING_SOA | ||
| 1288 | 'Missing SOA record in NODATA response with NSEC3. Fetched from ' | ||
| 1289 | . 'name servers "{ns_list}".', | ||
| 1290 | @_; | ||
| 1291 | }, | ||
| 1292 | DS10_NSEC3_NODATA_WRONG_SOA => sub { | ||
| 1293 | __x # DNSSEC:DS10_NSEC3_NODATA_WRONG_SOA | ||
| 1294 | 'Wrong owner name ("{domain}") on SOA record in NODATA response with NSEC3. ' | ||
| 1295 | . 'Fetched from name servers "{ns_list}".', | ||
| 1296 | @_; | ||
| 1297 | }, | ||
| 1298 | DS10_NSEC3_NO_VERIFIED_SIGNATURE => sub { | ||
| 1299 | __x # DNSSEC:DS10_NSEC3_NO_VERIFIED_SIGNATURE | ||
| 1300 | 'The RRSIG (signature) for the NSEC3 record cannot be verified. ' | ||
| 1301 | . 'Fetched from name servers "{ns_list}".', | ||
| 1302 | @_; | ||
| 1303 | }, | ||
| 1304 | DS10_NSEC3_RRSIG_EXPIRED => sub { | ||
| 1305 | __x # DNSSEC:DS10_NSEC3_RRSIG_EXPIRED | ||
| 1306 | 'The RRSIG (signature) with tag {keytag} for the NSEC3 record has expired. ' | ||
| 1307 | . 'Fetched from name servers "{ns_list}".', | ||
| 1308 | @_; | ||
| 1309 | }, | ||
| 1310 | DS10_NSEC3_RRSIG_NOT_YET_VALID => sub { | ||
| 1311 | __x # DNSSEC:DS10_NSEC3_RRSIG_NOT_YET_VALID | ||
| 1312 | 'The RRSIG (signature) with tag {keytag} for the NSEC3 record it not yet valid. ' | ||
| 1313 | . 'Fetched from name servers "{ns_list}".', | ||
| 1314 | @_; | ||
| 1315 | }, | ||
| 1316 | DS10_NSEC3_RRSIG_NO_DNSKEY => sub { | ||
| 1317 | __x # DNSSEC:DS10_NSEC3_RRSIG_NO_DNSKEY | ||
| 1318 | 'There is no DNSKEY record matching the RRSIG (signature) with tag {keytag} for ' | ||
| 1319 | . 'the NSEC3 record. Fetched from name servers "{ns_list}".', | ||
| 1320 | @_; | ||
| 1321 | }, | ||
| 1322 | DS10_NSEC3_RRSIG_VERIFY_ERROR => sub { | ||
| 1323 | __x # DNSSEC:DS10_NSEC3_RRSIG_VERIFY_ERROR | ||
| 1324 | 'The RRSIG (signature) with tag {keytag} for the NSEC3 record cannot be verified. ' | ||
| 1325 | . 'Fetched from name servers "{ns_list}".', | ||
| 1326 | @_; | ||
| 1327 | }, | ||
| 1328 | DS10_NSEC_ERR_TYPE_LIST => sub { | ||
| 1329 | __x # DNSSEC:DS10_NSEC_ERR_TYPE_LIST | ||
| 1330 | 'NSEC record for the zone apex with incorrect type list. Fetched from name ' | ||
| 1331 | . 'servers "{ns_list}".', | ||
| 1332 | @_; | ||
| 1333 | }, | ||
| 1334 | DS10_NSEC_GIVES_ERR_ANSWER => sub { | ||
| 1335 | __x # DNSSEC:DS10_NSEC_GIVES_ERR_ANSWER | ||
| 1336 | 'Unexpected DNS record in the answer section on an NSEC query. Fetched from ' | ||
| 1337 | . 'name servers "{ns_list}".', | ||
| 1338 | @_; | ||
| 1339 | }, | ||
| 1340 | DS10_NSEC_MISMATCHES_APEX => sub { | ||
| 1341 | __x # DNSSEC:DS10_NSEC_MISMATCHES_APEX | ||
| 1342 | 'The returned NSEC record has an unexpected non-apex owner name. Fetched from ' | ||
| 1343 | . 'name servers "{ns_list}".', | ||
| 1344 | @_; | ||
| 1345 | }, | ||
| 1346 | DS10_NSEC_MISSING_SIGNATURE => sub { | ||
| 1347 | __x # DNSSEC:DS10_NSEC_MISSING_SIGNATURE | ||
| 1348 | 'Missing RRSIG (signature) for the NSEC record or records. Fetched from ' | ||
| 1349 | . 'name servers "{ns_list}".', | ||
| 1350 | @_; | ||
| 1351 | }, | ||
| 1352 | DS10_NSEC_NODATA_MISSING_SOA => sub { | ||
| 1353 | __x # DNSSEC:DS10_NSEC_NODATA_MISSING_SOA | ||
| 1354 | 'Missing SOA record in NODATA response with NSEC. Fetched from name ' | ||
| 1355 | . 'servers "{ns_list}".', | ||
| 1356 | @_; | ||
| 1357 | }, | ||
| 1358 | DS10_NSEC_NODATA_WRONG_SOA => sub { | ||
| 1359 | __x # DNSSEC:DS10_NSEC_NODATA_WRONG_SOA | ||
| 1360 | 'Wrong owner name ("{domain}") on SOA record in NODATA response with NSEC. ' | ||
| 1361 | . 'Fetched from name servers "{ns_list}".', | ||
| 1362 | @_; | ||
| 1363 | }, | ||
| 1364 | DS10_NSEC_NO_VERIFIED_SIGNATURE => sub { | ||
| 1365 | __x # DNSSEC:DS10_NSEC_NO_VERIFIED_SIGNATURE | ||
| 1366 | 'There is no RRSIG (signature) for the NSEC record that can be verified. ' | ||
| 1367 | . 'Fetched from name servers "{ns_list}".', | ||
| 1368 | @_; | ||
| 1369 | }, | ||
| 1370 | DS10_NSEC_QUERY_RESPONSE_ERR => sub { | ||
| 1371 | __x # DNSSEC:DS10_NSEC_QUERY_RESPONSE_ERR | ||
| 1372 | 'No response or error in response on query for NSEC. Fetched from name ' | ||
| 1373 | . 'servers "{ns_list}".', | ||
| 1374 | @_; | ||
| 1375 | }, | ||
| 1376 | DS10_NSEC_RRSIG_EXPIRED => sub { | ||
| 1377 | __x # DNSSEC:DS10_NSEC_RRSIG_EXPIRED | ||
| 1378 | 'The RRSIG (signature) with tag {keytag} for the NSEC record has expired. ' | ||
| 1379 | . 'Fetched from name servers "{ns_list}".', | ||
| 1380 | @_; | ||
| 1381 | }, | ||
| 1382 | DS10_NSEC_RRSIG_NOT_YET_VALID => sub { | ||
| 1383 | __x # DNSSEC:DS10_NSEC_RRSIG_NOT_YET_VALID | ||
| 1384 | 'The RRSIG (signature) with tag {keytag} for the NSEC record it not yet valid. ' | ||
| 1385 | . 'Fetched from name servers "{ns_list}".', | ||
| 1386 | @_; | ||
| 1387 | }, | ||
| 1388 | DS10_NSEC_RRSIG_NO_DNSKEY => sub { | ||
| 1389 | __x # DNSSEC:DS10_NSEC_RRSIG_NO_DNSKEY | ||
| 1390 | 'There is no DNSKEY record matching the RRSIG (signature) with tag {keytag} for ' | ||
| 1391 | . 'the NSEC record. Fetched from name servers "{ns_list}".', | ||
| 1392 | @_; | ||
| 1393 | }, | ||
| 1394 | DS10_NSEC_RRSIG_VERIFY_ERROR => sub { | ||
| 1395 | __x # DNSSEC:DS10_NSEC_RRSIG_VERIFY_ERROR | ||
| 1396 | 'The RRSIG (signature) with tag {keytag} for the NSEC record cannot be verified. ' | ||
| 1397 | . 'Fetched from name servers "{ns_list}".', | ||
| 1398 | @_; | ||
| 1399 | }, | ||
| 1400 | DS10_SERVER_NO_DNSSEC => sub { | ||
| 1401 | __x # DNSSEC:DS10_SERVER_NO_DNSSEC | ||
| 1402 | 'The following name servers do not support DNSSEC or have not been properly ' | ||
| 1403 | . 'configured. Testing for NSEC and NSEC3 has been skipped on these servers. ' | ||
| 1404 | . 'Fetched from name servers "{ns_list}".', | ||
| 1405 | @_; | ||
| 1406 | }, | ||
| 1407 | DS10_ZONE_NO_DNSSEC => sub { | ||
| 1408 | __x # DNSSEC:DS10_ZONE_NO_DNSSEC | ||
| 1409 | 'The zone is not DNSSEC signed or not properly DNSSEC signed. ' | ||
| 1410 | . 'Testing for NSEC and NSEC3 has been skipped. Fetched from ' | ||
| 1411 | . 'name servers "{ns_list}".', | ||
| 1412 | @_; | ||
| 1413 | }, | ||
| 1414 | DS11_INCONSISTENT_DS => sub { | ||
| 1415 | __x # DNSSEC:DS11_INCONSISTENT_DS | ||
| 1416 | 'Parent name servers are inconsistent on the existence of DS.', | ||
| 1417 | @_; | ||
| 1418 | }, | ||
| 1419 | DS11_INCONSISTENT_SIGNED_ZONE => sub { | ||
| 1420 | __x # DNSSEC:DS11_INCONSISTENT_SIGNED_ZONE | ||
| 1421 | 'Name servers for the child zone are inconsistent on whether the ' | ||
| 1422 | . 'zone is signed or not.', | ||
| 1423 | @_; | ||
| 1424 | }, | ||
| 1425 | DS11_UNDETERMINED_DS => sub { | ||
| 1426 | __x # DNSSEC:DS11_UNDETERMINED_DS | ||
| 1427 | 'It cannot be determined if the parent zone has DS for the child ' | ||
| 1428 | . 'zone or not.', | ||
| 1429 | @_; | ||
| 1430 | }, | ||
| 1431 | DS11_UNDETERMINED_SIGNED_ZONE => sub { | ||
| 1432 | __x # DNSSEC:DS11_UNDETERMINED_SIGNED_ZONE | ||
| 1433 | 'It cannot be determined if the child zone is signed or not.', | ||
| 1434 | @_; | ||
| 1435 | }, | ||
| 1436 | DS11_PARENT_WITHOUT_DS => sub { | ||
| 1437 | __x # DNSSEC:DS11_PARENT_WITHOUT_DS | ||
| 1438 | 'No DS record for the child zone found on parent nameservers with IP ' | ||
| 1439 | . 'addresses "{ns_ip_list}".', | ||
| 1440 | @_; | ||
| 1441 | }, | ||
| 1442 | DS11_PARENT_WITH_DS => sub { | ||
| 1443 | __x # DNSSEC:DS11_PARENT_WITH_DS | ||
| 1444 | 'DS record for the child zone found on parent nameservers with IP addresses ' | ||
| 1445 | . '"{ns_ip_list}".', | ||
| 1446 | @_; | ||
| 1447 | }, | ||
| 1448 | DS11_NS_WITH_SIGNED_ZONE => sub { | ||
| 1449 | __x # DNSSEC:DS11_NS_WITH_SIGNED_ZONE | ||
| 1450 | 'Signed child zone found on nameservers with IP addresses ' | ||
| 1451 | . '"{ns_ip_list}".', | ||
| 1452 | @_; | ||
| 1453 | }, | ||
| 1454 | DS11_NS_WITH_UNSIGNED_ZONE => sub { | ||
| 1455 | __x # DNSSEC:DS11_NS_WITH_UNSIGNED_ZONE | ||
| 1456 | 'Unsigned child zone found on nameservers with IP addresses ' | ||
| 1457 | . '"{ns_ip_list}".', | ||
| 1458 | @_; | ||
| 1459 | }, | ||
| 1460 | DS11_DS_BUT_UNSIGNED_ZONE => sub { | ||
| 1461 | __x # DNSSEC:DS11_DS_BUT_UNSIGNED_ZONE | ||
| 1462 | 'The child zone is unsigned, but the parent zone has DS record.', | ||
| 1463 | @_; | ||
| 1464 | }, | ||
| 1465 | DS13_ALGO_NOT_SIGNED_DNSKEY => sub { | ||
| 1466 | __x # DNSSEC:DS13_ALGO_NOT_SIGNED_DNSKEY | ||
| 1467 | 'The DNSKEY RRset is not signed by algorithm {algo_num} ({algo_mnemo}) ' | ||
| 1468 | . 'present in the DNSKEY RRset. Fetched from the nameservers with IP ' | ||
| 1469 | . 'addresses "{ns_ip_list}".', | ||
| 1470 | @_; | ||
| 1471 | }, | ||
| 1472 | DS13_ALGO_NOT_SIGNED_NS => sub { | ||
| 1473 | __x # DNSSEC:DS13_ALGO_NOT_SIGNED_NS | ||
| 1474 | 'The NS RRset is not signed by algorithm {algo_num} ({algo_mnemo}) ' | ||
| 1475 | . 'present in the DNSKEY RRset. Fetched from the nameservers with IP ' | ||
| 1476 | . 'addresses "{ns_ip_list}".', | ||
| 1477 | @_; | ||
| 1478 | }, | ||
| 1479 | DS13_ALGO_NOT_SIGNED_SOA => sub { | ||
| 1480 | __x # DNSSEC:DS13_ALGO_NOT_SIGNED_SOA | ||
| 1481 | 'The SOA RRset is not signed by algorithm {algo_num} ({algo_mnemo}) ' | ||
| 1482 | . 'present in the DNSKEY RRset. Fetched from the nameservers with IP ' | ||
| 1483 | . 'addresses "{ns_ip_list}".', | ||
| 1484 | @_; | ||
| 1485 | }, | ||
| 1486 | DS15_HAS_CDNSKEY_NO_CDS => sub { | ||
| 1487 | __x # DNSSEC:DS15_HAS_CDNSKEY_NO_CDS | ||
| 1488 | 'CDNSKEY RRset is found on nameservers that resolve to IP addresses ' | ||
| 1489 | . '({ns_ip_list}), but no CDS RRset.', | ||
| 1490 | @_; | ||
| 1491 | }, | ||
| 1492 | DS15_HAS_CDS_AND_CDNSKEY => sub { | ||
| 1493 | __x # DNSSEC:DS15_HAS_CDS_AND_CDNSKEY | ||
| 1494 | 'CDNSKEY and CDS RRsets are found on nameservers that resolve to IP addresses ' | ||
| 1495 | . '({ns_ip_list}).', | ||
| 1496 | @_; | ||
| 1497 | }, | ||
| 1498 | DS15_HAS_CDS_NO_CDNSKEY => sub { | ||
| 1499 | __x # DNSSEC:DS15_HAS_CDS_NO_CDNSKEY | ||
| 1500 | 'CDS RRset is found on nameservers that resolve to IP addresses ' | ||
| 1501 | . '({ns_ip_list}), but no CDNSKEY RRset.', | ||
| 1502 | @_; | ||
| 1503 | }, | ||
| 1504 | DS15_INCONSISTENT_CDNSKEY => sub { | ||
| 1505 | __x # DNSSEC:DS15_INCONSISTENT_CDNSKEY | ||
| 1506 | 'All servers do not have the same CDNSKEY RRset.', @_; | ||
| 1507 | }, | ||
| 1508 | DS15_INCONSISTENT_CDS => sub { | ||
| 1509 | __x # DNSSEC:DS15_INCONSISTENT_CDS | ||
| 1510 | 'All servers do not have the same CDS RRset.', @_; | ||
| 1511 | }, | ||
| 1512 | DS15_MISMATCH_CDS_CDNSKEY => sub { | ||
| 1513 | __x # DNSSEC:DS15_MISMATCH_CDS_CDNSKEY | ||
| 1514 | 'Both CDS and CDNSKEY RRsets are found on nameservers that resolve to IP ' | ||
| 1515 | . 'addresses ({ns_ip_list}) but they do not match.', | ||
| 1516 | @_; | ||
| 1517 | }, | ||
| 1518 | DS15_NO_CDS_CDNSKEY => sub { | ||
| 1519 | __x # DNSSEC:DS15_NO_CDS_CDNSKEY | ||
| 1520 | 'No CDS or CDNSKEY RRsets are found on any name server.', @_; | ||
| 1521 | }, | ||
| 1522 | DS16_CDS_INVALID_RRSIG => sub { | ||
| 1523 | __x # DNSSEC:DS16_CDS_INVALID_RRSIG | ||
| 1524 | 'The CDS RRset is signed with an RRSIG with tag {keytag}, but the RRSIG does ' | ||
| 1525 | . 'not match the DNSKEY with the same key tag. Fetched from the nameservers ' | ||
| 1526 | . 'with IP addresses "{ns_ip_list}".', | ||
| 1527 | @_; | ||
| 1528 | }, | ||
| 1529 | DS16_CDS_MATCHES_NON_SEP_DNSKEY => sub { | ||
| 1530 | __x # DNSSEC:DS16_CDS_MATCHES_NON_SEP_DNSKEY | ||
| 1531 | 'The CDS record with tag {keytag} matches a DNSKEY record with SEP bit (bit 15) ' | ||
| 1532 | . 'unset. Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1533 | @_; | ||
| 1534 | }, | ||
| 1535 | DS16_CDS_MATCHES_NON_ZONE_DNSKEY => sub { | ||
| 1536 | __x # DNSSEC:DS16_CDS_MATCHES_NON_ZONE_DNSKEY | ||
| 1537 | 'The CDS record with tag {keytag} matches a DNSKEY record with zone bit (bit 7) ' | ||
| 1538 | . 'unset. Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1539 | @_; | ||
| 1540 | }, | ||
| 1541 | DS16_CDS_MATCHES_NO_DNSKEY => sub { | ||
| 1542 | __x # DNSSEC:DS16_CDS_MATCHES_NO_DNSKEY | ||
| 1543 | 'The CDS record with tag {keytag} does not match any DNSKEY record. Fetched ' | ||
| 1544 | . 'from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1545 | @_; | ||
| 1546 | }, | ||
| 1547 | DS16_CDS_NOT_SIGNED_BY_CDS => sub { | ||
| 1548 | __x # DNSSEC:DS16_CDS_NOT_SIGNED_BY_CDS | ||
| 1549 | 'The CDS RRset is not signed by the DNSKEY that the CDS record with tag ' | ||
| 1550 | . '{keytag} points to. Fetched from the nameservers with IP addresses ' | ||
| 1551 | . '"{ns_ip_list}".', | ||
| 1552 | @_; | ||
| 1553 | }, | ||
| 1554 | DS16_CDS_SIGNED_BY_UNKNOWN_DNSKEY => sub { | ||
| 1555 | __x # DNSSEC:DS16_CDS_SIGNED_BY_UNKNOWN_DNSKEY | ||
| 1556 | 'The CDS RRset is signed by RRSIG with tag {keytag} but that is not in the ' | ||
| 1557 | . 'DNSKEY RRset. Fetched from the nameservers with P addresses "{ns_ip_list}".', | ||
| 1558 | @_; | ||
| 1559 | }, | ||
| 1560 | DS16_CDS_UNSIGNED => sub { | ||
| 1561 | __x # DNSSEC:DS16_CDS_UNSIGNED | ||
| 1562 | 'The CDS RRset is not signed. Fetched from the nameservers with IP addresses ' | ||
| 1563 | . '"{ns_ip_list}".', | ||
| 1564 | @_; | ||
| 1565 | }, | ||
| 1566 | DS16_CDS_WITHOUT_DNSKEY => sub { | ||
| 1567 | __x # DNSSEC:DS16_CDS_WITHOUT_DNSKEY | ||
| 1568 | 'A CDS RRset exists, but no DNSKEY record exists. Fetched from the ' | ||
| 1569 | . 'nameservers with IP addresses "{ns_ip_list}".', | ||
| 1570 | @_; | ||
| 1571 | }, | ||
| 1572 | DS16_DELETE_CDS => sub { | ||
| 1573 | __x # DNSSEC:DS16_DELETE_CDS | ||
| 1574 | 'A single "delete" CDS record is found on the nameservers with IP addresses ' | ||
| 1575 | . '"{ns_ip_list}".', | ||
| 1576 | @_; | ||
| 1577 | }, | ||
| 1578 | DS16_DNSKEY_NOT_SIGNED_BY_CDS => sub { | ||
| 1579 | __x # DNSSEC:DS16_DNSKEY_NOT_SIGNED_BY_CDS | ||
| 1580 | 'The DNSKEY RRset is not signed by the DNSKEY that the CDS record with tag ' | ||
| 1581 | . '{keytag} points to. Fetched from the nameservers with IP addresses ' | ||
| 1582 | . '"{ns_ip_list}".', | ||
| 1583 | @_; | ||
| 1584 | }, | ||
| 1585 | DS16_MIXED_DELETE_CDS => sub { | ||
| 1586 | __x # DNSSEC:DS16_MIXED_DELETE_CDS | ||
| 1587 | 'The CDS RRset is a mixture between "delete" record and other records. ' | ||
| 1588 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1589 | @_; | ||
| 1590 | }, | ||
| 1591 | DS17_CDNSKEY_INVALID_RRSIG => sub { | ||
| 1592 | __x # DNSSEC:DS17_CDNSKEY_INVALID_RRSIG | ||
| 1593 | 'The CDNSKEY RRset is signed with an RRSIG with tag {keytag}, but the RRSIG does ' | ||
| 1594 | . 'not match the DNSKEY with the same key tag. Fetched from the nameservers ' | ||
| 1595 | . 'with IP addresses "{ns_ip_list}".', | ||
| 1596 | @_; | ||
| 1597 | }, | ||
| 1598 | DS17_CDNSKEY_IS_NON_SEP => sub { | ||
| 1599 | __x # DNSSEC:DS17_CDNSKEY_IS_NON_SEP | ||
| 1600 | 'The CDNSKEY record with tag {keytag} has the SEP bit (bit 15) unset. Fetched ' | ||
| 1601 | . 'from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1602 | @_; | ||
| 1603 | }, | ||
| 1604 | DS17_CDNSKEY_IS_NON_ZONE => sub { | ||
| 1605 | __x # DNSSEC:DS17_CDNSKEY_IS_NON_ZONE | ||
| 1606 | 'The CDNSKEY record with tag {keytag} has the zone bit (bit 7) unset. Fetched ' | ||
| 1607 | . 'from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1608 | @_; | ||
| 1609 | }, | ||
| 1610 | DS17_CDNSKEY_MATCHES_NO_DNSKEY => sub { | ||
| 1611 | __x # DNSSEC:DS17_CDNSKEY_MATCHES_NO_DNSKEY | ||
| 1612 | 'The CDNSKEY record with tag {keytag} does not match any DNSKEY record. Fetched ' | ||
| 1613 | . 'from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1614 | @_; | ||
| 1615 | }, | ||
| 1616 | DS17_CDNSKEY_NOT_SIGNED_BY_CDNSKEY => sub { | ||
| 1617 | __x # DNSSEC:DS17_CDNSKEY_NOT_SIGNED_BY_CDNSKEY | ||
| 1618 | 'The CDNSKEY RRset is not signed by the DNSKEY that the CDNSKEY record with tag ' | ||
| 1619 | . '{keytag} points to. Fetched from the nameservers with IP addresses ' | ||
| 1620 | . '"{ns_ip_list}".', | ||
| 1621 | @_; | ||
| 1622 | }, | ||
| 1623 | DS17_CDNSKEY_SIGNED_BY_UNKNOWN_DNSKEY => sub { | ||
| 1624 | __x # DNSSEC:DS17_CDNSKEY_SIGNED_BY_UNKNOWN_DNSKEY | ||
| 1625 | 'The CDNSKEY RRset is signed by RRSIG with tag {keytag} but that is not in the ' | ||
| 1626 | . 'DNSKEY RRset. Fetched from the nameservers with P addresses "{ns_ip_list}".', | ||
| 1627 | @_; | ||
| 1628 | }, | ||
| 1629 | DS17_CDNSKEY_UNSIGNED => sub { | ||
| 1630 | __x # DNSSEC:DS17_CDNSKEY_UNSIGNED | ||
| 1631 | 'The CDNSKEY RRset is not signed. Fetched from the nameservers with IP addresses ' | ||
| 1632 | . '"{ns_ip_list}".', | ||
| 1633 | @_; | ||
| 1634 | }, | ||
| 1635 | DS17_CDNSKEY_WITHOUT_DNSKEY => sub { | ||
| 1636 | __x # DNSSEC:DS17_CDNSKEY_WITHOUT_DNSKEY | ||
| 1637 | 'A CDNSKEY RRset exists, but no DNSKEY record exists. Fetched from the ' | ||
| 1638 | . 'nameservers with IP addresses "{ns_ip_list}".', | ||
| 1639 | @_; | ||
| 1640 | }, | ||
| 1641 | DS17_DELETE_CDNSKEY => sub { | ||
| 1642 | __x # DNSSEC:DS17_DELETE_CDNSKEY | ||
| 1643 | 'A single "delete" CDNSKEY record is found on the nameservers with IP addresses ' | ||
| 1644 | . '"{ns_ip_list}".', | ||
| 1645 | @_; | ||
| 1646 | }, | ||
| 1647 | DS17_DNSKEY_NOT_SIGNED_BY_CDNSKEY => sub { | ||
| 1648 | __x # DNSSEC:DS17_DNSKEY_NOT_SIGNED_BY_CDNSKEY | ||
| 1649 | 'The DNSKEY RRset is not signed by the DNSKEY that the CDNSKEY record with tag ' | ||
| 1650 | . '{keytag} points to. Fetched from the nameservers with IP addresses ' | ||
| 1651 | . '"{ns_ip_list}".', | ||
| 1652 | @_; | ||
| 1653 | }, | ||
| 1654 | DS17_MIXED_DELETE_CDNSKEY => sub { | ||
| 1655 | __x # DNSSEC:DS17_MIXED_DELETE_CDNSKEY | ||
| 1656 | 'The CDNSKEY RRset is a mixture between "delete" record and other records. ' | ||
| 1657 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1658 | @_; | ||
| 1659 | }, | ||
| 1660 | DS18_NO_MATCH_CDS_RRSIG_DS => sub { | ||
| 1661 | __x # DNSSEC:DS18_NO_MATCH_CDS_RRSIG_DS | ||
| 1662 | 'The CDS RRset is not signed with a DNSKEY record that a DS record points to. ' | ||
| 1663 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1664 | @_; | ||
| 1665 | }, | ||
| 1666 | DS18_NO_MATCH_CDNSKEY_RRSIG_DS => sub { | ||
| 1667 | __x # DNSSEC:DS18_NO_MATCH_CDNSKEY_RRSIG_DS | ||
| 1668 | 'The CDNSKEY RRset is not signed with a DNSKEY record that a DS record points to. ' | ||
| 1669 | . 'Fetched from the nameservers with IP addresses "{ns_ip_list}".', | ||
| 1670 | @_; | ||
| 1671 | }, | ||
| 1672 | DURATION_LONG => sub { | ||
| 1673 | __x # DNSSEC:DURATION_LONG | ||
| 1674 | 'RRSIG with keytag {keytag} and covering type(s) {types} ' | ||
| 1675 | . 'has a duration of {duration} seconds, which is too long.', | ||
| 1676 | @_; | ||
| 1677 | }, | ||
| 1678 | DURATION_OK => sub { | ||
| 1679 | __x # DNSSEC:DURATION_OK | ||
| 1680 | 'RRSIG with keytag {keytag} and covering type(s) {types} ' | ||
| 1681 | . 'has a duration of {duration} seconds, which is just fine.', | ||
| 1682 | @_; | ||
| 1683 | }, | ||
| 1684 | EXTRA_PROCESSING_BROKEN => sub { | ||
| 1685 | __x # DNSSEC:EXTRA_PROCESSING_BROKEN | ||
| 1686 | 'Server at {server} sent {keys} DNSKEY records, and {sigs} RRSIG records.', @_; | ||
| 1687 | }, | ||
| 1688 | EXTRA_PROCESSING_OK => sub { | ||
| 1689 | __x # DNSSEC:EXTRA_PROCESSING_OK | ||
| 1690 | 'Server at {server} sent {keys} DNSKEY records and {sigs} RRSIG records.', @_; | ||
| 1691 | }, | ||
| 1692 | IPV4_DISABLED => sub { | ||
| 1693 | __x # DNSSEC:IPV4_DISABLED | ||
| 1694 | 'IPv4 is disabled, not sending "{rrtype}" query to {ns}.', @_; | ||
| 1695 | }, | ||
| 1696 | IPV6_DISABLED => sub { | ||
| 1697 | __x # DNSSEC:IPV6_DISABLED | ||
| 1698 | 'IPv6 is disabled, not sending "{rrtype}" query to {ns}.', @_; | ||
| 1699 | }, | ||
| 1700 | KEY_SIZE_OK => sub { | ||
| 1701 | __x # DNSSEC:KEY_SIZE_OK | ||
| 1702 | 'All keys from the DNSKEY RRset have the correct size.', @_; | ||
| 1703 | }, | ||
| 1704 | NO_RESPONSE_DNSKEY => sub { | ||
| 1705 | __x # DNSSEC:NO_RESPONSE_DNSKEY | ||
| 1706 | 'Nameserver {ns} responded with no DNSKEY record(s).', @_; | ||
| 1707 | }, | ||
| 1708 | NO_RESPONSE => sub { | ||
| 1709 | __x # DNSSEC:NO_RESPONSE | ||
| 1710 | 'Nameserver {ns} did not respond.', @_; | ||
| 1711 | }, | ||
| 1712 | REMAINING_LONG => sub { | ||
| 1713 | __x # DNSSEC:REMAINING_LONG | ||
| 1714 | 'RRSIG with keytag {keytag} and covering type(s) {types} ' | ||
| 1715 | . 'has a remaining validity of {duration} seconds, which is too long.', | ||
| 1716 | @_; | ||
| 1717 | }, | ||
| 1718 | REMAINING_SHORT => sub { | ||
| 1719 | __x # DNSSEC:REMAINING_SHORT | ||
| 1720 | 'RRSIG with keytag {keytag} and covering type(s) {types} ' | ||
| 1721 | . 'has a remaining validity of {duration} seconds, which is too short.', | ||
| 1722 | @_; | ||
| 1723 | }, | ||
| 1724 | RRSIG_EXPIRATION => sub { | ||
| 1725 | __x # DNSSEC:RRSIG_EXPIRATION | ||
| 1726 | 'RRSIG with keytag {keytag} and covering type(s) {types} expires at ' . ': {date}.', @_; | ||
| 1727 | }, | ||
| 1728 | RRSIG_EXPIRED => sub { | ||
| 1729 | __x # DNSSEC:RRSIG_EXPIRED | ||
| 1730 | 'RRSIG with keytag {keytag} and covering type(s) {types} has already ' | ||
| 1731 | . 'expired (expiration is: {expiration}).', | ||
| 1732 | @_; | ||
| 1733 | }, | ||
| 1734 | TEST_CASE_END => sub { | ||
| 1735 | __x # DNSSEC:TEST_CASE_END | ||
| 1736 | 'TEST_CASE_END {testcase}.', @_; | ||
| 1737 | }, | ||
| 1738 | TEST_CASE_START => sub { | ||
| 1739 | __x # DNSSEC:TEST_CASE_START | ||
| 1740 | 'TEST_CASE_START {testcase}.', @_; | ||
| 1741 | } | ||
| 1742 | ); | ||
| 1743 | |||
| 1744 | =over | ||
| 1745 | |||
| 1746 | =item tag_descriptions() | ||
| 1747 | |||
| 1748 | my $hash_ref = tag_descriptions(); | ||
| 1749 | |||
| 1750 | Used by the L<built-in translation system|Zonemaster::Engine::Translator>. | ||
| 1751 | |||
| 1752 | Returns a reference to a hash, the keys of which are the message tags and the corresponding values are strings (message IDs). | ||
| 1753 | |||
| 1754 | =back | ||
| 1755 | |||
| 1756 | =cut | ||
| 1757 | |||
| 1758 | sub tag_descriptions { | ||
| 1759 | return \%TAG_DESCRIPTIONS; | ||
| 1760 | } | ||
| 1761 | |||
| 1762 | =over | ||
| 1763 | |||
| 1764 | =item version() | ||
| 1765 | |||
| 1766 | my $version_string = version(); | ||
| 1767 | |||
| 1768 | Returns a string containing the version of the current module. | ||
| 1769 | |||
| 1770 | =back | ||
| 1771 | |||
| 1772 | =cut | ||
| 1773 | |||
| 1774 | sub version { | ||
| 1775 | return "$Zonemaster::Engine::Test::DNSSEC::VERSION"; | ||
| 1776 | } | ||
| 1777 | |||
| 1778 | =head1 INTERNAL METHODS | ||
| 1779 | |||
| 1780 | =over | ||
| 1781 | |||
| 1782 | =item _emit_log() | ||
| 1783 | |||
| 1784 | my $log_entry = _emit_log( $message_tag_string, $hash_ref ); | ||
| 1785 | |||
| 1786 | Adds a message to the L<logger|Zonemaster::Engine::Logger> for this module. | ||
| 1787 | See L<Zonemaster::Engine::Logger::Entry/add($tag, $argref, $module, $testcase)> for more details. | ||
| 1788 | |||
| 1789 | Takes a string (message tag) and a reference to a hash (arguments). | ||
| 1790 | |||
| 1791 | Returns a L<Zonemaster::Engine::Logger::Entry> object. | ||
| 1792 | |||
| 1793 | =back | ||
| 1794 | |||
| 1795 | =cut | ||
| 1796 | |||
| 1797 | sub _emit_log { my ( $tag, $argref ) = @_; return Zonemaster::Engine->logger->add( $tag, $argref, 'DNSSEC' ); } | ||
| 1798 | |||
| 1799 | =over | ||
| 1800 | |||
| 1801 | =item _ip_disabled_message() | ||
| 1802 | |||
| 1803 | my $bool = _ip_disabled_message( $logentry_array_ref, $ns, @query_type_array ); | ||
| 1804 | |||
| 1805 | Checks if the IP version of a given name server is allowed to be queried. If not, it adds a logging message and returns true. Else, it returns false. | ||
| 1806 | |||
| 1807 | Takes a reference to an array of L<Zonemaster::Engine::Logger::Entry> objects, a L<Zonemaster::Engine::Nameserver> object and an array of strings (query type). | ||
| 1808 | |||
| 1809 | Returns a boolean. | ||
| 1810 | |||
| 1811 | =back | ||
| 1812 | |||
| 1813 | =cut | ||
| 1814 | |||
| 1815 | sub _ip_disabled_message { | ||
| 1816 | my ( $results_array, $ns, @rrtypes ) = @_; | ||
| 1817 | |||
| 1818 | if ( not Zonemaster::Engine::Profile->effective->get(q{net.ipv6}) and $ns->address->version == $IP_VERSION_6 ) { | ||
| 1819 | push @$results_array, map { | ||
| 1820 | _emit_log( | ||
| 1821 | IPV6_DISABLED => { | ||
| 1822 | ns => $ns->string, | ||
| 1823 | rrtype => $_ | ||
| 1824 | } | ||
| 1825 | ) | ||
| 1826 | } @rrtypes; | ||
| 1827 | return 1; | ||
| 1828 | } | ||
| 1829 | |||
| 1830 | if ( not Zonemaster::Engine::Profile->effective->get(q{net.ipv4}) and $ns->address->version == $IP_VERSION_4 ) { | ||
| 1831 | push @$results_array, map { | ||
| 1832 | _emit_log( | ||
| 1833 | IPV4_DISABLED => { | ||
| 1834 | ns => $ns->string, | ||
| 1835 | rrtype => $_, | ||
| 1836 | } | ||
| 1837 | ) | ||
| 1838 | } @rrtypes; | ||
| 1839 | return 1; | ||
| 1840 | } | ||
| 1841 | return 0; | ||
| 1842 | } | ||
| 1843 | |||
| 1844 | =head1 TESTS | ||
| 1845 | |||
| 1846 | =over | ||
| 1847 | |||
| 1848 | =item dnssec01() | ||
| 1849 | |||
| 1850 | my @logentry_array = dnssec01( $zone ); | ||
| 1851 | |||
| 1852 | Runs the L<DNSSEC01 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec01.md>. | ||
| 1853 | |||
| 1854 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 1855 | |||
| 1856 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 1857 | |||
| 1858 | =back | ||
| 1859 | |||
| 1860 | =cut | ||
| 1861 | |||
| 1862 | sub dnssec01 { | ||
| 1863 | my ( $class, $zone ) = @_; | ||
| 1864 | |||
| 1865 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC01'; | ||
| 1866 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 1867 | |||
| 1868 | my @ignored_parent_ns_ip; | ||
| 1869 | my ( @responds_without_valid_ds, @responds_with_ds ); | ||
| 1870 | my ( %algo_2_ds, %non_algo_2_ds ); | ||
| 1871 | my %sets = ( | ||
| 1872 | 'DS01_DS_ALGO_DEPRECATED' => {}, | ||
| 1873 | 'DS01_DS_ALGO_RESERVED' => {}, | ||
| 1874 | 'DS01_DS_ALGO_UNASSIGNED' => {}, | ||
| 1875 | 'DS01_DS_ALGO_PRIVATE' => {}, | ||
| 1876 | 'DS01_DS_ALGO_NOT_DS' => {}, | ||
| 1877 | 'DS01_DS_ALGO_OK' => {} | ||
| 1878 | ); | ||
| 1879 | |||
| 1880 | my $parent_nss = Zonemaster::Engine::TestMethodsV2->get_parent_ns_names_and_ips( $zone ); | ||
| 1881 | |||
| 1882 | my @undelegated_ds; | ||
| 1883 | if ( my $parent = $zone->parent ) { | ||
| 1884 | foreach my $ns ( @{ $parent->ns } ) { | ||
| 1885 | if ( $ns->fake_ds->{$zone->name} ) { | ||
| 1886 | @undelegated_ds = @{ $ns->fake_ds->{$zone->name} }; | ||
| 1887 | |||
| 1888 | if ( @undelegated_ds ) { | ||
| 1889 | my $ns_ip = "-"; | ||
| 1890 | |||
| 1891 | foreach my $ds_data ( @undelegated_ds ) { | ||
| 1892 | my $digest = $ds_data->digtype; | ||
| 1893 | my $keytag = $ds_data->keytag; | ||
| 1894 | |||
| 1895 | push @{ $sets{$dnssec01_tags_mapping{$digest}}->{$digest}{$keytag} }, $ns_ip; | ||
| 1896 | |||
| 1897 | if ( $digest == 2 ) { | ||
| 1898 | push @{ $algo_2_ds{$keytag} }, $ns_ip; | ||
| 1899 | } | ||
| 1900 | else { | ||
| 1901 | push @{ $non_algo_2_ds{$keytag} }, $ns_ip; | ||
| 1902 | } | ||
| 1903 | } | ||
| 1904 | |||
| 1905 | push @responds_with_ds, $ns_ip; | ||
| 1906 | $parent_nss = undef; | ||
| 1907 | } | ||
| 1908 | } | ||
| 1909 | } | ||
| 1910 | } | ||
| 1911 | |||
| 1912 | my @nss = @{ $parent_nss // [] }; | ||
| 1913 | |||
| 1914 | my %ip_already_processed; | ||
| 1915 | foreach my $ns ( @nss ) { | ||
| 1916 | my $ns_ip = $ns->address->short; | ||
| 1917 | |||
| 1918 | next if exists $ip_already_processed{$ns_ip}; | ||
| 1919 | $ip_already_processed{$ns_ip} = [ grep { $_->address->short eq $ns_ip } @nss ]; | ||
| 1920 | |||
| 1921 | if ( _ip_disabled_message( \@results, $ns, q{DS} ) ) { | ||
| 1922 | next; | ||
| 1923 | } | ||
| 1924 | |||
| 1925 | my @matching_nss = @{ $ip_already_processed{$ns_ip} }; | ||
| 1926 | |||
| 1927 | my $p = $ns->query( $zone->name, q{DS}, { dnssec => 1 } ); | ||
| 1928 | |||
| 1929 | if ( not $p or $p->rcode ne q{NOERROR} or not $p->has_edns or not $p->do or not $p->aa ) { | ||
| 1930 | push @ignored_parent_ns_ip, @matching_nss; | ||
| 1931 | next; | ||
| 1932 | } | ||
| 1933 | |||
| 1934 | my @rrs = $p->get_records( q{DS}, q{answer} ); | ||
| 1935 | |||
| 1936 | my $valid_ds_rr = 0; | ||
| 1937 | foreach my $ds_rr ( @rrs ) { | ||
| 1938 | if ( $ds_rr->owner eq $zone->name->fqdn ){ | ||
| 1939 | $valid_ds_rr = 1; | ||
| 1940 | last; | ||
| 1941 | } | ||
| 1942 | } | ||
| 1943 | |||
| 1944 | if ( not $valid_ds_rr ){ | ||
| 1945 | push @responds_without_valid_ds, @matching_nss; | ||
| 1946 | next; | ||
| 1947 | } | ||
| 1948 | |||
| 1949 | push @responds_with_ds, @matching_nss; | ||
| 1950 | |||
| 1951 | foreach my $ds_rr ( @rrs ) { | ||
| 1952 | my $digest = $ds_rr->digtype; | ||
| 1953 | my $keytag = $ds_rr->keytag; | ||
| 1954 | |||
| 1955 | push @{ $sets{$dnssec01_tags_mapping{$digest}}->{$digest}{$keytag} }, @matching_nss; | ||
| 1956 | |||
| 1957 | if ( $digest == 2 ) { | ||
| 1958 | push @{ $algo_2_ds{$keytag} }, @matching_nss; | ||
| 1959 | } | ||
| 1960 | else { | ||
| 1961 | push @{ $non_algo_2_ds{$keytag} }, @matching_nss; | ||
| 1962 | } | ||
| 1963 | } | ||
| 1964 | } | ||
| 1965 | |||
| 1966 | while ( my ($tag_name, $set_ref) = each %sets ) { | ||
| 1967 | my %values = %{ $set_ref }; | ||
| 1968 | if ( %values ) { | ||
| 1969 | foreach my $digest ( keys %values ) { | ||
| 1970 | foreach my $keytag ( keys %{ $values{$digest} } ) { | ||
| 1971 | push @results, | ||
| 1972 | _emit_log( | ||
| 1973 | $tag_name => { | ||
| 1974 | ns_list => join( q{;}, uniq sort @{ $values{$digest}{$keytag} } ), | ||
| 1975 | keytag => $keytag, | ||
| 1976 | ds_algo_num => $digest, | ||
| 1977 | ds_algo_descr => $digest_algorithms{$digest} | ||
| 1978 | } | ||
| 1979 | ); | ||
| 1980 | } | ||
| 1981 | } | ||
| 1982 | } | ||
| 1983 | } | ||
| 1984 | |||
| 1985 | if ( %non_algo_2_ds ) { | ||
| 1986 | while ( my ($keytag, $ns_ips) = each %non_algo_2_ds ) { | ||
| 1987 | my $lc = List::Compare->new( $ns_ips, $algo_2_ds{$keytag} ); | ||
| 1988 | my @unique_nss = $lc->get_unique; | ||
| 1989 | |||
| 1990 | if ( @unique_nss ) { | ||
| 1991 | push @results, | ||
| 1992 | _emit_log( | ||
| 1993 | DS01_DS_ALGO_2_MISSING => { | ||
| 1994 | ns_list => join( q{;}, uniq sort @unique_nss ), | ||
| 1995 | keytag => $keytag | ||
| 1996 | } | ||
| 1997 | ); | ||
| 1998 | } | ||
| 1999 | } | ||
| 2000 | } | ||
| 2001 | |||
| 2002 | if ( not @responds_without_valid_ds and not @responds_with_ds and @ignored_parent_ns_ip ) { | ||
| 2003 | push @results, | ||
| 2004 | _emit_log( | ||
| 2005 | DS01_NO_RESPONSE => { | ||
| 2006 | ns_list => join( q{;}, uniq sort @ignored_parent_ns_ip ) | ||
| 2007 | } | ||
| 2008 | ) | ||
| 2009 | } | ||
| 2010 | |||
| 2011 | if ( $zone->name eq '.' and not @undelegated_ds ) { | ||
| 2012 | push @results, | ||
| 2013 | _emit_log( | ||
| 2014 | DS01_ROOT_N_NO_UNDEL_DS => {} | ||
| 2015 | ) | ||
| 2016 | } | ||
| 2017 | |||
| 2018 | if ( $zone->name ne '.' and Zonemaster::Engine::Recursor->has_fake_addresses( $zone->name->string ) and not @undelegated_ds ) { | ||
| 2019 | push @results, | ||
| 2020 | _emit_log( | ||
| 2021 | DS01_UNDEL_N_NO_UNDEL_DS => {} | ||
| 2022 | ) | ||
| 2023 | } | ||
| 2024 | |||
| 2025 | if ( @responds_without_valid_ds ) { | ||
| 2026 | if ( not @responds_with_ds ) { | ||
| 2027 | push @results, | ||
| 2028 | _emit_log( | ||
| 2029 | DS01_PARENT_ZONE_NO_DS => { | ||
| 2030 | ns_list => join( q{;}, uniq sort @responds_without_valid_ds ) | ||
| 2031 | } | ||
| 2032 | ) | ||
| 2033 | } | ||
| 2034 | else { | ||
| 2035 | push @results, | ||
| 2036 | _emit_log( | ||
| 2037 | DS01_PARENT_SERVER_NO_DS => { | ||
| 2038 | ns_list => join( q{;}, uniq sort @responds_without_valid_ds ) | ||
| 2039 | } | ||
| 2040 | ) | ||
| 2041 | } | ||
| 2042 | } | ||
| 2043 | |||
| 2044 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2045 | } ## end sub dnssec01 | ||
| 2046 | |||
| 2047 | =over | ||
| 2048 | |||
| 2049 | =item dnssec02() | ||
| 2050 | |||
| 2051 | my @logentry_array = dnssec02( $zone ); | ||
| 2052 | |||
| 2053 | Runs the L<DNSSEC02 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec02.md>. | ||
| 2054 | |||
| 2055 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 2056 | |||
| 2057 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 2058 | |||
| 2059 | =back | ||
| 2060 | |||
| 2061 | =cut | ||
| 2062 | |||
| 2063 | sub dnssec02 { | ||
| 2064 | my ( $self, $zone ) = @_; | ||
| 2065 | |||
| 2066 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC02'; | ||
| 2067 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 2068 | |||
| 2069 | my @ds_record; | ||
| 2070 | my %no_dnskey_for_ds; | ||
| 2071 | my %no_match_ds_dnskey; | ||
| 2072 | my %dnskey_not_for_zone_signing; | ||
| 2073 | my %dnskey_not_sep; | ||
| 2074 | my %no_matching_dnskey_rrsig; | ||
| 2075 | my %algo_not_supported_by_zm; | ||
| 2076 | my %rrsig_not_valid_by_dnskey; | ||
| 2077 | my %responding_child_ns; | ||
| 2078 | my %dnskey_matching_ds; | ||
| 2079 | my %has_dnskey_match_ds; | ||
| 2080 | my %has_rrsig_match_ds; | ||
| 2081 | my @ns_dnskey; | ||
| 2082 | my @ns_rrsig; | ||
| 2083 | my $continue_with_child_tests = 1; | ||
| 2084 | |||
| 2085 | my $parent = Zonemaster::Engine::TestMethods->method1( $zone ); | ||
| 2086 | my @nss_parent = @{ $parent->ns }; | ||
| 2087 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_parent; | ||
| 2088 | my %ip_already_processed; | ||
| 2089 | |||
| 2090 | for my $nss_key ( sort keys %nss ) { | ||
| 2091 | my $ns = $nss{$nss_key}; | ||
| 2092 | |||
| 2093 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 2094 | $ip_already_processed{$ns->address->short} = 1; | ||
| 2095 | |||
| 2096 | if ( _ip_disabled_message( \@results, $ns, q{DS} ) ) { | ||
| 2097 | next; | ||
| 2098 | } | ||
| 2099 | |||
| 2100 | my $ds_p = $ns->query( $zone->name, q{DS}, { dnssec => 1 } ); | ||
| 2101 | if ( not $ds_p or $ds_p->rcode ne q{NOERROR} or not $ds_p->has_edns or not $ds_p->do or not $ds_p->aa) { | ||
| 2102 | next; | ||
| 2103 | } | ||
| 2104 | my @tmp_ds_records = $ds_p->get_records_for_name( q{DS}, $zone->name->string, q{answer} ); | ||
| 2105 | if ( not scalar @tmp_ds_records ) { | ||
| 2106 | next; | ||
| 2107 | } | ||
| 2108 | foreach my $tmp_ds_record ( @tmp_ds_records ) { | ||
| 2109 | if ( | ||
| 2110 | not grep { | ||
| 2111 | $tmp_ds_record->keytag == $_->keytag | ||
| 2112 | and $tmp_ds_record->digtype == $_->digtype | ||
| 2113 | and $tmp_ds_record->algorithm == $_->algorithm | ||
| 2114 | and $tmp_ds_record->hexdigest eq $_->hexdigest | ||
| 2115 | } @ds_record | ||
| 2116 | ) | ||
| 2117 | { | ||
| 2118 | push @ds_record, $tmp_ds_record; | ||
| 2119 | } | ||
| 2120 | } | ||
| 2121 | } | ||
| 2122 | undef %ip_already_processed; | ||
| 2123 | |||
| 2124 | if ( not scalar @ds_record ) { | ||
| 2125 | $continue_with_child_tests = 0; | ||
| 2126 | } | ||
| 2127 | |||
| 2128 | if ( $continue_with_child_tests ) { | ||
| 2129 | |||
| 2130 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 2131 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 2132 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 2133 | my %ip_already_processed; | ||
| 2134 | |||
| 2135 | for my $nss_key ( sort keys %nss ) { | ||
| 2136 | my $ns = $nss{$nss_key}; | ||
| 2137 | |||
| 2138 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 2139 | $ip_already_processed{$ns->address->short} = 1; | ||
| 2140 | |||
| 2141 | if ( _ip_disabled_message( \@results, $ns, q{DNSKEY} ) ) { | ||
| 2142 | next; | ||
| 2143 | } | ||
| 2144 | |||
| 2145 | my $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { dnssec => 1, usevc => 0 } ); | ||
| 2146 | if ( not $dnskey_p or $dnskey_p->rcode ne q{NOERROR} or not $dnskey_p->has_edns or not $dnskey_p->do or not $dnskey_p->aa ) { | ||
| 2147 | next; | ||
| 2148 | } | ||
| 2149 | my @dnskey_rrs = $dnskey_p->get_records_for_name( q{DNSKEY}, $zone->name->string, q{answer} ); | ||
| 2150 | if ( not scalar @dnskey_rrs ) { | ||
| 2151 | next; | ||
| 2152 | } | ||
| 2153 | |||
| 2154 | $responding_child_ns{$ns->address->short} = 1; | ||
| 2155 | |||
| 2156 | my @dnskey_rrsig = $dnskey_p->get_records_for_name( q{RRSIG}, $zone->name->string, q{answer} ); | ||
| 2157 | |||
| 2158 | %dnskey_matching_ds = (); | ||
| 2159 | |||
| 2160 | foreach my $ds ( @ds_record ) { | ||
| 2161 | my $matching_dnskey = undef; | ||
| 2162 | my @matching_keytag_dnskeys = grep { $ds->keytag == $_->keytag } @dnskey_rrs; | ||
| 2163 | my $match_ds_dnskey = 0; | ||
| 2164 | |||
| 2165 | foreach my $matching_keytag_dnskey ( @matching_keytag_dnskeys ) { | ||
| 2166 | if ( exists $LDNS_digest_algorithms_supported{$ds->digtype()} ) { | ||
| 2167 | my $tmp_ds = $matching_keytag_dnskey->ds($LDNS_digest_algorithms_supported{$ds->digtype()}); | ||
| 2168 | |||
| 2169 | if ( not $tmp_ds or $tmp_ds->hexdigest() eq $ds->hexdigest() ) { | ||
| 2170 | $matching_dnskey = $matching_keytag_dnskey; | ||
| 2171 | $match_ds_dnskey = 1; | ||
| 2172 | last; | ||
| 2173 | } | ||
| 2174 | } | ||
| 2175 | else{ | ||
| 2176 | $matching_dnskey = $matching_keytag_dnskey; | ||
| 2177 | $match_ds_dnskey = 1; | ||
| 2178 | last; | ||
| 2179 | } | ||
| 2180 | } | ||
| 2181 | |||
| 2182 | if ( scalar @matching_keytag_dnskeys >= 1 and not $match_ds_dnskey) { | ||
| 2183 | $matching_dnskey = shift @matching_keytag_dnskeys; | ||
| 2184 | } | ||
| 2185 | |||
| 2186 | if ( not $matching_dnskey ) { | ||
| 2187 | push @{ $no_dnskey_for_ds{$ds->keytag} }, $ns->address->short; | ||
| 2188 | } | ||
| 2189 | else { | ||
| 2190 | if ( not $match_ds_dnskey ) { | ||
| 2191 | push @{ $no_match_ds_dnskey{$ds->keytag} }, $ns->address->short; | ||
| 2192 | } | ||
| 2193 | if ( not $matching_dnskey->flags & 256 ) { # Bit 7 (ZONE) | ||
| 2194 | push @{ $dnskey_not_for_zone_signing{$ds->keytag} }, $ns->address->short; | ||
| 2195 | next; | ||
| 2196 | } | ||
| 2197 | if ( not $matching_dnskey->flags & 1 ) { # Bit 15 (SEP) | ||
| 2198 | push @{ $dnskey_not_sep{$ds->keytag} }, $ns->address->short; | ||
| 2199 | } | ||
| 2200 | |||
| 2201 | $dnskey_matching_ds{$matching_dnskey} = $matching_dnskey->keytag; | ||
| 2202 | $has_dnskey_match_ds{$ns->address->short} = 1; | ||
| 2203 | |||
| 2204 | foreach my $dnskey ( keys %dnskey_matching_ds ) { | ||
| 2205 | my @matching_keytag_rrsigs = grep { $dnskey_matching_ds{$dnskey} == $_->keytag } @dnskey_rrsig; | ||
| 2206 | my $time = $dnskey_p->timestamp; | ||
| 2207 | my $found_match = 0; | ||
| 2208 | |||
| 2209 | foreach my $rrsig_record ( @matching_keytag_rrsigs ) { | ||
| 2210 | my $msg = q{}; | ||
| 2211 | # Does not work if we have a list with just a DNSKEY | ||
| 2212 | #my @key_list = ( $matching_dnskey ); | ||
| 2213 | #my $validate = $rrsig_record->verify_time( \@key_list, \@key_list, $time, $msg ); | ||
| 2214 | my $validate = $rrsig_record->verify_time( \@dnskey_rrs, \@dnskey_rrs, $time, $msg ); | ||
| 2215 | if ( not $validate and $msg =~ /Unknown cryptographic algorithm/ ) { | ||
| 2216 | push @{ $algo_not_supported_by_zm{$rrsig_record->keytag}{$rrsig_record->algorithm} }, $ns->address->short; | ||
| 2217 | } | ||
| 2218 | elsif ( not $validate ) { | ||
| 2219 | push @{ $rrsig_not_valid_by_dnskey{$rrsig_record->keytag} }, $ns->address->short; | ||
| 2220 | } | ||
| 2221 | else { | ||
| 2222 | $found_match++; | ||
| 2223 | } | ||
| 2224 | } | ||
| 2225 | |||
| 2226 | if ( not scalar @matching_keytag_rrsigs or not $found_match ) { | ||
| 2227 | push @{ $no_matching_dnskey_rrsig{$dnskey_matching_ds{$dnskey}} }, $ns->address->short; | ||
| 2228 | } | ||
| 2229 | else { | ||
| 2230 | $has_rrsig_match_ds{$ns->address->short} = 1; | ||
| 2231 | } | ||
| 2232 | } | ||
| 2233 | } | ||
| 2234 | } | ||
| 2235 | } | ||
| 2236 | } | ||
| 2237 | |||
| 2238 | if ( scalar keys %no_dnskey_for_ds ) { | ||
| 2239 | push @results, map { | ||
| 2240 | _emit_log( | ||
| 2241 | DS02_NO_DNSKEY_FOR_DS => { | ||
| 2242 | keytag => $_, | ||
| 2243 | ns_ip_list => join( q{;}, uniq sort @{ $no_dnskey_for_ds{$_} } ) | ||
| 2244 | } | ||
| 2245 | ) | ||
| 2246 | } keys %no_dnskey_for_ds; | ||
| 2247 | } | ||
| 2248 | if ( scalar keys %no_match_ds_dnskey ) { | ||
| 2249 | push @results, map { | ||
| 2250 | _emit_log( | ||
| 2251 | DS02_NO_MATCH_DS_DNSKEY => { | ||
| 2252 | keytag => $_, | ||
| 2253 | ns_ip_list => join( q{;}, uniq sort @{ $no_match_ds_dnskey{$_} } ) | ||
| 2254 | } | ||
| 2255 | ) | ||
| 2256 | } keys %no_match_ds_dnskey; | ||
| 2257 | } | ||
| 2258 | if ( scalar keys %dnskey_not_for_zone_signing ) { | ||
| 2259 | push @results, map { | ||
| 2260 | _emit_log( | ||
| 2261 | DS02_DNSKEY_NOT_FOR_ZONE_SIGNING => { | ||
| 2262 | keytag => $_, | ||
| 2263 | ns_ip_list => join( q{;}, uniq sort @{ $dnskey_not_for_zone_signing{$_} } ) | ||
| 2264 | } | ||
| 2265 | ) | ||
| 2266 | } keys %dnskey_not_for_zone_signing; | ||
| 2267 | } | ||
| 2268 | if ( scalar keys %dnskey_not_sep ) { | ||
| 2269 | push @results, map { | ||
| 2270 | _emit_log( | ||
| 2271 | DS02_DNSKEY_NOT_SEP => { | ||
| 2272 | keytag => $_, | ||
| 2273 | ns_ip_list => join( q{;}, uniq sort @{ $dnskey_not_sep{$_} } ) | ||
| 2274 | } | ||
| 2275 | ) | ||
| 2276 | } keys %dnskey_not_sep; | ||
| 2277 | } | ||
| 2278 | if ( scalar keys %no_matching_dnskey_rrsig ) { | ||
| 2279 | push @results, map { | ||
| 2280 | _emit_log( | ||
| 2281 | DS02_NO_MATCHING_DNSKEY_RRSIG => { | ||
| 2282 | keytag => $_, | ||
| 2283 | ns_ip_list => join( q{;}, uniq sort @{ $no_matching_dnskey_rrsig{$_} } ) | ||
| 2284 | } | ||
| 2285 | ) | ||
| 2286 | } keys %no_matching_dnskey_rrsig; | ||
| 2287 | } | ||
| 2288 | if ( scalar keys %algo_not_supported_by_zm ) { | ||
| 2289 | foreach my $keytag ( keys %algo_not_supported_by_zm ) { | ||
| 2290 | push @results, map { | ||
| 2291 | _emit_log( | ||
| 2292 | DS02_ALGO_NOT_SUPPORTED_BY_ZM => { | ||
| 2293 | keytag => $keytag, | ||
| 2294 | algo_num => $_, | ||
| 2295 | algo_mnemo => $algo_properties{$_}{mnemonic}, | ||
| 2296 | ns_ip_list => join( q{;}, uniq sort @{ $algo_not_supported_by_zm{$keytag}{$_} } ) | ||
| 2297 | } | ||
| 2298 | ) | ||
| 2299 | } keys %{ $algo_not_supported_by_zm{$keytag} }; | ||
| 2300 | } | ||
| 2301 | } | ||
| 2302 | if ( scalar keys %rrsig_not_valid_by_dnskey ) { | ||
| 2303 | push @results, map { | ||
| 2304 | _emit_log( | ||
| 2305 | DS02_RRSIG_NOT_VALID_BY_DNSKEY => { | ||
| 2306 | keytag => $_, | ||
| 2307 | ns_ip_list => join( q{;}, uniq sort @{ $rrsig_not_valid_by_dnskey{$_} } ) | ||
| 2308 | } | ||
| 2309 | ) | ||
| 2310 | } keys %rrsig_not_valid_by_dnskey; | ||
| 2311 | } | ||
| 2312 | |||
| 2313 | foreach my $ns_ip ( keys %responding_child_ns ) { | ||
| 2314 | push @ns_dnskey, $ns_ip if not exists $has_dnskey_match_ds{$ns_ip}; | ||
| 2315 | push @ns_rrsig, $ns_ip if not exists $has_rrsig_match_ds{$ns_ip}; | ||
| 2316 | } | ||
| 2317 | |||
| 2318 | if ( scalar @ns_dnskey ) { | ||
| 2319 | push @results, | ||
| 2320 | _emit_log( | ||
| 2321 | DS02_NO_VALID_DNSKEY_FOR_ANY_DS => { | ||
| 2322 | ns_ip_list => join( q{;}, sort @ns_dnskey ) | ||
| 2323 | } | ||
| 2324 | ) | ||
| 2325 | } | ||
| 2326 | else { | ||
| 2327 | if ( scalar @ns_rrsig ) { | ||
| 2328 | push @results, | ||
| 2329 | _emit_log( | ||
| 2330 | DS02_DNSKEY_NOT_SIGNED_BY_ANY_DS => { | ||
| 2331 | ns_ip_list => join( q{;}, sort @ns_rrsig ) | ||
| 2332 | } | ||
| 2333 | ) | ||
| 2334 | } | ||
| 2335 | } | ||
| 2336 | |||
| 2337 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2338 | } ## end sub dnssec02 | ||
| 2339 | |||
| 2340 | =over | ||
| 2341 | |||
| 2342 | =item dnssec03() | ||
| 2343 | |||
| 2344 | my @logentry_array = dnssec03( $zone ); | ||
| 2345 | |||
| 2346 | Runs the L<DNSSEC03 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec03.md>. | ||
| 2347 | |||
| 2348 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 2349 | |||
| 2350 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 2351 | |||
| 2352 | =back | ||
| 2353 | |||
| 2354 | =cut | ||
| 2355 | |||
| 2356 | sub dnssec03 { | ||
| 2357 | my ( $self, $zone ) = @_; | ||
| 2358 | |||
| 2359 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC03'; | ||
| 2360 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 2361 | |||
| 2362 | my @responds_without_dnskey; | ||
| 2363 | my @responds_with_dnskey; | ||
| 2364 | my @responds_without_nsec3; | ||
| 2365 | my @responds_with_nsec3; | ||
| 2366 | my @multiple_nsec3; | ||
| 2367 | my %hash_algorithm; | ||
| 2368 | my %nsec3_flags; | ||
| 2369 | my %nsec3_iterations; | ||
| 2370 | my %nsec3_salt_length; | ||
| 2371 | my @no_response_nsec_query; | ||
| 2372 | my @error_response_nsec_query; | ||
| 2373 | |||
| 2374 | my %ip_already_processed; | ||
| 2375 | |||
| 2376 | foreach my $ns ( @{ Zonemaster::Engine::TestMethods->method4and5( $zone ) } ){ | ||
| 2377 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 2378 | $ip_already_processed{$ns->address->short} = 1; | ||
| 2379 | |||
| 2380 | if ( _ip_disabled_message( \@results, $ns, qw{DNSKEY NSEC} ) ) { | ||
| 2381 | next; | ||
| 2382 | } | ||
| 2383 | |||
| 2384 | my $p1 = $ns->query( $zone->name, q{DNSKEY}, { dnssec => 1 } ); | ||
| 2385 | |||
| 2386 | if ( not $p1 or $p1->rcode ne q{NOERROR} or not $p1->aa ) { | ||
| 2387 | next; | ||
| 2388 | } | ||
| 2389 | |||
| 2390 | if ( not scalar $p1->get_records_for_name( q{DNSKEY}, $zone->name, q{answer} ) ) { | ||
| 2391 | push @responds_without_dnskey, $ns; | ||
| 2392 | next; | ||
| 2393 | } | ||
| 2394 | |||
| 2395 | push @responds_with_dnskey, $ns; | ||
| 2396 | |||
| 2397 | my $p2 = $ns->query( $zone->name, q{NSEC}, { dnssec => 1 } ); | ||
| 2398 | |||
| 2399 | if ( not $p2 ) { | ||
| 2400 | push @no_response_nsec_query, $ns; | ||
| 2401 | next; | ||
| 2402 | } | ||
| 2403 | |||
| 2404 | if ( $p2->rcode ne q{NOERROR} or not $p2->aa ) { | ||
| 2405 | push @error_response_nsec_query, $ns; | ||
| 2406 | next; | ||
| 2407 | } | ||
| 2408 | |||
| 2409 | my @nsec3_rrs = $p2->get_records( q{NSEC3}, q{authority} ); | ||
| 2410 | |||
| 2411 | if ( not scalar @nsec3_rrs ) { | ||
| 2412 | push @responds_without_nsec3, $ns; | ||
| 2413 | next; | ||
| 2414 | } | ||
| 2415 | else { | ||
| 2416 | push @responds_with_nsec3, $ns; | ||
| 2417 | |||
| 2418 | if ( scalar @nsec3_rrs > 1 ) { | ||
| 2419 | push @multiple_nsec3, $ns; | ||
| 2420 | } | ||
| 2421 | |||
| 2422 | my $rr = ( @nsec3_rrs )[0]; | ||
| 2423 | |||
| 2424 | push @{ $hash_algorithm{$rr->algorithm} }, $ns if defined $rr->algorithm; | ||
| 2425 | push @{ $nsec3_flags{$rr->flags} }, $ns if defined $rr->flags; | ||
| 2426 | push @{ $nsec3_iterations{$rr->iterations} }, $ns if defined $rr->iterations; | ||
| 2427 | |||
| 2428 | if ( defined $rr->salt ) { | ||
| 2429 | push @{ $nsec3_salt_length{length unpack('H*', $rr->salt)} }, $ns; | ||
| 2430 | } | ||
| 2431 | else { | ||
| 2432 | push @{ $nsec3_salt_length{0} }, $ns; | ||
| 2433 | } | ||
| 2434 | } | ||
| 2435 | } | ||
| 2436 | |||
| 2437 | if ( not scalar @responds_with_dnskey and scalar @responds_without_dnskey ) { | ||
| 2438 | push @results, | ||
| 2439 | _emit_log( | ||
| 2440 | DS03_NO_DNSSEC_SUPPORT => { | ||
| 2441 | ns_list => join( q{;}, sort @responds_without_dnskey ) | ||
| 2442 | } | ||
| 2443 | ); | ||
| 2444 | } | ||
| 2445 | |||
| 2446 | if ( scalar @responds_with_dnskey and scalar @responds_without_dnskey ) { | ||
| 2447 | push @results, | ||
| 2448 | _emit_log( | ||
| 2449 | DS03_SERVER_NO_DNSSEC_SUPPORT => { | ||
| 2450 | ns_list => join( q{;}, sort @responds_without_dnskey ) | ||
| 2451 | } | ||
| 2452 | ); | ||
| 2453 | } | ||
| 2454 | |||
| 2455 | if ( not scalar @responds_with_nsec3 and scalar @responds_without_nsec3 ) { | ||
| 2456 | push @results, | ||
| 2457 | _emit_log( | ||
| 2458 | DS03_NO_NSEC3 => { | ||
| 2459 | ns_list => join( q{;}, sort @responds_without_nsec3 ) | ||
| 2460 | } | ||
| 2461 | ); | ||
| 2462 | } | ||
| 2463 | |||
| 2464 | if ( scalar @responds_with_nsec3 and scalar @responds_without_nsec3 ) { | ||
| 2465 | push @results, | ||
| 2466 | _emit_log( | ||
| 2467 | DS03_SERVER_NO_NSEC3 => { | ||
| 2468 | ns_list => join( q{;}, sort @responds_without_nsec3 ) | ||
| 2469 | } | ||
| 2470 | ); | ||
| 2471 | } | ||
| 2472 | |||
| 2473 | if ( scalar @multiple_nsec3 ) { | ||
| 2474 | push @results, | ||
| 2475 | _emit_log( | ||
| 2476 | DS03_ERR_MULT_NSEC3 => { | ||
| 2477 | ns_list => join( q{;}, sort @multiple_nsec3 ) | ||
| 2478 | } | ||
| 2479 | ); | ||
| 2480 | } | ||
| 2481 | |||
| 2482 | if ( scalar keys %hash_algorithm ) { | ||
| 2483 | if ( scalar keys %hash_algorithm > 1 ) { | ||
| 2484 | push @results, | ||
| 2485 | _emit_log( | ||
| 2486 | DS03_INCONSISTENT_HASH_ALGO => {} | ||
| 2487 | ); | ||
| 2488 | } | ||
| 2489 | |||
| 2490 | foreach my $algo ( keys %hash_algorithm ) { | ||
| 2491 | if ( $algo eq '1' ) { | ||
| 2492 | push @results, | ||
| 2493 | _emit_log( | ||
| 2494 | DS03_LEGAL_HASH_ALGO => { | ||
| 2495 | ns_list => join( q{;}, sort @{ $hash_algorithm{$algo} } ) | ||
| 2496 | } | ||
| 2497 | ); | ||
| 2498 | } | ||
| 2499 | else { | ||
| 2500 | push @results, | ||
| 2501 | _emit_log( | ||
| 2502 | DS03_ILLEGAL_HASH_ALGO => { | ||
| 2503 | ns_list => join( q{;}, sort @{ $hash_algorithm{$algo} } ), | ||
| 2504 | algo_num => $algo | ||
| 2505 | } | ||
| 2506 | ); | ||
| 2507 | } | ||
| 2508 | } | ||
| 2509 | } | ||
| 2510 | |||
| 2511 | if ( scalar keys %nsec3_flags ) { | ||
| 2512 | if ( scalar keys %nsec3_flags > 1 ) { | ||
| 2513 | push @results, | ||
| 2514 | _emit_log( | ||
| 2515 | DS03_INCONSISTENT_NSEC3_FLAGS => {} | ||
| 2516 | ); | ||
| 2517 | } | ||
| 2518 | |||
| 2519 | foreach my $flag ( keys %nsec3_flags ) { | ||
| 2520 | # Makes a list of bit positions corresponding to flags that are set, where the most-significant bit is 0. | ||
| 2521 | my @bit_positions = grep { $flag & (1 << ( 7 - $_ ) ) } (0..7); | ||
| 2522 | |||
| 2523 | foreach my $bit ( grep { $_ >= 0 and $_ <= 6 } @bit_positions ) { | ||
| 2524 | push @results, | ||
| 2525 | _emit_log( | ||
| 2526 | DS03_UNASSIGNED_FLAG_USED => { | ||
| 2527 | ns_list => join( q{;}, sort @{ $nsec3_flags{$flag} } ), | ||
| 2528 | int => $bit | ||
| 2529 | } | ||
| 2530 | ); | ||
| 2531 | } | ||
| 2532 | |||
| 2533 | if ( grep { $_ == 7 } @bit_positions ) { | ||
| 2534 | # Note below that the Public Suffix List check is not yet implemented. | ||
| 2535 | if ( $zone->name eq '.' or $zone->name->next_higher eq '.' ) { | ||
| 2536 | push @results, | ||
| 2537 | _emit_log( | ||
| 2538 | DS03_NSEC3_OPT_OUT_ENABLED_TLD => { | ||
| 2539 | ns_list => join( q{;}, sort @{ $nsec3_flags{$flag} } ) | ||
| 2540 | } | ||
| 2541 | ); | ||
| 2542 | } | ||
| 2543 | else { | ||
| 2544 | push @results, | ||
| 2545 | _emit_log( | ||
| 2546 | DS03_NSEC3_OPT_OUT_ENABLED_NON_TLD => { | ||
| 2547 | ns_list => join( q{;}, sort @{ $nsec3_flags{$flag} } ) | ||
| 2548 | } | ||
| 2549 | ); | ||
| 2550 | } | ||
| 2551 | } | ||
| 2552 | else { | ||
| 2553 | push @results, | ||
| 2554 | _emit_log( | ||
| 2555 | DS03_NSEC3_OPT_OUT_DISABLED => { | ||
| 2556 | ns_list => join( q{;}, sort @{ $nsec3_flags{$flag} } ) | ||
| 2557 | } | ||
| 2558 | ); | ||
| 2559 | } | ||
| 2560 | } | ||
| 2561 | } | ||
| 2562 | |||
| 2563 | if ( scalar keys %nsec3_iterations ) { | ||
| 2564 | if ( scalar keys %nsec3_iterations > 1 ) { | ||
| 2565 | push @results, | ||
| 2566 | _emit_log( | ||
| 2567 | DS03_INCONSISTENT_ITERATION => {} | ||
| 2568 | ); | ||
| 2569 | } | ||
| 2570 | |||
| 2571 | foreach my $iter ( keys %nsec3_iterations ) { | ||
| 2572 | if ( $iter eq '0' ) { | ||
| 2573 | push @results, | ||
| 2574 | _emit_log( | ||
| 2575 | DS03_LEGAL_ITERATION_VALUE => { | ||
| 2576 | ns_list => join( q{;}, sort @{ $nsec3_iterations{$iter} } ) | ||
| 2577 | } | ||
| 2578 | ); | ||
| 2579 | } | ||
| 2580 | else { | ||
| 2581 | push @results, | ||
| 2582 | _emit_log( | ||
| 2583 | DS03_ILLEGAL_ITERATION_VALUE => { | ||
| 2584 | ns_list => join( q{;}, sort @{ $nsec3_iterations{$iter} } ), | ||
| 2585 | int => $iter | ||
| 2586 | } | ||
| 2587 | ); | ||
| 2588 | } | ||
| 2589 | } | ||
| 2590 | } | ||
| 2591 | |||
| 2592 | if ( scalar keys %nsec3_salt_length ) { | ||
| 2593 | if ( scalar keys %nsec3_salt_length > 1 ) { | ||
| 2594 | push @results, | ||
| 2595 | _emit_log( | ||
| 2596 | DS03_INCONSISTENT_SALT_LENGTH => {} | ||
| 2597 | ); | ||
| 2598 | } | ||
| 2599 | |||
| 2600 | foreach my $salt ( keys %nsec3_salt_length ) { | ||
| 2601 | if ( $salt eq '0' ) { | ||
| 2602 | push @results, | ||
| 2603 | _emit_log( | ||
| 2604 | DS03_LEGAL_EMPTY_SALT => { | ||
| 2605 | ns_list => join( q{;}, sort @{ $nsec3_salt_length{$salt} } ) | ||
| 2606 | } | ||
| 2607 | ); | ||
| 2608 | } | ||
| 2609 | else { | ||
| 2610 | push @results, | ||
| 2611 | _emit_log( | ||
| 2612 | DS03_ILLEGAL_SALT_LENGTH => { | ||
| 2613 | ns_list => join( q{;}, sort @{ $nsec3_salt_length{$salt} } ), | ||
| 2614 | int => $salt | ||
| 2615 | } | ||
| 2616 | ); | ||
| 2617 | } | ||
| 2618 | } | ||
| 2619 | } | ||
| 2620 | |||
| 2621 | if ( scalar @no_response_nsec_query ) { | ||
| 2622 | push @results, | ||
| 2623 | _emit_log( | ||
| 2624 | DS03_NO_RESPONSE_NSEC_QUERY => { | ||
| 2625 | ns_list => join( q{;}, sort @no_response_nsec_query ) | ||
| 2626 | } | ||
| 2627 | ); | ||
| 2628 | } | ||
| 2629 | |||
| 2630 | if ( scalar @error_response_nsec_query ) { | ||
| 2631 | push @results, | ||
| 2632 | _emit_log( | ||
| 2633 | DS03_ERROR_RESPONSE_NSEC_QUERY => { | ||
| 2634 | ns_list => join( q{;}, sort @error_response_nsec_query ) | ||
| 2635 | } | ||
| 2636 | ); | ||
| 2637 | } | ||
| 2638 | |||
| 2639 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2640 | } ## end sub dnssec03 | ||
| 2641 | |||
| 2642 | =over | ||
| 2643 | |||
| 2644 | =item dnssec04() | ||
| 2645 | |||
| 2646 | my @logentry_array = dnssec04( $zone ); | ||
| 2647 | |||
| 2648 | Runs the L<DNSSEC04 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec04.md>. | ||
| 2649 | |||
| 2650 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 2651 | |||
| 2652 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 2653 | |||
| 2654 | =back | ||
| 2655 | |||
| 2656 | =cut | ||
| 2657 | |||
| 2658 | sub dnssec04 { | ||
| 2659 | my ( $self, $zone ) = @_; | ||
| 2660 | |||
| 2661 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC04'; | ||
| 2662 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 2663 | |||
| 2664 | my $dnskey_p = $zone->query_one( $zone->name, 'DNSKEY', { dnssec => 1 } ); | ||
| 2665 | if ( not $dnskey_p ) { | ||
| 2666 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2667 | } | ||
| 2668 | my @keys = $dnskey_p->get_records( 'DNSKEY', 'answer' ); | ||
| 2669 | my @key_sigs = $dnskey_p->get_records( 'RRSIG', 'answer' ); | ||
| 2670 | |||
| 2671 | my $soa_p = $zone->query_one( $zone->name, 'SOA', { dnssec => 1 } ); | ||
| 2672 | if ( not $soa_p ) { | ||
| 2673 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2674 | } | ||
| 2675 | my @soas = $soa_p->get_records( 'SOA', 'answer' ); | ||
| 2676 | my @soa_sigs = $soa_p->get_records( 'RRSIG', 'answer' ); | ||
| 2677 | |||
| 2678 | foreach my $sig ( @key_sigs, @soa_sigs ) { | ||
| 2679 | push @results, | ||
| 2680 | _emit_log( | ||
| 2681 | RRSIG_EXPIRATION => { | ||
| 2682 | date => scalar( gmtime($sig->expiration) ), | ||
| 2683 | keytag => $sig->keytag, | ||
| 2684 | types => $sig->typecovered, | ||
| 2685 | } | ||
| 2686 | ); | ||
| 2687 | |||
| 2688 | my $remaining = $sig->expiration - int( $dnskey_p->timestamp ); | ||
| 2689 | my $result_remaining; | ||
| 2690 | my $remaining_short_limit = Zonemaster::Engine::Profile->effective->get( q{test_cases_vars.dnssec04.REMAINING_SHORT} ); | ||
| 2691 | my $remaining_long_limit = Zonemaster::Engine::Profile->effective->get( q{test_cases_vars.dnssec04.REMAINING_LONG} ); | ||
| 2692 | my $duration_long_limit = Zonemaster::Engine::Profile->effective->get( q{test_cases_vars.dnssec04.DURATION_LONG} ); | ||
| 2693 | |||
| 2694 | if ( $remaining < 0 ) { # already expired | ||
| 2695 | $result_remaining = _emit_log( | ||
| 2696 | RRSIG_EXPIRED => { | ||
| 2697 | expiration => $sig->expiration, | ||
| 2698 | keytag => $sig->keytag, | ||
| 2699 | types => $sig->typecovered, | ||
| 2700 | } | ||
| 2701 | ); | ||
| 2702 | } | ||
| 2703 | elsif ( $remaining < ( $remaining_short_limit ) ) { | ||
| 2704 | $result_remaining = _emit_log( | ||
| 2705 | REMAINING_SHORT => { | ||
| 2706 | duration => $remaining, | ||
| 2707 | keytag => $sig->keytag, | ||
| 2708 | types => $sig->typecovered, | ||
| 2709 | } | ||
| 2710 | ); | ||
| 2711 | } | ||
| 2712 | elsif ( $remaining > ( $remaining_long_limit ) ) { | ||
| 2713 | $result_remaining = _emit_log( | ||
| 2714 | REMAINING_LONG => { | ||
| 2715 | duration => $remaining, | ||
| 2716 | keytag => $sig->keytag, | ||
| 2717 | types => $sig->typecovered, | ||
| 2718 | } | ||
| 2719 | ); | ||
| 2720 | } | ||
| 2721 | |||
| 2722 | my $duration = $sig->expiration - $sig->inception; | ||
| 2723 | my $result_duration; | ||
| 2724 | if ( $duration > ( $duration_long_limit ) ) { | ||
| 2725 | $result_duration = _emit_log( | ||
| 2726 | DURATION_LONG => { | ||
| 2727 | duration => $duration, | ||
| 2728 | keytag => $sig->keytag, | ||
| 2729 | types => $sig->typecovered, | ||
| 2730 | } | ||
| 2731 | ); | ||
| 2732 | } | ||
| 2733 | |||
| 2734 | if ( $result_remaining or $result_duration ) { | ||
| 2735 | push @results, $result_remaining if $result_remaining; | ||
| 2736 | push @results, $result_duration if $result_duration; | ||
| 2737 | } | ||
| 2738 | else { | ||
| 2739 | push @results, | ||
| 2740 | _emit_log( | ||
| 2741 | DURATION_OK => { | ||
| 2742 | duration => $duration, | ||
| 2743 | keytag => $sig->keytag, | ||
| 2744 | types => $sig->typecovered, | ||
| 2745 | } | ||
| 2746 | ); | ||
| 2747 | } | ||
| 2748 | } ## end foreach my $sig ( @key_sigs...) | ||
| 2749 | |||
| 2750 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2751 | } ## end sub dnssec04 | ||
| 2752 | |||
| 2753 | =over | ||
| 2754 | |||
| 2755 | =item dnssec05() | ||
| 2756 | |||
| 2757 | my @logentry_array = dnssec05( $zone ); | ||
| 2758 | |||
| 2759 | Runs the L<DNSSEC05 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec05.md>. | ||
| 2760 | |||
| 2761 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 2762 | |||
| 2763 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 2764 | |||
| 2765 | =back | ||
| 2766 | |||
| 2767 | =cut | ||
| 2768 | |||
| 2769 | sub dnssec05 { | ||
| 2770 | my ( $self, $zone ) = @_; | ||
| 2771 | |||
| 2772 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC05'; | ||
| 2773 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 2774 | |||
| 2775 | my @ignored_ns_ip; | ||
| 2776 | my @responds_without_dnskey; | ||
| 2777 | my @responds_with_dnskey; | ||
| 2778 | my %sets = ( | ||
| 2779 | 'DS05_ALGO_DEPRECATED' => {}, | ||
| 2780 | 'DS05_ALGO_RESERVED' => {}, | ||
| 2781 | 'DS05_ALGO_UNASSIGNED' => {}, | ||
| 2782 | 'DS05_ALGO_NOT_RECOMMENDED' => {}, | ||
| 2783 | 'DS05_ALGO_PRIVATE' => {}, | ||
| 2784 | 'DS05_ALGO_NOT_ZONE_SIGN' => {}, | ||
| 2785 | 'DS05_ALGO_OK' => {} | ||
| 2786 | ); | ||
| 2787 | |||
| 2788 | my @nss = uniq grep { $_->isa('Zonemaster::Engine::Nameserver') } ( | ||
| 2789 | @{ Zonemaster::Engine::TestMethodsV2->get_del_ns_names_and_ips( $zone ) // [] }, | ||
| 2790 | @{ Zonemaster::Engine::TestMethodsV2->get_zone_ns_names_and_ips( $zone ) // [] } | ||
| 2791 | ); | ||
| 2792 | |||
| 2793 | my %ip_already_processed; | ||
| 2794 | for my $ns ( @nss ) { | ||
| 2795 | my $ns_ip = $ns->address->short; | ||
| 2796 | |||
| 2797 | next if exists $ip_already_processed{$ns_ip}; | ||
| 2798 | $ip_already_processed{$ns_ip} = [ grep { $_->address->short eq $ns_ip } @nss ]; | ||
| 2799 | |||
| 2800 | if ( _ip_disabled_message( \@results, $ns, 'DNSKEY' ) ) { | ||
| 2801 | next; | ||
| 2802 | } | ||
| 2803 | |||
| 2804 | my @matching_nss = @{ $ip_already_processed{$ns_ip} }; | ||
| 2805 | |||
| 2806 | my $dnskey_p = $ns->query( $zone->name, 'DNSKEY', { dnssec => 1 } ); | ||
| 2807 | |||
| 2808 | if ( not $dnskey_p or $dnskey_p->rcode ne 'NOERROR' or not $dnskey_p->aa ) { | ||
| 2809 | push @ignored_ns_ip, @matching_nss; | ||
| 2810 | next; | ||
| 2811 | } | ||
| 2812 | |||
| 2813 | my @dnskey_rrs = $dnskey_p->get_records_for_name( 'DNSKEY', $zone->name->fqdn, 'answer' ); | ||
| 2814 | |||
| 2815 | if ( not @dnskey_rrs ) { | ||
| 2816 | push @responds_without_dnskey, @matching_nss; | ||
| 2817 | next; | ||
| 2818 | } | ||
| 2819 | |||
| 2820 | push @responds_with_dnskey, @matching_nss; | ||
| 2821 | |||
| 2822 | foreach my $rr ( @dnskey_rrs ) { | ||
| 2823 | my $algo = $rr->algorithm; | ||
| 2824 | my $keytag = $rr->keytag; | ||
| 2825 | |||
| 2826 | push @{ $sets{$dnssec05_tags_mapping{$algo}}->{$algo}{$keytag} }, @matching_nss; | ||
| 2827 | } | ||
| 2828 | } | ||
| 2829 | |||
| 2830 | while ( my ($tag_name, $set_ref) = each %sets ) { | ||
| 2831 | my %values = %{ $set_ref }; | ||
| 2832 | if ( %values ) { | ||
| 2833 | foreach my $algo ( keys %values ) { | ||
| 2834 | foreach my $keytag ( keys %{ $values{$algo} } ) { | ||
| 2835 | push @results, | ||
| 2836 | _emit_log( | ||
| 2837 | $tag_name => { | ||
| 2838 | ns_list => join( q{;}, uniq sort @{ $values{$algo}{$keytag} } ), | ||
| 2839 | keytag => $keytag, | ||
| 2840 | algo_num => $algo, | ||
| 2841 | algo_descr => $algo_properties{$algo}{description}, | ||
| 2842 | algo_mnemo => $algo_properties{$algo}{mnemonic} | ||
| 2843 | } | ||
| 2844 | ); | ||
| 2845 | } | ||
| 2846 | } | ||
| 2847 | } | ||
| 2848 | } | ||
| 2849 | |||
| 2850 | if ( not @responds_without_dnskey and not @responds_with_dnskey ) { | ||
| 2851 | push @results, | ||
| 2852 | _emit_log( | ||
| 2853 | DS05_NO_RESPONSE => { | ||
| 2854 | ns_list => join( q{;}, uniq sort @ignored_ns_ip ) | ||
| 2855 | } | ||
| 2856 | ); | ||
| 2857 | } | ||
| 2858 | |||
| 2859 | if ( @responds_without_dnskey ) { | ||
| 2860 | if ( not @responds_with_dnskey ) { | ||
| 2861 | push @results, | ||
| 2862 | _emit_log( | ||
| 2863 | DS05_ZONE_NO_DNSSEC => { | ||
| 2864 | ns_list => join( q{;}, uniq sort @responds_without_dnskey ) | ||
| 2865 | } | ||
| 2866 | ); | ||
| 2867 | } | ||
| 2868 | else { | ||
| 2869 | push @results, | ||
| 2870 | _emit_log( | ||
| 2871 | DS05_SERVER_NO_DNSSEC => { | ||
| 2872 | ns_list => join( q{;}, uniq sort @responds_without_dnskey ) | ||
| 2873 | } | ||
| 2874 | ); | ||
| 2875 | } | ||
| 2876 | } | ||
| 2877 | |||
| 2878 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2879 | } ## end sub dnssec05 | ||
| 2880 | |||
| 2881 | =over | ||
| 2882 | |||
| 2883 | =item dnssec06() | ||
| 2884 | |||
| 2885 | my @logentry_array = dnssec06( $zone ); | ||
| 2886 | |||
| 2887 | Runs the L<DNSSEC06 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec06.md>. | ||
| 2888 | |||
| 2889 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 2890 | |||
| 2891 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 2892 | |||
| 2893 | =back | ||
| 2894 | |||
| 2895 | =cut | ||
| 2896 | |||
| 2897 | sub dnssec06 { | ||
| 2898 | my ( $self, $zone ) = @_; | ||
| 2899 | |||
| 2900 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC06'; | ||
| 2901 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 2902 | |||
| 2903 | my $dnskey_aref = $zone->query_all( $zone->name, 'DNSKEY', { dnssec => 1 } ); | ||
| 2904 | foreach my $dnskey_p ( @{$dnskey_aref} ) { | ||
| 2905 | next if not $dnskey_p; | ||
| 2906 | |||
| 2907 | my @keys = $dnskey_p->get_records( 'DNSKEY', 'answer' ); | ||
| 2908 | my @sigs = $dnskey_p->get_records( 'RRSIG', 'answer' ); | ||
| 2909 | if ( @sigs > 0 and @keys > 0 ) { | ||
| 2910 | push @results, | ||
| 2911 | _emit_log( | ||
| 2912 | EXTRA_PROCESSING_OK => { | ||
| 2913 | server => $dnskey_p->answerfrom, | ||
| 2914 | keys => scalar( @keys ), | ||
| 2915 | sigs => scalar( @sigs ), | ||
| 2916 | } | ||
| 2917 | ); | ||
| 2918 | } | ||
| 2919 | elsif ( $dnskey_p->rcode eq q{NOERROR} and ( @sigs == 0 or @keys == 0 ) ) { | ||
| 2920 | push @results, | ||
| 2921 | _emit_log( | ||
| 2922 | EXTRA_PROCESSING_BROKEN => { | ||
| 2923 | server => $dnskey_p->answerfrom, | ||
| 2924 | keys => scalar( @keys ), | ||
| 2925 | sigs => scalar( @sigs ) | ||
| 2926 | } | ||
| 2927 | ); | ||
| 2928 | } | ||
| 2929 | } ## end foreach my $dnskey_p ( @{$dnskey_aref...}) | ||
| 2930 | |||
| 2931 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 2932 | } ## end sub dnssec06 | ||
| 2933 | |||
| 2934 | =over | ||
| 2935 | |||
| 2936 | =item dnssec07() | ||
| 2937 | |||
| 2938 | my @logentry_array = dnssec07( $zone ); | ||
| 2939 | |||
| 2940 | Runs the L<DNSSEC07 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec07.md>. | ||
| 2941 | |||
| 2942 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 2943 | |||
| 2944 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 2945 | |||
| 2946 | =back | ||
| 2947 | |||
| 2948 | =cut | ||
| 2949 | |||
| 2950 | sub dnssec07 { | ||
| 2951 | my ( $self, $zone ) = @_; | ||
| 2952 | |||
| 2953 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC07'; | ||
| 2954 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 2955 | |||
| 2956 | my $type_soa = q{SOA}; | ||
| 2957 | my $type_dnskey = q{DNSKEY}; | ||
| 2958 | my $type_ds = q{DS}; | ||
| 2959 | my @query_types = ( $type_soa, $type_dnskey, $type_ds ); | ||
| 2960 | |||
| 2961 | my ( @ignored_child_ns, @ignored_parent_ns_ip ); | ||
| 2962 | my ( @no_response_dnskey, @signed_response ); | ||
| 2963 | my ( @no_auth_dnskey, %error_rcode_dnskey ); | ||
| 2964 | my ( @no_dnskey, @no_ds, @ds_in_response ); | ||
| 2965 | |||
| 2966 | my @child_nss = uniq grep { $_->isa('Zonemaster::Engine::Nameserver') } ( | ||
| 2967 | @{ Zonemaster::Engine::TestMethodsV2->get_del_ns_names_and_ips( $zone ) // [] }, | ||
| 2968 | @{ Zonemaster::Engine::TestMethodsV2->get_zone_ns_names_and_ips( $zone ) // [] } | ||
| 2969 | ); | ||
| 2970 | |||
| 2971 | my %ip_already_processed; | ||
| 2972 | for my $ns ( @child_nss ) { | ||
| 2973 | my $ns_ip = $ns->address->short; | ||
| 2974 | |||
| 2975 | next if exists $ip_already_processed{$ns_ip}; | ||
| 2976 | $ip_already_processed{$ns_ip} = [ grep { $_->address->short eq $ns_ip } @child_nss ]; | ||
| 2977 | |||
| 2978 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 2979 | next; | ||
| 2980 | } | ||
| 2981 | |||
| 2982 | my @matching_nss = @{ $ip_already_processed{$ns_ip} }; | ||
| 2983 | |||
| 2984 | my $soa_p = $ns->query( $zone->name, $type_soa ); | ||
| 2985 | |||
| 2986 | if ( not $soa_p or $soa_p->rcode ne 'NOERROR' or not $soa_p->aa or not $soa_p->get_records( $type_soa, 'answer' ) ) { | ||
| 2987 | push @ignored_child_ns, @matching_nss; | ||
| 2988 | next; | ||
| 2989 | } | ||
| 2990 | |||
| 2991 | my $dnskey_p = $ns->query( $zone->name, $type_dnskey, { dnssec => 1 } ); | ||
| 2992 | |||
| 2993 | if ( not $dnskey_p ) { | ||
| 2994 | push @no_response_dnskey, @matching_nss; | ||
| 2995 | next; | ||
| 2996 | } | ||
| 2997 | |||
| 2998 | if ( not $dnskey_p->aa ) { | ||
| 2999 | push @no_auth_dnskey, @matching_nss; | ||
| 3000 | next; | ||
| 3001 | } | ||
| 3002 | |||
| 3003 | if ( $dnskey_p->rcode ne 'NOERROR' ) { | ||
| 3004 | push @{ $error_rcode_dnskey{$dnskey_p->rcode} }, @matching_nss; | ||
| 3005 | next; | ||
| 3006 | } | ||
| 3007 | |||
| 3008 | my @dnskey_rrs = $dnskey_p->get_records( $type_dnskey, 'answer' ); | ||
| 3009 | my @rrsig_rrs = $dnskey_p->get_records( 'RRSIG', 'answer' ); | ||
| 3010 | |||
| 3011 | my $covered_dnskey = 0; | ||
| 3012 | foreach my $rr ( @rrsig_rrs ) { | ||
| 3013 | if ( $rr->typecovered eq $type_dnskey ) { | ||
| 3014 | $covered_dnskey = 1; | ||
| 3015 | last; | ||
| 3016 | } | ||
| 3017 | } | ||
| 3018 | |||
| 3019 | if ( $covered_dnskey ) { | ||
| 3020 | push @signed_response, @matching_nss; | ||
| 3021 | } | ||
| 3022 | else { | ||
| 3023 | push @no_dnskey, @matching_nss; | ||
| 3024 | } | ||
| 3025 | } | ||
| 3026 | |||
| 3027 | my $parent_ref = Zonemaster::Engine::TestMethodsV2->get_parent_ns_names_and_ips( $zone ); | ||
| 3028 | |||
| 3029 | my @undelegated_ds; | ||
| 3030 | if ( my $parent = $zone->parent ) { | ||
| 3031 | foreach my $ns ( @{ $parent->ns } ) { | ||
| 3032 | if ( $ns->fake_ds->{$zone->name} ) { | ||
| 3033 | @undelegated_ds = @{ $ns->fake_ds->{$zone->name} }; | ||
| 3034 | |||
| 3035 | if ( @undelegated_ds ) { | ||
| 3036 | push @ds_in_response, '-'; | ||
| 3037 | $parent_ref = undef; | ||
| 3038 | } | ||
| 3039 | } | ||
| 3040 | } | ||
| 3041 | } | ||
| 3042 | |||
| 3043 | if ( not @signed_response ) { | ||
| 3044 | $parent_ref = undef; | ||
| 3045 | @ds_in_response = (); | ||
| 3046 | } | ||
| 3047 | |||
| 3048 | my @parent_nss = @{ $parent_ref // [] }; | ||
| 3049 | |||
| 3050 | %ip_already_processed = (); | ||
| 3051 | foreach my $ns ( @parent_nss ) { | ||
| 3052 | my $ns_ip = $ns->address->short; | ||
| 3053 | |||
| 3054 | next if exists $ip_already_processed{$ns_ip}; | ||
| 3055 | $ip_already_processed{$ns_ip} = [ grep { $_->address->short eq $ns_ip } @parent_nss ]; | ||
| 3056 | |||
| 3057 | if ( _ip_disabled_message( \@results, $ns, $type_ds ) ) { | ||
| 3058 | next; | ||
| 3059 | } | ||
| 3060 | |||
| 3061 | my @matching_nss = @{ $ip_already_processed{$ns_ip} }; | ||
| 3062 | |||
| 3063 | my $ds_p = $ns->query( $zone->name, $type_ds, { dnssec => 1 } ); | ||
| 3064 | |||
| 3065 | if ( not $ds_p or $ds_p->rcode ne q{NOERROR} or not $ds_p->has_edns or not $ds_p->do or not $ds_p->aa ) { | ||
| 3066 | push @ignored_parent_ns_ip, @matching_nss; | ||
| 3067 | next; | ||
| 3068 | } | ||
| 3069 | |||
| 3070 | my @ds_rrs = $ds_p->get_records_for_name( $type_ds, $zone->name, q{answer} ); | ||
| 3071 | my @rrsig_rrs = $ds_p->get_records_for_name( q{RRSIG}, $zone->name, q{answer} ); | ||
| 3072 | |||
| 3073 | my $covered_ds = 0; | ||
| 3074 | foreach my $rr ( @rrsig_rrs ) { | ||
| 3075 | if ( $rr->typecovered eq $type_ds ) { | ||
| 3076 | $covered_ds = 1; | ||
| 3077 | last; | ||
| 3078 | } | ||
| 3079 | } | ||
| 3080 | |||
| 3081 | if ( $covered_ds ) { | ||
| 3082 | push @ds_in_response, @matching_nss; | ||
| 3083 | } | ||
| 3084 | else { | ||
| 3085 | push @no_ds, @matching_nss; | ||
| 3086 | } | ||
| 3087 | } | ||
| 3088 | |||
| 3089 | my @combined = uniq ( @ignored_child_ns, @no_response_dnskey, @no_auth_dnskey, map { @{ $error_rcode_dnskey{$_} } } keys %error_rcode_dnskey ); | ||
| 3090 | my $lc = List::Compare->new(\@combined, \@child_nss); | ||
| 3091 | |||
| 3092 | if ( not $lc->get_symmetric_difference ) { | ||
| 3093 | push @results, | ||
| 3094 | _emit_log( | ||
| 3095 | DS07_NOT_SIGNED => {} | ||
| 3096 | ); | ||
| 3097 | } | ||
| 3098 | |||
| 3099 | if ( @no_response_dnskey ) { | ||
| 3100 | push @results, | ||
| 3101 | _emit_log( | ||
| 3102 | DS07_NO_RESPONSE_DNSKEY => { | ||
| 3103 | ns_list => join( q{;}, uniq sort @no_response_dnskey ) | ||
| 3104 | } | ||
| 3105 | ); | ||
| 3106 | } | ||
| 3107 | |||
| 3108 | if ( @no_auth_dnskey ) { | ||
| 3109 | push @results, | ||
| 3110 | _emit_log( | ||
| 3111 | DS07_NON_AUTH_RESPONSE_DNSKEY => { | ||
| 3112 | ns_list => join( q{;}, uniq sort @no_auth_dnskey ) | ||
| 3113 | } | ||
| 3114 | ); | ||
| 3115 | } | ||
| 3116 | |||
| 3117 | if ( keys %error_rcode_dnskey ) { | ||
| 3118 | push @results, | ||
| 3119 | _emit_log( | ||
| 3120 | DS07_UNEXP_RCODE_RESP_DNSKEY => { | ||
| 3121 | ns_list => join( q{;}, uniq sort @{ $error_rcode_dnskey{$_} } ), | ||
| 3122 | rcode => $_ | ||
| 3123 | } | ||
| 3124 | ) for keys %error_rcode_dnskey; | ||
| 3125 | } | ||
| 3126 | |||
| 3127 | if ( @signed_response ) { | ||
| 3128 | push @results, | ||
| 3129 | _emit_log( | ||
| 3130 | DS07_SIGNED_ON_SERVER => { | ||
| 3131 | ns_list => join( q{;}, uniq sort @signed_response ) | ||
| 3132 | } | ||
| 3133 | ); | ||
| 3134 | } | ||
| 3135 | |||
| 3136 | if ( @no_dnskey ) { | ||
| 3137 | push @results, | ||
| 3138 | _emit_log( | ||
| 3139 | DS07_NOT_SIGNED_ON_SERVER => { | ||
| 3140 | ns_list => join( q{;}, uniq sort @no_dnskey ) | ||
| 3141 | } | ||
| 3142 | ); | ||
| 3143 | } | ||
| 3144 | |||
| 3145 | if ( @signed_response and @no_dnskey ) { | ||
| 3146 | push @results, | ||
| 3147 | _emit_log( | ||
| 3148 | DS07_INCONSISTENT_SIGNED => {} | ||
| 3149 | ); | ||
| 3150 | } | ||
| 3151 | |||
| 3152 | if ( @signed_response and not @no_dnskey ) { | ||
| 3153 | push @results, | ||
| 3154 | _emit_log( | ||
| 3155 | DS07_SIGNED => {} | ||
| 3156 | ); | ||
| 3157 | } | ||
| 3158 | |||
| 3159 | if ( not @signed_response and @no_dnskey ) { | ||
| 3160 | push @results, | ||
| 3161 | _emit_log( | ||
| 3162 | DS07_NOT_SIGNED => {} | ||
| 3163 | ); | ||
| 3164 | } | ||
| 3165 | |||
| 3166 | if ( @no_ds ) { | ||
| 3167 | push @results, | ||
| 3168 | _emit_log( | ||
| 3169 | DS07_NO_DS_ON_PARENT_SERVER => { | ||
| 3170 | ns_list => join( q{;}, uniq sort @no_ds ) | ||
| 3171 | } | ||
| 3172 | ); | ||
| 3173 | } | ||
| 3174 | |||
| 3175 | if ( @ds_in_response ) { | ||
| 3176 | push @results, | ||
| 3177 | _emit_log( | ||
| 3178 | DS07_DS_ON_PARENT_SERVER => { | ||
| 3179 | ns_list => join( q{;}, uniq sort @ds_in_response ) | ||
| 3180 | } | ||
| 3181 | ); | ||
| 3182 | } | ||
| 3183 | |||
| 3184 | if ( @no_ds and @ds_in_response ) { | ||
| 3185 | push @results, | ||
| 3186 | _emit_log( | ||
| 3187 | DS07_INCONSISTENT_DS => {} | ||
| 3188 | ); | ||
| 3189 | } | ||
| 3190 | |||
| 3191 | if ( not @no_dnskey and @signed_response ) { | ||
| 3192 | if ( @no_ds and not @ds_in_response ) { | ||
| 3193 | push @results, | ||
| 3194 | _emit_log( | ||
| 3195 | DS07_NO_DS_FOR_SIGNED_ZONE => {} | ||
| 3196 | ); | ||
| 3197 | } | ||
| 3198 | if ( not @no_ds and @ds_in_response ) { | ||
| 3199 | push @results, | ||
| 3200 | _emit_log( | ||
| 3201 | DS07_DS_FOR_SIGNED_ZONE => {} | ||
| 3202 | ); | ||
| 3203 | } | ||
| 3204 | } | ||
| 3205 | |||
| 3206 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 3207 | } ## end sub dnssec07 | ||
| 3208 | |||
| 3209 | =over | ||
| 3210 | |||
| 3211 | =item dnssec08() | ||
| 3212 | |||
| 3213 | my @logentry_array = dnssec08( $zone ); | ||
| 3214 | |||
| 3215 | Runs the L<DNSSEC08 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec08.md>. | ||
| 3216 | |||
| 3217 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 3218 | |||
| 3219 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 3220 | |||
| 3221 | =back | ||
| 3222 | |||
| 3223 | =cut | ||
| 3224 | |||
| 3225 | sub dnssec08 { | ||
| 3226 | my ( $self, $zone ) = @_; | ||
| 3227 | |||
| 3228 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC08'; | ||
| 3229 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 3230 | my @dnskey_without_rrsig; | ||
| 3231 | my %dnskey_rrsig_not_yet_valid; | ||
| 3232 | my %dnskey_rrsig_expired; | ||
| 3233 | my %no_matching_dnskey; | ||
| 3234 | my %rrsig_not_valid_by_dnskey; | ||
| 3235 | my %algo_not_supported_by_zm; | ||
| 3236 | |||
| 3237 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 3238 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 3239 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 3240 | my %ip_already_processed; | ||
| 3241 | |||
| 3242 | for my $nss_key ( sort keys %nss ) { | ||
| 3243 | my $ns = $nss{$nss_key}; | ||
| 3244 | |||
| 3245 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 3246 | $ip_already_processed{$ns->address->short} = 1; | ||
| 3247 | |||
| 3248 | if ( _ip_disabled_message( \@results, $ns, q{DNSKEY} ) ) { | ||
| 3249 | next; | ||
| 3250 | } | ||
| 3251 | |||
| 3252 | my $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { dnssec => 1 } ); | ||
| 3253 | if ( not $dnskey_p ) { | ||
| 3254 | next; | ||
| 3255 | } | ||
| 3256 | if ( $dnskey_p->rcode ne q{NOERROR} ) { | ||
| 3257 | next; | ||
| 3258 | } | ||
| 3259 | if ( not $dnskey_p->aa ) { | ||
| 3260 | next; | ||
| 3261 | } | ||
| 3262 | |||
| 3263 | my @dnskey_records = $dnskey_p->get_records_for_name( q{DNSKEY}, $zone->name->string, q{answer} ); | ||
| 3264 | if ( not scalar @dnskey_records ) { | ||
| 3265 | next; | ||
| 3266 | } | ||
| 3267 | @dnskey_records = $dnskey_p->get_records( q{DNSKEY}, q{answer} ); | ||
| 3268 | my @rrsig_records = $dnskey_p->get_records( q{RRSIG}, q{answer} ); | ||
| 3269 | |||
| 3270 | if ( not scalar @rrsig_records ) { | ||
| 3271 | push @dnskey_without_rrsig, $ns->address->short; | ||
| 3272 | next; | ||
| 3273 | } | ||
| 3274 | |||
| 3275 | my $time = $dnskey_p->timestamp; | ||
| 3276 | foreach my $rrsig_record ( @rrsig_records ) { | ||
| 3277 | if ( $rrsig_record->inception > $time ) { | ||
| 3278 | push @{ $dnskey_rrsig_not_yet_valid{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3279 | } | ||
| 3280 | elsif ( $rrsig_record->expiration < $time ) { | ||
| 3281 | push @{ $dnskey_rrsig_expired{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3282 | } | ||
| 3283 | else { | ||
| 3284 | my $msg = q{}; | ||
| 3285 | my $validate = $rrsig_record->verify_time( \@dnskey_records, \@dnskey_records, $time, $msg ); | ||
| 3286 | if ( not $validate and $msg =~ /Unknown cryptographic algorithm/ ) { | ||
| 3287 | push @{ $algo_not_supported_by_zm{$rrsig_record->keytag}{$rrsig_record->algorithm} }, $ns->address->short; | ||
| 3288 | } | ||
| 3289 | elsif ( not scalar grep { $_->keytag == $rrsig_record->keytag } @dnskey_records ) { | ||
| 3290 | push @{ $no_matching_dnskey{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3291 | } | ||
| 3292 | elsif ( not $validate ) { | ||
| 3293 | push @{ $rrsig_not_valid_by_dnskey{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3294 | } | ||
| 3295 | } | ||
| 3296 | } | ||
| 3297 | } | ||
| 3298 | if ( scalar @dnskey_without_rrsig ) { | ||
| 3299 | push @results, | ||
| 3300 | _emit_log( | ||
| 3301 | DS08_MISSING_RRSIG_IN_RESPONSE => { | ||
| 3302 | ns_ip_list => join( q{;}, uniq sort @dnskey_without_rrsig ) | ||
| 3303 | } | ||
| 3304 | ); | ||
| 3305 | } | ||
| 3306 | if ( scalar keys %dnskey_rrsig_not_yet_valid ) { | ||
| 3307 | push @results, map { | ||
| 3308 | _emit_log( | ||
| 3309 | DS08_DNSKEY_RRSIG_NOT_YET_VALID => { | ||
| 3310 | keytag => $_, | ||
| 3311 | ns_ip_list => join( q{;}, uniq sort @{ $dnskey_rrsig_not_yet_valid{$_} } ) | ||
| 3312 | } | ||
| 3313 | ) | ||
| 3314 | } keys %dnskey_rrsig_not_yet_valid; | ||
| 3315 | } | ||
| 3316 | if ( scalar keys %dnskey_rrsig_expired ) { | ||
| 3317 | push @results, map { | ||
| 3318 | _emit_log( | ||
| 3319 | DS08_DNSKEY_RRSIG_EXPIRED => { | ||
| 3320 | keytag => $_, | ||
| 3321 | ns_ip_list => join( q{;}, uniq sort @{ $dnskey_rrsig_expired{$_} } ) | ||
| 3322 | } | ||
| 3323 | ) | ||
| 3324 | } keys %dnskey_rrsig_expired; | ||
| 3325 | } | ||
| 3326 | if ( scalar keys %no_matching_dnskey ) { | ||
| 3327 | push @results, map { | ||
| 3328 | _emit_log( | ||
| 3329 | DS08_NO_MATCHING_DNSKEY => { | ||
| 3330 | keytag => $_, | ||
| 3331 | ns_ip_list => join( q{;}, uniq sort @{ $no_matching_dnskey{$_} } ) | ||
| 3332 | } | ||
| 3333 | ) | ||
| 3334 | } keys %no_matching_dnskey; | ||
| 3335 | } | ||
| 3336 | if ( scalar keys %rrsig_not_valid_by_dnskey ) { | ||
| 3337 | push @results, map { | ||
| 3338 | _emit_log( | ||
| 3339 | DS08_RRSIG_NOT_VALID_BY_DNSKEY => { | ||
| 3340 | keytag => $_, | ||
| 3341 | ns_ip_list => join( q{;}, uniq sort @{ $rrsig_not_valid_by_dnskey{$_} } ) | ||
| 3342 | } | ||
| 3343 | ) | ||
| 3344 | } keys %rrsig_not_valid_by_dnskey; | ||
| 3345 | } | ||
| 3346 | if ( scalar keys %algo_not_supported_by_zm ) { | ||
| 3347 | foreach my $keytag ( keys %algo_not_supported_by_zm ) { | ||
| 3348 | push @results, map { | ||
| 3349 | _emit_log( | ||
| 3350 | DS08_ALGO_NOT_SUPPORTED_BY_ZM => { | ||
| 3351 | keytag => $keytag, | ||
| 3352 | algo_num => $_, | ||
| 3353 | algo_mnemo => $algo_properties{$_}{mnemonic}, | ||
| 3354 | ns_ip_list => join( q{;}, uniq sort @{ $algo_not_supported_by_zm{$keytag}{$_} } ) | ||
| 3355 | } | ||
| 3356 | ) | ||
| 3357 | } keys %{ $algo_not_supported_by_zm{$keytag} }; | ||
| 3358 | } | ||
| 3359 | } | ||
| 3360 | |||
| 3361 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 3362 | } ## end sub dnssec08 | ||
| 3363 | |||
| 3364 | =over | ||
| 3365 | |||
| 3366 | =item dnssec09() | ||
| 3367 | |||
| 3368 | my @logentry_array = dnssec09( $zone ); | ||
| 3369 | |||
| 3370 | Runs the L<DNSSEC09 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec09.md>. | ||
| 3371 | |||
| 3372 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 3373 | |||
| 3374 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 3375 | |||
| 3376 | =back | ||
| 3377 | |||
| 3378 | =cut | ||
| 3379 | |||
| 3380 | sub dnssec09 { | ||
| 3381 | my ( $self, $zone ) = @_; | ||
| 3382 | |||
| 3383 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC09'; | ||
| 3384 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 3385 | my @soa_without_rrsig; | ||
| 3386 | my %soa_rrsig_not_yet_valid; | ||
| 3387 | my %soa_rrsig_expired; | ||
| 3388 | my %no_matching_dnskey; | ||
| 3389 | my %rrsig_not_valid_by_dnskey; | ||
| 3390 | my %algo_not_supported_by_zm; | ||
| 3391 | |||
| 3392 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 3393 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 3394 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 3395 | my %ip_already_processed; | ||
| 3396 | |||
| 3397 | for my $nss_key ( sort keys %nss ) { | ||
| 3398 | my $ns = $nss{$nss_key}; | ||
| 3399 | |||
| 3400 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 3401 | $ip_already_processed{$ns->address->short} = 1; | ||
| 3402 | |||
| 3403 | if ( _ip_disabled_message( \@results, $ns, q{DNSKEY} ) ) { | ||
| 3404 | next; | ||
| 3405 | } | ||
| 3406 | |||
| 3407 | my $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { dnssec => 1 } ); | ||
| 3408 | if ( not $dnskey_p ) { | ||
| 3409 | next; | ||
| 3410 | } | ||
| 3411 | if ( $dnskey_p->rcode ne q{NOERROR} ) { | ||
| 3412 | next; | ||
| 3413 | } | ||
| 3414 | if ( not $dnskey_p->aa ) { | ||
| 3415 | next; | ||
| 3416 | } | ||
| 3417 | |||
| 3418 | my @dnskey_records = $dnskey_p->get_records_for_name( q{DNSKEY}, $zone->name->string, q{answer} ); | ||
| 3419 | if ( not scalar @dnskey_records ) { | ||
| 3420 | next; | ||
| 3421 | } | ||
| 3422 | |||
| 3423 | my $soa_p = $ns->query( $zone->name, q{SOA}, { dnssec => 1, usevc => 0 } ); | ||
| 3424 | if ( not $soa_p ) { | ||
| 3425 | next; | ||
| 3426 | } | ||
| 3427 | if ( $soa_p->rcode ne q{NOERROR} ) { | ||
| 3428 | next; | ||
| 3429 | } | ||
| 3430 | if ( not $soa_p->aa ) { | ||
| 3431 | next; | ||
| 3432 | } | ||
| 3433 | |||
| 3434 | my @soa_records = $soa_p->get_records_for_name( q{SOA}, $zone->name->string, q{answer} ); | ||
| 3435 | if ( not scalar @soa_records ) { | ||
| 3436 | next; | ||
| 3437 | } | ||
| 3438 | my @rrsig_records = $soa_p->get_records( q{RRSIG}, q{answer} ); | ||
| 3439 | |||
| 3440 | if ( not scalar @rrsig_records ) { | ||
| 3441 | push @soa_without_rrsig, $ns->address->short; | ||
| 3442 | next; | ||
| 3443 | } | ||
| 3444 | |||
| 3445 | my $time = $dnskey_p->timestamp; | ||
| 3446 | foreach my $rrsig_record ( @rrsig_records ) { | ||
| 3447 | if ( $rrsig_record->inception > $time ) { | ||
| 3448 | push @{ $soa_rrsig_not_yet_valid{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3449 | } | ||
| 3450 | elsif ( $rrsig_record->expiration < $time ) { | ||
| 3451 | push @{ $soa_rrsig_expired{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3452 | } | ||
| 3453 | else { | ||
| 3454 | my $msg = q{}; | ||
| 3455 | my $validate = $rrsig_record->verify_time( \@soa_records, \@dnskey_records, $time, $msg ); | ||
| 3456 | if ( not $validate and $msg =~ /Unknown cryptographic algorithm/ ) { | ||
| 3457 | push @{ $algo_not_supported_by_zm{$rrsig_record->keytag}{$rrsig_record->algorithm} }, $ns->address->short; | ||
| 3458 | } | ||
| 3459 | elsif ( not scalar grep { $_->keytag == $rrsig_record->keytag } @dnskey_records ) { | ||
| 3460 | push @{ $no_matching_dnskey{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3461 | } | ||
| 3462 | elsif ( not $validate ) { | ||
| 3463 | push @{ $rrsig_not_valid_by_dnskey{$rrsig_record->keytag} }, $ns->address->short; | ||
| 3464 | } | ||
| 3465 | } | ||
| 3466 | } | ||
| 3467 | } | ||
| 3468 | if ( scalar @soa_without_rrsig ) { | ||
| 3469 | push @results, | ||
| 3470 | _emit_log( | ||
| 3471 | DS09_MISSING_RRSIG_IN_RESPONSE => { | ||
| 3472 | ns_ip_list => join( q{;}, uniq sort @soa_without_rrsig ) | ||
| 3473 | } | ||
| 3474 | ); | ||
| 3475 | } | ||
| 3476 | if ( scalar keys %soa_rrsig_not_yet_valid ) { | ||
| 3477 | push @results, map { | ||
| 3478 | _emit_log( | ||
| 3479 | DS09_SOA_RRSIG_NOT_YET_VALID => { | ||
| 3480 | keytag => $_, | ||
| 3481 | ns_ip_list => join( q{;}, uniq sort @{ $soa_rrsig_not_yet_valid{$_} } ) | ||
| 3482 | } | ||
| 3483 | ) | ||
| 3484 | } keys %soa_rrsig_not_yet_valid; | ||
| 3485 | } | ||
| 3486 | if ( scalar keys %soa_rrsig_expired ) { | ||
| 3487 | push @results, map { | ||
| 3488 | _emit_log( | ||
| 3489 | DS09_SOA_RRSIG_EXPIRED => { | ||
| 3490 | keytag => $_, | ||
| 3491 | ns_ip_list => join( q{;}, uniq sort @{ $soa_rrsig_expired{$_} } ) | ||
| 3492 | } | ||
| 3493 | ) | ||
| 3494 | } keys %soa_rrsig_expired; | ||
| 3495 | } | ||
| 3496 | if ( scalar keys %no_matching_dnskey ) { | ||
| 3497 | push @results, map { | ||
| 3498 | _emit_log( | ||
| 3499 | DS09_NO_MATCHING_DNSKEY => { | ||
| 3500 | keytag => $_, | ||
| 3501 | ns_ip_list => join( q{;}, uniq sort @{ $no_matching_dnskey{$_} } ) | ||
| 3502 | } | ||
| 3503 | ) | ||
| 3504 | } keys %no_matching_dnskey; | ||
| 3505 | } | ||
| 3506 | if ( scalar keys %rrsig_not_valid_by_dnskey ) { | ||
| 3507 | push @results, map { | ||
| 3508 | _emit_log( | ||
| 3509 | DS09_RRSIG_NOT_VALID_BY_DNSKEY => { | ||
| 3510 | keytag => $_, | ||
| 3511 | ns_ip_list => join( q{;}, uniq sort @{ $rrsig_not_valid_by_dnskey{$_} } ) | ||
| 3512 | } | ||
| 3513 | ) | ||
| 3514 | } keys %rrsig_not_valid_by_dnskey; | ||
| 3515 | } | ||
| 3516 | if ( scalar keys %algo_not_supported_by_zm ) { | ||
| 3517 | foreach my $keytag ( keys %algo_not_supported_by_zm ) { | ||
| 3518 | push @results, map { | ||
| 3519 | _emit_log( | ||
| 3520 | DS09_ALGO_NOT_SUPPORTED_BY_ZM => { | ||
| 3521 | keytag => $keytag, | ||
| 3522 | algo_num => $_, | ||
| 3523 | algo_mnemo => $algo_properties{$_}{mnemonic}, | ||
| 3524 | ns_ip_list => join( q{;}, uniq sort @{ $algo_not_supported_by_zm{$keytag}{$_} } ) | ||
| 3525 | } | ||
| 3526 | ) | ||
| 3527 | } keys %{ $algo_not_supported_by_zm{$keytag} } | ||
| 3528 | } | ||
| 3529 | } | ||
| 3530 | |||
| 3531 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 3532 | } ## end sub dnssec09 | ||
| 3533 | |||
| 3534 | =over | ||
| 3535 | |||
| 3536 | =item dnssec10() | ||
| 3537 | |||
| 3538 | my @logentry_array = dnssec10( $zone ); | ||
| 3539 | |||
| 3540 | Runs the L<DNSSEC10 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec10.md>. | ||
| 3541 | |||
| 3542 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 3543 | |||
| 3544 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 3545 | |||
| 3546 | =back | ||
| 3547 | |||
| 3548 | =cut | ||
| 3549 | |||
| 3550 | sub dnssec10 { | ||
| 3551 | my ( $class, $zone ) = @_; | ||
| 3552 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC10'; | ||
| 3553 | |||
| 3554 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 3555 | |||
| 3556 | my $type_soa = q{SOA}; | ||
| 3557 | my $type_dnskey = q{DNSKEY}; | ||
| 3558 | my $type_nsec = q{NSEC}; | ||
| 3559 | my $type_nsec3 = q{NSEC3}; | ||
| 3560 | my $type_nsec3param = q{NSEC3PARAM}; | ||
| 3561 | my @query_types = ( $type_dnskey, $type_nsec, $type_nsec3param ); | ||
| 3562 | |||
| 3563 | my %algo_not_supported_by_zm; | ||
| 3564 | my ( @erroneous_multiple_nsec, @erroneous_multiple_nsec3, @erroneous_multiple_nsec3param ); | ||
| 3565 | my ( @nsec_in_answer, @nsec3param_in_answer ); | ||
| 3566 | my ( @nsec_incorrect_type_list, @nsec3_incorrect_type_list ); | ||
| 3567 | my ( @nsec_mismatches_apex, @nsec3_mismatches_apex, @nsec3param_mismatches_apex ); | ||
| 3568 | my ( @nsec_missing_signature, @nsec3_missing_signature ); | ||
| 3569 | my ( %nsec_nodata_wrong_soa, %nsec3_nodata_wrong_soa ); | ||
| 3570 | my ( @nsec_nodata_missing_soa, @nsec3_nodata_missing_soa ); | ||
| 3571 | my ( @nsec_erroneous_answer, @nsec3param_erroneous_answer ); | ||
| 3572 | my ( @nsec_nsec3_nodata, @nsec3param_nsec_nodata ); | ||
| 3573 | my ( %nsec_rrsig_verify_error, %nsec3_rrsig_verify_error ); | ||
| 3574 | my ( %nsec_rrsig_expired, %nsec3_rrsig_expired ); | ||
| 3575 | my ( %nsec_rrsig_not_yet_valid, %nsec3_rrsig_not_yet_valid ); | ||
| 3576 | my ( %nsec_rrsig_no_dnskey, %nsec3_rrsig_no_dnskey ); | ||
| 3577 | my ( @nsec_rrsig_verified, @nsec3_rrsig_verified ); | ||
| 3578 | my ( @nsec_response_error, @nsec3param_response_error ); | ||
| 3579 | my ( @with_dnskey, @without_dnskey ); | ||
| 3580 | |||
| 3581 | my @all_ns = uniq grep { $_->isa('Zonemaster::Engine::Nameserver') } ( | ||
| 3582 | @{ Zonemaster::Engine::TestMethodsV2->get_del_ns_names_and_ips( $zone ) // [] }, | ||
| 3583 | @{ Zonemaster::Engine::TestMethodsV2->get_zone_ns_names_and_ips( $zone ) // [] } | ||
| 3584 | ); | ||
| 3585 | |||
| 3586 | my @ignored_nss; | ||
| 3587 | my %nss; | ||
| 3588 | push @{ $nss{$_->address->short} }, $_ for @all_ns; | ||
| 3589 | |||
| 3590 | my $testing_time = time; | ||
| 3591 | |||
| 3592 | for my $ns_ip ( keys %nss ) { | ||
| 3593 | my $ns = $nss{$ns_ip}[0]; | ||
| 3594 | my @all_ns_for_ip = @{ $nss{$ns_ip} }; | ||
| 3595 | |||
| 3596 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 3597 | push @ignored_nss, @all_ns_for_ip; | ||
| 3598 | next; | ||
| 3599 | } | ||
| 3600 | |||
| 3601 | my $dnskey_p = $ns->query( $zone->name, $type_dnskey, { dnssec => 1 } ); | ||
| 3602 | |||
| 3603 | if ( not $dnskey_p or $dnskey_p->rcode ne q{NOERROR} or not $dnskey_p->aa ) { | ||
| 3604 | push @ignored_nss, @all_ns_for_ip; | ||
| 3605 | next; | ||
| 3606 | } | ||
| 3607 | |||
| 3608 | my @dnskey_records = $dnskey_p->get_records_for_name( $type_dnskey, $zone->name->string, q{answer} ); | ||
| 3609 | |||
| 3610 | if ( not scalar @dnskey_records ) { | ||
| 3611 | push @without_dnskey, @all_ns_for_ip; | ||
| 3612 | next; | ||
| 3613 | } | ||
| 3614 | |||
| 3615 | push @with_dnskey, @all_ns_for_ip; | ||
| 3616 | |||
| 3617 | my $nsec_p = $ns->query( $zone->name, $type_nsec, { dnssec => 1 } ); | ||
| 3618 | |||
| 3619 | if ( not $nsec_p or $nsec_p->rcode ne q{NOERROR} or not $nsec_p->aa ) { | ||
| 3620 | push @nsec_response_error, @all_ns_for_ip; | ||
| 3621 | } | ||
| 3622 | elsif ( $nsec_p->answer ) { | ||
| 3623 | if ( scalar $nsec_p->get_records( $type_nsec, q{answer} ) ) { | ||
| 3624 | push @nsec_in_answer, @all_ns_for_ip; | ||
| 3625 | |||
| 3626 | if ( scalar $nsec_p->get_records( $type_nsec, q{answer} ) > 1 ) { | ||
| 3627 | push @erroneous_multiple_nsec, @all_ns_for_ip; | ||
| 3628 | } | ||
| 3629 | elsif ( ($nsec_p->get_records( $type_nsec, q{answer} ))[0]->owner ne $zone->name ) { | ||
| 3630 | push @nsec_mismatches_apex, @all_ns_for_ip; | ||
| 3631 | } | ||
| 3632 | } | ||
| 3633 | else { | ||
| 3634 | push @nsec_erroneous_answer, @all_ns_for_ip; | ||
| 3635 | } | ||
| 3636 | } | ||
| 3637 | elsif ( not $nsec_p->answer and scalar $nsec_p->get_records( $type_nsec3, q{authority} ) ) { | ||
| 3638 | my @nsec3_rrs = $nsec_p->get_records( $type_nsec3, q{authority} ); | ||
| 3639 | |||
| 3640 | push @nsec_nsec3_nodata, @all_ns_for_ip; | ||
| 3641 | |||
| 3642 | unless ( scalar $nsec_p->get_records( $type_soa, q{authority} ) ) { | ||
| 3643 | push @nsec3_nodata_missing_soa, @all_ns_for_ip; | ||
| 3644 | } | ||
| 3645 | elsif ( ($nsec_p->get_records( $type_soa, q{authority} ))[0]->owner ne $zone->name ) { | ||
| 3646 | push @{ $nsec3_nodata_wrong_soa{$zone->name} }, @all_ns_for_ip; | ||
| 3647 | } | ||
| 3648 | |||
| 3649 | if ( scalar @nsec3_rrs > 1 ) { | ||
| 3650 | push @erroneous_multiple_nsec3, @all_ns_for_ip; | ||
| 3651 | } | ||
| 3652 | else { | ||
| 3653 | unless ( $nsec3_rrs[0]->hash_name( $zone->name ) eq lc( @{ name($nsec3_rrs[0]->owner)->labels }[0] ) ) { | ||
| 3654 | push @nsec3_mismatches_apex, @all_ns_for_ip; | ||
| 3655 | } | ||
| 3656 | else { | ||
| 3657 | my @mandatory_typelist = qw( SOA NS DNSKEY NSEC3PARAM RRSIG ); | ||
| 3658 | my @forbidden_typelist = qw( NSEC NSEC3 ); | ||
| 3659 | my %typelist = %{ $nsec3_rrs[0]->typehref }; | ||
| 3660 | |||
| 3661 | foreach my $type ( @mandatory_typelist ) { | ||
| 3662 | if ( not exists $typelist{$type} ) { | ||
| 3663 | push @nsec3_incorrect_type_list, @all_ns_for_ip; | ||
| 3664 | last; | ||
| 3665 | } | ||
| 3666 | } | ||
| 3667 | |||
| 3668 | foreach my $type ( @forbidden_typelist ) { | ||
| 3669 | if ( exists $typelist{$type} ) { | ||
| 3670 | push @nsec3_incorrect_type_list, @all_ns_for_ip; | ||
| 3671 | last; | ||
| 3672 | } | ||
| 3673 | } | ||
| 3674 | } | ||
| 3675 | |||
| 3676 | my @nsec3_rrsig_rrs = grep { $_->typecovered eq q{NSEC3} } $nsec_p->get_records_for_name( q{RRSIG}, $nsec3_rrs[0]->name ); | ||
| 3677 | |||
| 3678 | unless ( scalar @nsec3_rrsig_rrs ) { | ||
| 3679 | push @nsec3_missing_signature, @all_ns_for_ip; | ||
| 3680 | } | ||
| 3681 | else { | ||
| 3682 | foreach my $rr ( @nsec3_rrsig_rrs ) { | ||
| 3683 | my @matching_dnskeys = grep { $rr->keytag == $_->keytag } @dnskey_records; | ||
| 3684 | |||
| 3685 | unless ( scalar @matching_dnskeys ) { | ||
| 3686 | push @{ $nsec3_rrsig_no_dnskey{$rr->keytag} }, @all_ns_for_ip; | ||
| 3687 | } | ||
| 3688 | elsif ( $rr->expiration < $testing_time ) { | ||
| 3689 | push @{ $nsec3_rrsig_expired{$rr->keytag} }, @all_ns_for_ip; | ||
| 3690 | } | ||
| 3691 | elsif ( $rr->inception > $testing_time ) { | ||
| 3692 | push @{ $nsec3_rrsig_not_yet_valid{$rr->keytag} }, @all_ns_for_ip; | ||
| 3693 | } | ||
| 3694 | else { | ||
| 3695 | my $i = 1; | ||
| 3696 | foreach my $dnskey ( @matching_dnskeys ) { | ||
| 3697 | my $msg = q{}; | ||
| 3698 | my $validated = $rr->verify_time( [grep { name( $_->name ) eq name( $rr->name ) } @nsec3_rrs], [ $dnskey ], $testing_time, $msg ); | ||
| 3699 | |||
| 3700 | if ( $validated ) { | ||
| 3701 | push @nsec3_rrsig_verified, @all_ns_for_ip; | ||
| 3702 | last; | ||
| 3703 | } | ||
| 3704 | |||
| 3705 | if ( $i >= scalar @matching_dnskeys ) { | ||
| 3706 | if ( $msg =~ /Unknown cryptographic algorithm/ ) { | ||
| 3707 | push @{ $algo_not_supported_by_zm{$dnskey->keytag}{$dnskey->algorithm} }, @all_ns_for_ip; | ||
| 3708 | } | ||
| 3709 | else { | ||
| 3710 | push @{ $nsec3_rrsig_verify_error{$dnskey->keytag} }, @all_ns_for_ip; | ||
| 3711 | } | ||
| 3712 | } | ||
| 3713 | |||
| 3714 | $i++; | ||
| 3715 | } | ||
| 3716 | } | ||
| 3717 | } | ||
| 3718 | } | ||
| 3719 | } | ||
| 3720 | } | ||
| 3721 | |||
| 3722 | my $nsec3param_p = $ns->query( $zone->name, $type_nsec3param, { dnssec => 1 } ); | ||
| 3723 | |||
| 3724 | if ( not $nsec3param_p or $nsec3param_p->rcode ne q{NOERROR} or not $nsec3param_p->aa ) { | ||
| 3725 | push @nsec3param_response_error, @all_ns_for_ip; | ||
| 3726 | } | ||
| 3727 | elsif ( $nsec3param_p->answer ) { | ||
| 3728 | if ( scalar $nsec3param_p->get_records( $type_nsec3param, q{answer} ) ) { | ||
| 3729 | push @nsec3param_in_answer, @all_ns_for_ip; | ||
| 3730 | |||
| 3731 | if ( scalar $nsec3param_p->get_records( $type_nsec3param, q{answer} ) > 1 ) { | ||
| 3732 | push @erroneous_multiple_nsec3param, @all_ns_for_ip; | ||
| 3733 | } | ||
| 3734 | elsif ( ($nsec3param_p->get_records( $type_nsec3param, q{answer} ))[0]->owner ne $zone->name ) { | ||
| 3735 | push @nsec3param_mismatches_apex, @all_ns_for_ip; | ||
| 3736 | } | ||
| 3737 | } | ||
| 3738 | else { | ||
| 3739 | push @nsec3param_erroneous_answer, @all_ns_for_ip; | ||
| 3740 | } | ||
| 3741 | } | ||
| 3742 | elsif ( not $nsec3param_p->answer and scalar $nsec3param_p->get_records( $type_nsec, q{authority} ) ) { | ||
| 3743 | my @nsec_rrs = $nsec3param_p->get_records( $type_nsec, q{authority} ); | ||
| 3744 | |||
| 3745 | push @nsec3param_nsec_nodata, @all_ns_for_ip; | ||
| 3746 | |||
| 3747 | unless ( scalar $nsec3param_p->get_records( $type_soa, q{authority} ) ) { | ||
| 3748 | push @nsec_nodata_missing_soa, @all_ns_for_ip; | ||
| 3749 | } | ||
| 3750 | elsif ( ($nsec3param_p->get_records( $type_soa, q{authority} ))[0]->owner ne $zone->name ) { | ||
| 3751 | push @{ $nsec_nodata_wrong_soa{$zone->name} }, @all_ns_for_ip; | ||
| 3752 | } | ||
| 3753 | |||
| 3754 | if ( scalar @nsec_rrs > 1 ) { | ||
| 3755 | push @erroneous_multiple_nsec, @all_ns_for_ip; | ||
| 3756 | } | ||
| 3757 | else { | ||
| 3758 | unless ( $nsec_rrs[0]->owner eq $zone->name ) { | ||
| 3759 | push @nsec_mismatches_apex, @all_ns_for_ip; | ||
| 3760 | } | ||
| 3761 | else { | ||
| 3762 | my @mandatory_typelist = qw( SOA NS DNSKEY NSEC RRSIG ); | ||
| 3763 | my @forbidden_typelist = qw( NSEC3PARAM NSEC3 ); | ||
| 3764 | my %typelist = %{ $nsec_rrs[0]->typehref }; | ||
| 3765 | |||
| 3766 | foreach my $type ( @mandatory_typelist ) { | ||
| 3767 | if ( not exists $typelist{$type} ) { | ||
| 3768 | push @nsec_incorrect_type_list, @all_ns_for_ip; | ||
| 3769 | last; | ||
| 3770 | } | ||
| 3771 | } | ||
| 3772 | |||
| 3773 | foreach my $type ( @forbidden_typelist ) { | ||
| 3774 | if ( exists $typelist{$type} ) { | ||
| 3775 | push @nsec_incorrect_type_list, @all_ns_for_ip; | ||
| 3776 | last; | ||
| 3777 | } | ||
| 3778 | } | ||
| 3779 | } | ||
| 3780 | |||
| 3781 | my @nsec_rrsig_rrs = grep { $_->typecovered eq q{NSEC} } $nsec3param_p->get_records_for_name( q{RRSIG}, $nsec_rrs[0]->name ); | ||
| 3782 | |||
| 3783 | unless ( scalar @nsec_rrsig_rrs ) { | ||
| 3784 | push @nsec_missing_signature, @all_ns_for_ip; | ||
| 3785 | } | ||
| 3786 | else { | ||
| 3787 | foreach my $rr ( @nsec_rrsig_rrs ) { | ||
| 3788 | my @matching_dnskeys = grep { $rr->keytag == $_->keytag } @dnskey_records; | ||
| 3789 | |||
| 3790 | unless ( scalar @matching_dnskeys ) { | ||
| 3791 | push @{ $nsec_rrsig_no_dnskey{$rr->keytag} }, @all_ns_for_ip; | ||
| 3792 | } | ||
| 3793 | elsif ( $rr->expiration < $testing_time ) { | ||
| 3794 | push @{ $nsec_rrsig_expired{$rr->keytag} }, @all_ns_for_ip; | ||
| 3795 | } | ||
| 3796 | elsif ( $rr->inception > $testing_time ) { | ||
| 3797 | push @{ $nsec_rrsig_not_yet_valid{$rr->keytag} }, @all_ns_for_ip; | ||
| 3798 | } | ||
| 3799 | else { | ||
| 3800 | my $i = 1; | ||
| 3801 | foreach my $dnskey ( @matching_dnskeys ) { | ||
| 3802 | my $msg = q{}; | ||
| 3803 | my $validated = $rr->verify_time( [grep { name( $_->name ) eq name( $rr->name ) } @nsec_rrs], [ $dnskey ], $testing_time, $msg ); | ||
| 3804 | |||
| 3805 | if ( $validated ) { | ||
| 3806 | push @nsec_rrsig_verified, @all_ns_for_ip; | ||
| 3807 | last; | ||
| 3808 | } | ||
| 3809 | |||
| 3810 | if ( $i >= scalar @matching_dnskeys ) { | ||
| 3811 | if ( $msg =~ /Unknown cryptographic algorithm/ ) { | ||
| 3812 | push @{ $algo_not_supported_by_zm{$dnskey->keytag}{$dnskey->algorithm} }, @all_ns_for_ip; | ||
| 3813 | } | ||
| 3814 | else { | ||
| 3815 | push @{ $nsec_rrsig_verify_error{$dnskey->keytag} }, @all_ns_for_ip; | ||
| 3816 | } | ||
| 3817 | } | ||
| 3818 | |||
| 3819 | $i++; | ||
| 3820 | } | ||
| 3821 | } | ||
| 3822 | } | ||
| 3823 | } | ||
| 3824 | } | ||
| 3825 | } | ||
| 3826 | } | ||
| 3827 | |||
| 3828 | if ( scalar @erroneous_multiple_nsec ) { | ||
| 3829 | push @results, | ||
| 3830 | _emit_log( | ||
| 3831 | DS10_ERR_MULT_NSEC => { | ||
| 3832 | ns_list => join( q{;}, uniq sort @erroneous_multiple_nsec ) | ||
| 3833 | } | ||
| 3834 | ); | ||
| 3835 | } | ||
| 3836 | |||
| 3837 | if ( scalar @erroneous_multiple_nsec3 ) { | ||
| 3838 | push @results, | ||
| 3839 | _emit_log( | ||
| 3840 | DS10_ERR_MULT_NSEC3 => { | ||
| 3841 | ns_list => join( q{;}, uniq sort @erroneous_multiple_nsec3 ) | ||
| 3842 | } | ||
| 3843 | ); | ||
| 3844 | } | ||
| 3845 | |||
| 3846 | if ( scalar @erroneous_multiple_nsec3param ) { | ||
| 3847 | push @results, | ||
| 3848 | _emit_log( | ||
| 3849 | DS10_ERR_MULT_NSEC3PARAM => { | ||
| 3850 | ns_list => join( q{;}, uniq sort @erroneous_multiple_nsec3param ) | ||
| 3851 | } | ||
| 3852 | ); | ||
| 3853 | } | ||
| 3854 | |||
| 3855 | my $lc = List::Compare->new( \@nsec_in_answer, \@nsec3param_nsec_nodata ); | ||
| 3856 | my @diff = $lc->get_symmetric_difference; | ||
| 3857 | my @union = uniq map { $_->string } ( @nsec3param_in_answer, @nsec_nsec3_nodata ); | ||
| 3858 | my $lc2 = List::Compare->new( \@diff, \@union ); | ||
| 3859 | my @final_diff = $lc2->get_symmetric_difference; | ||
| 3860 | |||
| 3861 | if ( scalar @diff and scalar @final_diff ) { | ||
| 3862 | push @results, | ||
| 3863 | _emit_log( | ||
| 3864 | DS10_INCONSISTENT_NSEC => { | ||
| 3865 | ns_list => join( q{;}, uniq sort @final_diff ) | ||
| 3866 | } | ||
| 3867 | ); | ||
| 3868 | } | ||
| 3869 | |||
| 3870 | $lc = List::Compare->new( \@nsec3param_in_answer, \@nsec_nsec3_nodata ); | ||
| 3871 | @diff = $lc->get_symmetric_difference; | ||
| 3872 | @union = uniq map { $_->string } ( @nsec_in_answer, @nsec3param_nsec_nodata ); | ||
| 3873 | $lc2 = List::Compare->new( \@diff, \@union ); | ||
| 3874 | @final_diff = $lc2->get_symmetric_difference; | ||
| 3875 | |||
| 3876 | if ( scalar @diff and scalar @final_diff ) { | ||
| 3877 | push @results, | ||
| 3878 | _emit_log( | ||
| 3879 | DS10_INCONSISTENT_NSEC3 => { | ||
| 3880 | ns_list => join( q{;}, uniq sort @final_diff ) | ||
| 3881 | } | ||
| 3882 | ); | ||
| 3883 | } | ||
| 3884 | |||
| 3885 | $lc = List::Compare->new( [ @nsec3param_in_answer, @nsec_nsec3_nodata ], [ @nsec_in_answer, @nsec3param_nsec_nodata ] ); | ||
| 3886 | my @intersection = $lc->get_intersection; | ||
| 3887 | |||
| 3888 | if ( @intersection ) { | ||
| 3889 | push @results, | ||
| 3890 | _emit_log( | ||
| 3891 | DS10_MIXED_NSEC_NSEC3 => { | ||
| 3892 | ns_list => join( q{;}, uniq sort @intersection ) | ||
| 3893 | } | ||
| 3894 | ); | ||
| 3895 | } | ||
| 3896 | |||
| 3897 | if ( ( scalar @nsec_in_answer or @nsec3param_nsec_nodata ) and not scalar @nsec3param_in_answer and not scalar @nsec_nsec3_nodata ) { | ||
| 3898 | push @results, | ||
| 3899 | _emit_log( | ||
| 3900 | DS10_HAS_NSEC => { | ||
| 3901 | ns_list => join( q{;}, uniq sort ( @nsec_in_answer, @nsec3param_nsec_nodata ) ) | ||
| 3902 | } | ||
| 3903 | ); | ||
| 3904 | } | ||
| 3905 | |||
| 3906 | if ( ( scalar @nsec3param_in_answer or @nsec_nsec3_nodata ) and not scalar @nsec_in_answer and not scalar @nsec3param_nsec_nodata ) { | ||
| 3907 | push @results, | ||
| 3908 | _emit_log( | ||
| 3909 | DS10_HAS_NSEC3 => { | ||
| 3910 | ns_list => join( q{;}, uniq sort ( @nsec3param_in_answer, @nsec_nsec3_nodata ) ) | ||
| 3911 | } | ||
| 3912 | ); | ||
| 3913 | } | ||
| 3914 | |||
| 3915 | @union = ( @nsec3param_in_answer, @nsec_nsec3_nodata ); | ||
| 3916 | my @second_union = ( @nsec_in_answer, @nsec3param_nsec_nodata ); | ||
| 3917 | $lc = List::Compare->new( \@union, \@second_union ); | ||
| 3918 | my @first = $lc->get_unique; | ||
| 3919 | my @second = $lc->get_complement; | ||
| 3920 | |||
| 3921 | if ( scalar @first and scalar @second ) { | ||
| 3922 | push @results, | ||
| 3923 | _emit_log( | ||
| 3924 | DS10_INCONSISTENT_NSEC_NSEC3 => { | ||
| 3925 | ns_list => join( q{;}, uniq sort ( @union, @second_union ) ) | ||
| 3926 | } | ||
| 3927 | ); | ||
| 3928 | } | ||
| 3929 | |||
| 3930 | if ( scalar @nsec_incorrect_type_list ) { | ||
| 3931 | push @results, | ||
| 3932 | _emit_log( | ||
| 3933 | DS10_NSEC_ERR_TYPE_LIST => { | ||
| 3934 | ns_list => join( q{;}, uniq sort @nsec_incorrect_type_list ) | ||
| 3935 | } | ||
| 3936 | ); | ||
| 3937 | } | ||
| 3938 | |||
| 3939 | if ( scalar @nsec_mismatches_apex ) { | ||
| 3940 | push @results, | ||
| 3941 | _emit_log( | ||
| 3942 | DS10_NSEC_MISMATCHES_APEX => { | ||
| 3943 | ns_list => join( q{;}, uniq sort @nsec_mismatches_apex ) | ||
| 3944 | } | ||
| 3945 | ); | ||
| 3946 | } | ||
| 3947 | |||
| 3948 | if ( scalar keys %nsec_nodata_wrong_soa ) { | ||
| 3949 | push @results, map { | ||
| 3950 | _emit_log( | ||
| 3951 | DS10_NSEC_NODATA_WRONG_SOA => { | ||
| 3952 | domain => $_, | ||
| 3953 | ns_list => join( q{;}, uniq sort @{ $nsec_nodata_wrong_soa{$_} } ) | ||
| 3954 | } | ||
| 3955 | ) | ||
| 3956 | } keys %nsec_nodata_wrong_soa; | ||
| 3957 | } | ||
| 3958 | |||
| 3959 | if ( scalar @nsec_nodata_missing_soa ) { | ||
| 3960 | push @results, | ||
| 3961 | _emit_log( | ||
| 3962 | DS10_NSEC_NODATA_MISSING_SOA => { | ||
| 3963 | ns_list => join( q{;}, uniq sort @nsec_nodata_missing_soa ) | ||
| 3964 | } | ||
| 3965 | ); | ||
| 3966 | } | ||
| 3967 | |||
| 3968 | if ( scalar @nsec_erroneous_answer ) { | ||
| 3969 | push @results, | ||
| 3970 | _emit_log( | ||
| 3971 | DS10_NSEC_GIVES_ERR_ANSWER => { | ||
| 3972 | ns_list => join( q{;}, uniq sort @nsec_erroneous_answer ) | ||
| 3973 | } | ||
| 3974 | ); | ||
| 3975 | } | ||
| 3976 | |||
| 3977 | if ( scalar @nsec_response_error ) { | ||
| 3978 | push @results, | ||
| 3979 | _emit_log( | ||
| 3980 | DS10_NSEC_QUERY_RESPONSE_ERR => { | ||
| 3981 | ns_list => join( q{;}, uniq sort @nsec_response_error ) | ||
| 3982 | } | ||
| 3983 | ); | ||
| 3984 | } | ||
| 3985 | |||
| 3986 | if ( scalar @nsec3_incorrect_type_list ) { | ||
| 3987 | push @results, | ||
| 3988 | _emit_log( | ||
| 3989 | DS10_NSEC3_ERR_TYPE_LIST => { | ||
| 3990 | ns_list => join( q{;}, uniq sort @nsec3_incorrect_type_list ) | ||
| 3991 | } | ||
| 3992 | ); | ||
| 3993 | } | ||
| 3994 | |||
| 3995 | if ( scalar @nsec3_mismatches_apex ) { | ||
| 3996 | push @results, | ||
| 3997 | _emit_log( | ||
| 3998 | DS10_NSEC3_MISMATCHES_APEX => { | ||
| 3999 | ns_list => join( q{;}, uniq sort @nsec3_mismatches_apex ) | ||
| 4000 | } | ||
| 4001 | ); | ||
| 4002 | } | ||
| 4003 | |||
| 4004 | if ( scalar keys %nsec3_nodata_wrong_soa ) { | ||
| 4005 | push @results, map { | ||
| 4006 | _emit_log( | ||
| 4007 | DS10_NSEC3_NODATA_WRONG_SOA => { | ||
| 4008 | domain => $_, | ||
| 4009 | ns_list => join( q{;}, uniq sort @{ $nsec3_nodata_wrong_soa{$_} } ) | ||
| 4010 | } | ||
| 4011 | ) | ||
| 4012 | } keys %nsec3_nodata_wrong_soa; | ||
| 4013 | } | ||
| 4014 | |||
| 4015 | if ( scalar @nsec3_nodata_missing_soa ) { | ||
| 4016 | push @results, | ||
| 4017 | _emit_log( | ||
| 4018 | DS10_NSEC3_NODATA_MISSING_SOA => { | ||
| 4019 | ns_list => join( q{;}, uniq sort @nsec3_nodata_missing_soa ) | ||
| 4020 | } | ||
| 4021 | ); | ||
| 4022 | } | ||
| 4023 | |||
| 4024 | if ( scalar @nsec3param_erroneous_answer ) { | ||
| 4025 | push @results, | ||
| 4026 | _emit_log( | ||
| 4027 | DS10_NSEC3PARAM_GIVES_ERR_ANSWER => { | ||
| 4028 | ns_list => join( q{;}, uniq sort @nsec3param_erroneous_answer ) | ||
| 4029 | } | ||
| 4030 | ); | ||
| 4031 | } | ||
| 4032 | |||
| 4033 | if ( scalar @nsec3param_mismatches_apex ) { | ||
| 4034 | push @results, | ||
| 4035 | _emit_log( | ||
| 4036 | DS10_NSEC3PARAM_MISMATCHES_APEX => { | ||
| 4037 | ns_list => join( q{;}, uniq sort @nsec3param_mismatches_apex ) | ||
| 4038 | } | ||
| 4039 | ); | ||
| 4040 | } | ||
| 4041 | |||
| 4042 | if ( scalar @nsec3param_response_error ) { | ||
| 4043 | push @results, | ||
| 4044 | _emit_log( | ||
| 4045 | DS10_NSEC3PARAM_QUERY_RESPONSE_ERR => { | ||
| 4046 | ns_list => join( q{;}, uniq sort @nsec3param_response_error ) | ||
| 4047 | } | ||
| 4048 | ); | ||
| 4049 | } | ||
| 4050 | |||
| 4051 | if ( scalar @nsec_missing_signature ) { | ||
| 4052 | push @results, | ||
| 4053 | _emit_log( | ||
| 4054 | DS10_NSEC_MISSING_SIGNATURE => { | ||
| 4055 | ns_list => join( q{;}, uniq sort @nsec_missing_signature ) | ||
| 4056 | } | ||
| 4057 | ); | ||
| 4058 | } | ||
| 4059 | |||
| 4060 | if ( scalar @nsec3_missing_signature ) { | ||
| 4061 | push @results, | ||
| 4062 | _emit_log( | ||
| 4063 | DS10_NSEC3_MISSING_SIGNATURE => { | ||
| 4064 | ns_list => join( q{;}, uniq sort @nsec3_missing_signature ) | ||
| 4065 | } | ||
| 4066 | ); | ||
| 4067 | } | ||
| 4068 | |||
| 4069 | if ( scalar keys %nsec_rrsig_no_dnskey ) { | ||
| 4070 | push @results, map { | ||
| 4071 | _emit_log( | ||
| 4072 | DS10_NSEC_RRSIG_NO_DNSKEY => { | ||
| 4073 | keytag => $_, | ||
| 4074 | ns_list => join( q{;}, uniq sort @{ $nsec_rrsig_no_dnskey{$_} } ) | ||
| 4075 | } | ||
| 4076 | ) | ||
| 4077 | } keys %nsec_rrsig_no_dnskey; | ||
| 4078 | } | ||
| 4079 | |||
| 4080 | if ( scalar keys %nsec_rrsig_expired ) { | ||
| 4081 | push @results, map { | ||
| 4082 | _emit_log( | ||
| 4083 | DS10_NSEC_RRSIG_EXPIRED => { | ||
| 4084 | keytag => $_, | ||
| 4085 | ns_list => join( q{;}, uniq sort @{ $nsec_rrsig_expired{$_} } ) | ||
| 4086 | } | ||
| 4087 | ) | ||
| 4088 | } keys %nsec_rrsig_expired; | ||
| 4089 | } | ||
| 4090 | |||
| 4091 | if ( scalar keys %nsec_rrsig_not_yet_valid ) { | ||
| 4092 | push @results, map { | ||
| 4093 | _emit_log( | ||
| 4094 | DS10_NSEC_RRSIG_NOT_YET_VALID => { | ||
| 4095 | keytag => $_, | ||
| 4096 | ns_list => join( q{;}, uniq sort @{ $nsec_rrsig_not_yet_valid{$_} } ) | ||
| 4097 | } | ||
| 4098 | ) | ||
| 4099 | } keys %nsec_rrsig_not_yet_valid; | ||
| 4100 | } | ||
| 4101 | |||
| 4102 | if ( scalar keys %nsec_rrsig_verify_error ) { | ||
| 4103 | push @results, map { | ||
| 4104 | _emit_log( | ||
| 4105 | DS10_NSEC_RRSIG_VERIFY_ERROR => { | ||
| 4106 | keytag => $_, | ||
| 4107 | ns_list => join( q{;}, uniq sort @{ $nsec_rrsig_verify_error{$_} } ) | ||
| 4108 | } | ||
| 4109 | ) | ||
| 4110 | } keys %nsec_rrsig_verify_error; | ||
| 4111 | } | ||
| 4112 | |||
| 4113 | if ( values %nsec_rrsig_no_dnskey or values %nsec_rrsig_expired or values %nsec_rrsig_not_yet_valid or values %nsec_rrsig_verify_error ) { | ||
| 4114 | my @combined_ns = uniq ( values %nsec_rrsig_no_dnskey, values %nsec_rrsig_expired, values %nsec_rrsig_not_yet_valid, values %nsec_rrsig_verify_error ); | ||
| 4115 | my @ns_list; | ||
| 4116 | |||
| 4117 | foreach my $ns_aref ( @combined_ns ) { | ||
| 4118 | foreach my $ns ( @$ns_aref ) { | ||
| 4119 | push @ns_list, $ns unless grep { $_ eq $ns } @nsec_rrsig_verified; | ||
| 4120 | } | ||
| 4121 | } | ||
| 4122 | |||
| 4123 | push @results, | ||
| 4124 | _emit_log( | ||
| 4125 | DS10_NSEC_NO_VERIFIED_SIGNATURE => { | ||
| 4126 | ns_list => join( q{;}, uniq sort @ns_list ) | ||
| 4127 | } | ||
| 4128 | ) if scalar @ns_list; | ||
| 4129 | } | ||
| 4130 | |||
| 4131 | if ( scalar keys %nsec3_rrsig_no_dnskey ) { | ||
| 4132 | push @results, map { | ||
| 4133 | _emit_log( | ||
| 4134 | DS10_NSEC3_RRSIG_NO_DNSKEY => { | ||
| 4135 | keytag => $_, | ||
| 4136 | ns_list => join( q{;}, uniq sort @{ $nsec3_rrsig_no_dnskey{$_} } ) | ||
| 4137 | } | ||
| 4138 | ) | ||
| 4139 | } keys %nsec3_rrsig_no_dnskey; | ||
| 4140 | } | ||
| 4141 | |||
| 4142 | if ( scalar keys %nsec3_rrsig_expired ) { | ||
| 4143 | push @results, map { | ||
| 4144 | _emit_log( | ||
| 4145 | DS10_NSEC3_RRSIG_EXPIRED => { | ||
| 4146 | keytag => $_, | ||
| 4147 | ns_list => join( q{;}, uniq sort @{ $nsec3_rrsig_expired{$_} } ) | ||
| 4148 | } | ||
| 4149 | ) | ||
| 4150 | } keys %nsec3_rrsig_expired; | ||
| 4151 | } | ||
| 4152 | |||
| 4153 | if ( scalar keys %nsec3_rrsig_not_yet_valid ) { | ||
| 4154 | push @results, map { | ||
| 4155 | _emit_log( | ||
| 4156 | DS10_NSEC3_RRSIG_NOT_YET_VALID => { | ||
| 4157 | keytag => $_, | ||
| 4158 | ns_list => join( q{;}, uniq sort @{ $nsec3_rrsig_not_yet_valid{$_} } ) | ||
| 4159 | } | ||
| 4160 | ) | ||
| 4161 | } keys %nsec3_rrsig_not_yet_valid; | ||
| 4162 | } | ||
| 4163 | |||
| 4164 | if ( scalar keys %nsec3_rrsig_verify_error ) { | ||
| 4165 | push @results, map { | ||
| 4166 | _emit_log( | ||
| 4167 | DS10_NSEC3_RRSIG_VERIFY_ERROR => { | ||
| 4168 | keytag => $_, | ||
| 4169 | ns_list => join( q{;}, uniq sort @{ $nsec3_rrsig_verify_error{$_} } ) | ||
| 4170 | } | ||
| 4171 | ) | ||
| 4172 | } keys %nsec3_rrsig_verify_error; | ||
| 4173 | } | ||
| 4174 | |||
| 4175 | if ( values %nsec3_rrsig_no_dnskey or values %nsec3_rrsig_expired or values %nsec3_rrsig_not_yet_valid or values %nsec3_rrsig_verify_error ) { | ||
| 4176 | my @combined_ns = uniq ( values %nsec3_rrsig_no_dnskey, values %nsec3_rrsig_expired, values %nsec3_rrsig_not_yet_valid, values %nsec3_rrsig_verify_error ); | ||
| 4177 | my @ns_list; | ||
| 4178 | |||
| 4179 | foreach my $ns_aref ( @combined_ns ) { | ||
| 4180 | foreach my $ns ( @$ns_aref ) { | ||
| 4181 | push @ns_list, $ns unless grep { $_ eq $ns } @nsec3_rrsig_verified; | ||
| 4182 | } | ||
| 4183 | } | ||
| 4184 | |||
| 4185 | push @results, | ||
| 4186 | _emit_log( | ||
| 4187 | DS10_NSEC3_NO_VERIFIED_SIGNATURE => { | ||
| 4188 | ns_list => join( q{;}, uniq sort @ns_list ) | ||
| 4189 | } | ||
| 4190 | ) if scalar @ns_list; | ||
| 4191 | } | ||
| 4192 | |||
| 4193 | if ( scalar keys %algo_not_supported_by_zm ) { | ||
| 4194 | foreach my $keytag ( keys %algo_not_supported_by_zm ) { | ||
| 4195 | push @results, map { | ||
| 4196 | _emit_log( | ||
| 4197 | DS10_ALGO_NOT_SUPPORTED_BY_ZM => { | ||
| 4198 | keytag => $keytag, | ||
| 4199 | algo_num => $_, | ||
| 4200 | algo_mnemo => $algo_properties{$_}{mnemonic}, | ||
| 4201 | ns_ip_list => join( q{;}, uniq sort @{ $algo_not_supported_by_zm{$keytag}{$_} } ) | ||
| 4202 | } | ||
| 4203 | ) | ||
| 4204 | } keys %{ $algo_not_supported_by_zm{$keytag} }; | ||
| 4205 | } | ||
| 4206 | } | ||
| 4207 | |||
| 4208 | if ( not scalar @with_dnskey and scalar @without_dnskey ) { | ||
| 4209 | push @results, | ||
| 4210 | _emit_log( | ||
| 4211 | DS10_ZONE_NO_DNSSEC => { | ||
| 4212 | ns_list => join( q{;}, uniq sort @without_dnskey ) | ||
| 4213 | } | ||
| 4214 | ); | ||
| 4215 | } | ||
| 4216 | |||
| 4217 | if ( scalar @with_dnskey and scalar @without_dnskey ) { | ||
| 4218 | push @results, | ||
| 4219 | _emit_log( | ||
| 4220 | DS10_SERVER_NO_DNSSEC => { | ||
| 4221 | ns_list => join( q{;}, uniq sort @without_dnskey ) | ||
| 4222 | } | ||
| 4223 | ); | ||
| 4224 | } | ||
| 4225 | |||
| 4226 | $lc = List::Compare->new( [ @all_ns ], [ @ignored_nss, @without_dnskey, @nsec_in_answer, @nsec3param_nsec_nodata, @nsec3param_in_answer, @nsec_nsec3_nodata ] ); | ||
| 4227 | @first = $lc->get_unique; | ||
| 4228 | |||
| 4229 | if ( @first ) { | ||
| 4230 | push @results, | ||
| 4231 | _emit_log( | ||
| 4232 | DS10_EXPECTED_NSEC_NSEC3_MISSING => { | ||
| 4233 | ns_list => join( q{;}, uniq sort @first ) | ||
| 4234 | } | ||
| 4235 | ); | ||
| 4236 | } | ||
| 4237 | |||
| 4238 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 4239 | } ## end sub dnssec10 | ||
| 4240 | |||
| 4241 | =over | ||
| 4242 | |||
| 4243 | =item dnssec11() | ||
| 4244 | |||
| 4245 | my @logentry_array = dnssec11( $zone ); | ||
| 4246 | |||
| 4247 | Runs the L<DNSSEC11 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec11.md>. | ||
| 4248 | |||
| 4249 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 4250 | |||
| 4251 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 4252 | |||
| 4253 | =back | ||
| 4254 | |||
| 4255 | =cut | ||
| 4256 | |||
| 4257 | sub dnssec11 { | ||
| 4258 | my ( $class, $zone ) = @_; | ||
| 4259 | |||
| 4260 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC11'; | ||
| 4261 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 4262 | my @undetermined_ds; | ||
| 4263 | my @no_ds_record; | ||
| 4264 | my @has_ds_record; | ||
| 4265 | my $continue_with_child_tests = 1; | ||
| 4266 | |||
| 4267 | my $parent = Zonemaster::Engine::TestMethods->method1( $zone ); | ||
| 4268 | my @nss_parent = @{ $parent->ns }; | ||
| 4269 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_parent; | ||
| 4270 | my %ip_already_processed; | ||
| 4271 | |||
| 4272 | my $is_undelegated = Zonemaster::Engine::Recursor->has_fake_addresses( $zone->name->string ); | ||
| 4273 | |||
| 4274 | for my $nss_key ( sort keys %nss ) { | ||
| 4275 | my $ns = $nss{$nss_key}; | ||
| 4276 | |||
| 4277 | if ( $is_undelegated ){ | ||
| 4278 | if ( not $ns->fake_ds->{$zone->name->string} ){ | ||
| 4279 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 4280 | } | ||
| 4281 | last; | ||
| 4282 | } | ||
| 4283 | |||
| 4284 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 4285 | $ip_already_processed{$ns->address->short} = 1; | ||
| 4286 | |||
| 4287 | if ( _ip_disabled_message( \@results, $ns, q{DS} ) ) { | ||
| 4288 | next; | ||
| 4289 | } | ||
| 4290 | |||
| 4291 | my $ds_p = $ns->query( $zone->name, q{DS}, { dnssec => 1, usevc => 0 } ); | ||
| 4292 | if ( $ds_p and $ds_p->tc ) { | ||
| 4293 | $ds_p = $ns->query( $zone->name, q{DS}, { dnssec => 1, usevc => 1 } ); | ||
| 4294 | } | ||
| 4295 | |||
| 4296 | if ( not $ds_p or $ds_p->rcode ne q{NOERROR} or not $ds_p->aa ) { | ||
| 4297 | push @undetermined_ds, $ns->address->short; | ||
| 4298 | next; | ||
| 4299 | } | ||
| 4300 | my @ds = $ds_p->get_records_for_name( q{DS}, $zone->name->string, q{answer} ); | ||
| 4301 | if ( not scalar @ds ) { | ||
| 4302 | push @no_ds_record, $ns->address->short; | ||
| 4303 | } | ||
| 4304 | else { | ||
| 4305 | push @has_ds_record, $ns->address->short; | ||
| 4306 | } | ||
| 4307 | } | ||
| 4308 | undef %ip_already_processed; | ||
| 4309 | |||
| 4310 | if ( scalar @undetermined_ds and not scalar @no_ds_record and not scalar @has_ds_record ) { | ||
| 4311 | push @results, _emit_log( DS11_UNDETERMINED_DS => {} ); | ||
| 4312 | $continue_with_child_tests = 0; | ||
| 4313 | } | ||
| 4314 | elsif ( scalar @no_ds_record and not scalar @has_ds_record ) { | ||
| 4315 | $continue_with_child_tests = 0; | ||
| 4316 | } | ||
| 4317 | elsif ( scalar @no_ds_record and scalar @has_ds_record ) { | ||
| 4318 | push @results, _emit_log( DS11_INCONSISTENT_DS => {} ); | ||
| 4319 | push @results, | ||
| 4320 | _emit_log( | ||
| 4321 | DS11_PARENT_WITHOUT_DS => { | ||
| 4322 | ns_ip_list => join( q{;}, sort @no_ds_record ) | ||
| 4323 | } | ||
| 4324 | ); | ||
| 4325 | push @results, | ||
| 4326 | _emit_log( | ||
| 4327 | DS11_PARENT_WITH_DS => { | ||
| 4328 | ns_ip_list => join( q{;}, sort @has_ds_record ) | ||
| 4329 | } | ||
| 4330 | ); | ||
| 4331 | } | ||
| 4332 | |||
| 4333 | if ( $continue_with_child_tests ) { | ||
| 4334 | my @query_types = qw{SOA DNSKEY}; | ||
| 4335 | my @undetermined_dnskey; | ||
| 4336 | my @no_dnskey_record; | ||
| 4337 | my @has_dnskey_record; | ||
| 4338 | |||
| 4339 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 4340 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 4341 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 4342 | my %ip_already_processed; | ||
| 4343 | |||
| 4344 | for my $nss_key ( sort keys %nss ) { | ||
| 4345 | my $ns = $nss{$nss_key}; | ||
| 4346 | |||
| 4347 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 4348 | $ip_already_processed{$ns->address->short} = 1; | ||
| 4349 | |||
| 4350 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 4351 | next; | ||
| 4352 | } | ||
| 4353 | |||
| 4354 | my $soa_p = $ns->query( $zone->name, q{SOA}, { usevc => 0 } ); | ||
| 4355 | if ( not $soa_p ) { | ||
| 4356 | next; | ||
| 4357 | } | ||
| 4358 | if ( $soa_p->rcode ne q{NOERROR} ) { | ||
| 4359 | next; | ||
| 4360 | } | ||
| 4361 | if ( not $soa_p->aa ) { | ||
| 4362 | next; | ||
| 4363 | } | ||
| 4364 | my @soa = $soa_p->get_records_for_name( q{SOA}, $zone->name->string, q{answer} ); | ||
| 4365 | if ( not scalar @soa ) { | ||
| 4366 | next; | ||
| 4367 | } | ||
| 4368 | |||
| 4369 | my $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { usevc => 0 } ); | ||
| 4370 | if ( $dnskey_p and $dnskey_p->tc ) { | ||
| 4371 | $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { usevc => 1 } ); | ||
| 4372 | } | ||
| 4373 | |||
| 4374 | if ( not $dnskey_p or $dnskey_p->rcode ne q{NOERROR} or not $dnskey_p->aa ) { | ||
| 4375 | push @undetermined_dnskey, $ns->address->short; | ||
| 4376 | next; | ||
| 4377 | } | ||
| 4378 | my @dnskey = $dnskey_p->get_records_for_name( q{DNSKEY}, $zone->name->string, q{answer} ); | ||
| 4379 | if ( not scalar @dnskey ) { | ||
| 4380 | push @no_dnskey_record, $ns->address->short; | ||
| 4381 | } | ||
| 4382 | else { | ||
| 4383 | push @has_dnskey_record, $ns->address->short; | ||
| 4384 | } | ||
| 4385 | } | ||
| 4386 | undef %ip_already_processed; | ||
| 4387 | |||
| 4388 | if ( scalar @undetermined_dnskey and not scalar @no_dnskey_record and not scalar @has_dnskey_record ) { | ||
| 4389 | push @results, _emit_log( DS11_UNDETERMINED_SIGNED_ZONE => {} ); | ||
| 4390 | } | ||
| 4391 | elsif ( scalar @no_dnskey_record and not scalar @has_dnskey_record ) { | ||
| 4392 | push @results, _emit_log( DS11_DS_BUT_UNSIGNED_ZONE => {} ); | ||
| 4393 | } | ||
| 4394 | elsif ( scalar @no_dnskey_record and scalar @has_dnskey_record ) { | ||
| 4395 | push @results, _emit_log( DS11_INCONSISTENT_SIGNED_ZONE => {} ); | ||
| 4396 | push @results, | ||
| 4397 | _emit_log( | ||
| 4398 | DS11_NS_WITH_UNSIGNED_ZONE => { | ||
| 4399 | ns_ip_list => join( q{;}, sort @no_dnskey_record ) | ||
| 4400 | } | ||
| 4401 | ); | ||
| 4402 | push @results, | ||
| 4403 | _emit_log( | ||
| 4404 | DS11_NS_WITH_SIGNED_ZONE => { | ||
| 4405 | ns_ip_list => join( q{;}, sort @has_dnskey_record ) | ||
| 4406 | } | ||
| 4407 | ); | ||
| 4408 | } | ||
| 4409 | } | ||
| 4410 | |||
| 4411 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 4412 | } ## end sub dnssec11 | ||
| 4413 | |||
| 4414 | =over | ||
| 4415 | |||
| 4416 | =item dnssec13() | ||
| 4417 | |||
| 4418 | my @logentry_array = dnssec13( $zone ); | ||
| 4419 | |||
| 4420 | Runs the L<DNSSEC13 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec13.md>. | ||
| 4421 | |||
| 4422 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 4423 | |||
| 4424 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 4425 | |||
| 4426 | =back | ||
| 4427 | |||
| 4428 | =cut | ||
| 4429 | |||
| 4430 | sub dnssec13 { | ||
| 4431 | my ( $class, $zone ) = @_; | ||
| 4432 | |||
| 4433 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC13'; | ||
| 4434 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 4435 | my @query_types = qw{DNSKEY SOA NS}; | ||
| 4436 | my %algo_not_signed; | ||
| 4437 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 4438 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 4439 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 4440 | my %ip_already_processed; | ||
| 4441 | |||
| 4442 | for my $nss_key ( sort keys %nss ) { | ||
| 4443 | my $ns = $nss{$nss_key}; | ||
| 4444 | |||
| 4445 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 4446 | $ip_already_processed{$ns->address->short} = 1; | ||
| 4447 | |||
| 4448 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 4449 | next; | ||
| 4450 | } | ||
| 4451 | |||
| 4452 | my %dnskey_algorithm; | ||
| 4453 | foreach my $query_type ( @query_types ) { | ||
| 4454 | |||
| 4455 | my $p = $ns->query( $zone->name, $query_type, { dnssec => 1, usevc => 0 } ); | ||
| 4456 | if ( not $p ) { | ||
| 4457 | next; | ||
| 4458 | } | ||
| 4459 | if ( $p->rcode ne q{NOERROR} ) { | ||
| 4460 | next; | ||
| 4461 | } | ||
| 4462 | if ( not $p->aa ) { | ||
| 4463 | next; | ||
| 4464 | } | ||
| 4465 | my @type_records = $p->get_records( $query_type, q{answer} ); | ||
| 4466 | if ( not scalar @type_records ) { | ||
| 4467 | next; | ||
| 4468 | } | ||
| 4469 | my @rrsig_records = $p->get_records( q{RRSIG} , q{answer} ); | ||
| 4470 | if ( not scalar @rrsig_records ) { | ||
| 4471 | next; | ||
| 4472 | } | ||
| 4473 | |||
| 4474 | if ( $query_type eq q{DNSKEY} ) { | ||
| 4475 | %dnskey_algorithm = map { $_->algorithm => 1 } @type_records; | ||
| 4476 | } | ||
| 4477 | foreach my $algorithm ( keys %dnskey_algorithm ) { | ||
| 4478 | if ( not scalar grep { $_->algorithm == $algorithm } @rrsig_records ) { | ||
| 4479 | push @{ $algo_not_signed{ lc($query_type) }{$algorithm} }, $ns->address->short; | ||
| 4480 | } | ||
| 4481 | } | ||
| 4482 | } | ||
| 4483 | } | ||
| 4484 | |||
| 4485 | foreach my $query_type ( @query_types ) { | ||
| 4486 | if ( exists $algo_not_signed{ lc($query_type) } ) { | ||
| 4487 | foreach my $algorithm ( keys %{ $algo_not_signed{ lc($query_type) } } ) { | ||
| 4488 | push @results, | ||
| 4489 | _emit_log( | ||
| 4490 | "DS13_ALGO_NOT_SIGNED_${query_type}" => { | ||
| 4491 | ns_ip_list => join( q{;}, uniq sort @{ $algo_not_signed{ lc($query_type) }{$algorithm} }), | ||
| 4492 | algo_num => $algorithm, | ||
| 4493 | algo_mnemo => $algo_properties{$algorithm}{mnemonic} | ||
| 4494 | } | ||
| 4495 | ); | ||
| 4496 | } | ||
| 4497 | } | ||
| 4498 | } | ||
| 4499 | |||
| 4500 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 4501 | } ## end sub dnssec13 | ||
| 4502 | |||
| 4503 | =over | ||
| 4504 | |||
| 4505 | =item dnssec14() | ||
| 4506 | |||
| 4507 | my @logentry_array = dnssec14( $zone ); | ||
| 4508 | |||
| 4509 | Runs the L<DNSSEC14 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec14.md>. | ||
| 4510 | |||
| 4511 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 4512 | |||
| 4513 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 4514 | |||
| 4515 | =back | ||
| 4516 | |||
| 4517 | =cut | ||
| 4518 | |||
| 4519 | sub dnssec14 { | ||
| 4520 | my ( $class, $zone ) = @_; | ||
| 4521 | |||
| 4522 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC14'; | ||
| 4523 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 4524 | my @dnskey_rrs; | ||
| 4525 | |||
| 4526 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 4527 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 4528 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 4529 | |||
| 4530 | for my $nss_key ( sort keys %nss ) { | ||
| 4531 | my $ns = $nss{$nss_key}; | ||
| 4532 | |||
| 4533 | if ( _ip_disabled_message( \@results, $ns, q{DNSKEY} ) ) { | ||
| 4534 | next; | ||
| 4535 | } | ||
| 4536 | |||
| 4537 | my $dnskey_p = $ns->query( $zone->name, 'DNSKEY', { dnssec => 1, usevc => 0 } ); | ||
| 4538 | if ( not $dnskey_p ) { | ||
| 4539 | push @results, _emit_log( NO_RESPONSE => { ns => $ns->string } ); | ||
| 4540 | next; | ||
| 4541 | } | ||
| 4542 | |||
| 4543 | my @keys = $dnskey_p->get_records( 'DNSKEY', 'answer' ); | ||
| 4544 | if ( not @keys ) { | ||
| 4545 | push @results, _emit_log( NO_RESPONSE_DNSKEY => { ns => $ns->string } ); | ||
| 4546 | next; | ||
| 4547 | } else { | ||
| 4548 | push @dnskey_rrs, @keys; | ||
| 4549 | } | ||
| 4550 | } | ||
| 4551 | |||
| 4552 | my %investigated_keys; | ||
| 4553 | foreach my $key ( @dnskey_rrs ) { | ||
| 4554 | my $algo = $key->algorithm; | ||
| 4555 | |||
| 4556 | next if not exists $rsa_key_size_details{$algo}; | ||
| 4557 | |||
| 4558 | # Only test once per keytag, keysize and algorithm | ||
| 4559 | my $key_ref = join ':', $key->keytag, $key->keysize, $algo; | ||
| 4560 | next if exists $investigated_keys{$key_ref}; | ||
| 4561 | |||
| 4562 | my $algo_args = { | ||
| 4563 | algo_num => $algo, | ||
| 4564 | algo_descr => $algo_properties{$algo}{description}, | ||
| 4565 | keytag => $key->keytag, | ||
| 4566 | keysize => $key->keysize, | ||
| 4567 | keysizemin => $rsa_key_size_details{$algo}{min_size}, | ||
| 4568 | keysizemax => $rsa_key_size_details{$algo}{max_size}, | ||
| 4569 | keysizerec => $rsa_key_size_details{$algo}{rec_size}, | ||
| 4570 | }; | ||
| 4571 | |||
| 4572 | if ( $key->keysize < $rsa_key_size_details{$algo}{min_size} ) { | ||
| 4573 | push @results, _emit_log( DNSKEY_TOO_SMALL_FOR_ALGO => $algo_args ); | ||
| 4574 | } | ||
| 4575 | |||
| 4576 | if ( $key->keysize < $rsa_key_size_details{$algo}{rec_size} ) { | ||
| 4577 | push @results, _emit_log( DNSKEY_SMALLER_THAN_REC => $algo_args ); | ||
| 4578 | } | ||
| 4579 | |||
| 4580 | if ( $key->keysize > $rsa_key_size_details{$algo}{max_size} ) { | ||
| 4581 | push @results, _emit_log( DNSKEY_TOO_LARGE_FOR_ALGO => $algo_args ); | ||
| 4582 | } | ||
| 4583 | |||
| 4584 | $investigated_keys{$key_ref} = 1; | ||
| 4585 | |||
| 4586 | } ## end foreach my $key ( @keys ) | ||
| 4587 | |||
| 4588 | if ( scalar @dnskey_rrs and scalar @results == scalar grep { $_->tag eq 'NO_RESPONSE' } @results) { | ||
| 4589 | push @results, _emit_log( KEY_SIZE_OK => {} ); | ||
| 4590 | } | ||
| 4591 | |||
| 4592 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 4593 | } ## end sub dnssec14 | ||
| 4594 | |||
| 4595 | =over | ||
| 4596 | |||
| 4597 | =item dnssec15() | ||
| 4598 | |||
| 4599 | my @logentry_array = dnssec15( $zone ); | ||
| 4600 | |||
| 4601 | Runs the L<DNSSEC15 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec15.md>. | ||
| 4602 | |||
| 4603 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 4604 | |||
| 4605 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 4606 | |||
| 4607 | =back | ||
| 4608 | |||
| 4609 | =cut | ||
| 4610 | |||
| 4611 | sub dnssec15 { | ||
| 4612 | my ( $class, $zone ) = @_; | ||
| 4613 | |||
| 4614 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC15'; | ||
| 4615 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 4616 | |||
| 4617 | my @query_types = qw{CDS CDNSKEY}; | ||
| 4618 | my %cds_rrsets; | ||
| 4619 | my %cdnskey_rrsets; | ||
| 4620 | my %mismatch_cds_cdnskey; | ||
| 4621 | my %has_cds_no_cdnskey; | ||
| 4622 | my %has_cdnskey_no_cds; | ||
| 4623 | my %has_cds_and_cdnskey; | ||
| 4624 | |||
| 4625 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 4626 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 4627 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 4628 | my %ip_already_processed; | ||
| 4629 | |||
| 4630 | for my $nss_key ( sort keys %nss ) { | ||
| 4631 | my $ns = $nss{$nss_key}; | ||
| 4632 | |||
| 4633 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 4634 | $ip_already_processed{$ns->address->short} = 1; | ||
| 4635 | |||
| 4636 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 4637 | next; | ||
| 4638 | } | ||
| 4639 | |||
| 4640 | my $cds_p = $ns->query( $zone->name, q{CDS}, { dnssec => 1, usevc => 0 } ); | ||
| 4641 | if ( not $cds_p ) { | ||
| 4642 | next; | ||
| 4643 | } | ||
| 4644 | if ( not $cds_p->aa ) { | ||
| 4645 | next; | ||
| 4646 | } | ||
| 4647 | if ( $cds_p->rcode ne q{NOERROR} ) { | ||
| 4648 | next; | ||
| 4649 | } | ||
| 4650 | my @cds_records = $cds_p->get_records( q{CDS}, q{answer} ); | ||
| 4651 | push @{ $cds_rrsets{ $ns->address->short } }, @cds_records; | ||
| 4652 | |||
| 4653 | my $cdnskey_p = $ns->query( $zone->name, q{CDNSKEY}, { dnssec => 1, usevc => 0 } ); | ||
| 4654 | if ( not $cdnskey_p ) { | ||
| 4655 | next; | ||
| 4656 | } | ||
| 4657 | if ( not $cdnskey_p->aa ) { | ||
| 4658 | next; | ||
| 4659 | } | ||
| 4660 | if ( $cdnskey_p->rcode ne q{NOERROR} ) { | ||
| 4661 | next; | ||
| 4662 | } | ||
| 4663 | my @cdnskey_records = $cdnskey_p->get_records( q{CDNSKEY}, q{answer} ); | ||
| 4664 | push @{ $cdnskey_rrsets{ $ns->address->short } }, @cdnskey_records; | ||
| 4665 | } | ||
| 4666 | undef %ip_already_processed; | ||
| 4667 | |||
| 4668 | my $no_cds_cdnskey = 1; | ||
| 4669 | for my $ns_ip ( keys %cds_rrsets ) { | ||
| 4670 | if ( scalar @{ $cds_rrsets{ $ns_ip } } ) { | ||
| 4671 | $no_cds_cdnskey = 0; | ||
| 4672 | } | ||
| 4673 | } | ||
| 4674 | for my $ns_ip ( keys %cdnskey_rrsets ) { | ||
| 4675 | if ( scalar @{ $cdnskey_rrsets{ $ns_ip } } ) { | ||
| 4676 | $no_cds_cdnskey = 0; | ||
| 4677 | } | ||
| 4678 | } | ||
| 4679 | |||
| 4680 | if ( $no_cds_cdnskey ) { | ||
| 4681 | push @results, _emit_log( DS15_NO_CDS_CDNSKEY => {} ); | ||
| 4682 | } | ||
| 4683 | else { | ||
| 4684 | for my $ns_ip ( keys %cds_rrsets ) { | ||
| 4685 | |||
| 4686 | if ( not exists $cdnskey_rrsets{ $ns_ip } ) { | ||
| 4687 | next; | ||
| 4688 | } | ||
| 4689 | |||
| 4690 | if ( | ||
| 4691 | scalar @{ $cds_rrsets{ $ns_ip } } | ||
| 4692 | and not scalar @{ $cdnskey_rrsets{ $ns_ip } } | ||
| 4693 | ) | ||
| 4694 | { | ||
| 4695 | $has_cds_no_cdnskey{ $ns_ip } = 1; | ||
| 4696 | } | ||
| 4697 | elsif ( | ||
| 4698 | scalar @{ $cdnskey_rrsets{ $ns_ip } } | ||
| 4699 | and not scalar @{ $cds_rrsets{ $ns_ip } } | ||
| 4700 | ) | ||
| 4701 | { | ||
| 4702 | $has_cdnskey_no_cds{ $ns_ip } = 1; | ||
| 4703 | } | ||
| 4704 | elsif ( | ||
| 4705 | scalar @{ $cds_rrsets{ $ns_ip } } | ||
| 4706 | and scalar @{ $cdnskey_rrsets{ $ns_ip } } | ||
| 4707 | ) | ||
| 4708 | { | ||
| 4709 | $has_cds_and_cdnskey{ $ns_ip } = 1; | ||
| 4710 | } | ||
| 4711 | } | ||
| 4712 | |||
| 4713 | for my $ns_ip ( keys %cds_rrsets ) { | ||
| 4714 | if ( | ||
| 4715 | scalar @{ $cds_rrsets{ $ns_ip } } | ||
| 4716 | and exists $cdnskey_rrsets{ $ns_ip } | ||
| 4717 | and scalar @{ $cdnskey_rrsets{ $ns_ip } } | ||
| 4718 | ) | ||
| 4719 | { | ||
| 4720 | # | ||
| 4721 | # Quick hack. Proper fix should be available in LDNS 1.8.5: https://github.com/NLnetLabs/ldns/commit/b39813870a5fb0f4e8ff1570b3b09416aaee716c | ||
| 4722 | # | ||
| 4723 | my @dnskey; | ||
| 4724 | foreach my $cdnskey ( @{ $cdnskey_rrsets{ $ns_ip } } ) { | ||
| 4725 | my $rr_string = $cdnskey->string; | ||
| 4726 | $rr_string =~ s/\s+CDNSKEY\s+/ DNSKEY /; | ||
| 4727 | push @dnskey, Zonemaster::LDNS::RR->new( $rr_string ); | ||
| 4728 | } | ||
| 4729 | |||
| 4730 | foreach my $cds ( @{ $cds_rrsets{ $ns_ip } } ) { | ||
| 4731 | my @matching_keys = grep { $cds->keytag == $_->keytag or ($cds->algorithm == 0 and $_->algorithm == 0)} @dnskey; | ||
| 4732 | if ( not scalar @matching_keys ) { | ||
| 4733 | $mismatch_cds_cdnskey{ $ns_ip } = 1; | ||
| 4734 | } | ||
| 4735 | } | ||
| 4736 | |||
| 4737 | foreach my $dnskey ( @dnskey ) { | ||
| 4738 | my @matching_keys = grep { $dnskey->keytag == $_->keytag or ($dnskey->algorithm == 0 and $_->algorithm == 0)} @{ $cds_rrsets{ $ns_ip } }; | ||
| 4739 | if ( not scalar @matching_keys ) { | ||
| 4740 | $mismatch_cds_cdnskey{ $ns_ip } = 1; | ||
| 4741 | } | ||
| 4742 | } | ||
| 4743 | } | ||
| 4744 | } | ||
| 4745 | |||
| 4746 | if ( scalar keys %has_cds_no_cdnskey ) { | ||
| 4747 | push @results, | ||
| 4748 | _emit_log( | ||
| 4749 | DS15_HAS_CDS_NO_CDNSKEY => { | ||
| 4750 | ns_ip_list => join( q{;}, sort keys %has_cds_no_cdnskey ) | ||
| 4751 | } | ||
| 4752 | ); | ||
| 4753 | } | ||
| 4754 | |||
| 4755 | if ( scalar keys %has_cdnskey_no_cds ) { | ||
| 4756 | push @results, | ||
| 4757 | _emit_log( | ||
| 4758 | DS15_HAS_CDNSKEY_NO_CDS => { | ||
| 4759 | ns_ip_list => join( q{;}, sort keys %has_cdnskey_no_cds ) | ||
| 4760 | } | ||
| 4761 | ); | ||
| 4762 | } | ||
| 4763 | |||
| 4764 | if ( scalar keys %has_cds_and_cdnskey ) { | ||
| 4765 | push @results, | ||
| 4766 | _emit_log( | ||
| 4767 | DS15_HAS_CDS_AND_CDNSKEY => { | ||
| 4768 | ns_ip_list => join( q{;}, sort keys %has_cds_and_cdnskey ) | ||
| 4769 | } | ||
| 4770 | ); | ||
| 4771 | } | ||
| 4772 | |||
| 4773 | my $first = 1; | ||
| 4774 | my $first_rrlist; | ||
| 4775 | my $inconsistent_rrset = 0; | ||
| 4776 | for my $ns_ip ( keys %cds_rrsets ) { | ||
| 4777 | if ( $first ) { | ||
| 4778 | $first_rrlist = Zonemaster::LDNS::RRList->new( $cds_rrsets{ $ns_ip } ); | ||
| 4779 | $first = 0; | ||
| 4780 | next; | ||
| 4781 | } | ||
| 4782 | |||
| 4783 | my $rrlist = Zonemaster::LDNS::RRList->new( $cds_rrsets{ $ns_ip } ); | ||
| 4784 | |||
| 4785 | if ( $rrlist ne $first_rrlist ) { | ||
| 4786 | $inconsistent_rrset = 1; | ||
| 4787 | last; | ||
| 4788 | } | ||
| 4789 | } | ||
| 4790 | |||
| 4791 | push @results, _emit_log( DS15_INCONSISTENT_CDS => {} ) if $inconsistent_rrset; | ||
| 4792 | |||
| 4793 | $first = 1; | ||
| 4794 | $inconsistent_rrset = 0; | ||
| 4795 | for my $ns_ip ( keys %cdnskey_rrsets ) { | ||
| 4796 | if ( $first ) { | ||
| 4797 | $first_rrlist = Zonemaster::LDNS::RRList->new( $cdnskey_rrsets{ $ns_ip } ); | ||
| 4798 | $first = 0; | ||
| 4799 | next; | ||
| 4800 | } | ||
| 4801 | |||
| 4802 | my $rrlist = Zonemaster::LDNS::RRList->new( $cdnskey_rrsets{ $ns_ip } ); | ||
| 4803 | |||
| 4804 | if ( $rrlist ne $first_rrlist ) { | ||
| 4805 | $inconsistent_rrset = 1; | ||
| 4806 | last; | ||
| 4807 | } | ||
| 4808 | } | ||
| 4809 | |||
| 4810 | push @results, _emit_log( DS15_INCONSISTENT_CDNSKEY => {} ) if $inconsistent_rrset; | ||
| 4811 | |||
| 4812 | if ( scalar keys %mismatch_cds_cdnskey ) { | ||
| 4813 | push @results, | ||
| 4814 | _emit_log( | ||
| 4815 | DS15_MISMATCH_CDS_CDNSKEY => { | ||
| 4816 | ns_ip_list => join( q{;}, sort keys %mismatch_cds_cdnskey ) | ||
| 4817 | } | ||
| 4818 | ); | ||
| 4819 | } | ||
| 4820 | } | ||
| 4821 | |||
| 4822 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 4823 | } ## end sub dnssec15 | ||
| 4824 | |||
| 4825 | =over | ||
| 4826 | |||
| 4827 | =item dnssec16() | ||
| 4828 | |||
| 4829 | my @logentry_array = dnssec16( $zone ); | ||
| 4830 | |||
| 4831 | Runs the L<DNSSEC16 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec16.md>. | ||
| 4832 | |||
| 4833 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 4834 | |||
| 4835 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 4836 | |||
| 4837 | =back | ||
| 4838 | |||
| 4839 | =cut | ||
| 4840 | |||
| 4841 | sub dnssec16 { | ||
| 4842 | my ( $class, $zone ) = @_; | ||
| 4843 | |||
| 4844 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC16'; | ||
| 4845 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 4846 | my @query_types = qw{CDS DNSKEY}; | ||
| 4847 | my %cds_rrsets; | ||
| 4848 | my %dnskey_rrsets; | ||
| 4849 | my %no_dnskey_rrset; | ||
| 4850 | my %mixed_delete_cds; | ||
| 4851 | my %delete_cds; | ||
| 4852 | my %no_match_cds_with_dnskey; | ||
| 4853 | my %cds_points_to_non_zone_dnskey; | ||
| 4854 | my %cds_points_to_non_sep_dnskey; | ||
| 4855 | my %dnskey_not_signed_by_cds; | ||
| 4856 | my %cds_not_signed_by_cds; | ||
| 4857 | my %cds_not_signed; | ||
| 4858 | my %cds_signed_by_unknown_dnskey; | ||
| 4859 | my %cds_invalid_rrsig; | ||
| 4860 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 4861 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 4862 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 4863 | my %ip_already_processed; | ||
| 4864 | my $testing_time = time; | ||
| 4865 | |||
| 4866 | for my $nss_key ( sort keys %nss ) { | ||
| 4867 | my $ns = $nss{$nss_key}; | ||
| 4868 | |||
| 4869 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 4870 | $ip_already_processed{$ns->address->short} = 1; | ||
| 4871 | |||
| 4872 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 4873 | next; | ||
| 4874 | } | ||
| 4875 | |||
| 4876 | my $cds_p = $ns->query( $zone->name, q{CDS}, { dnssec => 1, usevc => 0 } ); | ||
| 4877 | if ( not $cds_p ) { | ||
| 4878 | next; | ||
| 4879 | } | ||
| 4880 | if ( not $cds_p->aa ) { | ||
| 4881 | next; | ||
| 4882 | } | ||
| 4883 | if ( $cds_p->rcode ne q{NOERROR} ) { | ||
| 4884 | next; | ||
| 4885 | } | ||
| 4886 | my @cds_records = $cds_p->get_records( q{CDS}, q{answer} ); | ||
| 4887 | if ( not scalar @cds_records ) { | ||
| 4888 | next; | ||
| 4889 | } | ||
| 4890 | my @cds_rrsig_records = $cds_p->get_records( q{RRSIG} , q{answer} ); | ||
| 4891 | push @{ $cds_rrsets{ $ns->address->short }{cds} }, @cds_records; | ||
| 4892 | push @{ $cds_rrsets{ $ns->address->short }{rrsig} }, @cds_rrsig_records; | ||
| 4893 | foreach my $cds ( @{ $cds_rrsets{ $ns->address->short }{cds} } ) { | ||
| 4894 | my $rr_string = $cds->string; | ||
| 4895 | $rr_string =~ s/\s+CDS\s+/ DS /; | ||
| 4896 | push @{ $cds_rrsets{ $ns->address->short }{ds} }, Zonemaster::LDNS::RR->new( $rr_string ); | ||
| 4897 | } | ||
| 4898 | |||
| 4899 | my $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { dnssec => 1, usevc => 0 } ); | ||
| 4900 | if ( not $dnskey_p ) { | ||
| 4901 | next; | ||
| 4902 | } | ||
| 4903 | if ( not $dnskey_p->aa ) { | ||
| 4904 | next; | ||
| 4905 | } | ||
| 4906 | if ( $dnskey_p->rcode ne q{NOERROR} ) { | ||
| 4907 | next; | ||
| 4908 | } | ||
| 4909 | my @dnskey_records = $dnskey_p->get_records( q{DNSKEY}, q{answer} ); | ||
| 4910 | if ( not scalar @dnskey_records ) { | ||
| 4911 | next; | ||
| 4912 | } | ||
| 4913 | my @dnskey_rrsig_records = $dnskey_p->get_records( q{RRSIG} , q{answer} ); | ||
| 4914 | push @{ $dnskey_rrsets{ $ns->address->short }{dnskey} }, @dnskey_records; | ||
| 4915 | push @{ $dnskey_rrsets{ $ns->address->short }{rrsig} }, @dnskey_rrsig_records; | ||
| 4916 | $testing_time = $dnskey_p->timestamp; | ||
| 4917 | |||
| 4918 | } | ||
| 4919 | undef %ip_already_processed; | ||
| 4920 | |||
| 4921 | if ( scalar keys %cds_rrsets ) { | ||
| 4922 | for my $ns_ip ( keys %cds_rrsets ) { | ||
| 4923 | if ( not scalar @{ $cds_rrsets{ $ns_ip }{cds} } ) { | ||
| 4924 | next; | ||
| 4925 | } | ||
| 4926 | if ( scalar grep { $_->algorithm == 0 } @{ $cds_rrsets{ $ns_ip }{ds} } ) { | ||
| 4927 | if ( scalar grep { $_->algorithm != 0 } @{ $cds_rrsets{ $ns_ip }{ds} } ) { | ||
| 4928 | $mixed_delete_cds{ $ns_ip } = 1; | ||
| 4929 | } | ||
| 4930 | else { | ||
| 4931 | $delete_cds{ $ns_ip } = 1; | ||
| 4932 | } | ||
| 4933 | next; | ||
| 4934 | } | ||
| 4935 | if ( not defined $dnskey_rrsets{ $ns_ip }{dnskey} or not scalar @{ $dnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 4936 | $no_dnskey_rrset{ $ns_ip } = 1; | ||
| 4937 | next; | ||
| 4938 | } | ||
| 4939 | foreach my $ds ( @{ $cds_rrsets{ $ns_ip }{ds} } ) { | ||
| 4940 | next if $ds->algorithm == 0; | ||
| 4941 | if ( not scalar grep { $ds->keytag == $_->keytag } @{ $dnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 4942 | push @{ $no_match_cds_with_dnskey{ $ds->keytag } }, $ns_ip; | ||
| 4943 | } | ||
| 4944 | elsif ( scalar grep { $ds->keytag == $_->keytag and not $_->flags & 256 } @{ $dnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 4945 | push @{ $cds_points_to_non_zone_dnskey{ $ds->keytag } }, $ns_ip; | ||
| 4946 | } | ||
| 4947 | else { | ||
| 4948 | if ( not scalar grep { $ds->keytag == $_->keytag } @{ $dnskey_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 4949 | push @{ $dnskey_not_signed_by_cds{ $ds->keytag } }, $ns_ip; | ||
| 4950 | } | ||
| 4951 | if ( not scalar grep { $ds->keytag == $_->keytag } @{ $cds_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 4952 | push @{ $cds_not_signed_by_cds{ $ds->keytag } }, $ns_ip; | ||
| 4953 | } | ||
| 4954 | if ( scalar grep { $ds->keytag == $_->keytag and not $_->flags & 1 } @{ $dnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 4955 | push @{ $cds_points_to_non_sep_dnskey{ $ds->keytag } }, $ns_ip; | ||
| 4956 | } | ||
| 4957 | } | ||
| 4958 | } | ||
| 4959 | if ( not scalar @{ $cds_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 4960 | $cds_not_signed{ $ns_ip } = 1; | ||
| 4961 | } | ||
| 4962 | else { | ||
| 4963 | foreach my $rrsig ( @{ $cds_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 4964 | my $msg = q{}; | ||
| 4965 | my @matching_dnskeys = grep { $rrsig->keytag == $_->keytag } @{ $dnskey_rrsets{ $ns_ip }{dnskey} }; | ||
| 4966 | if ( not scalar @matching_dnskeys ) { | ||
| 4967 | push @{ $cds_signed_by_unknown_dnskey{ $rrsig->keytag } }, $ns_ip; | ||
| 4968 | } | ||
| 4969 | elsif ( not $rrsig->verify_time( $cds_rrsets{ $ns_ip }{cds} , \@matching_dnskeys, $testing_time, $msg) ) { | ||
| 4970 | push @{ $cds_invalid_rrsig{ $rrsig->keytag } }, $ns_ip; | ||
| 4971 | } | ||
| 4972 | } | ||
| 4973 | } | ||
| 4974 | } | ||
| 4975 | |||
| 4976 | if ( scalar keys %no_dnskey_rrset ) { | ||
| 4977 | push @results, | ||
| 4978 | _emit_log( | ||
| 4979 | DS16_CDS_WITHOUT_DNSKEY => { | ||
| 4980 | ns_ip_list => join( q{;}, sort keys %no_dnskey_rrset ) | ||
| 4981 | } | ||
| 4982 | ); | ||
| 4983 | } | ||
| 4984 | |||
| 4985 | if ( scalar keys %mixed_delete_cds ) { | ||
| 4986 | push @results, | ||
| 4987 | _emit_log( | ||
| 4988 | DS16_MIXED_DELETE_CDS => { | ||
| 4989 | ns_ip_list => join( q{;}, sort keys %mixed_delete_cds ) | ||
| 4990 | } | ||
| 4991 | ); | ||
| 4992 | } | ||
| 4993 | |||
| 4994 | if ( scalar keys %delete_cds ) { | ||
| 4995 | push @results, | ||
| 4996 | _emit_log( | ||
| 4997 | DS16_DELETE_CDS => { | ||
| 4998 | ns_ip_list => join( q{;}, sort keys %delete_cds ) | ||
| 4999 | } | ||
| 5000 | ); | ||
| 5001 | } | ||
| 5002 | |||
| 5003 | if ( scalar keys %no_match_cds_with_dnskey ) { | ||
| 5004 | push @results, map { | ||
| 5005 | _emit_log( | ||
| 5006 | DS16_CDS_MATCHES_NO_DNSKEY => { | ||
| 5007 | keytag => $_, | ||
| 5008 | ns_ip_list => join( q{;}, uniq sort @{ $no_match_cds_with_dnskey{ $_ } } ) | ||
| 5009 | } | ||
| 5010 | ) | ||
| 5011 | } keys %no_match_cds_with_dnskey; | ||
| 5012 | } | ||
| 5013 | |||
| 5014 | if ( scalar keys %cds_points_to_non_zone_dnskey ) { | ||
| 5015 | push @results, map { | ||
| 5016 | _emit_log( | ||
| 5017 | DS16_CDS_MATCHES_NON_ZONE_DNSKEY => { | ||
| 5018 | keytag => $_, | ||
| 5019 | ns_ip_list => join( q{;}, uniq sort @{ $cds_points_to_non_zone_dnskey{ $_ } } ) | ||
| 5020 | } | ||
| 5021 | ) | ||
| 5022 | } keys %cds_points_to_non_zone_dnskey; | ||
| 5023 | } | ||
| 5024 | |||
| 5025 | if ( scalar keys %cds_points_to_non_sep_dnskey ) { | ||
| 5026 | push @results, map { | ||
| 5027 | _emit_log( | ||
| 5028 | DS16_CDS_MATCHES_NON_SEP_DNSKEY => { | ||
| 5029 | keytag => $_, | ||
| 5030 | ns_ip_list => join( q{;}, uniq sort @{ $cds_points_to_non_sep_dnskey{ $_ } } ) | ||
| 5031 | } | ||
| 5032 | ) | ||
| 5033 | } keys %cds_points_to_non_sep_dnskey; | ||
| 5034 | } | ||
| 5035 | |||
| 5036 | if ( scalar keys %dnskey_not_signed_by_cds ) { | ||
| 5037 | push @results, map { | ||
| 5038 | _emit_log( | ||
| 5039 | DS16_DNSKEY_NOT_SIGNED_BY_CDS => { | ||
| 5040 | keytag => $_, | ||
| 5041 | ns_ip_list => join( q{;}, uniq sort @{ $dnskey_not_signed_by_cds{ $_ } } ) | ||
| 5042 | } | ||
| 5043 | ) | ||
| 5044 | } keys %dnskey_not_signed_by_cds; | ||
| 5045 | } | ||
| 5046 | |||
| 5047 | if ( scalar keys %cds_not_signed_by_cds ) { | ||
| 5048 | push @results, map { | ||
| 5049 | _emit_log( | ||
| 5050 | DS16_CDS_NOT_SIGNED_BY_CDS => { | ||
| 5051 | keytag => $_, | ||
| 5052 | ns_ip_list => join( q{;}, uniq sort @{ $cds_not_signed_by_cds{ $_ } } ) | ||
| 5053 | } | ||
| 5054 | ) | ||
| 5055 | } keys %cds_not_signed_by_cds; | ||
| 5056 | } | ||
| 5057 | |||
| 5058 | if ( scalar keys %cds_invalid_rrsig ) { | ||
| 5059 | push @results, map { | ||
| 5060 | _emit_log( | ||
| 5061 | DS16_CDS_INVALID_RRSIG => { | ||
| 5062 | keytag => $_, | ||
| 5063 | ns_ip_list => join( q{;}, uniq sort @{ $cds_invalid_rrsig{ $_ } } ) | ||
| 5064 | } | ||
| 5065 | ) | ||
| 5066 | } keys %cds_invalid_rrsig; | ||
| 5067 | } | ||
| 5068 | |||
| 5069 | if ( scalar keys %cds_not_signed ) { | ||
| 5070 | push @results, | ||
| 5071 | _emit_log( | ||
| 5072 | DS16_CDS_UNSIGNED => { | ||
| 5073 | ns_ip_list => join( q{;}, sort keys %cds_not_signed ) | ||
| 5074 | } | ||
| 5075 | ); | ||
| 5076 | } | ||
| 5077 | |||
| 5078 | if ( scalar keys %cds_signed_by_unknown_dnskey ) { | ||
| 5079 | push @results, map { | ||
| 5080 | _emit_log( | ||
| 5081 | DS16_CDS_SIGNED_BY_UNKNOWN_DNSKEY => { | ||
| 5082 | keytag => $_, | ||
| 5083 | ns_ip_list => join( q{;}, uniq sort @{ $cds_signed_by_unknown_dnskey{ $_ } } ) | ||
| 5084 | } | ||
| 5085 | ) | ||
| 5086 | } keys %cds_signed_by_unknown_dnskey; | ||
| 5087 | } | ||
| 5088 | } | ||
| 5089 | |||
| 5090 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 5091 | } ## end sub dnssec16 | ||
| 5092 | |||
| 5093 | =over | ||
| 5094 | |||
| 5095 | =item dnssec17() | ||
| 5096 | |||
| 5097 | my @logentry_array = dnssec17( $zone ); | ||
| 5098 | |||
| 5099 | Runs the L<DNSSEC17 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec17.md>. | ||
| 5100 | |||
| 5101 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 5102 | |||
| 5103 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 5104 | |||
| 5105 | =back | ||
| 5106 | |||
| 5107 | =cut | ||
| 5108 | |||
| 5109 | sub dnssec17 { | ||
| 5110 | my ( $class, $zone ) = @_; | ||
| 5111 | |||
| 5112 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC17'; | ||
| 5113 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 5114 | my @query_types = qw{CDNSKEY DNSKEY}; | ||
| 5115 | my %cdnskey_rrsets; | ||
| 5116 | my %dnskey_rrsets; | ||
| 5117 | my %no_dnskey_rrset; | ||
| 5118 | my %mixed_delete_cdnskey; | ||
| 5119 | my %cdnskey_is_non_zone_key; | ||
| 5120 | my %cdnskey_is_non_sep_key; | ||
| 5121 | my %delete_cdnskey; | ||
| 5122 | my %no_match_cdnskey_with_dnskey; | ||
| 5123 | my %dnskey_not_signed_by_cdnskey; | ||
| 5124 | my %cdnskey_not_signed_by_cdnskey; | ||
| 5125 | my %cdnskey_not_signed; | ||
| 5126 | my %cdnskey_signed_by_unknown_dnskey; | ||
| 5127 | my %cdnskey_invalid_rrsig; | ||
| 5128 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 5129 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 5130 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 5131 | my %ip_already_processed; | ||
| 5132 | my $testing_time = time; | ||
| 5133 | |||
| 5134 | for my $nss_key ( sort keys %nss ) { | ||
| 5135 | my $ns = $nss{$nss_key}; | ||
| 5136 | |||
| 5137 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 5138 | $ip_already_processed{$ns->address->short} = 1; | ||
| 5139 | |||
| 5140 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 5141 | next; | ||
| 5142 | } | ||
| 5143 | |||
| 5144 | my $cdnskey_p = $ns->query( $zone->name, q{CDNSKEY}, { dnssec => 1, usevc => 0 } ); | ||
| 5145 | if ( not $cdnskey_p ) { | ||
| 5146 | next; | ||
| 5147 | } | ||
| 5148 | if ( not $cdnskey_p->aa ) { | ||
| 5149 | next; | ||
| 5150 | } | ||
| 5151 | if ( $cdnskey_p->rcode ne q{NOERROR} ) { | ||
| 5152 | next; | ||
| 5153 | } | ||
| 5154 | my @cdnskey_records = $cdnskey_p->get_records( q{CDNSKEY}, q{answer} ); | ||
| 5155 | if ( not scalar @cdnskey_records ) { | ||
| 5156 | next; | ||
| 5157 | } | ||
| 5158 | my @cdnskey_rrsig_records = $cdnskey_p->get_records( q{RRSIG} , q{answer} ); | ||
| 5159 | push @{ $cdnskey_rrsets{ $ns->address->short }{cdnskey} }, @cdnskey_records; | ||
| 5160 | push @{ $cdnskey_rrsets{ $ns->address->short }{rrsig} }, @cdnskey_rrsig_records; | ||
| 5161 | foreach my $cdnskey ( @{ $cdnskey_rrsets{ $ns->address->short }{cdnskey} } ) { | ||
| 5162 | my $rr_string = $cdnskey->string; | ||
| 5163 | $rr_string =~ s/\s+CDNSKEY\s+/ DNSKEY /; | ||
| 5164 | push @{ $cdnskey_rrsets{ $ns->address->short }{dnskey} }, Zonemaster::LDNS::RR->new( $rr_string ); | ||
| 5165 | } | ||
| 5166 | |||
| 5167 | my $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { dnssec => 1, usevc => 0 } ); | ||
| 5168 | if ( not $dnskey_p ) { | ||
| 5169 | next; | ||
| 5170 | } | ||
| 5171 | if ( not $dnskey_p->aa ) { | ||
| 5172 | next; | ||
| 5173 | } | ||
| 5174 | if ( $dnskey_p->rcode ne q{NOERROR} ) { | ||
| 5175 | next; | ||
| 5176 | } | ||
| 5177 | my @dnskey_records = $dnskey_p->get_records( q{DNSKEY}, q{answer} ); | ||
| 5178 | if ( not scalar @dnskey_records ) { | ||
| 5179 | next; | ||
| 5180 | } | ||
| 5181 | my @dnskey_rrsig_records = $dnskey_p->get_records( q{RRSIG} , q{answer} ); | ||
| 5182 | push @{ $dnskey_rrsets{ $ns->address->short }{dnskey} }, @dnskey_records; | ||
| 5183 | push @{ $dnskey_rrsets{ $ns->address->short }{rrsig} }, @dnskey_rrsig_records; | ||
| 5184 | $testing_time = $dnskey_p->timestamp; | ||
| 5185 | |||
| 5186 | } | ||
| 5187 | undef %ip_already_processed; | ||
| 5188 | |||
| 5189 | if ( scalar keys %cdnskey_rrsets ) { | ||
| 5190 | for my $ns_ip ( keys %cdnskey_rrsets ) { | ||
| 5191 | if ( not scalar @{ $cdnskey_rrsets{ $ns_ip }{cdnskey} } ) { | ||
| 5192 | next; | ||
| 5193 | } | ||
| 5194 | if ( scalar grep { $_->algorithm == 0 } @{ $cdnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 5195 | if ( scalar grep { $_->algorithm != 0 } @{ $cdnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 5196 | $mixed_delete_cdnskey{ $ns_ip } = 1; | ||
| 5197 | } | ||
| 5198 | else { | ||
| 5199 | $delete_cdnskey{ $ns_ip } = 1; | ||
| 5200 | } | ||
| 5201 | next; | ||
| 5202 | } | ||
| 5203 | if ( not defined $dnskey_rrsets{ $ns_ip }{dnskey} or not scalar @{ $dnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 5204 | $no_dnskey_rrset{ $ns_ip } = 1; | ||
| 5205 | next; | ||
| 5206 | } | ||
| 5207 | foreach my $dnskey ( @{ $cdnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 5208 | next if $dnskey->algorithm == 0; | ||
| 5209 | if ( not $dnskey->flags & 256 ) { | ||
| 5210 | push @{ $cdnskey_is_non_zone_key{ $dnskey->keytag } }, $ns_ip; | ||
| 5211 | } | ||
| 5212 | else { | ||
| 5213 | if ( not $dnskey->flags & 1 ) { | ||
| 5214 | push @{ $cdnskey_is_non_sep_key{ $dnskey->keytag } }, $ns_ip; | ||
| 5215 | } | ||
| 5216 | if ( not scalar grep { $dnskey->keytag == $_->keytag } @{ $dnskey_rrsets{ $ns_ip }{dnskey} } ) { | ||
| 5217 | push @{ $no_match_cdnskey_with_dnskey{ $dnskey->keytag } }, $ns_ip; | ||
| 5218 | } | ||
| 5219 | else { | ||
| 5220 | if ( not scalar grep { $dnskey->keytag == $_->keytag } @{ $dnskey_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 5221 | push @{ $dnskey_not_signed_by_cdnskey{ $dnskey->keytag } }, $ns_ip; | ||
| 5222 | } | ||
| 5223 | if ( not scalar grep { $dnskey->keytag == $_->keytag } @{ $cdnskey_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 5224 | push @{ $cdnskey_not_signed_by_cdnskey{ $dnskey->keytag } }, $ns_ip; | ||
| 5225 | } | ||
| 5226 | } | ||
| 5227 | } | ||
| 5228 | } | ||
| 5229 | if ( not scalar @{ $cdnskey_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 5230 | $cdnskey_not_signed{ $ns_ip } = 1; | ||
| 5231 | } | ||
| 5232 | else { | ||
| 5233 | foreach my $rrsig ( @{ $cdnskey_rrsets{ $ns_ip }{rrsig} } ) { | ||
| 5234 | my $msg = q{}; | ||
| 5235 | my @matching_dnskeys = grep { $rrsig->keytag == $_->keytag } @{ $dnskey_rrsets{ $ns_ip }{dnskey} }; | ||
| 5236 | if ( not scalar @matching_dnskeys ) { | ||
| 5237 | push @{ $cdnskey_signed_by_unknown_dnskey{ $rrsig->keytag } }, $ns_ip; | ||
| 5238 | } | ||
| 5239 | elsif ( not $rrsig->verify_time( $cdnskey_rrsets{ $ns_ip }{cdnskey} , \@matching_dnskeys, $testing_time, $msg) ) { | ||
| 5240 | push @{ $cdnskey_invalid_rrsig{ $rrsig->keytag } }, $ns_ip; | ||
| 5241 | } | ||
| 5242 | } | ||
| 5243 | } | ||
| 5244 | } | ||
| 5245 | |||
| 5246 | if ( scalar keys %no_dnskey_rrset ) { | ||
| 5247 | push @results, | ||
| 5248 | _emit_log( | ||
| 5249 | DS17_CDNSKEY_WITHOUT_DNSKEY => { | ||
| 5250 | ns_ip_list => join( q{;}, sort keys %no_dnskey_rrset ) | ||
| 5251 | } | ||
| 5252 | ); | ||
| 5253 | } | ||
| 5254 | |||
| 5255 | if ( scalar keys %mixed_delete_cdnskey ) { | ||
| 5256 | push @results, | ||
| 5257 | _emit_log( | ||
| 5258 | DS17_MIXED_DELETE_CDNSKEY => { | ||
| 5259 | ns_ip_list => join( q{;}, sort keys %mixed_delete_cdnskey ) | ||
| 5260 | } | ||
| 5261 | ); | ||
| 5262 | } | ||
| 5263 | |||
| 5264 | if ( scalar keys %delete_cdnskey ) { | ||
| 5265 | push @results, | ||
| 5266 | _emit_log( | ||
| 5267 | DS17_DELETE_CDNSKEY => { | ||
| 5268 | ns_ip_list => join( q{;}, sort keys %delete_cdnskey ) | ||
| 5269 | } | ||
| 5270 | ); | ||
| 5271 | } | ||
| 5272 | |||
| 5273 | if ( scalar keys %no_match_cdnskey_with_dnskey ) { | ||
| 5274 | push @results, map { | ||
| 5275 | _emit_log( | ||
| 5276 | DS17_CDNSKEY_MATCHES_NO_DNSKEY => { | ||
| 5277 | keytag => $_, | ||
| 5278 | ns_ip_list => join( q{;}, uniq sort @{ $no_match_cdnskey_with_dnskey{ $_ } } ) | ||
| 5279 | } | ||
| 5280 | ) | ||
| 5281 | } keys %no_match_cdnskey_with_dnskey; | ||
| 5282 | } | ||
| 5283 | |||
| 5284 | if ( scalar keys %cdnskey_is_non_zone_key ) { | ||
| 5285 | push @results, map { | ||
| 5286 | _emit_log( | ||
| 5287 | DS17_CDNSKEY_IS_NON_ZONE => { | ||
| 5288 | keytag => $_, | ||
| 5289 | ns_ip_list => join( q{;}, uniq sort @{ $cdnskey_is_non_zone_key{ $_ } } ) | ||
| 5290 | } | ||
| 5291 | ) | ||
| 5292 | } keys %cdnskey_is_non_zone_key; | ||
| 5293 | } | ||
| 5294 | |||
| 5295 | |||
| 5296 | if ( scalar keys %cdnskey_is_non_sep_key ) { | ||
| 5297 | push @results, map { | ||
| 5298 | _emit_log( | ||
| 5299 | DS17_CDNSKEY_IS_NON_SEP => { | ||
| 5300 | keytag => $_, | ||
| 5301 | ns_ip_list => join( q{;}, uniq sort @{ $cdnskey_is_non_sep_key{ $_ } } ) | ||
| 5302 | } | ||
| 5303 | ) | ||
| 5304 | } keys %cdnskey_is_non_sep_key; | ||
| 5305 | } | ||
| 5306 | |||
| 5307 | if ( scalar keys %dnskey_not_signed_by_cdnskey ) { | ||
| 5308 | push @results, map { | ||
| 5309 | _emit_log( | ||
| 5310 | DS17_DNSKEY_NOT_SIGNED_BY_CDNSKEY => { | ||
| 5311 | keytag => $_, | ||
| 5312 | ns_ip_list => join( q{;}, uniq sort @{ $dnskey_not_signed_by_cdnskey{ $_ } } ) | ||
| 5313 | } | ||
| 5314 | ) | ||
| 5315 | } keys %dnskey_not_signed_by_cdnskey; | ||
| 5316 | } | ||
| 5317 | |||
| 5318 | if ( scalar keys %cdnskey_not_signed_by_cdnskey ) { | ||
| 5319 | push @results, map { | ||
| 5320 | _emit_log( | ||
| 5321 | DS17_CDNSKEY_NOT_SIGNED_BY_CDNSKEY => { | ||
| 5322 | keytag => $_, | ||
| 5323 | ns_ip_list => join( q{;}, uniq sort @{ $cdnskey_not_signed_by_cdnskey{ $_ } } ) | ||
| 5324 | } | ||
| 5325 | ) | ||
| 5326 | } keys %cdnskey_not_signed_by_cdnskey; | ||
| 5327 | } | ||
| 5328 | |||
| 5329 | if ( scalar keys %cdnskey_invalid_rrsig ) { | ||
| 5330 | push @results, map { | ||
| 5331 | _emit_log( | ||
| 5332 | DS17_CDNSKEY_INVALID_RRSIG => { | ||
| 5333 | keytag => $_, | ||
| 5334 | ns_ip_list => join( q{;}, uniq sort @{ $cdnskey_invalid_rrsig{ $_ } } ) | ||
| 5335 | } | ||
| 5336 | ) | ||
| 5337 | } keys %cdnskey_invalid_rrsig; | ||
| 5338 | } | ||
| 5339 | |||
| 5340 | if ( scalar keys %cdnskey_not_signed ) { | ||
| 5341 | push @results, | ||
| 5342 | _emit_log( | ||
| 5343 | DS17_CDNSKEY_UNSIGNED => { | ||
| 5344 | ns_ip_list => join( q{;}, sort keys %cdnskey_not_signed ) | ||
| 5345 | } | ||
| 5346 | ); | ||
| 5347 | } | ||
| 5348 | |||
| 5349 | if ( scalar keys %cdnskey_signed_by_unknown_dnskey ) { | ||
| 5350 | push @results, map { | ||
| 5351 | _emit_log( | ||
| 5352 | DS17_CDNSKEY_SIGNED_BY_UNKNOWN_DNSKEY => { | ||
| 5353 | keytag => $_, | ||
| 5354 | ns_ip_list => join( q{;}, uniq sort @{ $cdnskey_signed_by_unknown_dnskey{ $_ } } ) | ||
| 5355 | } | ||
| 5356 | ) | ||
| 5357 | } keys %cdnskey_signed_by_unknown_dnskey; | ||
| 5358 | } | ||
| 5359 | } | ||
| 5360 | |||
| 5361 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 5362 | } ## end sub dnssec17 | ||
| 5363 | |||
| 5364 | =over | ||
| 5365 | |||
| 5366 | =item dnssec18() | ||
| 5367 | |||
| 5368 | my @logentry_array = dnssec18( $zone ); | ||
| 5369 | |||
| 5370 | Runs the L<DNSSEC18 Test Case|https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/tests/DNSSEC-TP/dnssec18.md>. | ||
| 5371 | |||
| 5372 | Takes a L<Zonemaster::Engine::Zone> object. | ||
| 5373 | |||
| 5374 | Returns a list of L<Zonemaster::Engine::Logger::Entry> objects. | ||
| 5375 | |||
| 5376 | =back | ||
| 5377 | |||
| 5378 | =cut | ||
| 5379 | |||
| 5380 | sub dnssec18 { | ||
| 5381 | my ( $class, $zone ) = @_; | ||
| 5382 | |||
| 5383 | local $Zonemaster::Engine::Logger::TEST_CASE_NAME = 'DNSSEC18'; | ||
| 5384 | push my @results, _emit_log( TEST_CASE_START => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ); | ||
| 5385 | my %cds_rrsets; | ||
| 5386 | my %cdnskey_rrsets; | ||
| 5387 | my %dnskey_rrsets; | ||
| 5388 | my @ds_records; | ||
| 5389 | my %ds_no_match_cds_rrsig; | ||
| 5390 | my %ds_no_match_cdnskey_rrsig; | ||
| 5391 | my $continue_with_child_tests = 1; | ||
| 5392 | |||
| 5393 | my $parent = Zonemaster::Engine::TestMethods->method1( $zone ); | ||
| 5394 | my @nss_parent = @{ $parent->ns }; | ||
| 5395 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_parent; | ||
| 5396 | my %ip_already_processed; | ||
| 5397 | |||
| 5398 | for my $nss_key ( sort keys %nss ) { | ||
| 5399 | my $ns = $nss{$nss_key}; | ||
| 5400 | |||
| 5401 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 5402 | $ip_already_processed{$ns->address->short} = 1; | ||
| 5403 | |||
| 5404 | if ( _ip_disabled_message( \@results, $ns, q{DS} ) ) { | ||
| 5405 | next; | ||
| 5406 | } | ||
| 5407 | |||
| 5408 | my $ds_p = $ns->query( $zone->name, q{DS}, { dnssec => 1, usevc => 0 } ); | ||
| 5409 | if ( not $ds_p or $ds_p->rcode ne q{NOERROR} or not $ds_p->aa ) { | ||
| 5410 | next; | ||
| 5411 | } | ||
| 5412 | my @tmp_ds_records = $ds_p->get_records_for_name( q{DS}, $zone->name->string, q{answer} ); | ||
| 5413 | if ( not scalar @tmp_ds_records ) { | ||
| 5414 | next; | ||
| 5415 | } | ||
| 5416 | foreach my $tmp_ds_record ( @tmp_ds_records ) { | ||
| 5417 | if ( | ||
| 5418 | not grep { | ||
| 5419 | $tmp_ds_record->keytag == $_->keytag | ||
| 5420 | and $tmp_ds_record->digtype == $_->digtype | ||
| 5421 | and $tmp_ds_record->algorithm == $_->algorithm | ||
| 5422 | and $tmp_ds_record->hexdigest eq $_->hexdigest | ||
| 5423 | } @ds_records | ||
| 5424 | ) | ||
| 5425 | { | ||
| 5426 | push @ds_records, $tmp_ds_record; | ||
| 5427 | } | ||
| 5428 | } | ||
| 5429 | } | ||
| 5430 | undef %ip_already_processed; | ||
| 5431 | |||
| 5432 | if ( not scalar @ds_records ) { | ||
| 5433 | $continue_with_child_tests = 0; | ||
| 5434 | } | ||
| 5435 | |||
| 5436 | if ( $continue_with_child_tests ) { | ||
| 5437 | |||
| 5438 | my @query_types = qw{CDNSKEY CDS DNSKEY}; | ||
| 5439 | my @nss_del = @{ Zonemaster::Engine::TestMethods->method4( $zone ) }; | ||
| 5440 | my @nss_child = @{ Zonemaster::Engine::TestMethods->method5( $zone ) }; | ||
| 5441 | my %nss = map { $_->name->string . '/' . $_->address->short => $_ } @nss_del, @nss_child; | ||
| 5442 | my %ip_already_processed; | ||
| 5443 | |||
| 5444 | for my $nss_key ( sort keys %nss ) { | ||
| 5445 | my $ns = $nss{$nss_key}; | ||
| 5446 | |||
| 5447 | next if exists $ip_already_processed{$ns->address->short}; | ||
| 5448 | $ip_already_processed{$ns->address->short} = 1; | ||
| 5449 | |||
| 5450 | if ( _ip_disabled_message( \@results, $ns, @query_types ) ) { | ||
| 5451 | next; | ||
| 5452 | } | ||
| 5453 | |||
| 5454 | my $cds_p = $ns->query( $zone->name, q{CDS}, { dnssec => 1, usevc => 0 } ); | ||
| 5455 | if ( not $cds_p or not $cds_p->aa or $cds_p->rcode ne q{NOERROR} ) { | ||
| 5456 | next; | ||
| 5457 | } | ||
| 5458 | my @cds_records = $cds_p->get_records( q{CDS}, q{answer} ); | ||
| 5459 | if ( scalar @cds_records ) { | ||
| 5460 | my @cds_rrsig_records = $cds_p->get_records( q{RRSIG} , q{answer} ); | ||
| 5461 | push @{ $cds_rrsets{ $ns->address->short }{cds} }, @cds_records; | ||
| 5462 | push @{ $cds_rrsets{ $ns->address->short }{rrsig} }, @cds_rrsig_records; | ||
| 5463 | foreach my $cds ( @{ $cds_rrsets{ $ns->address->short }{cds} } ) { | ||
| 5464 | my $rr_string = $cds->string; | ||
| 5465 | $rr_string =~ s/\s+CDS\s+/ DS /; | ||
| 5466 | push @{ $cds_rrsets{ $ns->address->short }{ds} }, Zonemaster::LDNS::RR->new( $rr_string ); | ||
| 5467 | } | ||
| 5468 | } | ||
| 5469 | |||
| 5470 | my $cdnskey_p = $ns->query( $zone->name, q{CDNSKEY}, { dnssec => 1, usevc => 0 } ); | ||
| 5471 | if ( not $cdnskey_p or not $cdnskey_p->aa or $cdnskey_p->rcode ne q{NOERROR} ) { | ||
| 5472 | next; | ||
| 5473 | } | ||
| 5474 | my @cdnskey_records = $cdnskey_p->get_records( q{CDNSKEY}, q{answer} ); | ||
| 5475 | if ( scalar @cdnskey_records ) { | ||
| 5476 | my @cdnskey_rrsig_records = $cdnskey_p->get_records( q{RRSIG} , q{answer} ); | ||
| 5477 | push @{ $cdnskey_rrsets{ $ns->address->short }{cdnskey} }, @cdnskey_records; | ||
| 5478 | push @{ $cdnskey_rrsets{ $ns->address->short }{rrsig} }, @cdnskey_rrsig_records; | ||
| 5479 | foreach my $cdnskey ( @{ $cdnskey_rrsets{ $ns->address->short }{cdnskey} } ) { | ||
| 5480 | my $rr_string = $cdnskey->string; | ||
| 5481 | $rr_string =~ s/\s+CDNSKEY\s+/ DNSKEY /; | ||
| 5482 | push @{ $cdnskey_rrsets{ $ns->address->short }{dnskey} }, Zonemaster::LDNS::RR->new( $rr_string ); | ||
| 5483 | } | ||
| 5484 | } | ||
| 5485 | |||
| 5486 | my $dnskey_p = $ns->query( $zone->name, q{DNSKEY}, { dnssec => 1, usevc => 0 } ); | ||
| 5487 | if ( not $dnskey_p or $dnskey_p->rcode ne q{NOERROR} or not $dnskey_p->aa ) { | ||
| 5488 | next; | ||
| 5489 | } | ||
| 5490 | my @dnskey_records = $dnskey_p->get_records( q{DNSKEY}, q{answer} ); | ||
| 5491 | if ( scalar @dnskey_records ) { | ||
| 5492 | push @{ $dnskey_rrsets{ $ns->address->short }{dnskey} }, @dnskey_records; | ||
| 5493 | } | ||
| 5494 | } | ||
| 5495 | undef %ip_already_processed; | ||
| 5496 | |||
| 5497 | if ( not( not scalar keys %cds_rrsets and not scalar keys %cdnskey_rrsets ) | ||
| 5498 | and not( not scalar keys %dnskey_rrsets ) ) | ||
| 5499 | { | ||
| 5500 | for my $ns_ip ( keys %cds_rrsets ) { | ||
| 5501 | my (@rrsig, @dnskey); | ||
| 5502 | push @rrsig, @{ $cds_rrsets{ $ns_ip }{rrsig} }; | ||
| 5503 | push @dnskey, @{ $dnskey_rrsets{ $ns_ip }{dnskey} }; | ||
| 5504 | my $match = 0; | ||
| 5505 | foreach my $ds ( @ds_records ) { | ||
| 5506 | if ( not scalar grep { $ds->keytag == $_->keytag } @dnskey ) { | ||
| 5507 | next; | ||
| 5508 | } | ||
| 5509 | elsif ( scalar grep { $ds->keytag == $_->keytag } @rrsig ) { | ||
| 5510 | $match = 1; | ||
| 5511 | last; | ||
| 5512 | } | ||
| 5513 | } | ||
| 5514 | if ( not $match ) { | ||
| 5515 | $ds_no_match_cds_rrsig{ $ns_ip } = 1; | ||
| 5516 | } | ||
| 5517 | } | ||
| 5518 | for my $ns_ip ( keys %cdnskey_rrsets ) { | ||
| 5519 | my (@rrsig, @dnskey); | ||
| 5520 | push @rrsig, @{ $cdnskey_rrsets{ $ns_ip }{rrsig} }; | ||
| 5521 | push @dnskey, @{ $dnskey_rrsets{ $ns_ip }{dnskey} }; | ||
| 5522 | my $match = 0; | ||
| 5523 | foreach my $ds ( @ds_records ) { | ||
| 5524 | if ( not scalar grep { $ds->keytag == $_->keytag } @dnskey ) { | ||
| 5525 | next; | ||
| 5526 | } | ||
| 5527 | elsif ( scalar grep { $ds->keytag == $_->keytag } @rrsig ) { | ||
| 5528 | $match = 1; | ||
| 5529 | last; | ||
| 5530 | } | ||
| 5531 | } | ||
| 5532 | if ( not $match ) { | ||
| 5533 | $ds_no_match_cdnskey_rrsig{ $ns_ip } = 1; | ||
| 5534 | } | ||
| 5535 | } | ||
| 5536 | if ( scalar keys %ds_no_match_cds_rrsig ) { | ||
| 5537 | push @results, | ||
| 5538 | _emit_log( | ||
| 5539 | DS18_NO_MATCH_CDS_RRSIG_DS => { | ||
| 5540 | ns_ip_list => join( q{;}, sort keys %ds_no_match_cds_rrsig ) | ||
| 5541 | } | ||
| 5542 | ); | ||
| 5543 | } | ||
| 5544 | if ( scalar keys %ds_no_match_cdnskey_rrsig ) { | ||
| 5545 | push @results, | ||
| 5546 | _emit_log( | ||
| 5547 | DS18_NO_MATCH_CDNSKEY_RRSIG_DS => { | ||
| 5548 | ns_ip_list => join( q{;}, sort keys %ds_no_match_cdnskey_rrsig ) | ||
| 5549 | } | ||
| 5550 | ); | ||
| 5551 | } | ||
| 5552 | } | ||
| 5553 | } | ||
| 5554 | |||
| 5555 | return ( @results, _emit_log( TEST_CASE_END => { testcase => $Zonemaster::Engine::Logger::TEST_CASE_NAME } ) ); | ||
| 5556 | } ## end sub dnssec18 | ||
| 5557 | |||
| 5558 | 1; |