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

BIND::SDB::LDAP::Helper - Manages DNS zones stored in LDAP for the BIND9 SDB LDAP patch

VERSION

Version 0.0.0

SYNOPSIS

    use BIND::SDB::LDAP::Helper;

    my $sdbhelper = BIND::SDB::LDAP::Helper->new();
    ...

METHODS

new

This initializes this module.

One arguement is accepted and it is a arguement hash.

args hash

configfile

This is the config file to read upon start.

confighash

This should be a hash ref similar to the type returned by Config::IniHash.

This will take presedence over 'configfile'.

    my $pldm=BIND::SDB::LDAP::Helper->new;
    if($pldnsm->{error}){
        print "Error!\n";
    }

addRecords

This adds records to a relative domain name.

One arguement is taken and it is a hash.

args hash

relative

This is a relative domain name.

This is a required key.

zone

This is the zone to add it to.

This is a required key.

ttl

This is the TTL to use. If a old one is set, it will be removed.

a

This is a array containing entries for A records.

aaaa

This is a array containing entries for AAAA records.

cname

This is a array containing entries for CNAME records.

mx

This is a array containing entries for MX records.

ptr

This is a array containing entries for PTR records.

txt

This is a array containing entries for TXT records.

        $pldm->addRecords({
                                        zone=>$opts{z},
                                        relative=>$opts{r},
                                        ttl=>$opts{T},
                                        a=>\@a,
                                        aaaa=>\@aaaa,
                                        mx=>\@mx,
                                        ptr=>\@ptr,
                                        txt=>\@txt,
                                        });
        if ($pldm->{error}) {
                exit $pldm->{error};
        }

addRelative

This adds a new relative domain name to a zone.

One arguement is taken and it is a hash.

args hash

relative

This is a relative domain name.

This is a required key.

zone

This is the zone to add it to.

This is a required key.

ttl

This is the TTL to use.

a

This is a array containing entries for A records.

aaaa

This is a array containing entries for AAAA records.

cname

This is a array containing entries for CNAME records.

mx

This is a array containing entries for MX records.

ptr

This is a array containing entries for PTR records.

txt

This is a array containing entries for TXT records.

    $dlhm->addRelative({
                          zone=>'some.zone',
                          relative=>'someRelative',
                          aRecord=>['192.168.15.2'],
                       });

addZone

This creazes a new zone.

One argument is required and it is a hash.

The required values are as listed below.

    zone
    email
    ns

The default or config specified value will be used for any of the others.

args hash

zone

This is the zone name.

email

This is the email address for the SOA.

ns

This is a array containing what

ttl

This is the ttl for the SOA.

refresh

This is the refresh value for the SOA.

retry

This is the retry value for the SOA.

expire

This is the expire value for the SOA.

minimum

This is the minimum value for the SOA.

    $pdlm->addZoneDC({
                     zone=>'some.zone',
                     email=>'bob@foo.bar',
                     ns=>['ns1.some.zone.', 'ns2.fu.bar.'],
                     });
    if($pdlm->{error}){
        print "Error!\n";
    }

addZoneDC

This adds the new DC structure for a zone.

    $pdlm->addZoneDC('some.zone');
    if($pdlm->{error}){
        print "Error!\n";
    }

configCheck

This checks if a config hash ref if valid or not.

    my $config={""=>{
                     bind=>'cn=admin,dc=whatever',
                     pass=>'fubar',
                    }
               };
    my $returned$pldm->setConfig($config);
    if($pldm->{error}){
        print "Error!\n";
    }
    if(!$returned){
        print "It is missing a required value.\n";
    }

connect

This forms a LDAP connection using the information in config file.

    my $ldap=$pldm->connect;
    if($pt->{error}){
        print "Error!\n";
    }

getRelativeInfo

This gets the records for a specified relative.

Two arguements are required. The first is a relative domain name and the second is the zone name.

The returned value is a hash. It's keys are the names of the LDAP attributes.

    my %info=$pldm->getRelativeInfo('someRelative', 'someZone');
    if($pldm->{error}){
        print "Error!\n";
    }

hasSubZoneDCs

This checks if a zone has any sub zones.

One arguement is required and taken. It is the name of the zone.

    my $returned=$pldm->hasSubZones('some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }
    if($returned){
        print "The zone has sub zones.\n";
    }

listRelatives

This lists the relative domain names setup for a zone.

One arguement is required and that is the zone to list the relative domain names for.

    my @relatives=$pldm->listRelatives('some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }

listZones

This lists the zones that are setup in LDAP.

    my @zones=$pldm->listZones;
    if($pldm->{error}){
        print "Error!\n";
    }

listZoneDCs

This builds a list of domain names based off of dcObjects.

It does not check if it is a usable object or not.

    my @zones=$pldm->listZones;
    if($pldm->{error}){
        print "Error!\n";
    }

readConfig

This reads the specified config file.

One arguement is accepted and that the name of the file to read.

    $pldm->readConfig('some/file.ini');
    if($pldm->{error}){
        print "Error!\n";
    }

relativeExists

This check if a specified relative exists for a zone.

Two arguements are accepted. The first is the relative domain name and the second is the zone.

    my $returned=$pldm->relativeExists('someRelative', 'some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }
    if($returned){
        print "The relative exists.\n";
    }

removeRecords

This removes the specified records from a relative domain name.

One arguement is taken and it is a hash.

args hash

relative

This is a relative domain name.

This is a required key.

zone

This is the zone to add it to.

This is a required key.

ttl

If this is set to true, it will be removed.

a

This is a array containing entries for A records.

aaaa

This is a array containing entries for AAAA records.

cname

This is a array containing entries for CNAME records.

mx

This is a array containing entries for MX records.

ptr

This is a array containing entries for PTR records.

txt

This is a array containing entries for TXT records.

        $pldm->removeRecords({
                                        zone=>$opts{z},
                                        relative=>$opts{r},
                                        ttl=>$opts{T},
                                        a=>\@a,
                                        aaaa=>\@aaaa,
                                        mx=>\@mx,
                                        ptr=>\@ptr,
                                        txt=>\@txt,
                                        });
        if ($pldm->{error}) {
                exit $pldm->{error};
        }

removeRelative

This removes a specified relative from a zone.

Two arguements are accepted. The first one is the relative name and the second one is the zone.

This will remove any matching entries found. As of currently it does not check if the entry is being used for any others, which is why one should fall the implementation notes for when making use of this.

    my $returned=$pldm->removeExists('someRelative', 'some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }
    if($returned){
        print "removed\n";
    }

removeZone

This removes a zone.

Only one arguement is taken and it is the name of the zone.

    $pldm->removeZone('some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }

removeZoneDC

This removes the DC structure for a zone.

setConfig

This sets the config being used the hash ref that has been specified.

    my $config={""=>{
                     bind=>'cn=admin,dc=whatever',
                     pass=>'fubar',
                    }
               };
    $pldm->setConfig($config);
    if($pldm->{error}){
        print "Error!\n";
    }

zoneDCexists

This checks if the dcObject stuff for a zone exists.

One arguement is required and it is the name of the zone to check for the dcObject structure for.

    my $returned=$pldm->zoneDCexists('some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }
    if($returned){
        print "It exists.\n";
    }

zoneExists

This checks if a specified zone exists or not.

One arguement is accepted and it is the name of the zone.

    my $returned=$pldm->zoneExists('some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }
    if($returned){
        print "The zone exists.\n";
    }

zoneIsDConly

This check is the the zone specified is a object that has been created for just structural purposes or if it is a actual zone.

    my $returned=$pldm->zoneIsDConly('some.zone');
    if($pldm->{error}){
        print "Error!\n";
    }
    if($returned){
        print "It is lacking a relativeDomainName=@ entry.\n";
    }

errorblank

This is a internal function and should not be called.

ERROR CODES

1

Missing a required variable.

2

Config value missing.

3

Failed to connect to LDAP.

4

Failed to start TLS.

5

Failed to bind to the server.

6

The zone does not exist.

7

Update for Net::LDAP::Entry failed.

8

Attempted to operate on '@'.

9

Zone is already setup.

10

The relative already exists.

AUTHOR

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-bind-sdb-ldap-helper at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=BIND-SDB-LDAP-Helper. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc BIND::SDB::LDAP::Helper

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Zane C. Bowers, all rights reserved.

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