The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::DNS::Resolver::Unbound - Unbound resolver base for Net::DNS

SYNOPSIS

    use Net::DNS;
    use Net::DNS::Resolver::Unbound;
    my $resolver = Net::DNS::Resolver::Unbound->new(...);
    my $response = $resolver->send(...);

DESCRIPTION

Net::DNS::Resolver::Unbound is designed as an extension to an existing Net::DNS installation which provides DNSSEC validated name resolution.

Net::DNS::Resolver::Unbound replaces the resolver send() and bgsend() functionality in the Net::DNS::Resolver::Base implementation.

As of this writing, the implementation has some significant limitations:

  • Selection of transport protocol and associated parameters is entirely at the discretion of Unbound.

  • There is no provision for specifying DNS header flags or EDNS options in outbound packets.

  • It is not possible to send a pre-constructed DNS query packet to a nameserver. A best-effort attempt is made using (qname,qtype,qclass) extracted from the presented packet.

METHODS

new

    my $resolver = Net::DNS::Resolver::Unbound->new(
        debug       => 1,
        defnames    => 1,
        dnsrch,     => 1,
        domain      => 'domain',
        ndots       => 1,
        searchlist  => ['domain' ... ],
        nameservers => [ ... ],
        option => ['logfile', 'mylog.txt'] );

Returns a new Net::DNS::Resolver::Unbound resolver object.

nameservers, force_v6, prefer_v6, force_v4, prefer_v4

See Net::DNS::Resolver.

search, query, send, bgsend, bgbusy, bgread

See Net::DNS::Resolver.

option

    $filename = $resolver->option( 'logfile' );
    $resolver->option( 'logfile', $filename );

Get or set Unbound resolver (name,value) context options.

config

    $resolver->config( 'Unbound.cfg' );

This is a power-users interface that lets you specify all sorts of Unbound configuration options.

set_fwd

    $resolver->set_fwd( 'IP address' );

Set IPv4 or IPv6 address to which DNS 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.

set_tls

    $resolver->set_tls( 0 );
    $resolver->set_tls( 1 );

Use DNS over TLS to send queries to machines specified using set_fwd().

set_stub

    $resolver->set_stub( 'zone', '10.1.2.3', 0 );

Add a stub zone, with given address to send to. This is for custom root hints or pointing to a local authoritative dns server. For dns resolvers and the 'DHCP DNS' ip address, use ub_ctx_set_fwd.

add_ta

    $resolver->add_ta( 'trust anchor' );

Add a trust anchor which is a string that holds a valid DNSKEY or DS RR in RFC1035 zonefile format.

add_ta_file

    $resolver->add_ta_file( 'filename' );

Pass the name of a file containing DS and DNSKEY records (like from dig or drill).

trustedkeys

    $resolver->trustedkeys( 'filename' );

Pass the name of a bind-style config file comtaining trusted-keys{}.

debug_level

    $resolver->debug_level(0);

Set verbosity of the debug output directed to stderr. Level 0 is off, 1 very minimal, 2 detailed, and 3 lots.

async_thread

    $resolver->async_thread(1);

Enable a call to resolve_async() to create a thread to handle work in the background. If false (by default), a process is forked to handle work in the background.

COPYRIGHT

Copyright (c)2022 Dick Franks

All Rights Reserved

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.

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.

SEE ALSO

perl, Net::DNS, Net::DNS::Resolver, Unbound