Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ t/Test-nameserver01-C.data
t/Test-nameserver01-C.t
t/Test-nameserver01-D.data
t/Test-nameserver01-D.t
t/Test-nameserver15.data
t/Test-nameserver15.t
t/Test-syntax.data
t/Test-syntax.t
t/Test-syntax06-A.data
Expand Down
7 changes: 5 additions & 2 deletions docs/logentry_args.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ and updated messages (*msgids* and *msgstr*).
| algo_descr | Text | The human readable description of a [DNSSEC algorithm]. |
| algo_mnemo | Text | The mnemonic of a [DNSSEC algorithm]. |
| algo_num | Non-negative integer | The numeric value for a [DNSSEC algorithm]. |
| domain | Domain name | A domain name. If "nsname" or "mailtarget" is also applicable, use that one instead. |
| domain | Domain name | A domain name. If "nsname", "mailtarget" or "query_name" is also applicable, use that one instead. |
| ds_algo_descr | Text | The human readable description of a [DS Digest algorithm]. |
| ds_algo_mnemo | Text | The mnemonic of a [DS Digest algorithm]. |
| ds_algo_num | Non-negative integer | The numeric value for a [DS Digest algorithm]. |
Expand All @@ -68,10 +68,12 @@ and updated messages (*msgids* and *msgstr*).
| ns_list | List of domain name and IP address pairs | A list of name servers, as specified by "ns", separated by ";". |
| nsname | Domain name | The domain name of a name server. |
| nsname_list | List of domain names | A list of name servers, as specified by "nsname", separated by ";". |
| query_name | Domain name | A query domain name (QNAME), as defined in [RFC1035, section 4.1.2]. |
| rcode | An RCODE Name | An RCODE Name (not numeric code) from [DNS RCODEs]. |
| rrtype | A Resource Record TYPE Name | A Resource Record TYPE Name (not numeric code) from [DNS RR TYPEs]. |
| soaserial | Non-negative integer | The numeric value for the SERIAL field in an SOA record. Integer in range 0-4,294,967,295 |
| soaserial_list | List of non-negative integers | A list of non-negative integers, as specified by "soaserial", separated by ";". |
| string | Text | The content of the RDATA of a TXT resource record. |
| testcase | A Zonemaster test case, or `all` | A test case identifier. |
| unicode_name | Unicode name of a code point | The name is a string in ASCII only and in upper case, e.g. "LATIN SMALL LETTER A"|

Expand Down Expand Up @@ -149,5 +151,6 @@ Message names maked with a question mark should not be considered stable.
[DNSSEC algorithm]: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml
[DS Digest algorithm]: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml
[fr.po]: ../share/fr.po
[sv.po]: ../share/fr.po
[RFC1035, section 4.1.2]: https://datatracker.ietf.org/doc/html/rfc1035#section-4.1.2
[sv.po]: ../share/sv.po

84 changes: 83 additions & 1 deletion lib/Zonemaster/Engine/Test/Nameserver.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use 5.014002;
use strict;
use warnings;

use version; our $VERSION = version->declare( "v1.0.27" );
use version; our $VERSION = version->declare( "v1.1.0" );

use List::MoreUtils qw[uniq none];
use Locale::TextDomain qw[Zonemaster-Engine];
Expand Down Expand Up @@ -72,6 +72,9 @@ sub all {
if ( Zonemaster::Engine::Util::should_run_test( q{nameserver13} ) ) {
push @results, $class->nameserver13( $zone );
}
if ( Zonemaster::Engine::Util::should_run_test( q{nameserver15} ) ) {
push @results, $class->nameserver15( $zone );
}

return @results;
} ## end sub all
Expand Down Expand Up @@ -216,6 +219,14 @@ sub metadata {
TEST_CASE_START
)
],
nameserver15 => [
qw(
N15_NO_VERSION
N15_SOFTWARE_VERSION
TEST_CASE_END
TEST_CASE_START
)
],
};
} ## end sub metadata

Expand Down Expand Up @@ -445,6 +456,14 @@ Readonly my %TAG_DESCRIPTIONS => (
__x # NAMESERVER:N11_UNSET_AA
'The DNS response, on query with unknown EDNS option-code, is unexpectedly not authoritative from name servers "{ns_ip_list}".', @_;
},
N15_NO_VERSION => sub {
__x # NAMESERVER:N15_NO_VERSION
'The following name server(s) do not respond to software version queries. Returned from name servers: "{ns_ip_list}"', @_;
},
N15_SOFTWARE_VERSION => sub {
__x # NAMESERVER:N15_SOFTWARE_VERSION
'The following name server(s) respond to software version query "{query_name}" with string "{string}". Returned from name servers: "{ns_ip_list}"', @_;
},
QNAME_CASE_INSENSITIVE => sub {
__x # NAMESERVER:QNAME_CASE_INSENSITIVE
'Nameserver {ns} does not preserve original case of the queried name ({domain}).', @_;
Expand Down Expand Up @@ -1338,6 +1357,65 @@ sub nameserver13 {
return ( @results, info( TEST_CASE_END => { testcase => (split /::/, (caller(0))[3])[-1] } ) );
} ## end sub nameserver13

sub nameserver15 {
my ( $class, $zone ) = @_;
push my @results, info( TEST_CASE_START => { testcase => (split /::/, (caller(0))[3])[-1] } );

my %txt_data;
my @no_version;

foreach my $ns ( @{ Zonemaster::Engine::TestMethods->method4and5( $zone ) } ) {

next if ( _ip_disabled_message( \@results, $ns, q{TXT} ) );

my $found_string = 0;

foreach my $query_name ( q{version.bind}, q{version.server} ) {
my $p = $ns->query( $query_name, q{TXT}, { class => q{CH} } );

if ( $p and $p->rcode eq q{NOERROR} and scalar $p->get_records_for_name( q{TXT}, $query_name, q{answer} ) ) {
foreach my $rr ( $p->get_records_for_name(q{TXT}, $query_name, q{answer} ) ) {
my $string = $rr->txtdata;

if ( $string and $string ne "") {
$found_string = 1;
push @{ $txt_data{$string}{$query_name} }, $ns->string;
}
}
}
}

if ( not $found_string ) {
push @no_version, $ns->string;
}
}

if ( scalar keys %txt_data ) {
foreach my $string ( keys %txt_data ) {
push @results, map {
info(
N15_SOFTWARE_VERSION => {
string => $string,
query_name => $_,
ns_ip_list => join( q{;}, uniq sort @{ $txt_data{$string}{$_} } )
}
)
} keys %{ $txt_data{$string} };
}
}

if ( scalar @no_version ) {
push @results,
info(
N15_NO_VERSION => {
ns_ip_list => join( q{;}, uniq sort @no_version )
}
);
}

return ( @results, info( TEST_CASE_END => { testcase => (split /::/, (caller(0))[3])[-1] } ) );
} ## end sub nameserver15

1;

=head1 NAME
Expand Down Expand Up @@ -1427,6 +1505,10 @@ Check whether authoritative name servers responses has "Z" bits cleared even if

This Test Case will try to verify that if the response to a query with an OPT record is truncated, then the response will contain an OPT record.

=item nameserver15($zone)

Verifies if a name server responds to certain TXT queries in the CHAOS class, specifically about its software version.

=back

=cut
3 changes: 3 additions & 0 deletions share/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@
"N11_UNEXPECTED_ANSWER_SECTION" : "WARNING",
"N11_UNEXPECTED_RCODE" : "WARNING",
"N11_UNSET_AA" : "WARNING",
"N15_NO_VERSION": "INFO",
"N15_SOFTWARE_VERSION": "INFO",
"QNAME_CASE_INSENSITIVE" : "WARNING",
"QNAME_CASE_SENSITIVE" : "INFO",
"QUERY_DROPPED" : "NOTICE",
Expand Down Expand Up @@ -530,6 +532,7 @@
"nameserver11",
"nameserver12",
"nameserver13",
"nameserver15",
"syntax01",
"syntax02",
"syntax03",
Expand Down
2 changes: 2 additions & 0 deletions t/Test-nameserver.t
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ $zone = Zonemaster::Engine->zone( 'bemacom.se' );
zone_gives( 'nameserver11', $zone, [q{N11_UNEXPECTED_RCODE}] );
zone_gives_not( 'nameserver11', $zone, [qw{N11_NO_EDNS N11_NO_RESPONSE N11_RETURNS_UNKNOWN_OPTION_CODE N11_UNEXPECTED_ANSWER_SECTION N11_UNSET_AA}] );

# nameserver15 -- see t/Test-nameserver15.t instead.

SKIP: {
skip "Zone does not actually have tested problem", 1,
$zone = Zonemaster::Engine->zone( 'escargot.se' );
Expand Down
Loading