Commit Graph

33017 Commits

Author SHA1 Message Date
Evan Hunt
131bbb9bbe remove dns_client_update() and related code
the libdns client API is no longer being maintained for
external use, we can remove the code that isn't being used
internally, as well as the related tests.

(cherry picked from commit fb2a352e7c)
2021-04-19 13:25:48 +02:00
Ondřej Surý
dac0950381 Merge branch '2636-timing-race-in-setnsec3param-task-v9_16' into 'v9_16'
Fix task timing race in setnsec3param() (v9.16)

See merge request isc-projects/bind9!4915
2021-04-19 11:26:35 +00:00
Ondřej Surý
cb6bfd1e9c Fix task timing race in setnsec3param()
When setnsec3param() is schedule from zone_postload() there's no
guarantee that `zone->db` is not `NULL` yet.  Thus when the
setnsec3param() is called, we need to check for `zone->db` existence and
reschedule the task, because calling `rss_post()` on a zone with empty
`.db` ends up with no-op (the function just returns).

(cherry picked from commit 0127ba6472)
2021-04-19 11:48:39 +02:00
Michał Kępień
60c8ace726 Merge branch '2634-fix-handling-undefined-GSS_SPNEGO_MECHANISM-macro' into 'v9_16'
Fix handling undefined GSS_SPNEGO_MECHANISM macro

See merge request isc-projects/bind9!4902
2021-04-16 12:50:53 +00:00
Michał Kępień
381202629e Add CHANGES entry 2021-04-16 14:40:06 +02:00
Michał Kępień
648ef3a2b4 Fix handling undefined GSS_SPNEGO_MECHANISM macro
BIND 9 attempts to look up GSSAPI OIDs for the Kerberos 5 and SPNEGO
mechanisms in the relevant header files provided by the Kerberos/GSSAPI
library used.  Due to the differences between various Kerberos/GSSAPI
implementations, if any of the expected preprocessor macros
(GSS_KRB5_MECHANISM, GSS_SPNEGO_MECHANISM) is not defined in the header
files provided by the library used, the code in lib/dns/gssapictx.c
defines its own version of each missing macro, so that BIND 9 can
attempt to use the relevant security mechanisms anyway.

Commit a875dcc669, which contains a
partial backport of the changes introduced in commit
978c7b2e89, left a block of code in the
lib/dns/dst_internal.h header which defines the GSS_SPNEGO_MECHANISM
preprocessor macro to NULL if it is not defined by any header file
provided by the Kerberos/GSSAPI library used.  This causes the
gss_add_oid_set_member() call in the mech_oid_set_create() helper
function to always return an error.  This in turn causes the
dst_gssapi_acquirecred() function to also always return an error, which
ultimately prevents any named instance whose configuration includes the
"tkey-gssapi-credential" option from starting.

Remove the offending conditional definition of the GSS_SPNEGO_MECHANISM
preprocessor macro from lib/dns/dst_internal.h, so that a proper GSSAPI
OID is assigned to that macro in lib/dns/gssapictx.c when the
Kerberos/GSSAPI library used does not define it.
2021-04-16 14:40:06 +02:00
Michał Kępień
87f1db2ce4 Roll back unnecessary libtool updates
Commit a875dcc669 inadvertently included
libtool updates which were unrelated to the removal of custom SPNEGO
code.  Roll these updates back to avoid confusion.
2021-04-16 14:40:06 +02:00
Ondřej Surý
b6b891c407 Merge branch '2623-9-16-13-overwrites-master-files-if-old-format-jnl-files-are-present-v9_16' into 'v9_16'
Fixing a recoverable journal should not result in the zone being written [v9.16]

See merge request isc-projects/bind9!4900
2021-04-16 12:35:25 +00:00
Mark Andrews
382f915175 Add CHANGES and release note for [GL #2623]
(cherry picked from commit 3df637fb83)
2021-04-16 13:50:21 +02:00
Ondřej Surý
83c79a0b1e Refactor dns_journal_rollforward() to work over opened journal
Too much logic was cramped inside the dns_journal_rollforward() that
made it harder to follow.  The dns_journal_rollforward() was refactored
to work over already opened journal and some of the previous logic was
moved to new static zone_journal_rollforward() that separates the
journal "rollforward" logic from the "zone" logic.

(cherry picked from commit 55b942b4a0)
2021-04-16 13:50:20 +02:00
Mark Andrews
875366565c Fixing a recoverable journal should not result in the zone being written
when dns_journal_rollforward returned ISC_R_RECOVERABLE the distintion
between 'up to date' and 'success' was lost, as a consequence
zone_needdump() was called writing out the zone file when it shouldn't
have been.   This change restores that distintion.  Adjust system
test to reflect visible changes.

(cherry picked from commit ec7a9af381)
2021-04-16 13:50:20 +02:00
Matthijs Mekking
55f7f13ea1 Merge branch 'matthijs-keymgr2kasp-rework-v9_16' into 'v9_16'
Fix view-related issues in the "keymgr2kasp" test

See merge request isc-projects/bind9!4896
2021-04-15 13:19:54 +00:00
Matthijs Mekking
ecc7d6b4bc Fix view-related issues in the "keymgr2kasp" test
Due to the lack of "match-clients" clauses in ns4/named2.conf.in, the
same view is incorrectly chosen for all queries received by ns4 in the
"keymgr2kasp" system test.  This causes only one version of the
"view-rsasha256.kasp" zone to actually be checked.  Add "match-clients"
clauses to ns4/named2.conf.in to ensure the test really checks what it
claims to.

Use identical view names ("ext", "int") in ns4/named.conf.in and
ns4/named2.conf.in so that it is easier to quickly identify the
differences between these two files.

Update tests.sh to account for the above changes.  Also fix a copy-paste
error in a comment to prevent confusion.

(cherry picked from commit 0de5a576c5)
2021-04-15 14:57:14 +02:00
Matthijs Mekking
84948ef445 Merge branch '1100-inline-signing-include-v9_16' into 'v9_16'
Add inline-signing with $INCLUDE test

See merge request isc-projects/bind9!4892
2021-04-14 09:50:45 +00:00
Matthijs Mekking
b9db975a6d Document relative path of $INCLUDE
Add to the ARM from where relative paths are searched.

(cherry picked from commit bad5c3cf7c)
2021-04-14 11:49:02 +02:00
Matthijs Mekking
3e2b6bee17 Fix inline test with missing $INCLUDE
The test case for a zone with a missing include file was wrong for two
reasons:
1. It was loading the wrong file (master5 instead of master6)
2. It did actually not set the $ret variable to 1 if the test failed
   (it should default to ret=1 and clear the variable if the
   appropriate log is found).

(cherry picked from commit 96583e7c40)
2021-04-14 11:48:54 +02:00
Matthijs Mekking
304f5eac7f Add inline-signing with $INCLUDE test
Add a test case for inline-signing for a zone with an $INCLUDE
statement. There is already a test for a missing include file, this
one adds a test for a zone with an include file that does exist.

Test if the record in the included file is loaded.

(cherry picked from commit 6463ee0f40)
2021-04-14 11:48:46 +02:00
Matthijs Mekking
d8c75125bd Merge branch '2347-draft-vandijk-dnsop-nsec-ttl-v9_16' into 'v9_16'
Implement draft-vandijk-dnsop-nsec-ttl (9.16)

See merge request isc-projects/bind9!4890
2021-04-13 15:23:11 +00:00
Matthijs Mekking
3e7c6a6fe8 Small refactor lib/dns/zone.c
Introduce some macros that can be reused in 'zone_load_soa_rr()' and
'zone_get_from_db()' to make those functions more readable.

(cherry picked from commit 8fcbef2423)
2021-04-13 14:19:52 +02:00
Matthijs Mekking
b0fb734079 Use designated initializer in dns_zone_create
Shorten the code and make it less prone to initialisation errors
(it is still easy to forget adding an initializer, but it now defaults
to 0).

(cherry picked from commit 032110bd2e)
2021-04-13 14:19:32 +02:00
Matthijs Mekking
8d0a5775cc Add change entry and release note for [#2347]
(cherry picked from commit 3b68dd426f)
2021-04-13 14:18:42 +02:00
Matthijs Mekking
e5736de60d Implement draft-vandijk-dnsop-nsec-ttl
The draft says that the NSEC(3) TTL must have the same TTL value
as the minimum of the SOA MINIMUM field and the SOA TTL. This was
always the intended behaviour.

Update the zone structure to also track the SOA TTL. Whenever we
use the MINIMUM value to determine the NSEC(3) TTL, use the minimum
of MINIMUM and SOA TTL instead.

There is no specific test for this, however two tests need adjusting
because otherwise they failed: They were testing for NSEC3 records
including the TTL. Update these checks to use 600 (the SOA TTL),
rather than 3600 (the SOA MINIMUM).

(cherry picked from commit 9af8caa733)
2021-04-13 14:18:33 +02:00
Matthijs Mekking
bb90cb2619 Merge branch '2289-cache-dump-stale-ttl-weird-values-9_16' into 'v9_16'
Fix nonsensical stale TTL values in cache dump (9.16)

See merge request isc-projects/bind9!4889
2021-04-13 09:43:07 +00:00
Matthijs Mekking
0d47f9f20f Use stale TTL as RRset TTL in dumpdb
It is more intuitive to have the countdown 'max-stale-ttl' as the
RRset TTL, instead of 0 TTL. This information was already available
in a comment "; stale (will be retained for x more seconds", but
Support suggested to put it in the TTL field instead.

(cherry picked from commit a83c8cb0af)
2021-04-13 10:59:17 +02:00
Matthijs Mekking
7b17cc080e Check staleness in bind_rdataset
Before binding an RRset, check the time and see if this record is
stale (or perhaps even ancient). Marking a header stale or ancient
happens only when looking up an RRset in cache, but binding an RRset
can also happen on other occasions (for example when dumping the
database).

Check the time and compare it to the header. If according to the
time the entry is stale, but not ancient, set the STALE attribute.
If according to the time is ancient, set the ANCIENT attribute.

We could mark the header stale or ancient here, but that requires
locking, so that's why we only compare the current time against
the rdh_ttl.

Adjust the test to check the dump-db before querying for data. In the
dumped file the entry should be marked as stale, despite no cache
lookup happened since the initial query.

(cherry picked from commit debee6157b)
2021-04-13 10:59:10 +02:00
Matthijs Mekking
dcf6e3e58a Fix nonsensical stale TTL values in cache dump
When introducing change 5149, "rndc dumpdb" started to print a line
above a stale RRset, indicating how long the data will be retained.

At that time, I thought it should also be possible to load
a cache from file. But if a TTL has a value of 0 (because it is stale),
stale entries wouldn't be loaded from file. So, I added the
'max-stale-ttl' to TTL values, and adjusted the $DATE accordingly.

Since we actually don't have a "load cache from file" feature, this
is premature and is causing confusion at operators. This commit
changes the 'max-stale-ttl' adjustments.

A check in the serve-stale system test is added for a non-stale
RRset (longttl.example) to make sure the TTL in cache is sensible.

Also, the comment above stale RRsets could have nonsensical
values. A possible reason why this may happen is when the RRset was
marked a stale but the 'max-stale-ttl' has passed (and is actually an
RRset awaiting cleanup). This would lead to the "will be retained"
value to be negative (but since it is stored in an uint32_t, you would
get a nonsensical value (e.g. 4294362497).

To mitigate against this, we now also check if the header is not
ancient. In addition we check if the stale_ttl would be negative, and
if so we set it to 0. Most likely this will not happen because the
header would already have been marked ancient, but there is a possible
race condition where the 'rdh_ttl + serve_stale_ttl' has passed,
but the header has not been checked for staleness.

(cherry picked from commit 2a5e0232ed)
2021-04-13 10:59:00 +02:00
Mark Andrews
7c2b5495e0 Merge branch '2597-make-calling-generic-rdata-methods-consistent-v9_16' into 'v9_16'
Make calling generic rdata methods consistent

See merge request isc-projects/bind9!4843
2021-04-13 03:04:20 +00:00
Mark Andrews
f4331a48fa Make calling generic rdata methods consistent
add matching macros to pass arguments from called methods
to generic methods.  This will reduce the amount of work
required when extending methods.

Also cleanup unnecessary UNUSED declarations.

(cherry picked from commit a88d3963e2)
2021-04-13 01:54:29 +00:00
Mark Andrews
2adee41fce Merge branch '2622-command-line-option-l-not-shown-with-usage-message-v9_16' into 'v9_16'
Update named's usage description

See merge request isc-projects/bind9!4887
2021-04-13 01:53:26 +00:00
Mark Andrews
4864b69e95 Update named's usage description
(cherry picked from commit 38449de93b)
2021-04-13 11:35:13 +10:00
Michal Nowak
b3bebad281 Merge branch 'mnowak/gdb-for-killed-named-v9_16' into 'v9_16'
Run GDB for crashed named servers

See merge request isc-projects/bind9!4848
2021-04-08 10:28:19 +00:00
Michal Nowak
45bb2ae5f6 Run GDB for crashed named servers
When a core file was generated after named crashed during a system test
on 9.16, it wasn't processed by GDB, and no backtrace report was
created. This is now fixed. There are also a few white-space changes.
2021-04-08 11:53:32 +02:00
Michal Nowak
e00b69d2ee Merge branch 'mnowak/fix-missing-fromhex.pl-in-out-of-tree-v9_16' into 'v9_16'
[v9_16] Move fromhex.pl script to bin/tests/system/

See merge request isc-projects/bind9!4877
2021-04-08 09:51:14 +00:00
Michal Nowak
98d91e3024 Move fromhex.pl script to bin/tests/system/
The fromhex.pl script needs to be copied from the source directory to
the build directory before any test is run, otherwise the out-of-tree
fails to find it. Given that the script is used only in system test,
move it to bin/tests/system/.

(cherry picked from commit cd0a34df1b)
2021-04-08 11:11:23 +02:00
Michał Kępień
e02df06d8e Merge branch '2620-free-resources-when-gss_accept_sec_context-fails-v9_16' into 'v9_16'
[v9_16] Free resources when gss_accept_sec_context() fails

See merge request isc-projects/bind9!4874
2021-04-08 09:04:09 +00:00
Michał Kępień
ef4460949f Add CHANGES entry
(cherry picked from commit 7eb87270a4)
2021-04-08 10:41:09 +02:00
Michał Kępień
363902ce2c Free resources when gss_accept_sec_context() fails
Even if a call to gss_accept_sec_context() fails, it might still cause a
GSS-API response token to be allocated and left for the caller to
release.  Make sure the token is released before an early return from
dst_gssapi_acceptctx().

(cherry picked from commit d954e152d9)
2021-04-08 10:41:08 +02:00
Michał Kępień
21b0eac026 Merge branch 'michal/fix-triggering-rules-for-the-tarball-create-job' into 'v9_16'
Fix triggering rules for the "tarball-create" job

See merge request isc-projects/bind9!4871
2021-04-07 20:34:01 +00:00
Michał Kępień
233294d750 Fix triggering rules for the "tarball-create" job
Commit fd8ce68189 (a backport of commit
4d5d3b75da) did not account for the fact
that the "tarball-create" GitLab CI job is not created for manually
triggered pipelines.  This prevents manual pipeline creation from
succeeding as it causes the "gcc:tarball" job to have unsatisfied
dependencies.  Make sure the "tarball-create" job is created for
manually triggered pipelines to allow such pipelines to be started
again.
2021-04-07 22:31:09 +02:00
Ondřej Surý
66e243e64d Merge branch '2600-general-error-managed-keys-zone-dns_journal_compact-failed-no-more-v9_16' into 'v9_16'
Resolve "general: error: managed-keys-zone: dns_journal_compact failed: no more" (v9.16)

See merge request isc-projects/bind9!4870
2021-04-07 20:00:32 +00:00
Mark Andrews
2840fca4c5 Add CHANGES and release note for [GL #2600]
(cherry picked from commit 0174098aca)
2021-04-07 21:30:01 +02:00
Mark Andrews
dd2c7a3c8e Check that upgrade of managed-keys.bind.jnl succeeded
Update the system to include a recoverable managed.keys journal created
with <size,serial0,serial1,0> transactions and test that it has been
updated as part of the start up process.

(cherry picked from commit bb6f0faeed)
2021-04-07 21:29:07 +02:00
Mark Andrews
7b93ff93d6 Rewrite managed-key journal immediately
Both managed keys and regular zone journals need to be updated
immediately when a recoverable error is discovered.

(cherry picked from commit 0fbdf189c7)
2021-04-07 21:29:07 +02:00
Mark Andrews
511ea2d3f3 Update dns_journal_compact() to handle bad transaction headers
Previously, dns_journal_begin_transaction() could reserve the wrong
amount of space.  We now check that the transaction is internally
consistent when upgrading / downgrading a journal and we also handle the
bad transaction headers.

(cherry picked from commit 83310ffd92)
2021-04-07 21:29:06 +02:00
Mark Andrews
6da2e05df9 Compute transaction size based on journal/transaction type
previously the code assumed that it was a new transaction.

(cherry picked from commit 520509ac7e)
2021-04-07 21:29:06 +02:00
Mark Andrews
d9ad7ccf2d Use journal_write_xhdr() to write the dummy transaction header
Instead of journal_write(), use correct format call journal_write_xhdr()
to write the dummy transaction header which looks at j->header_ver1 to
determine which transaction header to write instead of always writing a
zero filled journal_rawxhdr_t header.

(cherry picked from commit 5a6112ec8f)
2021-04-07 21:29:06 +02:00
Diego dos Santos Fronza
25750e6436 Merge branch '2582-threadsanitizer-data-race-lib-dns-zone-c-10272-7-in-zone_maintenance-v9_16' into 'v9_16'
Resolve TSAN data race in zone_maintenance

See merge request isc-projects/bind9!4866
2021-04-07 13:25:17 +00:00
Diego Fronza
5d391f07c0 Resolve TSAN data race in zone_maintenance
Fix race between zone_maintenance and dns_zone_notifyreceive functions,
zone_maintenance was attempting to read a zone flag calling
DNS_ZONE_FLAG(zone, flag) while dns_zone_notifyreceive was updating
a flag in the same zone calling DNS_ZONE_SETFLAG(zone, ...).

The code reading the flag in zone_maintenance was not protected by the
zone's lock, to avoid a race the zone's lock is now being acquired
before an attempt to read the zone flag is made.
2021-04-07 13:22:36 +00:00
Matthijs Mekking
834379b807 Merge branch '2608-stale-answer-client-timeout-default-off-v9_16' into 'v9_16'
Change default stale-answer-client-timeout to off (9.16)

See merge request isc-projects/bind9!4867
2021-04-07 13:16:03 +00:00
Matthijs Mekking
c63b533690 Change default stale-answer-client-timeout to off
Using "stale-answer-client-timeout" turns out to have unforeseen
negative consequences, and thus it is better to disable the feature
by default for the time being.

(cherry picked from commit e443279bbf)
2021-04-07 14:46:55 +02:00