跳转至

配置参考

配置文件为 TOML 格式,acme-dns 按以下顺序查找:

  1. -c/--config 指定路径(优先);
  2. /etc/acme-dns/config.toml;
  3. ./config.toml。

acme-dns init 可生成带注释的示例配置到 config.toml(已存在时不覆盖, -c 可指定目标路径)。字段名与 Go 版 config.cfg 完全一致。

[general]

字段 默认值 说明
listen 127.0.0.1:53 DNS 监听地址;注意 systemd-resolved 可能占用 127.0.0.53:53
protocol both 监听协议:both / both4 / both6 / udp / udp4 / udp6 / tcp / tcp4 / tcp6
domain — 服务的域名(如 auth.example.org)
nsname — SOA 的 zone name server
nsadmin — SOA 管理员邮箱,@ 替换为 .
records [] 静态预置记录(除 TXT 外),如 "auth.example.org. A 198.51.100.1"
debug false CORS 等调试日志

[database]

字段 默认值 说明
engine sqlite sqlite(兼容 sqlite3 别名)或 postgres
connection — sqlite 为文件路径;postgres 为 postgres://user:password@host/db

SQLite 单连接串行化(与 Go 版一致),文件不存在时自动创建; schema 与 Go 版互通,可直接复用现有 acme-dns.db。

[api]

字段 默认值 说明
ip 0.0.0.0 API 监听 IP
port 80 API 监听端口(如 443)
disable_registration false 关闭 /register 端点
tls none cert / none(letsencrypt 系列字段保留兼容,当前 Rust 版未内置 ACME 客户端,见差异说明)
tls_cert_privkey — tls = "cert" 时私钥 PEM 路径
tls_cert_fullchain — tls = "cert" 时证书全链 PEM 路径
acme_cache_dir api-certs Let's Encrypt 模式缓存目录(保留字段)
notification_email "" Let's Encrypt 到期通知邮箱(保留字段)
corsorigins ["*"] CORS AllowOrigins,可用通配符
use_header false 用 HTTP 头解析客户端 IP(反代场景)
header_name X-Forwarded-For 从哪个头取 IP 列表
hsts_enabled false 是否发送 HSTS 头
hsts_max_age 31536000 HSTS max-age
hsts_include_subdomains false HSTS includeSubDomains
hsts_preload false HSTS preload
admin_token "" 管理端 /admin/* Bearer token;为空时管理 API 不挂载

[log]

字段 默认值 说明
loglevel info error / warning / info / debug
logtype stdout 输出目标(当前支持 stdout)
logformat text text / json

示例

完整带注释示例见根目录 config.toml,或运行 acme-dns init 生成。 容器专用配置见 docker/config.toml。