my goal is to renew my certificate automatically with a zone entry like :
_acme-challenge.subdomain.example.com. IN TXT " ?????????????????? "
so I installed the plugin :
apt install python3-certbot-dns-rfc2136
I am now a proud owner of a certbot with a dns-rfc2136 plugin.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* dns-rfc2136
Description: Obtain certificates using a DNS TXT record (if you are using BIND for DNS).
Interfaces: IAuthenticator, IPlugin
Entry point: dns-rfc2136 = certbot_dns_rfc2136._internal.dns_rfc2136:Authenticator
* standalone
Description: Spin up a temporary webserver
Interfaces: IAuthenticator, IPlugin
Entry point: standalone = certbot._internal.plugins.standalone:Authenticator
* webroot
Description: Place files in webroot directory
Interfaces: IAuthenticator, IPlugin
Entry point: webroot = certbot._internal.plugins.webroot:Authenticator
then I tried to run the command :
certbot certonly --dns-rfc2136 -d subdomain.example.com
and certbot has complained as follows:
Input the path to your RFC 2136 credentials INI file (Enter 'c' to cancel):
Please enter a valid path to your RFC 2136 credentials INI file.
On the internet I found a sample of a ini file
# Target DNS server
dns_rfc2136_server = 192.0.2.1
# Target DNS port
dns_rfc2136_port = 53
# TSIG key name
dns_rfc2136_name = keyname.
# TSIG key secret
dns_rfc2136_secret = 4q4wM/2I180UXoMyN4INVhJNi8V9BCV+jMw2mXgZw/CSuxUT8C7NKKFs AmKd7ak51vWKgSl12ib86oQRPkpDjg==
# TSIG key algorithm
dns_rfc2136_algorithm = HMAC-SHA512
so tried to be creative and I entered the command
rndc-confgen -a \
-A HMAC-SHA512 \
-b 512
-c /etc/bind/subdomain.example.com.key \
-p 53 \
-s 123.123.123.123 \
-k keyname
that gave me the following output
key "keyname" {
algorithm hmac-sha512;
secret "Aun6vSwTAIt5j3gMxHJsI+xXr8HVrQdEYbjwKaC9gj2c08+TxNjYGFl21PGU2EgK5UZbreFKGEYa8VRacN6B2A==";
};
so I updated the rfc2136.ini file acordingly
# Target DNS server
dns_rfc2136_server = 123.123.123.123
# Target DNS port
dns_rfc2136_port = 53
# TSIG key name
dns_rfc2136_name = keyname.
# TSIG key secret
dns_rfc2136_secret = Aun6vSwTAIt5j3gMxHJsI+xXr8HVrQdEYbjwKaC9gj2c08+TxNjYGFl21PGU2EgK5UZbreFKGEYa8VRacN6B2A==
# TSIG key algorithm
dns_rfc2136_algorithm = HMAC-SHA512
so far so good, i have further given the following command
$ certbot certonly --dns-rfc2136 --dns-rfc2136-credentials /etc/bind/rfc2136.ini -d subdomain.example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-rfc2136, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate for subdomain.example.com
Performing the following challenges:
dns-01 challenge for subdomain.example.com
Cleaning up challenges
Encountered exception during recovery: certbot.errors.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
now I am stucked.