The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

DNS::Zone::PowerDNS::To::BIND - Generate BIND zone configuration from information in PowerDNS database

VERSION

This document describes version 0.006 of DNS::Zone::PowerDNS::To::BIND (from Perl distribution DNS-Zone-PowerDNS-To-BIND), released on 2019-09-04.

SYNOPSIS

 use DNS::Zone::PowerDNS::To::BIND qw(gen_bind_zone_from_powerdns_db);

 say gen_bind_zone_from_powerdns_db(
     db_dsn => 'dbi:mysql:database=pdns',
     domain => 'example.com',
 );

will output something like:

 $TTL 300
 @ IN 300 SOA ns1.example.com. hostmaster.example.org. (
   2019072401 ;serial
   7200 ;refresh
   1800 ;retry
   12009600 ;expire
   300 ;ttl
   )
  IN NS ns1.example.com.
  IN NS ns2.example.com.
  IN A 1.2.3.4
 www IN CNAME @

FUNCTIONS

gen_bind_zone_from_powerdns_db

Usage:

 gen_bind_zone_from_powerdns_db(%args) -> any

Generate BIND zone configuration from information in PowerDNS database.

This function is not exported by default, but exportable.

Arguments ('*' denotes required arguments):

  • db_dsn => str (default: "DBI:mysql:database=pdns")

  • db_password => str

  • db_user => str

  • dbh => obj

  • default_ns => array[net::hostname]

  • domain => net::hostname

  • domain_id => uint

  • workaround_cname_and_other_data => bool (default: 1)

    Whether to avoid having CNAME record for a name as well as other record types.

    This is a workaround for a common misconfiguration in PowerDNS DB. Bind will reject the whole zone if there is CNAME record for a name (e.g. 'www') as well as other record types (e.g. 'A' or 'TXT'). The workaround is to skip those A/TXT records and only keep the CNAME record.

  • workaround_no_ns => bool (default: 1)

    Whether to add some NS records for '' when there are no NS records for it.

    This is a workaround for a common misconfiguration in PowerDNS DB. This will add some NS records specified in default_ns.

  • workaround_root_cname => bool (default: 1)

    Whether to avoid having CNAME record for a name as well as other record types.

    CNAME on a root node (host='') does not make sense, so the workaround is to ignore the root CNAME.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/DNS-Zone-PowerDNS-To-BIND.

SOURCE

Source repository is at https://github.com/perlancar/perl-DNS-Zone-PowerDNS-To-BIND.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=DNS-Zone-PowerDNS-To-BIND

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Sah::Schemas::DNS

DNS::Zone::Struct::To::BIND

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.