Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TSIG middleware. #380

Merged
merged 154 commits into from
Sep 16, 2024
Merged

Add TSIG middleware. #380

merged 154 commits into from
Sep 16, 2024

Conversation

ximon18
Copy link
Member

@ximon18 ximon18 commented Sep 3, 2024

Taken from the xfr branch in order to split PR #335 into several smaller PRs.

Notable changes:

  • Add TSIG response signing middleware.
  • Add TSIG Stelline test recipe.
  • Update Stelline server integration tests to use the new TSIG middleware.
  • Remove unnecessary Unpin bounds in net::server::message::Request.
  • Tsig module changes:
    • Derive Clone for Key.
    • Added Key::compose_len() for determining how many response bytes to reserve.
    • Added From<ServerTransaction<K>> for ServerSequence<K>.
    • Various minor RustDoc improvements.
    • Made tsig::ServerError::unsigned() public.
  • Make Time48 obey mock (predictable and controllable) time so that TSIG signing uses mock time during Stelline tests.
  • 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.

This PR will also benefit from merging PR #334 and PR #390.

ximon18 and others added 30 commits August 6, 2024 23:34
…tain number of bytes should be reserved (to make space for post-processing adding EDNS options to the response), and (b) strongly typed passing of arbitrary metadata between middleware that produces a type and middleware that consumes the type (e.g. a TSIG key name).
…o that a wrapper client (such as a future TSIG client) can augment the message before it gets sent.
- Added a simple UDP client that doesn't interfere with requests before sending (for TSIG testing).
- Added support for receiving multiple responses (for XFR testing).
- Added support for connection timeout errors
- Added support for connection termination errors (for EDNS testing).
- Added support for specifying the TSIG key to use (for TSIG testing).
- Added support for $ORIGIN in zone file fragments.
- Simplified rcode checking and use it instead of the yxrrset BADCOOKIE hack.
- In memory channel changes:
  - Fixed a trace message that incorrectly referred to client instead of server.
  - Fixed a too-tight connection read loop that was preventing Tokio task switching.
  - Added connection shutdown detection.
- Fixed incorrect setting of TCP mode to true when UDP mode was requested.
…t' into stelline-server-testing-changes.

Update Stelline based server tests to work with new multiple response capable
Rust types and alternate stream end detection mechanism.
@ximon18
Copy link
Member Author

ximon18 commented Sep 12, 2024

For RFC 8945 compliance we also need #334.

While it doesn't violate a MUST, this PR doesn't handle this at present:

5.2.3 Time Check and Error Handling
...
The server SHOULD also cache the most recent Time Signed value in a message generated by a key and SHOULD return BADTIME if a message received later has an earlier Time Signed value.

@Philip-NLnetLabs
Copy link
Member

That needs to listed as a limitation. Certainly for UPDATE that is something we need.

…f available, via a new TruncationContext type.

- Truncate for TCP as well as UDP.
- Return ServiceError::InternalError if truncation fails.
- Implement handling of ServiceError in DgramServer and stream::Connection.
- Break DgramServer and stream::Connection dispatch to service code out into helper RequestDispatcher types.
- Terminate the response stream if ServiceError::InternalError occurs.
@ximon18
Copy link
Member Author

ximon18 commented Sep 13, 2024

That needs to listed as a limitation. Certainly for UPDATE that is something we need.

Done.

Copy link
Member Author

@ximon18 ximon18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that for a middleware TSIG layer it is best to reject what we cannot support at the moment. So if get_relevant_question fails then don't proceed.

After some internal discussion it seems to me that there is no reason to restrict the opcode or query type on which TSIG verification is performed. If the request has a TSIG RR and the server stack includes TSIG middleware then that middleware should verify the TSIG signature and also sign any corresponding response. So I'm going to remove this restriction entirely.

@ximon18 ximon18 merged commit 400843e into main Sep 16, 2024
26 checks passed
@ximon18 ximon18 deleted the tsig-middleware branch September 16, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants