Commit Graph

34692 Commits

Author SHA1 Message Date
Evan Hunt
5dcf55da03 Remove support for shared UDP dispatch sockets
Currently the netmgr doesn't support unconnected, shared UDP sockets, so
there's no reason to retain that functionality in the dispatcher prior
to porting to the netmgr.

In this commit, the DNS_DISPATCHATTR_EXCLUSIVE attribute has been
removed as it is now non-optional; UDP dispatches are alwasy exclusive.
Code implementing non-exclusive UDP dispatches has been removed.
dns_dispatch_getentrysocket() now always returns the dispsocket for UDP
dispatches and the dispatch socket for TCP dispatches.

There is no longer any need to search for existing dispatches from
dns_dispatch_getudp(), so the 'mask' option has been removed, and the
function renamed to the more descriptive dns_dispatch_createudp().
2021-10-02 10:21:43 +02:00
Evan Hunt
300392ae2f General code refactoring
- style cleanup
- removed NULL checks in places where they are not currently needed
- use isc_refcount for dispatch reference counting
- revised code flow for readability
- remove some #ifdefs that are no longer relevant
- remove unused struct members
- removed unnecessary function parameters
- use C99 struct initialization
2021-10-02 10:21:38 +02:00
Evan Hunt
5863acc907 Make sharing of pending TCP dispatches nonoptional
The DNS_REQUESTOPT_SHARE flag was added when client-side pipelining of
TCP queries was implemented. there was no need to make it optional;
forcing it to be in effect for all requests simplfiies the code.
2021-10-02 10:21:35 +02:00
Evan Hunt
ca11f68d61 Simplify dns_dispatchmgr_create with fixed buffersize
- UDP buffersize is now established when creating dispatch manager
  and is always set to 4096.

- Set up the default port range in dispatchmgr before setting the magic
  number.

- Magic is not set until dispatchmgr is fully created.
2021-10-02 10:21:32 +02:00
Evan Hunt
57fce0e895 Remove some DNS_DISPATCHATTR flags
- DNS_DISPATCHATTR_CANREUSE was never set. the code that implements it
  has been removed.

- DNS_DISPATCHOPT_FIXEDID and DNS_DISPATCHATTR_FIXEDID were both
  defined, but only the DISPATCHOPT was ever set; it appears the
  DISPATCHATTR was added accidentally.

- DNS_DISPATCHATTR_NOLISTEN was set but never used.
2021-10-02 10:21:25 +02:00
Evan Hunt
c69f2018a3 Remove unused code in dispatch.c
Some routines in dispatch.c are obsolete and unused; clean them up
before porting to netmgr.
2021-10-02 10:21:22 +02:00
Vicky Risk
a480522f6e Merge branch '2913-release-checklist-for-bind-is-missing-a-step-for-the-official-docker-image' into 'main'
Resolve "Release checklist for BIND + a step for the official docker image"

Closes #2913

See merge request isc-projects/bind9!5436
2021-10-01 15:41:23 +00:00
Vicky Risk
829d02fa3f Update Release.md to break out steps required to build and update packages 2021-10-01 15:21:59 +00:00
Artem Boldariev
39584a5226 Merge branch 'artem/tls-protocols-conf' into 'main'
Resolve #2795, #2796: implement TLS configuration options to make it possible to specify supported TLS versions and implement perfect forward secrecy for DoH and DoT

Closes #2796 and #2795

See merge request isc-projects/bind9!5444
2021-10-01 13:28:14 +00:00
Artem Boldariev
4369d94f68 Provide an example of forward secrecy enabled TLS configuration
This commit adds and example of a perfect forward secrecy enabled TLS
configuration intended to be used as a starting point.
2021-10-01 15:56:02 +03:00
Artem Boldariev
834bb4e52b Modify release notes [GL #2796]
Mention the new "tls" clause options in the release notes.
2021-10-01 15:56:02 +03:00
Artem Boldariev
503a9a56b2 Modify release notes [GL #2795]
Mention that it is now possible to specify supported TLS protocol
versions.
2021-10-01 15:56:02 +03:00
Artem Boldariev
bbf758a6fd Modify CHANGES [GL #2796]
Mention the new "tls" options in the CHANGES file.
2021-10-01 15:55:57 +03:00
Artem Boldariev
17d2b3c8db Modify CHANGES [GL #2795]
Mention in the CHANGES file that supported TLS versions can be
specified in the configuration file.
2021-10-01 15:51:40 +03:00
Artem Boldariev
9c34fa2896 Mention that "tls" options defaults are outside of our control
We have to mention that every option within a "tls" clause has
defaults out of our control as some platforms have means for defining
encryption policies globally for any application on the system.

In order to comply with these policies, we have not to modify TLS
contexts settings, unless we have to do so according to the options
specified within "tls" clauses.
2021-10-01 15:50:43 +03:00
Artem Boldariev
c759f25c7b Add "session-tickets" options to the "tls" clause
This commit adds the ability to enable or disable stateless TLS
session resumption tickets (see RFC5077). Having this ability is
twofold.

Firstly, these tickets are encrypted by the server, and the algorithm
might be weaker than the algorithm negotiated during the TLS session
establishment (it is in general the case for TLSv1.2, but the generic
principle applies to TLSv1.3 as well, despite it having better ciphers
for session tickets). Thus, they might compromise Perfect Forward
Secrecy.

Secondly, disabling it might be necessary if the same TLS key/cert
pair is supposed to be used by multiple servers to achieve, e.g., load
balancing because the session ticket by default gets generated in
runtime, while to achieve successful session resumption ability, in
this case, would have required using a shared key.

The proper alternative to having the ability to disable stateless TLS
session resumption tickets is to implement a proper session tickets
key rollover mechanism so that key rotation might be performed
often (e.g. once an hour) to not compromise forward secrecy while
retaining the associated performance benefits. That is much more work,
though. On the other hand, having the ability to disable session
tickets allows having a deployable configuration right now in the
cases when either forward secrecy is wanted or sharing the TLS
key/cert pair between multiple servers is needed (or both).
2021-10-01 15:50:43 +03:00
Artem Boldariev
16c6e2be06 Add "prefer-server-ciphers" options to the "tls" clause
This commit adds support for enforcing the preference of server
ciphers over the client ones. This way, the server attains control
over the ciphers priority and, thus, can choose more strong cyphers
when a client prioritises less strong ciphers over the more strong
ones, which is beneficial when trying to achieve Perfect Forward
Secrecy.
2021-10-01 15:50:43 +03:00
Artem Boldariev
3b88d783a2 Add "ciphers" options to the "tls" clause
This commit adds support for setting TLS cipher list string in the
format specified in the OpenSSL
documentation (https://www.openssl.org/docs/man1.1.1/man1/ciphers.html).

The syntax of the cipher list is verified so that specifying the wrong
string will prevent the configuration from being loaded.
2021-10-01 15:50:43 +03:00
Artem Boldariev
f2ae4c8480 DH-parameters loading support
This commit adds support for loading DH-parameters (Diffie-Hellman
parameters) via the new "dhparam-file" option within "tls" clause. In
particular, Diffie-Hellman parameters are needed to enable the range
of forward-secrecy enabled cyphers for TLSv1.2, which are getting
silently disabled otherwise.
2021-10-01 15:50:43 +03:00
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