Commit graph

34325 commits

Author SHA1 Message Date
Mark Andrews
ed4e00713f Check opcode of messages returned by dns_request_getresponse 2021-07-20 15:17:32 +10:00
Michal Nowak
42492890a7 Merge branch 'mnowak/process-core-dumps-when-named-fails-to-start' into 'main'
Process core dump from named which failed to start

See merge request isc-projects/bind9!4987
2021-07-16 16:13:54 +00:00
Michal Nowak
a39697635b
Fix handling of restart option in run.sh
The support for stat.pl's --restart option was incomplete in run.sh.
This change makes sure it's handled properly and that named.run file is
not being removed by clean.sh when the --restart option is used.
2021-07-16 16:37:57 +02:00
Michal Nowak
bc097d3358
Process core dump from named which failed to start
When named failed to start and produced core dump, the core file wasn't
processed by GDB because of run.sh script exiting immediately. This
remedies the limitation, simplifies the surrounding code, and makes the
script shellcheck clean.
2021-07-16 16:37:57 +02:00
Michal Nowak
4339831e54 Merge branch 'mnowak/replace-literal-blocks-with-anchors' into 'main'
Use anchors instead of literal blocks in .gitlab-ci.yml

See merge request isc-projects/bind9!4742
2021-07-16 14:21:36 +00:00
Michal Nowak
c22008629e
Use anchors instead of literal blocks in .gitlab-ci.yml
Anchor lets the user see the full command logged in GitLab CI:

    ${CONFIGURE} --disable-maintainer-mode --enable-developer ...

Instead of a folded multi-line when literal block is used:

    ${CONFIGURE} \ # collapsed multi-line command
2021-07-16 12:15:01 +02:00
Artem Boldariev
5f2b69a038 Merge branch 'artem/doh-quota-integration' into 'main'
Make DoH-quota separate and configurable, make it possible to limit the number of HTTP/2 streams per connection

See merge request isc-projects/bind9!5036
2021-07-16 09:41:01 +00:00
Artem Boldariev
87f79a67f2 Add a missing break on error when adding a DoH endpoint
The break on error when adding a DoH endpoint was implied but somehow
gotten missed. This commit fixes that.
2021-07-16 11:50:22 +03:00
Artem Boldariev
f5614be9df Update documentation to include the new HTTP configuration options
Documentation for the new DoH options has been added.
2021-07-16 11:50:22 +03:00
Artem Boldariev
3773802f20 Add a system test that tests connections quota for DoH
The system tests stress out the DoH quota by opening many TCP
connections and then running dig instances against the "overloaded"
server to perform some queries. The processes cannot make any
resolutions because the quota is exceeded. Then the opened connections
are getting closed in random order allowing the queries to proceed.
2021-07-16 11:50:22 +03:00
Artem Boldariev
ac9ce6f446 modify CHANGES [GL #2809]
Document the new HTTP specific options in the CHANGES file.
2021-07-16 11:50:22 +03:00
Artem Boldariev
147da54e13 Update grammar reference documentation
This commit updates the named grammar reference according to the
latest changes.
2021-07-16 11:50:22 +03:00
Artem Boldariev
590e8e0b86 Make max number of HTTP/2 streams configurable
This commit makes number of concurrent HTTP/2 streams per connection
configurable as a mean to fight DDoS attacks. As soon as the limit is
reached, BIND terminates the whole session.

The commit adds a global configuration
option (http-streams-per-connection) which can be overridden in an
http <name> {...} statement like follows:

http local-http-server {
    ...
    streams-per-connection 100;
    ...
};

For now the default value is 100, which should be enough (e.g. NGINX
uses 128, but it is a full-featured WEB-server). When using lower
numbers (e.g. ~70), it is possible to hit the limit with
e.g. flamethrower.
2021-07-16 11:50:22 +03:00
Artem Boldariev
03a557a9bb Add (http-)listener-clients option (DoH quota mechanism)
This commit adds support for http-listener-clients global options as
well as ability to override the default in an HTTP server description,
like:

http local-http-server {
    ...
    listener-clients 100;
    ...
};

This way we have ability to specify per-listener active connections
quota globally and then override it when required. This is exactly
what AT&T requested us: they wanted a functionality to specify quota
globally and then override it for specific IPs. This change
functionality makes such a configuration possible.

It makes sense: for example, one could have different quotas for
internal and external clients. Or, for example, one could use BIND's
internal ability to serve encrypted DoH with some sane quota value for
internal clients, while having un-encrypted DoH listener without quota
to put BIND behind a load balancer doing TLS offloading for external
clients.

Moreover, the code no more shares the quota with TCP, which makes
little sense anyway (see tcp-clients option), because of the nature of
interaction of DoH clients: they tend to keep idle opened connections
for longer periods of time, preventing the TCP and TLS client from
being served. Thus, the need to have a separate, generally larger,
quota for them.

Also, the change makes any option within "http <name> { ... };"
statement optional, making it easier to override only required default
options.

By default, the DoH connections are limited to 300 per listener. I
hope that it is a good initial guesstimate.
2021-07-16 11:50:20 +03:00
Artem Boldariev
0aac2d094a Merge branch 'artem/doh-http-path-validation' into 'main'
Verify HTTP paths both in incoming requests and in config file

See merge request isc-projects/bind9!5231
2021-07-16 07:51:43 +00:00
Artem Boldariev
dac3e4abc9 Update CHANGES
The CHANGES file was updated to include information that configuration
checking code now verifies HTTP paths properly.
2021-07-16 10:28:28 +03:00
Artem Boldariev
954240467d Verify HTTP paths both in incoming requests and in config file
This commit adds the code (and some tests) which allows verifying
validity of HTTP paths both in incoming HTTP requests and in BIND's
configuration file.
2021-07-16 10:28:08 +03:00
Michał Kępień
40aba825ae Merge branch '2759-extend-tests-for-signed-cname-sourced-delegations' into 'main'
Extend tests for signed, CNAME-sourced delegations

Closes #2759

See merge request isc-projects/bind9!5272
2021-07-16 05:23:15 +00:00
Michał Kępień
a14efdf54c Extend tests for signed, CNAME-sourced delegations
Extend the "chain" system test with AUTHORITY section checks for signed,
secure delegations.  This complements the checks for signed, insecure
delegations added by commit 26ec4b9a89.

Extend the existing AUTHORITY section checks for signed, insecure
delegations to ensure nonexistence of DS RRsets in such responses.
Adjust comments accordingly.

Ensure dig failures cause the "chain" system test to fail.
2021-07-16 07:20:15 +02:00
Michał Kępień
29d8d35869 Tweak query_addds() comments to avoid confusion
It has been noticed that commit 7a87bf468b
did not only fix NSEC record handling in signed, insecure delegations
prepared using both wildcard expansion and CNAME chaining - it also
inadvertently fixed DS record handling in signed, secure delegations
of that flavor.  This is because the 'rdataset' variable in the relevant
location in query_addds() can be either a DS RRset or an NSEC RRset.
Update a code comment in query_addds() to avoid confusion.

Update the comments describing the purpose of query_addds() so that they
also mention NSEC(3) records.
2021-07-16 07:20:15 +02:00
Mark Andrews
ddacc7e1b2 Merge branch '2820-rndc-reconfig-does-not-act-on-change-to-zone-statistics' into 'main'
Resolve "rndc reconfig does not act on change to zone-statistics"

Closes #2820

See merge request isc-projects/bind9!5271
2021-07-16 04:09:53 +00:00
Mark Andrews
f2461afff7 Add CHANGES for [GL #2820] 2021-07-16 13:49:22 +10:00
Mark Andrews
616896d735 zone->requeststats_on was not being set at the correct point 2021-07-16 13:49:22 +10:00
Mark Andrews
592f9ff6bc Test that 'zone-statistics full;' is properly processed 2021-07-16 13:49:22 +10:00
Matthijs Mekking
02c3a2decc Merge branch '2710-multisigner-cds' into 'main'
Allow update CDS/CDNSKEY records that do not match DNSKEY

Closes #2710

See merge request isc-projects/bind9!5270
2021-07-15 07:24:09 +00:00
Matthijs Mekking
ba5869943d Add change and release notes [#2710] 2021-07-15 08:32:16 +02:00
Matthijs Mekking
577bf913b9 Relax zone_cdscheck function
If we have a CDS or CDNSKEY we at least need to have a DNSKEY with the
same algorithm published and signing the CDS RRset. Same for CDNSKEY
of course.

This relaxes the zone_cdscheck function, because before the CDS or
CDNSKEY had to match a DNSKEY, now only the algorithm has to match.

This allows a provider in a multisigner model to update the CDS/CDNSKEY
RRset in the zone that is served by the other provider.
2021-07-14 12:10:11 -07:00
Matthijs Mekking
6b79db1fdd Add test for allowing update CDS/CDNSKEY
Add tests to the nsupdate system test to make sure that CDS and/or
CDNSKEY that match an algorithm in the DNSKEY RRset are allowed. Also
add tests that updates are rejected if the algorithm does not match.

Remove the now redundant test cases from the dnssec system test.

Update the checkzone system test: Change the algorithm of the CDS and
CDNSKEY records so that the zone is still rejected.
2021-07-14 12:10:11 -07:00
Evan Hunt
2292b48c2a Merge branch 'each-doc-trampoline' into 'main'
document isc__trampoline

See merge request isc-projects/bind9!5116
2021-07-14 17:59:28 +00:00
Evan Hunt
4f6e2317e9 document isc__trampoline
Added some header file documentation to the isc__trampoline
implementation in trampoline_p.h.
2021-07-14 10:55:12 -07:00
Artem Boldariev
9a7d2000e6 Merge branch 'artem/doh-empty-query-string-crash-fix' into 'main'
Fix crash in DoH on empty query string in GET requests

See merge request isc-projects/bind9!5268
2021-07-13 13:55:30 +00:00
Artem Boldariev
3e3c944d2e Add CHANGES for [GL !5268]
The commit updates the CHANGES file adding a note about a crash caused
by improper handling of DoH GET requests.
2021-07-13 16:54:25 +03:00
Artem Boldariev
64cd7e8a7f Fix crash in DoH on empty query string in GET requests
An unhandled code path left GET query string data uninitialised (equal
to NULL) and led to a crash during the requests' base64 data
decoding. This commit fixes that.
2021-07-13 16:53:51 +03:00
Ondřej Surý
1c5d033576 Merge branch '2822-inconsistent-recursive-performance' into 'main'
Disable setting the thread affinity

Closes #2822

See merge request isc-projects/bind9!5265
2021-07-13 13:50:53 +00:00
Ondřej Surý
41afe6bc5e Add CHANGES and release notes for [GL #2822] 2021-07-13 15:44:08 +02:00
Ondřej Surý
4c5dc1904b Disable the cpu system test
As we don't set the thread affinity, the cpu test would consistently
fail.  Disable it, but don't remove it as we might restore setting the
affinity in the future versions of BIND 9.
2021-07-13 14:48:29 +02:00
Ondřej Surý
a9e6a7ae57 Disable setting the thread affinity
It was discovered that setting the thread affinity on both the netmgr
and netthread threads lead to inconsistent recursive performance because
sometimes the netmgr and netthread threads would compete over single
resource and sometimes not.

Removing setting the affinity causes a slight dip in the authoritative
performance around 5% (the measured range was from 3.8% to 7.8%), but
the recursive performance is now consistently good.
2021-07-13 14:48:29 +02:00
Ondřej Surý
a92a89f4fa Merge branch '2815-increase-sizeinfo-memory-alignment-on-OpenBSD' into 'main'
Use max_align_t for memory sizeinfo alignment on OpenBSD

Closes #2815

See merge request isc-projects/bind9!5267
2021-07-13 12:00:01 +00:00
Ondrej Sury
6eca4b402e Use max_align_t for memory sizeinfo alignment on OpenBSD
On OpenBSD and more generally on platforms without either jemalloc or
malloc_(usable_)size, we need to increase the alignment for the memory
to sizeof(max_align_t) as with plain sizeof(void *), the compiled code
would be crashing when accessing the returned memory.
2021-07-13 13:48:33 +02:00
Matthijs Mekking
97e1a1f929 Merge branch '2811-checkds-memleak-shutdown' into 'main'
Fix leak in checkds code

Closes #2811

See merge request isc-projects/bind9!5262
2021-07-13 09:50:33 +00:00
Matthijs Mekking
2ccf342690 Add change entry for [#2811] 2021-07-13 11:12:37 +02:00
Matthijs Mekking
b676163933 Fix leak in checkds code
In 'checkds_send_toaddr' there is a goto bug that causes the TSIG key
and DNS message to not be detached. Remove the offending goto statement.
2021-07-13 11:12:37 +02:00
Ondřej Surý
ef467a5a7c Merge branch '2819-cache-the-isc_os_ncpu-result' into 'main'
Cache the isc_os_ncpu() result

Closes #2819

See merge request isc-projects/bind9!5263
2021-07-13 07:55:51 +00:00
Ondrej Sury
23751fe252 Cache the isc_os_ncpu() result
It was discovered that on some platforms (f.e. Alpine Linux with MUSL)
the result of isc_os_ncpus() call differ when called before and after we
drop privileges.  This commit changes the isc_os_ncpus() call to cache
the result from the first call and thus always return the same value
during the runtime of the named.  The first call to isc_os_ncpus() is
made as soon as possible on the library initalization.
2021-07-13 09:12:04 +02:00
Ondřej Surý
e04d69533d Merge branch '2816-mem-c-739-2-runtime-error-null-pointer-returned-from-function-declared-to-never-return-null' into 'main'
Remove nonnull attribute from isc_mem_{get,allocate,reallocate}

Closes #2816

See merge request isc-projects/bind9!5261
2021-07-12 08:23:40 +00:00
Ondřej Surý
b9722ce98f Merge branch '2815-crashes-related-to-memory-reallocation-on-openbsd' into 'main'
Fix the real allocation size in OpenBSD rallocx shim

Closes #2815

See merge request isc-projects/bind9!5260
2021-07-12 08:06:09 +00:00
Ondřej Surý
ce03015d48 Remove nonnull attribute from isc_mem_{get,allocate,reallocate}
The isc_mem_get(), isc_mem_allocate() and isc_mem_reallocate() can
return NULL ptr in case where the allocation size is NULL.  Remove the
nonnull attribute from the functions' declarations.

This stems from the following definition in the C11 standard:

> If the size of the space requested is zero, the behavior is
> implementation-defined: either a null pointer is returned, or the
> behavior is as if the size were some nonzero value, except that the
> returned pointer shall not be used to access an object.

In this case, we return NULL as it's easier to detect errors when
accessing pointer from zero-sized allocation which should obviously
never happen.
2021-07-12 10:02:18 +02:00
Ondřej Surý
d1a9e549b1 Fix the real allocation size in OpenBSD rallocx shim
In the rallocx() shim for OpenBSD (that's the only platform that doesn't
have malloc_size() or malloc_usable_size() equivalent), the newly
allocated size was missing the extra size_t member for storing the
allocation size leading to size_t sized overflow at the end of the
reallocated memory chunk.
2021-07-12 08:43:14 +02:00
Mark Andrews
592a4bc456 Merge branch '2703-gcc-10-fanalyzer-reports-dereference-of-null-text-in-server-c-14721' into 'main'
Resolve "gcc-10+ -fanalyzer reports dereference of NULL ‘text’ in server.c:14721"

Closes #2703

See merge request isc-projects/bind9!5047
2021-07-12 04:28:50 +00:00
Mark Andrews
ac0fc3c2de Add DBC REQUIRE to check that 'text' is non NULL
for all control channel commands.  This should silence
gcc-10-analyzer reporting NULL pointer dereference of 'text'.
2021-07-12 03:55:37 +00:00