forked from jameswhite/net-ad-dnsrecord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
43 lines (30 loc) · 1.98 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
This is a set of perl modules to allow for the editing of ActiveDirectory-backed-DNS.
documentation is lacking, code examples are in the t/ (tests) directory
Use this at your own peril. I do.
################################################################################
#
use Net::ActiveDirectory;
my $zone="example.org";
my $ad = Net::ActiveDirectory->new({
'domain' => $ENV{'WINDOWS_DOMAIN'}, # example.org
'username' => $ENV{'WINDOWS_USERNAME'}, # joe (not [email protected] or EXAMPLE\joe)
'password' => $ENV{'WINDOWS_PASSWORD'}, # derp
});
# Add some records to a zone
$ad->addrecord( $zone, "somehost IN A 192.168.2.225" # add an A record
$ad->addrecord( "2.168.192.in-addr.arpa", "225 IN PTR somehost.$zone." ); # add a PTR
$ad->addrecord( "$zone", "_ldap._tcp IN SRV 0 10 389 192.168.2.225" # zone, entry form
$ad->addrecord( "_ldap._tcp.$zone. 86400 IN SRV 0 10 389 192.168.2.225"); # all-one-arguement form (w/optional ttl)
# Delete the same records from a zone with the same formats
$ad->delrecord( $zone, "somehost IN A 192.168.2.225"
$ad->delrecord( "2.168.192.in-addr.arpa", "225 IN PTR somehost.$zone." );
$ad->delrecord( "$zone", "_ldap._tcp IN SRV 0 10 389 192.168.2.225"
$ad->delrecord( "_ldap._tcp.$zone. 86400 IN SRV 0 10 389 192.168.2.225");
# or add a reciprocal pair (this will add / delete the A and PTR for both)
# (it needs the fqdn / full IP to detect the zone file)
$ad->addpair( "somehost.$zone", "192.168.2.225" );
$ad->delpair( "somehost.$zone", "192.168.2.225" );
# this will return if all NS servers have the record (this can take 15 minutes with mixed-mode domains)
# I use them to loop until all servers have the record before continuing an operation that depends on DNS
$ad->add_propagated("somehost.$zone IN A 192.168.2.225");
$ad->del_propagated("somehost.$zone IN A 192.168.2.225");