[GH-ISSUE #5258] [Bug]: SSL issuance fails on IPv6-only servers without public IPv4 (HTTP-01 standalone assumes port 80 is publicly reachable) #3683

Closed
opened 2026-10-31 20:34:13 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @justin-zc on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5258

Describe the bug

Version

Latest 3x-ui version(v3.3.1)

Environment

  • OS: Alpine Linux 3.23
  • Panel: 3x-ui
  • ACME client: acme.sh (bundled)
  • Server type: IPv6-only VPS

Description

I am using a VPS provider that only provides:

  • Public IPv6 address
  • No public IPv4 address
  • IPv4 access is available only through several mapped ports

Example:
Public IPv6:
Example:2a01:4f9:6b:47e9::2451

IPv4 mapped ports:
22116
32116
42116

The domain points to the server's IPv6 address via an AAAA record.

Problem

When using:
Menu -> Panel Settings -> SSL Certificate -> Get SSL (Domain)
3x-ui invokes acme.sh in standalone HTTP-01 mode and always expects port 80 to be reachable from the Internet.

The certificate request fails with:

Invalid response from http://domain/.well-known/acme-challenge/...
521
cli 错误显示如下:
xxx.com: Invalid status. Verification error details: 2a01:4f9:6b:47e9::2451: Fetching http://xxx.com/.well-known/acme-challenge/5itjDyHqMRNx78nbJEKq07escdyMctyzEgRSqnrBXso: Connection refused

### How to reproduce the problem

or similar connection errors.

In IPv6-only environments, this is a common deployment scenario.

### Expected behavior

3x-ui should:

1. Detect whether port 80 is actually reachable before starting HTTP-01 validation.
2. Detect IPv6-only environments and provide a warning.
3. Offer DNS-01 validation as an alternative directly from the UI.
4. Improve error messages to indicate:
    * Port 80 is unreachable
    * Cloudflare proxy is enabled
    * IPv6-only environment detected

### Actual behavior

_No response_

### Relevant logs

```shell

Screenshots

No response

3x-ui version

3.3.1

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Alpine Linux 3.23

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @justin-zc on GitHub (Jun 13, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5258 ### Describe the bug ### Version Latest 3x-ui version(v3.3.1) ### Environment - OS: Alpine Linux 3.23 - Panel: 3x-ui - ACME client: acme.sh (bundled) - Server type: IPv6-only VPS ### Description I am using a VPS provider that only provides: - Public IPv6 address - No public IPv4 address - IPv4 access is available only through several mapped ports Example: Public IPv6: Example:2a01:4f9:6b:47e9::2451 IPv4 mapped ports: 22116 32116 42116 The domain points to the server's IPv6 address via an AAAA record. ### Problem When using: Menu -> Panel Settings -> SSL Certificate -> Get SSL (Domain) 3x-ui invokes acme.sh in standalone HTTP-01 mode and always expects port 80 to be reachable from the Internet. The certificate request fails with: ```text Invalid response from http://domain/.well-known/acme-challenge/... 521 cli 错误显示如下: xxx.com: Invalid status. Verification error details: 2a01:4f9:6b:47e9::2451: Fetching http://xxx.com/.well-known/acme-challenge/5itjDyHqMRNx78nbJEKq07escdyMctyzEgRSqnrBXso: Connection refused ### How to reproduce the problem or similar connection errors. In IPv6-only environments, this is a common deployment scenario. ### Expected behavior 3x-ui should: 1. Detect whether port 80 is actually reachable before starting HTTP-01 validation. 2. Detect IPv6-only environments and provide a warning. 3. Offer DNS-01 validation as an alternative directly from the UI. 4. Improve error messages to indicate: * Port 80 is unreachable * Cloudflare proxy is enabled * IPv6-only environment detected ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.3.1 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Alpine Linux 3.23 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:34:13 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 13, 2026):

The failure here is caused by a fundamental constraint of HTTP-01 validation, not a bug in the listener configuration. Let's Encrypt's validation servers must be able to open a TCP connection to port 80 on the server's public IP. Your provider exposes only specific NAT-mapped ports (22116, 32116, 42116) and not port 80, so the challenge will always be refused regardless of which IP-stack acme.sh listens on.

What the code actually does

x-ui.sh option 19 → "Get SSL (Domain)" calls ssl_cert_issue() (x-ui.sh line 1653), which runs:

~/.acme.sh/acme.sh --issue -d <domain> $(acme_listen_flag) --standalone --httpport <port> --force

The helper acme_listen_flag() (x-ui.sh lines 57–63, added to fix #4994) checks for a globally-scoped IPv4 address:

  • host has a global IPv4 → no extra flag (acme.sh binds 0.0.0.0:80)
  • no global IPv4 → --listen-v6 (acme.sh binds :::80)

On your IPv6-only VPS, ip -4 addr show scope global returns nothing, so the listener correctly binds to :::80. The error is not about which stack the listener uses—it is about Let's Encrypt being unable to reach that port at all because port 80 is not forwarded through your provider's NAT.

This is distinct from #4994 (IPv6-only listener on a dual-stack host where the A record requires IPv4 validation) and #3960 (missing --listen-v6 flag for the IP-certificate flow). Both of those were addressed in commit dbee150b and are already in v3.3.1.

Working workaround available today

If your domain's DNS is managed by Cloudflare: use the built-in DNS-01 option, which does not require port 80 at all.

x-ui   →  option 20 (Cloudflare SSL Certificate)

This calls ssl_cert_issue_CF() (x-ui.sh line 1867), which uses --dns dns_cf and validates entirely through the Cloudflare API.

If your DNS is not on Cloudflare: run acme.sh directly with your DNS provider's plugin. acme.sh ships plugins for most major providers (Namecheap, DigitalOcean, Gandi, Vultr, etc.). Example:

# Export your provider's API credentials first, then:
~/.acme.sh/acme.sh --issue -d your.domain --dns dns_<provider> --server letsencrypt

# Install the certificate and register an auto-renewal hook:
~/.acme.sh/acme.sh --installcert -d your.domain \
  --key-file /root/cert/your.domain/privkey.pem \
  --fullchain-file /root/cert/your.domain/fullchain.pem \
  --reloadcmd "x-ui restart"

# Then configure the panel (x-ui option 19 → option 5, or Settings in the web UI)
# to use those two paths.

Consult the acme.sh DNS API wiki for your provider's plugin name and required environment variables.

On the enhancement requests

The following items in the original report are not yet implemented in the codebase:

  • Pre-flight check for port 80 reachability before starting acme.sh
  • Detection of IPv6-only / NAT-mapped-port environments with a user-visible warning
  • DNS-01 support in the ssl_cert_issue menu for providers other than Cloudflare
  • More descriptive error messages distinguishing "port 80 blocked", "Cloudflare proxy active", and "no public IPv4"

These are valid improvements; a PR addressing any of them would be welcome.


This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4697767273 --> @github-actions[bot] commented on GitHub (Jun 13, 2026): The failure here is caused by a fundamental constraint of HTTP-01 validation, not a bug in the listener configuration. Let's Encrypt's validation servers must be able to open a TCP connection to **port 80 on the server's public IP**. Your provider exposes only specific NAT-mapped ports (22116, 32116, 42116) and not port 80, so the challenge will always be refused regardless of which IP-stack acme.sh listens on. **What the code actually does** `x-ui.sh` option 19 → "Get SSL (Domain)" calls `ssl_cert_issue()` (x-ui.sh line 1653), which runs: ```bash ~/.acme.sh/acme.sh --issue -d <domain> $(acme_listen_flag) --standalone --httpport <port> --force ``` The helper `acme_listen_flag()` (x-ui.sh lines 57–63, added to fix #4994) checks for a globally-scoped IPv4 address: - host has a global IPv4 → no extra flag (acme.sh binds `0.0.0.0:80`) - no global IPv4 → `--listen-v6` (acme.sh binds `:::80`) On your IPv6-only VPS, `ip -4 addr show scope global` returns nothing, so the listener correctly binds to `:::80`. The error is not about which stack the listener uses—it is about Let's Encrypt being unable to reach that port at all because port 80 is not forwarded through your provider's NAT. This is distinct from #4994 (IPv6-only listener on a dual-stack host where the A record requires IPv4 validation) and #3960 (missing `--listen-v6` flag for the IP-certificate flow). Both of those were addressed in commit dbee150b and are already in v3.3.1. **Working workaround available today** If your domain's DNS is managed by **Cloudflare**: use the built-in DNS-01 option, which does not require port 80 at all. ``` x-ui → option 20 (Cloudflare SSL Certificate) ``` This calls `ssl_cert_issue_CF()` (x-ui.sh line 1867), which uses `--dns dns_cf` and validates entirely through the Cloudflare API. If your DNS is **not** on Cloudflare: run acme.sh directly with your DNS provider's plugin. acme.sh ships plugins for most major providers (Namecheap, DigitalOcean, Gandi, Vultr, etc.). Example: ```bash # Export your provider's API credentials first, then: ~/.acme.sh/acme.sh --issue -d your.domain --dns dns_<provider> --server letsencrypt # Install the certificate and register an auto-renewal hook: ~/.acme.sh/acme.sh --installcert -d your.domain \ --key-file /root/cert/your.domain/privkey.pem \ --fullchain-file /root/cert/your.domain/fullchain.pem \ --reloadcmd "x-ui restart" # Then configure the panel (x-ui option 19 → option 5, or Settings in the web UI) # to use those two paths. ``` Consult the [acme.sh DNS API wiki](https://github.com/acmesh-official/acme.sh/wiki/dnsapi) for your provider's plugin name and required environment variables. **On the enhancement requests** The following items in the original report are not yet implemented in the codebase: - Pre-flight check for port 80 reachability before starting acme.sh - Detection of IPv6-only / NAT-mapped-port environments with a user-visible warning - DNS-01 support in the `ssl_cert_issue` menu for providers other than Cloudflare - More descriptive error messages distinguishing "port 80 blocked", "Cloudflare proxy active", and "no public IPv4" These are valid improvements; a PR addressing any of them would be welcome. --- *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@justin-zc commented on GitHub (Jun 13, 2026):

Thanks😄

<!-- gh-comment-id:4697794749 --> @justin-zc commented on GitHub (Jun 13, 2026): Thanks😄
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3683
No description provided.