catalyst / pdns-cli

Command line client for the PowerDNS HTTPS API
GNU General Public License v3.0
7 stars 5 forks source link

edit-rrset on zone apex? #9

Open JanKoppe opened 1 year ago

JanKoppe commented 1 year ago

Hi,

giving this CLI a spin right now.

It seems that I'm unable to edit/add a rrset on the apex of a zone.

$ pdns ... edit-rrset --add --ttl 60 asdf123.de @ NS bogus.example.com.
API error: Name '@.asdf123.de.' contains unsupported characters

$ pdns ... edit-rrset --add --ttl 60 asdf123.de '' NS bogus.example.com.
API error: Unable to parse DNS Name '.asdf123.de.'

$ pdns ... edit-rrset --add --ttl 60 asdf123.de NS bogus.example.com.
usage: pdns edit-rrset [-h] (--add | --replace | --delete) [--disabled] [--set-ptr] [--ttl TTL] zone name type content
pdns edit-rrset: error: the following arguments are required: content

$ pdns ... edit-rrset --add --ttl 60 de asdf123 NS bogus.example.com.
HTTP error: 404 Client Error: NOT FOUND for url: https://powerdns.***/api/v1/servers/localhost/zones/de

Am I just holding it wrong? Is this maybe not yet implemented?

Setup is PowerDNS-Admin 0.4.0 in front of PowerDNS 4.7, but PDA should be effectively passthrough to the PowerDNS server on the /api/v1 prefix.

catalystfd commented 1 year ago

Hey there, sorry the syntax for adding records to the root of the zone is quite confusing, you essentially repeat the full dns path of the zone (including the .)

pdns -c conf.toml edit-rrset example.org --add --ttl 60 example.org. NS ns1.bogus.com.

edit: note it can also be of the form pdns -c conf.toml edit-rrset --add --ttl 60 example.org. example.org. NS ns1.bogus.com.

I'll add something to the documentation about this, but a future improvement could be to use the zone for both arguments if only one was provided instead of just complaining about missing the other argument.

JanKoppe commented 1 year ago

Ha! That worked. I was indeed holding it wrong. Thank you very much. :) Feel free to close this issue, unless you want to keep it to track the mentioned documentation change.