.\" Automatically generated by Pod::Man 4.14 (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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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::Resolver::Unbound 3pm" .TH Net::DNS::Resolver::Unbound 3pm "2022-11-29" "perl v5.36.0" "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::Resolver::Unbound \- Net::DNS resolver based on libunbound .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use Net::DNS; \& use Net::DNS::Resolver::Unbound; \& my $resolver = Net::DNS::Resolver::Unbound\->new(...); \& my $response = $resolver\->send(...); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Net::DNS::Resolver::Unbound is designed as an extension to an existing Net::DNS installation which facilitates \s-1DNS\s0(\s-1SEC\s0) name resolution using the libunbound library developed by NLnet Labs. .PP Net::DNS::Resolver::Unbound replaces the resolver \fBsend()\fR and \fBbgsend()\fR functionality in the Net::DNS::Resolver::Base implementation. .PP As of this writing, the implementation has some significant limitations: .IP "\(bu" 3 Selection of transport protocol and associated parameters is entirely at the discretion of Unbound. .IP "\(bu" 3 There is no provision for specifying \s-1DNS\s0 header flags or \s-1EDNS\s0 options in outbound packets. .IP "\(bu" 3 It is not possible to send a pre-constructed packet to a nameserver. A best-effort attempt is made instead using (qname,qtype,qclass) extracted from the presented packet. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 9 \& my $resolver = Net::DNS::Resolver::Unbound\->new( \& debug_level => 2, \& defnames => 1, \& dnsrch, => 1, \& domain => \*(Aqdomain\*(Aq, \& ndots => 1, \& searchlist => [\*(Aqdomain\*(Aq ... ], \& nameservers => [ ... ], \& option => [\*(Aqlogfile\*(Aq, \*(Aqmylog.txt\*(Aq] ); .Ve .PP Returns a new Net::DNS::Resolver::Unbound resolver object. .SS "nameservers" .IX Subsection "nameservers" .Vb 3 \& my $stub_resolver = Net::DNS::Resolver::Unbound\->new( \& nameservers => [ \*(Aq127.0.0.53\*(Aq ] \& ); \& \& my $fully_recursive = Net::DNS::Resolver::Unbound\->new( \& nameservers => [] # override /etc/resolv.conf \& ); \& \& my $dnssec_resolver = Net::DNS::Resolver::Unbound\->new( \& nameservers => [], \& add_ta_file => \*(Aq/var/lib/unbound/root.key\*(Aq \& ); \& \& my @nameservers = $stub_resolver\->nameservers; .Ve .PP By default, \s-1DNS\s0 queries are sent to the \s-1IP\s0 addresses listed in /etc/resolv.conf or similar platform-specific sources. .SS "search, query, send, bgsend, bgbusy, bgread" .IX Subsection "search, query, send, bgsend, bgbusy, bgread" See Net::DNS::Resolver. .SS "option" .IX Subsection "option" .Vb 2 \& $filename = $resolver\->option( \*(Aqlogfile\*(Aq ); \& $resolver\->option( \*(Aqlogfile\*(Aq, $filename ); .Ve .PP Get or set Unbound resolver (name,value) context options. .SS "config" .IX Subsection "config" .Vb 1 \& $resolver\->config( \*(AqUnbound.cfg\*(Aq ); .Ve .PP This is a power-users interface that lets you specify all sorts of Unbound configuration options. .SS "set_fwd" .IX Subsection "set_fwd" .Vb 1 \& $resolver\->set_fwd( \*(AqIP address\*(Aq ); .Ve .PP Set IPv4 or IPv6 address to which \s-1DNS\s0 queries are to be directed. The destination machine is expected to run a recursive resolver. If the proxy is not DNSSEC-capable, validation may fail. Can be called several times, in that case the addresses are used as backup servers. .SS "set_tls" .IX Subsection "set_tls" .Vb 2 \& $resolver\->set_tls( 0 ); \& $resolver\->set_tls( 1 ); .Ve .PP Use \s-1DNS\s0 over \s-1TLS\s0 for queries to nameservers specified using \fBset_fwd()\fR. .SS "set_stub" .IX Subsection "set_stub" .Vb 1 \& $resolver\->set_stub( \*(Aqzone\*(Aq, \*(Aq10.1.2.3\*(Aq, 0 ); .Ve .PP Add a stub zone, with given address to send to. This is for custom root hints or pointing to a local authoritative \s-1DNS\s0 server. For \s-1DNS\s0 resolvers and the '\s-1DHCP DNS\s0' \s-1IP\s0 address, use \fBset_fwd()\fR. .SS "resolv_conf" .IX Subsection "resolv_conf" .Vb 1 \& $resolver\->resolv_conf( \*(Aqfilename\*(Aq ); .Ve .PP Extract nameserver list from \fBresolv.conf\fR\|(5) format configuration file. Any domain, searchlist, ndots or other settings are ignored. .PP Note that Net::DNS builds its own nameserver list using /etc/resolv.conf or other platform-specific sources. .SS "hosts" .IX Subsection "hosts" .Vb 1 \& $resolver\->hosts( \*(Aqfilename\*(Aq ); .Ve .PP Read list of hosts from the filename given, usually \*(L"/etc/hosts\*(R". These addresses are not flagged as \s-1DNSSEC\s0 secure when queried. .SS "add_ta" .IX Subsection "add_ta" .Vb 1 \& $resolver\->add_ta( \*(Aqtrust anchor\*(Aq ); .Ve .PP Add a trust anchor which is a string that holds a valid \s-1DNSKEY\s0 or \s-1DS RR\s0 in \s-1RFC1035\s0 zonefile format. .SS "add_ta_file" .IX Subsection "add_ta_file" .Vb 1 \& $resolver\->add_ta_file( \*(Aqfilename\*(Aq ); .Ve .PP Pass the name of a file containing \s-1DS\s0 and \s-1DNSKEY\s0 records (as from dig or drill). .SS "add_ta_autr" .IX Subsection "add_ta_autr" .Vb 1 \& $resolver\->add_ta_autr( \*(Aqfilename\*(Aq ); .Ve .PP Add trust anchor to the given context that is tracked with \s-1RFC5011\s0 automated trust anchor maintenance. The file is written when the trust anchor is changed. .SS "trusted_keys" .IX Subsection "trusted_keys" .Vb 1 \& $resolver\->trusted_keys( \*(Aqfilename\*(Aq ); .Ve .PP Pass the name of a BIND-style config file containing trusted\-keys{}. .SS "debug_out" .IX Subsection "debug_out" .Vb 1 \& $resolver\->debug_out( out ); .Ve .PP Send debug output (and error output) to the specified stream. Pass a null argument to disable. Default is stderr. .SS "debug_level" .IX Subsection "debug_level" .Vb 1 \& $resolver\->debug_level(0); .Ve .PP Set verbosity of the debug output directed to stderr. Level 0 is off, 1 minimal, 2 detailed, 3 lots, and 4 lots more. .SS "async_thread" .IX Subsection "async_thread" .Vb 1 \& $resolver\->async_thread(1); .Ve .PP Set the context behaviour for asynchronous actions. Enable a call to \fBresolve_async()\fR to create a thread to handle work in the background. If false (by default), a process is forked to perform the work. .SS "print, string" .IX Subsection "print, string" .Vb 2 \& $resolver\->print; \& print $resolver\->string; .Ve .PP Prints the resolver state on the standard output. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c)2022 Dick Franks .PP All Rights Reserved .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 \&\s-1THE SOFTWARE IS PROVIDED \*(L"AS IS\*(R", 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.\s0 .SH "SEE ALSO" .IX Header "SEE ALSO" perl, Net::DNS, Net::DNS::Resolver, Unbound