DBHOST(7)

NAME

dbhosts - serve data from /etc/hosts

DESCRIPTION

The dbhost handler is useful for serving data from a /etc/hosts file. It watches the file and reloads it when written to. The dbhost handler can only reply to A, AAAA and PTR queries, all others are deferred to the next handler(s).

The dbhost handler can be used with readily available hosts files that block access to advertising servers.

HOSTS FILE

Commonly the entries are of the form IP_address canonical_hostname [aliases...] as explained by the hosts(5) man page.

Examples:

    # The following lines are desirable for IPv4 capable hosts
    127.0.0.1       localhost
    192.168.1.10    example.com            example
    # The following lines are desirable for IPv6 capable hosts
    ::1                     localhost ip6-localhost ip6-loopback
    fdfc:a744:27b5:3b0e::1  example.com example

REVERSE LOOKUPS

PTR records for reverse lookups are generated automatically.

SYNTAX

    dbhost [FILE] {
        ttl TTL
    }

•   FILE the hosts file to read and parse. If the path is relative the path from the root handler will be prepended to it. Defaults to/etc/hosts if omitted.

•   ttl change the TTL of the records generated (forward and reverse). The default is 3600 seconds (1 hour).

EXAMPLES

Load /etc/hosts file.

    . {
        dbhost
    }

Load example.hosts file in the current directory (if root is not set), and only use it for example.org names:

    example.org {
        dbhost example.hosts
    }

SEE ALSO

The form of the entries in the /etc/hosts file are based on IETF RFC 952 ⟨https://tools.ietf.org/html/rfc952⟩ which was updated by IETF RFC 1123 ⟨https://tools.ietf.org/html/rfc1123⟩.