2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

33236 Commits

Author SHA1 Message Date
Artem Boldariev
08da09bc76 Initial support for DNS-over-HTTP(S)
This commit completes the support for DNS-over-HTTP(S) built on top of
nghttp2 and plugs it into the BIND. Support for both GET and POST
requests is present, as required by RFC8484.

Both encrypted (via TLS) and unencrypted HTTP/2 connections are
supported. The latter are mostly there for debugging/troubleshooting
purposes and for the means of encryption offloading to third-party
software (as might be desirable in some environments to simplify TLS
certificates management).
2021-02-03 12:06:17 +01:00
Witold Kręcicki
7a96081360 nghttp2-based HTTP layer in netmgr
This commit includes work-in-progress implementation of
DNS-over-HTTP(S).

Server-side code remains mostly untested, and there is only support
for POST requests.
2021-02-03 12:06:17 +01:00
Witold Kręcicki
cdf9d21731 Add isc_mem_strndup() function
This commit adds an implementation of strndup() function which
allocates memory from the supplied isc_mem_t memory context.
2021-02-03 12:06:17 +01:00
Evan Hunt
931ccd225f update ARM with "http" grammar
add a link to the http statement grammar and explanations and examples
for configuring DoH listeners.
2021-02-03 12:06:17 +01:00
Evan Hunt
06951472dd Add parser support for DoH configuration options
This commit adds stub parser support and tests for:
- an "http" global option for HTTP/2 endpoint configuration.
- command line options to set http or https port numbers by
  specifying -p http=PORT or -p https=PORT.  (NOTE: this change
  only affects syntax; specifying HTTP and HTTPS ports on the
  command line currently has no effect.)
- named.conf options "http-port" and "https-port"
- HTTPSPORT environment variable for use when running tests.
2021-02-03 12:06:17 +01:00
Artem Boldariev
6b9a31989c Resurrect old TLS code
This commit resurrects the old TLS code from
8f73c70d23e26954165fd44ce5617a95f112bcff.

It also includes numerous stability fixes and support for
isc_nm_cancelread() for the TLS layer.

The code was resurrected to be used for DoH.
2021-02-03 12:06:17 +01:00
Michał Kępień
677cc94671 Merge branch '2448-tweak-sphinx-build-invocations' into 'main'
Tweak sphinx-build invocations

Closes #2448

See merge request isc-projects/bind9!4640
2021-02-03 10:57:51 +00:00
Michał Kępień
51479ed9a3 Make sphinx-build warnings fatal
In order to prevent documentation building issues from being glossed
over, pass the -W command line switch to all sphinx-build invocations.
This causes the latter to return with a non-zero exit code whenever any
Sphinx warnings are triggered.
2021-02-03 11:44:02 +01:00
Michał Kępień
84862e96c1 Address a Sphinx duplicate label warning
Both doc/man/ddns-confgen.rst and doc/man/tsig-keygen.rst include
bin/confgen/tsig-keygen.rst, which defines a "man_tsig-keygen" label.
This triggers the following warning when running sphinx-build with the
-W command line switch in the doc/man/ directory:

    ../../bin/confgen/tsig-keygen.rst:27: WARNING: duplicate label man_tsig-keygen, other instance in /tmp/bind9/doc/man/ddns-confgen.rst

Move the offending label from bin/confgen/tsig-keygen.rst to the proper
spot in doc/arm/manpages.rst to avoid effectively defining it twice in
different source documents while still allowing the relevant man page to
be referenced in the ARM.  Also rename that label so that it more
closely matches the content it points to.  As the label no longer
immediately precedes a section title in its new location, use
:ref:`Title <label>` syntax for the only reference to the
tsig-keygen/ddns-confgen man page in the ARM.
2021-02-03 11:44:02 +01:00
Michał Kępień
33db7ea16d Use separate sphinx-build cache directories
Simultaneously starting multiple sphinx-build instances with the -d
command line switch set to a common value (which is what happens when
e.g. "make -j6 doc" is run) causes intermittent problems which we failed
to notice before because they only trigger Sphinx warnings, not errors,
e.g.:

    WARNING: toctree contains ref to nonexisting file 'reference'

The message above is not triggered because doc/arm/reference.rst is
actually missing from disk at any point, but rather because a temporary
file created by one sphinx-build instance gets truncated by another one
working in parallel (the confusing message quoted above is logged
because of an overly broad "except" statement in Sphinx code).

Prevent this problem from being triggered by making each sphinx-build
process use its own dedicated cache directory.
2021-02-03 11:44:02 +01:00
Matthijs Mekking
62af115fa9 Merge branch '2406-kasp-init-inactive-delete-metadata' into 'main'
Resolve "kasp: look at Inactive/Delete when initializing state files"

Closes #2406

See merge request isc-projects/bind9!4599
2021-02-03 08:49:14 +00:00
Matthijs Mekking
82632fa6d9 Remove initialize goal code
Since keys now have their goals initialized in 'keymgr_key_init()',
remove this redundant piece of code in 'keymgr_key_run()'.
2021-02-03 08:36:14 +01:00
Matthijs Mekking
76cf72e65a Correctly initialize old key with state file
The 'key_init()' function is used to initialize a state file for keys
that don't have one yet. This can happen if you are migrating from a
'auto-dnssec' or 'inline-signing' to a 'dnssec-policy' configuration.

It did not look at the "Inactive" and "Delete" timing metadata and so
old keys left behind in the key directory would also be considered as
a possible active key. This commit fixes this and now explicitly sets
the key goal to OMNIPRESENT for keys that have their "Active/Publish"
timing metadata in the past, but their "Inactive/Delete" timing
metadata in the future. If the "Inactive/Delete" timing metadata is
also in the past, the key goal is set to HIDDEN.

If the "Inactive/Delete" timing metadata is in the past, also the
key states are adjusted to either UNRETENTIVE or HIDDEN, depending on
how far in the past the metadata is set.
2021-02-03 08:36:01 +01:00
Matthijs Mekking
d4b2b7072d Update legacy-keys kasp test
The 'legacy-keys.kasp' test checks that a zone with key files but not
yet state files is signed correctly. This test is expanded to cover
the case where old key files still exist in the key directory. This
covers bug #2406 where keys with the "Delete" timing metadata are
picked up by the keymgr as active keys.

Fix the 'legacy-keys.kasp' test, by creating the right key files
(for zone 'legacy-keys.kasp', not 'legacy,kasp').

Use a unique policy for this zone, using shorter lifetimes.

Create two more keys for the zone, and use 'dnssec-settime' to set
the timing metadata in the past, long enough ago so that the keys
should not be considered by the keymgr.

Update the 'key_unused()' test function, and consider keys with
their "Delete" timing metadata in the past as unused.

Extend the test to ensure that the keys to be used are not the old
predecessor keys (with their "Delete" timing metadata in the past).

Update the test so that the checks performed are consistent with the
newly configured policy.
2021-02-03 08:35:56 +01:00
Mark Andrews
6b79a0ce9d Merge branch '1697-isc_rwlock_init-can-no-longer-fail-in-master-clean-up-calls' into 'main'
Resolve "isc_rwlock_init can no longer fail in master, clean up calls."

Closes #2462 and #1697

See merge request isc-projects/bind9!4635
2021-02-03 02:36:24 +00:00
Mark Andrews
3b11bacbb7 Cleanup redundant isc_rwlock_init() result checks 2021-02-03 12:22:33 +11:00
Ondřej Surý
48a89e5fbe Merge branch '2444-call-freeaddrinfo-in-test_client' into 'main'
Fix addrinfo leak in test_client.c

Closes #2444

See merge request isc-projects/bind9!4629
2021-01-29 14:54:42 +00:00
Ondřej Surý
6aa4d59526 Fix addrinfo leak in test_client.c
The addrinfo we got from getaddrinfo() was never freed.
2021-01-29 13:26:28 +01:00
Ondřej Surý
b42137c453 Merge branch '2392-xot-xfrin' into 'main'
Add support for incoming tranfers via XoT

Closes #2392

See merge request isc-projects/bind9!4571
2021-01-29 11:55:16 +00:00
Evan Hunt
220bca9ebf CHANGES and release notes 2021-01-29 12:07:38 +01:00
Ondřej Surý
e488309da7 implement xfrin via XoT
Add support for a "tls" key/value pair for zone primaries, referencing
either a "tls" configuration statement or "ephemeral". If set to use
TLS, zones will send SOA and AXFR/IXFR queries over a TLS channel.
2021-01-29 12:07:38 +01:00
Matthijs Mekking
778d0c03a9 Merge branch '2442-tsan-error-lib-dns-rbtdb-c' into 'main'
Resolve "TSAN error: lib/dns/rbtdb.c"

Closes #2442

See merge request isc-projects/bind9!4609
2021-01-29 10:45:40 +00:00
Diego Fronza
c75575e350 Fix race condition on check_stale_header
This commit fix a race that could happen when two or more threads have
failed to refresh the same RRset, the threads could simultaneously
attempt to update the header->last_refresh_fail_ts field in
check_stale_header, a field used to implement stale-refresh-time.

By making this field atomic we avoid such race.
2021-01-29 10:29:51 +01:00
Matthijs Mekking
0fab6cf88e Merge branch '2434-fetch-limit-serve-stale' into 'main'
Resolve "Serve stale when fetch limits are hit"

Closes #2434

See merge request isc-projects/bind9!4607
2021-01-28 16:57:20 +00:00
Matthijs Mekking
ed8421693c Add notes and change entry for [#2434]
This concludes the serve-stale improvements.
2021-01-28 17:02:56 +01:00
Matthijs Mekking
11b74fc176 Add test for serve-stale /w fetch-limits
Add a test case when fetch-limits are reached and we have stale data
in cache.

This test starts with a positive answer for 'data.example/TXT' in
cache.

1. Reload named.conf to set fetch limits.
2. Disable responses from the authoritative server.
3. Now send a batch of queries to the resolver, until hitting the
   fetch limits. We can detect this by looking at the response RCODE,
   at some point we will see SERVFAIL responses.
4. At that point we will turn on serve-stale.
5. Clients should see stale answers now.
6. An incoming query should not set the stale-refresh-time window,
   so a following query should still get a stale answer because of a
   resolver failure (and not because it was in the stale-refresh-time
   window).
2021-01-28 16:39:30 +01:00
Matthijs Mekking
aabdedeae3 Only start stale refresh window when resuming
If we did not attempt a fetch due to fetch-limits, we should not start
the stale-refresh-time window.

Introduce a new flag DNS_DBFIND_STALESTART to differentiate between
a resolver failure and unexpected error. If we are resuming, this
indicates a resolver failure, then start the stale-refresh-time window,
otherwise don't start the stale-refresh-time window, but still fall
back to using stale data.

(This commit also wraps some docstrings to 80 characters width)
2021-01-28 16:38:34 +01:00
Matthijs Mekking
c6fd02aed5 Use stale data also if we are not resuming
Before this change, BIND will only fallback to using stale data if
there was an actual attempt to resolve the query. Then on a timeout,
the stale data from cache becomes eligible.

This commit changes this so that on any unexpected error stale data
becomes eligble (you would still have to have 'stale-answer-enable'
enabled of course).

If there is no stale data, this may return in an error again, so don't
loop on stale data lookup attempts. If the DNS_DBFIND_STALEOK flag is
set, this means we already tried to lookup stale data, so if that is
the case, don't use stale again.
2021-01-28 16:36:46 +01:00
Mark Andrews
c1c7e1ac5c Merge branch '2420-xmlfreetextwriter-could-be-called-twice' into 'main'
Resolve "CID 316510: Memory - corruptions (USE_AFTER_FREE)"

Closes #2420

See merge request isc-projects/bind9!4613
2021-01-28 05:19:53 +00:00
Mark Andrews
95114f7d60 Add CHANGES entry for [GL #2420] 2021-01-28 04:15:06 +00:00
Mark Andrews
b5cf54252a Stop xmlFreeTextWriter being called twice
xmlFreeTextWriter could be called twice if xmlDocDumpFormatMemoryEnc
failed.
2021-01-28 04:15:06 +00:00
Mark Andrews
838d3673a8 Merge branch 'marka-changes-line-length' into 'main'
Detect overly long CHANGES lines

See merge request isc-projects/bind9!4603
2021-01-28 04:06:14 +00:00
Mark Andrews
28449acded fix overly long line 2021-01-28 14:12:40 +11:00
Mark Andrews
b1ecab6383 Detect overly long CHANGES lines 2021-01-28 13:49:02 +11:00
Mark Andrews
12c5b2a1b8 Merge branch '2413-after-upgrade-to-bind9-9-16-11-named-is-killed-with-status-11-segv' into 'main'
Resolve "after upgrade to bind9 9.16.11 named is killed with status=11/SEGV"

Closes #2413

See merge request isc-projects/bind9!4592
2021-01-28 02:34:43 +00:00
Mark Andrews
79fad620a2 Add release note for [GL #2413] 2021-01-28 01:54:59 +00:00
Mark Andrews
5ec9999b28 Add CHANGES for [GL #2413] 2021-01-28 01:54:59 +00:00
Mark Andrews
3dee62cfa5 Add a named acl example 2021-01-28 01:54:59 +00:00
Mark Andrews
a8b55992a8 Require 'ctx' to be non-NULL in cfg_acl_fromconfig{,2} 2021-01-28 01:54:59 +00:00
Mark Andrews
2b3fcd7156 Pass an afg_aclconfctx_t structure to cfg_acl_fromconfig
in named_zone_inlinesigning.  A NULL pointer does not work.
2021-01-28 01:54:59 +00:00
Mark Andrews
b111592dca Merge branch '2391-check-nsupdate-y-for-all-hmac-algorithms' into 'main'
Resolve "Check 'nsupdate -y' for all hmac algorithms."

Closes #2391

See merge request isc-projects/bind9!4569
2021-01-28 01:54:30 +00:00
Mark Andrews
4b01ba44ea Check that 'nsupdate -y' works for all HMAC algorithms 2021-01-28 01:21:27 +00:00
Mark Andrews
5921af4c7f Merge branch '2073-dnssec-verify-tries-all-keys-which-results-in-poor-performance' into 'main'
Resolve "dnssec-verify tries all keys which results in poor performance"

Closes #2073

See merge request isc-projects/bind9!4411
2021-01-28 01:06:47 +00:00
Mark Andrews
3f0859d223 Add CHANGES note 2021-01-28 11:07:52 +11:00
Mark Andrews
c75b325832 Optimise dnssec-verify
dns_dnssec_keyfromrdata() only needs to be called once per DNSKEY
rather than once per verification attempt.
2021-01-28 11:07:03 +11:00
Mark Andrews
d7f41c3dce Merge branch '2342-rndc-retransfer-issues-misleading-diagnostic-on-primary-zone' into 'main'
Resolve "rndc retransfer issues misleading diagnostic on primary zone"

Closes #2342

See merge request isc-projects/bind9!4482
2021-01-27 22:42:05 +00:00
Mark Andrews
1f55f49f21 Add CHANGES 2021-01-28 08:43:50 +11:00
Mark Andrews
8f36b8567a Check 'rndc retransfer' of primary error message 2021-01-28 08:43:03 +11:00
Mark Andrews
dd3520ae41 Improve the diagnostic 'rndc retransfer' error message 2021-01-28 08:43:03 +11:00
Matthijs Mekking
1fcc6132c4 Merge branch '2178-dnssec-fromlabel-ec_crash' into 'main'
Resolve "dnssec-keyfromlabel  ECDSAP256SHA256 error on AEP Keypers HSM"

Closes #2178

See merge request isc-projects/bind9!4495
2021-01-26 14:02:49 +00:00