Net::DNS::RR::TSIG (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
Net::DNS::RR::TSIG - DNS TSIG resource recordSYNOPSIS
use Net::DNS; $tsig = create Net::DNS::RR::TSIG( $keyfile, fudge => 300 ); $tsig = create Net::DNS::RR::TSIG( $keyname, $key );
DESCRIPTION
Class forMETHODS
The available methods are those inherited from the base class augmented by the type-specific methods defined in this package.Use of undocumented package features or direct access to internal data structures is discouraged and could result in program termination or other unpredictable behaviour.
algorithm
$algorithm = $rr->algorithm; $rr->algorithm( $algorithm );
A domain name which specifies the name of the algorithm.
key
$rr->key( $key );
Base64 representation of the key material.
keybin
$rr->keybin( $keybin );
Binary representation of the key material.
time_signed
$time_signed = $rr->time_signed; $rr->time_signed( $time_signed );
Signing time as the number of seconds since 1 Jan 1970 00:00:00
fudge
$fudge = $rr->fudge; $rr->fudge( $fudge );
``fudge'' represents the permitted error in the signing time. The default fudge is 300 seconds.
mac
$mac = $rr->mac;
Returns the message authentication code (
macbin
$macbin = $rr->macbin; $rr->macbin( $macbin );
Binary message authentication code (
prior_mac
$prior_mac = $rr->prior_mac; $rr->prior_mac( $prior_mac );
Prior message authentication code (
prior_macbin
$prior_macbin = $rr->prior_macbin; $rr->prior_macbin( $prior_macbin );
Binary prior message authentication code.
request_mac
$request_mac = $rr->request_mac; $rr->request_mac( $request_mac );
Request message authentication code (
request_macbin
$request_macbin = $rr->request_macbin; $rr->request_macbin( $request_macbin );
Binary request message authentication code.
original_id
$original_id = $rr->original_id; $rr->original_id( $original_id );
The message
error
$rcode = $tsig->error;
Returns the
other
$other = $rr->other; $rr->other( $other );
This field should be empty unless the error is
sig_function
sub signing_function { my ( $keybin, $data ) = @_; my $hmac = new Digest::HMAC( $keybin, 'Digest::MD5' ); $hmac->add( $data ); return $hmac->digest; } $tsig->sig_function( \&signing_function );
This sets the signing function to be used for this
sig_data
$sigdata = $tsig->sig_data($packet);
Returns the packet packed according to
create
$tsig = create Net::DNS::RR::TSIG( $keyfile ); $tsig = create Net::DNS::RR::TSIG( $keyfile, fudge => 300 ); $tsig = create Net::DNS::RR::TSIG( $keyname, $key );
Returns a
The two argument form is supported for backward compatibility.
verify
$verify = $tsig->verify( $data ); $verify = $tsig->verify( $packet ); $verify = $tsig->verify( $reply, $query ); $verify = $tsig->verify( $packet, $prior );
The boolean verify method will return true if the hash over the packet data conforms to the data in the
TSIG Keys
$ dnssec-keygen -a HMAC-SHA1 -b 160 -n HOST <keyname> The key will be stored as a private and public keyfile pair K<keyname>+161+<keyid>.private and K<keyname>+161+<keyid>.key where <keyname> is the DNS name of the key. <keyid> is the (generated) numerical identifier used to distinguish this key.
Other algorithms may be substituted for
It is recommended that the keyname be globally unique and incorporate the fully qualified domain names of the resolver and nameserver in that order. It should be possible for more than one key to be in use simultaneously between any such pair of hosts.
Although the formats differ, the private and public keys are identical and both should be stored and handled as secret data.
Configuring BIND Nameserver
The following lines must be added to the /etc/named.conf file:
key <keyname> { algorithm HMAC-SHA1; secret "<keydata>"; };
<keyname> is the name of the key chosen when the key was generated.
<keydata> is the key string extracted from the generated key file.
ACKNOWLEDGMENT
Most of the code in the Net::DNS::RR::TSIG module was contributed by Chris Turbeville.Support for external signing functions was added by Andrew Tridgell.
BUGS
A 32-bit representation of time is used, contrary toCOPYRIGHT
Copyright (c)2002 Michael Fuhr.Portions Copyright (c)2002-2004 Chris Reinhardt.
Portions Copyright (c)2013 Dick Franks.
All rights reserved.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Package template (c)2009,2012 O.M.Kolkman and R.W.Franks.