certbot on Debian Bookworm fails with: The peer didn't know the key we used
Posted by
ads
on
Monday, 2025-06-09 Posted in [Lets-Encrypt][Linux][Software]
Was setting up a new Debian Bookworm system in my home environment. So far I was not using certificates at home, and wanted to change this along the way, using Let’s Encrypt. Since the IP-addresses here are RFC1918, I can’t use the http01 challenge, and have to resort to dns01 challenges. On Debian Bookworm, using certbot, this fails reproducible.
1
Encountered error when making query: The peer didn't know the key we used
Note: Domain names in this blog posting are protected, I’m not really using the home zone but a valid domain name.
The Setup
Freshly installed Debian Bookworm system, with all upgrades. No other additionally software installed, only certbot.
On the DNS-Server side I’m using bind9, with DNSSEC for zone updates. I am regularly using zone updates already for other use cases, but I never used it before for Let’s Encrypt. That part is new.
My original intention was to spin up a new Grafana VM, and encrypt the access to the web interface.
In my DNS server I added a new key, and an update policy to the zone I’m using at home:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Account registered.
Requesting a certificate for grafana.home
Encountered exception during recovery: certbot.errors.PluginError: Encountered error when making query: The peer didn't know the key we used
Encountered error when making query: The peer didn't know the key we used
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
Strange.
Debugging
My first thought was that I did something wrong setting up the zone, or the dnssec setup. After all, I did not use dns01 before. I went as far as throwing everything out and redo it from scratch. And checked the Playbook twice. No bueno.
Reply from SOA query:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30487
;; flags: qr aa; QUESTION: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;_acme-challenge.grafana.home. IN SOA
;; AUTHORITY SECTION:
home. 60 IN SOA ns11. postmaster. 2025060807 7200 900 604800 7200
;; TSIG PSEUDOSECTION:
letsencrypt-home-grafana. 0 ANY TSIG hmac-sha256. 1749403629 300 32 <hash>= 30487 NOERROR 0
Found zone name: home
The primary is: 1.2.3.4
Sending update to 1.2.3.4#53
Outgoing update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: 9041
;; flags:; ZONE: 1, PREREQ: 0, UPDATE: 2, ADDITIONAL: 1
;; UPDATE SECTION:
_acme-challenge.grafana.home. 0 ANY TXT
_acme-challenge.grafana.home. 300 IN TXT "challenge-token"
;; TSIG PSEUDOSECTION:
letsencrypt-home-grafana. 0 ANY TSIG hmac-sha256. 1749403629 300 32 <hash>= 9041 NOERROR 0
Reply from update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: 9041
;; flags: qr; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 1
;; ZONE SECTION:
;home. IN SOA
;; TSIG PSEUDOSECTION:
letsencrypt-home-grafana. 0 ANY TSIG hmac-sha256. 1749403629 300 32 <hash>= 9041 NOERROR 0
WOW!
Even more debugging
I have Ansible playbooks, and I have a Proxmox host! Therefore I spun up two new systems, one Debian Bookworm and one Debian Trixie (the upcoming stable release). Both got their own entry in my home zone, and use the same dnssec key. Both are installed using the same Playbook.
Out of the box, Trixie works. Bookworm fails.
Bookworm is certbot version 2.1.0-4, which was released in December 2022.
Trixie is certbot version 4.0.0-2, which was released in April 2025.
Conclusion
Looks like I fell for wanting a stable system (Debian) and instead got a very outdated piece of software. Based on the stone age of the software in Bookworm, I’m not going to bother to file a bug request. This blog posting here is mainly to document the findings.
The next question is: do I want to stick with Debian, and if yes, which version. And do I want to stick with certbot, or switch to something like lego instead.