Comments (2)
I've written quite a few scripts that automate the creation of forward and reverse matching DNS. The problem is, every single one has been unique to the organization using it. There just isn't a one-size-fits-all or even one-size-fits-most way to automatically create matching rDNS. There's an open issue #41 for doing it. Here's the salient bits of the last "add a host and matching IPv4 and IPv6 rDNS" script I wrote (but you'll notice, it has some extra not-included bits that determine what the right rDNS zone is):
$fqdn ||= $util->ask("fully qualified domain name (FQDN)");
$ip ||= $util->ask("IPv4 address");
$ip6 ||= $util->ask("IPv6 address"); # get optional IPv6 IP
usage() if ( ! $fqdn || ( ! $ip && ! $ip6 ) );
$cnt->nt_connect(); # connect to nictool
my ($host, $domain) = split /\./, $fqdn, 2; # get the $host / $domain
#print "host: $host\n";
#print "domn: $domain\n";
my $zone_id = $cnt->get_zone_id( $domain ) # find the $domain zone
or die "could not find zone ID for $domain\n";
foreach my $t ( qw/ A AAAA / ) {
my $now = $cnt->_get_zone_records( $zone_id, $host, $t ); # find the host record
if ( $now ) {
warn "$t record exists\n";
my %new = %$now;
$new{address} = $t eq 'A' ? $ip : $ip6;
$cnt->update_record( \%new, $now ); # update the $host record
}
else {
my $address = $t eq 'A' ? $ip : $ip6;
if ( $address ) {
$cnt->create_forward( $fqdn, $address, $t );
};
}
};
my $now = $cnt->get_reverse_zone_record($ip); # find the reverse zone
if ( $now ) {
my %new = %$now;
$new{address} = "$fqdn.";
$cnt->log( "updating PTR for $ip to $fqdn.\n" );
$cnt->update_record( \%new, $now ); # update the PTR
};
if ( $ip6 && $ip6 ne '' ) {
$now = $cnt->get_reverse_zone_record_ipv6($ip6); # find the IPv6 reverse zone
if ( $now ) {
# add IPv6 PTR
my %new = %$now;
$new{address} = "$fqdn.";
$cnt->log( "updating PTR for $ip6 to $fqdn.\n" );
$cnt->update_record( \%new, $now ); # update the PTR
}
else {
$cnt->create_ptr( $ip6, "$fqdn.");
};
};
from nictool.
Thanks for the reply. It was very helpful!
I see you have cut'n'pasted from https://github.com/msimerson/NicTool/tree/master/server/api
The code is very helpful for me and ill try and brew a new clever script which interfaces to Nictool for reverse DNS management.
If i get it working, i will publish it here :)
Thanks
Per
from nictool.
Related Issues (20)
- NicToolServer::Import::tinydns MX and SRV issues HOT 3
- Support LUA Records HOT 1
- Allow PTR in "forward" zones to support DNS-SD (RFC 6763) HOT 1
- Problems with an upgrade HOT 1
- Only 10 nameserver offered for new zones HOT 1
- Importer and UI reports false duplicates HOT 2
- CNAME import fails when aborted import is started again
- CNAME validation does not catch CNAME for the zone name HOT 6
- Importer can not import zone files with $origin and $ttl HOT 4
- Updating the Makefile.PL with MariaDB HOT 5
- NicTool v3 Working Plan Outline
- Data store is a document database
- Federated Identity support (SSO, SAML, OAuth, OpenID)
- build error
- Please add howto setup NicTool with nginx to your documentation HOT 2
- CAA records: make it a little more difficult to generate zone file syntax error
- Support TLSA records HOT 1
- SOAP response with wrong type of data
- delegation permissions only use the first one on the list
- insecure session_id generation, users logging in at the same second get the same id HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nictool.