]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
5 years agoMerge branch 'michal/tweak-cve-handling-checklists' into 'main'
Michał Kępień [Mon, 17 May 2021 12:09:44 +0000 (12:09 +0000)] 
Merge branch 'michal/tweak-cve-handling-checklists' into 'main'

Tweak security incident handling checklists

See merge request isc-projects/bind9!5017

5 years agoTweak security incident handling checklists
Michał Kępień [Mon, 17 May 2021 12:07:27 +0000 (14:07 +0200)] 
Tweak security incident handling checklists

Add an item to the CVE issue template which calls for drafting the
security advisory early in the security incident handling process.  The
intention is to ensure there is enough time to review and polish ISC
security advisories before they get published.

Tweak the release checklist to make sure we carefully consider all
confidential issues before opening them up to the public.  This change
is intended as a safeguard against accidentally disclosing too much
information about a security vulnerability before our users get a chance
to patch it.

5 years agoMerge branch 'ondrej/remove-netmgr-quantum' into 'main'
Ondřej Surý [Mon, 17 May 2021 10:05:11 +0000 (10:05 +0000)] 
Merge branch 'ondrej/remove-netmgr-quantum' into 'main'

Replace netmgr quantum with loop-preventing barrier

See merge request isc-projects/bind9!5028

5 years agoReplace netmgr quantum with loop-preventing barrier
Ondřej Surý [Fri, 7 May 2021 10:58:40 +0000 (12:58 +0200)] 
Replace netmgr quantum with loop-preventing barrier

Instead of using fixed quantum, this commit adds atomic counter for
number of items on each queue and uses the number of netievents
scheduled to run as the limit of maximum number of netievents for a
single process_queue() run.

This prevents the endless loops when the netievent would schedule more
netievents onto the same loop, but we don't have to pick "magic" number
for the quantum.

5 years agoMerge branch '2693-add-py-test-to-the-list-of-tested-pytest-names' into 'main'
Michal Nowak [Mon, 17 May 2021 09:23:25 +0000 (09:23 +0000)] 
Merge branch '2693-add-py-test-to-the-list-of-tested-pytest-names' into 'main'

Add py.test to the list of tested pytest names

Closes #2693

See merge request isc-projects/bind9!5022

5 years agoAdd py.test to the list of tested pytest names
Michal Nowak [Thu, 13 May 2021 15:24:57 +0000 (17:24 +0200)] 
Add py.test to the list of tested pytest names

OpenBSD changed the name of the pytest script from py.test-3 in OpenBSD
6.8 to py.test in OpenBSD 6.9.

The py.test-3 name which was added in d5562a3e for the sake of OpenBSD
and CentOS is still required for CentOS.

5 years agoMerge branch '2313-set-RCVBUF-SNDBUF' into 'main'
Ondřej Surý [Mon, 17 May 2021 07:42:37 +0000 (07:42 +0000)] 
Merge branch '2313-set-RCVBUF-SNDBUF' into 'main'

Resolve "Set reasonable values to SO_RCVBUF and SO_SNDBUF"

Closes #2313

See merge request isc-projects/bind9!4460

5 years agoAdd CHANGES and release note for GL #2313
Ondřej Surý [Mon, 15 Mar 2021 14:55:44 +0000 (15:55 +0100)] 
Add CHANGES and release note for GL #2313

5 years agoAdd configuration option to set send/recv buffers on the nm sockets
Ondřej Surý [Wed, 2 Dec 2020 19:51:38 +0000 (20:51 +0100)] 
Add configuration option to set send/recv buffers on the nm sockets

This commit adds a new configuration option to set the receive and send
buffer sizes on the TCP and UDP netmgr sockets.  The default is `0`
which doesn't set any value and just uses the value set by the operating
system.

There's no magic value here - set it too small and the performance will
drop, set it too large, the buffers can fill-up with queries that have
already timeouted on the client side and nobody is interested for the
answer and this would just make the server clog up even more by making
it produce useless work.

The `netstat -su` can be used on POSIX systems to monitor the receive
and send buffer errors.

5 years agoMerge branch '2386-check-correct-copyright-dates-in-man-pages' into 'main'
Michal Nowak [Fri, 14 May 2021 12:46:33 +0000 (12:46 +0000)] 
Merge branch '2386-check-correct-copyright-dates-in-man-pages' into 'main'

Set copyright year to the current year

Closes #2386

See merge request isc-projects/bind9!4869

5 years agoSet copyright year to the current year
Michal Nowak [Wed, 7 Apr 2021 14:42:28 +0000 (16:42 +0200)] 
Set copyright year to the current year

To ensure that a release with outdated copyright year is not produced at
the beginning of a year, set copyright year to the current year.

5 years agoMerge branch 'mnowak/add-unit-gcc-out-of-tree-ci-job' into 'main'
Michal Nowak [Fri, 14 May 2021 12:21:06 +0000 (12:21 +0000)] 
Merge branch 'mnowak/add-unit-gcc-out-of-tree-ci-job' into 'main'

Add unit:gcc:out-of-tree CI job

See merge request isc-projects/bind9!4740

5 years agoAdd unit:gcc:out-of-tree CI job
Michal Nowak [Wed, 24 Feb 2021 11:15:59 +0000 (12:15 +0100)] 
Add unit:gcc:out-of-tree CI job

Also extract the workspace save-and-retrieve logic to YAML anchors.

5 years agoMake masterXX.data.in reachable by out-of-tree builds
Michal Nowak [Fri, 11 Sep 2020 07:07:04 +0000 (09:07 +0200)] 
Make masterXX.data.in reachable by out-of-tree builds

Unit test run for out-of-tree builds used to fail to find
masterXX.data.in files:

    /usr/bin/perl -w /builds/mnowak/bind9/lib/dns/tests/mkraw.pl < testdata/master/master12.data.in > testdata/master/master12.data
    /bin/bash: testdata/master/master12.data.in: No such file or directory
    make[4]: *** [Makefile:1910: testdata/master/master12.data] Error 1

5 years agoMerge branch 'ondrej/fix-outgoing-udp-socket-selection-on-windows' into 'main'
Ondřej Surý [Thu, 13 May 2021 14:05:22 +0000 (14:05 +0000)] 
Merge branch 'ondrej/fix-outgoing-udp-socket-selection-on-windows' into 'main'

Fix the outgoing UDP socket selection on Windows

See merge request isc-projects/bind9!5021

5 years agoFix the outgoing UDP socket selection on Windows
Ondřej Surý [Thu, 13 May 2021 13:04:48 +0000 (15:04 +0200)] 
Fix the outgoing UDP socket selection on Windows

The outgoing UDP socket selection would pick unintialized children
socket on Windows, because we have more netmgr workers than we have
listening sockets.  This commit fixes the selection by keeping the
outgoing socket the same, so it's always run on existing socket.

5 years agoMerge branch 'artem-flamethrower-fixes' into 'main'
Artem Boldariev [Thu, 13 May 2021 10:01:26 +0000 (10:01 +0000)] 
Merge branch 'artem-flamethrower-fixes' into 'main'

DoH flamethrower fixes

See merge request isc-projects/bind9!5019

5 years agoFix DoH unit tests logic
Artem Boldariev [Wed, 12 May 2021 16:28:29 +0000 (19:28 +0300)] 
Fix DoH unit tests logic

This commit fixes logic bugs in DoH test suite revealed by making DoH
not to call nghttp2_session_terminate_session() in server-side code.

5 years agoFix crash in TLS caused by improper handling of shutdown messages
Artem Boldariev [Wed, 12 May 2021 11:39:24 +0000 (14:39 +0300)] 
Fix crash in TLS caused by improper handling of shutdown messages

The problem was found when flamethrower was accidentally run in DoT
mode against DoH port.

5 years agoLimit the number of active concurrent HTTP/2 streams
Artem Boldariev [Wed, 12 May 2021 09:12:21 +0000 (12:12 +0300)] 
Limit the number of active concurrent HTTP/2 streams

The initial intent was to limit the number of concurrent streams by
the value of 100 but due to the error when reading the documentation
it was set to the maximum possible number of streams per session.

This could lead to security issues, e.g. a remote attacker could have
taken down the BIND instance by creating lots of sessions via low
number of transport connections. This commit fixes that.

5 years agoDo not allow empty DoH endpoints to be added
Artem Boldariev [Wed, 12 May 2021 08:53:35 +0000 (11:53 +0300)] 
Do not allow empty DoH endpoints to be added

It was possible to specify empty DoH endpoint in BIND's configuration
file: that was an error, we should not allow doing so.

5 years agoDo not call nghttp2_session_terminate_session() in server-side code
Artem Boldariev [Wed, 12 May 2021 08:48:13 +0000 (11:48 +0300)] 
Do not call nghttp2_session_terminate_session() in server-side code

We should not call nghttp2_session_terminate_session() in server-side
code after all of the active HTTP/2 streams are processed. The
underlying transport connection is expected to remain opened at least
for some time in this case for new HTTP/2 requests to arrive. That is
what flamethrower was expecting and it makes perfect sense from the
HTTP/2 perspective.

5 years agoMerge branch '2528-check-soa-rdata' into 'main'
Mark Andrews [Thu, 13 May 2021 05:17:39 +0000 (05:17 +0000)] 
Merge branch '2528-check-soa-rdata' into 'main'

Check SOA rdata for consistency in AXFR.

Closes #2528

See merge request isc-projects/bind9!5014

5 years agosystem test
Evan Hunt [Sat, 8 May 2021 17:53:09 +0000 (10:53 -0700)] 
system test

Attempt a zone transfer with mismatched SOA records.

5 years agoAdd CHANGES entry for [GL #2528]
Mark Andrews [Mon, 15 Mar 2021 04:47:39 +0000 (15:47 +1100)] 
Add CHANGES entry for [GL #2528]

5 years agoCheck that the first and last SOA of an AXFR are consistent
Mark Andrews [Mon, 15 Mar 2021 04:43:26 +0000 (15:43 +1100)] 
Check that the first and last SOA of an AXFR are consistent

5 years agoMerge branch '2656-resolver-system-test-fails-on-macos' into 'main'
Mark Andrews [Wed, 12 May 2021 03:40:52 +0000 (03:40 +0000)] 
Merge branch '2656-resolver-system-test-fails-on-macos' into 'main'

Resolve "resolver system test fails on macOS"

Closes #2656

See merge request isc-projects/bind9!4947

5 years agoAdd missing call to isc_app_ctxstart
Mark Andrews [Thu, 6 May 2021 00:23:54 +0000 (10:23 +1000)] 
Add missing call to isc_app_ctxstart

5 years agoMerge branch 'marka/add-missing-isc_condition_init' into 'main'
Ondřej Surý [Tue, 11 May 2021 13:03:13 +0000 (13:03 +0000)] 
Merge branch 'marka/add-missing-isc_condition_init' into 'main'

initalise sock->cond

See merge request isc-projects/bind9!5013

5 years agoinitalise sock->cond
Mark Andrews [Tue, 11 May 2021 04:01:37 +0000 (14:01 +1000)] 
initalise sock->cond

5 years agoMerge branch 'ondrej/increase-netmgr-quantum' into 'main'
Ondřej Surý [Mon, 10 May 2021 20:04:10 +0000 (20:04 +0000)] 
Merge branch 'ondrej/increase-netmgr-quantum' into 'main'

Bump the netmgr quantum to 1024

See merge request isc-projects/bind9!5009

5 years agoBump the netmgr quantum to 1024
Ondřej Surý [Mon, 10 May 2021 13:13:46 +0000 (15:13 +0200)] 
Bump the netmgr quantum to 1024

During the stress testing, it was discovered that the default netmgr
quantum of 128 is not enough and there was a performance drop for TCP on
FreeBSD.  Bumping the default quantum to 1024 solves the performance
issue and is still enough to prevent the endless loops.

5 years agoMerge branch 'each-taskmgr-setmode' into 'main'
Evan Hunt [Mon, 10 May 2021 19:32:00 +0000 (19:32 +0000)] 
Merge branch 'each-taskmgr-setmode' into 'main'

reset taskmgr immediately after loading zones

See merge request isc-projects/bind9!5010

5 years agoreset taskmgr mode immediately after returning from zone load
Evan Hunt [Sat, 8 May 2021 19:01:45 +0000 (12:01 -0700)] 
reset taskmgr mode immediately after returning from zone load

all privileged tasks are complete by the time we return from
isc_task_endexclusive(), so it makes sense to reset the taskmgr
mode to non-privileged right then.

5 years agoMerge branch 'ondrej/dereference-taskmgr-after-all-tasks-are-done' into 'main'
Ondřej Surý [Mon, 10 May 2021 19:24:53 +0000 (19:24 +0000)] 
Merge branch 'ondrej/dereference-taskmgr-after-all-tasks-are-done' into 'main'

Destroy reference to taskmgr after all tasks are done

See merge request isc-projects/bind9!5008

5 years agoDestroy reference to taskmgr after all tasks are done
Ondřej Surý [Mon, 10 May 2021 12:11:25 +0000 (14:11 +0200)] 
Destroy reference to taskmgr after all tasks are done

We were clearing the pointer to taskmgr as soon as isc_taskmgr_destroy()
would be called and before all tasks were finished.  Unfortunately, some
tasks would use global named_g_taskmgr objects from inside the events
and this would cause either a data race or NULL pointer dereference.

This commit fixes the data race by moving the destruction of the
referenced pointer to the time after all tasks are finished.

5 years agoMerge branch 'ondrej/fix-missing-isc_taskmgr_detach-on-exiting' into 'main'
Ondřej Surý [Mon, 10 May 2021 11:33:46 +0000 (11:33 +0000)] 
Merge branch 'ondrej/fix-missing-isc_taskmgr_detach-on-exiting' into 'main'

Add isc_taskmgr_detach when task is created while shutting down

See merge request isc-projects/bind9!5006

5 years agoAdd isc_taskmgr_detach when task is created while shutting down
Ondřej Surý [Mon, 10 May 2021 09:36:54 +0000 (11:36 +0200)] 
Add isc_taskmgr_detach when task is created while shutting down

When taskmgr is shutting down, the creating the task would attach
to the taskmgr, but don't detach on error condition.

5 years agoMerge branch '2654-create-isc_managers-api' into 'main'
Evan Hunt [Fri, 7 May 2021 21:37:01 +0000 (21:37 +0000)] 
Merge branch '2654-create-isc_managers-api' into 'main'

Destroy netmgr before destroying taskmgr

Closes #2654

See merge request isc-projects/bind9!4983

5 years agoCHANGES
Evan Hunt [Fri, 7 May 2021 18:32:21 +0000 (11:32 -0700)] 
CHANGES

5 years agoimprovements to socket_test
Ondřej Surý [Fri, 7 May 2021 13:34:22 +0000 (15:34 +0200)] 
improvements to socket_test

- be more strict, but patient, waiting for event completion.
- use an atomic pointer for the socket to silence TSAN warnings.

5 years agoensure interlocked netmgr events run on worker[0]
Ondřej Surý [Thu, 6 May 2021 14:11:43 +0000 (16:11 +0200)] 
ensure interlocked netmgr events run on worker[0]

Network manager events that require interlock (pause, resume, listen)
are now always executed in the same worker thread, mgr->workers[0],
to prevent races.

"stoplistening" events no longer require interlock.

5 years agofix shutdown deadlocks
Evan Hunt [Wed, 5 May 2021 21:54:53 +0000 (14:54 -0700)] 
fix shutdown deadlocks

- ensure isc_nm_pause() and isc_nm_resume() work the same whether
  run from inside or outside of the netmgr.
- promote 'stop' events to the priority event level so they can
  run while the netmgr is pausing or paused.
- when pausing, drain the priority queue before acquiring an
  interlock; this prevents a deadlock when another thread is waiting
  for us to complete a task.
- release interlock after pausing, reacquire it when resuming, so
  that stop events can happen.

some incidental changes:
- use a function to enqueue pause and resume events (this was part of a
  different change attempt that didn't work out; I kept it because I
  thought was more readable).
- make mgr->nworkers a signed int to remove some annoying integer casts.

5 years agoUse barriers for netmgr synchronization
Ondřej Surý [Wed, 5 May 2021 09:51:39 +0000 (11:51 +0200)] 
Use barriers for netmgr synchronization

The netmgr listening, stoplistening, pausing and resuming functions
now use barriers for synchronization, which makes the code much simpler.

isc/barrier.h defines isc_barrier macros as a front-end for uv_barrier
on platforms where that works, and pthread_barrier where it doesn't
(including TSAN builds).

5 years agoRun isc__nm_http_stoplistening() synchronously in netmgr
Ondřej Surý [Thu, 6 May 2021 07:03:33 +0000 (09:03 +0200)] 
Run isc__nm_http_stoplistening() synchronously in netmgr

When isc__nm_http_stoplistening() is run from inside the netmgr, we need
to make sure it's run synchronously.  This commit is just a band-aid
though, as the desired behvaior for isc_nm_stoplistening() is not always
the same:

  1. When run from outside user of the interface, the call must be
     synchronous, e.g. the calling code expects the call to really stop
     listening on the interfaces.

  2. But if there's a call from listen<proto> when listening fails,
     that needs to be scheduled to run asynchronously, because
     isc_nm_listen<proto> is being run in a paused (interlocked)
     netmgr thread and we could get stuck.

The proper solution would be to make isc_nm_stoplistening()
behave like uv_close(), i.e., to have a proper callback.

5 years agoonly run tasks as privileged if taskmgr is in privileged mode
Evan Hunt [Fri, 7 May 2021 02:41:49 +0000 (19:41 -0700)] 
only run tasks as privileged if taskmgr is in privileged mode

all zone loading tasks have the privileged flag, but we only want
them to run as privileged tasks when the server is being initialized;
if we privilege them the rest of the time, the server may hang for a
long time after a reload/reconfig. so now we call isc_taskmgr_setmode()
to turn privileged execution mode on or off in the task manager.

isc_task_privileged() returns true if the task's privilege flag is
set *and* the taskmgr is in privileged execution mode. this is used
to determine in which netmgr event queue the task should be run.

5 years agoFix crash when allocating UDP socket fails on OpenBSD
Ondřej Surý [Wed, 5 May 2021 19:21:02 +0000 (21:21 +0200)] 
Fix crash when allocating UDP socket fails on OpenBSD

When socket() call fails, the UDP connect code would call the connectcb
with empty req->handle.  This has been fixed.

5 years agoDon't clear dig lookup if it was already cleared
Ondřej Surý [Tue, 4 May 2021 12:25:55 +0000 (14:25 +0200)] 
Don't clear dig lookup if it was already cleared

This workarounds couple of races where the current_lookup would be
already detached during shutting down the dig, but still processing the
pending reads.

5 years agoFix wrong query accounting in the connect function in dighost.c
Ondřej Surý [Tue, 27 Apr 2021 10:03:20 +0000 (12:03 +0200)] 
Fix wrong query accounting in the connect function in dighost.c

The start_udp() function didn't properly attach to the query and thus
a callback with ISC_R_CANCELED would end with wrong accounting on the
query object.

Usually, this doesn't happen because underlying libuv API
uv_udp_connect() is synchronous, but isc_nm_udpconnect() could return
ISC_R_CANCELED in case it's called while the netmgr is shutting down.

5 years agoMake the netmgr queue processing quantized
Ondřej Surý [Tue, 27 Apr 2021 10:03:34 +0000 (12:03 +0200)] 
Make the netmgr queue processing quantized

There was a theoretical possibility of clogging up the queue processing
with an endless loop where currently processing netievent would schedule
new netievent that would get processed immediately.  This wasn't such a
problem when only netmgr netievents were processed, but with the
addition of the tasks, there are at least two situation where this could
happen:

 1. In lib/dns/zone.c:setnsec3param() the task would get re-enqueued
    when the zone was not yet fully loaded.

 2. Tasks have internal quantum for maximum number of isc_events to be
    processed, when the task quantum is reached, the task would get
    rescheduled and then immediately processed by the netmgr queue
    processing.

As the isc_queue doesn't have a mechanism to atomically move the queue,
this commit adds a mechanism to quantize the queue, so enqueueing new
netievents will never stop processing other uv_loop_t events.
The default quantum size is 128.

Since the queue used in the network manager allows items to be enqueued
more than once, tasks are now reference-counted around task_ready()
and task_run(). task_ready() now has a public API wrapper,
isc_task_ready(), that the netmgr can use to reschedule processing
of a task if the quantum has been reached.

Incidental changes: Cleaned up some unused fields left in isc_task_t
and isc_taskmgr_t after the last refactoring, and changed atomic
flags to atomic_bools for easier manipulation.

5 years agoDestroy netmgr before destroying taskmgr
Ondřej Surý [Tue, 27 Apr 2021 08:28:40 +0000 (10:28 +0200)] 
Destroy netmgr before destroying taskmgr

With taskmgr running on top of netmgr, the ordering of how the tasks and
netmgr shutdown interacts was wrong as previously isc_taskmgr_destroy()
was waiting until all tasks were properly shutdown and detached.  This
responsibility was moved to netmgr, so we now need to do the following:

  1. shutdown all the tasks - this schedules all shutdown events onto
     the netmgr queue

  2. shutdown the netmgr - this also makes sure all the tasks and
     events are properly executed

  3. Shutdown the taskmgr - this now waits for all the tasks to finish
     running before returning

  4. Shutdown the netmgr - this call waits for all the netmgr netievents
     to finish before returning

This solves the race when the taskmgr object would be destroyed before
all the tasks were finished running in the netmgr loops.

5 years agoAdd new isc_managers API to simplify <*>mgr create/destroy
Ondřej Surý [Mon, 26 Apr 2021 22:07:43 +0000 (00:07 +0200)] 
Add new isc_managers API to simplify <*>mgr create/destroy

Previously, netmgr, taskmgr, timermgr and socketmgr all had their own
isc_<*>mgr_create() and isc_<*>mgr_destroy() functions.  The new
isc_managers_create() and isc_managers_destroy() fold all four into a
single function and makes sure the objects are created and destroy in
correct order.

Especially now, when taskmgr runs on top of netmgr, the correct order is
important and when the code was duplicated at many places it's easy to
make mistake.

The former isc_<*>mgr_create() and isc_<*>mgr_destroy() functions were
made private and a single call to isc_managers_create() and
isc_managers_destroy() is required at the program startup / shutdown.

5 years agoMerge branch 'artem/doh-tests-fix' into 'main'
Artem Boldariev [Fri, 7 May 2021 13:25:56 +0000 (13:25 +0000)] 
Merge branch 'artem/doh-tests-fix' into 'main'

Fix flawed DoH unit tests logic and some corner cases in the DoH code. Fix doh_test failure on FreeBSD 13.0

Closes #2632

See merge request isc-projects/bind9!5005

5 years agoDoH: close active server streams when finishing session
Artem Boldariev [Thu, 6 May 2021 13:44:09 +0000 (16:44 +0300)] 
DoH: close active server streams when finishing session

Under some circumstances a situation might occur when server-side
session gets finished while there are still active HTTP/2
streams. This would lead to isc_nm_httpsocket object leaks.

This commit fixes this behaviour as well as refactors failed_read_cb()
to allow better code reuse.

5 years agoFix crash in client side DoH code
Artem Boldariev [Thu, 6 May 2021 12:14:04 +0000 (15:14 +0300)] 
Fix crash in client side DoH code

This commit fixes a situation when a cstream object could get unlinked
from the list as a result of a cstream->read_cb call. Thus, unlinking
it after the call could crash the program.

5 years agoMake some TLS tests actually use quota
Artem Boldariev [Fri, 30 Apr 2021 13:06:09 +0000 (16:06 +0300)] 
Make some TLS tests actually use quota

A directive to check quota was missing from some of the TLS tests
which were supposed to test TLS code with quotas.

5 years agoTLS: cancel reading on the underlying TCP socket after (see below)
Artem Boldariev [Fri, 30 Apr 2021 12:55:21 +0000 (15:55 +0300)] 
TLS: cancel reading on the underlying TCP socket after (see below)

... the last handle has been detached after calling write
callback. That makes it possible to detach from the underlying socket
and not to keep the socket object alive for too long. This issue was
causing TLS tests with quota to fail because quota might not have been
detached on time (because it was still referenced by the underlying
TCP socket).

One could say that this commit is an ideological continuation of:

513cdb52ecd4e63566672217f7390574f68c4d2d.

5 years agoFix crashes in TLS when handling TLS shutdown messages
Artem Boldariev [Tue, 27 Apr 2021 10:41:57 +0000 (13:41 +0300)] 
Fix crashes in TLS when handling TLS shutdown messages

This commit fixes some situations which could appear in TLS code when
dealing with shutdown messages and lead to crashes.

5 years agoAvoid creating connect netievents during low level failures in HTTP
Artem Boldariev [Mon, 26 Apr 2021 19:52:59 +0000 (22:52 +0300)] 
Avoid creating connect netievents during low level failures in HTTP

This way we create less netievent objects, not bombarding NM with the
messages in case of numerous low-level errors (like too many open
files) in e.g. unit tests.

5 years agoAvoid creating httpclose netievents in case of low level failures
Artem Boldariev [Mon, 26 Apr 2021 18:04:06 +0000 (21:04 +0300)] 
Avoid creating httpclose netievents in case of low level failures

This way we create less load on NM workers by avoiding netievent
creation.

5 years agoAlways call TCP connect callback from within a worker context
Artem Boldariev [Fri, 23 Apr 2021 14:50:04 +0000 (17:50 +0300)] 
Always call TCP connect callback from within a worker context

This change ensures that a TCP connect callback is called from within
the context of a worker thread in case of a low-level error when
descriptors cannot be created (e.g. when there are too many open file
descriptors).

5 years agoGot rid of tlsconnect event and corresponding code
Artem Boldariev [Fri, 23 Apr 2021 14:30:59 +0000 (17:30 +0300)] 
Got rid of tlsconnect event and corresponding code

We do not need it since we decided to not return values from connect
functions.

5 years agoFinish HTTP session on write failure
Artem Boldariev [Wed, 21 Apr 2021 17:32:35 +0000 (20:32 +0300)] 
Finish HTTP session on write failure

Not doing so caused client-side code to not free file descriptors as
soon as possible, that was causing unit tests to fail.

5 years agoFix flawed DoH unit tests logic
Artem Boldariev [Wed, 21 Apr 2021 12:15:27 +0000 (15:15 +0300)] 
Fix flawed DoH unit tests logic

This commit fixes some logical mistakes in DoH unit tests logic,
causing them either to fail or not to do what they are intended to do.

5 years agoMerge branch 'mnowak/add-placeholder-for-issue-2671' into 'main'
Michal Nowak [Fri, 7 May 2021 11:15:42 +0000 (11:15 +0000)] 
Merge branch 'mnowak/add-placeholder-for-issue-2671' into 'main'

Add placeholder for #2671

See merge request isc-projects/bind9!5004

5 years agoAdd placeholder for #2671
Michal Nowak [Fri, 7 May 2021 10:08:40 +0000 (12:08 +0200)] 
Add placeholder for #2671

Issue #2671 was merged to 9.16 but a respective placeholder was not
added to "main".

5 years agoMerge branch '2603-test-dnssec-policy-none' into 'main'
Matthijs Mekking [Wed, 5 May 2021 17:15:58 +0000 (17:15 +0000)] 
Merge branch '2603-test-dnssec-policy-none' into 'main'

Check zonefile is untouched if dnssec-policy none

Closes #2603

See merge request isc-projects/bind9!4888

5 years agoUse isdigit instead of checking character range
Matthijs Mekking [Wed, 14 Apr 2021 07:19:20 +0000 (09:19 +0200)] 
Use isdigit instead of checking character range

When looking for key files, we could use isdigit rather than checking
if the character is within the range [0-9].

Use (unsigned char) cast to ensure the value is representable in the
unsigned char type (as suggested by the isdigit manpage).

Change " & 0xff" occurrences to the recommended (unsigned char) type
cast.

5 years agoChanges and release notes for [#2603]
Matthijs Mekking [Tue, 13 Apr 2021 15:00:49 +0000 (17:00 +0200)] 
Changes and release notes for [#2603]

5 years agoCheck for filename clashes /w dnssec-policy zones
Matthijs Mekking [Tue, 13 Apr 2021 14:45:16 +0000 (16:45 +0200)] 
Check for filename clashes /w dnssec-policy zones

Just like with dynamic and/or inline-signing zones, check if no two
or more zone configurations set the same filename. In these cases,
the zone files are not read-only and named-checkconf should catch
a configuration where multiple zone statements write to the same file.

Add some bad configuration tests where KASP zones reference the same
zone file.

Update the good-kasp test to allow for two zones configure the same
file name, dnssec-policy none.

5 years agoCheck zonefile is untouched if dnssec-policy none
Matthijs Mekking [Tue, 13 Apr 2021 07:38:14 +0000 (09:38 +0200)] 
Check zonefile is untouched if dnssec-policy none

Make sure no DNSSEC contents are added to the zonefile if dnssec-policy
is set to "none" (and no .state files exist for the zone).

5 years agoMerge branch '2670-always-set-rewrite-when-compacting-a-version-1-journal' into ...
Mark Andrews [Wed, 5 May 2021 13:33:55 +0000 (13:33 +0000)] 
Merge branch '2670-always-set-rewrite-when-compacting-a-version-1-journal' into 'main'

Resolve "Always set 'rewrite' when compacting a version 1 journal."

Closes #2670

See merge request isc-projects/bind9!4985

5 years agoAdd release note for [GL #2670]
Mark Andrews [Wed, 5 May 2021 03:03:42 +0000 (13:03 +1000)] 
Add release note for [GL #2670]

5 years agoAdd CHANGES note for [GL #2670]
Mark Andrews [Wed, 5 May 2021 03:01:26 +0000 (13:01 +1000)] 
Add CHANGES note for [GL #2670]

5 years agoCheck journal compaction
Mark Andrews [Tue, 4 May 2021 07:55:49 +0000 (17:55 +1000)] 
Check journal compaction

5 years agoAlways perform a re-write when processing a version 1 journal
Mark Andrews [Tue, 4 May 2021 07:22:56 +0000 (17:22 +1000)] 
Always perform a re-write when processing a version 1 journal

version 1 journals may have a mix of type 1 and type 2 transaction
headers so always use the recovery code.

5 years agoAllow named-journalprint to compact journals at a given serial
Mark Andrews [Tue, 4 May 2021 07:20:26 +0000 (17:20 +1000)] 
Allow named-journalprint to compact journals at a given serial

5 years agoMerge branch 'matthijs-follow-up-2596' into 'main'
Matthijs Mekking [Wed, 5 May 2021 10:48:38 +0000 (10:48 +0000)] 
Merge branch 'matthijs-follow-up-2596' into 'main'

Remove double "insecure" check

See merge request isc-projects/bind9!4997

5 years agoRemove double "insecure" check
Matthijs Mekking [Wed, 5 May 2021 10:45:47 +0000 (12:45 +0200)] 
Remove double "insecure" check

This was a conflict between dba13d280aacb1ee52de54b0607b3beb4ff1aa0e
and 636ff1e15cb15db9252bd664a6f051761db824ca.

5 years agoMerge branch '2596-dnssec-policy-keys-inaccessible' into 'main'
Matthijs Mekking [Wed, 5 May 2021 10:33:46 +0000 (10:33 +0000)] 
Merge branch '2596-dnssec-policy-keys-inaccessible' into 'main'

Don't roll keys when the private key file is offline

Closes #2596

See merge request isc-projects/bind9!4885

5 years agoNo longer need to strcmp for "none"
Matthijs Mekking [Tue, 4 May 2021 07:49:14 +0000 (09:49 +0200)] 
No longer need to strcmp for "none"

When we introduced "dnssec-policy insecure" we could have removed the
'strcmp' check for "none", because if it was set to "none", the 'kasp'
variable would have been set to NULL.

5 years agoChanges and release notes for [#2596]
Matthijs Mekking [Mon, 12 Apr 2021 13:57:38 +0000 (15:57 +0200)] 
Changes and release notes for [#2596]

5 years agoAdd kasp tests for offline keys
Matthijs Mekking [Mon, 12 Apr 2021 13:26:34 +0000 (15:26 +0200)] 
Add kasp tests for offline keys

Add a test for default.kasp that if we remove the private key file,
no successor key is created for it. We need to update the kasp script
to deal with a missing private key. If this is the case, skip checks
for private key files.

Add a test with a zone for which the private key of the ZSK is missing.

Add a test with a zone for which the private key of the KSK is missing.

5 years agoUpdate smart signing when key is offline
Matthijs Mekking [Mon, 12 Apr 2021 12:45:31 +0000 (14:45 +0200)] 
Update smart signing when key is offline

BIND 9 is smart about when to sign with what key. If a key is offline,
BIND will delete the old signature anyway if there is another key to
sign the RRset with.

With KASP we don't want to fallback to the KSK if the ZSK is missing,
only for the SOA RRset. If the KSK is missing, but we do have a ZSK,
deleting the signature is fine. Otherwise it depends on if we use KASP
or not. Update the 'delsig_ok' function to reflect that.

5 years agoDon't roll offline keys
Matthijs Mekking [Mon, 12 Apr 2021 12:40:46 +0000 (14:40 +0200)] 
Don't roll offline keys

When checking the current DNSSEC state against the policy, consider
offline keys. If we didn't found an active key, check if the key is
offline by checking the public key list. If there is a match in the
public key list (the key data is retrieved from the .key and the
.state files), treat the key as offline and don't create a successor
key for it.

5 years agorndc dnssec -status should include offline keys
Matthijs Mekking [Thu, 8 Apr 2021 10:01:32 +0000 (12:01 +0200)] 
rndc dnssec -status should include offline keys

The rndc command 'dnssec -status' only considered keys from
'dns_dnssec_findmatchingkeys' which only includes keys with accessible
private keys. Change it so that offline keys are also listed in the
status.

5 years agoTry to read state when reading keylist from rdata
Matthijs Mekking [Thu, 8 Apr 2021 09:35:03 +0000 (11:35 +0200)] 
Try to read state when reading keylist from rdata

The function 'dns_dnssec_keylistfromrdataset()' creates a keylist from
the DNSKEY RRset. If we attempt to read the private key, we also store
the key state. However, if the private key is offline, the key state
will not be stored. To fix this, first attempt to read the public key
file. If then reading the private key file fails, and we do have a
public key, add that to the keylist, with appropriate state. If we
also failed to read the public key file, add the DNSKEY to the keylist,
as we did before.

5 years agoWhen reading public key from file, also read state
Matthijs Mekking [Thu, 8 Apr 2021 09:32:48 +0000 (11:32 +0200)] 
When reading public key from file, also read state

The 'dst_key_fromnamedfile()' function did not read and store the
key state from the .state file when reading a public key file.

5 years agoFix a kasp lock issue
Matthijs Mekking [Tue, 6 Apr 2021 09:31:35 +0000 (11:31 +0200)] 
Fix a kasp lock issue

The kasp lock would stay locked if 'dns_keymgr_run' failed.

5 years agoMerge branch '2678-named-checkconf-doesn-t-catch-redefinition-of-dnssec-policy-insecu...
Mark Andrews [Wed, 5 May 2021 07:03:12 +0000 (07:03 +0000)] 
Merge branch '2678-named-checkconf-doesn-t-catch-redefinition-of-dnssec-policy-insecure' into 'main'

Resolve "named-checkconf doesn't catch redefinition of dnssec-policy insecure"

Closes #2678

See merge request isc-projects/bind9!4994

5 years agonamed-checkconf now detects redefinition of dnssec-policy 'insecure'
Mark Andrews [Wed, 5 May 2021 01:23:02 +0000 (11:23 +1000)] 
named-checkconf now detects redefinition of dnssec-policy 'insecure'

5 years agoMerge branch '2536-inline-signing-documentation-doesn-t-match-reality' into 'main'
Mark Andrews [Wed, 5 May 2021 00:17:40 +0000 (00:17 +0000)] 
Merge branch '2536-inline-signing-documentation-doesn-t-match-reality' into 'main'

Resolve "inline-signing documentation doesn't match reality"

Closes #2536

See merge request isc-projects/bind9!4751

5 years agocheckconf tests for inline-signing at options/view
Matthijs Mekking [Tue, 4 May 2021 08:16:59 +0000 (10:16 +0200)] 
checkconf tests for inline-signing at options/view

5 years agoAdd Release note for [GL #2536]
Mark Andrews [Thu, 25 Feb 2021 23:10:04 +0000 (10:10 +1100)] 
Add Release note for [GL #2536]

5 years agoAdd CHANGES note for [GL #2536]
Mark Andrews [Thu, 25 Feb 2021 23:06:17 +0000 (10:06 +1100)] 
Add CHANGES note for [GL #2536]

5 years agoinline-signing should have been in zone_only_clauses
Mark Andrews [Thu, 25 Feb 2021 23:00:09 +0000 (10:00 +1100)] 
inline-signing should have been in zone_only_clauses

5 years agoMerge branch '2675-wrong-rfc-reference-in-name-c' into 'main'
Ondřej Surý [Tue, 4 May 2021 15:22:49 +0000 (15:22 +0000)] 
Merge branch '2675-wrong-rfc-reference-in-name-c' into 'main'

Fix RFC292 -> RFC952 typo

Closes #2675

See merge request isc-projects/bind9!4990

5 years agoFix RFC292 -> RFC952 typo
Ondřej Surý [Tue, 4 May 2021 15:21:52 +0000 (17:21 +0200)] 
Fix RFC292 -> RFC952 typo

5 years agoMerge branch '2624-kasp-test-failure-job-1630205' into 'main'
Matthijs Mekking [Tue, 4 May 2021 08:24:43 +0000 (08:24 +0000)] 
Merge branch '2624-kasp-test-failure-job-1630205' into 'main'

Fix intermittent kasp test failure

Closes #2624

See merge request isc-projects/bind9!4884

5 years agoFix intermittent kasp test failure
Matthijs Mekking [Mon, 12 Apr 2021 09:45:06 +0000 (11:45 +0200)] 
Fix intermittent kasp test failure

The kasp system test performs for each zone a couple of checks to make
sure the zone is signed correctly. To avoid test failures caused by
timing issues, there is first a check to ensure the zone is done
signing, 'wait_for_done_signing'. This function waits with the DNSSEC
checks until a "zone_rekey done" log message is seen for a specific
key.

Unfortunately this is not sufficient to avoid test failures due to
timing issues, because there is a small amount of time in between this
log message and the newly signed zone actually being served.

Therefore, in 'check_apex', retry for three seconds the DNSKEY query
check. After that, additional checks should pass without retries,
because at that point we know for sure the zone has been resigned with
the expected keys.

Also reduce the number of redundant 'check_signatures'