From: Sevan / Venture37 on
Hiya
I've created a basic port to install the dns-audit perl script posted on
the Sun Bigadmin site:
http://www.sun.com/bigadmin/scripts/submittedScripts/dns-audit.pl.txt

I'd appreciate some feedback about if you think it's worth submitting
for inclusion to ports or not.


Sevan / Venture37
From: Sevan / Venture37 on
On 27/01/2010 00:21, Sevan / Venture37 wrote:
> Hiya
> I've created a basic port to install the dns-audit perl script posted on
> the Sun Bigadmin site:
> http://www.sun.com/bigadmin/scripts/submittedScripts/dns-audit.pl.txt
>
> I'd appreciate some feedback about if you think it's worth submitting
> for inclusion to ports or not.
>
>
> Sevan / Venture37


# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# .
# ./pkg-descr
# ./Makefile
# ./pkg-plist
# ./files
# ./files/dns-audit.pl.txt
#
echo c - .
mkdir -p . > /dev/null 2>&1
echo x - ./pkg-descr
sed 's/^X//' >./pkg-descr << '0e313719ff012ceaf97a028d51caa8f5'
Xdns-audit will:
X1) Query the DNS server for every IP address within the block that you
give it
Xand record the forward names.
X2) Then go and query the forward names and make sure that they match the
Xreverse.
X3) Spit out a warning error if any do not match.
X
XFeatures:
XTakes network blocks in CIDR notation.
XCan turn on full list of forward / reverse names or just see errors.
X
XWWW: http://www.sun.com/bigadmin/jsp/descFile.jsp?url=descAll/dnsaudit_pl
0e313719ff012ceaf97a028d51caa8f5
echo x - ./Makefile
sed 's/^X//' >./Makefile << '464ef7c6571951809b23e262cbe26e19'
X# New ports collection makefile for: dns-audit
X# Date created: 2010-01-26
X# Whom: Sevan Janiyan <venture37(a)geeklan.co.uk>
X#
X# $FreeBSD$
X#
X
XPORTNAME= dns-audit
XPORTVERSION= 0.1
XCATEGORIES= dns net
XMASTER_SITES= #
XDISTFILES= #
X
XMAINTAINER= venture37(a)geeklan.co.uk
XCOMMENT= A script to audit a DNS server for reverse lookup of IP addresses
X
XRUN_DEPENDS=
${SITE_PERL}/${PERL_ARCH}/auto/Getopt/Long:${PORTSDIR}/devel/p5-Getopt-Long
\
X
${SITE_PERL}/${PERL_ARCH}/NetAddr/IP.pm:${PORTSDIR}/net-mgmt/p5-NetAddr-IP \
X ${SITE_PERL}/${PERL_ARCH}/Net/DNS/Resolver.pm:${PORTSDIR}/dns/p5-Net-DNS
X
XNO_BUILD= YES
XUSE_PERL5= YES
X
X.include <bsd.port.pre.mk>
X
Xdo-install:
X @ ${INSTALL_SCRIPT} ${FILESDIR}/dns-audit.pl.txt ${PREFIX}/bin/dns-audit
X.include <bsd.port.post.mk>
464ef7c6571951809b23e262cbe26e19
echo x - ./pkg-plist
sed 's/^X//' >./pkg-plist << 'ef3e7f63841ae908ba397c2bef1fbad6'
X(a)comment $FreeBSD$
Xbin/dns-audit
ef3e7f63841ae908ba397c2bef1fbad6
echo c - ./files
mkdir -p ./files > /dev/null 2>&1
echo x - ./files/dns-audit.pl.txt
sed 's/^X//' >./files/dns-audit.pl.txt << 'ec7b0bb99e5965497da04e0067115781'
X#!/usr/bin/perl
X
X###
X### This perl script will go out and check any given name server for
X### any given block of reverse IP addresses.
X###
X### It will:
X### 1) Query the name server for every single IP address within the
block
X### that you give it and record the forward names.
X### 2) Then go and query the forward names and make sure that they
match
X### the reverse.
X### 3) Spit out a warning error if any do not match.
X###
X### Features:
X### Takes network blocks in CIDR notation.
X### Can turn on full list of forward / reverse names or just see errors.
X###
X### Uses CPAN modules:
X###
X### Net::DNS::Resolver
X### NetAddr::IP
X###
X### Submitted by: Scott van Kalken
X###
X
Xuse Net::DNS::Resolver;
Xuse NetAddr::IP;
Xuse Getopt::Long;
X
Xuse vars qw/ %opt /;
X
X#############################################################################
X#
#
X# Sub to perform DNS lookup
#
X# Too lazy to write one sub with var for fw/rev so did two instead
#
X#
#
X#############################################################################
Xsub revlookup {
X my $res = Net::DNS::Resolver->new;
X $res->nameservers($server);
X my $search = $res->search($input);
X
X if ($search) {
X foreach $rr ($search->answer) {
X my $type = $rr->type;
X if ($type eq "A") {
X $host = $rr->address;
X }
X
X if ($type eq "PTR") {
X $host = $rr->ptrdname;
X } else {
X print "$input\t$rr->type\n";
X }
X
X if ($pr) {
X print "$input\t$host\n";
X }
X
X push(@reverseip,$input);
X push (@reversename, $host);
X }
X }
X}
X
Xsub fwlookup {
X my $res = Net::DNS::Resolver->new;
X $res->nameservers($server);
X my $search = $res->search($input);
X
X if ($search) {
X foreach $rr ($search->answer) {
X my $type = $rr->type;
X if ($type eq "A") {
X $host = $rr->address;
X }
X
X if ($type eq "PTR") {
X $host = $rr->ptrdname;
X }
X
X if ($type eq "CNAME") {
X $host = $rr->cname;
X } else {
X #print "$input\t$rr->type\n";
X }
X
X if ($pf) {
X print "$input\t$host\n";
X }
X
X push(@forwardip,$host);
X push (@forwardname, $input);
X }
X } else {
X push (@forwardip, $res->errorstring);
X push (@forwardname, $input);
X }
X}
X
X#############################################################################
X#
#
X# sub to check command line options passed to program for validity
#
X#
#
X#############################################################################
Xsub options {
X
X if ($#ARGV lt 0) {
X &usage;
X }
X
X GetOptions ("r:s" => \$cidr,
X "h" => \$help,
X "s:s" => \$server,
X "pr" => \$pr,
X "pf" => \$pf);
X
X &usage if $help;
X &usage if not $cidr;
X &usage if not $server;
X}
X
X
X#############################################################################
X#
#
X# sub to display a usage message
#
X#
#
X#############################################################################
Xsub usage {
X print "-h help message\n";
X print "-r [range] to search in CIDR format: 128.0/8\n";
X print "-s [server] to direct queries to\n";
X print "-pf print forward names as they are looked up\n";
X print "-pr print reverse names as they are looked up\n";
X
X exit 1;
X}
X
X
X#############################################################################
X#
#
X# Main program
#
X# Too lazy to write sub to do check so just shoved it in here
#
X#
#
X#############################################################################
X
X&options;
X
Xmy $ip = new NetAddr::IP($cidr);
X$range = $ip->range();
X$bcast = $ip->broadcast();
X
Xprint "Searching range: $range: Broadcast $bcast\n";
Xwhile ($ip < $ip->broadcast) {
X ($iponly,$mask) = split /\//, $ip;
X $input = $iponly;
X &revlookup;
X $ip++;
X}
X
Xforeach (@reversename) {
X $input = $_;
X &fwlookup;
X}
X
Xfor ($count = 0; $count ne $#reversename; $count++) {
X $revip = $reverseip[$count];
X $revname = $reversename[$count];
X $fwip = $forwardip[$count];
X $fwname = $forwardname[$count];
X
X if ($revip ne $fwip) {
X print "\n\n";
X print "REVERSE: $revip\t$revname\n";
X print "FORWARD: $fwname\t$fwip\n";
X }
X
X if ($fwname ne $revname) {
X print "\n\n";
X print "WARNING: $revname\t$fwname\n";
X }
X}
X
X
X
X##############################################################################
X### This script is submitted to BigAdmin by a user of the BigAdmin
community.
X### Sun Microsystems, Inc. is not responsible for the
X### contents or the code enclosed.
X###
X###
X### Copyright Sun Microsystems, Inc. ALL RIGHTS RESERVED
X### Use of this software is authorized pursuant to the
X### terms of the license found at
X### http://www.sun.com/bigadmin/common/berkeley_license.jsp
X##############################################################################
X
X
ec7b0bb99e5965497da04e0067115781
exit



_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Jason on
Without having looked at the port itself, yet, I would like to comment on
the name of the port.

It really is misleading that it is a dns-audit port, in that it only seems
to audit the Dns Record and the Reverse. I do understand that this is
matching the name of the script, itself, but I don't know if that is something
that would be "up" for discussion with FreeBSD, and finding a suitable
alterative name.

That being said, thank you for the time and effort you put into this and I
would love to try this out!

-j

On Wed, Jan 27, 2010 at 12:21:38AM +0000, Sevan / Venture37 thus spake:
>Hiya
>I've created a basic port to install the dns-audit perl script posted on
>the Sun Bigadmin site:
>http://www.sun.com/bigadmin/scripts/submittedScripts/dns-audit.pl.txt
>
>I'd appreciate some feedback about if you think it's worth submitting
>for inclusion to ports or not.
>
>
>Sevan / Venture37

>_______________________________________________
>freebsd-ports(a)freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-ports
>To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"
_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Mark Foster on
Sevan / Venture37 wrote:
> Hiya
> I've created a basic port to install the dns-audit perl script posted
> on the Sun Bigadmin site:
> http://www.sun.com/bigadmin/scripts/submittedScripts/dns-audit.pl.txt
>
> I'd appreciate some feedback about if you think it's worth submitting
> for inclusion to ports or not.
Not to dissuade you but this is what the dns/scavenge port does (perhaps
better?). You might want to check it out.
http://conshell.net/wiki/index.php/Scavenge

--
I hate racists. Mark D. Foster <mark(a)foster.cc>
http://mark.foster.cc/ | http://www.freegeekseattle.org/


_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"

From: Sevan / Venture37 on
On 27/01/2010 00:45, Mark Foster wrote:
> Not to dissuade you but this is what the dns/scavenge port does (perhaps
> better?). You might want to check it out.
> http://conshell.net/wiki/index.php/Scavenge

Thanks for the pointer Mark, will check it out, not questioning if it's
better or not, but it seems a bit more heavy weight dependency wise though?


Sevan / Venture37
_______________________________________________
freebsd-ports(a)freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscribe(a)freebsd.org"