[Pdns-users] "HTTP/1.1 422 Unprocessable Entity" when creating a zone

Tomasz Chmielewski mangoo at wpkg.org
Tue Jun 30 13:20:56 UTC 2020


I'm using pdns 4.2.1.



Tomasz


On 2020-06-30 22:17, Frank Louwers wrote:
> Hi Tomasz,
> 
> What version are you using? The docs you mention, refer to an old
> version of PowerDNS Auth...
> 
> Frank
> 
>> On 30 Jun 2020, at 15:09, Tomasz Chmielewski via Pdns-users
>> <pdns-users at mailman.powerdns.com> wrote:
>> 
>> I did it exactly as in PowerDNS README:
>> https://doc.powerdns.com/md/httpapi/README/
>> 
>> Does it mean README is buggy?
>> 
>> But it also fails without "masters" attribute:
>> 
>> # echo '{"name":"example.org [1].", "kind": "Native", "nameservers":
>> ["ns1.example.org [2].", "ns2.example.org [3]."]}' | jq
>> {
>> "name": "example.org [1].",
>> "kind": "Native",
>> "nameservers": [
>> "ns1.example.org [2].",
>> "ns2.example.org [3]."
>> ]
>> }
>> 
>> Tomasz
>> 
>> On 2020-06-14 23:52, Kevin P. Fleming via Pdns-users wrote:
>> Have you doing this without specifying the 'masters' attribute at
>> all?
>> Native zones don't support masters, so it's possible that supplying
>> the attribute, even with an empty list, is causing a failure.
>> On Sun, Jun 14, 2020 at 9:29 AM Tomasz Chmielewski via Pdns-users
>> <pdns-users at mailman.powerdns.com> wrote:
>> Using 4.2.1, I'm getting "HTTP/1.1 422 Unprocessable Entity" when
>> trying
>> to create a zone as described on
>> https://doc.powerdns.com/md/httpapi/README/
>> What am I doing wrong?
>> '{"name":"example.org.", "kind": "Native", "masters": [],
>> "nameservers":
>> ["ns1.example.org.", "ns2.example.org."]}' validates fine with jq:
>> # echo '{"name":"example.org.", "kind": "Native", "masters": [],
>> "nameservers": ["ns1.example.org.", "ns2.example.org."]}' | jq
>> {
>> "name": "example.org.",
>> "kind": "Native",
>> "masters": [],
>> "nameservers": [
>> "ns1.example.org.",
>> "ns2.example.org."
>> ]
>> }
>> # curl -X POST --data '{"name":"example.org.", "kind": "Native",
>> "masters": [], "nameservers": ["ns1.example.org.",
>> "ns2.example.org."]}'
>> -v -H 'X-API-Key: my-key'
>> http://10.58.150.164:8081/api/v1/servers/localhost/zones
>> Note: Unnecessary use of -X or --request, POST is already inferred.
>> *   Trying 10.58.150.164:8081...
>> * TCP_NODELAY set
>> * Connected to 10.58.150.164 (10.58.150.164) port 8081 (#0)
>>> POST /api/v1/servers/localhost/zones HTTP/1.1
>>> Host: 10.58.150.164:8081
>>> User-Agent: curl/7.68.0
>>> Accept: */*
>>> X-API-Key: my-key
>>> Content-Length: 113
>>> Content-Type: application/x-www-form-urlencoded
>>> 
>> * upload completely sent off: 113 out of 113 bytes
>> * Mark bundle as not supporting multiuse
>> < HTTP/1.1 422 Unprocessable Entity
>> < Access-Control-Allow-Origin: *
>> < Connection: close
>> < Content-Length: 50
>> < Content-Security-Policy: default-src 'self'; style-src 'self'
>> 'unsafe-inline'
>> < Content-Type: application/json
>> < Server: PowerDNS/4.2.1
>> < X-Content-Type-Options: nosniff
>> < X-Frame-Options: deny
>> < X-Permitted-Cross-Domain-Policies: none
>> < X-Xss-Protection: 1; mode=block
>> <
>> * Closing connection 0
>> {"error": "Creating domain 'example.org.' failed"}
>> This logs:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Request details:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  POST params:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"name":"example.org.",
>> "kind":
>> "Native", "masters": [], "nameservers": ["ns1.example.org.",
>> "ns2.example.org."]}:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Headers:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   accept: */*
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   content-length: 113
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   content-type:
>> application/x-www-form-urlencoded
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   host: 10.58.150.164:8081
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   user-agent: curl/7.68.0
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   x-api-key: my-key
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Full body:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"name":"example.org.",
>> "kind":
>> "Native", "masters": [], "nameservers": ["ns1.example.org.",
>> "ns2.example.org."]}
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Handling request
>> "/api/v1/servers/localhost/zones"
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Result for
>> "/api/v1/servers/localhost/zones": 422, body length: 50
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 Response details:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Headers:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   access-control-allow-origin:
>> *
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Connection: close
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Length: 50
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Security-Policy:
>> default-src 'self'; style-src 'self' 'unsafe-inline'
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Content-Type:
>> application/json
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   Server: PowerDNS/4.2.1
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-Content-Type-Options:
>> nosniff
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-Frame-Options: deny
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8
>> X-Permitted-Cross-Domain-Policies: none
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   X-XSS-Protection: 1;
>> mode=block
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8  Full body:
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8   {"error": "Creating domain
>> 'example.org.' failed"}
>> Jun 14 13:19:59 dns1 pdns_server[25635]: [webserver]
>> a5b403b9-83a9-45b9-a638-0f2b4ce1f4d8 10.58.150.164:39182 "POST
>> /api/v1/servers/localhost/zones HTTP/1.1" 422 423
>> Tomasz
>> _______________________________________________
>> Pdns-users mailing list
>> Pdns-users at mailman.powerdns.com
>> https://mailman.powerdns.com/mailman/listinfo/pdns-users
>> _______________________________________________
>> Pdns-users mailing list
>> Pdns-users at mailman.powerdns.com
>> https://mailman.powerdns.com/mailman/listinfo/pdns-users
>  _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/pdns-users
> 
> 
> 
> Links:
> ------
> [1] http://example.org
> [2] http://ns1.example.org
> [3] http://ns2.example.org


More information about the Pdns-users mailing list