Commit Graph

35741 Commits

Author SHA1 Message Date
Aram Sargsyan
f64cd23e7b Add digdelv system test to check timed-out result followed by a SERVFAIL
This test ensures that `dig` retries with another attempt after a
timed-out request, and that it does not crash when the retried
request returns a SERVFAIL result. See [GL #3020] for the latter
issue.

(cherry picked from commit 3ec5d2d6ed)
2022-03-18 08:29:13 +00:00
Aram Sargsyan
1e17d5a130 Add CHANGES note for [GL #3020]
(cherry picked from commit e353700189)
2022-03-18 08:28:42 +00:00
Aram Sargsyan
58685cd573 When resending a UDP request, insert the query to the lookup's list
When a query times out, and `dig` (or `host`) creates a new query
to resend the request, it is being prepended to the lookup's queries
list, which can cause a confusion later, making `dig` (or `host`)
believe that there is another new query in the list, but that is
actually the old one, which was timed out. That mistake will result
in an assertion failure.

That can happen, in particular, when after a timed out request,
the retried request returns a SERVFAIL result, and the recursion
is enabled, and `+nofail` option was used with `dig` (that is the
default behavior in `host`, unless the `-s` option is provided).

Fix the problem by inserting the query just after the current,
timed-out query, instead of prepending to the list.

Before calling start_udp() detach `l->current_query`, like it is
done in another place in the function.

Slightly update a couple of debug messages to make them more
consistent.

(cherry picked from commit a962475948)
2022-03-18 08:27:07 +00:00
Aram Sargsyan
b6bd2a5311 Fix an issue in dig when retrying with the next server after SERVFAIL
After a query results in a SERVFAIL result, and there is another
registered query in the lookup's queries list, `dig` starts the next
query to try another server, but for some reason, reports about that
also when the current query is in the head of the list, even if there
is no other query in the list to try.

Use the same condition for both decisions, and after starting the next
query, jump to the "detach_query" label instead of "next_lookup",
because there is no need to start the next lookup after we just started
a query in the current lookup.

(cherry picked from commit e888c62fbd)
2022-03-18 08:27:00 +00:00
Ondřej Surý
3d27a75eca Merge branch '3208-fix-xfrout-maxtimer-timer-log-message-log-level-v9_18' into 'v9_18'
Change xfer-out timer message log level to DEBUG(1)

See merge request isc-projects/bind9!5996
2022-03-17 20:40:26 +00:00
Ondřej Surý
5e253fd629 Change xfer-out timer message log level to DEBUG(1)
When max-transfer-*-out timeouts were reintroduced, the log message
about starting the timer was errorneously left as ISC_LOG_ERROR.
Change the log level of said message to ISC_LOG_DEBUG(1).

(cherry picked from commit 8f6e4dfa15)
2022-03-17 21:38:24 +01:00
Ondřej Surý
c965b315c5 Merge branch 'ondrej/add-missing-braces-clang-format-15-v9_18' into 'v9_18'
Add couple missing braces around single-line statements [v9.18]

See merge request isc-projects/bind9!5969
2022-03-17 19:42:49 +00:00
Ondřej Surý
485a2b329e Add couple missing braces around single-line statements
The clang-format-15 has new option InsertBraces that could add missing
branches around single line statements.  Use that to our advantage
without switching to not-yet-released LLVM version to add missing braces
in couple of places.
2022-03-17 18:29:57 +01:00
Michał Kępień
d5cf60ab3d Merge branch 'v9_18_1-release' into 'v9_18'
Merge 9.18.1 release branch

See merge request isc-projects/bind9!5990
2022-03-16 22:36:26 +00:00
Michał Kępień
cc59e6fd3f Set up release notes for BIND 9.18.2 2022-03-16 23:18:18 +01:00
Michał Kępień
bd24843fa7 Update BIND version to 9.18.1 2022-03-16 23:18:18 +01:00
Michał Kępień
d76bab0c8c Add a CHANGES marker 2022-03-16 23:18:18 +01:00
Michał Kępień
6b5f682ff1 Merge branch 'michal/prepare-documentation-for-bind-9.18.1' into 'security-v9_18'
Prepare documentation for BIND 9.18.1

See merge request isc-private/bind9!392
2022-03-16 23:18:18 +01:00
Michał Kępień
29eee12ccb Merge branch '3129-check-fetch-shutting-down-in-resume_dslookup-v9_18' into 'security-v9_18'
[CVE-2022-0667] [v9_18] Check if the fetch is shutting down in resume_dslookup()

See merge request isc-private/bind9!379
2022-03-16 23:18:18 +01:00
Michał Kępień
2841d81160 Prepare release notes for BIND 9.18.1 2022-03-16 23:18:18 +01:00
Michał Kępień
4158b69eb0 Merge branch '3158-confidential-issue-only-set-foundname-on-success-v9_18' into 'security-v9_18'
[v9_18] [CVE-2022-0635] DNAME lookups can trigger INSIST when synth-from-dnssec is enabled

See merge request isc-private/bind9!391
2022-03-16 23:18:18 +01:00
Aram Sargsyan
897e332b6c Add CHANGES and release note for [GL #3129] 2022-03-16 23:18:18 +01:00
Michał Kępień
4f51dc7408 Reorder release notes 2022-03-16 23:18:18 +01:00
Michał Kępień
a64496ef02 Merge branch '3112-ensure-correct-ordering-in-isc__nm_process_sock_buffer-v9_18' into 'security-v9_18'
[CVE-2022-0396] [v9_18] Resolve #3112 TCP sockets stuck in CLOSE_WAIT

See merge request isc-private/bind9!375
2022-03-16 23:18:18 +01:00
Mark Andrews
4a23672009 Add CHANGES and release note for [GL #3158] 2022-03-16 23:18:18 +01:00
Aram Sargsyan
09ec28dc9e Check if the fetch is shutting down in resume_dslookup()
The fetch can be in the shutting down state when resume_dslookup() is
trying to operate on it.

This is also a security issue, because a malicious actor can set up a
name server which delays certain queries in such a way that the fetch
will time out and shut down, which will cause named to crash.

Add a check to see if the fetch has the shutting down attribute set,
and cancel any further operations on it in such case.

A similar bug had been fixed earlier for the resume_qmin() function,
see [GL #966].
2022-03-16 23:18:18 +01:00
Michał Kępień
305c5bb5fa Tweak and reword release notes 2022-03-16 23:18:18 +01:00
Michał Kępień
f4a911ea5f Merge branch '2950-confidential-cache-acceptance-rules-v9_18' into 'security-v9_18'
[CVE-2021-25220] [v9_18] prevent cache poisoning from forwarder responses

See merge request isc-private/bind9!382
2022-03-16 23:18:18 +01:00
Ondřej Surý
4a025c19b9 Add CHANGES and release note for [GL #3112] 2022-03-16 23:18:18 +01:00
Mark Andrews
bc8f721d59 Skip calling find_coveringnsec if we found a DNAME
This is an optimisation as we can skip a lot of pointless work when we
know there is a DNAME there.

When we have a partial match and a DNAME above the QNAME, the closest
encloser has the same owner as the DNAME, will have the DNAME bit set
in the type map, and we wouldn't use it as we would return the
DNAME + RRSIG(DNAME) instead.

So there is no point in looking for it nor in attempting to check that
it is valid for the QNAME.
2022-03-16 23:18:18 +01:00
Michał Kępień
ddd5c6aace Fix typo in CHANGES 2022-03-16 23:18:18 +01:00
Petr Špaček
1e11351d50 Add Release Note for [GL #2950] 2022-03-16 23:18:18 +01:00
Ondřej Surý
6ec223a539 Run .closehandle_cb asynchrounosly in nmhandle_detach_cb()
When sock->closehandle_cb is set, we need to run nmhandle_detach_cb()
asynchronously to ensure correct order of multiple packets processing in
the isc__nm_process_sock_buffer().  When not run asynchronously, it
would cause:

  a) out-of-order processing of the return codes from processbuffer();

  b) stack growth because the next TCP DNS message read callback will
     be called from within the current TCP DNS message read callback.

The sock->closehandle_cb is set to isc__nm_resume_processing() for TCP
sockets which calls isc__nm_process_sock_buffer().  If the read callback
(called from isc__nm_process_sock_buffer()->processbuffer()) doesn't
attach to the nmhandle (f.e. because it wants to drop the processing or
we send the response directly via uv_try_write()), the
isc__nm_resume_processing() (via .closehandle_cb) would call
isc__nm_process_sock_buffer() recursively.

The below shortened code path shows how the stack can grow:

 1: ns__client_request(handle, ...);
 2: isc_nm_tcpdns_sequential(handle);
 3: ns_query_start(client, handle);
 4:   query_lookup(qctx);
 5:     query_send(qctcx->client);
 6:       isc__nmhandle_detach(&client->reqhandle);
 7:         nmhandle_detach_cb(&handle);
 8:           sock->closehandle_cb(sock); // isc__nm_resume_processing
 9:             isc__nm_process_sock_buffer(sock);
10:               processbuffer(sock); // isc__nm_tcpdns_processbuffer
11:                 isc_nmhandle_attach(req->handle, &handle);
12:                 isc__nm_readcb(sock, req, ISC_R_SUCCESS);
13:                   isc__nm_async_readcb(NULL, ...);
14:                     uvreq->cb.recv(...); // ns__client_request

Instead, if 'sock->closehandle_cb' is set, we need to run detach the
handle asynchroniously in 'isc__nmhandle_detach', so that on line 8 in
the code flow above does not start this recursion. This ensures the
correct order when processing multiple packets in the function
'isc__nm_process_sock_buffer()' and prevents the stack growth.

When not run asynchronously, the out-of-order processing leaves the
first TCP socket open until all requests on the stream have been
processed.

If the pipelining is disabled on the TCP via `keep-response-order`
configuration option, named would keep the first socket in lingering
CLOSE_WAIT state when the client sends an incomplete packet and then
closes the connection from the client side.
2022-03-16 23:18:18 +01:00
Mark Andrews
1d32fbcd34 Only update foundname if returning DNS_R_COVERINGNSEC
'setup_delegation' depends on 'foundname' being the value returned
by 'dns_rbt_findnode' in the cache and 'find_coveringnsec' was
modifying 'foundname' when a covering NSEC was not found.
2022-03-16 23:18:18 +01:00
Michał Kępień
5a7c04b520 Remove outdated release notes 2022-03-16 23:18:18 +01:00
Petr Špaček
7b03643483 Add CHANGES note for [GL #2950] 2022-03-16 23:18:18 +01:00
Mark Andrews
4baf22c0f0 Look for zones deeper than the current domain or forward name
When caching glue, we need to ensure that there is no closer
source of truth for the name. If the owner name for the glue
record would be answered by a locally configured zone, do not
cache.
2022-03-16 23:18:18 +01:00
Mark Andrews
0347eed567 Check cached names for possible "forward only" clause
When caching additional and glue data *not* from a forwarder, we must
check that there is no "forward only" clause covering the owner name
that would take precedence.  Such names would normally be allowed by
baliwick rules, but a "forward only" zone introduces a new baliwick
scope.
2022-03-16 23:18:18 +01:00
Mark Andrews
67179e8973 Check that the forward declaration is unchanged and not overridden
If we are using a fowarder, in addition to checking that names to
be cached are subdomains of the forwarded namespace, we must also
check that there are no subsidiary forwarded namespaces which would
take precedence. To be safe, we don't cache any responses if the
forwarding configuration has changed since the query was sent.
2022-03-16 23:18:18 +01:00
Mark Andrews
f7cb79b66a Add additional name checks when using a forwarder
When using a forwarder, check that the owner name of response
records are within the bailiwick of the forwarded name space.
2022-03-16 23:18:18 +01:00
Matthijs Mekking
f2c813c635 Merge branch '3185-follow-up-fix-zone-documentation-v9_18' into 'v9_18'
[v9_18] Fix zone named.conf man page documentation

See merge request isc-projects/bind9!5981
2022-03-15 16:00:07 +00:00
Matthijs Mekking
617b1d7f28 Fix named.conf man page documentation
Commit 4ca74eee49 update the zone grammar
such that the zone statement is printed with the valid options per
zone type.

This commit is a follow-up, putting back the ZONE heading and adding
a note that these zone statements may also be put inside the view
statement.

It is tricky to actually print the zone statements inside
the view statement, and so we decided that we would add a note to say
that this is possible.

(cherry picked from commit 01b125ff05)
2022-03-15 14:15:26 +01:00
Petr Špaček
5f3713852b Merge branch 'pspacek/manpage-hyperlinks-v9_18' into 'v9_18'
Add hyperlinks to manual pages [v9_18]

See merge request isc-projects/bind9!5975
2022-03-14 10:38:11 +00:00
Petr Špaček
4daef4a2a7 Fix dig option hyperlinks in the TSIG section of hte ARM
While backporting !5934 I noticed a copy&paste mistake in TSIG
chapter of the ARM.

The incorrect reference was introduced by "Add hyperlinks from
program options to definition in man pages" commit but it is not
worth creating separate MR for that when the backport is not merged
yet.
2022-03-14 11:28:02 +01:00
Tony Finch
4b96f17ab2 Regenerate the named.conf manual with hyperlinks
The named.conf grammar is exported to the manual via
doc/misc/rst-options.pl which is the ultimate source
for the non-grammar parts of the man page.

(cherry picked from commit ad5b0402c9)
2022-03-14 11:01:32 +01:00
Petr Špaček
680869cbe2 Add internal hyperlinks to See Also section of manual pages
Replace :manpage: with :iscman: to generate internal hyperlinks. That
way reader can use links even when offline, and jumps to man pages
for the same version.

Formerly HTML version of man pages did not have links in See Also
section because :manpage: role in Sphinx can generate only external
hyperlinks - and we do not have that enabled.
Enabling the Sphinx :manpage: linking could reliably create hyperlinks
only to external URLs, but that would take users to another version
of docs.

Generated by:
    find bin -name '*.rst' | xargs sed -i -e 's/:manpage:`\([^(]\+\)(\([0-9]\))`/:iscman:`\1(\2) <\1>`/g'
+ hand-edit to revert change for mmencode reference which is
  not provided in our source tree.

(cherry picked from commit 1d4d008fc9)
2022-03-14 11:01:32 +01:00
Petr Špaček
4063ed938a Remove reference to ndc utility from BIND 8
(cherry picked from commit 420a71df57)
2022-03-14 11:01:32 +01:00
Petr Špaček
07044325eb Hyperlink program names to their manual pages
Use the new role :iscman: to replace all occurences or ``binary``
with :iscman:`binary`, creating a hyperlink to the manual page.

Generated using:
    find bin -name *.rst | xargs fgrep --files-with-matches '.. iscman' | xargs -I{} -n1 basename {} .rst > /tmp/progs
    for PROG in $(cat /tmp/progs); do find -name '*.rst' | xargs sed -i -e "s/\`\`$PROG\`\`/:iscman:\`$PROG\`/g"; done

Additional hand-edits were done mainly around filter-aaaa and
filter-a which are program names and and option names at the
same time. Couple more edits was neede to fix .rst syntax broken by
automatic replacement.

(cherry picked from commit 53a5776025)
2022-03-14 11:01:31 +01:00
Petr Špaček
52a20d646d Use semantic markup for :program: self-references
Sphinx has it's own :program: syntax for refering to program names.
Use it for self-references in manual pages. These self-references are
not clickable and not as eye-cathing as links, which is a good thing.
There is no point in attracting attention to ``dig`` several times on a
single page dedicated to dig itself.

Substituted automatically using:
    find bin  -name *.rst | xargs fgrep --files-with-matches '.. program' | xargs -n1 bash /tmp/repl.sh

With /tmp/repl.sh being:
    BASE=$(basename "$1" .rst)
    sed -i -e "s/\`\`$BASE\`\`/:program:\`$BASE\`/g" "$1"

(cherry picked from commit c7085be211)
2022-03-14 10:57:29 +01:00
Petr Špaček
d13066ca5b Introduce new Sphinx role iscman for ISC manual pages
The new directive and role "iscman" allow to tag & reference man pages in
our source tree. Essentially it is just namespacing for ISC man pages,
but it comes with couple benefits.

Differences from .. _man_program label we formerly used:
- Does not expand :ref:`man_program` into full text of the page header.
- Generates index entry with category "manual page".
- Rendering style is closer to ubiquitous to the one produced
  by ``named`` syntax.

Differences from Sphinx built-in :manpage: role:
- Supports all builders with support for cross-references.
- Generates internal links (unlike :manpage: which generates external
  URLs).
- Checks that target exists withing our source tree.

(cherry picked from commit 7e7a946d44)
2022-03-14 10:57:29 +01:00
Tony Finch
1538326417 More man page option hyperlinks
The dig man page wanted -h option hyperlink and anchor, and there
were a couple of missing cross-references in the rndc man page.

(cherry picked from commit ccc6378355)
2022-03-14 10:57:29 +01:00
Petr Špaček
8066485ea3 Add hyperlinks from program options to definition in man pages
Side-effect of hyperlinking is that typos in program and option names
are now detected by Sphinx.

Candidate -options were detected using:
    find -name *.rst | xargs grep '``-[^`]'
and then modified from ``-o`` to :option:`-o` using regex
    s/``\(-[^`]\+\)``/:option:`\1`/
+ manual modifications where necessary.

Non-hyphenated options were detected by looking at context around
program names:
    find bin -name *.rst | xargs -I{} -n1 basename {} .rst | sort -u
and grepping for program name with trailing whitespace.

Stand-alone program names like ``named`` are not hyperlinked in this
commit.

(cherry picked from commit a85df3ff9c)
2022-03-14 10:57:23 +01:00
Petr Špaček
e0c336f337 Add semantic markup for program names into manual pages
It allows to cross-reference options in man pages from other
documents using :option:`named -g` syntax.

(cherry picked from commit 8537878c01)
2022-03-14 10:56:19 +01:00
Petr Špaček
b4e46de257 Denote all command line options using semantic markup (.. option::)
The markup allows referencing individual options, and also makes them
more legible (no more thin red text on gray background).

Most of the work was done using regexes:
    s/^``-\(.*\)``$/.. option:: -\1\r/
    s/^``+\(.*\)``$/.. option:: +\1\r/
on bin/**/*.rst files along with visual inspection and hand-edits,
mostly for positional arguments.

Regex for rndc.rst:
    s/^``\(.*\)``/.. option:: \1\r/
+ hand edits to remove extra asterisk and whitespace here and there.

(cherry picked from commit ec30944aa4)
2022-03-14 10:56:19 +01:00
Michał Kępień
ed7c208616 Merge branch 'michal/tidy-setup-of-python-based-tests-v9_18' into 'v9_18'
[v9_18] Tidy setup of Python-based tests

See merge request isc-projects/bind9!5973
2022-03-14 08:55:15 +00:00