Commit Graph

11786 Commits

Author SHA1 Message Date
Aydın Mercan
2690dc48d3 Expose the TCP client count in statistics channel
The statistics channel does not expose the current number of TCP clients
connected, only the highwater. Therefore, users did not have an easy
means to collect statistics about TCP clients served over time. This
information could only be measured as a seperate mechanism via rndc by
looking at the TCP quota filled.

In order to expose the exact current count of connected TCP clients
(tracked by the "tcp-clients" quota) as a statistics counter, an
extra, dedicated Network Manager callback would need to be
implemented for that purpose (a counterpart of ns__client_tcpconn()
that would be run when a TCP connection is torn down), which is
inefficient. Instead, track the number of currently-connected TCP
clients separately for IPv4 and IPv6, as Network Manager statistics.
2024-01-17 11:11:12 +03:00
Artem Boldariev
dbcdd868f9 Skipping portions of cipher-suites test in FIPS mode
We need to skip some portions the system test in FIPS mode as some of
the algorithms used in the test are not available when using the FIPS
mode (e.g. TLS_CHACHA20_POLY1305_SHA256)
2024-01-16 15:01:39 +02:00
Artem Boldariev
8ae661048d Fix flawed logic when detecting same listener type
The older version of the code was reporting that listeners are going
to be of the same type after reconfiguration when switching from DoT
to HTTPS listener, making BIND abort its executions.

That was happening due to the flaw in logic due to which the code
could consider a current listener and a configuration for the new one
to be of the same type (DoT) even when the new listener entry is
explicitly marked as HTTP.

The checks for PROXY in between the configuration were masking that
behaviour, but when porting it to 9.18 (when there is no PROXY
support), the behaviour was exposed.

Now the code mirrors the logic in 'interface_setup()' closely (as it
was meant to).
2024-01-12 17:59:53 +02:00
Artem Boldariev
211f12ff85 Add a system test to verify listener transport change functionality
This commit adds a system test that helps to verify that changing a
listener transport by editing "listen-on" statements before
reconfiguration works as expected.
2024-01-12 14:55:12 +02:00
Artem Boldariev
ed546007c9 Add TLS 'cipher-suites' checkconf test
This commit adds a set of valid and invalid configuration files
samples that use the new 'cipher-suites' option of the 'tls'
statement.
2024-01-12 13:27:59 +02:00
Artem Boldariev
53f53e9b02 Add a 'cipher-suites' option system test
This commit adds a new system test which verifies that using the
'cipher-suites' option actually works as expected (as well as adds
first TLSv1.3 specific tests).
2024-01-12 13:27:59 +02:00
Artem Boldariev
eb924e460b Integrate TLS cipher suites support into BIND
This commit makes BIND use the new 'cipher-suites' option from the
'tls' statement.
2024-01-12 13:27:59 +02:00
Aram Sargsyan
913b20abf8 Print a dig comment about the failed query consistently
Dig failed to print a comment about the reason of the unacceptable
query reply got from a server when there was no other query to
start in the lookup's chain.

Add an "else" block to print out the comment even when not starting
up the next query.
2024-01-10 21:54:39 +00:00
Aram Sargsyan
f6658b333e Fix a possible dig/host crash in "NS search" mode
When getting a SERVFAIL reply from a query, 'host' tries to start
the next query in the lookup's list (also true for 'dig  +nofail').
However, when running with the '-C' switch (or +nssearch for 'dig'),
all the queries in the lookup start from the beginning, so that logic
brings to a crash because of the attempted start of the query which
was already started.

Don't start the next query in the affected code path when in +nssearch
mode.
2024-01-10 21:54:39 +00:00
Mark Andrews
d5103b742b Defer control channel message invalidation
The conn_shutdown() function is called whenever a control channel
connection is supposed to be closed, e.g. after a response to the client
is sent or when named is being shut down.  That function calls
isccc_ccmsg_invalidate(), which resets the magic number in the structure
holding the messages exchanged over a given control channel connection
(isccc_ccmsg_t).  The expectation here is that all operations related to
the given control channel connection will have been completed by the
time the connection needs to be shut down.

However, if named shutdown is initiated while a control channel message
is still in flight, some netmgr callbacks might still be pending when
conn_shutdown() is called and isccc_ccmsg_t invalidated.  This causes
the REQUIRE assertion checking the magic number in ccmsg_senddone() to
fail when the latter function is eventually called, resulting in a
crash.

Fix by splitting up isccc_ccmsg_invalidate() into two separate
functions:

  - isccc_ccmsg_disconnect(), which initiates TCP connection shutdown,
  - isccc_ccmsg_invalidate(), which cleans up magic number and buffer,

and then:

  - replacing all existing uses of isccc_ccmsg_invalidate() with calls
    to isccc_ccmsg_disconnect(),

  - only calling isccc_ccmsg_invalidate() when all netmgr callbacks are
    guaranteed to have been run.

Adjust function comments accordingly.
2024-01-10 15:48:25 +01:00
Tom Krizek
10827fe96c Allow the fetchlimit test to be re-run
The test is known to be unstable due to timing issues. Prevent frequent
false positives by allowing the test to be re-run by the flaky pytest
plugin.
2024-01-10 14:57:20 +01:00
Tom Krizek
a65b654a23 Don't type-check the flaky plugin with mypy
Since we execute mypy for bin/tests/system/isctest package, this is now
needed because the flaky package doesn't have type hints.
2024-01-10 14:57:20 +01:00
Tom Krizek
f314f1b432 Move custom pytest markers into isctest module
Keep our pytest code more organized by moving the shared code for custom
pytest markers into a dedicated isctest/mark.py module.
2024-01-10 14:57:13 +01:00
Tom Krizek
124882476b Allow nsupdate test rerun on FreeBSD
The "exceeded time limit waiting for literal 'too many DNS UPDATEs
queued' in ns1/named.run" is prone to fail due to a timing issue.
Despite out efforts to stabilize it, the check still often fails on
FreeBSD in our CI. Allow the test to be re-run on this platform.
2024-01-10 13:18:04 +01:00
Mark Andrews
bb75676f90 Error if proxy ports are too big 2024-01-09 23:27:45 +00:00
Aram Sargsyan
96f63a9f0b Make digdelv test work in different network envs (continued)
This commit complements the 1e7d832342
commit.
2024-01-09 13:40:38 +00:00
Tom Krizek
68234372a5 Add missing dnssec-validation to ns4 in xfer test
This file was missing explicit dnssec-validation. Seems like it was
missed in our previous efforts, probably because of the different
filename / extension. Rename it to end with *.in to reflect that it is a
template file used by copy_setports.
2024-01-08 18:43:45 +01:00
Tom Krizek
7b77574b6d Handle dig timing out gracefully in upforwd 2024-01-08 17:03:36 +01:00
Tom Krizek
cc7c4760aa Handle dig timing out gracefully in staticstub 2024-01-08 17:03:36 +01:00
Tom Krizek
2341934f7d Handle dig timing out gracefully in sortlist 2024-01-08 17:03:36 +01:00
Tom Krizek
99799fba60 Handle dig timing out gracefully in rpz 2024-01-08 17:03:36 +01:00
Tom Krizek
de569ad97a Handle dig timing out gracefully in rootkeysentinel 2024-01-08 17:03:36 +01:00
Tom Krizek
606985d775 Handle dig timing out gracefully in qmin 2024-01-08 17:03:35 +01:00
Tom Krizek
c983449e5e Handle dig timing out gracefully in padding 2024-01-08 17:03:35 +01:00
Tom Krizek
3c7291248c Handle dig timing out gracefully in nsupdate 2024-01-08 17:03:35 +01:00
Tom Krizek
410aa5aeab Handle dig timing out gracefully in names 2024-01-08 17:03:35 +01:00
Tom Krizek
0bf25138b6 Handle dig timing out gracefully in masterfile 2024-01-08 17:03:35 +01:00
Tom Krizek
8ece026848 Handle dig timing out gracefully in logfileconfig 2024-01-08 17:03:34 +01:00
Tom Krizek
2cc90a815e Handle dig timing out gracefully in legacy 2024-01-08 17:03:34 +01:00
Tom Krizek
c6b267ce4d Handle dig timing out gracefully in keepalive 2024-01-08 17:03:34 +01:00
Tom Krizek
fcce010045 Handle dig timing out gracefully in dnstap 2024-01-08 17:03:34 +01:00
Tom Krizek
343b3f0f84 Handle dig timing out gracefully in cookie 2024-01-08 17:03:33 +01:00
Tom Krizek
445ec7cc0f Handle dig timing out gracefully in autosign 2024-01-08 17:03:33 +01:00
Tom Krizek
ddb41798d5 Handle dig timing out gracefully in auth 2024-01-08 17:03:33 +01:00
Tom Krizek
0d5df1fc02 Handle dig timing out gracefully in allow-query 2024-01-08 17:03:33 +01:00
Mark Andrews
4351076d48 Handle dig timing out gracefully in serve-stale 2024-01-08 17:03:32 +01:00
Mark Andrews
02d9f2eeb9 Handle dig timing out gracefully in rndc 2024-01-08 17:03:31 +01:00
Mark Andrews
882b1a4449 Set the DNSKEY TTLs to match the dnssec policy
This prevents the DNSKEY records being updated and the statistics
not matching as a consequence
2024-01-03 12:09:12 +11:00
Mark Andrews
7a6570a911 Create keys with TTLs that match the policies TTL 2024-01-03 12:09:12 +11:00
Mark Andrews
16a720357b Make $TTL match dnskey-ttl 2024-01-03 12:09:11 +11:00
Matthijs Mekking
b770740b44 Write new DNSKEY TTL to key file
When the current DNSKEY TTL does not match the one from the policy,
write the new TTL to disk.
2024-01-03 12:09:11 +11:00
Mark Andrews
f894bf661f Test dnssec-policy dnskey-ttl behaviour
If the dnskey-ttl in the dnssec-policy doesn't match the DNSKEY's
ttl then the DNSKEY, CDNSKEY and CDS rrset should be updated by
named to reflect the expressed policy.  Check that named does this
by creating a zone with a TTL that does not match the policy's TTL
and check that it is correctly updated.
2024-01-03 12:09:11 +11:00
Mark Andrews
c2c59dea60 Support Net::DNS::Nameserver 1.42
In Net::DNS 1.42 $ns->main_loop no longer loops.  Use current methods
for starting the server, wait for SIGTERM then cleanup child processes
using $ns->stop_server(), then remove the pid file.
2024-01-03 09:21:15 +11:00
Michal Nowak
e67d770432 Rewrite spf system test to pytest 2023-12-22 15:02:58 +01:00
Michał Kępień
662a88055c Add wait_for_zones_loaded fixture
The wait_for_zones_loaded fixture waits for the "all zones loaded"
message in the named log file before the test function can proceed.
2023-12-22 15:02:58 +01:00
Michał Kępień
1770b37095 Ensure wait_for_line() is not called with timeout=0 2023-12-22 15:02:58 +01:00
Michał Kępień
831c5d34f9 Refactor string matching loop for readability 2023-12-22 15:02:58 +01:00
Tom Krizek
05b0ebac0f Add LogFile helper
LogFile class contains a log path and has means to find a string in the
log file.
2023-12-22 15:02:58 +01:00
Michał Kępień
fdc45c70e8 Add reconfiguration support to NamedInstance
Reconfiguring named using RNDC is a common action in BIND 9 system
tests.  It involves sending the "reconfig" RNDC command to a named
instance and waiting until it is fully processed.  Add a reconfigure()
method to the NamedInstance class in order to simplify and standardize
named reconfiguration using RNDC in Python-based system tests.

TODO:

  - full reconfiguration support (w/templating *.in files)

  - add an "rndc null" before every reconfiguration to show which file
    is used (NamedInstance.add_mark_to_log() as it may be generically
    useful?)
2023-12-21 18:10:15 +00:00
Michał Kępień
aa31a872d0 Clean up the "checkds" system test
The "checkds" system test contains a lot of duplicated code despite
carrying out the same set of actions for every tested scenario
(zone_check() → wait for logs to appear → keystate_check()).  Extract
the parts of the code shared between all tests into a new function,
test_checkds(), and use pytest's test parametrization capabilities to
pass distinct sets of test parameters to this new function, in an
attempt to cleanly separate the fixed parts of this system test from the
variable ones.  Replace format() calls with f-strings.
2023-12-21 18:10:15 +00:00