Commit graph

11711 commits

Author SHA1 Message Date
Artem Boldariev
10e626111f doth test: add a secondary NS instance that reuses a 'tls' entry
This commit extends the 'doth' system tests with additional secondary
NS instance that reuses the same 'tls' entry for connecting the the
primary to download zones. This configurations were known to crash
secondaries in some cases.
2023-12-06 16:01:20 +02:00
Artem Boldariev
019555fb1d System test for PROXYv2
This commit adds a system test suite for PROXYv2. The idea on which it
is based is simple:

1. Firstly we check that 'allow-proxy' and 'allow-proxy-on' (whatever
is using the new 'isc_nmhandle_real_localaddr/peeraddr()') do what
they intended to do.

2. Anything else that needs an interface or peer address (ACL
functionality, for example) is using the old
'isc_nmhandle_localaddr/peeraddr()' - which are now returning
addresses received via PROXY (if any) instead of the real connection
addresses. The beauty of it that we DO NOT need to verify every bit of
the code relying on these functions: whatever works in one place will
work everywhere else, as these were the only functions that allowed
any higher level code to get peer and interface addresses.

This way it is relatively easy to see if PROXYv2 works as intended.
2023-12-06 15:15:25 +02:00
Artem Boldariev
0e8d5c9c6b Add checkonf tests for the PROXYv2 related options
This commit adds necessary PROXYv2 configuration options checks.
2023-12-06 15:15:25 +02:00
Artem Boldariev
5ed3a76f9d BIND: Add 'allow-proxy' and 'allow-proxy-on' options
The main intention of PROXY protocol is to pass endpoints information
to a back-end server (in our case - BIND). That means that it is a
valid way to spoof endpoints information, as the addresses and ports
extracted from PROXYv2 headers, from the point of view of BIND, are
used instead of the real connection addresses.

Of course, an ability to easily spoof endpoints information can be
considered a security issue when used uncontrollably. To resolve that,
we introduce 'allow-proxy' and 'allow-proxy-on' ACL options. These are
the only ACL options in BIND that work with real PROXY connections
addresses, allowing a DNS server operator to specify from what clients
and on which interfaces he or she is willing to accept PROXY
headers. By default, for security reasons we do not allow to accept
them.
2023-12-06 15:15:25 +02:00
Artem Boldariev
f650d3eb63 Add 'proxy' option to 'listen-on' statement
This commit extends "listen-on" statement with "proxy" options that
allows one to enable PROXYv2 support on a dedicated listener. It can
have the following values:

- "plain" to send PROXYv2 headers without encryption, even in the case
of encrypted transports.
- "encrypted" to send PROXYv2 headers encrypted right after the TLS
handshake.
2023-12-06 15:15:25 +02:00
Artem Boldariev
e87f980d42 Document the new PROXY-related options for dig
This commit adds new documentation for +[no]proxy and +[no]proxy-plain
dig options.
2023-12-06 15:15:25 +02:00
Artem Boldariev
e0afd614c3 Integrate PROXYv2 support into dig
This commit adds PROXYv2 support into dig by the means of adding
+[no]proxy and +[no]proxy-plain options. Since this commit dig
supports sending PROXYv2 headers on all supported DNS-transports.

The support for PROXYv2 is modelled after that one in kdig.
2023-12-06 15:15:25 +02:00
Artem Boldariev
9d7343cd7d DoH: add PROXY over TLS support
This commit extends DNS over HTTP(S) transport with PROXY over TLS
support.
2023-12-06 15:15:25 +02:00
Artem Boldariev
eb52015db1 Stream DNS: add PROXY over TLS support
This commit extends Stream DNS with PROXY over TLS support.
2023-12-06 15:15:25 +02:00
Artem Boldariev
eccc3fe0a0 Add PROXYv2 support to DNS over HTTP(S) transport
This commit extends DNS over HTTP(S) transport with PROXYv2 support.
2023-12-06 15:15:24 +02:00
Artem Boldariev
e97903ca14 Add PROXY support to Stream DNS
This commit makes it possible to use Stream DNS on top of PROXY Stream
either directly or indirectly (in the case when TLS is involved).
2023-12-06 15:15:24 +02:00
Matthijs Mekking
abdaa77303 Change max NSEC3 iterations in system tests to 50
The dnssec and nsupdate system tests need to be adjusted to accept
a lower maximum value for NSEC3 iterations.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
ff4201e388 Lower the maximum allowed NSEC3 iterations to 50
BIND 9 will now treat the response as insecure when processing NSEC3
records with iterations larger than 50.

Earlier, we limited the number of iterations to 150 (in #2445).

RFC 9276 says: Because there has been a large growth of open (public)
DNSSEC validating resolvers that are subject to compute resource
constraints when handling requests from anonymous clients, this
document recommends that validating resolvers reduce their iteration
count limits over time. Specifically, validating resolver operators and
validating resolver software implementers are encouraged to continue
evaluating NSEC3 iteration count deployment trends and lower their
acceptable iteration limits over time.

After evaluation, we decided that the next major BIND release should
lower the maximum allowed NSEC3 iterations to 50, which should be
fine for 99,87% of the domain names.
2023-12-05 14:58:58 +00:00
Matthijs Mekking
3c08fbc79f Change NSEC3 iterations to 0 in system tests
The system tests need to be updated because non-zero iterations are no
longer accepted.

The autosign system test changes its iterations from 1 to 0 in one
test case. This requires the hash to be updated.

The checkconf system test needs to change the iterations in the good
configuration files to 0, and in the bad ones to 1 (any non-zero value
would suffice, but we test the corner case here). Also, the expected
failure message is change, so needs to be adjusted.

The nsec3 system test also needs iteration configuration adjustments.
In addition, the test script no longer needs the ITERATIONS environment
variable.

In the process of updating the system tests, I noticed an error
in the dnssec-policy "nsec3-other", where the salt length in one
configuration file is different than in the other (they need to be
the same). Furthermore, the 'rndc signing -nsec3param' test case
is operated on the zone 'nsec-change.kasp', so is moved so that the
tests on the same zone are grouped together.
2023-12-05 14:58:58 +00:00
Tom Krizek
5de2b07daa
Refactor statschannel test to use isctest
Use common utility functions in favor of duplicating the code in a
test-specific file.
2023-12-05 13:26:49 +01:00
Tom Krizek
cba5a1d62c
Add system test utility package isctest
Create a utility package for code shared by the python tests. The
utility functions should use reasonable defaults and be split up into
modules according to their functionality.

Ensure assert rewriting is enabled for the modules to get the most
useful output from pytest.
2023-12-05 13:26:49 +01:00
Tom Krizek
f0481c8600
Simplify statsport fixture in statschannel test
The ports fixture provides the required port numbers already and there's
no need to get the port number from environment.
2023-12-05 13:26:49 +01:00
Tom Krizek
a57af8163a
Allow assertion message rewrite in statschannel test
By default, the useful assertion message rewrite is used by pytest for
test modules only. Since another module is imported with shared
functionality, ensure it has pytest's assertion message rewriting
enabled to obtain more debug information in case it fails.
2023-12-05 13:26:49 +01:00
Tom Krizek
fc295b2b5d
Move helper functions in statchannel into single file
Since dnspython is now a required dependency, there's no need to keep
these two helper files separate.
2023-12-05 13:26:49 +01:00
Tom Krizek
767f4670c6
Add assert message to test doth/stress_http_quota.py
This file is executed outside of pytest with pure python, which doesn't
do any AssertionError message rewriting like pytest. Ensure the assert
messages in this file provide a useful debug message.
2023-12-05 13:26:43 +01:00
Mark Andrews
69f7048c89 Handle ISC_R_SHUTTINGDOWN in dighost.c:recv_done
When dighost.c:recv_done is called with ISC_R_SHUTTINGDOWN cancel
all outstanding lookups as this indicates SIGTERM was recieved.
2023-12-05 07:30:52 +11:00
Michał Kępień
422286e9c2
Do not daemonize named instances with custom args
This enables the "logfileconfig" and "rpzextra" system tests to pass
when named is started under the supervision of rr (USE_RR=1).
2023-12-04 18:40:52 +01:00
Michal Nowak
920af590d1
Fix process listing string of rpzextra ns3 server 2023-12-04 18:39:28 +01:00
Michal Nowak
e088e8a992
Add support for recording named runtime with rr
The traces of the named process are stored in the directory
$system_test/nsX/named-Y/.
2023-12-04 18:38:29 +01:00
Ondřej Surý
658d62a6f4
Remove support for running system tests under Valgrind
Valgrind support has been scarcely used.
2023-12-04 18:27:51 +01:00
Aram Sargsyan
4d529ee12a Emit "no servers could be reached" also for UDP setup failure
When all the servers are exhausted for UDP setup emit "no servers
could be reached" in udp_ready(). This message can also be emitted
for a recv_done() error and for TCP connection failure similarly.
2023-12-04 10:38:16 +00:00
Tom Krizek
1e181cf61d
Remove -U 4 from system tests
This option doesn't appear to be needed for any of the tests, so remove
it to keep things simple.
2023-12-01 14:03:35 +01:00
Tom Krizek
fba295600b
Update system test documentation
Rewrite and reorganize the test documentation to focus on the pytest
runner, omit any mentions of the legacy runner which are no longer
relevant, and mention a few pytest tricks.
2023-12-01 14:03:33 +01:00
Tom Krizek
3e26d99c3c
Remove obsolete system test lists
These were used by deleted legacy runner utility scripts.
2023-12-01 13:47:29 +01:00
Tom Krizek
910440d9b6
Remove legacy runner control scripts
These scripts have been used exclusively by the legacy test runner and
they're no longer needed.
2023-12-01 13:47:27 +01:00
Matthijs Mekking
00fa7483b9
Renumber the ns2/named-alt*.conf.in files
Now that some configuration input files have been removed, rename
the filenames.
2023-11-28 17:03:08 +01:00
Matthijs Mekking
3119164e29
Drop ns2/named-alt1.conf.in and ns2/named-alt2.conf.in
These files were not being used in the system test.
2023-11-28 17:03:08 +01:00
Michal Nowak
236e5bf519
Drop the last remnant of ns2/named-alt3.conf.in
The ns2/named-alt3.conf.in config file was removed in
f8e264ba6d. From then on, system test
reports:

    sed: can't read ns2/named-alt3.conf.in: No such file or directory"

Drop the last remnant of ns2/named-alt3.conf.in.
2023-11-28 17:03:08 +01:00
Matthijs Mekking
6a4f3ec242 Add a DNSSEC policy test case for a special zone
Try to create a key for a zone, and then sign it, that has some special
characters in the name.
2023-11-20 08:31:39 +01:00
Mark Andrews
831efa40d6 Emit "no servers could be reached" for TCP as well as UDP
When all the servers are exhausted for TCP emit "no servers could
be reached" in tcp_connected.  This message is already emitted for
UDP.
2023-11-20 12:23:27 +11:00
Ondřej Surý
5734d6c826
Make sure we shutdown the controlconf listeners and connections once
It was possible that controlconf connections could be shutdown twice
when shutting down the server, because they would receive the
signal (ISC_R_SHUTTINGDOWN result) from netmgr and then the shutdown
procedure would be called second time via controls_shutdown().

Split the shutdown procedure from control_recvmessage(), so we can call
it independently from netmgr callbacks and make sure it will be called
only once.  Do the similar thing for the listeners.
2023-11-16 16:58:12 +01:00
Evan Hunt
9643281453 set loadtime during initial transfer of a secondary zone
when transferring in a non-inline-signing secondary for the first time,
we previously never set the value of zone->loadtime, so it remained
zero. this caused a test failure in the statschannel system test,
and that test case was temporarily disabled.  the value is now set
correctly and the test case has been reinstated.
2023-11-15 17:23:25 -08:00
Mark Andrews
cbfcdbc199 Adjust message buffer sizes in test code 2023-11-16 11:22:02 +11:00
Ondřej Surý
17da9fed58
Remove AES algorithm for DNS cookies
The AES algorithm for DNS cookies was being kept for legacy reasons, and
it can be safely removed in the next major release.  Remove both the AES
usage for DNS cookies and the AES implementation itself.
2023-11-15 10:31:16 +01:00
Tony Finch
61b245e318 Fix missing newlines in output of rndc nta -dump
There were no newlines between each view in the list of negative trust
anchors.
2023-11-02 21:31:09 +11:00
Tom Krizek
ba25ecd2d2
Fix pytest junitxml output processing for make check
Not every element tagged `skipped` in the JUnitXML tree has to contain
the `type` attribute. An example of that is a test that results in
xpass.

This has been verified with pytest version 7.4.2 and prior.
2023-11-02 09:59:23 +01:00
Mark Andrews
0482451f84 Cleanup dead code in dnstap-read
Remove 'b' from main as it is unused.
2023-11-01 20:58:22 +00:00
Mark Andrews
578da93581 Turn on QNAME minimisation when fetching nameserver addresses 2023-11-01 16:49:08 +01:00
Matthijs Mekking
e196ba6168 Test case for issue #4355
Add a test case where serve-stale is enabled on a server that also
servers a local authoritative zone.

The particular case tests a lame delegation and checks if falling
back to serving stale data does not attempt to retrieve the query
by recursing from the root down.
2023-10-30 20:07:01 +01:00
Ondřej Surý
2d2c249958
Call isccc_ccmsg_invalidate() when shutting down the connection
Previously, the isccc_ccmsg_invalidate() was called from conn_free() and
this could lead to netmgr calling control_recvmessage() after we
detached the reading controlconnection_t reference, but it wouldn't be
the last reference because controlconnection_t is also attached/detached
when sending response or running command asynchronously.

Instead, move the isccc_ccmsg_invalidate() call to control_recvmessage()
error handling path to make sure that control_recvmessage() won't be
ever called again from the netmgr.
2023-10-27 10:53:26 +02:00
Ondřej Surý
07f569e2f6
Replace mutex for listener->connections with TID check
The controlconf channel runs single-threaded on the main thread.
Replace the listener->connections locking with check that we are still
running on the thread with TID 0.
2023-10-27 10:21:41 +02:00
Ondřej Surý
f8e264ba6d
Remove the lock-file configuration and -X argument to named
The lock-file configuration (both from configuration file and -X
argument to named) has better alternatives nowadays.  Modern process
supervisor should be used to ensure that a single named process is
running on a given configuration.

Alternatively, it's possible to wrap the named with flock(1).
2023-10-26 22:42:37 +02:00
Ondřej Surý
d3f2766a79
Mark the lock-file configuration option as deprecated
This is first step in removing the lock-file configuration option, it
marks both the `lock-file` configuration directive and -X option to
named as deprecated.
2023-10-26 22:41:45 +02:00
Aram Sargsyan
41945b32d7 Do not warn about lock-file option change when -X is used
When -X is used the 'lock-file' option change detection condition
is invalid, because it compares the 'lock-file' option's value to
the '-X' argument's value instead of the older 'lock-file' option
value (which was ignored because of '-X').

Don't warn about changing 'lock-file' option if '-X' is used.
2023-10-26 12:34:15 +00:00
Aram Sargsyan
bc891e749f Fix an invalid condition check when detecting a lock-file change
It is obvious that the '!cfg_obj_asstring(obj)' check should be
'cfg_obj_asstring(obj)' instead, because it is an AND logic chain
which further uses 'obj' as a string.

Fix the error.
2023-10-26 12:34:07 +00:00