Commit graph

36472 commits

Author SHA1 Message Date
Artem Boldariev
a957511734 TLS: fix double resumption in isc__nm_tls_resumeread()
This commit fixes an obvious error in isc__nm_tls_resumeread() so that
read cannot be resumed twice.
2022-07-26 15:27:40 +03:00
Artem Boldariev
a165b66fc7 TLS: clear 'errno' when handling SSL status
Sometimes tls_do_bio() might be called when there is no new data to
process (most notably, when resuming reads), in such a case internal
TLS session state will remain untouched and old value in 'errno' will
alter the result of SSL_get_error() call, possibly making it to return
SSL_ERROR_SYSCALL. This value will be treated as an error, and will
lead to closing the connection, which is not what expected.
2022-07-26 15:27:40 +03:00
Mark Andrews
80f777ccfe Merge branch '3469-auto-disable-rsasha1-and-nsec3rsasha1-when-not-supported-by-the-os-v9_18' into 'v9_18'
Check that we can verify a signature at initialisation time [v9_18]

See merge request isc-projects/bind9!6614
2022-07-25 15:51:23 +00:00
Mark Andrews
676a6456e8 Add release note for [GL #3469]
(cherry picked from commit 16b133af407e7659f6c46a81aa58e1d7891249d4)
2022-07-25 10:59:38 -04:00
Mark Andrews
d0b48df8ea CHANGES note for [GL #3469]
(cherry picked from commit c549249cb9020fa2138e7c7411bc64ebd4839557)
2022-07-25 10:59:38 -04:00
Mark Andrews
f3a0dac057 Check that we can verify a signature at initialisation time
Fedora 33 doesn't support RSASHA1 in future mode.  There is no easy
check for this other than by attempting to perform a verification
using known good signatures.  We don't attempt to sign with RSASHA1
as that would not work in FIPS mode.  RSASHA1 is verify only.

The test vectors were generated using OpenSSL 3.0 and
util/gen-rsa-sha-vectors.c.  Rerunning will generate a new set of
test vectors as the private key is not preserved.

e.g.
	cc util/gen-rsa-sha-vectors.c -I /opt/local/include \
		-L /opt/local/lib -lcrypto

(cherry picked from commit cd3f00874f63a50954cebb78edac8f580a27c0de)
2022-07-25 10:59:38 -04:00
Matthijs Mekking
c3ab2a25ef Merge branch '3462-rndc-dumpdb-expired-doesnt-always-work-v9_18' into 'v9_18'
[v9_18] Fix rndc dumpdb -expired for stuck cache contents

See merge request isc-projects/bind9!6612
2022-07-25 14:54:30 +00:00
Matthijs Mekking
acdde6f0a4 Add change entry and release note for #3462
News worthy.

(cherry picked from commit 44bbc0175c5cd0df5c45b726464bcb82604d34ab)
2022-07-25 16:29:41 +02:00
Matthijs Mekking
56f1bf250d Fix rndc dumpdb -expired for stuck cache contents
The command 'rndc dumpdb -expired' will include expired RRsets in the
output, but only for the RBTDB_VIRTUAL time (of 5 minutes). This means
that if there is a cache cleaning problem and contents are not cleaned
up, the rndc command has little diagnostic value. Fix this by including
all RRsets in the dumpdb output if the '-expired' flag is set.

(cherry picked from commit 930ba2c914a0abc07fd087d663a7bfb57850d4ca)
2022-07-25 16:28:18 +02:00
Evan Hunt
78ea0a36a4 Merge branch '2918-deprecate-max-zone-ttl-v9_18' into 'v9_18'
dnssec-policy max-zone-ttl was not fully effective

See merge request isc-projects/bind9!6599
2022-07-22 20:34:16 +00:00
Evan Hunt
3c533374da CHANGES and release note for [GL #2918] 2022-07-22 13:13:43 -07:00
Evan Hunt
4720f13730 warn about zones with both dnssec-policy and max-zone-ttl
max-zone-ttl in zone/view/options is a no-op if dnssec-policy
is in use, so generate a warning.
2022-07-22 13:13:24 -07:00
Evan Hunt
a8e596e32c clarify "max-zone-ttl" documentation
The "max-zone-ttl" option should now be configured as part of
dnssec-policy. Use of this option in zone/view/options will be ignored
in any zone that also has dnssec-policy configured.
2022-07-22 13:13:24 -07:00
Matthijs Mekking
793554c6ce Reject zones with TTL higher than dnssec-policy max-zone-ttl
Reject loading of zones with TTL higher than the max-zone-ttl
from the dnssec-policy.

With this change, any zone with a dnssec-policy in use will ignore
the max-zone-ttl option in zone/view/options.
2022-07-22 13:13:24 -07:00
Matthijs Mekking
9c872756c3 Test dnssec-policy max-zone-ttl rejects zone with too high TTL
Similar to the 'max-zone-ttl' zone option, the 'dnssec-policy' option
should reject zones with TTLs that are out of range.
2022-07-22 13:13:24 -07:00
Arаm Sаrgsyаn
d8acad751e Merge branch '3419-dig-nssearch-query-failure-robustness-v9_18' into 'v9_18'
[v9_18] Fix DiG query error handling robustness in NSSEARCH mode

See merge request isc-projects/bind9!6609
2022-07-22 10:24:48 +00:00
Aram Sargsyan
525c0e9d38 Add CHANGES note for [GL #3419]
(cherry picked from commit e03897087256b394a5cbf6d8639410ed1bdc8451)
2022-07-22 09:41:53 +00:00
Aram Sargsyan
ab8343a5f6 dig +nssearch: send more queries even if setting up one of them fails
In the NSSEARCH followup lookup, when one of the queries fails to be
set up (UDP) or connected (TCP), DiG doesn't start the next query.
This is a mistake, because in NSSEARCH mode the queries are independent
and DiG shouldn't stop the lookup process just because setting up (or
connecting to) one of the name servers returns an error code in the
`udp_ready()` or `tcp_connected()` callbacks.

Write a new `nssearch_next()` function which takes care of starting the
next query in NSSEARCH mode, so it can be used in several places without
code repetition.

Make sure that the `udp_ready()` and `tcp_connected()` functions call
`nssearch_next()` in case they won't be calling `send_udp()` and
`send_tcp()` respectively, because in that case the `send_done()`
callback, which usually does the job, won't be called.

Refactor `send_done()` to use the newly written `nssearch_next()`
function.

(cherry picked from commit 76bee507b7415b176897b2fb1a3497bfb8ab194a)
2022-07-22 09:41:47 +00:00
Aram Sargsyan
8fecc9dc1e dig +nssearch: send more queries even if sending the previous one fails
In the NSSEARCH followup lookup, when one of the queries fails to be
sent, DiG doesn't start the next query. This is a mistake, because in
NSSEARCH mode the queries are independent and DiG shouldn't stop the
lookup process just because sending a query to one of the name servers
returns an error code.

Restructure the `send_done()` function to unconditionally send the next
query in NSSEARCH mode, if it exists.

(cherry picked from commit 49ac879dfad91ac08201be3e351450fd9d83b9f5)
2022-07-22 09:41:41 +00:00
Arаm Sаrgsyаn
5d47d4e342 Merge branch '3407-dighost-udp-fail-over-other-nameservers-v9_18' into 'v9_18'
[v9_18] Fix DiG UDP query retry and fail-over bug

See merge request isc-projects/bind9!6608
2022-07-22 09:37:53 +00:00
Aram Sargsyan
c0bb75e9ef Suppress warning/error comments in dig outputs for "rrsetorder" test
In the CI dig sometimes produces warning/error comments when
communicating with the server, which produces problems when comparing
the outputs.

Here is an example of a dig output with a warning message which
is benign, because dig, after a retry, managed to query the server.

;; communications error to 10.53.0.3#7529: timed out
1.2.3.1
1.2.3.2
1.2.3.3
1.2.3.4

When comparing this to the expected output, which doesn't contain
the comment line (starting with double ';'), the outputs don't match.

Use grep inverse logic to strip the comments from the dig outputs.

(cherry picked from commit a5b2aa7c977b5c40b62698a8f46ffd839b764814)
2022-07-22 09:03:54 +00:00
Aram Sargsyan
8bdc4e40de Add CHANGES note for [GL #3407]
(cherry picked from commit 1554faa47659d68dc6c48fe177faba95ba57adb7)
2022-07-22 09:03:39 +00:00
Aram Sargsyan
048a035267 Add "digdelv" test to simulate DiG network unreachable error
There are existing tests for simulating timeouts, read errors, and
refused connecion errors. Implement also "network unreachable"
simulation.

Use "fixed" string search mode `-F` for `grep` in more places where
it is appropriate to do so.

(cherry picked from commit 626fbf325e048158625d197cd9734da932f6011d)
2022-07-22 09:00:31 +00:00
Aram Sargsyan
29057d9911 DiG: use the same retry and fail-over logic for different failure types
DiG implements different logic in the `recv_done()` callback function
when processing a failure:

1. For a timed-out query it applies the "retries" logic first, then,
   when it fails, fail-overs to the next server.

2. For an EOF (end-of-file, or unexpected disconnect) error it tries to
   make a single retry attempt (even if the user has requested more
   retries), then, when it fails, fail-overs to the next server.

3. For other types of failures, DiG does not apply the "retries" logic,
   and tries to fail-over to the next servers (again, even if the user
   has requested to make retries).

Simplify the logic and apply the same logic (1) of first retries, and
then fail-over, for different types of failures in `recv_done()`.

(cherry picked from commit abfd0d363f4f495de00dc4bd41f74726370369ba)
2022-07-22 09:00:21 +00:00
Aram Sargsyan
6efb73d4bb Fix DiG query retry and fail-over bug
When the `send_done()` callback function gets called with a failure
result code, DiG erroneously cancels the lookup.

Stop canceling the lookup and give DiG a chance to retry the failed
query, or fail-over to another server, using the logic implemented in
the `recv_done()` callback function.

(cherry picked from commit c2329dd110e88a194be4d9a3fe1571dbae8af178)
2022-07-22 09:00:15 +00:00
Aram Sargsyan
be8ec6ef18 Fix DiG UDP query retry and fail-over bug
When the `udp_ready()` callback function gets called with a failure
result code, DiG erroneously cancels the lookup.

Copy the logic behind `tcp_connected()` callback function into
`udp_ready()` so that DiG will now retry the failed query (if retries
are enabled) and then, if it fails again, it will fail-over to the next
server in the list, which synchronizes the behavior between TCP and UDP
modes.

Also, `udp_ready()` was calling `lookup_detach()` without calling
`lookup_attach()` first, but the issue was masked behind the fact
that `clear_current_lookup()` wasn't being called when needed, and
`lookup_detach()` was compensating for that. This also has been fixed.

(cherry picked from commit 3f3108552577c326b4dab6c3b631c51cf0040144)
2022-07-22 09:00:08 +00:00
Petr Špaček
c003127717 Merge branch 'pspacek/arm-zombie-support-v9_18' into 'v9_18'
Support ancient build tools for the ARM [v9_18]

See merge request isc-projects/bind9!6605
2022-07-21 13:30:27 +00:00
Petr Špaček
c56bcbdb6a
Support Sphinx 1.6.7
Luckily we don't rely on SphinxDirective functionality which does not
exist in 1.6.7. Replace it with docutils Directive.

transform_content() callback was added only in Sphinx 3.0.0.
Detect if it was not called and call it manually.
The transform_content() function requires access to inner "contentnode"
which is created inside run(). This workaround relies on the order of
node as it was in the pre-3.0.0 versions, but it should not matter as
new versions will not trigger the workaround.

(cherry picked from commit 8796ad7fe8ed24d1287bfd94ef1ee283d778c047)
2022-07-21 15:26:26 +02:00
Petr Špaček
5864cac5d4
Support docutils 0.14+dfsg-4
Ancient versions of docutils cannot cope with bare text inside a table
cell. Wrap text in a paragraph to work around that.

(cherry picked from commit af5bbb433afca3bb600bd409c7421d33c3552aaa)
2022-07-21 15:26:22 +02:00
Petr Špaček
3818a87e95 Merge branch 'pspacek/minor-arm-tweaks-and-fixes-v9_18' into 'v9_18'
Fix dnssec-signzone examples in DNSSEC Guide [v9_18]

See merge request isc-projects/bind9!6603
2022-07-21 13:19:24 +00:00
Petr Špaček
d40615d881
Avoid opt-out flag in dnssec-signzone examples
Since !6413 we discourage opt-out, so we should not be advertising it in
the examples. Even worse, it was just thrown into the command line
without even mentioning its meaning in the surrounding text.

Related: !6413
(cherry picked from commit beae857288b52ee555bdf41491c5aa2eec390c10)
2022-07-21 15:18:55 +02:00
Petr Špaček
a927799e84
Remove errorneous shell output redirection from dnssec-signzone example
The > looked like shell output redirection. It was present since we
imported DNSSEC Guide into the ARM.

(cherry picked from commit 1ab564d605450cb2c473ded28ff5e8891a4df83b)
2022-07-21 15:18:50 +02:00
Michal Nowak
d4b00b1dc1 BIND 9.18.5
-----BEGIN PGP SIGNATURE-----
 
 iQJDBAABCgAtFiEENKwGS3ftSQfs1TU17QVz/8hFYQUFAmLG8fIPHG1pY2hhbEBp
 c2Mub3JnAAoJEO0Fc//IRWEFcDAP/1sbZd5p2vCh5T2guuEJX7x1kk/T9HkLKlTT
 UPNF/pIBzu7xG4oVxjNq74IiTEF5juUf8+YFBGah4woC+gfSmU9JF+4apLi5zjWk
 hJnS/51L1gu8/k4HNPGAvOg7wQq85g8OiM6AYjYxiYlCZUr5IT3elZxcHbdXQ2fL
 hcVy0NEEFYh+SK4ggra2cWrsH4GlqwCeYY6eZmJKCXGdaZVH24eq6LuGzjg164AA
 t27x+IGdcOdBK4ewN3CfgWBUpIPGkOltVMLHbB+gDJIWFz4VYJZGpUfVDIDEMLbB
 JyQBX2Vbls0048dDON0XiXm2W/kZceBx2wiJ94qhN1/aEsv4RNcUZrKy7cTgSR67
 Jrn3Y3mVd1d4+AHFeWjsksX5qe1YgMkhZMmMttUGWVl2eqQN5IJ1uahgSumPOPGc
 hFkSObqt9/GiuEkBq3gCdgdkRsde8yuicbXdj70cTxkbPEV70vSryUszoY1lUPfX
 U+mnFHQge0CId8cgAAiwzsKqCbH0VbSRzKjXb4+LrQcGdNtB5oK8LJVTijlQsSs3
 tDOkQ6v2Lamc8/XmoQmRSdXXM7O6Ty8+rNcXOsCgOs18VjFtn4oiuXegtmhGFagN
 IQkjbqxq2989bfUB4TOGood7O7jHM27w3dNeif/pxYIqZopOg7VFeKvEQGw7gOWT
 1VilTCi7
 =5Ea3
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEIz+ZTe/bbr1Q+/5RJKPoRjruXlYFAmLZKwMACgkQJKPoRjru
 XlbyJxAAjlBU7u1jZShfJuK34h4vl9n3uNC9DUQ5rEo1YFiV7XPcAc2HoaoCFJXn
 BMxsxme42fMI+LFzeuyPvNNruJQXv8Vz2mz/QQqoijr9xaWRdSh/9Eo3uXrQg/A7
 ZJvjF5QXIee5MUwJXbS/K4aSU0OxA6KZ1GUSU5mSOxb32gFtXJr3tL9rIqtYhIeY
 QBZOk8fBfdvcMjREGeuBtf+5HSf9XghnDzDDV8VkN+jz2+Ae48eNm4n231DUlH8B
 NN2SaxfFd9CaKr9/nDSipKbtcAL/WVTkvTNT8UBMIgpbQSimRwKwpgGhhM2sh7KL
 Ia/8ZEGD+bfYM0Rl+EUxDBsLRR4/b3Mg6jqoRbjLUGmOa7rGD3KVijL9x5Rzvamq
 E8e4XCja6GyBxyopN3fc3xe7G0tAsI8mNfL00pPaFzK8VuhjrnrD3mshvJJqfyxQ
 THD2aRxTu7FXUQpeF5wq1DCEqT2tSk0XNlqptZ+O3uaNXTEZMGQTrroTn5QUwNLA
 4NUfWcV+yk4wBZIA4IGfQNiWFj7MPpC5FyD5AYKjFpx6XHSABECNQfjQvm82lQBE
 k800cqVTh2Ps8xXE9edZRQZNzQ9H1pt559axtaybBRFxXovHCxfXpJK6ov5zy2q+
 FgrSnqKmymOtRgfmUHV9f+zQuO88GJvRusnGCkd9lakmwtJO61k=
 =dajA
 -----END PGP SIGNATURE-----

Merge tag 'v9_18_5' into v9_18

BIND 9.18.5
2022-07-21 12:31:03 +02:00
Michał Kępień
98258e21b5 Merge branch 'michal/run-a-short-respdiff-test-for-all-merge-requests-v9_18' into 'v9_18'
[v9_18] Run a short respdiff test for all merge requests

See merge request isc-projects/bind9!6590
2022-07-18 13:33:49 +00:00
Michał Kępień
f3e647a4c1 Run a short respdiff test for all merge requests
Running a respdiff test for every merge request would be useful for
catching protocol-breaking changes before they are applied to the source
code.  However, the existing respdiff-based tests take a while to
complete (about half an hour with our current CI infrastructure), which
does not make them a good fit for this purpose.  Add a new GitLab CI
job, "respdiff-short", which uses a smaller query set that gets
processed within a couple of minutes on our current CI infrastructure.
Rename the existing respdiff-based jobs to make distinguishing them
easier.

(cherry picked from commit 31ee43a314f17b433909a049fafa01200bac14ca)
2022-07-18 15:25:17 +02:00
Michał Kępień
82b6a388fc Extract respdiff job definition to a YAML anchor
Ensure the common parts of all jobs using respdiff are available in the
form of a reusable YAML anchor, to reduce code duplication and to
simplify adding more respdiff-based jobs to GitLab CI.

(cherry picked from commit ca20a189f7c020e67feebcabd436a02e69272164)
2022-07-18 15:25:17 +02:00
Michał Kępień
7d02e1088c Use a pre-built executable as the reference named
The "respdiff" GitLab CI job compares DNS responses produced by the
current version of named with those produced by a reference version.
The latter is built from source in each "respdiff" job, despite the fact
that the reference version changes very rarely.  Use a pre-built named
executable as the reference version instead, assuming it is available in
the OS image used for "respdiff" tests.

(cherry picked from commit ab90a4705a13d1a5040bb361e20ff63b5d47d875)
2022-07-18 15:25:17 +02:00
Ondřej Surý
116b825b8d Merge branch '3453-cope-with-too-small-BUFSIZ-v9_18' into 'v9_18'
Increase the BUFSIZ-long buffers [v9.18]

See merge request isc-projects/bind9!6586
2022-07-15 20:40:03 +00:00
Ondřej Surý
3c1d6e164e
Increase the BUFSIZ-long buffers
The BUFSIZ value varies between platforms, it could be 8K on Linux and
512 bytes on mingw.  Make sure the buffers are always big enough for the
output data to prevent truncation of the output by appropriately
enlarging or sizing the buffers.

(cherry picked from commit b19d932262e84608174cb89eeed32ae0212f8a87)
2022-07-15 21:16:51 +02:00
Michał Kępień
c447008196 Merge branch '3443-memory-related-cleanups-v9_18' into 'v9_18'
[v9_18] Memory-related cleanups

See merge request isc-projects/bind9!6568
2022-07-15 08:36:18 +00:00
Michał Kępień
93ded5cca2 Update documentation for named's -M option
Remove "external" from the list of legal values for the -M command-line
option as it has not been allowed since the internal memory allocator
was removed by commit 55ace5d3aa.

Make the style of the relevant paragraph more in line with the next one
and split its contents up into an unordered list of options for improved
readability.

(cherry picked from commit f0c31ceb3ba7364aa0478adf17c43ef700270a76)
2022-07-15 10:31:53 +02:00
Evan Hunt
ba16ff2da5 Merge branch '3456-dispatch-connect-race-v9_18' into 'v9_18'
remove unnecessary assertion in dns_dispatch_connect()

See merge request isc-projects/bind9!6584
2022-07-15 04:18:05 +00:00
Evan Hunt
7903bffbc4 remove unnecessary assertion in dns_dispatch_connect()
When a thread calls dns_dispatch_connect() on an unconnected TCP socket
it sets `tcpstate` from `DNS_DISPATCHSTATE_NONE` to `_CONNECTING`.
Previously, it then INSISTed that there were no pending connections
before calling isc_nm_tcpdnsconnect().

If a second thread called dns_dispatch_connect() during that window
of time, it could add a pending connection to the list, and trigger
an assertion failure.

This commit removes the INSIST since the condition is actually
harmless.

(cherry picked from commit 25ddec8a0a8e0549b69f4e601028f3323d3c1886)
2022-07-14 19:27:24 -07:00
Ondřej Surý
93757acfe5 Merge branch 'ondrej-fix-timing-error-in-statistics-system-test-v9_18' into 'v9_18'
Wait for TCP connection refused in the statistics system test [v9.18]

See merge request isc-projects/bind9!6583
2022-07-14 20:53:10 +00:00
Ondřej Surý
c6b4d82557
Wait for TCP connection refused in the statistics system test
The statistics system test makes a query to foo.info to check for the
pending connections because the ans4 doesn't respond to the query.

This might or might not (depending on exact timing) increment the failed
TCP connection counter when the query is retried over TCP because ans4
doesn't listen on the TCP.

Wait for the 'connection refused' in the ns3 log file to be able to
count the exactly 1 failed TCP connection.

(cherry picked from commit 0227d82dc849182c6f8a74ee3d406cca72d0f6a1)
2022-07-14 22:34:08 +02:00
Ondřej Surý
54ec179723 Merge branch '3451-handle-transient-TCP-connect-EADDRINUSE-on-BSDs-v9_18' into 'v9_18'
Handle the transient TCP connect() failures on FreeBSD [v9.18]

See merge request isc-projects/bind9!6582
2022-07-14 20:13:12 +00:00
Ondřej Surý
c79ee8daa1
Add CHANGES note for [GL #3451]
(cherry picked from commit a9c54ecdc6c53f3c23ad2ce6c45f0ed9296ae464)
2022-07-14 21:48:48 +02:00
Ondřej Surý
d242ced18f
Cleanup the STATID_CONNECT and STATID_CONNECTFAIL stat counters
The STATID_CONNECT and STATID_CONNECTFAIL statistics were used
incorrectly. The STATID_CONNECT was incremented twice (once in
the *_connect_direct() and once in the callback) and STATID_CONNECTFAIL
would not be incremented at all if the failure happened in the callback.

Closes: #3452
(cherry picked from commit 59e1703b50dc4a5c52e3d6ae13bdd873a677b03f)
2022-07-14 21:48:44 +02:00
Ondřej Surý
259f4481bd
Handle the transient TCP connect() failures on FreeBSD
On FreeBSD (and perhaps other *BSD) systems, the TCP connect() call (via
uv_tcp_connect()) can fail with transient UV_EADDRINUSE error.  The UDP
code already handles this by trying three times (is a charm) before
giving up.  Add a code for the TCP, TCPDNS and TLSDNS layers to also try
three times before giving up by calling uv_tcp_connect() from the
callback two more time on UV_EADDRINUSE error.

Additionally, stop the timer only if we succeed or on hard error via
isc__nm_failed_connect_cb().

(cherry picked from commit b21f507c0ac5b5d2d2c27fd2d71e27e8605dd5fc)
2022-07-14 21:47:47 +02:00
Mark Andrews
5ba1038a1b Merge branch '3447-lib-dns-tkey-c-free_namelist-should-be-disassociating-associated-rdatatsets-v9_18' into 'v9_18'
disassociate rdatasets when cleaning up [v9_18]

See merge request isc-projects/bind9!6577
2022-07-14 00:58:59 +00:00