Description
Welcome
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, the DNS provider exposes a public API.
- Yes, I know that the lego maintainers don't have an account in all DNS providers in the world.
- Yes, I'm able to create a pull request and be able to maintain the implementation.
- Yes, I'm able to test an implementation if someone creates a pull request to add the support of this DNS provider.
How do you use lego?
Through Traefik
Link to the DNS provider
Link to the API documentation
https://api.sqr.nl/api/documentation
Additional Notes
Here are the required details for implementing a challenge solver to the DNS API provided by SQR.nl (a Dutch provider). Being a customer of SQR.nl myself, I can attest that this should work.
I am a programmer so I had a look at https://go-acme.github.io/lego/usage/library/writing-a-challenge-solver/ for details, but I have no knowledge at all of Go (or C++), so providing a challenge solver would be very hard for me at this point.
Although, I am in the process of writing a custom Node JS service that interfaces with SQR.nl's API and allows for an HTTPREQ
implementation for use with Traefik. So have managed to get this thing to work and thus I am able and willing to help work out the details or help test.
All information in this post is based on publicly available information:
- https://sqr.nl/support/beheer-domeinen-en-dns-met-de-api/ (Dutch only)
- https://api.sqr.nl/api/documentation (English)
Present
A Present
call would look like this:
curl -X POST "https://api.sqr.nl/domains/example.com/dns?client_id=0" -H "accept: */*" -H "API-TOKEN: XYZ" -H "Content-Type: application/json" -H "X-CSRF-TOKEN: " -d "[{\"name\":\"example.com\",\"type\":\"TXT\",\"content\":\"\\\"CHALLENGE\\\"\",\"ttl\":3600,\"prio\":0}]"
Variables:
XYZ
: a customer API keyexample.com
: the domain name (used both in the URL and the JSON data)CHALLENGE
: the challenge text
A response from SQR.nl's API should look like this:
{ "success": true, "data": [ { "id": "12345", "type": "TXT", "content": "\"CHALLENGE\"", "name": "example.com", "prio": 0, "ttl": 3600 } ] }
Note the id
property for the added DNS record.
Cleanup
A Cleanup
call would look like this:
curl -X DELETE "https://api.sqr.nl/domains/example.com/dns?client_id=0" -H "accept: */*" -H "API-TOKEN: XYZ" -H "Content-Type: application/json" -H "X-CSRF-TOKEN: " -d "[{\"id\":12345}]"
Variables:
XYZ
: the customer API keyexample.com
: the domain name12345
: the DNS record that needs to be removed
A response should look like this:
{ "success": true, "data": [ { "id": "12345" } ] }
Find entry to remove
To optionally find the the correct DNS record to delete, you can fetch a list of all DNS records:
curl -X GET "https://api.sqr.nl/domains/example.com/dns?client_id=0" -H "accept: */*" -H "API-TOKEN: XYZ" -H "X-CSRF-TOKEN: "
Variables:
XYZ
: the customer API keyexample.com
: the domain name
A response should look something like this:
{ "success": true, "data": [ { "id": "12344", "name": "example.com", "type": "SOA", "content": "some-content", "ttl": "86400", "prio": "0", "disabled": "0" }, { "id": "12345", "name": "example.com", "type": "TXT", "content": "\"CHALLENGE\"", "ttl": "3600", "prio": "0", "disabled": "0" }, { "id": "12346", "name": "*.example.com", "type": "CNAME", "content": "example.com", "ttl": "60", "prio": "0", "disabled": "0" }, { "id": "12347", "name": "example.com", "type": "A", "content": "93.184.216.34", "ttl": "60", "prio": "0", "disabled": "0" } ] }
That way, it's possible to iterate over all DNS records and find the one that holds the challenge text. Thus you will find the ID required for cleanup.
Errors
In case any error happens, you will usually only get this response:
{ "errors": { "message": "Something went wrong" } }
Notes:
- it's always required to append
client_id=0
as a request parameter and the value is always0
- you obtain an API key by submitting a request (as a customer) and providing the IP-address(es) from which calls will be made to SQR.nl's API; see https://sqr.nl/support/aan-de-slag-met-de-api/ (Dutch only)
- the API key must be supplied via the HTTP-header
API-TOKEN
- I'm not certain if the empty HTTP-header
X-CSRF-TOKEN
can be omitted; I have not tested that; it's just listed in many of the examples that SQR.nl provides (see: https://sqr.nl/support/beheer-domeinen-en-dns-met-de-api/ (Dutch only)) - all of the above information is based on my experience implementing my Node JS webservice; I have no knowledge of actual implementations of challenge solvers