pub struct SqliteAuthority { /* private fields */ }
This is supported on crate feature sqlite only.
Expand description

SqliteAuthority is responsible for storing the resource records for a particular zone.

Authorities default to DNSClass IN. The ZoneType specifies if this should be treated as the start of authority for the zone, is a Secondary, or a cached zone.

Implementations

Creates a new Authority.

Arguments
  • in_memory - InMemoryAuthority for all records.
  • allow_update - If true, then this zone accepts dynamic updates.
  • is_dnssec_enabled - If true, then the zone will sign the zone with all registered keys, (see add_zone_signing_key())
Return value

The new Authority.

load the authority from the configuration

Recovers the zone from a Journal, returns an error on failure to recover the zone.

Arguments
  • journal - the journal from which to load the persisted zone.

Persist the state of the current zone to the journal, does nothing if there is no associated Journal.

Returns an error if there was an issue writing to the persistence layer.

Associate a backing Journal with this Authority for Updatable zones

This is supported on crate feature testing only.

Returns the associated Journal

Enables the zone for dynamic DNS updates

This is supported on crate feature testing only.

Get serial

RFC 2136, DNS Update, April 1997


3.2 - Process Prerequisite Section

  Next, the Prerequisite Section is checked to see that all
  prerequisites are satisfied by the current state of the zone.  Using
  the definitions expressed in Section 1.2, if any RR's NAME is not
  within the zone specified in the Zone Section, signal NOTZONE to the
  requestor.

3.2.1. For RRs in this section whose CLASS is ANY, test to see that
  TTL and RDLENGTH are both zero (0), else signal FORMERR to the
  requestor.  If TYPE is ANY, test to see that there is at least one RR
  in the zone whose NAME is the same as that of the Prerequisite RR,
  else signal NXDOMAIN to the requestor.  If TYPE is not ANY, test to
  see that there is at least one RR in the zone whose NAME and TYPE are
  the same as that of the Prerequisite RR, else signal NXRRSET to the
  requestor.

3.2.2. For RRs in this section whose CLASS is NONE, test to see that
  the TTL and RDLENGTH are both zero (0), else signal FORMERR to the
  requestor.  If the TYPE is ANY, test to see that there are no RRs in
  the zone whose NAME is the same as that of the Prerequisite RR, else
  signal YXDOMAIN to the requestor.  If the TYPE is not ANY, test to
  see that there are no RRs in the zone whose NAME and TYPE are the
  same as that of the Prerequisite RR, else signal YXRRSET to the
  requestor.

3.2.3. For RRs in this section whose CLASS is the same as the ZCLASS,
  test to see that the TTL is zero (0), else signal FORMERR to the
  requestor.  Then, build an RRset for each unique <NAME,TYPE> and
  compare each resulting RRset for set equality (same members, no more,
  no less) with RRsets in the zone.  If any Prerequisite RRset is not
  entirely and exactly matched by a zone RRset, signal NXRRSET to the
  requestor.  If any RR in this section has a CLASS other than ZCLASS
  or NONE or ANY, signal FORMERR to the requestor.

3.2.4 - Table Of Metavalues Used In Prerequisite Section

  CLASS    TYPE     RDATA    Meaning
  ------------------------------------------------------------
  ANY      ANY      empty    Name is in use
  ANY      rrset    empty    RRset exists (value independent)
  NONE     ANY      empty    Name is not in use
  NONE     rrset    empty    RRset does not exist
  zone     rrset    rr       RRset exists (value dependent)
This is supported on crate feature dnssec only.

RFC 2136, DNS Update, April 1997


3.3 - Check Requestor's Permissions

3.3.1. Next, the requestor's permission to update the RRs named in
  the Update Section may be tested in an implementation dependent
  fashion or using mechanisms specified in a subsequent Secure DNS
  Update protocol.  If the requestor does not have permission to
  perform these updates, the server may write a warning message in its
  operations log, and may either signal REFUSED to the requestor, or
  ignore the permission problem and proceed with the update.

3.3.2. While the exact processing is implementation defined, if these
  verification activities are to be performed, this is the point in the
  server's processing where such performance should take place, since
  if a REFUSED condition is encountered after an update has been
  partially applied, it will be necessary to undo the partial update
  and restore the zone to its original state before answering the
  requestor.

RFC 2136, DNS Update, April 1997


3.4 - Process Update Section

  Next, the Update Section is processed as follows.

3.4.1 - Prescan

  The Update Section is parsed into RRs and each RR's CLASS is checked
  to see if it is ANY, NONE, or the same as the Zone Class, else signal
  a FORMERR to the requestor.  Using the definitions in Section 1.2,
  each RR's NAME must be in the zone specified by the Zone Section,
  else signal NOTZONE to the requestor.

3.4.1.2. For RRs whose CLASS is not ANY, check the TYPE and if it is
  ANY, AXFR, MAILA, MAILB, or any other QUERY metatype, or any
  unrecognized type, then signal FORMERR to the requestor.  For RRs
  whose CLASS is ANY or NONE, check the TTL to see that it is zero (0),
  else signal a FORMERR to the requestor.  For any RR whose CLASS is
  ANY, check the RDLENGTH to make sure that it is zero (0) (that is,
  the RDATA field is empty), and that the TYPE is not AXFR, MAILA,
  MAILB, or any other QUERY metatype besides ANY, or any unrecognized
  type, else signal FORMERR to the requestor.

Updates the specified records according to the update section.

RFC 2136, DNS Update, April 1997


3.4.2.6 - Table Of Metavalues Used In Update Section

  CLASS    TYPE     RDATA    Meaning
  ---------------------------------------------------------
  ANY      ANY      empty    Delete all RRsets from a name
  ANY      rrset    empty    Delete an RRset
  NONE     rrset    rr       Delete an RR from an RRset
  zone     rrset    rr       Add to an RRset
Arguments
  • records - set of record instructions for update following above rules
  • auto_signing_and_increment - if true, the zone will sign and increment the SOA, this should be disabled during recovery.

Methods from Deref<Target = InMemoryAuthority>

The DNSClass of this zone

This is supported on crate feature testing only.

Allow AXFR’s (zone transfers)

Clears all records (including SOA, etc)

Retrieve the Signer, which contains the private keys, for this zone

Get all the records

Get a mutable reference to the records

Get a mutable reference to the records

Returns the minimum ttl (as used in the SOA record)

get the current serial number for the zone.

Inserts or updates a Record depending on it’s existence in the authority.

Guarantees that SOA, CNAME only has one record, will implicitly update if they already exist.

Arguments
  • record - The Record to be inserted or updated.
  • serial - Current serial number to be recorded against updates.
Return value

true if the value was inserted, false otherwise

Non-async version of upsert when behind a mutable reference.

This is supported on crate feature dnssec only.

Non-async method of add_update_auth_key when behind a mutable reference

This is supported on crate feature dnssec only.

Non-async method of add_zone_signing_key when behind a mutable reference

This is supported on crate feature dnssec only.

(Re)generates the nsec records, increments the serial number and signs the zone

Trait Implementations

What type is this zone

Return true if AXFR is allowed

Takes the UpdateMessage, extracts the Records, and applies the changes to the record set.

RFC 2136, DNS Update, April 1997


3.4 - Process Update Section

  Next, the Update Section is processed as follows.

3.4.2 - Update

  The Update Section is parsed into RRs and these RRs are processed in
  order.

3.4.2.1. If any system failure (such as an out of memory condition,
  or a hardware error in persistent storage) occurs during the
  processing of this section, signal SERVFAIL to the requestor and undo
  all updates applied to the zone during this transaction.

3.4.2.2. Any Update RR whose CLASS is the same as ZCLASS is added to
  the zone.  In case of duplicate RDATAs (which for SOA RRs is always
  the case, and for WKS RRs is the case if the ADDRESS and PROTOCOL
  fields both match), the Zone RR is replaced by Update RR.  If the
  TYPE is SOA and there is no Zone SOA RR, or the new SOA.SERIAL is
  lower (according to [RFC1982]) than or equal to the current Zone SOA
  RR's SOA.SERIAL, the Update RR is ignored.  In the case of a CNAME
  Update RR and a non-CNAME Zone RRset or vice versa, ignore the CNAME
  Update RR, otherwise replace the CNAME Zone RR with the CNAME Update
  RR.

3.4.2.3. For any Update RR whose CLASS is ANY and whose TYPE is ANY,
  all Zone RRs with the same NAME are deleted, unless the NAME is the
  same as ZNAME in which case only those RRs whose TYPE is other than
  SOA or NS are deleted.  For any Update RR whose CLASS is ANY and
  whose TYPE is not ANY all Zone RRs with the same NAME and TYPE are
  deleted, unless the NAME is the same as ZNAME in which case neither
  SOA or NS RRs will be deleted.

3.4.2.4. For any Update RR whose class is NONE, any Zone RR whose
  NAME, TYPE, RDATA and RDLENGTH are equal to the Update RR is deleted,
  unless the NAME is the same as ZNAME and either the TYPE is SOA or
  the TYPE is NS and the matching Zone RR is the only NS remaining in
  the RRset, in which case this Update RR is ignored.

3.4.2.5. Signal NOERROR to the requestor.
Arguments
  • update - The UpdateMessage records will be extracted and used to perform the update actions as specified in the above RFC.
Return value

true if any of additions, updates or deletes were made to the zone, false otherwise. Err is returned in the case of bad data, etc.

Get the origin of this zone, i.e. example.com is the origin for www.example.com

Looks up all Resource Records matching the giving Name and RecordType.

Arguments
  • name - The Name, label, to lookup.
  • rtype - The RecordType, to lookup. RecordType::ANY will return all records matching name. RecordType::AXFR will return all record types except RecordType::SOA due to the requirements that on zone transfers the RecordType::SOA must both precede and follow all other records.
  • is_secure - If the DO bit is set on the EDNS OPT record, then return RRSIGs as well.
Return value

None if there are no matching records, otherwise a Vec containing the found records.

Return the NSEC records based on the given name

Arguments
  • name - given this name (i.e. the lookup name), return the NSEC record that is less than this
  • is_secure - if true then it will return RRSIG records as well

Result of a lookup

Using the specified query, perform a lookup against this zone. Read more

Get the NS, NameServer, record for the zone

Returns the SOA of the authority. Read more

Returns the SOA record for the zone

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

By adding a secure key, this will implicitly enable dnssec for the zone.

Arguments
  • signer - Signer with associated private key

(Re)generates the nsec records, increments the serial number and signs the zone

Add a (Sig0) key that is authorized to perform updates against this authority

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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