Let's Encrypt has announced they have:
Turned on support for the ACME DNS challenge
How do I make ./letsencrypt-auto
generate a new certificate using DNS challenge domain validation?
EDIT
I mean: How do I avoid http/https
port binding, by using the newly announced feature (2015-01-20) that lets you prove the domain ownership by adding a specific TXT record in the DNS zone of the target domain?
Currently it is possible to perform DNS validation, also with the certbot LetsEncrypt client in manual mode. Automation is possible as well (see below).
Manual plugin
You can either perform a manual verification - with the manual plugin.
Certbot will then provide you instructions to manually update a TXT record for the domain in order to proceed with the validation.
Once you have updated the DNS record, press Enter, certbot will continue and if the LetsEncrypt CA verifies the challenge, the certificate is issued as normally.
You may also use a command with more options to minimize interactivity and answering certbot questions. Note that the manual plugin does not yet support non-interactive mode.
Renewal does not work with the manual plugin as it runs in non-interactive mode. More info in the official certbot documentation.
Update: manual hooks
In the new certbot version you can use hooks, e.g.,
--manual-auth-hook
,--manual-cleanup-hook
. The hooks are external scripts executed by certbot to perform the task.Information is passed in environment variables - e.g., domain to validate, challenge token. Vars:
CERTBOT_DOMAIN
,CERTBOT_VALIDATION
,CERTBOT_TOKEN
.You can write your own handler or use already existing ones. There are many available, e.g., for Cloudflare DNS.
More info on official certbot hooks documentation.
Automation, Renewal, Scripting
If you would like to automate DNS challenge validation it is not currently possible with vanilla certbot.Update: some automation is possible with the certbot hooks.We thus created a simple plugin that supports scripting with DNS automation. It's available as certbot-external-auth.
It supports the DNS, HTTP, TLS-SNI validation methods. You can either use it in handler mode or in JSON output mode.
Handler mode
In handler mode, the certbot + plugin calls external hooks (a program, shell script, Python, ...) to perform the validation and installation. In practice you write a simple handler/shell script which gets the input arguments - domain, token and makes the change in DNS. When the handler finishes, certbot proceeds with validation as usual.
This gives you extra flexibility, renewal is also possible.
Handler mode is also compatible with Dehydrated DNS hooks (former letsencrypt.sh). There are already many DNS hooks for common providers (e.g., CloudFlare, GoDaddy, AWS). In the repository there is a README with extensive examples and example handlers.
Example with Dehydrated DNS hook:
JSON mode
Another plugin mode is JSON mode. It produces one JSON object per line. This enables a more complicated integration - e.g., when Ansible or some deployment manager is calling certbot. Communication is performed via STDOUT and STDIN. Cerbot produces JSON objects with data to perform the validation, for example:
Once DNS is updated, the caller sends the new-line character to STDIN of certbot to signal it can continue with validation.
This enables automation and certificate management from the central management server. For installation you can deploy certificates over SSH.
For more info please refer to the readme and examples on certbot-external-auth GitHub.
EDIT: There is also a new blog post describing the DNS validation problem and the plugin usage.
EDIT: We currently work on Ansible 2-step validation, will be soon off.
I was able to use the
dehydrated
client to obtain a certificate using DNS validation.https://github.com/lukas2511/dehydrated
You'll need to use the correct DNS validation hook for your domain, but there are a few options available as examples:
https://github.com/lukas2511/dehydrated/wiki/Examples-for-DNS-01-hooks
As of today, the official client doesn't support the DNS-01 challenge type (yet).
See https://community.letsencrypt.org/t/status-of-official-letsencrypt-clients-dns-01-challenge-support/9427
You can follow the progress at this PR. Alternatively, there are some clients that already support it.
I wrote a hook script for the letsencrypt.sh client that allows you to use Lets Encrypt DNS verification for DNS providers that don't provide an api to use (aka, manual entry and verification is required).
You can check it out here: https://github.com/jbjonesjr/letsencrypt-manual-hook
As mentioned in previous answers, you can easy verify a domain by DNS with this:
apt-get install -y git ruby letsencrypt git clone https://github.com/lukas2511/dehydrated.git git clone https://github.com/jbjonesjr/letsencrypt-manual-hook.git dehydrated/hooks/manual
./dehydrated/dehydrated -c -t dns-01 -d www.example.com -k ./dehydrated/hooks /manual/manual_hook.rb
After trying different combinations, this is what worked for me using dehydrated and letsencrypt-manual-hook git repositories. If the below steps works for you, don't forget to star these repositories
NOTE: This is in addition to answers of panticz.de and alexcline
You will get a hash (after running the above command), create a TXT record in your DNS. Make sure it works by either running the below command or GSuite Toolbox
Now, press enter at the prompt. This did not work for me although the TXT record was updated. I had to press Ctrl+C and run the command again.
Now, your public and private certs are present here.
To renew (minimum wait time is 30 days), just the same command again.
It is pretty easy to accomplish when using
--manual-auth-hook
and--manual-cleanup-hook
in certbot.where
auth.sh
would be something likeand
cleanup.sh
something likeprovided your dns server is properly configured to allow dynamic dns updates (RFC2136). Using a TSIG Key is strongly advisabe but if you choose to make no use of it just cut the
-k $KEYFILE
option when invokingnsupdate
.Hugo Landau wrote an ACME client in Go (https://github.com/hlandau/acme) that supports DNS challenges (with BIND's nsupdate protocol). It's been working flawlessly for me for at least 18 months.
Maybe with one of the DNS plugins of certbot?
For macOS