[GH-ISSUE #6885] [Feature]: Automatic detection of the server's IPv6 address when obtaining an SSL certificate for an IP address. #4571

Open
opened 2026-10-31 20:40:35 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @alinasrollahzadeh405-sudo on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6885

Hello. @MHSanaei, please add a feature to automatically detect the server's IPv6 address when obtaining an SSL certificate for an IP. This would improve efficiency and save users from the difficult task of manually entering IPv6 addresses—especially since data centers often provide IPv6 addresses as a range! Also, it would be helpful to allow this step to be confirmed or skipped via a simple y/n prompt. Thank you for your efforts and for the work of all the contributors!

Describe the solution you'd like

Please add an automatic IPv6 detection feature within the SSL certificate management section of the terminal. Additionally, provide the user with the option to accept or decline this step by displaying a prompt such as: "Your server's IPv6 address has been detected. Would you like to include it in the SSL certificate? (y/n)" or "IPv6 detected; include it in the SSL certificate? (y/n)." Thank you!

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @alinasrollahzadeh405-sudo on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6885 ### Is your feature request related to a problem? Hello. @MHSanaei, please add a feature to automatically detect the server's IPv6 address when obtaining an SSL certificate for an IP. This would improve efficiency and save users from the difficult task of manually entering IPv6 addresses—especially since data centers often provide IPv6 addresses as a range! Also, it would be helpful to allow this step to be confirmed or skipped via a simple `y/n` prompt. Thank you for your efforts and for the work of all the contributors! ### Describe the solution you'd like Please add an automatic IPv6 detection feature within the SSL certificate management section of the terminal. Additionally, provide the user with the option to accept or decline this step by displaying a prompt such as: "Your server's IPv6 address has been detected. Would you like to include it in the SSL certificate? (y/n)" or "IPv6 detected; include it in the SSL certificate? (y/n)." Thank you! ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 21, 2026):

This is a valid feature request. Right now the IP-certificate flow finds your IPv4 address automatically, but for IPv6 it only gives you an empty prompt. Nothing on the IPv6 side is detected or offered for you to confirm.

What the code does today (x-ui menu → SSL Certificate Management → option 6, which calls ssl_cert_issue_for_ip in x-ui.sh):

  1. IPv4 is detected automatically. The script tries a list of IPv4-only echo services (api4.ipify.org, ipv4.icanhazip.com, …, x-ui.sh:1552-1569) and asks you to confirm the result with a y/n prompt:
    if ! confirm "Is ${server_ip} the correct incoming public IPv4 address for this server?" "y"; then
    
    (x-ui.sh:1573)
  2. IPv6 is entered by hand only:
    read -rp "Do you have an IPv6 address to include? (leave empty to skip): " ipv6_addr
    
    (x-ui.sh:1593). If you type something, it is added as a second -d SAN (x-ui.sh:1640-1644).
  3. The installer works the same way: install.sh:954 shows the same manual prompt (it can be pre-filled with the XUI_SSL_IPV6 environment variable for non-interactive installs).

So what you're asking for is to give IPv6 the same treatment as IPv4: detect the address, then ask "include it? (y/n)". Some things for whoever implements it, based on the code above:

  • Detection could reuse the IPv4 pattern with IPv6-only endpoints, or read the host's global address (ip -6 addr show scope global). One thing about your "range" point: a data center usually routes a whole /64 to the server, but a certificate covers single addresses. The detected address has to be the one clients actually connect to, which is why the IPv4 path already asks for confirmation.
  • is_ipv6 only checks that the value contains a colon (x-ui.sh:43-45), so anything detected should be validated more strictly before it goes into domain_args.
  • Let's Encrypt validates each IP SAN separately over HTTP-01, so port 80 must be reachable over IPv6 as well. Otherwise issuance fails for the whole certificate, not just the IPv6 part. The IP flow's acme.sh --issue call (x-ui.sh:1687-1694) does not pass $(acme_listen_flag), unlike the domain flows (install.sh:456, install.sh:756). Whether acme.sh's standalone listener answers on IPv6 in that case depends on acme.sh/socat behaviour I did not check here. Anyone adding auto-inclusion should test it on a dual-stack host.

Until this exists, you can paste the address at the existing prompt. ip -6 addr show scope global lists the server's global IPv6 addresses.

Related, but a different request: #4948 (IPv6 addresses in subscriptions when the certificate only covers IPv4).

Verdict: Feature request

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

<!-- gh-comment-id:6307341037 --> @github-actions[bot] commented on GitHub (Oct 21, 2026): This is a valid feature request. Right now the IP-certificate flow finds your **IPv4** address automatically, but for **IPv6** it only gives you an empty prompt. Nothing on the IPv6 side is detected or offered for you to confirm. What the code does today (`x-ui` menu → SSL Certificate Management → option 6, which calls `ssl_cert_issue_for_ip` in `x-ui.sh`): 1. IPv4 is detected automatically. The script tries a list of IPv4-only echo services (`api4.ipify.org`, `ipv4.icanhazip.com`, …, `x-ui.sh:1552-1569`) and asks you to confirm the result with a y/n prompt: ```bash if ! confirm "Is ${server_ip} the correct incoming public IPv4 address for this server?" "y"; then ``` (`x-ui.sh:1573`) 2. IPv6 is entered by hand only: ```bash read -rp "Do you have an IPv6 address to include? (leave empty to skip): " ipv6_addr ``` (`x-ui.sh:1593`). If you type something, it is added as a second `-d` SAN (`x-ui.sh:1640-1644`). 3. The installer works the same way: `install.sh:954` shows the same manual prompt (it can be pre-filled with the `XUI_SSL_IPV6` environment variable for non-interactive installs). So what you're asking for is to give IPv6 the same treatment as IPv4: detect the address, then ask "include it? (y/n)". Some things for whoever implements it, based on the code above: - Detection could reuse the IPv4 pattern with IPv6-only endpoints, or read the host's global address (`ip -6 addr show scope global`). One thing about your "range" point: a data center usually routes a whole /64 to the server, but a certificate covers single addresses. The detected address has to be the one clients actually connect to, which is why the IPv4 path already asks for confirmation. - `is_ipv6` only checks that the value contains a colon (`x-ui.sh:43-45`), so anything detected should be validated more strictly before it goes into `domain_args`. - Let's Encrypt validates each IP SAN separately over HTTP-01, so port 80 must be reachable over IPv6 as well. Otherwise issuance fails for the whole certificate, not just the IPv6 part. The IP flow's `acme.sh --issue` call (`x-ui.sh:1687-1694`) does not pass `$(acme_listen_flag)`, unlike the domain flows (`install.sh:456`, `install.sh:756`). Whether acme.sh's standalone listener answers on IPv6 in that case depends on acme.sh/socat behaviour I did not check here. Anyone adding auto-inclusion should test it on a dual-stack host. Until this exists, you can paste the address at the existing prompt. `ip -6 addr show scope global` lists the server's global IPv6 addresses. Related, but a different request: #4948 (IPv6 addresses in subscriptions when the certificate only covers IPv4). Verdict: Feature request *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@HamedSanaei commented on GitHub (Oct 27, 2026):

I've implemented automatic IPv6 detection for IP-based SSL certificate issuance.

The implementation detects eligible IPv6 addresses, allows the user to confirm or skip the detected address, and retains manual entry when needed.

It also preserves the existing IPv4 certificate flow and non-interactive installation behavior.

I included validation and regression tests covering IPv6 discovery, address selection, and ACME certificate issuance scenarios.

PR: https://github.com/MHSanaei/3x-ui/pull/6971

Feedback and testing on dual-stack servers are welcome.

<!-- gh-comment-id:6432210928 --> @HamedSanaei commented on GitHub (Oct 27, 2026): I've implemented automatic IPv6 detection for IP-based SSL certificate issuance. The implementation detects eligible IPv6 addresses, allows the user to confirm or skip the detected address, and retains manual entry when needed. It also preserves the existing IPv4 certificate flow and non-interactive installation behavior. I included validation and regression tests covering IPv6 discovery, address selection, and ACME certificate issuance scenarios. PR: https://github.com/MHSanaei/3x-ui/pull/6971 Feedback and testing on dual-stack servers are welcome.
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#4571
No description provided.