[Pdns-users] Adding multiple records to all zones at once

Chris Wopat me at falz.net
Thu Oct 12 18:31:02 UTC 2023


This seems a lot safer, and perhaps even easier, if you were to use the API
to do it with python or similar.

https://doc.powerdns.com/authoritative/http-api/zone.html

* Query to get list of all zones - GET `/servers/0/zones`

* Loop through each zones to add record(s)

Cheers,


On Thu, Oct 12, 2023 at 1:14 PM Andrea Biancalani via Pdns-users <
pdns-users at mailman.powerdns.com> wrote:

>
> Hi all,
>
> I know this is not strictly related to PDNS only, but an help will be
> really appreciated.
>
> Thanks to anyone givin' a cent.
>
> Il 04/10/2023 18:42, Andrea Biancalani via Pdns-users ha scritto:
>
> Hello there,
>
> I'm using latest PDNS server authoritative with MySQL backend and I want
> to autoadd 2 records (autodiscover/autoconfig CNAMEs) for each zone
> available in my db (that has not those records already set), to make it
> more clear:
>
> Example.
>
> *zone1.tld*
>
> autodiscover.zone1.tld    CNAME autodiscover.outlook.com    3600
> autoconfig.zones1.tld    CNAME autoconfig.outlook.com    3600
>
> *zone2.tld*
>
> none
>
>
> *zone3.tld*
>
> none
>
>
> *zone4.tld*
>
> autodiscover.zone4.tld    CNAME autodiscover.outlook.com    3600
> autoconfig.zones4.tld    CNAME autoconfig.outlook.com    3600
>
>
> *zone5.tld*
>
> autodiscover.zone5.tld    CNAME autodiscover.outlook.com    3600
> autoconfig.zones5.tld    CNAME autoconfig.outlook.com    3600
>
> Using powerdns db in a mysql shell I can prompt this command
>
> insert into records(domain_id,name,type,content,ttl) VALUES ("*2*
> ","autoconfig.*zonename.tld*","CNAME","*<my autoconfig zone>*","3600");
> insert into records(domain_id,name,type,content,ttl) VALUES ("*2*
> ","autodiscover.*zonename.tld*","CNAME","*<my autodiscover zone>*
> ","3600");
>
>
> but I need to extract all my zones within a script, than use a script to
> extract only null zone IDs, than push values inside db: not so practical.
>
> Is there any way to avoid this and push those values inside not
> overwriting existing values (where already set)?
>
> After this I'll schedule a "pdnsutil increase-serial" loop to increase SOA
> serials and propagate those differences to slaves with AXFR.
>
> Any help is more than welcome!
>
> Thanks all.
>
>
>
>
> _______________________________________________
> Pdns-users mailing listPdns-users at mailman.powerdns.comhttps://mailman.powerdns.com/mailman/listinfo/pdns-users
>
>
> --
> Andrea Biancalani - *Rep. Commerciale e Tecnico*
> *Connessioni Metropolitane srl*
> Via G. Valentini, 14 - Prato (PO) - 59100
> Sito web: https://www.conmet.it
> Tel. 0574 536553
> Fax. 0574 536554
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> https://mailman.powerdns.com/mailman/listinfo/pdns-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.powerdns.com/pipermail/pdns-users/attachments/20231012/56c7500c/attachment.htm>


More information about the Pdns-users mailing list