Skip to main content

DataplaneDnssecValidator

Struct DataplaneDnssecValidator 

Source
pub struct DataplaneDnssecValidator { /* private fields */ }
Expand description

Dataplane DNSSEC validator handed to the proxy via super::DnsProxyConfig::dnssec_validator.

Construct via DataplaneDnssecValidator::from_authority in production (returns Ok(None) for mode = off so the proxy hot path is unchanged), or via the test-only DataplaneDnssecValidator::with_backend for unit tests.

Implementations§

Source§

impl DataplaneDnssecValidator

Source

pub fn from_authority(auth: &DnsAuthority) -> Result<Option<Self>, CellosError>

SEC-21 Phase 3h.1 — construct a validator from a parsed DnsAuthority.

Returns:

  • Ok(None) when the first declared resolver has no dnssec block or has dnssec.validate = false — i.e. the cell opted out (mode = off). The proxy hot path stays byte-identical to today.
  • Ok(Some(..)) when dnssec.validate = true. The validator is ready to evaluate workload queries. fail_closed is taken from dnssec.fail_closed (true → require, false → best_effort).
  • Err(CellosError::InvalidSpec) when dnssec.trust_anchors_path is set but the file is missing, symlinked, or oversized — the trust-anchor loader (reused from crate::resolver_refresh::dnssec::TrustAnchors) refuses to construct the validator silently. Surfacing this at activation time prevents a cell from running with a broken validator and a half-enforced policy.

Resolver selection: the first entry of auth.resolvers is consulted; this matches the proxy’s existing super::DnsProxyConfig::upstream_resolver_id convention (the proxy talks to one upstream resolver per cell). Cells with multiple resolvers and per-resolver DNSSEC policies are out of scope for P3h.1.

Tokio context: this constructor does NOT call Handle::current() — the production backend captures the handle lazily on the first validate() call. This keeps from_authority callable from unit tests that don’t have a runtime, while still letting production (which always has a runtime) drive hickory.

Source

pub fn is_require_mode(&self) -> bool

true when the validator was constructed in require mode (cell’s DnsAuthority set dnssec.fail_closed = true). Drives the proxy’s SERVFAIL decision for Unsigned and Skip outcomes.

Source

pub fn trust_anchor_source(&self) -> &str

Trust-anchor source descriptor stamped into emitted events ("iana-default" or the basename of an operator-supplied file).

Source

pub fn validate( &self, query: &[u8], _upstream_answer: &[u8], ) -> DataplaneDnssecOutcome

Validate a single workload query.

query is the raw UDP payload the workload sent. _upstream_answer is the raw upstream response — ignored under Option B: the validator re-resolves the same (qname, qtype) through hickory to produce an independent verdict (see module docs for why we chose Option B over Option A).

The parameter is plumbed for forward-compat to a future Option-A migration that injects the raw answer into hickory’s validator (when hickory exposes such a knob).

§Type dispatch (post-A2)

validate() switches over the parsed qtype:

Query typeBackend dispatched
A, AAAAself.backend (hickory lookup_ip strategy)
CNAME, HTTPS, SVCB, MX, TXTself.typed_backend (hickory generic lookup)
All othersSkip (call site policy: SERVFAIL in require, forward in best_effort)

When self.typed_backend is None (validators built via the pre-A2 Self::with_backend test constructor), CNAME/HTTPS/SVCB/MX/TXT also Skip — preserving backward compatibility with the existing P3h.1 test surface that asserts TXT + require → SERVFAIL.

§Outcomes
  • DataplaneDnssecOutcome::Skip for query types outside the first-class set, or for first-class types when the typed-record backend is absent. Caller policy decides what to do (see module docs).
  • DataplaneDnssecOutcome::Validated when hickory’s bundled validator chained the response back to the configured anchors.
  • DataplaneDnssecOutcome::Unsigned when the zone has no DNSSEC chain.
  • DataplaneDnssecOutcome::Failed when the validator rejected the chain (RRSIG missing, signature bogus, or chained to a non-anchor key) OR the backend returned an I/O error (network timeout / SERVFAIL from upstream — fail-safe to Failed).

Trait Implementations§

Source§

impl Debug for DataplaneDnssecValidator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more