Skip to content

Commit 96fa471

Browse files
added example for dns challenge delegation to the Readme
1 parent 163092b commit 96fa471

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed

Readme.md

+67-2
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ To check if the plugin is installed correctly and detected properly by certbot,
148148
certbot plugins
149149
```
150150

151-
---
152-
153151
Below are some examples of how to use the plugin:
154152

153+
---
154+
155155
Generate a certificate for a DNS-01 challenge of the domain "example.duckdns.org":
156156

157157
```commandline
@@ -166,6 +166,8 @@ certbot certonly \
166166
-d "example.duckdns.org"
167167
```
168168

169+
---
170+
169171
Generate a certificate for a DNS-01 challenge of the subdomain "cloud.example.duckdns.org":
170172

171173
```commandline
@@ -180,6 +182,8 @@ certbot certonly \
180182
-d "cloud.example.duckdns.org"
181183
```
182184

185+
---
186+
183187
Generate a wildcard certificate for a DNS-01 challenge of all subdomains "*.example.duckdns.org":
184188

185189
```commandline
@@ -194,6 +198,8 @@ certbot certonly \
194198
-d "*.example.duckdns.org"
195199
```
196200

201+
---
202+
197203
Generate a certificate for a DNS-01 challenge of the domain "example.duckdns.org" using a credentials file:
198204

199205
```commandline
@@ -208,6 +214,8 @@ certbot certonly \
208214
-d "example.duckdns.org"
209215
```
210216

217+
---
218+
211219
Generate a certificate for a DNS-01 challenge of the domain "example.duckdns.org" without an account (i.e. without an
212220
email address):
213221

@@ -223,6 +231,8 @@ certbot certonly \
223231
-d "example.duckdns.org"
224232
```
225233

234+
---
235+
226236
Generate a staging certificate (i.e. temporary testing certificate) for a DNS-01 challenge of the domain "
227237
example.duckdns.org":
228238

@@ -239,12 +249,67 @@ certbot certonly \
239249
--staging
240250
```
241251

252+
---
253+
254+
DNS-01 Challenges allow using CNAME records or NS records to delegate the challenge response to other DNS zones.
255+
For example, this allows you to resolve the DNS challenge for another provider's domain using a duckdns domain.
256+
For example, we have `abc.duckdns.org` as duckdns domain and `example.com` as our other domain.
257+
We might have an existing DNS configuration which look like this:
258+
```commandline
259+
one.example.com. 600 IN CNAME two.example.com.
260+
two.example.com. 600 IN CNAME abc.duckdns.org.
261+
```
262+
It chains `one.example.com` to `two.example.com` and finally to `abc.duckdns.org`.
263+
264+
Now we want to issue a DNS-01 challenge for the subdomain "test.example.com".
265+
So we create a CNAME record for "_acme-challenge.test.example.com" pointing to "one.example.com".
266+
The DNS records now look like this:
267+
```commandline
268+
_acme-challenge.test.example.com. 600 IN CNAME one.example.com.
269+
one.example.com. 600 IN CNAME two.example.com.
270+
two.example.com. 600 IN CNAME abc.duckdns.org.
271+
```
272+
273+
Now we use certbot to generate a certificate for the domain `test.example.com` with the DNS challenge:
274+
275+
```commandline
276+
certbot certonly \
277+
--non-interactive \
278+
--agree-tos \
279+
--email <your-email> \
280+
--preferred-challenges dns \
281+
--authenticator dns-duckdns \
282+
--dns-duckdns-token <your-duckdns-token> \
283+
--dns-duckdns-propagation-seconds 60 \
284+
-d "test.example.com" \
285+
```
286+
287+
What happens in the background can be seen very well in the DNS records:
288+
```commandline
289+
_acme-challenge.test.example.com. 600 IN CNAME one.example.com.
290+
one.example.com. 600 IN CNAME two.example.com.
291+
two.example.com. 600 IN CNAME abc.duckdns.org.
292+
abc.duckdns.org. 60 TXT "asduh9asudhßa97sdhap9sudaisudoi"
293+
```
294+
295+
When validating the DNS challenge value, all CNAME records are now traversed.
296+
It starts with `_acme-challenge.test.example.com` and goes to `one.example.com`, then to `two.example.com` and finally
297+
to `abc.duckdns.org`. Here is the validation token stored as TXT record.
298+
299+
The example could also be shortened by directly creating a CNAME entry from `_acme-challenge.test.example.com` to
300+
`abc.duckdns.org`. So we skip all other CNAME records in between. To make it clear that any CNAME records are traversed
301+
during validation, the intermediate parts are added in the previous example.
302+
303+
---
304+
242305
Try to update all currently generated certificates:
243306

244307
```commandline
245308
certbot renew
246309
```
247310

311+
---
312+
248313
You can find al list of all available certbot cli options in
249314
the [official documentation](https://certbot.eff.org/docs/using.html#certbot-command-line-options) of *certbot*.
250315

0 commit comments

Comments
 (0)