Commit Graph
76 Commits
Author SHA1 Message Date
arya dradjicaandGitHub c6d934038a Rewrite the CI pipeline (#536)
- Automatically determine the MSRV.
- Rebuild 'main' every week to catch environmental changes.
- Run Clippy in a dedicated job to be more parallel.
  - Only run it on Ubuntu.
- Introduce caching of '~/.cargo' and '/target'.
  - Only save it on 'main', but restore it in all other jobs.
- Preserve OpenSSL-excluding behavior for Windows.
2025-06-25 14:23:28 +00:00
52b6cdf982 Introduce feature unstable-client-cache to make the client cache optional. (#478)
The client cache depends on the moka crate. Make the client cache optional to allow the use of the client transports without depending on moka.
---------

Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2025-04-02 11:23:37 +02:00
0e854cf4da DNSSEC signing improvements and general crypto and DNSSEC restructuring (#416)
---------

Co-authored-by: arya dradjica <arya@nlnetlabs.nl>
Co-authored-by: Jannik Peters <jannik.peters@posteo.de>
Co-authored-by: Martin Hoffmann <martin@nlnetlabs.nl>
Co-authored-by: Ximon Eighteen <ximon@nlnetlabs.nl>
2025-04-01 10:04:09 +02:00
Ximon EighteenandGitHub e5ace3f152 Update serve-zone.rs to show working with the TSIG key. (#485) 2025-03-04 10:35:43 +01:00
Philip-NLnetLabsandGitHub bcb4e8553f Fix clippy errors for 1.85.0. (#490)
* Fix clippy errors for 1.85.0.

* Also fix nightly clippies.

* Restore comment.

* Remove redundant ok()
2025-02-26 15:21:59 +01:00
Philip Homburg 69f1dc520b Add key lifecycle management (PR #459) 2024-12-19 14:49:14 +01:00
Philip Homburg c2619838c0 A load balancer client transport (PR #425). 2024-11-26 14:11:37 +01:00
Ximon EighteenandGitHub b137d5bac6 Add missing required features to Cargo.toml for examples (#432)
* Add missing required features to serve-zone example.

* Fix required-features listed in Cargo.toml for the query-zone example.

* Fix required-features listed in Cargo.toml for the client-transports example.

* Echo all run commands to check examples, and exit immediately on error (also ensures a final success doesn't cause previous failures to be ignored).

* Fix required-features listed in Cargo.toml for the server-transports example.

* Remove unused import except when feature is enabled that needs it.
2024-11-08 14:16:46 +01:00
Philip Homburg f13016e299 Qname router (#353) 2024-10-28 13:51:57 +01:00
Ximon EighteenandGitHub f111cc6316 Set the AA flag and include glue in responses. (#400)
This PR adds handling of the AA flag and additional records to zonetree
answer generation.
2024-10-03 15:28:51 +02:00
Ximon EighteenandGitHub 01fccdf942 Add XFR middleware. (#384)
Add XFR middleware and:
- Fixes a bug where the incorrect owner name was passed to the zone walker callback.
- New `ixfr-client.rs` example.
- Updated `serve-zone.rs` example demonstrating TSIG authenticated XFR and NOTIFY middlewares.
- Additional From impls for CallResult.
- Renames ZoneDiff to InMemoryZoneDiff.
- Renames ZoneDiffBuilder to InMemoryZoneDiffBuilder.
- Introduces new ZoneDiff and related traits.
- Adds AnswerContent::first().
2024-10-02 21:28:01 +02:00
Ximon EighteenandGitHub 2c700853d5 XFR response interpreter. (#375) 2024-09-17 15:24:08 +02:00
400843e226 Add TSIG middleware. (#380)
- Add TSIG response signing middleware.
- Update Stelline server integration tests to use the new TSIG middleware.
- Add TSIG Stelline test recipe.
- TSIG module changes:
  - Derive Clone for Key.
  - Added Key::compose_len() for determining how many response bytes to reserve.
  - Added ClientTransaction::wrapped_key(), ClientSequence::wrapped_key() and SigningContext::wrapped_key() to access the real underlying "wrapped" key type.
  - Added From<ServerTransaction<K>> for ServerSequence<K>.
  - Various minor RustDoc improvements.
 - Make Time48 obey mock (predictable and controllable) time so that TSIG signing uses mock time during Stelline tests.

Other:
- Remove unnecessary Unpin bounds on net::server::message::Request.
- Remove unnecessary Clone bound on impl SendRequest for net::client::dgram::Connection.
- Remove unnecessary mutex lock on middleware post-processing response state and rename PostprocessingConfig to PostprocessingState to better reflect its mutable nature.
- Don't set the AA flag on test service responses as (a) actual zone serving doesn't do this yet and this still needs fixing, and (b) it violates the expectations of the TSIG Stelline test that verifies at a byte level the TSIG response signature.

---------

Co-authored-by: Philip Homburg <philip@nlnetlabs.nl>
Co-authored-by: Philip-NLnetLabs <93709748+Philip-NLnetLabs@users.noreply.github.com>
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2024-09-16 16:25:29 +02:00
Ximon EighteenandGitHub 1d022f4283 Revert regression of changes in 0.9.3 that switched from the futures crate to futures-util instead. (#389) 2024-09-13 14:02:57 +02:00
Ximon EighteenandGitHub 282f94b327 Add a TSIG client. (#373) 2024-09-11 16:32:38 +02:00
Philip Homburg 90cc96d632 Add support to client transports for requests that may result in multiple
responses. (#377)

This adds ComposeRequestMulti and other *Multi types. The main change is to
the stream transport, which is the only transport that implements
SendRequestMulti.
2024-09-04 14:03:12 +02:00
Ximon EighteenandGitHub ce74445279 Service enhancement prerequisites for XFR support (#369)
* Adds support for indicating to downstream Service impls that a certain number of bytes should be reserved (to make space for adding a TSIG RR or EDNS options during middleware post-processing).

* Adds support for strongly typed passing of arbitrary metadata between middleware that produces a type and middleware that consumes the type (e.g. passing the used TSIG key name from TSIG middleware to XFR middleware).

* Replaces the blanket impl Service for Arc with a more general impl Service for Deref.

* Removes the blanket impl Service for fn as I have multiple times been blocked from defining some other Service impl because the fn one matches, because its presence can cause very confusing compiler error messages if your impl Service for T is not quite in sync with the signature of your other impl T blocks.

* Adds an "enabled" flag to the CookiesMiddlewareSvc making it easier to create a service stack with optionally enabled layers based on runtime configuration.
2024-09-03 15:39:52 +02:00
Ximon EighteenandGitHub 67f53ea109 Service layering (#307)
This PR changes the design for services by removing all of the existing
middleware types and re-implementing the middleware processors as middleware
services that take an "upstream" service to pass requests on to.
2024-07-29 11:34:32 +02:00
Ximon EighteenandGitHub 0659c8f765 Improved zonefile parsing error messages. (#362)
* Report zone file problems as explanatory messages with supporting data instead of just logging enum variant names.

* Return the set of errors on parsing failure with `TryFrom<inplace::Zonefile> for Zonefile`, ala how it works for `TryFrom<Zonefile> for ZoneBuilder`.
2024-07-24 15:31:44 +02:00
Ximon EighteenandGitHub ec5cb5bbb8 Re-enable and fix the Stelline cookies test (#336)
- Re-enable the cookies Stelline test and fix `CookiesMiddlewareProcessor` to allow requests with invalid cookies to proceed if they are authenticated or not required to authenticate.
- Add support for net blocks in the deny list of the cookie middleware processor, ala Unbound, otherwise the deny list is difficult to use beyond a few simple specific IP addresses.
- Improvements to the Stelline server test support needed by the Stelline cookies test:
  - Advance mock system time in the Stelline server tests.
  - Move Stelline server tests under src/ to permit #cfg(test) based swap out of real system time for mock system time.
  - Use the thread_local version of mock_instant to ensure parallel mock time dependent tests don't interfere with each other (such tests also use tokio::time which only works if they run in a single thread).
  - Set mock system time to start at zero for each Stelline server test (as expected by the cookies .rpl test script).
  - Pass the IP address of the test client to the server so that the cookies middleware can match it against its deny list.
2024-06-27 11:22:02 +02:00
Philip-NLnetLabsandGitHub 97bfa2c9f8 DNSSEC validator (#328)
This PR adds a DNSSEC validator.
2024-06-13 14:05:56 +02:00
Ximon EighteenandGitHub bbfd6ff6ec More Dname to Name renaming. (#308) 2024-05-06 15:26:00 +02:00
Martin HoffmannandGitHub 95a7218048 Update dependencies. (#304)
This PR updates all dependencies to their latest major version. This
requires some changes to the examples using tokio-rustls.

This PR also updates the minimum supported Rust version to 1.70.

This is a breaking change.
2024-04-29 17:41:07 +02:00
Martin HoffmannandGitHub 47655265dd Rename *Dname* to *Name*. (#290)
This PR renames all types and functions that refer to domain name from using
the term “dname” to just “name.” For instance, Dname becomes Name, ToDname
becomes ToName, and ToDname::to_dname becomes ToName::to_name.

This annoyingly wide-reaching change is motivated by a clash with the DNAME
record type that would always be confusing. So we rather do it now.

This is a really breaking change. Apologies.
2024-04-22 13:31:34 +02:00
Ximon EighteenandGitHub b5b411ee56 Add a queryable zone tree (#286)
This PR adds zonefile/parsed.rs, zonetree/ and related examples/, which
together enable, and show a library user how, to go from a zone file in
presentation format to an in-memory tree of zones which can be queried to
provide an answer, or walked (iterated over).

The tree also supports versioned write operations and a trait based zone
implementation allowing for the in-memory tree for a zone to instead be some
other (a)synchornous backing store (as demonstrated by the mysql-zone.rs
example).

The zonetree module is feature-gated behind the unstable-zonetree feature.
2024-04-12 10:21:21 +02:00
Ximon EighteenandGitHub 0bd1a68fe0 Add the net::server module. (#274)
This PR adds an unstable net::server module that enables the creation of UDP
and TCP DNS servers using base transport server, middleware and service building blocks.
2024-04-11 16:41:40 +02:00
Martin HoffmannandGitHub 8d9f686f47 Refactor IANA type variants into constants. (#276)
This PR changes the types for the IANA registered values into structs
wrapping underlying integer types and provides the values as constants. This
mostly just changes the spelling of those values. However, it also required
some re-wiring of the type generation macros for record data and opt data
since the type names and value names differ now.

This is a breaking change.
2024-04-05 11:16:23 +02:00
Philip Homburg 4d13fe8998 Client Cache (#275)
This PR adds experimental support for a client cache provided as a pass
through transport
2024-03-12 10:32:21 +01:00
Philip-NLnetLabsandGitHub b8d2aa59bf Client Transport (#215)
This PR adds experimental support for client transport of DNS messages.

It also adds a new concept of unstable features which gate code that can introduce breaking changes also in non-breaking releases.
2024-01-15 14:54:20 +01:00
Martin HoffmannandGitHub 5075e31f7c Refactor OPT options. (#193)
This PR refactors the existing support for OPT options. It does the
following things:

  o  Changes all option data types to ensure their wire format is at most
     65,535 octets long. This requires changing the signatures of some
     creator functions. Their naming scheme and signatures are also changed
     to follow the pattern established with record data.

  o  Renamed `UnknownOptData::from_octets` to `new` and return a result.

  o  Completely redesigns DNS cookie options, adding support for standard
     server cookies introduced in RFC 9018.

  o  Change the type of `ExtendedError`’s text to `Str<Octs>` and change the
     return type of `set_text` to `()`.

  o  Changed the type `TcpKeepalive`’s content to a newtype `IdleTimeout` to
     make it easier to convert to and from durations.

  o  Changes Padding to just contain the padding octets and drop
     `PaddingMode`. Instead, the methods on OptBuilder` should be used to
     add padding.

This is a breaking change.
2023-04-28 11:20:35 +02:00
Martin HoffmannandGitHub f29816bb94 Drop the try_ prefix from message builder methods. (#164)
This commit drops the `try_` prefix from `MessageBuilder` functions that still have it.
2023-01-10 13:15:40 +01:00
Martin HoffmannandGitHub a2ce078a92 The Great octseq Conversion (#160)
This commit swaps the traits and types defined in `base::octets` for their
equivalent in the `octseq` trait. These are mostly the same except that they
facilitate Generic Associated Types as stabilized in Rust 1.65. This results
in subtly changed trait bounds, though mostly these should be invisible to
the user.

One notable change is that `octseq` makes the error type of the
`OctetsBuilder` generic and uses `Infallible` for those types where
appending data will never fail (which, for most users, is all of them). It
provides methods for either case and we are mirroring these in `domain`.
While this means that converting you code to using the PR will require some
work, that work should mostly be removing unwraps – which is nice.

We’re using the opportunity to clean up a few more things that have crept
into the code over time. A list of which will be added here:

*  The range, slice, and split methods on the domain name types have
   changed. They have been merge into a single method taking ranges – except
   for those on `Dname` that require type changes. The split methods now
   take references and don’t change `self` anymore. This is somewhat
   required by the limitations imposed by the new `Octets` trait but feels
   better, anyway.

*  The `Parse`, `Compose`, and `Scan` traits have been demoted to mere
   extension traits for foreign types (primarily the built-in integers, so
   that you can do things like `u16::parse`). All other types now simply have
   methods matching the patterns. Where generics are necessary, dedicated
   traits have been added. E.g., there now are `ParseRecordData` and
   `ComposeRecordData` traits that are implemented by all record data types.

*  Composing of record data and options has been switched to a scheme where
   the size is predetermined whenever possible instead of composing the data
   and then updating the length after. Since this is not possible for record
   data that uses compressed names when compression is actually in use, the
   old scheme is still used in this particular case.
2023-01-10 12:48:41 +01:00
Axel VialaandGitHub 8b9163d521 Clippy: Needless borrow. (#162)
Found with #[warn(clippy::needless_borrowed_reference)]
2022-12-05 17:40:59 +01:00
Martin HoffmannandGitHub cd88889557 Redesign zone file parsing. (#142)
This commit completely redesigns zone file parsing. The primary change is to
convert the scanner into a trait in order to allow multiple zone parser
implementations for different sources and purposes. A number of changes had
to be made in order to make this possible.

The commit also contains an initial implementation of a scanner that modifies
data in-place and can thus returned parsed data with only a minimal amount
of additional allocations. While working, this scanner is more a
proof-of-concept at this point to ensure that the API design is sound.

This commit is based on ideas and code proposed by @not-my-profile in #106.

This commit increases the minimal supported Rust version to 1.59.0.
2022-11-07 15:11:36 +01:00
28fd40fc0e Add DNS client example (#138)
Co-authored-by: TCY16 <tom@nlnetlabs.nl>
2022-08-26 11:46:00 +02:00
Joonas Koivunen e8296d8b3e chore: redo formatting 2021-01-14 11:50:50 +02:00
Joonas Koivunen 61b7f3f121 chore: cargo fmt 2021-01-13 16:04:16 +02:00
Joonas Koivunen c461f3c830 chore: upgrade deps following tokio 1.0 2021-01-13 13:00:52 +02:00
Martin Hoffmann 748a4d2dc8 Merge domain-resolv into domain::resolv. 2020-08-25 17:52:10 +02:00
Martin Hoffmann ee5a96f18f Re-arrange so that all domain sub-crates can live here. 2018-08-22 10:44:12 +02:00
Martin Hoffmann accb0879d3 Fix examples and doctests. 2018-08-21 19:01:41 +02:00
Martin Hoffmann edda10b2ee Add record types from RFC 4034 and 5155. 2018-05-01 18:37:42 +02:00
Martin Hoffmann 91335ceaf2 Rename Record::name to Record::owner. 2018-03-06 09:50:18 +01:00
Martin Hoffmann 356a9c8567 Make mine more like dig. 2017-12-30 16:07:57 +01:00
Martin Hoffmann 95c16bb1ea Make message builder’s freeze return a Message. 2017-12-21 10:51:10 +01:00
Martin Hoffmann 9a9fe1f0de Rename dig to mine. 2017-12-21 08:57:28 +01:00
Martin Hoffmann 2e56c7adff Bring back dig. 2017-12-21 08:55:12 +01:00
Martin Hoffmann 85904ba808 Switch error handling to failure crate. 2017-11-19 11:06:13 +01:00
Martin Hoffmann 9214f376ff Fix most of Clippy’s complaints. 2017-04-25 16:58:07 +02:00
Martin Hoffmann 8670bb7c16 Update rusthome example. 2017-03-19 10:52:15 +01:00