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
Show file tree
Hide file tree
Changes from 151 commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
ce2c35a
Add support for (a) indicating to downstream Service impls that a cer…
ximon18 Aug 6, 2024
5f1a647
Remove fn accidentally included from the xfr branch but not intended …
ximon18 Aug 6, 2024
b5e33a7
Remove fn accidentally included from the xfr branch but not intended …
ximon18 Aug 6, 2024
6701131
Remove changes accidentally included from the xfr branch but not inte…
ximon18 Aug 6, 2024
a0e1a1d
Remove changes accidentally included from the xfr branch but not inte…
ximon18 Aug 6, 2024
a5fcce5
Update Service RustDocs now that implementing a service impicitly via…
ximon18 Aug 7, 2024
53017f5
Cargo fmt.
ximon18 Aug 7, 2024
40eea81
Show more ways to impl Service on a struct.
ximon18 Aug 7, 2024
0a289e9
More Service RustDoc improvements.
ximon18 Aug 7, 2024
37c35e9
Minor RustDoc fixes.
ximon18 Aug 7, 2024
ace9498
More RustDoc about request metadata and response byte reservation.
ximon18 Aug 7, 2024
cb87682
Reorder field setting order to match struct field order.
ximon18 Aug 8, 2024
6e7a754
Remove EDNS fixes that are also dealt with by separate work in branch…
ximon18 Aug 8, 2024
ef0bfd2
Clippy.
ximon18 Aug 8, 2024
c2e9e9a
Support streaming responses with the stream client.
ximon18 Aug 8, 2024
d8c8b14
Support adding to a message generated by a client before sending it s…
ximon18 Aug 8, 2024
1376041
Fix compilation error caused by the recent streaming support commit.
ximon18 Aug 8, 2024
1447bfc
Cargo fmt.
ximon18 Aug 8, 2024
5e36a5c
Stelline server testing changes:
ximon18 Aug 8, 2024
6aacae9
Add net::client::tsig.
ximon18 Aug 8, 2024
67f0f33
Remove the added Clone derive on tsig::Key, use Arc in the example in…
ximon18 Aug 8, 2024
6e72597
More coding standards compliance.
ximon18 Aug 8, 2024
46cd1bd
Client transport support for AXFR and IXFR.
Philip-NLnetLabs Aug 20, 2024
461c342
Fmt
Philip-NLnetLabs Aug 20, 2024
911365e
A bit of cleanup.
Philip-NLnetLabs Aug 21, 2024
767fac4
Clippy
Philip-NLnetLabs Aug 21, 2024
aa294fb
Review feedback: SERVFAIL if question cannot be built when preparing …
ximon18 Aug 27, 2024
119e7a2
Merge branch 'service-request-metadata-and-byte-reservation-net-clien…
ximon18 Aug 29, 2024
787799e
Merge branch 'stelline-server-testing-changes' into tsig-client.
ximon18 Aug 30, 2024
26b87cc
Merge branch 'service-request-metadata-and-byte-reservation-net-clien…
ximon18 Aug 29, 2024
dc7b039
Revert local change made for testing.
ximon18 Sep 2, 2024
1d7c952
Import used type.
ximon18 Sep 2, 2024
bf79aba
Remove outdated comment.
ximon18 Sep 2, 2024
326207d
Remove commented out code.
ximon18 Sep 2, 2024
0bea63d
Merge branch 'stelline-server-testing-changes' into tsig-client
ximon18 Sep 2, 2024
649836a
Review feedback: Respond with SERVFAIL with whatever questions we wer…
ximon18 Sep 2, 2024
80752e8
Simplify comment.
ximon18 Sep 2, 2024
f8c58a1
Minor RustDoc improvement.
ximon18 Sep 2, 2024
9aa5795
Minor RustDoc improvement.
ximon18 Sep 2, 2024
efe4972
Remove Unpin constraint on Service RequestOctets generic type.
ximon18 Sep 2, 2024
9f44750
Clippy.
ximon18 Sep 2, 2024
b06d978
Merge branch 'service-request-metadata-and-byte-reservation' into ser…
ximon18 Sep 2, 2024
6be66f7
Merge branch 'service-request-metadata-and-byte-reservation-net-clien…
ximon18 Sep 2, 2024
ab63edd
Merge branch 'stelline-server-testing-changes' into tsig-client
ximon18 Sep 2, 2024
7c26d76
Add RustDoc for the multiple response support.
ximon18 Sep 2, 2024
88d7087
Remove outdated comment.
ximon18 Sep 2, 2024
18da3ee
Replace incorrect conversion (as it will return Error::FormError for …
ximon18 Sep 2, 2024
b99e6f7
Remove errant whitespace in RustDoc comments.
ximon18 Sep 2, 2024
024b1d1
Undo reformatting of imports in otherwise untouched files.
ximon18 Sep 2, 2024
0d2a488
Undo reformatting in otherwise untouched file.
ximon18 Sep 2, 2024
d6d5794
Undo reformatting in otherwise untouched file.
ximon18 Sep 2, 2024
ab633ef
Merge branch 'service-request-metadata-and-byte-reservation-net-clien…
ximon18 Sep 2, 2024
8018663
Remove outdated comment.
ximon18 Sep 2, 2024
88b5c75
More TSIG client RustDoc.
ximon18 Sep 2, 2024
ca3cccf
Minor code simplification.
ximon18 Sep 2, 2024
119ab45
Fix example.
Philip-NLnetLabs Sep 3, 2024
6adac7a
Rename Message::is_stream to Message::is_xfr. Remove is_stream from
Philip-NLnetLabs Sep 3, 2024
c2b57c1
Merge branch 'main' into service-request-metadata-and-byte-reservatio…
ximon18 Sep 3, 2024
2caa383
Merge branch 'stelline-server-testing-changes' into tsig-client
ximon18 Sep 3, 2024
5d424e7
Remove is_streaming() fn as it has been removed in upstream branches.
ximon18 Sep 3, 2024
b957161
Cherry pick the Stelline server testing README from the `xfr` branch.
ximon18 Sep 3, 2024
b7db22c
Review feedback: SERVFAIL if question cannot be built when preparing …
ximon18 Aug 27, 2024
45400d0
Review feedback: Respond with SERVFAIL with whatever questions we wer…
ximon18 Sep 2, 2024
fe588d1
Minor RustDoc improvement.
ximon18 Sep 2, 2024
331b247
Remove Unpin constraint on Service RequestOctets generic type.
ximon18 Sep 2, 2024
a10b8f4
Clippy.
ximon18 Sep 2, 2024
84761e0
Remove outdated comment.
ximon18 Sep 2, 2024
ad432ac
More TSIG client RustDoc.
ximon18 Sep 2, 2024
af467d6
Minor code simplification.
ximon18 Sep 2, 2024
4bfef52
- Add TSIG response signing middleware.
ximon18 Sep 3, 2024
7c3bbbf
Remove unnecessary Clone bound.
ximon18 Sep 3, 2024
55ce155
Replace incorrect conversion (as it will return Error::FormError for …
ximon18 Sep 2, 2024
cba3daf
Remove errant whitespace in RustDoc comments.
ximon18 Sep 2, 2024
113fabd
Undo reformatting of imports in otherwise untouched files.
ximon18 Sep 2, 2024
0a1c866
Undo reformatting in otherwise untouched file.
ximon18 Sep 2, 2024
5720e2b
Undo reformatting in otherwise untouched file.
ximon18 Sep 2, 2024
31a083c
Add RustDoc for the multiple response support.
ximon18 Sep 2, 2024
d2c0d51
Fix example.
Philip-NLnetLabs Sep 3, 2024
04533e7
Rename Message::is_stream to Message::is_xfr. Remove is_stream from
Philip-NLnetLabs Sep 3, 2024
3319395
Remove is_streaming() fn as it has been removed in upstream branches.
ximon18 Sep 3, 2024
dcd1f1a
Make Time48 obey mock (predictable and controllable) time so that TSI…
ximon18 Sep 3, 2024
9e78310
Don't set the AA flag on test service responses as (a) actual zone se…
ximon18 Sep 3, 2024
27533bd
Strip the TSIG Stelline server test down to what can be tested withou…
ximon18 Sep 3, 2024
90f6f21
Remove unnecessary display impl.
ximon18 Sep 3, 2024
b3818bc
Add back accidentally removed interop module.
ximon18 Sep 3, 2024
3a10fc7
Don't list middleware modules in RustDoc, let the RustDoc module list…
ximon18 Sep 3, 2024
ba48bc1
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 3, 2024
41f0992
Merge branch 'main' into service-request-metadata-and-byte-reservatio…
ximon18 Sep 4, 2024
29f7bcb
Merge branch 'service-request-metadata-and-byte-reservation-net-clien…
ximon18 Sep 4, 2024
b4861af
Merge branch 'stelline-server-testing-changes' into tsig-client
ximon18 Sep 4, 2024
685294c
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 4, 2024
1bc196a
Docs
Philip-NLnetLabs Sep 4, 2024
e98bfa4
Cleanup.
Philip-NLnetLabs Sep 4, 2024
0b89d1e
Remove comment abou TcpKeepalive.
Philip-NLnetLabs Sep 4, 2024
523fe1d
Docs
Philip-NLnetLabs Sep 4, 2024
dc7e3c2
Docs
Philip-NLnetLabs Sep 4, 2024
33b5089
Update src/net/client/request.rs
Philip-NLnetLabs Sep 4, 2024
f02f773
Use unreachable! instead of panic!
Philip-NLnetLabs Sep 4, 2024
bf781f8
Merge branch 'service-request-metadata-and-byte-reservation-net-clien…
ximon18 Sep 4, 2024
3c3c19d
Merge branch 'stelline-server-testing-changes' into tsig-client
ximon18 Sep 4, 2024
8ae1749
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 4, 2024
c1de8ac
Remove left behind trace statement.
ximon18 Sep 4, 2024
cfe20f6
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 4, 2024
e1357c6
Merge branch 'main' into stelline-server-testing-changes
ximon18 Sep 4, 2024
b93422c
Merge branch 'stelline-server-testing-changes' into tsig-client
ximon18 Sep 4, 2024
108deec
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 4, 2024
e99f021
Merge branch 'main' into stelline-server-testing-changes
ximon18 Sep 9, 2024
aeb3c80
Merge branch 'stelline-server-testing-changes' into tsig-client
ximon18 Sep 9, 2024
d2c3db9
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 9, 2024
2f4e464
Merge branch 'main' into tsig-client
ximon18 Sep 9, 2024
cc037f6
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 9, 2024
76c2b43
- Merge TsigClient and TsigClientMulti.
ximon18 Sep 10, 2024
ebe0d2f
Remove left behind trace logging.
ximon18 Sep 10, 2024
b309a13
Remove AuthenticatedRequestMessageMulti, it isn't needed.
ximon18 Sep 10, 2024
6886079
Fold RequestMulti into Request and RequestStateMulti into RequestStat…
ximon18 Sep 10, 2024
aec32d4
Cargo fmt.
ximon18 Sep 10, 2024
a033102
Small simplification.
ximon18 Sep 10, 2024
ea5dfda
Review feedback: Key should not be optional.
ximon18 Sep 10, 2024
7f328c9
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 10, 2024
59cc56d
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 10, 2024
c8c577a
- More RustDocs.
ximon18 Sep 11, 2024
352c522
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 11, 2024
386b2df
Explain on TSIG failure in client-transport that this is probably exp…
ximon18 Sep 11, 2024
7040044
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 11, 2024
e5d86bc
Merge fix.
ximon18 Sep 11, 2024
67bb521
Add TSIG client tests.
ximon18 Sep 11, 2024
aea337d
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 11, 2024
008574b
Add docs for validator_test.
Philip-NLnetLabs Sep 11, 2024
22d8c62
Resolve cargo doc issues.
ximon18 Sep 11, 2024
bc7baca
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 11, 2024
85a2455
Merge branch 'main' into tsig-middleware
ximon18 Sep 11, 2024
35937a9
Fix test compilation failure after merging with main including revers…
ximon18 Sep 11, 2024
f782927
Revert changes not related to the PR.
ximon18 Sep 11, 2024
88665d9
Revert changes not related to the PR.
ximon18 Sep 11, 2024
c4a0afe
More RustDoc. Removed the unused MaybeAuthenticated trait.
ximon18 Sep 12, 2024
5174a48
- More RustDoc.
ximon18 Sep 12, 2024
226d311
Update references to removed Authentication type.
ximon18 Sep 12, 2024
bf977f7
Fix broken RustDoc references.
ximon18 Sep 12, 2024
f29b8d4
Document known limitation.
ximon18 Sep 12, 2024
41cebe0
- Handle TSIG response truncation using the existing ServerSequence i…
ximon18 Sep 12, 2024
9251700
Revert changes to network servers, will move them to a separate PR.
ximon18 Sep 13, 2024
9fbcf22
Make the reference to the other tsig module less confusing.
ximon18 Sep 15, 2024
cef732f
More RustDoc for the TSIG middleware service.
ximon18 Sep 15, 2024
5679724
Merge branch 'main' into tsig-middleware
ximon18 Sep 15, 2024
0b41774
Fix compilation errors caused by merging with main.
ximon18 Sep 15, 2024
73d7d7d
Remove opcode/query type TSIG verification restrictions.
ximon18 Sep 16, 2024
bf7b77f
Use the existing TSIG error building code, don't hand create it ourse…
ximon18 Sep 16, 2024
a3af7e5
Update src/net/server/middleware/tsig.rs
ximon18 Sep 16, 2024
8509a68
Update src/net/server/middleware/tsig.rs
ximon18 Sep 16, 2024
df0499a
Update src/net/server/middleware/tsig.rs
ximon18 Sep 16, 2024
d9c04b4
Comment correction.
ximon18 Sep 16, 2024
749721e
Rename PostprocessingConfig to PostprocessingState to better reflect …
ximon18 Sep 16, 2024
3df2f22
Undo unnecessary change to tsig::ServerError.
ximon18 Sep 16, 2024
c175bd9
Rename key_wrapper() to wrapped_key().
ximon18 Sep 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/server-transports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl<Svc> StatsMiddlewareSvc<Svc> {
fn postprocess<RequestOctets>(
request: &Request<RequestOctets>,
response: &AdditionalBuilder<StreamTarget<Svc::Target>>,
stats: Arc<RwLock<Stats>>,
stats: &RwLock<Stats>,
) where
RequestOctets: Octets + Send + Sync + Unpin,
Svc: Service<RequestOctets>,
Expand All @@ -512,7 +512,7 @@ impl<Svc> StatsMiddlewareSvc<Svc> {
fn map_stream_item<RequestOctets>(
request: Request<RequestOctets>,
stream_item: ServiceResult<Svc::Target>,
stats: Arc<RwLock<Stats>>,
stats: &mut Arc<RwLock<Stats>>,
) -> ServiceResult<Svc::Target>
where
RequestOctets: Octets + Send + Sync + Unpin,
Expand Down
2 changes: 1 addition & 1 deletion src/net/client/dgram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ where
S: AsyncConnect + Clone + Send + Sync + 'static,
S::Connection:
AsyncDgramRecv + AsyncDgramSend + Send + Sync + Unpin + 'static,
Req: ComposeRequest + Clone + Send + Sync + 'static,
Req: ComposeRequest + Send + Sync + 'static,
{
fn send_request(
&self,
Expand Down
4 changes: 2 additions & 2 deletions src/net/server/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ where

impl<Octs, Metadata> Request<Octs, Metadata>
where
Octs: AsRef<[u8]> + Send + Sync + Unpin,
Octs: AsRef<[u8]> + Send + Sync,
{
/// Creates a new request wrapper around a message along with its context.
pub fn new(
Expand Down Expand Up @@ -270,7 +270,7 @@ where

impl<Octs, Metadata> Clone for Request<Octs, Metadata>
where
Octs: AsRef<[u8]> + Send + Sync + Unpin,
Octs: AsRef<[u8]> + Send + Sync,
Metadata: Clone,
{
fn clone(&self) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/net/server/middleware/edns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ where
fn map_stream_item(
request: Request<RequestOctets, RequestMeta>,
mut stream_item: ServiceResult<NextSvc::Target>,
_pp_meta: (),
_pp_meta: &mut (),
) -> ServiceResult<NextSvc::Target> {
if let Ok(cr) = &mut stream_item {
if let Some(response) = cr.response_mut() {
Expand Down
4 changes: 2 additions & 2 deletions src/net/server/middleware/mandatory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ where
fn map_stream_item(
request: Request<RequestOctets, RequestMeta>,
mut stream_item: ServiceResult<NextSvc::Target>,
strict: bool,
strict: &mut bool,
) -> ServiceResult<NextSvc::Target> {
if let Ok(cr) = &mut stream_item {
if let Some(response) = cr.response_mut() {
Self::postprocess(&request, response, strict);
Self::postprocess(&request, response, *strict);
}
}
stream_item
Expand Down
16 changes: 7 additions & 9 deletions src/net/server/middleware/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@
//! post-processing the resulting responses and propagating them back down
//! through the layers to the server.
//!
//! Currently the following middleware are available:
//! If needed middleware services can pass service specific data to upstream
//! services for consumption, via the `RequestMeta` custom data support of
//! the [`Service`] trait. An example of this can be seen in the
//! [`TsigMiddlewareSvc`][tsig::TsigMiddlewareSvc].
//!
//! - [`MandatoryMiddlewareSvc`]: Core DNS RFC standards based message
//! processing for MUST requirements.
//! - [`EdnsMiddlewareSvc`]: RFC 6891 and related EDNS message processing.
//! - [`CookiesMiddlewareSvc`]: RFC 7873 DNS Cookies related message
//! processing.
//! Currently the following middleware are available:
//!
//! [`MandatoryMiddlewareSvc`]: mandatory::MandatoryMiddlewareSvc
//! [`EdnsMiddlewareSvc`]: edns::EdnsMiddlewareSvc
//! [`CookiesMiddlewareSvc`]: cookies::CookiesMiddlewareSvc
//! [`Service`]: crate::net::server::service::Service

#[cfg(feature = "siphasher")]
pub mod cookies;
pub mod edns;
pub mod mandatory;
pub mod stream;
#[cfg(feature = "tsig")]
pub mod tsig;
12 changes: 5 additions & 7 deletions src/net/server/middleware/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ type PostprocessingStreamCallback<
> = fn(
Request<RequestOctets, RequestMeta>,
StreamItem,
PostProcessingMeta,
&mut PostProcessingMeta,
) -> StreamItem;

//------------ PostprocessingStream ------------------------------------------
Expand Down Expand Up @@ -153,7 +153,7 @@ where
pub fn new(
svc_call_fut: Future,
request: Request<RequestOctets, RequestMeta>,
metadata: PostProcessingMeta,
pp_meta: PostProcessingMeta,
cb: PostprocessingStreamCallback<
RequestOctets,
Stream::Item,
Expand All @@ -165,7 +165,7 @@ where
state: PostprocessingStreamState::Pending(svc_call_fut),
request,
cb,
pp_meta: metadata,
pp_meta,
}
}
}
Expand All @@ -187,7 +187,6 @@ where
Stream: futures_util::stream::Stream + Unpin,
Self: Unpin,
RequestMeta: Clone,
PostProcessingMeta: Clone,
{
type Item = Stream::Item;

Expand All @@ -206,9 +205,8 @@ where
let stream_item = ready!(stream.poll_next_unpin(cx));
trace!("Stream item retrieved, mapping to downstream type");
let request = self.request.clone();
let pp_meta = self.pp_meta.clone();
let map =
stream_item.map(|item| (self.cb)(request, item, pp_meta));
let map = stream_item
.map(|item| (self.cb)(request, item, &mut self.pp_meta));
Poll::Ready(map)
}
}
Expand Down
Loading