Trouble with certbot dns-rfc2136 and split BIND views

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g., so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command:/bin/certbot -n certonly --dns-rfc2136 --dns-rfc2136-credentials=/etc/letsencrypt/rfc2136.ini --dns-rfc2136-propagation-seconds 30 --logs-dir /var/log/letsencrypt --work-dir /etc/letsencrypt/live --config-dir /etc/letsencrypt -m --rsa-key-size 3072 --agree-tos -d

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-rfc2136, Installer None
Starting new HTTPS connection (1):
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for
Cleaning up challenges
Encountered exception during recovery:
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/certbot/_internal/”, line 124, in _call_registered
File “/usr/lib/python2.7/site-packages/certbot/_internal/”, line 243, in _cleanup_challenges
File “/usr/lib/python2.7/site-packages/certbot/plugins/”, line 77, in cleanup
self._cleanup(domain, validation_domain_name, validation)
File “/usr/lib/python2.7/site-packages/certbot_dns_rfc2136/_internal/”, line 79, in _cleanup
self._get_rfc2136_client().del_txt_record(validation_name, validation)
File “/usr/lib/python2.7/site-packages/certbot_dns_rfc2136/_internal/”, line 163, in del_txt_record
PluginError: Encountered error deleting TXT record: The peer didn’t know the key we used
Encountered error adding TXT record: The peer didn’t know the key we used

My web server is (include version): Apache/2.4.6 (CentOS)

The operating system my web server runs on is (include version): CentOS 7 – kernel version 3.10.0-1062.4.3

My hosting provider, if applicable, is: n/a

I can login to a root shell on my machine (yes or no, or I don’t know): yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): certbot 1.0.0

In addition, I have configured named on this system so that nsupdate succeeds. Named is configured with two views, one responding to the server’s external address, and the other to its internal address. The nsupdate transaction looks like this:
nsupdate -k Kcert-ddns.+165+01476.key -v nsUpdate.txt
nsupdate -k Kcert-ddns.+165+01476.key -v nsUpdate.txt
Outgoing update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: 0
;; flags:; ZONE: 0, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0

;; UPDATE SECTION: 180 IN TXT “my-first-dns-dynamic-update”

Sending update to ::1#53
Outgoing update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: 42194
;; flags:; ZONE: 1, PREREQ: 0, UPDATE: 1, ADDITIONAL: 1

;; UPDATE SECTION: 180 IN TXT “my-first-dns-dynamic-update”

cert-ddns. 0 ANY TSIG hmac-sha512. 1577389715 300 64 uq773okPVt6+XWEO5d1D/E7bd2Ozmc9Uo+OfJ1LGNKMZE0XovfbiOWUq gDIYrLYKStxoyjxSjpzZ0HucsyETlA== 42194 NOERROR 0

Reply from update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id: 42194
;; flags: qr; ZONE: 1, PREREQ: 0, UPDATE: 0, ADDITIONAL: 1

cert-ddns. 0 ANY TSIG hmac-sha512. 1577389715 300 64 uAPVmRkkujBagOSIVJG94ZpawwvZrRGg2Ku8UoTjnmus2Eol83BHUYIw i2Qx5zcUisEWusk7B33cHSCqRgm7iQ== 42194 NOERROR 0

The relevant parts of /etc/named.conf are:
key “cert-ddns” {
algorithm hmac-sha512;
secret “{obscured}”;

zone “” {
type master;
file “pub/”;
allow-transfer {none;};
update-policy {
grant cert-ddns name txt;

I am guessing, but do not have any proof, that the certbot interaction is trying to use the internal view rather than the public view, even though I have this rfc2136.ini file:

Target DNS server | Your BIND server

dns_rfc2136_server =

Target DNS port

dns_rfc2136_port = 53

TSIG key name

dns_rfc2136_name = cert_ddns

TSIG key secret

dns_rfc2136_secret ={obscured}

TSIG key algorithm

dns_rfc2136_algorithm = HMAC-SHA512

If anyone has any recommendation about what else I should try, I would be grateful.

Maybe this will help: If not, you will need someone with more expertise than
I have.

Seems like each view in my similar setup wanted both a “key” and a “!key”

In the internal “view” I put

match-clients {
key “internal-key.”;
!key “external-key”;
… other CDIR stuff

and in the external view I put …
match-clients {
key “external-key.”;
!key “internal-key”;



73 de Bill W5GFE

As others have observed in places I didn’t originally find, the key that is used by named to validate a dynamic update is very tightly defined:
the name suplied to
dnssec-keygen -a HMAC-SHA512 -b 512 -n HOST {key_name}
must match the name given to that key in the named.conf file (or separate key definition file). Otherwise, we get the error “tsig verify failure (BADKEY)”.

Then I discovered two other problems that kept my setup from working: first, because of the split view, I needed to set up the “match-clients” clause in named.conf to exclude access to the behind-the-firewall view (match-clients {!key certbot; …}
so that the request to insert a TXT record would go to the public view. And second, my update-policy clause was too restrictive: if I had
“grant certbot. name TXT”, any challenge for a host within that domain would fail. I went with
“grant certbot. subdomain TXT”,
so that a TXT record looking like TXT would succeed.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.