[Pdns-users] API Bug(?) with Postgres backend when inserting rr containg dots

Ferdinand Goldmann Ferdinand.Goldmann at jku.at
Tue Mar 16 15:40:19 UTC 2021


Hello!

I am trying to get the OperaDNS UI to work with my PowerDNS installation and
I've run into a potential bug.

OperaDNS uses the API to connect to PowerDNS. I noticed that whenever
I try to insert a record containing dots in its name PowerDNS gives me
an interal server error. So I ran tcpdump to catch the request that is
being sent to the PowerDNS API (confidential info overwritten with
aserisks):

----> snip <----
PATCH /api/v1/servers/localhost/zones/ferdl.test. HTTP/1.1
Host: ************************:8081
X-API-Key: ***************************************
0: Content-Length: 283
Accept: application/json
Content-Type: application/json
Content-Length: 283

{"rrsets":[{"name":"this.is.my.shiny.new.name.ferdl.test.","type":"A","ttl":86400,"changetype":"REPLACE","records":[{"name":"this.is.my.shiny.new.name.ferdl.test.","type":"A","content":"127.0.0.1","disabled":false,"set-ptr":false}],"comments":[{"content":"","account":"********"}]}]}HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 34
Content-Type: application/json
Server: PowerDNS/4.4.1

{"error": "Internal Server Error"}
----> snip <----

This API request leaves me with the following error in the pdns.log:

Mar 16 15:48:10 **** pdns[67880]: [webserver] 759b42ae-4c22-42be-a961-6b27805d9171 HTTP ISE for "/api/v1/servers/localhost/zones/ferdl.test.": Exception: GSQLBackend unable to insert empty non-terminal rr 'name.ferdl.test' in domain_id 86: Fatal error during query: insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,content) values (null,$1,false,$2,$3,$4,null,null,null): ERROR:  null value in column "type" violates not-null constraint DETAIL:  Failing row contains (4835479, 86, name.ferdl.test, null, null, null, null, f, null, t).

According to this log entry, the name 'this.is.my.shiny.new.name.ferdl.test' is somehow
truncated by PowerDNS so only the last part (name.ferdl.test) is left.

The corresponding Postgres errors are:

Mar 16 15:48:10 **** postgres[69658]: [55-1] 2021-03-16 15:48:10.411 CET [69658] ERROR:  null value in column "type" violates not-null constraint
Mar 16 15:48:10 **** postgres[69658]: [55-2] 2021-03-16 15:48:10.411 CET [69658] DETAIL:  Failing row contains (4835479, 86, name.ferdl.test, null, null, null, null, f, null, t).
Mar 16 15:48:10 **** postgres[69658]: [55-3] 2021-03-16 15:48:10.411 CET [69658] STATEMENT:  insert into records (type,domain_id,disabled,name,ordername,auth,ttl,prio,content) values (null,$1,false,$2,$3,$4,null,null,null)

So I'm wondering if I'm doing something wrong or if there's a bug in
the API and/or Postgres backend.

A name like this should be perfectly legal. In fact, there are such names
in our zones (inserted directly into the DB, not via API) and they work
just fine and PowerDNS is able to resolve those names.

Has anybody successfully tried inserting such names into PowerDNS using the API?
I'm using PowerDNS 4.4.1 and Postgres 12.5.

Regards
Ferdiand
-- 
Ferdinand Goldmann
System Administrator
Information Management

JOHANNES KEPLER
UNIVERSITY LINZ
ferdinand.goldmann at jku.at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5946 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20210316/1fc0b736/attachment.bin>


More information about the Pdns-users mailing list