Skip to content

HY2 ACME

KnowSky404 edited this page Nov 1, 2026 · 3 revisions

HY2 automatic certificates in instance management

新增 HY2 协议、创建实例和修改实例支持 ACME HTTP-01、Cloudflare DNS-01 与手动证书。新建结构化实例默认 ACME、监听单个 :: 接受 IPv4/IPv6 连接;无需在同端口额外添加 0.0.0.0 监听。修改默认保留已有模式和地址,首次安装的 legacy 配置实际监听仍遵循全局入站模式。DNS Token 隐藏输入,ACME 客户端使用系统信任;手动证书继续支持显式证书信任。

The existing schema-1 JSON store gains an optional ACME TLS variant without changing existing manual records. It stores tls:{enabled:true,server_name,acme:{...}} and requires client_trust:"system". The renderer selects inline certificate providers on sing-box 1.14+ and inline ACME on 1.13.x. Each instance retains its own domains, challenge options and credentials. Exported clients and ordinary Agent summaries never include ACME credentials. No ACME process or package is installed separately.

Legacy ACME/provider nodes are collected losslessly when creating a second instance. Unique provider mappings, existing identity, additional domains, custom storage, Cloudflare zone tokens and supported extensions are preserved. Unsupported fields, conflicting TLS sources, invalid ALPN and ambiguous mappings fail before publication. Existing CAS, backup, candidate checks, firewall journal, postcheck and rollback remain the write boundary. The generator-owned legacy provider is removed only after its final reference disappears; unrelated shared providers remain intact. Removing an instance does not remove certificates or the ACME cache.

HTTP-01 needs DNS pointing to the VPS and public TCP 80 reachable and usable for validation and renewal. DNS-01 needs Cloudflare DNS permissions and does not require those A/AAAA records or TCP 80. HY2 data traffic still uses its configured UDP port. The implementation does not expand firewall access for the CA challenge or claim public issuance based on service startup.

Focused verification

Use SINGBOX_BINARY_114 for the actual 1.14.x core and SINGBOX_BINARY_113 for optional 1.13.x checks:

bash tests/hy2_instance_acme.sh
bash tests/hy2_instance_acme_menu.sh
bash tests/hy2_instance_acme_lifecycle.sh
bash tests/hy2_install_prompt_guidance.sh
bash tests/structured_hy2_instance_management.sh

These cover the additional-install entry, HTTP/DNS choices, unchanged edit defaults, hidden token input, both runtime formats, complete intake, Agent/client/SubMan materials, invalid options, legacy adoption, create/replace/delete, stale revision rejection, real core validation failure and service-restart rollback. Related manual-TLS, legacy ACME, configuration, state and sharing tests provide the scoped cross-protocol regression checks.

tests/hy2_instance_acme_runtime.sh requires a fresh disposable verification Docker container, an official sing-box build with ACME/QUIC, Python, OpenSSL and a separately supplied Pebble executable. Copy install.sh and the runtime test into a repository-shaped directory, then run:

SBV_HY2_ACME_RUNTIME=1 PEBBLE_BINARY=/usr/local/bin/pebble \
  bash tests/hy2_instance_acme_runtime.sh

The test uses a private HTTPS trust file, a local CA, actual HTTP-01 validation on port 80, two HY2 instances, verified QUIC/TLS proxy transfers through the container non-loopback IPv4 address, cache reuse after restart, and deletion isolation. It never disables certificate verification or uses a public CA or real Cloudflare token. Keep /tmp/hy2-acme-runtime as the artifact bundle before removing the container. Set HY2_ACME_LEGACY_BASELINE=1 for the legacy-provider adoption variant. This proves isolated issuance and data flow; real Cloudflare DNS-01 issuance, public reachability and production deployment remain separate acceptance boundaries.

等待提示

公网监听确认后,实例事务会立即显示开始信息,并在等待期间每 5 秒报告已耗时;备份、发布、监听/防火墙同步及服务检查分别显示阶段。服务重启提示 ACME 签发或 DNS 验证可能耗时,最终显示完成或失败;具体证书诊断可通过主菜单 10 查看。进度提示不会输出 DNS Token 或完整配置。

Clone this wiki locally