acmesh-official / acme.sh

A pure Unix shell script implementing ACME client protocol
https://acme.sh
GNU General Public License v3.0
37.57k stars 4.83k forks source link

Add DNSAPI for DNS provider Beget #3952

Open Captd65 opened 2 years ago

Captd65 commented 2 years ago

Is it possible to add dns api for the provider Beget (https://beget.com/ru) https://beget.com/ru/kb/api/funkczii-upravleniya-dns

retifrav commented 5 months ago

I wanted to implement this, but very soon discovered that there is no way to add a single record, as you can only send a JSON object with all the records that need to be set.

For example, having executed a changeRecords query like this:

{"fqdn":"your.domain","records":{"TXT":[{"priority":10,"value":"ololo"}]}}

you'll end up fekkin overriding all your A, MX and TXT records, so the only record you'll have is this TXT record with the value ololo. How amazing is that.

So a "correct" procedure would be to first get that A/MX/TXT "triplet" of records with getData, form a new JSON object (as the format of the result isn't the same), add a new TXT record to that object and post the final object with changeRecords.

Yeah, nah, don't know about the others, but I personally won't be implementing this. They (Beget) really should make a more civilized API.

woxxo commented 1 week ago

overriding all your A, MX and TXT records

You should not override A and MX records at all, only add TXT record for the automatically generated "_acme-challenge" subdomain. If you use "fqdn":"_acme-challenge.your.domain", all dns records for your domain remain untouched. As for wildcards, the easiest and the dirtiest way is to save your first TXT record with _saveaccountconf_mutable, and then restore it with _readaccountconf_mutable to combine with the second TXT.

Example: {"fqdn":"_acme-challenge.your.domain","records":{"TXT":[{"priority":10,"value":"ololo"}]}}

retifrav commented 1 week ago

That is a good point, I don't remember why I haven't tried with _acme-challenge.your.domain and went with the bare your.domain instead.