Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for provider: hosting.nl (SQR.nl) #1598

Open
4 of 5 tasks
arnovdk opened this issue Feb 21, 2022 · 1 comment · May be fixed by #1967
Open
4 of 5 tasks

Support for provider: hosting.nl (SQR.nl) #1598

arnovdk opened this issue Feb 21, 2022 · 1 comment · May be fixed by #1967

Comments

@arnovdk
Copy link

arnovdk commented Feb 21, 2022

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

https://sqr.nl

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:

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 key
  • example.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 key
  • example.com: the domain name
  • 12345: 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 key
  • example.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 always 0
  • 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
@ldez ldez linked a pull request Jul 23, 2023 that will close this issue
9 tasks
@ldez
Copy link
Member

ldez commented Jul 23, 2023

Hello @arnovdk,

I created a PR (#1967) to add hosting.nl (previously sqr.nl), could you test it?

I created the PR based on the API documentation and your issue description.
There are some inconsistencies about the types inside documentation, so I make some arbitrary choices.

@ldez ldez changed the title Support for provider: SQR.nl Support for provider: hosting.nl (SQR.nl) Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants