#dns #dnssec #named #bind #networking #cross-platform

app crab-hole

Pi-Hole 克隆版,使用 hickory-dns/trust-dns 编写

9 个版本

0.1.8 2023年11月29日
0.1.7 2023年10月17日
0.1.5 2023年9月2日
0.1.4 2023年8月16日
0.1.3 2023年5月11日

#13#bind

Download history 20/week @ 2024-07-01

74 每月下载次数

AGPL-3.0 或更新版

57KB
1.5K SLoC

🦀 crab-hole

License: AGPL-3.0-or-later crab-hole on crates.io Source Code Repository Packaging status AUR package

Crab-hole 是一个跨平台 Pi-hole 克隆版,使用 Rust 编写,并利用 hickory-dns/trust-dns。它可以作为网络级的广告和间谍软件拦截器,或运行在您的本地电脑上。

为了安全私密通信,crab-hole 内置了对 doh(https)、doq(quic) 和 dot(tls)(用于上下游)以及 dnssec(用于上游)的支持。它还提供了对默认日志记录设置隐私友好的配置。

安装

Crab-hole 可在以下仓库中找到

Packaging status

可以从 GitHub 发布版 下载预构建的二进制文件。

从源码构建

或者您可以轻松地自行构建 crab-hole。

  • 安装 Rust
  • 运行 cargo install crab-hole --locked 更多关于 cargo install 的信息,请参阅 Rust 书籍
  • 确保 ~/.cargo/bin 已列入 PATH 环境变量中

Docker

GitHub 容器仓库中有可用的 Docker 镜像。示例 docker-compoe.yml

version: '3.3'
services:
    crab-hole:
        image: 'ghcr.io/luckyturtledev/crab-hole:latest' #semver tags are available
        ports: #required ports depend on downstream configuration
            - "53:53/tcp"
            - "53:53/udp"
        volumes:
            - './data:/data'
            - './config.toml:/data/config.toml:ro'

Semver 标签如 v0v0.1v0.1.3 可用于安全地允许自动更新。

配置

以下是一个示例配置文件,使用 cloudflare 作为 dot(dns-over-tls)上游。

[blocklist]
include_subdomains = true
lists = [
	"https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts",
	"https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt",
	"file:///blocked.txt"
]
# allow domains blocked by the blocklist again
allow_list = ["file:///allowed.txt"]

# optional
[api]
port = 8080
listen = "127.0.0.1"
# optional (default = false)
show_doc = true # OpenAPI doc loads content from third party websites
# optional
admin_key = "1234"

[[downstream]]
protocol = "udp"
listen = "localhost"
port = 8080

[[downstream]]
protocol = "udp"
listen = "[::]" #all ipv6 and ipv4 adress
port = 8053

[[downstream]]
protocol = "tls"
listen = "[::]"
port = 8054
certificate = "dns.example.com.crt"
key = "dns.example.com.key"
# optional (default = 3000)
timeout_ms = 3000

[[downstream]]
protocol = "https"
listen = "[::]"
port = 8055
certificate = "dns.example.com.crt"
key = "dns.example.com.key"
dns_hostname = "dns.example.com"
# optional (default = 3000)
timeout_ms = 3000

[[downstream]]
protocol = "quic"
listen = "127.0.0.1"
port = 8055
certificate = "dns.example.com.crt"
key = "dns.example.com.key"
dns_hostname = "dns.example.com"
# optional (default = 3000)
timeout_ms = 3000

# optional
[upstream.options]
# optional (default = false )
validate = true # use DNSSEC
# see https://docs.rs/trust-dns-resolver/0.23.0/trust_dns_resolver/config/struct.ResolverOpts.html for all options

[[upstream.name_servers]]
socket_addr = "[2606:4700:4700::1111]:853"
protocol = "tls"
tls_dns_name = "1dot1dot1dot1.cloudflare-dns.com"
trust_nx_responses = false

[[upstream.name_servers]]
socket_addr = "[2606:4700:4700::1001]:853"
protocol = "tls"
tls_dns_name = "1dot1dot1dot1.cloudflare-dns.com"
trust_nx_responses = false

[[upstream.name_servers]]
socket_addr = "1.1.1.1:853"
protocol = "tls"
tls_dns_name = "1dot1dot1dot1.cloudflare-dns.com"
trust_nx_responses = false

[[upstream.name_servers]]
socket_addr = "1.0.0.1:853"
protocol = "tls"
tls_dns_name = "1dot1dot1dot1.cloudflare-dns.com"
trust_nx_responses = false

依赖项

~44–60MB
~1M SLoC