# PR-DNSd | Passive-Recursive DNS Daemon

**URL:** <https://onehack.st/t/pr-dnsd-passive-recursive-dns-daemon/221860>\
**Category:** Tools & Scripts\
**Tags:** tools, freebies, networking\
**Created:** [August 1, 2022, 1:03pm UTC](https://onehack.st/t/pr-dnsd-passive-recursive-dns-daemon/221860 "2022-08-01T13:03:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlueHacker](https://onehack.st/user_avatar/onehack.st/bluehacker/32/174721_2.png) [@BlueHacker](https://onehack.st/u/BlueHacker)\
**Post date:** [August 1, 2022, 1:03pm UTC](https://onehack.st/t/pr-dnsd-passive-recursive-dns-daemon/221860/1 "2022-08-01T13:03:45Z")

</div>

![image](https://onehack.st/uploads/default/original/3X/7/0/70e5482c4ea65cbca9679c1bc10a9bf74739900d.jpeg)

# PR-DNSd

Passive-Recursive DNS daemon.

## What does it do

[![This](https://github.com/korc/PR-DNSd/raw/master/solved-netstat.jpg)](https://github.com/korc/PR-DNSd/blob/master/solved-netstat.jpg)

## Quickstart

go get [github.com/korc/PR-DNSd](http://github.com/korc/PR-DNSd) sudo setcap cap\_net\_bind\_service,cap\_sys\_chroot=ep go/bin/PR-DNSd go/bin/PR-DNSd -upstream 9.9.9.9:53 -listen 127.0.0.1:53 echo nameserver 127.0.0.1 | sudo tee /etc/resolv.conf dig [google.com](http://google.com) dig -x $(dig +short [google.com](http://google.com))

_If you can’t use `setcap`, you have to use `-chroot ""` and `-listen :<high_port>` options, or run as `root`._

## Use cases

- run as local host DNS service, to fix your `netstat`/`tcpview`/`lsof` etc. output
- as enterprise-internal DNS server, to also be able to do meaningful EDR/IR and log analysis
- as cloud service, to also collect Passive DNS data from non-enterprise (home, BYOD etc.) devices
  - _hint: you probably want to configure DDoS protection options_

- in cloud as DNS-over-TLS server, to additionally provide private DNS for supporting devices (ex: Android 9’s private DNS setting)
  - ex: domain pattern based firewall/proxy configuration for mobile devices

### Running as your own private server for Android9’s Private DNS settings

After appropriate `setcap`, run:

PR-DNSd -tlslisten :853 -cert YOUR\_SERVER\_CRT\_KEY\_PEM -upstream 1.1.1.1:53 -store pr-dnsd

## Options

```auto
-cert string
    TCP-TLS listener certificate (required for tls listener)
-chroot string
    chroot to directory after start (default "/var/tmp")
-count int
    Count of replies allowed before debounce delay is applied (default 100)
-ctmout string
    Client timeout for upstream queries
-debounce string
    Required time duration between UDP replies to single IP to prevent DoS (default "200ms")
-key string
    TCP-TLS certificate key (default same as -cert value)
-listen string
    listen address (default ":53")
-silent
    Don't report normal data
-store string
    Store PTR data to specified file
-tlslisten string
    TCP-TLS listener address (default ":853")
-upstream string
    upstream DNS server (tcp-tls:// prefix for DoT) (default "1.1.1.1:53")
    (with tls and chroot, ensure ca-certificates and resolv.conf in chroot are properly set up)

```

## GitHub:

> **[GitHub - korc/PR-DNSd: Passive-Recursive DNS daemon](https://github.com/korc/PR-DNSd)**
>
> Passive-Recursive DNS daemon
