|
| 1 | +# Installation on pfSense |
| 2 | + |
| 3 | +There are two ways to install DNSCrypt Proxy on pfSense: |
| 4 | + |
| 5 | +1. **[GUI Package (Recommended)](#gui-package-recommended)** - Full web interface integration with point-and-click configuration |
| 6 | +2. **[Manual Installation](#manual-installation)** - Traditional command-line setup for advanced users |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## GUI Package (Recommended) |
| 11 | + |
| 12 | +A community-maintained pfSense package provides full GUI integration for DNSCrypt Proxy, accessible from the pfSense web interface at **Services > DNSCrypt Proxy**. |
| 13 | + |
| 14 | +### Features |
| 15 | + |
| 16 | +- Full GUI configuration with 7 tabs (General, Server Selection, Cache & Filtering, Logging, Advanced, Query Log, and more) |
| 17 | +- Pre-configured servers from Cloudflare, Quad9, Google, AdGuard, NextDNS, Mullvad, OpenDNS, CleanBrowsing, and others |
| 18 | +- Support for DNSCrypt v2, DNS-over-HTTPS (DoH), and Anonymized DNS |
| 19 | +- Custom resolver support via DNS stamps |
| 20 | +- Domain filtering with block/allow lists, forwarding rules, and cloaking |
| 21 | +- Built-in query log viewer with filtering |
| 22 | +- Multi-architecture support (amd64 and arm64, auto-detected) |
| 23 | +- Native service integration via Status > Services |
| 24 | + |
| 25 | +### Installation |
| 26 | + |
| 27 | +Run one of these commands in the pfSense shell (via SSH or Console): |
| 28 | + |
| 29 | +**pfSense CE:** |
| 30 | +```bash |
| 31 | +pkg-static add https://github.com/nopoz/pfsense-dnscrypt-proxy/releases/latest/download/pfSense-pkg-dnscrypt-proxy.pkg |
| 32 | +``` |
| 33 | + |
| 34 | +**pfSense Plus:** |
| 35 | +```bash |
| 36 | +pkg-static -C /dev/null add https://github.com/nopoz/pfsense-dnscrypt-proxy/releases/latest/download/pfSense-pkg-dnscrypt-proxy.pkg |
| 37 | +``` |
| 38 | + |
| 39 | +After installation, navigate to **Services > DNSCrypt Proxy** in the pfSense web interface. |
| 40 | + |
| 41 | +### Basic Setup |
| 42 | + |
| 43 | +1. Navigate to **Services > DNSCrypt Proxy** |
| 44 | +2. Check **Enable DNSCrypt Proxy** |
| 45 | +3. Select your preferred DNS servers from the **Server Selection** tab |
| 46 | +4. Click **Save** |
| 47 | + |
| 48 | +### Integrating with DNS Resolver (Unbound) |
| 49 | + |
| 50 | +To forward Unbound queries through DNSCrypt Proxy: |
| 51 | + |
| 52 | +1. Go to **Services > DNS Resolver > General Settings** |
| 53 | +2. Add the following to **Custom options**: |
| 54 | + |
| 55 | +``` |
| 56 | +server: |
| 57 | + do-not-query-localhost: no |
| 58 | +forward-zone: |
| 59 | + name: "." |
| 60 | + forward-addr: 127.0.0.1@5300 |
| 61 | +``` |
| 62 | + |
| 63 | +3. Click **Save** and **Apply Changes** |
| 64 | + |
| 65 | +### Uninstall |
| 66 | + |
| 67 | +```bash |
| 68 | +pkg delete pfSense-pkg-dnscrypt-proxy |
| 69 | +``` |
| 70 | + |
| 71 | +For more details, see the [package repository](https://github.com/nopoz/pfsense-dnscrypt-proxy). |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## Manual Installation |
| 76 | + |
| 77 | +For users who prefer command-line configuration or need custom setups, follow these steps. |
| 78 | + |
| 79 | +### 1. Download and Install the Binary |
| 80 | + |
| 81 | +Download the latest release for FreeBSD/amd64 from the [releases page](https://github.com/DNSCrypt/dnscrypt-proxy/releases): |
| 82 | + |
| 83 | +```bash |
| 84 | +cd /tmp |
| 85 | +fetch https://github.com/DNSCrypt/dnscrypt-proxy/releases/download/2.1.5/dnscrypt-proxy-freebsd_amd64-2.1.5.tar.gz |
| 86 | +mkdir dnscrypt-proxy |
| 87 | +tar -xzf dnscrypt-proxy-freebsd_amd64-2.1.5.tar.gz -C dnscrypt-proxy |
| 88 | +mv dnscrypt-proxy/freebsd-amd64/dnscrypt-proxy /usr/local/bin/ |
| 89 | +chown root:wheel /usr/local/bin/dnscrypt-proxy |
| 90 | +chmod 755 /usr/local/bin/dnscrypt-proxy |
| 91 | +``` |
| 92 | + |
| 93 | +### 2. Configure DNSCrypt Proxy |
| 94 | + |
| 95 | +Create the configuration directory and copy the example configuration: |
| 96 | + |
| 97 | +```bash |
| 98 | +mkdir -p /usr/local/etc/dnscrypt-proxy |
| 99 | +cp /tmp/dnscrypt-proxy/freebsd-amd64/example-dnscrypt-proxy.toml /usr/local/etc/dnscrypt-proxy/dnscrypt-proxy.toml |
| 100 | +``` |
| 101 | + |
| 102 | +Edit the configuration file: |
| 103 | + |
| 104 | +```bash |
| 105 | +vi /usr/local/etc/dnscrypt-proxy/dnscrypt-proxy.toml |
| 106 | +``` |
| 107 | + |
| 108 | +**Important:** Set the listen address to avoid conflicts with pfSense DNS services: |
| 109 | + |
| 110 | +```toml |
| 111 | +listen_addresses = ['127.0.0.1:5300'] |
| 112 | +``` |
| 113 | + |
| 114 | +### 3. Create the Startup Script |
| 115 | + |
| 116 | +Create an rc.d script to enable automatic startup: |
| 117 | + |
| 118 | +```bash |
| 119 | +cat > /usr/local/etc/rc.d/dnscrypt-proxy.sh << 'EOF' |
| 120 | +#!/bin/sh |
| 121 | +
|
| 122 | +# PROVIDE: dnscrypt_proxy |
| 123 | +# REQUIRE: NETWORKING |
| 124 | +# KEYWORD: shutdown |
| 125 | +
|
| 126 | +. /etc/rc.subr |
| 127 | +
|
| 128 | +name="dnscrypt_proxy" |
| 129 | +rcvar="dnscrypt_proxy_enable" |
| 130 | +
|
| 131 | +load_rc_config $name |
| 132 | +
|
| 133 | +: ${dnscrypt_proxy_enable:="YES"} |
| 134 | +
|
| 135 | +pidfile="/var/run/dnscrypt-proxy.pid" |
| 136 | +command="/usr/local/bin/dnscrypt-proxy" |
| 137 | +command_args="-config /usr/local/etc/dnscrypt-proxy/dnscrypt-proxy.toml -pidfile ${pidfile} -syslog" |
| 138 | +
|
| 139 | +run_rc_command "$1" |
| 140 | +EOF |
| 141 | + |
| 142 | +chmod +x /usr/local/etc/rc.d/dnscrypt-proxy.sh |
| 143 | +``` |
| 144 | + |
| 145 | +### 4. Start the Service |
| 146 | + |
| 147 | +```bash |
| 148 | +service dnscrypt-proxy.sh start |
| 149 | +``` |
| 150 | + |
| 151 | +### 5. Configure DNS Resolver (Unbound) |
| 152 | + |
| 153 | +1. Navigate to **Services > DNS Resolver > General Settings** |
| 154 | +2. Add the following to **Custom options**: |
| 155 | + |
| 156 | +``` |
| 157 | +server: |
| 158 | + do-not-query-localhost: no |
| 159 | +forward-zone: |
| 160 | + name: "." |
| 161 | + forward-addr: 127.0.0.1@5300 |
| 162 | +``` |
| 163 | + |
| 164 | +3. Click **Save** and **Apply Changes** |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## Related Links |
| 169 | + |
| 170 | +- [DNSCrypt Proxy GitHub](https://github.com/DNSCrypt/dnscrypt-proxy) |
| 171 | +- [GUI Package Repository](https://github.com/nopoz/pfsense-dnscrypt-proxy) |
| 172 | +- [Configuration Documentation](https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Configuration) |
0 commit comments