.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::DNS::RR::TSIG 3pm" .TH Net::DNS::RR::TSIG 3pm 2024-02-17 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Net::DNS::RR::TSIG \- DNS TSIG resource record .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Net::DNS; \& $tsig = Net::DNS::RR::TSIG\->create( $keyfile ); \& \& $tsig = Net::DNS::RR::TSIG\->create( $keyfile, \& fudge => 300 \& ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Class for DNS Transaction Signature (TSIG) resource records. .SH METHODS .IX Header "METHODS" The available methods are those inherited from the base class augmented by the type-specific methods defined in this package. .PP Use of undocumented package features or direct access to internal data structures is discouraged and could result in program termination or other unpredictable behaviour. .SS algorithm .IX Subsection "algorithm" .Vb 2 \& $algorithm = $rr\->algorithm; \& $rr\->algorithm( $algorithm ); .Ve .PP A domain name which specifies the name of the algorithm. .SS key .IX Subsection "key" .Vb 1 \& $rr\->key( $key ); .Ve .PP Base64 representation of the key material. .SS keybin .IX Subsection "keybin" .Vb 1 \& $rr\->keybin( $keybin ); .Ve .PP Binary representation of the key material. .SS time_signed .IX Subsection "time_signed" .Vb 2 \& $time_signed = $rr\->time_signed; \& $rr\->time_signed( $time_signed ); .Ve .PP Signing time as the number of seconds since 1 Jan 1970 00:00:00 UTC. The default signing time is the current time. .SS fudge .IX Subsection "fudge" .Vb 2 \& $fudge = $rr\->fudge; \& $rr\->fudge( $fudge ); .Ve .PP "fudge" represents the permitted error in the signing time. The default fudge is 300 seconds. .SS mac .IX Subsection "mac" .Vb 1 \& $rr\->mac( $mac ); .Ve .PP Message authentication code (MAC). The programmer must call the Net::DNS::Packet \fBdata()\fR object method before this will return anything meaningful. .SS macbin .IX Subsection "macbin" .Vb 2 \& $macbin = $rr\->macbin; \& $rr\->macbin( $macbin ); .Ve .PP Binary message authentication code (MAC). .SS prior_mac .IX Subsection "prior_mac" .Vb 2 \& $prior_mac = $rr\->prior_mac; \& $rr\->prior_mac( $prior_mac ); .Ve .PP Prior message authentication code (MAC). .SS prior_macbin .IX Subsection "prior_macbin" .Vb 2 \& $prior_macbin = $rr\->prior_macbin; \& $rr\->prior_macbin( $prior_macbin ); .Ve .PP Binary prior message authentication code. .SS request_mac .IX Subsection "request_mac" .Vb 2 \& $request_mac = $rr\->request_mac; \& $rr\->request_mac( $request_mac ); .Ve .PP Request message authentication code (MAC). .SS request_macbin .IX Subsection "request_macbin" .Vb 2 \& $request_macbin = $rr\->request_macbin; \& $rr\->request_macbin( $request_macbin ); .Ve .PP Binary request message authentication code. .SS original_id .IX Subsection "original_id" .Vb 2 \& $original_id = $rr\->original_id; \& $rr\->original_id( $original_id ); .Ve .PP The message ID from the header of the original packet. .SS error .IX Subsection "error" .SS vrfyerrstr .IX Subsection "vrfyerrstr" .Vb 1 \& $rcode = $tsig\->error; .Ve .PP Returns the RCODE covering TSIG processing. Common values are NOERROR, BADSIG, BADKEY, and BADTIME. See RFC8945 for details. .SS other .IX Subsection "other" .Vb 1 \& $other = $tsig\->other; .Ve .PP This field should be empty unless the error is BADTIME, in which case it will contain the server time as the number of seconds since 1 Jan 1970 00:00:00 UTC. .SS sig_function .IX Subsection "sig_function" .Vb 2 \& sub signing_function { \& my ( $keybin, $data ) = @_; \& \& my $hmac = Digest::HMAC\->new( $keybin, \*(AqDigest::MD5\*(Aq ); \& $hmac\->add( $data ); \& return $hmac\->digest; \& } \& \& $tsig\->sig_function( \e&signing_function ); .Ve .PP This sets the signing function to be used for this TSIG record. The default signing function is HMAC\-MD5. .SS sig_data .IX Subsection "sig_data" .Vb 1 \& $sigdata = $tsig\->sig_data($packet); .Ve .PP Returns the packet packed according to RFC8945 in a form for signing. This is only needed if you want to supply an external signing function, such as is needed for TSIG-GSS. .SS create .IX Subsection "create" .Vb 1 \& $tsig = Net::DNS::RR::TSIG\->create( $keyfile ); \& \& $tsig = Net::DNS::RR::TSIG\->create( $keyfile, \& fudge => 300 \& ); .Ve .PP Returns a TSIG RR constructed using the parameters in the specified key file, which is assumed to have been generated by tsig-keygen. .SS verify .IX Subsection "verify" .Vb 2 \& $verify = $tsig\->verify( $data ); \& $verify = $tsig\->verify( $packet ); \& \& $verify = $tsig\->verify( $reply, $query ); \& \& $verify = $tsig\->verify( $packet, $prior ); .Ve .PP The boolean verify method will return true if the hash over the packet data conforms to the data in the TSIG itself .SH "TSIG Keys" .IX Header "TSIG Keys" The TSIG authentication mechanism employs shared secret keys to establish a trust relationship between two entities. .PP It should be noted that it is possible for more than one key to be in use simultaneously between any such pair of entities. .PP TSIG keys are generated using the tsig-keygen utility distributed with ISC BIND: .PP .Vb 1 \& tsig\-keygen \-a HMAC\-SHA256 host1\-host2.example. .Ve .PP Other algorithms may be substituted for HMAC\-SHA256 in the above example. .PP These keys must be protected in a manner similar to private keys, lest a third party masquerade as one of the intended parties by forging the message authentication code (MAC). .SH "Configuring BIND Nameserver" .IX Header "Configuring BIND Nameserver" The generated key must be added to the /etc/named.conf configuration or a separate file introduced by the \f(CW$INCLUDE\fR directive: .PP .Vb 4 \& key "host1\-host2.example. { \& algorithm hmac\-sha256; \& secret "Secret+known+only+by+participating+entities="; \& }; .Ve .SH ACKNOWLEDGMENT .IX Header "ACKNOWLEDGMENT" Most of the code in the Net::DNS::RR::TSIG module was contributed by Chris Turbeville. .PP Support for external signing functions was added by Andrew Tridgell. .PP TSIG verification, BIND keyfile handling and support for HMAC\-SHA1, HMAC\-SHA224, HMAC\-SHA256, HMAC\-SHA384 and HMAC\-SHA512 functions was added by Dick Franks. .SH BUGS .IX Header "BUGS" A 32\-bit representation of time is used, contrary to RFC8945 which demands 48 bits. This design decision will need to be reviewed before the code stops working on 7 February 2106. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (c)2000,2001 Michael Fuhr. .PP Portions Copyright (c)2002,2003 Chris Reinhardt. .PP Portions Copyright (c)2013,2020 Dick Franks. .PP All rights reserved. .PP Package template (c)2009,2012 O.M.Kolkman and R.W.Franks. .SH LICENSE .IX Header "LICENSE" Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the original copyright notices appear in all copies and that both copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. .PP THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .SH "SEE ALSO" .IX Header "SEE ALSO" perl Net::DNS Net::DNS::RR RFC8945 .PP TSIG Algorithm Names