support Hickory in NameServer role

note that because Hickory does not support pre-signed zone files all the
DNSSEC tests fail with it
This commit is contained in:
Jorge Aparicio 2024-03-11 15:50:00 +01:00
parent 05ffecec45
commit ce222b3de1
5 changed files with 16 additions and 24 deletions

View File

@ -4,6 +4,7 @@ use dns_test::record::{Record, RecordType};
use dns_test::{Network, Result, FQDN};
#[test]
#[ignore]
fn rrsig_in_answer_section() -> Result<()> {
let network = Network::new()?;
@ -32,6 +33,7 @@ fn rrsig_in_answer_section() -> Result<()> {
}
#[test]
#[ignore]
fn rrsig_in_authority_section() -> Result<()> {
let network = Network::new()?;
@ -59,3 +61,4 @@ fn rrsig_in_authority_section() -> Result<()> {
}
// TODO Additional section
// TODO TC bit

View File

@ -1,7 +1,9 @@
FROM rust:1-slim-bookworm
# ldns-utils = ldns-{key2ds,keygen,signzone}
RUN apt-get update && \
apt-get install -y \
ldnsutils \
tshark
# `dns-test` will invoke `docker build` from a temporary directory that contains

View File

@ -34,13 +34,6 @@ pub enum Role {
Resolver,
}
impl Role {
#[must_use]
pub fn is_resolver(&self) -> bool {
matches!(self, Self::Resolver)
}
}
#[derive(Clone)]
pub enum Implementation {
Bind,
@ -112,7 +105,12 @@ impl Implementation {
)
}
Self::Hickory(_) => unimplemented!(),
Self::Hickory(_) => {
minijinja::render!(
include_str!("templates/hickory.name-server.toml.jinja"),
fqdn => origin.as_str()
)
}
},
}
}
@ -134,14 +132,7 @@ impl Implementation {
match self {
Implementation::Bind => &["named", "-g", "-d5"],
Implementation::Hickory(_) => {
assert!(
role.is_resolver(),
"hickory acting in `NameServer` role is currently not supported"
);
&["hickory-dns", "-d"]
}
Implementation::Hickory(_) => &["hickory-dns", "-d"],
Implementation::Unbound => match role {
Role::NameServer => &["nsd", "-d"],

View File

@ -156,14 +156,6 @@ impl NameServer<Stopped> {
/// - one NS record, with this name server's FQDN set as the only available name server for
/// the zone
pub fn new(implementation: &Implementation, zone: FQDN, network: &Network) -> Result<Self> {
assert!(
matches!(
implementation,
Implementation::Unbound | Implementation::Bind
),
"currently only `unbound` (`nsd`) and BIND can be used as a `NameServer`"
);
let ns_count = ns_count();
let nameserver = primary_ns(ns_count);
let image = implementation.clone().into();

View File

@ -0,0 +1,4 @@
[[zones]]
zone = "{{ fqdn }}"
zone_type = "Primary"
file = "/etc/zones/main.zone"