2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

35120 Commits

Author SHA1 Message Date
Mark Andrews
3fa3b11ef8
Add synthesis of NODATA at wildcard
The old code rejected NSEC that proved the wildcard name existed
(exists).  The new code rejects NSEC that prove that the wildcard
name exists and that the type exists (exists && data) but accept
NSEC that prove the wildcard name exists.

query_synthnxdomain (renamed query_synthnxdomainnodata) already
took the NSEC records and added the correct records to the message
body for NXDOMAIN or NODATA responses with the above change.  The
only additional change needed was to ensure the correct RCODE is
set.
2021-12-02 14:24:37 +01:00
Mark Andrews
12c64d55f2
Add CHANGES and release note for [GL #1265] 2021-12-02 14:24:31 +01:00
Mark Andrews
4bdd5a9953
Ignore NSEC records without RRSIG and NSEC present
dns_nsec_noexistnodata now checks that RRSIG and NSEC are
present in the type map.  Both types should be present in
a correctly constructed NSEC record.  This check is in
addition to similar checks in resolver.c and validator.c.
2021-12-02 14:18:42 +01:00
Mark Andrews
8ff2c133b5
Add dns_nsec_requiredtypespresent
checks an NSEC rdataset to ensure that both NSEC and RRSIG are
present in the type map.  These types are required for the NSEC
to be valid
2021-12-02 14:18:42 +01:00
Mark Andrews
571f3af6e8
Check 'rndc stats' output for 'cache NSEC auxiliary database nodes' 2021-12-02 14:18:41 +01:00
Mark Andrews
0e1048ff25
Check synth-from-dnssec JSON counters 2021-12-02 14:18:41 +01:00
Mark Andrews
6dcea1531d
Check synth-from-dnssec XML counters 2021-12-02 14:18:41 +01:00
Mark Andrews
98cab76295
Check reported synthesized responses in named.stats 2021-12-02 14:18:41 +01:00
Mark Andrews
48bf5f143b
Correct spelling of synthesized 2021-12-02 14:18:41 +01:00
Mark Andrews
fe8bc79f2b
Check 'rndc stats' output for 'covering nsec returned' 2021-12-02 14:18:41 +01:00
Mark Andrews
43316a40a0
Record how often DNS_R_COVERINGNSEC is returned from the cache
reported as "covering nsec returned" when dumping cache stats
and as "CoveringNSEC" in json and xml cache statistics.
2021-12-02 14:18:41 +01:00
Mark Andrews
90dbdb2cb5
Restore 'synth-from-dnssec yes;' as the default 2021-12-02 14:18:41 +01:00
Mark Andrews
62dd9ec9c1
Report Cache NSEC auxilary database size 2021-12-02 14:18:41 +01:00
Mark Andrews
85bfcaeb2e
Extend dns_db_nodecount to access auxilary rbt node counts
dns_db_nodecount can now be used to get counts from the auxilary
rbt databases.  The existing node count is returned by
tree=dns_dbtree_main.  The nsec and nsec3 node counts by dns_dbtree_nsec
and dns_dbtree_nsec3 respectively.
2021-12-02 14:18:41 +01:00
Mark Andrews
cad24b8dc4
Check Cloudflare "black lies" response
"black lies" with a different QTYPE should synthesis NODATA responses.
2021-12-02 14:18:41 +01:00
Mark Andrews
c8a7f92b9e
Allow "black lies" to be cached
"black lies" differ from "white lies" in that the owner name of the
NSEC record matches the QNAME and the intent is to return NODATA
instead of NXDOMAIN for all types.  Caching this NSEC does not lead
to unexpected behaviour on synthesis when the QNAME matches the
NSEC owner which it does for the the general "white lie" response.

"black lie" QNAME NSEC \000.QNAME NSEC RRSIG

"white lie" QNAME- NSEC QNAME+ NSEC RRSIG

where QNAME- is a name that is close to QNAME but sorts before QNAME
and QNAME+ is a that is close to QNAME but sorts after QNAME.

Black lies are safe to cache as they don't bring into existence
names that are not intended to exist.  "Black lies" intentional change
NXDOMAIN to NODATA. "White lies" bring QNAME- into existence and named
would synthesis NODATA for QNAME+ if it is queried for that name
instead of discovering the, presumable, NXDOMAIN response.

Note rejection NSEC RRsets with NEXT names starting with the label
'\000' renders this change ineffective (see reject-000-label).
2021-12-02 14:18:41 +01:00
Mark Andrews
0d75ec9ee3
Check that minimal NSEC records are not cached
construct a test zone which contains a minimal NSEC record,
emit priming queries for this record, and then check that
a respose that would be synthesised from it isn't.
2021-12-02 14:18:41 +01:00
Mark Andrews
6fae151c9d
Do not cache minimal NSEC records (NSEC + RRSIG only)
these are not useful for dnssec synthesis as they can result in
false NODATA responses and just consume cache memory
2021-12-02 14:18:41 +01:00
Mark Andrews
e906fefb7d
Extend synthfromdnssec to test with dnssec validation disabled 2021-12-02 14:18:41 +01:00
Mark Andrews
10a05dc26a
Extend synthfromdnssec to check insecure responses
add matching tests against a insecure zone to those which
which are synthesised.
2021-12-02 14:18:40 +01:00
Mark Andrews
27acf56ba3
Remove unnecessary dns_rbt_fullnamefromnode call
the results from dns_rbt_fullnamefromnode are not used.
2021-12-02 14:18:40 +01:00
Mark Andrews
48f1f51870
Extend checking of synthesised respones
add digcomp checks to cover wildcard and cname wildcard case
(nxdomain and nodata already covered)
2021-12-02 14:18:40 +01:00
Mark Andrews
89542b8a15
Count DNS_R_COVERINGNSEC as a cache {query}hit
Note when synthesising answer involving wildcards we look in the
cache multiple times, once for the QNAME and once for the wildcard
name which is constucted by looking at the names from the covering
NSEC return by the QNAME miss.
2021-12-02 14:18:40 +01:00
Mark Andrews
e5ce159b5b
Add additional checks that upstream queries are not made
Check the named.run of authorative server that queries for the
synthesis target name are only made when expected and not when
unexpected.
2021-12-02 14:18:40 +01:00
Mark Andrews
67d4c783fa
Check synthesis of CNAME record from wildcard CNAME 2021-12-02 14:18:40 +01:00
Mark Andrews
25915e81b4
Check synthesis of A record from wildcard A 2021-12-02 14:18:40 +01:00
Mark Andrews
b8563db96a
Check whether soa responses are synthesised or not 2021-12-02 14:18:40 +01:00
Mark Andrews
95ec47a460
Add and use check_status 2021-12-02 14:18:40 +01:00
Mark Andrews
d06e8366b4
Add and use check_ad_flag 2021-12-02 14:18:40 +01:00
Mark Andrews
3a5652ccb1
Rework rbtdb.c:find_coveringnsec() to use the auxilary nsec rbt
this improves the performance of looking for NSEC and RRSIG(NSEC)
records in the cache by skipping lots of nodes in the main trees
in the cache without these records present.  This is a simplified
version of previous_closest_nsec() which uses the same underlying
mechanism to look for NSEC and RRSIG(NSEC) records in authorative
zones.

The auxilary NSEC tree was already being maintained as a side effect
of looking for the covering NSEC in large zones where there can be
lots of glue records that needed to be skipped.  Nodes are added
to the tree whenever a NSEC record is added to the primary tree.
They are removed when the corresponding node is removed from the
primary tree.

Having nodes in the NSEC tree w/o NSEC records in the primary tree
should not impact on synth-from-dnssec efficiency as that node would
have held the NSEC we would have been needed to synthesise the
response.  Removing the node when the NSEC RRset expires would only
cause rbtdb to return a NSEC which would be rejected at a higher
level.
2021-12-02 14:18:40 +01:00
Ondřej Surý
240b8a3afc Merge branch '2700-improve-failed-tcp-accept-logging' into 'main'
Improve the logging on failed TCP accept

Closes #2700

See merge request isc-projects/bind9!5611
2021-12-02 13:18:10 +00:00
Ondřej Surý
9d53471890 Add CHANGES and release note for [GL #2700] 2021-12-02 14:08:53 +01:00
Ondřej Surý
20ac73eb22 Improve the logging on failed TCP accept
Previously, when TCP accept failed, we have logged a message with
ISC_LOG_ERROR level.  One common case, how this could happen is that the
client hits TCP client quota and is put on hold and when resumed, the
client has already given up and closed the TCP connection.  In such
case, the named would log:

    TCP connection failed: socket is not connected

This message was quite confusing because it actually doesn't say that
it's related to the accepting the TCP connection and also it logs
everything on the ISC_LOG_ERROR level.

Change the log message to "Accepting TCP connection failed" and for
specific error states lower the severity of the log message to
ISC_LOG_INFO.
2021-12-02 13:50:00 +01:00
Evan Hunt
4ecbc3d09f Merge branch '3026-premature-tcp-connection-closure-leaks-fetch-contexts-hang-on-shutdown' into 'main'
Shutdown all active TCP connections on error

Closes #3026

See merge request isc-projects/bind9!5599
2021-12-01 20:10:44 +00:00
Ondřej Surý
4e779b11f6 Add CHANGES and release notes for [GL #3026] 2021-12-01 11:48:15 -08:00
Ondřej Surý
5c17919019 Add TCP connection reset test
The TCP connection reset test starts mock UDP and TCP server which
always returns empty DNS answer with TC bit set over UDP and resets the
TCP connection after five seconds.

When tested without the fix, the DNS query to 10.53.0.2 times out and
the ns2 server hangs at shutdown.
2021-12-01 11:48:12 -08:00
Evan Hunt
fa8f409af2 On non-matching answer, check for missed timeout
A TCP connection may be held open past its proper timeout if it's
receiving a stream of DNS responses that don't match any queries.
In this case, we now check whether the oldest query should have timed
out.
2021-12-01 11:45:55 -08:00
Ondřej Surý
ba1cadf14a Tear down the TCP connection on too many unexpected DNS messages
When the outgoing TCP dispatch times-out active response, we might still
receive the answer during the lifetime of the connection.  Previously,
we would just ignore any non-matching DNS answers, which would allow the
server to feed us with otherwise valid DNS answer and keep the
connection open.

Add a counter for timed-out DNS queries over TCP and tear down the whole
TCP connection if we receive unexpected number of DNS answers.
2021-12-01 11:45:55 -08:00
Ondřej Surý
c84ed5056e Refactor tcp_recv()
The tcp_recv() function used lot of gotos that made the function hard to
read.  Refactor the function by splitting it into smaller logical chunks.
2021-12-01 11:45:55 -08:00
Ondřej Surý
10f4f1a250 Shutdown all TCP connection on invalid DNS message
Previously, when invalid DNS message is received over TCP we throw the
garbage DNS message away and continued looking for valid DNS message
that would match our outgoing queries.  This logic makes sense for UDP,
because anyone can send DNS message over UDP.

Change the logic that the TCP connection is closed when we receive
garbage, because the other side is acting malicious.
2021-12-01 11:45:55 -08:00
Ondřej Surý
9230473324 Shutdown all active TCP connections on error
When outgoing TCP connection was prematurely terminated (f.e. with
connection reset), the dispatch code would not cleanup the resources
used by such connection leading to dangling dns_dispentry_t entries.
2021-12-01 11:45:55 -08:00
Ondřej Surý
081e18edc8 Merge branch '1610-disable-UseSTD3ASCIIRules-in-idn2' into 'main'
Disable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions

Closes #1610

See merge request isc-projects/bind9!5605
2021-12-01 15:32:29 +00:00
Ondřej Surý
1d42178c46 Add CHANGES and release note for [GL #1610] 2021-12-01 16:10:04 +01:00
Ondřej Surý
ce1256c066 Add an idna test that _ and * characters are preserved
Add a idna that checks whether non-character letters like _ and * are
preserved when IDN is enabled.  This wasn't the case when
UseSTD3ASCIIRules were enabled, f.e. _ from _tcp would get mangled to
tcp.
2021-12-01 16:10:04 +01:00
Ondřej Surý
70d8395ca3 Remove idna test for UseSTD3ASCIIRules=true
We had to disable UseSTD3ASCIIRules=true because it broke non-letter
domain names like _tcp or *.  Disable the idna test too.
2021-12-01 16:10:04 +01:00
Ondřej Surý
69cfc07d00 Disable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions
Disable IDN2_USE_STD3_ASCII_RULES to the libidn2 conversion because it
broke encoding some non-letter but valid domain names like _tcp or *.

This reverts commit ef8aa91740592a78c9162f3f7109167f2c9297a5.
2021-12-01 16:10:04 +01:00
Artem Boldariev
71ee5f6148 Merge branch '2983-fix-doth-system-test' into 'main'
Resolve #2983: Increase startup timeout for servers in system tests

Closes #2983

See merge request isc-projects/bind9!5609
2021-12-01 14:06:16 +00:00
Artem Boldariev
3e7bcc2939 Increase startup timeout for servers in system tests
This change is made in particular to address the issue with 'doth'
system tests where servers are unable to iniitalise in time in CI
system under high load (that happened particularly often for Debian
Buster cross32 configuration).

The right solution, is, of course, to (re)use TLS context sparingly,
while right now we create too many of them.
2021-12-01 13:11:39 +02:00
Artem Boldariev
6436caa607 Merge branch 'artem-xot-tls-protocols-ciphers' into 'main'
XoT: add support client-side TLS parameters for incoming XFRs, add 'tls' name configuration validation on secondaries

See merge request isc-projects/bind9!5602
2021-12-01 11:05:51 +00:00
Artem Boldariev
f3e025643f Add CHANGES entry [GL !5602]
Mention that client-side 'tls' parameters are now supported for XoT.
2021-12-01 12:00:31 +02:00