]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
4 years agoCHANGES for [GL #3033] 3033-validator-loops
Evan Hunt [Wed, 1 Dec 2021 05:29:45 +0000 (21:29 -0800)] 
CHANGES for [GL #3033]

4 years agoTest validation deadlock recovery
Mark Andrews [Tue, 7 Dec 2021 03:26:10 +0000 (14:26 +1100)] 
Test validation deadlock recovery

Check that the following scenarios do not cause fetches to hang:
- An undelegated unsigned zone with CNAME to apex where the parent
  zone is signed
- An NSEC3 zone with only DNSKEY correctly signed

4 years agocheck for validator/fetch dependency loops
Evan Hunt [Tue, 30 Nov 2021 19:17:01 +0000 (11:17 -0800)] 
check for validator/fetch dependency loops

It was possible for a deadlock to occur when a fetch started
a validator which started another fetch for the same name.
To address this, we now store pointers from the valdiator object
to the originating fetch, and from the fetch object to the originating
validator (if any), so that potential loops can be detected.

4 years agoprevent a possible validator deadlock
Evan Hunt [Mon, 29 Nov 2021 21:38:56 +0000 (13:38 -0800)] 
prevent a possible validator deadlock

When processing a CNAME response, a validator could initiate a
query that matches the one waiting on the validator.

4 years agoMerge branch '3042-tcp-hang' into 'main'
Evan Hunt [Wed, 8 Dec 2021 18:48:34 +0000 (18:48 +0000)] 
Merge branch '3042-tcp-hang' into 'main'

prevent a shutdown hang on non-matching TCP responses

Closes #3042

See merge request isc-projects/bind9!5616

4 years agoCHANGES for [GL #3042]
Evan Hunt [Thu, 2 Dec 2021 20:13:56 +0000 (12:13 -0800)] 
CHANGES for [GL #3042]

4 years agoadd system test for a no-questions reply over TCP
Evan Hunt [Fri, 3 Dec 2021 19:29:56 +0000 (11:29 -0800)] 
add system test for a no-questions reply over TCP

4 years agoincidental cleanups
Evan Hunt [Thu, 2 Dec 2021 20:10:54 +0000 (12:10 -0800)] 
incidental cleanups

the 'dipsatchmgr->state' was never set, so the MGR_IS_SHUTTINGDOWN
macro was always false. both of these have been removed.

renamed the 'dispatch->state' field to 'tcpstate' to make its purpose
less ambiguous.

changed an FCTXTRACE log message from "response did not match question"
to the more correctly descriptive "invalid question section".

4 years agoprevent a shutdown hang on non-matching TCP responses
Evan Hunt [Thu, 2 Dec 2021 20:04:42 +0000 (12:04 -0800)] 
prevent a shutdown hang on non-matching TCP responses

When a non-matching DNS response is received by the resolver,
it calls dns_dispatch_getnext() to resume reading. This is necessary
for UDP but not for TCP, because TCP connections automatically
resume reading after any valid DNS response.

This commit adds a 'tcpreading' flag to TCP dispatches, so that
`dispatch_getnext()` can be called multiple times without subsequent
calls having any effect.

4 years agoMerge branch '3051-missing-destroy-for-pthread-primitives' into 'main'
Ondřej Surý [Wed, 8 Dec 2021 17:17:17 +0000 (17:17 +0000)] 
Merge branch '3051-missing-destroy-for-pthread-primitives' into 'main'

Stop leaking mutex in nmworker and cond in nm socket

Closes #3051

See merge request isc-projects/bind9!5622

4 years agoAdd CHANGES and release not for [GL #3051]
Ondřej Surý [Wed, 8 Dec 2021 10:24:47 +0000 (11:24 +0100)] 
Add CHANGES and release not for [GL #3051]

4 years agoStop leaking mutex in nmworker and cond in nm socket
Ondřej Surý [Mon, 6 Dec 2021 10:10:17 +0000 (11:10 +0100)] 
Stop leaking mutex in nmworker and cond in nm socket

On FreeBSD, the pthread primitives are not solely allocated on stack,
but part of the object lives on the heap.  Missing pthread_*_destroy
causes the heap memory to grow and in case of fast lived object it's
possible to run out-of-memory.

Properly destroy the leaking mutex (worker->lock) and
the leaking condition (sock->cond).

4 years agoMerge branch '3048-fix-isc_hp-initialization' into 'main'
Ondřej Surý [Wed, 8 Dec 2021 16:33:40 +0000 (16:33 +0000)] 
Merge branch '3048-fix-isc_hp-initialization' into 'main'

Fix the isc_hp initialization and memory usage

Closes #3048

See merge request isc-projects/bind9!5620

4 years agoReduce the number of hazard pointers
Ondřej Surý [Tue, 7 Dec 2021 19:35:58 +0000 (20:35 +0100)] 
Reduce the number of hazard pointers

Previously, we set the number of the hazard pointers to be 4 times the
number of workers because the dispatch ran on the old socket code.
Since the old socket code was removed there's a smaller number of
threads, namely:

 - 1 main thread
 - 1 timer thread
 - <n> netmgr threads
 - <n> threadpool threads

Set the number of hazard pointers to 2 + 2 * workers.

4 years agoFix the isc_hp initialization and memory usage
Ondřej Surý [Tue, 7 Dec 2021 10:15:27 +0000 (11:15 +0100)] 
Fix the isc_hp initialization and memory usage

Previously, the isc_hp_init() could not lower the value of
isc__hp_max_threads, but because of a mistake the isc__hp_max_threads
would be set to HP_MAX_THREADS (e.g. 128 threads) thus it would be
always set to 128.  This would result in increased memory usage even
when small number of workers were in use.

Change the default value of isc__hp_max_threads to be 1.

Additionally, enforce the max_hps value in isc_hp_new() to be smaller or
equal to HP_MAX_HPS.  The only user is isc_queue which uses just 1
hazard pointer, so it's only theoretical issue.

4 years agoMerge branch '1265-deprecate-broken-nsec' into 'main'
Petr Špaček [Mon, 6 Dec 2021 16:06:25 +0000 (16:06 +0000)] 
Merge branch '1265-deprecate-broken-nsec' into 'main'

Mark broken-nsec option as deprecated

See merge request isc-projects/bind9!5618

4 years agoMark broken-nsec option as deprecated
Petr Špaček [Mon, 6 Dec 2021 15:24:57 +0000 (16:24 +0100)] 
Mark broken-nsec option as deprecated

It's unclear if we are going to keep it or not, so let's mark it as
deprecated for a good measure. It's easier to un-deprecate it than the
other way around.

4 years agoMerge branch '3040-restore-the-fetch-context-expiry-timer' into 'main'
Michał Kępień [Fri, 3 Dec 2021 09:07:27 +0000 (09:07 +0000)] 
Merge branch '3040-restore-the-fetch-context-expiry-timer' into 'main'

Restore the fetch context expiry timer

Closes #3040

See merge request isc-projects/bind9!5612

4 years agoCHANGES for [GL #3040]
Evan Hunt [Fri, 3 Dec 2021 08:15:52 +0000 (00:15 -0800)] 
CHANGES for [GL #3040]

4 years agorestore the fetch lifetime timer
Evan Hunt [Thu, 2 Dec 2021 01:02:05 +0000 (17:02 -0800)] 
restore the fetch lifetime timer

the lifetime expiry timer for the fetch context was removed
when we switched to using in-band netmgr timeouts. however,
it turns out some dependency loops can occur between a fetch
and the ADB the validator; these deadlocks were formerly broken
when the timer fired, and now there's no timer. we can fix these
errors individually, but in the meantime we don't want the server
to get hung at shutdown because of dangling fetches.

this commit puts back a single timer, which fires two seconds
after the fetch should have completed, and shuts it down. it also
logs a message at level INFO so we know about the problems when
they occur.

4 years agoMerge branch '1265-bind-9-14-option-synth-from-dnssec-causing-high-cpu-consumption...
Petr Špaček [Thu, 2 Dec 2021 13:52:40 +0000 (13:52 +0000)] 
Merge branch '1265-bind-9-14-option-synth-from-dnssec-causing-high-cpu-consumption-and-degraded-client-experience' into 'main'

Rework rbtdb.c:find_coveringnsec to use shadow NSEC tree

Closes #1265

See merge request isc-projects/bind9!5446

4 years agoClarify that NSEC3 is not supported by synth-from-dnssec yet
Petr Špaček [Thu, 2 Dec 2021 08:59:04 +0000 (09:59 +0100)] 
Clarify that NSEC3 is not supported by synth-from-dnssec yet

4 years agoCheck reject-000-label
Mark Andrews [Wed, 1 Dec 2021 13:56:27 +0000 (00:56 +1100)] 
Check reject-000-label

4 years agoReject NSEC records with next field with \000 label
Mark Andrews [Wed, 1 Dec 2021 13:34:38 +0000 (00:34 +1100)] 
Reject NSEC records with next field with \000 label

A number of DNS implementation produce NSEC records with bad type
maps that don't contain types that exist at the name leading to
NODATA responses being synthesize instead of the records in the
zone.  NSEC records with these bad type maps often have the NSEC
NSEC field set to '\000.QNAME'.  We look for the first label of
this pattern.

e.g.
example.com NSEC \000.example.com SOA NS NSEC RRSIG
example.com RRRSIG NSEC ...
example.com SOA ...
example.com RRRSIG SOA ...
example.com NS ...
example.com RRRSIG NS ...
example.com A ...
example.com RRRSIG A ...

A is missing from the type map.

This introduces a temporary option 'reject-000-label' to control
this behaviour.

4 years agoCheck SOA without DNSKEY behaviour
Mark Andrews [Wed, 1 Dec 2021 06:03:13 +0000 (17:03 +1100)] 
Check SOA without DNSKEY behaviour

4 years agoCheck 'server { broken-nsec yes; };'
Mark Andrews [Wed, 1 Dec 2021 04:32:20 +0000 (15:32 +1100)] 
Check 'server { broken-nsec yes; };'

4 years agoAdd server christmas tree test
Mark Andrews [Wed, 1 Dec 2021 03:52:31 +0000 (14:52 +1100)] 
Add server christmas tree test

This sets as many server options as possible at once to detect
cut-and-paste bugs when implementing new server options in peer.c.
Most of the accessor functions are similar and it is easy to miss
updating a macro name or structure element name when adding new
accessor functions.

checkconf/setup.sh is there to minimise the difference to branches
with optional server options where the list is updated at runtime.

4 years agoAllow servers that emit broken NSEC records to be identified
Mark Andrews [Wed, 1 Dec 2021 03:10:47 +0000 (14:10 +1100)] 
Allow servers that emit broken NSEC records to be identified

'server <prefix> { broken-nsec yes; };' can now be used to stop
NSEC records from negative responses from servers in the given
prefix being cached and hence available to synth-from-dnssec.

4 years agoCheck that SOA and DNSKEY are consistent in NSEC typemaps
Mark Andrews [Tue, 30 Nov 2021 22:58:46 +0000 (09:58 +1100)] 
Check that SOA and DNSKEY are consistent in NSEC typemaps

If there is a SOA record present then there should also be a
DNSKEY record present as the DNSKEY is supposed to live at the
zone apex like the SOA.

4 years agoAdd data lookups into nodata tests
Mark Andrews [Mon, 29 Nov 2021 02:26:29 +0000 (13:26 +1100)] 
Add data lookups into nodata tests

4 years agoCheck synthesis of wildcard NODATA with 2 NSEC
Mark Andrews [Sat, 27 Nov 2021 22:46:01 +0000 (09:46 +1100)] 
Check synthesis of wildcard NODATA with 2 NSEC

4 years agoLook for covering NSEC under two more conditions
Mark Andrews [Sat, 27 Nov 2021 22:46:01 +0000 (09:46 +1100)] 
Look for covering NSEC under two more conditions

1) when after processing a node there where no headers that
   contained active records.

   When

       if (check_stale_header(node, header, &locktype, lock, &search,
      &header_prev);

   succeeds or

       if (EXISTS(header) && !ANCIENT(header))

   fails for all entries in the list leading to 'empty_node' remaining
   true.

   If there is are no active records we know nothing about the
   current state of the name so we treat is as ISC_R_NOTFOUND.

2) when there was a covering NOQNAME proof found or all the
   active headers where negative.

   When

if (header->noqname != NULL &&
    header->trust == dns_trust_secure)

   succeeds or

if (!NEGATIVE(header))

   never succeeds.  Under these conditions there could (should be for
   found_noqname) be a covering NSEC earlier in the tree.

4 years agoCheck synthesis of wildcard NODATA with 1 NSEC
Mark Andrews [Fri, 26 Nov 2021 23:41:38 +0000 (10:41 +1100)] 
Check synthesis of wildcard NODATA with 1 NSEC

4 years agoAdd synthesis of NODATA at wildcard
Mark Andrews [Fri, 26 Nov 2021 23:41:38 +0000 (10:41 +1100)] 
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.

4 years agoAdd CHANGES and release note for [GL #1265]
Mark Andrews [Fri, 22 Oct 2021 04:23:43 +0000 (15:23 +1100)] 
Add CHANGES and release note for [GL #1265]

4 years agoIgnore NSEC records without RRSIG and NSEC present
Mark Andrews [Fri, 5 Nov 2021 22:30:48 +0000 (09:30 +1100)] 
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.

4 years agoAdd dns_nsec_requiredtypespresent
Mark Andrews [Fri, 26 Nov 2021 22:12:08 +0000 (09:12 +1100)] 
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

4 years agoCheck 'rndc stats' output for 'cache NSEC auxiliary database nodes'
Mark Andrews [Thu, 28 Oct 2021 02:28:11 +0000 (13:28 +1100)] 
Check 'rndc stats' output for 'cache NSEC auxiliary database nodes'

4 years agoCheck synth-from-dnssec JSON counters
Mark Andrews [Thu, 28 Oct 2021 23:41:37 +0000 (10:41 +1100)] 
Check synth-from-dnssec JSON counters

4 years agoCheck synth-from-dnssec XML counters
Mark Andrews [Thu, 28 Oct 2021 22:41:31 +0000 (09:41 +1100)] 
Check synth-from-dnssec XML counters

4 years agoCheck reported synthesized responses in named.stats
Mark Andrews [Thu, 28 Oct 2021 02:18:27 +0000 (13:18 +1100)] 
Check reported synthesized responses in named.stats

4 years agoCorrect spelling of synthesized
Mark Andrews [Thu, 28 Oct 2021 02:05:33 +0000 (13:05 +1100)] 
Correct spelling of synthesized

4 years agoCheck 'rndc stats' output for 'covering nsec returned'
Mark Andrews [Thu, 28 Oct 2021 00:08:18 +0000 (11:08 +1100)] 
Check 'rndc stats' output for 'covering nsec returned'

4 years agoRecord how often DNS_R_COVERINGNSEC is returned from the cache
Mark Andrews [Wed, 27 Oct 2021 02:25:41 +0000 (13:25 +1100)] 
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.

4 years agoRestore 'synth-from-dnssec yes;' as the default
Mark Andrews [Thu, 21 Oct 2021 05:30:35 +0000 (16:30 +1100)] 
Restore 'synth-from-dnssec yes;' as the default

4 years agoReport Cache NSEC auxilary database size
Mark Andrews [Wed, 20 Oct 2021 01:44:59 +0000 (12:44 +1100)] 
Report Cache NSEC auxilary database size

4 years agoExtend dns_db_nodecount to access auxilary rbt node counts
Mark Andrews [Wed, 20 Oct 2021 01:01:00 +0000 (12:01 +1100)] 
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.

4 years agoCheck Cloudflare "black lies" response
Mark Andrews [Tue, 19 Oct 2021 06:59:45 +0000 (17:59 +1100)] 
Check Cloudflare "black lies" response

"black lies" with a different QTYPE should synthesis NODATA responses.

4 years agoAllow "black lies" to be cached
Mark Andrews [Tue, 19 Oct 2021 22:22:50 +0000 (09:22 +1100)] 
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).

4 years agoCheck that minimal NSEC records are not cached
Mark Andrews [Tue, 19 Oct 2021 03:42:48 +0000 (14:42 +1100)] 
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.

4 years agoDo not cache minimal NSEC records (NSEC + RRSIG only)
Mark Andrews [Tue, 19 Oct 2021 03:40:27 +0000 (14:40 +1100)] 
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

4 years agoExtend synthfromdnssec to test with dnssec validation disabled
Mark Andrews [Mon, 18 Oct 2021 04:38:41 +0000 (15:38 +1100)] 
Extend synthfromdnssec to test with dnssec validation disabled

4 years agoExtend synthfromdnssec to check insecure responses
Mark Andrews [Mon, 18 Oct 2021 04:12:34 +0000 (15:12 +1100)] 
Extend synthfromdnssec to check insecure responses

add matching tests against a insecure zone to those which
which are synthesised.

4 years agoRemove unnecessary dns_rbt_fullnamefromnode call
Mark Andrews [Mon, 18 Oct 2021 03:05:37 +0000 (14:05 +1100)] 
Remove unnecessary dns_rbt_fullnamefromnode call

the results from dns_rbt_fullnamefromnode are not used.

4 years agoExtend checking of synthesised respones
Mark Andrews [Fri, 15 Oct 2021 06:42:45 +0000 (17:42 +1100)] 
Extend checking of synthesised respones

add digcomp checks to cover wildcard and cname wildcard case
(nxdomain and nodata already covered)

4 years agoCount DNS_R_COVERINGNSEC as a cache {query}hit
Mark Andrews [Fri, 15 Oct 2021 03:47:07 +0000 (14:47 +1100)] 
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.

4 years agoAdd additional checks that upstream queries are not made
Mark Andrews [Fri, 15 Oct 2021 02:04:57 +0000 (13:04 +1100)] 
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.

4 years agoCheck synthesis of CNAME record from wildcard CNAME
Mark Andrews [Tue, 2 Nov 2021 04:26:45 +0000 (15:26 +1100)] 
Check synthesis of CNAME record from wildcard CNAME

4 years agoCheck synthesis of A record from wildcard A
Mark Andrews [Tue, 2 Nov 2021 04:16:17 +0000 (15:16 +1100)] 
Check synthesis of A record from wildcard A

4 years agoCheck whether soa responses are synthesised or not
Mark Andrews [Tue, 2 Nov 2021 03:55:55 +0000 (14:55 +1100)] 
Check whether soa responses are synthesised or not

4 years agoAdd and use check_status
Mark Andrews [Tue, 2 Nov 2021 03:09:32 +0000 (14:09 +1100)] 
Add and use check_status

4 years agoAdd and use check_ad_flag
Mark Andrews [Tue, 2 Nov 2021 02:58:26 +0000 (13:58 +1100)] 
Add and use check_ad_flag

4 years agoRework rbtdb.c:find_coveringnsec() to use the auxilary nsec rbt
Mark Andrews [Wed, 29 Sep 2021 03:55:46 +0000 (13:55 +1000)] 
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.

4 years agoMerge branch '2700-improve-failed-tcp-accept-logging' into 'main'
Ondřej Surý [Thu, 2 Dec 2021 13:18:10 +0000 (13:18 +0000)] 
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

4 years agoAdd CHANGES and release note for [GL #2700]
Ondřej Surý [Wed, 1 Dec 2021 16:52:33 +0000 (17:52 +0100)] 
Add CHANGES and release note for [GL #2700]

4 years agoImprove the logging on failed TCP accept
Ondřej Surý [Wed, 1 Dec 2021 16:41:20 +0000 (17:41 +0100)] 
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.

4 years agoMerge branch '3026-premature-tcp-connection-closure-leaks-fetch-contexts-hang-on...
Evan Hunt [Wed, 1 Dec 2021 20:10:44 +0000 (20:10 +0000)] 
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

4 years agoAdd CHANGES and release notes for [GL #3026]
Ondřej Surý [Fri, 26 Nov 2021 10:13:47 +0000 (11:13 +0100)] 
Add CHANGES and release notes for [GL #3026]

4 years agoAdd TCP connection reset test
Ondřej Surý [Wed, 1 Dec 2021 11:22:59 +0000 (12:22 +0100)] 
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.

4 years agoOn non-matching answer, check for missed timeout
Evan Hunt [Tue, 30 Nov 2021 08:57:27 +0000 (09:57 +0100)] 
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.

4 years agoTear down the TCP connection on too many unexpected DNS messages
Ondřej Surý [Mon, 29 Nov 2021 08:59:33 +0000 (09:59 +0100)] 
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.

4 years agoRefactor tcp_recv()
Ondřej Surý [Fri, 26 Nov 2021 08:14:58 +0000 (09:14 +0100)] 
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.

4 years agoShutdown all TCP connection on invalid DNS message
Ondřej Surý [Fri, 26 Nov 2021 08:14:58 +0000 (09:14 +0100)] 
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.

4 years agoShutdown all active TCP connections on error
Ondřej Surý [Fri, 26 Nov 2021 08:14:58 +0000 (09:14 +0100)] 
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.

4 years agoMerge branch '1610-disable-UseSTD3ASCIIRules-in-idn2' into 'main'
Ondřej Surý [Wed, 1 Dec 2021 15:32:29 +0000 (15:32 +0000)] 
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

4 years agoAdd CHANGES and release note for [GL #1610]
Ondřej Surý [Tue, 30 Nov 2021 14:25:22 +0000 (15:25 +0100)] 
Add CHANGES and release note for [GL #1610]

4 years agoAdd an idna test that _ and * characters are preserved
Ondřej Surý [Wed, 1 Dec 2021 09:20:31 +0000 (10:20 +0100)] 
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.

4 years agoRemove idna test for UseSTD3ASCIIRules=true
Ondřej Surý [Tue, 30 Nov 2021 14:20:07 +0000 (15:20 +0100)] 
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.

4 years agoDisable IDN2_USE_STD3_ASCII_RULES to idn2 conversion functions
Ondřej Surý [Tue, 30 Nov 2021 14:18:40 +0000 (15:18 +0100)] 
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.

4 years agoMerge branch '2983-fix-doth-system-test' into 'main'
Artem Boldariev [Wed, 1 Dec 2021 14:06:16 +0000 (14:06 +0000)] 
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

4 years agoIncrease startup timeout for servers in system tests
Artem Boldariev [Wed, 1 Dec 2021 10:50:21 +0000 (12:50 +0200)] 
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.

4 years agoMerge branch 'artem-xot-tls-protocols-ciphers' into 'main'
Artem Boldariev [Wed, 1 Dec 2021 11:05:51 +0000 (11:05 +0000)] 
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

4 years agoAdd CHANGES entry [GL !5602]
Artem Boldariev [Tue, 30 Nov 2021 00:20:48 +0000 (02:20 +0200)] 
Add CHANGES entry [GL !5602]

Mention that client-side 'tls' parameters are now supported for XoT.

4 years agoTLS context handling code: Fix an abort on ancient OpenSSL version
Artem Boldariev [Tue, 30 Nov 2021 08:42:23 +0000 (10:42 +0200)] 
TLS context handling code: Fix an abort on ancient OpenSSL version

There was a logical bug when setting a list of enabled TLS protocols,
which may lead to a crash (an abort()) on systems with ancient OpenSSL
versions.

The problem was due to the fact that we were INSIST()ing on supporting
all of the TLS versions, while checking only for mentioned in the
configuration was implied.

4 years agoExtend the 'doth' system test with another XoT-enabled secondary
Artem Boldariev [Tue, 30 Nov 2021 00:05:29 +0000 (02:05 +0200)] 
Extend the 'doth' system test with another XoT-enabled secondary

This commit extends the 'doth' system test to include an additional
XoT-enabled secondary which uses the supported client-side 'tls'
parameters.

4 years agoAdd 'tls' validation for XoT enabled primaries
Artem Boldariev [Mon, 29 Nov 2021 22:31:36 +0000 (00:31 +0200)] 
Add 'tls' validation for XoT enabled primaries

This commit ensure that the 'tls' name specified in the 'primaries'
clause of a 'zone' statement is a valid one.

Prior to that such a name would be silently accepted, leading to
silent XFRs-via-TLS failures.

4 years agoXoT: add support for client-side TLS parameters
Artem Boldariev [Mon, 29 Nov 2021 21:09:51 +0000 (23:09 +0200)] 
XoT: add support for client-side TLS parameters

This commit adds support for client-side TLS parameters to XoT.

Prior to this commit all client-side TLS contexts were using default
parameters only, ignoring the options from the BIND's configuration
file.

Currently, the following 'tls' parameters are supported:

- protocols;
- ciphers;
- prefer-server-ciphers.

4 years agoMerge branch '2850-the-list-of-fetches-at-the-end-of-rndc-recursing-output-is-very...
Mark Andrews [Tue, 30 Nov 2021 11:30:47 +0000 (11:30 +0000)] 
Merge branch '2850-the-list-of-fetches-at-the-end-of-rndc-recursing-output-is-very-poorly-explained-in-the-arm' into 'main'

Resolve "The list of fetches at the end of 'rndc recursing' output is very poorly explained in the ARM - what does 'allowed' mean?"

Closes #2850

See merge request isc-projects/bind9!5388

4 years agoUpdate the description of fetches-per-zone counters
Mark Andrews [Wed, 8 Sep 2021 03:51:07 +0000 (13:51 +1000)] 
Update the description of fetches-per-zone counters

4 years agoMerge branch '853-dnssec-dsfromkey-doesn-t-omit-revoked-ksk' into 'main'
Mark Andrews [Tue, 30 Nov 2021 11:08:28 +0000 (11:08 +0000)] 
Merge branch '853-dnssec-dsfromkey-doesn-t-omit-revoked-ksk' into 'main'

Resolve "dnssec-dsfromkey doesn't omit revoked KSK"

Closes #853

See merge request isc-projects/bind9!5460

4 years agoAdd CHANGES for [GL #853]
Mark Andrews [Mon, 22 Nov 2021 06:29:08 +0000 (17:29 +1100)] 
Add CHANGES for [GL  #853]

4 years agoCheck dnssec-dsfromkey with revoked DNSKEY
Mark Andrews [Wed, 17 Nov 2021 02:06:44 +0000 (13:06 +1100)] 
Check dnssec-dsfromkey with revoked DNSKEY

Checks that there is a revoked key in the DNSKEY RRset then checks
that only the correct number of DS records are produced.

4 years agodnssec-dsfromkey should not convert revoked keys
Tony Finch [Mon, 4 Oct 2021 23:01:54 +0000 (10:01 +1100)] 
dnssec-dsfromkey should not convert revoked keys

it is pointless to convert revoked keys to DS or CDS records as
they cannot be used to provide a cryptographic link from the parent
zone.

4 years agoMerge branch '2776-allow-transfer-encrypted' into 'main'
Artem Boldariev [Tue, 30 Nov 2021 10:44:11 +0000 (10:44 +0000)] 
Merge branch '2776-allow-transfer-encrypted' into 'main'

Resolve #2776: Extend 'allow-transfer' with 'port' and 'transport' parameters

Closes #2776

See merge request isc-projects/bind9!5587

4 years agoAdd transport-acl system test
Artem Boldariev [Mon, 29 Nov 2021 10:50:35 +0000 (12:50 +0200)] 
Add transport-acl system test

This commit adds a new system-test: transport-acl system test. It is
intended to test the new, extended syntax for ACLs, the one where port
or transport protocol can be specified. Currently, it includes the
tests only using allow-transfer statement, as this extended syntax is
used only there, at least for now.

4 years agoModify CHANGES [GL #2776]
Artem Boldariev [Tue, 23 Nov 2021 15:11:44 +0000 (17:11 +0200)] 
Modify CHANGES [GL #2776]

Mention in the CHANGES file that the allow-transfer options has been
extended with 'port' and 'transport' options.

4 years agoMention that the allow-transfer option has been extended
Artem Boldariev [Tue, 23 Nov 2021 13:04:51 +0000 (15:04 +0200)] 
Mention that the allow-transfer option has been extended

This commit updates both the reference manual and release notes with
the information that 'allow-transfer' has been extended with
additional "port" and "transport" options.

4 years agoExtend the 'doth' system test to test extended allow-transfer option
Artem Boldariev [Mon, 22 Nov 2021 13:31:15 +0000 (15:31 +0200)] 
Extend the 'doth' system test to test extended allow-transfer option

This commit extends the 'doth' system test to verify that the new
extended 'allow-transfer' option syntax featuring 'port' and
'transport' parameters is supported and works as expected. That is, it
restricts the primary server to allow zone transfers only via XoT.

Additionally to that, it extends the 'checkonf' test with more
configuration file examples featuring the new syntax.

4 years agoIntegrate extended ACLs syntax featuring 'port' and 'transport' opts
Artem Boldariev [Fri, 12 Nov 2021 14:53:13 +0000 (16:53 +0200)] 
Integrate extended ACLs syntax featuring 'port' and 'transport' opts

This commit completes the integration of the new, extended ACL syntax
featuring 'port' and 'transport' options.

The runtime presentation and ACL loading code are extended to allow
the syntax to be used beyond the 'allow-transfer' option (e.g. in
'acl' definitions and other 'allow-*' options) and can be used to
ultimately extend the ACL support with transport-only
ACLs (e.g. 'transport-acl tls-acl port 853 transport tls'). But, due
to fundamental nature of such a change, it has not been completed as a
part of 9.17.X release series due to it being close to 9.18 stable
release status. That means that we do not have enough time to fully
test it.

The complete integration is planned as a part of 9.19.X release
series.

The code was manually verified to work as expected by temporarily
enabling the extended syntax for 'acl' statements and 'allow-query'
options, including ACL merging, negated ACLs.

4 years agoExtend ACL syntax handling code with 'port' and 'transport' options
Artem Boldariev [Thu, 4 Nov 2021 14:52:49 +0000 (16:52 +0200)] 
Extend ACL syntax handling code with 'port' and 'transport' options

This commit extends ACL syntax handling code with 'port' and
'transport' options. Currently, the extended syntax is available only
for allow-transfer options.