Hornet¶
Hornet is a fast, comprehensive Rust library for parsing, writing, and validating
BIND9 named.conf configuration files and DNS zone files.
Project Status¶
Technology¶
Security¶
Community¶
What is Hornet?¶
Hornet gives Rust applications a complete toolkit for working with BIND9 configuration. It parses config files and zone files into strongly-typed ASTs, serialises them back to valid text with configurable formatting, and runs semantic validation to catch common mistakes before they reach a live DNS server.
Key Features¶
| Capability | Details |
|---|---|
Parse named.conf |
options, zone, view, acl, logging, controls, key, primaries, server |
| Parse zone files | A, AAAA, NS, MX, SOA, CNAME, PTR, TXT, SRV, CAA, SSHFP, TLSA, NAPTR, DS, DNSKEY, RRSIG, NSEC, HTTPS/SVCB, and unknown types |
| Write / format | Round-trip serialisation with configurable indentation and keyword normalisation |
| Validate | Semantic checks: undefined ACLs, duplicate zones, missing SOA/NS, CIDR correctness, and more |
| CLI tool | parse, zone, check, check-zone, fmt, convert subcommands |
| Rich error reporting | Precise diagnostics via miette with source spans |
| Modern keyword aliases | Automatically rewrite master → primary, slave → secondary |
| Serde support | Optional serde feature flag adds Serialize/Deserialize to all AST types |
Quick Example¶
Parse a named.conf¶
use hornet_bind9::parse_named_conf;
let input = r#"
options {
directory "/var/cache/bind";
recursion yes;
allow-query { any; };
};
zone "example.com" {
type primary;
file "/etc/bind/zones/example.com.db";
};
"#;
let conf = parse_named_conf(input)?;
println!("{} statement(s)", conf.statements.len()); // 2
Validate a config¶
use hornet_bind9::{parse_named_conf, validate_named_conf, Severity};
let conf = parse_named_conf(input)?;
for diag in validate_named_conf(&conf) {
match diag.severity {
Severity::Error => eprintln!("error: {}", diag.message),
Severity::Warning => eprintln!("warn: {}", diag.message),
Severity::Info => println! ("info: {}", diag.message),
}
}
Use the CLI¶
# Validate a config file (exits 1 on errors/warnings)
hornet check /etc/bind/named.conf
# Reformat in-place
hornet fmt /etc/bind/named.conf
# Migrate legacy keywords (master → primary)
hornet convert --in-place /etc/bind/named.conf
Who Should Use Hornet?¶
Hornet is designed for:
- DNS automation tools that need to read, modify, and write BIND9 config
- Configuration linters and CI pipelines that validate DNS files before deployment
- Migration tools converting legacy BIND8 configs to modern BIND9 syntax
- Monitoring agents that parse running BIND9 configs for observability
- Testing frameworks that generate and assert on BIND9 configurations programmatically
Project Status¶
Hornet is actively developed. It supports the full breadth of named.conf statement types and
24+ DNS record types. The library API is stabilising toward a 1.0 release.
Current version: v0.1.0
Next Steps¶
- Quick Start — Install and use hornet in five minutes
- Concepts — Understand the AST and processing pipeline
- User Guide — Detailed guides for parsing, writing, and validation
- CLI Reference — Full
hornetCLI documentation - Reference — Complete named.conf constructs and record types
License¶
Hornet is licensed under the MIT License.