Commit Graph

8913 Commits

Author SHA1 Message Date
Evan Hunt
cf072d659e cleanup cfg_parse_buffer* functions
cfg_parse_buffer() now has the same signature as the former
cfg_parse_buffer4(). cfg_parse_buffer{2,3,4}() have been removed.
2019-01-24 12:08:54 -08:00
Evan Hunt
b9c9f2593a remove --disable-rpz-nsip and --disable-rpz-nsdname from configure 2019-01-24 11:32:44 -08:00
Mark Andrews
083b730ec7 introducing keymgr need to preserve functionality 2019-01-22 09:52:47 -08:00
Evan Hunt
bc7b34d6ef fix broken masterformat test
- dig command had the @ parameter in the wrong place
- private-dnskey and private-cdnskey are queried in a separate
  loop, which strips 'private-' from the name to determine the qtype
2019-01-21 01:41:25 -05:00
Witold Kręcicki
b49310ac06 If possible don't use forwarders when priming the resolver.
If we try to fetch a record from cache and need to look into
hints database we assume that the resolver is not primed and
start dns_resolver_prime(). Priming query is supposed to return
NSes for "." in ANSWER section and glue records for them in
ADDITIONAL section, so that we can fill that info in 'regular'
cache and not use hints db anymore.
However, if we're using a forwarder the priming query goes through
it, and if it's configured to return minimal answers we won't get
the addresses of root servers in ADDITIONAL section. Since the
only records for root servers we have are in hints database we'll
try to prime the resolver with every single query.

This patch adds a DNS_FETCHOPT_NOFORWARD flag which avoids using
forwarders if possible (that is if we have forward-first policy).
Using this flag on priming fetch fixes the problem as we get the
proper glue. With forward-only policy the problem is non-existent,
as we'll never ask for root server addresses because we'll never
have a need to query them.

Also added a test to confirm priming queries are not forwarded.
2019-01-16 17:41:13 -05:00
Michał Kępień
7d6b8f7c12 Log a message when a mirror zone becomes unusable
Log a message if a mirror zone becomes unusable for the resolver (most
usually due to the zone's expiration timer firing).  Ensure that
verification failures do not cause a mirror zone to be unloaded
(instead, its last successfully verified version should be served if it
is available).
2019-01-16 10:38:12 -08:00
Michał Kępień
7665e13206 Log a message when a mirror zone loaded from disk comes into effect
Log a message when a mirror zone is successfully loaded from disk and
subsequently verified.

This could have been implemented in a simpler manner, e.g. by modifying
an earlier code branch inside zone_postload() which checks whether the
zone already has a database attached and calls attachdb() if it does
not, but that would cause the resulting logs to indicate that a mirror
zone comes into effect before the "loaded serial ..." message is logged,
which would be confusing.

Tweak some existing sed commands used in the "mirror" system test to
ensure that separate test cases comprising it do not break each other.
2019-01-16 10:34:15 -08:00
Michał Kępień
1c97ace7dc Log a message when a transferred mirror zone comes into effect
Log a message when a mirror zone is successfully transferred and
verified, but only if no database for that zone was yet loaded at the
time the transfer was initiated.

This could have been implemented in a simpler manner, e.g. by modifying
zone_replacedb(), but (due to the calling order of the functions
involved in finalizing a zone transfer) that would cause the resulting
logs to suggest that a mirror zone comes into effect before its transfer
is finished, which would be confusing given the nature of mirror zones
and the fact that no message is logged upon successful mirror zone
verification.

Once the dns_zone_replacedb() call in axfr_finalize() is made, it
becomes impossible to determine whether the transferred zone had a
database attached before the transfer was started.  Thus, that check is
instead performed when the transfer context is first created and the
result of this check is passed around in a field of the transfer context
structure.  If it turns out to be desired, the relevant log message is
then emitted just before the transfer context is freed.

Taking this approach means that the log message added by this commit is
not timed precisely, i.e. mirror zone data may be used before this
message is logged.  However, that can only be fixed by logging the
message inside zone_replacedb(), which causes arguably more dire issues
discussed above.

dns_zone_isloaded() is not used to double-check that transferred zone
data was correctly loaded since the 'shutdown_result' field of the zone
transfer context will not be set to ISC_R_SUCCESS unless axfr_finalize()
succeeds (and that in turn will not happen unless dns_zone_replacedb()
succeeds).
2019-01-16 10:33:02 -08:00
Evan Hunt
27f3a210d7 fix incorrect comments 2019-01-15 23:20:38 -08:00
Evan Hunt
adcc16f2d7 error on allow-update and allow-update-forwarding at options/view level 2019-01-15 23:20:38 -08:00
Mark Andrews
7122b5786d add multi-view server and tests 2019-01-14 14:10:05 -08:00
Tony Finch
6a3b851f72 Fix a few cosmetic issues with rndc managed-keys
The handling of class and view arguments was broken, because the code
didn't realise that next_token() would overwrite the class name when
it parsed the view name. The code was trying to implement a syntax
like `refresh [[class] view]`, but it was documented to have a syntax
like `refresh [class [view]]`. The latter is consistent with other rndc
commands, so that is how I have fixed it.

Before:

$ rndc managed-keys refresh in rec
rndc: 'managed-keys' failed: unknown class/type
unknown class 'rec'

After:

$ rndc managed-keys refresh in rec
refreshing managed keys for 'rec'

There were missing newlines in the output from `rndc managed-keys
refresh` and `rndc managed-keys destroy`.

Before:

$ rndc managed-keys refresh
refreshing managed keys for 'rec'refreshing managed keys for 'auth'

After:

$ rndc managed-keys refresh
refreshing managed keys for 'rec'
refreshing managed keys for 'auth'
2019-01-14 14:01:24 -08:00
Ondřej Surý
fd050b6baf b/t/s/dnssec/tests.sh: Cleanup showprivate() function 2019-01-14 11:49:55 +01:00
Evan Hunt
82e83d5dc7 fix testing errors
- the checkprivate function in the dnssec test set ret=0, erasing
  results from previous tests and making the test appear to have passed
  when it shouldn't have
- checkprivate needed a delay loop to ensure there was time for all
  private signing records to be updated before the test
2019-01-13 17:50:08 -08:00
Tony Finch
66be4108bf cleanup: alphabetize rndc command dispatch 2019-01-11 15:34:02 +00:00
Mark Andrews
bd529b1f30 silence coverity issues; move isc_refcount_decrement out of INSIST 2019-01-10 14:42:28 +11:00
Mark Andrews
5e8b772ad1 Ensure base64/base32/hex fields in DNS records that should be non-empty are. 2019-01-09 18:04:21 +11:00
Mark Andrews
8a8d378def wait longer for dump to complete 2019-01-08 23:04:22 -05:00
Michał Kępień
13975b32c6 Fix cleanup upon an error before TCP socket creation
When a query times out after a socket is created and associated with a
given dig_query_t structure, calling isc_socket_cancel() causes
connect_done() to be run, which in turn takes care of all necessary
cleanups.  However, certain errors (e.g. get_address() returning
ISC_R_FAMILYNOSUPPORT) may prevent a TCP socket from being created in
the first place.  Since force_timeout() may be used in code handling
such errors, connect_timeout() needs to properly clean up a TCP query
which is not associated with any socket.  Call clear_query() from
connect_timeout() after attempting to send a TCP query to the next
available server if the timed out query does not have a socket
associated with it, in order to prevent dig from hanging indefinitely
due to the dig_query_t structure not being detached from its parent
dig_lookup_t structure.
2019-01-08 11:17:39 +01:00
Michał Kępień
c108fc5c6e Refactor code sending a query to the next server upon a timeout
When a query times out and another server is available for querying
within the same lookup, the timeout handler - connect_timeout() - is
responsible for sending the query to the next server.  Extract the
relevant part of connect_timeout() to a separate function in order to
improve code readability.
2019-01-08 11:17:39 +01:00
Michał Kępień
ef1da8731b Remove dead code handling address family mismatches for TCP sockets
Before commit c2ec022f57, using the "-b"
command line switch for dig did not disable use of the other address
family than the one to which the address supplied to that option
belonged to.  Thus, bind9_getaddresses() could e.g. prepare an
isc_sockaddr_t structure for an IPv6 address when an IPv4 address has
been passed to the "-b" command line option.  To avoid attempting the
impossible (e.g. querying an IPv6 address from a socket bound to an IPv4
address), a certain code block in send_tcp_connect() checked whether the
address family of the server to be queried was the same as the address
family of the socket set up for sending that query; if there was a
mismatch, that particular server address was skipped.

Commit c2ec022f57 made
bind9_getaddresses() fail upon an address family mismatch between the
address the hostname passed to it resolved to and the address supplied
to the "-b" command line option.  Such failures were fatal to dig back
then.

Commit 7f65860391 made
bind9_getaddresses() failures non-fatal, but also ensured that a
get_address() failure in send_tcp_connect() still causes the given query
address to be skipped (and also made such failures trigger an early
return from send_tcp_connect()).

Summing up, the code block handling address family mismatches in
send_tcp_connect() has been redundant since commit
c2ec022f57.  Remove it.
2019-01-08 11:17:39 +01:00
Michał Kępień
33350626f9 Track forwarder timeouts in fetch contexts
Since following a delegation resets most fetch context state, address
marks (FCTX_ADDRINFO_MARK) set inside lib/dns/resolver.c are not
preserved when a delegation is followed.  This is fine for full
recursive resolution but when named is configured with "forward first;"
and one of the specified forwarders times out, triggering a fallback to
full recursive resolution, that forwarder should no longer be consulted
at each delegation point subsequently reached within a given fetch
context.

Add a new badnstype_t enum value, badns_forwarder, and use it to mark a
forwarder as bad when it times out in a "forward first;" configuration.
Since the bad server list is not cleaned when a fetch context follows a
delegation, this prevents a forwarder from being queried again after
falling back to full recursive resolution.  Yet, as each fetch context
maintains its own list of bad servers, this change does not cause a
forwarder timeout to prevent that forwarder from being used by other
fetch contexts.
2019-01-08 08:29:54 +01:00
Mark Andrews
c69ad95238 indenting 2019-01-02 10:56:59 +11:00
Mark Andrews
dc64b70616 update copyrights 2019-01-02 10:20:43 +11:00
Mark Andrews
b75970efa3 named-checkconf triggered a assertion when a mirror zone had a bad name 2018-12-20 13:19:18 +11:00
Matthijs Mekking
17cdde1e56 Replace DSA with Reserved algorithm 2018-12-19 12:54:57 +01:00
Matthijs Mekking
6d976b37c1 Add dnssec-signzone tests with unsupported alg
dnssec-signzone should sign a zonefile that contains a DNSKEY record
with an unsupported algorithm.
2018-12-19 12:54:31 +01:00
Ondřej Surý
8903d68d69 gcc defines __SANITIZE_ADDRESS__ and not __ADDRESS_SANITIZER__, use the correct #define 2018-12-19 12:24:59 +01:00
Witold Kręcicki
6d50138405 Use rndc_reload in tests, make sure that reload is complete before continuing 2018-12-19 11:33:37 +01:00
Witold Kręcicki
517449e0e6 Add a status line to rndc status notifying that server is being reloaded/reconfigured 2018-12-19 11:32:21 +01:00
Ondřej Surý
cad6b39cab Disable RTLD_DEEPBIND when compiled under AddressSanitizer 2018-12-19 09:59:40 +01:00
Witold Kręcicki
fee890461b Get common stuff out of bin/tests/system/conf.sh.{in,win32} into conf.sh.common 2018-12-18 08:57:05 -05:00
Ondřej Surý
808dac0760 Properly detect msys/msys2 environment in the stop.pl script. 2018-12-18 14:27:56 +01:00
Ondřej Surý
7a721f983e Revert "Merge branch '782-cygwin-grep-CRLF-issue' into 'master'"
This reverts commit 4af9f97189, reversing
changes made to 0289f3f281.
2018-12-17 12:23:14 +01:00
Curtis Blackburn
2ec746dafe minor fixes to dns64 and rndc CRLF fix. rpzrecurse failure
will be addressed in a separate issue
2018-12-14 18:22:58 -08:00
Curtis Blackburn
9fc68285ef more CRLF fixes (dns64, rndc, rpzrecurse) 2018-12-14 18:22:58 -08:00
Curtis Blackburn
bdbf6ede3a missed one in the digdelv test 2018-12-14 18:22:58 -08:00
Curtis Blackburn
ba1b9ca4d4 digdelv test fixed for CRLF issue 2018-12-14 18:22:58 -08:00
Curtis Blackburn
18e8835044 windows CRLF issues fixed in builtin test 2018-12-14 18:22:58 -08:00
Mark Andrews
53a33f7365 pass the correct object to cfg_obj_log 2018-12-14 16:29:02 +11:00
Mark Andrews
7e4b82103b check that DNSKEY and other occluded data are excluded from the delegating bitmap 2018-12-14 12:48:55 +11:00
Mark Andrews
47a4e0eeaa check that the time between notify messages is not too small 2018-12-12 09:39:00 +11:00
Ondřej Surý
826c335980 Remove outdated bin/tests/optional/dst_test test 2018-12-11 11:32:24 +01:00
Ondřej Surý
e69dc0dbc7 Remove RSAMD5 support 2018-12-11 11:32:24 +01:00
Ondřej Surý
bc12c52e82 Run the digdelv tests with set -e enabled 2018-12-11 10:21:47 +01:00
Ondřej Surý
351efd8812 Update digdelv system test to not use static RSAMD5 key and make scripts shellcheck clean 2018-12-11 10:21:40 +01:00
Ondřej Surý
f5785f97fc Refactor synthfromdnssec system test to use $DEFAULT_ALGORITHM, be shellcheck clean and run under set -e 2018-12-11 09:44:08 +01:00
Ondřej Surý
e1bf5624fb Run the sfcache system tests with set -e enabled 2018-12-11 09:27:16 +01:00
Ondřej Surý
f566010717 sfcache system test: Remove RSAMD5 usage and make script shellcheck compliant 2018-12-11 09:27:16 +01:00
Ondřej Surý
7e07d05ae7 Replace RSAMD5 keys with keys using DEFAULT_ALGORITHM variable from conf.sh 2018-12-11 09:27:16 +01:00