NAME

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

VERSION

This document describes version 0.010 of DNS::Zone::PowerDNS::To::BIND (from Perl distribution DNS-Zone-PowerDNS-To-BIND), released on 2022-11-12.

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")

    (No description)

  • db_password => str

    (No description)

  • db_user => str

    (No description)

  • dbh => obj

    (No description)

  • default_ns => array[net::hostname]

    (No description)

  • domain => net::hostname

    (No description)

  • domain_id => uint

    (No description)

  • 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. 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_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.

  • workaround_underscore_in_host => bool (default: 1)

    Whether to convert underscores in hostname to dashes.

    Underscore is not a valid character in hostname. This workaround can help a bit by automatically converting underscores to dashes. Note that it does not ensure hostnames like foo_.example.com to become valid as foo-.example.com is also not a valid hostname.

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.

SEE ALSO

Sah::Schemas::DNS

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

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTORS

  • Ken Teague <kteague@pobox.com>

  • keteague <kteague+github.com@pobox.com>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2022, 2019 by perlancar <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.

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.