ms-dnsp
Parser and builder for the dnsRecord blob — how an Active-Directory-integrated DNS zone
stores each resource record (MS-DNSP §2.3.2.2, DNS_RPC_RECORD). Pure Rust, no FFI, no
network, no LDAP client of its own.
A dnsNode object under DC=<zone>,CN=MicrosoftDNS,DC=DomainDnsZones,… carries one
multi-valued dnsRecord attribute; every value is one of these blobs — a 24-byte header
plus type-specific data. Read them out of an LDAP search, hand them here.
use ;
for value in entry.attr_values
Building works the same way and is byte-for-byte round-trip stable:
let rec = new.with_ttl;
let blob = rec.to_bytes;
Covers
A, AAAA, NS, CNAME, PTR, SOA, MX, SRV, TXT, and DNS_TYPE_ZERO
tombstones. Any other type is preserved verbatim as RecordData::Unknown, so a record this
crate does not model still round-trips unchanged.
Both name encodings are handled: DNS_COUNT_NAME (length + label count + length-prefixed
labels) and DNS_RPC_NAME.
Details that bite
dwTtlSecondsis big-endian; every other integer in the header is little-endian.dwTimeStampis hours since 1601-01-01 UTC, and0means the record is static and will never be scavenged —DnsRecord::timestamp_unix()andis_static()handle both.Rankdecides which copy of a record wins; authoritative zone data isrank::ZONE(0xF0).
Parsing never panics: every length byte is validated against the buffer before it is used.
Who this is for
- Auditing AD-integrated DNS: who can update which zone, which records are unsecured, what the SRV topology exposes.
- DFIR and inventory over an LDAP dump, with no Windows host in the loop.
- Anything that has to write records back into AD without going through the DNS RPC server.
License
MIT