Skip to content

dnstap in Unbound 1.12.0 on FreeBSD 12-STABLE doesn't work #358

Description

@rallenh

Hi,

I have been trying to get dnstap via a file socket on FreeBSD 12-STABLE. I can't seem to make it work following: http://dnstap.info/Tutorials/NANOG60/ (even thought it's dated).

I have the Go dnstap utility installed. I use it to create and listen to the socket via:

sudo -u unbound ~/go/bin/dnstap -u /usr/local/etc/unbound/dnstap.sock -w /tmp/dnstap.out

Here's my unbound.conf dnsp section:

dnstap:
        dnstap-enable: yes
        # dnstap-bidirectional: yes
        dnstap-socket-path: "dnstap.sock"
        # dnstap-ip: ""
        # dnstap-tls: yes
        # dnstap-tls-server-name: ""
        # dnstap-tls-cert-bundle: ""
        # dnstap-tls-client-key-file: ""
        # dnstap-tls-client-cert-file: ""
        dnstap-send-identity: yes
        dnstap-send-version: yes
        # dnstap-identity: ""
        # dnstap-version: ""
        dnstap-log-resolver-query-messages: yes
        dnstap-log-resolver-response-messages: yes
        dnstap-log-client-query-messages: yes
        dnstap-log-client-response-messages: yes
        dnstap-log-forwarder-query-messages: yes
        dnstap-log-forwarder-response-messages: yes

FreeBSD uses the chroot option (chroot: "/usr/local/etc/unbound") for unbound. Here's what I see in the log (to syslog):

Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: init module 0: validator
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: init module 1: iterator
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: attempting to connect to dnstap socket /usr/local/etc/unbound/dnstap.sock
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] warning: could not open dnstap-socket-path: /usr/local/etc/unbound/dnstap.sock, No such file or directory
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap identity field set to "blah-blah-blah-blah"
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap version field set to "unbound 1.12.0"
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap Message/RESOLVER_QUERY enabled
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap Message/RESOLVER_RESPONSE enabled
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap Message/CLIENT_QUERY enabled
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap Message/CLIENT_RESPONSE enabled
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap Message/FORWARDER_QUERY enabled
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] notice: dnstap Message/FORWARDER_RESPONSE enabled
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:0] info: start of service (unbound 1.12.0).
Nov 29 22:52:59 blah-blah-blah-blah unbound[5929]: [5929:2] error: dnstap io: failed to connect to "/usr/local/etc/unbound/dnstap.sock": No such file or directory
Nov 29 22:52:59 static-173-53-110-7 syslogd: last message repeated 1 times

Here's a stat on the file:

stat -x /usr/local/etc/unbound/dnstap.sock
  File: "/usr/local/etc/unbound/dnstap.sock"
  Size: 0            FileType: Socket
  Mode: (0755/srwxr-xr-x)         Uid: (   59/ unbound)  Gid: (    0/   wheel)
Device: 0,112   Inode: 2053109887    Links: 1
Access: Sun Nov 29 22:38:59 2020
Modify: Sun Nov 29 22:38:59 2020
Change: Sun Nov 29 22:38:59 2020

I found this FreeBSD b/z https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248828 which suggests to come here and report the issue.

I can make dnstap work via a network socket:

dnstap:
        dnstap-enable: yes
        # dnstap-bidirectional: yes
        # dnstap-socket-path: "dnstap.sock"
         dnstap-ip: 127.0.0.1@5353
         dnstap-tls: no
        # dnstap-tls-server-name: ""
        # dnstap-tls-cert-bundle: ""
        # dnstap-tls-client-key-file: ""
        # dnstap-tls-client-cert-file: ""
        dnstap-send-identity: yes
        dnstap-send-version: yes
        # dnstap-identity: ""
        # dnstap-version: ""
        dnstap-log-resolver-query-messages: yes
        dnstap-log-resolver-response-messages: yes
        dnstap-log-client-query-messages: yes
        dnstap-log-client-response-messages: yes
        dnstap-log-forwarder-query-messages: yes
        dnstap-log-forwarder-response-messages: yes
sudo -u unbound ~/go/bin/dnstap -l 127.0.0.1:5353 -w /tmp/dnstap.out
dnstap.FrameStreamSockInput: accepted a socket connection
sudo ~/go/bin/dnstap -r /tmp/dnstap.out | head -n 3
dnstap: opened input file /tmp/dnstap.out
23:12:10.430397 CQ 9.8.7.6 UDP 41b "api.useragentswitch.com." IN A
23:12:10.430696 FQ 1.2.3.4 TCP 52b "api.useragentswitch.com." IN A
23:12:10.591342 FR 1.2.3.4 TCP 122b "api.useragentswitch.com." IN A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions