Commit Graph

34673 Commits

Author SHA1 Message Date
Artem Boldariev
992f815770 Add "protocols" options to the "tls" clause
This commit adds the ability to specify allowed TLS protocols versions
within the "tls" clause. If an unsupported TLS protocol version is
specified in a file, the configuration file will not pass
verification.

Also, this commit adds strict checks for "tls" clauses verification,
in particular:

- it ensures that loading configuration files containing duplicated
"tls" clauses is not allowed;

- it ensures that loading configuration files containing "tls" clauses
missing "cert-file" or "key-file" is not allowed;

- it ensures that loading configuration files containing "tls" clauses
named as "ephemeral" or "none" is not allowed.
2021-10-01 15:50:43 +03:00
Artem Boldariev
9e039986cd TLS: set some common options both for client and server contexts
This commit makes the TLS context manipulation code set some of the
common protocol versions regardless of the OpenSSL version in use.
2021-10-01 15:50:42 +03:00
Arаm Sаrgsyаn
aae268b6c8 Merge branch '2308-catz-reload-when-missing-a-zone' into 'main'
Handle a missing zone when reloading a catalog zone

Closes #2308

See merge request isc-projects/bind9!5442
2021-09-30 19:52:00 +00:00
Aram Sargsyan
3edaa0bde6 Add CHANGES and release notes for [GL #2308] 2021-09-30 19:19:43 +00:00
Aram Sargsyan
94a5712801 Handle a missing zone when reloading a catalog zone
Previously a missing/deleted zone which was referenced by a catalog
zone was causing a crash when doing a reload.

This commit will make `named` to ignore the fact that the zone is
missing, and make sure to restore it later on.
2021-09-30 19:14:12 +00:00
Ondřej Surý
2b5d3f125c Merge branch '2921-replace-xmalloc_true-with-own-assertions' into 'main'
Use assertions to check for failed allocations

See merge request isc-projects/bind9!5449
2021-09-30 13:52:01 +00:00
Ondřej Surý
c3250a9b81 Use assertions to check for failed allocations
It was discovered that named could crash due to a segmentation fault
when jemalloc was in use and memory allocation failed.  This was not
intended to happen as jemalloc's "xmalloc" option was set to "true" in
the "malloc_conf" configuration variable.  However, that variable was
only set after jemalloc was already done with parsing it, which
effectively caused setting that variable to have no effect.

While investigating this issue, it was also discovered that enabling the
"xmalloc" option makes jemalloc use a slow processing path, decreasing
its performance by about 25%. [1]

Additionally, further testing (carried out after fixing the way
"malloc_conf" was set) revealed that the non-default configuration
options do not have any measurable effect on either authoritative or
recursive DNS server performance.

Replace code setting various jemalloc options to non-default values with
assertion checks of mallocx()/rallocx() return values.

[1] https://github.com/jemalloc/jemalloc/pull/523
2021-09-30 13:54:55 +02:00
Artem Boldariev
7b18cdc315 Merge branch '2924-fix-heap-user-after-free-when-checking-for-http-duplicates' into 'main'
Fix heap use after free when checking for "http" duplicates

Closes #2924

See merge request isc-projects/bind9!5452
2021-09-30 09:16:43 +00:00
Artem Boldariev
6499ae021c Modify CHANGES [GL #2924]
Mention that heap-use-after-free when checking for "http" duplicates
is fixed.
2021-09-30 11:56:10 +03:00
Artem Boldariev
ef65d32594 Fix heap use after free when checking for "http" duplicates
This commit fixes heap use after free when checking BIND's
configuration files for errors with http clauses.  The old code
was unnecessarially copying the http element name and freeing
it to early.  The name is now used directly.
2021-09-30 11:56:10 +03:00
Artem Boldariev
52f411b288 Merge branch '2923-validate-doh-path-in-dig' into 'main'
Validate HTTP path passed to dig

Closes #2923

See merge request isc-projects/bind9!5451
2021-09-30 08:36:58 +00:00
Artem Boldariev
b20a8c5065 Modify CHANGES [GL #2923]
Mention that the HTTP path is now validated.
2021-09-29 19:42:18 +03:00
Artem Boldariev
0d5e0b9922 Validate HTTP path passed to dig
The commit makes sure that the HTTP path passed to dig is a valid one.
2021-09-29 19:42:03 +03:00
Ondřej Surý
4ce5f94333 Merge branch '2908-rwlock-with-reader-and-writer-both-waiting' into 'main'
Resolve "rwlock with reader and writer both waiting"

Closes #2908

See merge request isc-projects/bind9!5421
2021-09-29 15:56:35 +00:00
Mark Andrews
c04bce278f Add CHANGES note for [GL #2908] 2021-09-29 17:36:19 +02:00
Mark Andrews
4e1faa35d5 Pause the dbiterator before calling dns_db_find
zone.c:integrity_checks() acquires a read lock while iterating the
zone database, and calls zone_check_mx() which acquires another
read lock. If another thread tries to acquire a write lock in the
meantime, it can deadlock. Calling dns_dbiterator_pause() to release
the first read lock prevents this.
2021-09-29 17:35:57 +02:00
Mark Andrews
214c985876 Merge branch '2911-9-16-21-regression-legacy-check-names-configuration-does-not-work-anymore' into 'main'
Resolve "9.16.21 Regression: Legacy check-names configuration does not work anymore"

Closes #2911

See merge request isc-projects/bind9!5425
2021-09-29 09:42:54 +00:00
Mark Andrews
14249ce9fe Add CHANGES note for [GL #2911] 2021-09-29 09:18:59 +00:00
Mark Andrews
0b0d400d7c Check that 'check-names {secondary|slave} ignore;' works 2021-09-29 09:18:59 +00:00
Mark Andrews
9107c8caeb Check that 'check-names master ignore;' works 2021-09-29 09:18:59 +00:00
Mark Andrews
a3c6516a75 Fix "check-names master" and "check-names slave"
check for type "master" / "slave" at the same time as checking
for "primary" / "secondary" as we step through the maps.

Checking "primary" then "master" or "master" then "primary" does
not work as the synomym is not checked for to stop the search.
Similarly with "secondary" and "slave".
2021-09-29 09:18:59 +00:00
Mark Andrews
cb16ba3a41 Merge branch '2909-pointers-used-before-validation' into 'main'
Resolve "Pointers used before validation"

Closes #2909

See merge request isc-projects/bind9!5443
2021-09-29 01:41:25 +00:00
Mark Andrews
06a69e03ac Address use before NULL check warning of obj
move deference of obj to after NULL check
2021-09-28 11:57:47 +10:00
Mark Andrews
8fc9bb8e8e Address use before NULL check warning of ievent->sock
Reorder REQUIRE checks to ensure ievent->sock is checked earlier
2021-09-28 11:57:47 +10:00
Mark Andrews
7079829b84 Address use before NULL check warning of uvreq
move dereference of uvreq until the after NULL check.
2021-09-28 11:57:47 +10:00
Mark Andrews
eeec53eb5d Merge branch '2910-unknown-system-test-doesn-t-leave-forensics' into 'main'
Resolve "unknown system test doesn't leave forensics"

Closes #2910

See merge request isc-projects/bind9!5422
2021-09-24 03:34:18 +00:00
Mark Andrews
96b7421f8c Preserve dig results in case of test failure 2021-09-24 03:07:31 +00:00
Ondřej Surý
4054ec87cd Merge branch '2917-preserve-the-contents-of-tcp-buffer' into 'main'
Preserve the contents of socket buffer on realloc

Closes #2917

See merge request isc-projects/bind9!5437
2021-09-23 21:21:38 +00:00
Ondřej Surý
d717975e3e Add CHANGES and release notes for [GL #2917] 2021-09-23 22:36:01 +02:00
Ondřej Surý
8248da3b83 Preserve the contents of socket buffer on realloc
On TCPDNS/TLSDNS read callback, the socket buffer could be reallocated
if the received contents would be larger than the buffer.  The existing
code would not preserve the contents of the existing buffer which lead
to the loss of the already received data.

This commit changes the isc_mem_put()+isc_mem_get() with isc_mem_reget()
to preserve the existing contents of the socket buffer.
2021-09-23 22:36:01 +02:00
Ondřej Surý
f0e5428f78 Merge branch 'ondrej/introduce-isc_mem_reget' into 'main'
Add isc_mem_reget() function to realloc isc_mem_get allocations

See merge request isc-projects/bind9!5440
2021-09-23 20:35:29 +00:00
Ondřej Surý
d72d0149b0 Add CHANGES note for [GL !5440] 2021-09-23 22:17:15 +02:00
Ondřej Surý
8edbd0929f Use isc_mem_reget() to handle the internal active handle cache
The netmgr, has an internal cache for freed active handles.  This cache
was allocated using isc_mem_allocate()/isc_mem_free() API because it was
simpler to reallocate the cache when we needed to grow it.  The new
isc_mem_reget() function could be used here reducing the need to use
isc_mem_allocate() API which is tad bit slower than isc_mem_get() API.
2021-09-23 22:17:15 +02:00
Ondřej Surý
15d6249260 Use isc_mem_reget() when growing buffer dynamically
Previously, we cannot use isc_mem_reallocate() for growing the buffer
dynamically, because the memory was allocated using the
isc_mem_get()/isc_mem_put() API.  With the introduction of the
isc_mem_reget() function, we can use grow/shrink the memory directly
without always moving the memory around as the allocator might have
reserved some extra space after the initial allocation.
2021-09-23 22:17:15 +02:00
Ondřej Surý
4cdb3abf27 Return non-NULL pointer on zero-sized allocations and reallocations
Previously, the zero-sized allocations would return NULL pointer and the
caller had to make sure to not dereference such pointer.  The C standard
defines the zero-sized calls to malloc() as implementation specific and
jemalloc mallocx() with zero size would be undefined behaviour.  This
complicated the code as it had to handle such cases in a special manner
in all allocator and deallocator functions.

Now, for realloc(), the situation is even more complicated.  In C
standard up to C11, the behavior would be implementation defined, and
actually some implementation would free to orig ptr and some would not.
Since C17 (via DR400) would deprecate such usage and since C23, the
behaviour would be undefined.

This commits changes helper mem_get(), mem_put() and mem_realloc()
functions to grow the zero-allocation from 0 to sizeof(void *).

This way we get a predicable behaviour that all the allocations will
always return valid pointer.
2021-09-23 22:17:15 +02:00
Ondřej Surý
aeb3d1cab3 Add isc_mem_reget() function to realloc isc_mem_get allocations
The isc_mem_get() and isc_mem_put() functions are leaving the memory
allocation size tracking to the users of the API, while
isc_mem_allocate() and isc_mem_free() would track the sizes internally.
This allowed to have isc_mem_rellocate() to manipulate the memory
allocations by the later set, but not the former set of the functions.

This commit introduces isc_mem_reget(ctx, old_ptr, old_size, new_size)
function that operates on the memory allocations with external size
tracking completing the API.
2021-09-23 11:18:07 -07:00
Matthijs Mekking
c5c6a76e8c Merge branch 'matthijs-fix-arm-typos' into 'main'
The s stands for security

See merge request isc-projects/bind9!5428
2021-09-23 07:52:09 +00:00
Matthijs Mekking
4e3ba81696 Remove copy paste error on zone-max-ttl
The "zone-max-ttl" option inside a "dnssec-policy" is not used to cap
the TTLs in a zone, only yo calculate key rollover timings.
2021-09-23 09:51:40 +02:00
Matthijs Mekking
9ddc23b2bf Add a note about salt length
Apparently it is confusing that you don't specify a specific salt,
but a salt length.
2021-09-23 09:51:40 +02:00
Matthijs Mekking
a73a07832e The s stands for security
So "hardware security modules" not "hardware service modules"
2021-09-23 09:51:40 +02:00
Ondřej Surý
db00265dec Merge branch '2814-DLZ-drivers-additional-cleanups' into 'main'
Remove the DLZ driver documentation

Closes #2814

See merge request isc-projects/bind9!5431
2021-09-21 09:37:33 +00:00
Ondřej Surý
c478c77763 Remove CONTRIB_DLZ traces from bin/named/main.c
The named main.c had leftovers guarded by CONTRIB_DLZ macro which
has been removed.  This commit removes the dead code surrounded
by ifdef CONTRIB_DLZ.
2021-09-21 11:16:53 +02:00
Ondřej Surý
5acac71f20 Remove the DLZ driver documentation
Remove the last traces of static DLZ drivers from ARM.
2021-09-21 11:16:53 +02:00
Ondřej Surý
0b983fe2e5 Merge branch 'ondrej/remove-cruft-from-contrib' into 'main'
Remove old-style DLZ drivers linked into named at compile time

Closes #2814

See merge request isc-projects/bind9!5427
2021-09-20 21:01:40 +00:00
Ondřej Surý
e543054d56 Add CHANGES and release note for [GL #2814] 2021-09-20 22:26:17 +02:00
Ondřej Surý
b9319fc998 Remove couple old and rusty scripts from contrib/
* dnssec-keyset.sh - obsoleted by dnssec-policy
* named-bootconf.sh - unmaintained script from NetBSD that would
		      generate named.conf
2021-09-20 22:26:17 +02:00
Ondřej Surý
57b8a12734 Remove scripts to convert KASP to old dnssec-keymgr policy
The dnssec-keymgr has been replaces with dnssec-policy in the named, so
there's no need to carry the conversion script in the contrib/ anymore.
2021-09-20 22:26:17 +02:00
Ondřej Surý
b964e7882b Remove dnspriv example from the contrib directory
BIND 9 has now native DoH support, so there's no need to have nginx
proxy example in the contrib/ directory.
2021-09-20 22:26:17 +02:00
Ondřej Surý
354c5a358b Remove the mkdane.sh script from contrib directory
Better and maintained alternatives exists, f.e. sshfp package contains a
dane tool: https://github.com/xelerance/sshfp/
2021-09-20 22:26:17 +02:00
Ondřej Surý
67f76b1269 Add static Makefile to mysql and mysqldyn DLZ modules
Previously, the Makefiles for mysql and mysqldyn DLZ modules were
generated from autoconf to get CFLAGS and LIBS for MariaDB or MySQL
libraries.  The static Makefiles uses a simpler method by calling
`mysql_config` directly from the Makefile.
2021-09-20 22:26:17 +02:00