A robust solution to secure and filter DNS traffic for OpenVPN clients using BIND, DNSCrypt, and Cloudflare (DoH). This repository includes configuration steps, bash scripts, and guidelines for enabling content filtering and monitoring OpenVPN client traffic.
This project demonstrates how to:
- Secure DNS traffic with DNSCrypt using encrypted DNS-over-HTTPS (DoH).
- Enable content filtering with Cloudflare Family DNS for OpenVPN clients.
- Integrate BIND as an authoritative and recursive DNS server.
- Push filtered, secure DNS configurations to OpenVPN clients.
- Optionally monitor OpenVPN client HTTP traffic using logging techniques.
The tutorial assumes you have prior knowledge of:
- Installing and configuring OpenVPN, BIND, and DNSCrypt.
- System administration and handling advanced DNS setups.
- Content Filtering: Block adult and other restricted content via Cloudflare Family DNS.
- DNS-over-HTTPS (DoH): Encrypt DNS traffic for privacy and security.
- OpenVPN Integration: Push secure DNS to OpenVPN clients for consistent filtering.
- Traffic Monitoring: Includes a sample script,
spy_vpn.sh
, to analyze OpenVPN client traffic.
spy_vpn.sh
: A script to monitor OpenVPN client HTTP activity.
- OpenVPN installed and configured with a functional TUN/TAP interface.
- BIND set up as an authoritative primary DNS server.
- DNSCrypt-proxy configured to use Cloudflare (DoH).
Refer to the full tutorial: Content Filtering + (DoH) for OpenVPN Clients via BIND-DNSCrypt.
-
DNSCrypt Setup:
- Listen on a secondary loopback address (e.g.,
127.0.2.1:53
). - Configure caching and logging for optimal performance and debugging.
- Listen on a secondary loopback address (e.g.,
-
BIND Integration:
- Forward DNS queries to DNSCrypt-proxy.
- Separate OpenVPN client DNS traffic using BIND views.
-
OpenVPN Configuration:
- Push filtered DNS to OpenVPN clients using
push "dhcp-option DNS <bind-listen-IP>"
. - Enable logging for query tracking and debugging.
- Push filtered DNS to OpenVPN clients using
-
Traffic Monitoring:
- Use
spy_vpn.sh
to analyze OpenVPN client DNS and HTTP traffic.
- Use
- Connect an OpenVPN client.
- Verify DNS-over-HTTPS (DoH) using Cloudflare's DoH Test.
- Check logs:
- DNSCrypt:
/var/log/dnscrypt-proxy/query.log
- BIND:
/var/log/named/queries.log
- DNSCrypt:
- Analyze traffic using tools like
tcpdump
.
- Full Tutorial: PSAUXIT Tutorial
- Cloudflare DoH Service: 1.1.1.1/help
Feel free to submit issues or contribute to the repository by opening pull requests.
Created by Hasan ÇALIŞIR at PSAUXIT