From 0726e829a9726d9c2ab6709b32c9fb7764516db5 Mon Sep 17 00:00:00 2001 From: Roman Kivalin Date: Mon, 13 Apr 2026 20:35:12 +0200 Subject: [PATCH] Add HMAC-SHA-384 TSIG support, document HMAC-SHA-512 truncation limitation BIND 9.18+ truncates HMAC-SHA-512 MACs by default, and hickory-dns does not support verifying truncated HMACs. Document the workaround (use hmac-sha256) and add hmac-sha384 as an additional option. Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 6 ++++++ README.md | 8 +++++++- src/config.rs | 1 + src/dns/tsig.rs | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67c6394..00d3718 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ ### Fixes +- Add HMAC-SHA-384 TSIG algorithm support + +### Known limitations + +- TSIG with HMAC-SHA-512 may fail with BIND 9.18+ which truncates MACs by default. Use HMAC-SHA-256 as a workaround (hickory-dns does not support truncated HMAC verification). + ### Changes - **Breaking**: Configuration format overhauled diff --git a/README.md b/README.md index 9367b9b..e95f1fc 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ server = "ns1.example.com" zone = "example.com" tsig_key_path = "/etc/certforge/tsig.key" tsig_key_name = "certforge." -tsig_algorithm = "hmac-sha256" # or hmac-sha512 +tsig_algorithm = "hmac-sha256" # hmac-sha256, hmac-sha384, or hmac-sha512 ``` ### Challenge solvers @@ -231,6 +231,12 @@ systemctl enable --now certforge.timer For encrypted credentials, add `LoadCredentialEncrypted=` directives to service units that need access to TLS keys. Run `certforge init` to see the required directives. +## Known limitations + +- **TSIG HMAC-SHA-512**: BIND 9.18+ truncates HMAC-SHA-512 MACs by default, and the underlying DNS library (hickory-dns) does not support verifying truncated HMACs. Use `hmac-sha256` instead. +- RSA key types not yet supported (ECDSA only). +- `dane-check` shows expected TLSA records but does not query DNS to verify. + ## License MIT diff --git a/src/config.rs b/src/config.rs index 767a1a3..3302774 100644 --- a/src/config.rs +++ b/src/config.rs @@ -62,6 +62,7 @@ pub struct DnsClientConfig { #[serde(rename_all = "kebab-case")] pub enum TsigAlgorithm { HmacSha256, + HmacSha384, HmacSha512, } diff --git a/src/dns/tsig.rs b/src/dns/tsig.rs index 4a2ef58..44b0f98 100644 --- a/src/dns/tsig.rs +++ b/src/dns/tsig.rs @@ -26,6 +26,7 @@ pub async fn load_tsig_signer( let algorithm = match dns_config.tsig_algorithm { config::TsigAlgorithm::HmacSha256 => TsigAlgorithm::HmacSha256, + config::TsigAlgorithm::HmacSha384 => TsigAlgorithm::HmacSha384, config::TsigAlgorithm::HmacSha512 => TsigAlgorithm::HmacSha512, };