Skip to content

Commit

Permalink
Skip dnssec if no keys
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed May 5, 2024
1 parent 0f3b143 commit 701397b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ fn dns_thread(
let _ = soa_auth_recs_sign.insert(rec);

// DNSSEC signing and NSEC records
if req.opt().is_some() && req.opt().unwrap().dnssec_ok() {
if req.opt().is_some() && req.opt().unwrap().dnssec_ok() && !dnskeys.is_empty() {
let incep_ts =
Timestamp::from(Timestamp::now().into_int().overflowing_sub(43200).0);
let exp_ts = Timestamp::from(
Expand Down Expand Up @@ -1687,7 +1687,11 @@ fn dns_thread(
}

// Insert RRSIG if DNSSEC
if req.opt().is_some() && req.opt().unwrap().dnssec_ok() && res.counts().ancount() > 0 {
if req.opt().is_some()
&& req.opt().unwrap().dnssec_ok()
&& res.counts().ancount() > 0
&& !dnskeys.is_empty()
{
let incep_ts =
Timestamp::from(Timestamp::now().into_int().overflowing_sub(43200).0);
let exp_ts =
Expand Down Expand Up @@ -1789,7 +1793,7 @@ fn dns_thread(
auth.push(rec.clone()).unwrap();
let _ = soa_auth_recs_sign.insert(rec);

if req.opt().is_some() && req.opt().unwrap().dnssec_ok() {
if req.opt().is_some() && req.opt().unwrap().dnssec_ok() && !dnskeys.is_empty() {
// Sign it
let incep_ts =
Timestamp::from(Timestamp::now().into_int().overflowing_sub(43200).0);
Expand Down

0 comments on commit 701397b

Please # to comment.