Skip to content

Commit ea9b352

Browse files
Update docs for dns-scripting, acme-dns etc
1 parent 004bb3e commit ea9b352

File tree

5 files changed

+2466
-2033
lines changed

5 files changed

+2466
-2033
lines changed

docs/dns-scripting.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
id: dns-scripting
3+
title: DNS Scripting
4+
---
5+
6+
To provide your own script to update DNS you need to create (or source) a Windows (CMD) batch file which expects the following sequence of arguments and update a corresponding TXT record in your DNS zone:
7+
- Target Domain (e.g. `example.com`)
8+
- Record Name (e.g. `_acme-challenge.example.com`)
9+
- Record Value (e.g. `ABCBD123456789`)
10+
- Zone Id (e.g. `OptionalZoneId`, this is often useful to match the specific zone to update)
11+
12+
e.g. given a script at *C:\customscripts\UpdateDNS.bat*, this will be executed as:
13+
```
14+
C:\customscripts\UpdateDNS.bat example.com _acme-challenge.example.com ABCBD123456789 OptionalZoneId
15+
```
16+
Important Notes:
17+
18+
- Your script will run as the background service user (local system), not as your account.
19+
- You should assume the working directory of the process will not be the same as the script.
20+
- When an 'apex domain' like `example.com` is included in the certificate request for a wildcard (e.g. `*.example.com`) both TXT records will have the same name but different values, so updates need to add to the TXT record values. For this reason it's also a good idea to provide a (well tested!) delete script to clean up the TXT record once the request has completed, otherwise your TXT record values will grow with every validation attempt.
21+
22+
23+
## Calling a Python or node script
24+
To use a Python script (or similarly Node etc) start with a .bat file which can then forward all the arguments as required to your script using `%*` (or you could pass specific arguments if you needed). Note also the fully qualified path to the python exe (or node) as your script will run as local system (using the apps background service) and the path environment variable settings may be different:
25+
26+
```bat
27+
REM This script would be called with the parameters <target domain> <record name> <record value> <zone id (optionally)>
28+
29+
REM this example then calls a custom python script forwarding all the arguments
30+
31+
c:\python27\python.exe create_dns_txt_example.py %*
32+
```
33+
34+
In the following Pythong example the args are available in the `sys.argv` list. This example passes that list to a function called `main` and logs some example stuff (`create_dns_txt_example.py` logging to `dns_create_test.log`).
35+
36+
Your real script would use your DNS providers API or a library such as Apache libcloud.
37+
38+
```python
39+
# Example
40+
41+
import sys
42+
import os
43+
import getopt
44+
import logging
45+
46+
# TODO: added module for DNS updates (libcloud etc)
47+
48+
49+
def main(argv):
50+
51+
# init logging etc
52+
logging.basicConfig(filename='dns_create_test.log',
53+
filemode='a', level=logging.INFO)
54+
55+
logging.info("Example Python DNS helper.")
56+
57+
# TODO: setup your DNS provider (apache libcloud etc)
58+
59+
# TODO: add/append the txt record
60+
61+
logging.info("args: " + " ".join(sys.argv))
62+
63+
logging.info(
64+
"If this script did anything it would create a TXT record called " + sys.argv[2]
65+
+ " with the value " + sys.argv[3]
66+
+ " you could optionally use the domain ("+sys.argv[1]+") "
67+
+ " or zoneId ("+sys.argv[4]+") in your python script")
68+
69+
70+
#########################################
71+
if __name__ == "__main__":
72+
main(sys.argv)
73+
74+
```
75+
When the script runs that app will call the .bat file like:
76+
```
77+
ExampleDNSCreatePython.bat mydomain.com _acme-challenge.mydomain.com ABCD1234 myoptionalZoneId
78+
```
79+
Which in turn (based on the above example .bat) will call the python script as :
80+
```
81+
python create_dns_txt_basic.py.bat mydomain.com _acme-challenge.mydomain.com ABCD1234 myoptionalZoneId
82+
```

docs/dns-validation.md

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,60 @@ title: About DNS Validation (dns-01)
44
---
55

66
## Why use DNS Validation?
7-
To request a certificate from Let's Encrypt (or any Certificate Authority), you need to provide some kind of proof that you are entitled to receive the certificate for given domain(s). Let's Encrypt supports two methods of validation to prove control of your domain, `http-01` ([validation over HTTP](http-validation.md)) and `dns-01` (validation via DNS).
7+
To request a certificate from Let's Encrypt (or any Certificate Authority), you need to provide some kind of proof that you are entitled to receive the certificate for given domain(s). Let's Encrypt supports two methods of validation to prove control of your domain, `http-01` ([validation over HTTP](http-validation.md)) and `dns-01` (validation over DNS).
88

99
**Wildcard domain certificates (those covering `*.yourdomain.com`) can only be requested using DNS validation.** DNS Validation is also especially useful if the domains you are trying to get certification for are not public websites, or cannot serve http requests on port 80.
1010

1111
## How to use DNS Validation
1212

1313
In order to validate your control of your domains to the certificate authority you will be required to create a specified TXT record in your domain's DNS zone.
1414

15-
To do this you need to get the API credentials for the (hosted) DNS from your DNS providers control panel, store these credentials in the app then select them to be used for specific certificate requests.
15+
To do this you may need to get the API credentials for the (hosted) DNS from your DNS providers control panel, store these credentials in the app then select them to be used for specific certificate requests.
1616

1717
If your DNS provider (or custom DNS setup) does not have an API we can talk to, you can write your own DNS update script or use the Manual DNS option (the request pauses while you manually update DNS).
1818

19-
## DNS Providers
19+
### DNS API Providers
2020

21-
The following DNS providers are supported:
22-
- [Azure DNS](dns-azuredns.md)
21+
Currently supported DNS API providers include:
22+
- Aliyun
2323
- [AWS Route53](dns-awsroute53.md)
24+
- [Azure DNS](dns-azuredns.md)
2425
- [Cloudflare](dns-cloudflare.md) DNS *(Note: Cloudflare offer a free tier for DNS services)*
2526
- [DNS Made Easy](dns-dnsmadeeasy.md)
2627
- [GoDaddy](dns-godaddy.md)
28+
- Microsoft DNS
29+
- NameCheap
2730
- [OVH](dns-ovh.md)
2831
- Simple DNS Plus
2932

3033
**If you change API credentials, you need to replace the credential settings in Certify under 'Settings > Stored Credentials' to ensure renewals keep working. Once saved, there is also a 'Test' option so you can try out the credentials to check they still work.**
3134

32-
## DNS Scripting
33-
To provide your own script to update DNS you need to create (or source) a Windows (CMD) batch file which expects the following sequence of arguments and update a corresponding TXT record in your DNS zone:
34-
- Target Domain (e.g. `example.com`)
35-
- Record Name (e.g. `_acme-challenge.example.com`)
36-
- Record Value (e.g. `ABCBD123456789`)
37-
- Zone Id (e.g. `OptionalZoneId`, this is often useful to match the specific zone to update)
38-
39-
e.g. given a script at *C:\customscripts\UpdateDNS.bat*, this will be executed as:
40-
```
41-
C:\customscripts\UpdateDNS.bat example.com _acme-challenge.example.com ABCBD123456789 OptionalZoneId
42-
```
43-
Notes: you should assume the working directory of the process will not be the same as the script. When an 'apex domain' like `example.com` is included in the certificate request for a wildcard (e.g. `*.example.com`) both TXT records will have the same name but different values, so updates need to add to the TXT record values. For this reason it's also a good idea to provide a (well tested!) delete script to clean up the TXT record once the request has completed, otherwise your TXT record values will grow with every validation attempt.
35+
## Other DNS Validation Methods
36+
You can alternatively use the following methods to manage your DNS TXT records:
37+
38+
### ACME DNS
39+
[acme-dns](https://github.com/joohoi/acme-dns) is a system to automatically manage TXT record values on behalf of your domain **just for challenge validation**. This is probably the easiest method if you have a trusted acme-dns server you can use, this also avoids storing powerful DNS admin credentials on your server.
40+
41+
- Select acme-dns as the DNS update method
42+
- Point to a trusted acme-dns server
43+
- Request certificate, the first time you do so you will be prompted to create a CNAME pointing to the acme-dns server.
44+
- Resume the request using Request Certificate, the acme-dns server will provide the required TXT record responses on your behalf.
45+
- Automatic renewals will then perform this process again without manual intervention.
46+
47+
### DNS Scripting
48+
[DNS Scripting](dns-scripting.md) involves providing your own custom script to update/delete TXT records in your DNS using a .bat file which can then optionally call python, node scripts etc.
49+
50+
### Manual DNS
51+
If you are just experimenting with wildcard domains you may opt to use manual DNS updates (editing manually via your DNS control panel).
52+
53+
**This is the least recommended option as you will need to update this for every renewal.**
54+
55+
This method can also be extremely confusing when requesting a single cert for `*.domain.com` and `domain.com`, as you need to provide 2 values for the same TXT `_acme-challenge.domain.com` record (to answer both the `*.domain.com` and `domain.com` challenge responses).
56+
57+
To use Manual DNS:
58+
- Select Manual DNS as your DNS update method
59+
- Perform your initial certificate request. The request will pause and ask you to create a TXT record in your domain (one value for each domain or wildcard). Once you have completed that, wait for your DNS name servers to complete propagation. If you have trouble validating, wait an hour or more for this to complete.
60+
- Use 'Request Certificate' to resume the request and check validation.
61+
- If the certificate authority can see the TXT value they asked for in your DNS, they will then allow a certificate to be issued and the request will resume as normal.
62+
4463

website/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
"dns-ovh": {
4242
"title": "OVH DNS API"
4343
},
44+
"dns-scripting": {
45+
"title": "DNS Scripting"
46+
},
4447
"dns-validation": {
4548
"title": "About DNS Validation (dns-01)"
4649
},

0 commit comments

Comments
 (0)