Net::DNS::SEC::Validator - interface to libval(3) and related constants, structures and functions.
use Net::DNS::SEC::Validator; use Net::DNS::Packet; use Net::hostent; use Net::addrinfo; use Socket qw(:all); my $validator = new Net::DNS::SEC::Validator(policy => ":"); my (@r) = $validator->getaddrinfo("good-A.test.dnssec-tools.org"); my $r = $validator->res_query("marzot.net", "IN", "MX"); my $h = $validator->gethostbyname("good-AAAA.test.dnssec-tools.org", AF_INET6);
This Perl module is designed to implement and export functionality provided by the validating DNS resolver library, libval(3). The functions are provided through an easy-to-use object oriented interface. The interface is designed for the higher level user, hiding some of the complexity of validating resolvers. Nevertheless, application interface behavior can be customized through configuration files provided by libval(3) and extensive error codes returned.
Details of DNSSEC and associated resolver behavior may be found in the core DNSSEC RFCs (4033-4035).
A description of the API follows:
To create a validator object use the Net::DNS::SEC::Validator->new() method. This method optionally takes a policy label (policy => 'label'), or default to using the default label in the libval(3) dnsval.conf file.
$validator->{error} =>The latest method error code $validator->{errorStr} => the latest method error string $validator->{valStatus} => the val_status of last call (if single) $validator->{valStatusStr} => the val_status string of last call
<name> => is the node name or numeric address being queried <service> => is the name or number represting the service (note: <name> or <service> may be undef, but not both) <hint> => a Net::addrinfo object specying flags, family, etc.
An array of Net::addrinfo objects (augmented with a 'val_status' field). On error, returns an empty array. in scalar context returns first Net::addrinfo object, or undef on error.
<name> => is the node name or numeric address being queried <family> => the address family of returned entry (default: AF_INET)
A Net::hostent object. Validator valStatus/valStatusStr fields will be updated. On error, undef is returned and validator object error/errorStr fields are updated.
<name> => is the node name or numeric address being queried <class> => is the DNS class of the record being queried (default: IN) <type> => is the DNS record type being queried (defailt A)
A packed DNS query result is returned on success. This object is suitable to be passed to the Net::DNS::Packet(\$result) interface for parsing. Validator valStatus/valStatusStr fields will be updated. On error, undef is returned and validator object error/errorStr fields are updated.
<label> => the policy label to use (old context is destroyed) (default: ":" dnsval.conf default policy)
the policy label currently (after change) being used.
<val_status> => numeric vaildator status code (default: $validator->{valStatus})
A boolean positive value if <val_status> is a trusted result.
A string representation of the given <val_status>.
use Net::DNS::SEC::Validator; use Net::DNS::Packet; use Net::hostent; use Net::addrinfo; use Socket qw(:all); # construct object my $validator = new Net::DNS::SEC::Validator(policy => ":"); # change validation policy $validator->policy("validate_tools:"); # fetch array of Net::addrinfo objects my (@r) = $validator->getaddrinfo("good-A.test.dnssec-tools.org"); foreach $a (@r) { print $a->stringify, " is trusted\n" if $validator->istrusted($a->val_status)); } # query an MX record my $r = $validator->res_query("marzot.net", "IN", "MX"); my ($pkt, $err) = new Net::DNS::Packet(\$r); print ($validator->istrusted ? "result is trusted\n" : "result is NOT trusted\n"); my $h = $validator->gethostbyname("good-A.test.dnssec-tools.org"); if ( @{$h->addr_list}) { my $i; for $addr ( @{$h->addr_list} ) { printf "\taddr #%d is [%s]\n", $i++, inet_ntoa($addr); } }
Copyright (c) 2006 G. S. Marzot. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Copyright (c) 2006-2008 SPARTA, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
G. S. Marzot (marz@users.sourceforge.net)
To install Net::DNS::SEC::Validator, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DNS::SEC::Validator
CPAN shell
perl -MCPAN -e shell install Net::DNS::SEC::Validator
For more information on module installation, please visit the detailed CPAN module installation guide.