Skip to main content

ResolverRefresh

Struct ResolverRefresh 

Source
pub struct ResolverRefresh<'a> {
    pub policy: Option<&'a DnsRefreshPolicy>,
    pub rebinding_policy: Option<&'a DnsRebindingPolicy>,
    pub resolvers: &'a [DnsResolver],
    pub hostnames: &'a [String],
    pub keyset_id: Option<&'a str>,
    pub issuer_kid: Option<&'a str>,
    pub policy_digest: Option<&'a str>,
    pub correlation_id: Option<&'a str>,
    pub source: Option<&'a str>,
    pub dnssec_policy: Option<&'a DnsResolverDnssecPolicy>,
    pub trust_anchors: Option<&'a TrustAnchors>,
}
Expand description

One refresh-tick execution.

Borrows the spec-side configuration (no allocation), runs each declared hostname through the injected resolver, and produces drift CloudEvents the caller publishes via the configured event sink.

Fields§

§policy: Option<&'a DnsRefreshPolicy>

Refresh policy from spec.authority.dnsAuthority.refreshPolicy. None → defaults: no floor, no ceiling, ttl-honor strategy.

§rebinding_policy: Option<&'a DnsRebindingPolicy>

SEC-21 Phase 3e — DNS rebinding mitigation policy from spec.authority.dnsAuthority.rebindingPolicy. None → no per-hostname response-IP tracking. Combined with the P3a TTL floor (policy.min_ttl_seconds), this structurally closes the v0.4.0 rebinding residual.

§resolvers: &'a [DnsResolver]

Declared resolvers from spec.authority.dnsAuthority.resolvers[]. The first entry’s resolverId is used as the event’s resolverId when present; the empty string is used when none are declared.

§hostnames: &'a [String]

Hostnames the supervisor may refresh — typically derived from spec.authority.egressRules[].hostspec.authority.dnsAuthority.hostnameAllowlist.

§keyset_id: Option<&'a str>

Optional keysetId to bind into emitted events.

§issuer_kid: Option<&'a str>

Optional issuerKid to bind into emitted events.

§policy_digest: Option<&'a str>

Optional policy-bundle digest (sha256:<hex>) to bind into emitted events.

§correlation_id: Option<&'a str>

Optional pass-through correlation id.

§source: Option<&'a str>

CloudEvent source field — defaults to cellos-supervisor when the caller passes None.

§dnssec_policy: Option<&'a DnsResolverDnssecPolicy>

SEC-21 Phase 3h — opt-in DNSSEC validation policy. None (default) preserves P3a/P3e behaviour exactly: no validation, no dns_authority_dnssec_failed events, no dnssec_status tagging on drift events. When Some, the Self::tick_with_dnssec method honours validate / failClosed per resolver — see method docs.

§trust_anchors: Option<&'a TrustAnchors>

Trust anchors loaded from the env / spec / IANA-default precedence chain. Used purely for stamping the source descriptor into emitted events; hickory 0.24’s resolver does not accept custom anchors via public API. See [super::dnssec] module docs for the residual.

Implementations§

Source§

impl<'a> ResolverRefresh<'a>

Source

pub fn tick( &self, state: &mut ResolverState, resolver: &ResolverFn<'_>, now: SystemTime, cell_id: &str, run_id: &str, ) -> Vec<CloudEventV1>

Run one refresh tick.

For each declared hostname:

  • If the strategy is manual, skip (operator must opt in).
  • If min_ttl_seconds says we refreshed recently, skip — unless max_stale_seconds has been exceeded (ceiling overrides floor).
  • Call the injected resolver. On error: leave prior state untouched and emit no event (transient failures are not drift).
  • Canonicalize, hash, compare against prior digest.
  • On change, build a DnsAuthorityDrift payload, wrap it in a CloudEvent envelope, and append to the returned vector.
  • Update state with the new observation.

Returns the events the caller should publish — possibly empty.

Source

pub fn tick_with_rebinding( &self, state: &mut ResolverState, rebinding_state: &mut RebindingState, resolver: &ResolverFn<'_>, now: SystemTime, cell_id: &str, run_id: &str, ) -> Vec<CloudEventV1>

SEC-21 Phase 3e variant of Self::tick that also threads a per-cell RebindingState for DNS rebinding mitigation.

Behaves identically to tick when self.rebinding_policy is None: emits only dns_authority_drift events, never touches rebinding_state. When rebinding_policy is Some:

  1. Resolves every hostname (same as tick).
  2. For each successful resolution, calls RebindingState::evaluate to decide which IPs are novel, whether the per-hostname cap is exceeded, and which IPs violate the operator allowlist.
  3. Emits one dns_authority_rebind_threshold per hostname when the cap is exceeded, and one dns_authority_rebind_rejected per allowlist violation.
  4. Stamps the EFFECTIVE targets (post-rejection when reject_on_rebind=true) into the subsequent dns_authority_drift event so the drift digest reflects what the workload actually resolves to.
  5. Calls RebindingState::commit with the effective targets so the per-cell history persists across ticks.
Source§

impl<'a> ResolverRefresh<'a>

Source

pub fn tick_with_dnssec( &self, state: &mut ResolverState, rebinding_state: &mut RebindingState, validated_resolved: &HashMap<String, Result<ValidatedResolvedAnswer>>, now: SystemTime, cell_id: &str, run_id: &str, ) -> Vec<CloudEventV1>

SEC-21 Phase 3h variant of Self::tick_with_rebinding that also processes DNSSEC validation outcomes per hostname.

Behaviour:

  • When self.dnssec_policy is None, this method behaves exactly like Self::tick_with_rebinding except it pulls per-hostname answers from validated_resolved and stamps dnssec_status: not_attempted on every emitted drift event.
  • When self.dnssec_policy is Some(policy):
    • Validateddnssec_status: validated, normal flow.
    • Failed{reason} → emit dns_authority_dnssec_failed (reason: validation_failed); when policy.fail_closed, drop answer.targets to empty BEFORE the rebinding evaluator runs and tag drift dnssec_status: validation_failed.
    • Unsigned → emit dns_authority_dnssec_failed (reason: unsigned_zone); same fail_closed semantics.

Order: dnssec_failed events are emitted BEFORE the drift / rebinding events for that hostname so a SIEM sees them in causal order (“dnssec_failed → drift”).

Auto Trait Implementations§

§

impl<'a> Freeze for ResolverRefresh<'a>

§

impl<'a> RefUnwindSafe for ResolverRefresh<'a>

§

impl<'a> Send for ResolverRefresh<'a>

§

impl<'a> Sync for ResolverRefresh<'a>

§

impl<'a> Unpin for ResolverRefresh<'a>

§

impl<'a> UnsafeUnpin for ResolverRefresh<'a>

§

impl<'a> UnwindSafe for ResolverRefresh<'a>

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