StackExchange / dnscontrol

Infrastructure as code for DNS!
https://dnscontrol.org/
MIT License
3.07k stars 389 forks source link

PowerDNS: support for HTTPS/SVCB records #2992

Open alanpearce opened 3 months ago

alanpearce commented 3 months ago

I tried to add this myself, but got stuck. Setting providers.{CanUseHTTPS,CanUseSVCB} allows get-zones to correctly pull the records from pdns (generating HTTPS('@', 1, '.', 'alpn=h2'), but making any changes results in an error as the field values (i.e. h2 in this example) get encoded with double quotes, resulting in the following error

#1: ± MODIFY example.com HTTPS (1 . alpn="h2" ttl=86400) -> (1 . alpn="h3" ttl=86400)
FAILURE! unexpected status code 422: https://pdns.example.com/api/v1/servers/localhost/zones/example.com Record example.com./HTTPS '1 . alpn="h3"': Not in expected format (parsed as '1 . alpn=h3')

I've verified that the API works correctly when called manually:

curl -X PATCH https://pdns.example.com/api/v1/servers/localhost/zones/example.com. \
-H 'x-api-key: <snip>' -H 'content-type: application/json' \
-d '{"rrsets":[{"name":"example.com.","type":"HTTPS","ttl":86400,"changetype":"REPLACE","records":[{"content":"1 . alpn=h3"}]}]}'

Unfortunately, I couldn't figure out where to make the change for this. It looks as though the responsible code is all the way down in github.com/miekg/dns/svcb.go and I couldn't figure out how to implement a special case in the dnscontrol provider.

cafferata commented 3 months ago

Ping @jpbede, the maintainer of the PowerDNS provider.