SagerNet / SagerNet/sing-box

Feature Request: WAN IP discovery for Let's Encrypt IP cert

Open
#4,449 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
38.2k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

I implemented ACME WAN IP discovery for Let's Encrypt IP certs

I've only tested this using Hysteria2, there may be bugs with other protocols

The idea is to add optional WAN-IP discovery so ACME IP certificates do not require
rewriting "domain": [], when the public address changes.

  • lookup runs at startup (start fails if the first lookup fails)
  • interval time to check and re-issue only when the address set changes
  • forced tcp4/tcp6 dial so dual-stack echo endpoints return the matching family
  • GetCertificate selects IPv4 vs IPv6 by SNI, local addr, then remote family
    (fixes empty/"::" SNI on listen "::")
  • deletes stale IP cert files under "data_directory":

It probably needs some more beautifying in code and json structure

new json parameters in acme type

  "certificate_providers": [
    {
      "type": "acme",
      "tag": "",
      "provider": "letsencrypt",
      "check_ip": true,
      "check_ip_interval": "2d",
      "check_ip_url": "https://api.ip.sb/geoip",
      "check_ip_version": "both"
  • check_ip: Enable WAN-IP discovery. domain may be empty. Static names in domain are still requested.
  • check_ip_url: Required if check_ip is true. Plain text or JSON (ip, query, origin, address, wan_ip, ipAddress, IPv4, ipv6).
  • check_ip_version: 4 or empty → IPv4 only; 6 → IPv6 only; both → forced tcp4 and tcp6 lookups, one cert per address.
  • check_ip_interval: Default/omitted/empty lets certmagic handle the renewal process using the shortlived schedule, Accepts durations such as 30m, 2h, 5d

Branch on my fork:
https://github.com/FreestyleSasuke/sing-box/tree/feat/acme-check-ip

Compare:
https://github.com/SagerNet/sing-box/compare/testing...FreestyleSasuke:feat/acme-check-ip

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the provided feat/acme-check-ip branch and its comparison with testing, then inspect how the ACME certificate provider currently handles domains and certificate files. Check the proposed JSON parameters and the stated startup, interval, address-family, certificate-selection, and stale-file behaviors. Done means the WAN address changes are handled without rewriting the domain list and the documented configuration works across the supported protocols.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.