[GH-ISSUE #6318] [Feature]: No easy way to change Listen IP address in tui menu with SSH Port Forwarding Management after SSL cert set. #4293

Open
opened 2026-10-31 20:38:36 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @thadguidry on GitHub (Aug 25, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6318

Describe the bug

I expected to be able to change listen ip address at anytime for the node during initial setup, since I have a node with multiple CPUs and multiple NICs with lots of IPs available.

It would be nice to have an easier way to set the listen ip address during setup and after in the tui menu directly. I saw that it was available under the SSH Port Forwarding Management, but after you setup the SSL, then going back to that menu item for SSH Port Forwarding Management will no longer show sub-menu options, but instead says:

Panel is secure with SSL.

Panel state: Not Running
Start automatically: Yes
xray state: Not Running

Please enter your selection [0-28]: 24
Panel is secure with SSL.

How to reproduce the problem

  1. Set SSL cert using menu options.
  2. Choose SSH Port Forwarding Management
  3. Notice that sub-menu is no longer available, but instead just says: Panel is secure with SSL.

Expected behavior

There is always the ability to have the sub-menu for SSH Port Forwarding Management -> Change Listen IP

Actual behavior

Instead, the panel sub-menu shows "Panel is secure with SSL".
So, I had to change the listen address via a SQL script:

sudo sqlite3 /etc/x-ui/x-ui.db "UPDATE settings SET value = '127.0.0.1' WHERE key = 'webListen';"

Relevant logs


Screenshots

No response

3x-ui version

3.7.0

Xray-core version

26.7.28

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24.04 LTS

Which parts of the panel are affected?

Xray config generation

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

Yes — Cloudflare (proxied DNS)

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 @thadguidry on GitHub (Aug 25, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6318 ### Describe the bug I expected to be able to change listen ip address at anytime for the node during initial setup, since I have a node with multiple CPUs and multiple NICs with lots of IPs available. It would be nice to have an easier way to set the listen ip address during setup and after in the tui menu directly. I saw that it was available under the SSH Port Forwarding Management, but after you setup the SSL, then going back to that menu item for SSH Port Forwarding Management will no longer show sub-menu options, but instead says: > Panel is secure with SSL. ``` Panel state: Not Running Start automatically: Yes xray state: Not Running Please enter your selection [0-28]: 24 Panel is secure with SSL. ``` ### How to reproduce the problem 1. Set SSL cert using menu options. 2. Choose SSH Port Forwarding Management 3. Notice that sub-menu is no longer available, but instead just says: Panel is secure with SSL. ### Expected behavior There is always the ability to have the sub-menu for SSH Port Forwarding Management -> Change Listen IP ### Actual behavior Instead, the panel sub-menu shows "Panel is secure with SSL". So, I had to change the listen address via a SQL script: ```bash sudo sqlite3 /etc/x-ui/x-ui.db "UPDATE settings SET value = '127.0.0.1' WHERE key = 'webListen';" ``` ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.7.0 ### Xray-core version 26.7.28 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24.04 LTS ### Which parts of the panel are affected? Xray config generation ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? Yes — Cloudflare (proxied DNS) ### 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).
Author
Owner

@github-actions[bot] commented on GitHub (Aug 25, 2026):

Your observation is correct and it is deliberate in the script, not a malfunction: menu item 24 is written as an alternative to having a certificate, so as soon as both webCertFile and webKeyFile are set it prints that message and bounces you back to the main menu. What is genuinely missing is a place to change the panel's Listen IP that is independent of SSL — so I have re-classified this as an enhancement request rather than a bug, and below are the two supported ways to do it today (neither needs sqlite3).

What the code actually does

x-ui.sh, SSH_port_forwarding() — the gate is the first thing after the settings are read:

# x-ui.sh:2619-2622
if [[ -n "$existing_cert" && -n "$existing_key" ]]; then
    echo -e "${green}Panel is secure with SSL.${plain}"
    before_show_menu
fi

The design intent is visible in the branch immediately below it (x-ui.sh:2623-2626), which is the mirror image:

if [[ -z "$existing_cert" && -z "$existing_key" && (-z "$existing_listenIP" || "$existing_listenIP" == "0.0.0.0") ]]; then
    echo -e "\n${red}Warning: No Cert and Key found! The panel is not secure.${plain}"
    echo "Please obtain a certificate or set up SSH port forwarding."
fi

Certificate or SSH tunnel — the menu treats them as mutually exclusive, so it hides 1. Set listen IP / 2. Clear listen IP (x-ui.sh:2639-2640) once you have a cert. That has been the behaviour since the feature was added in 937bfb4c ("SSH Port Forwarding (#2590)", Oct 2024), and it is unchanged on v3.7.0 and on the default branch.

Changing the Listen IP today

1. CLI — works regardless of SSL, no menu involved:

x-ui setting -listenIP 127.0.0.1
x-ui restart

Check it, and revert it, with:

x-ui setting -getListen true
x-ui setting -listenIP 0.0.0.0
x-ui restart

This is the exact call the hidden menu option makes (x-ui.sh:2655 and x-ui.sh:2671), and it lands on the same webListen setting your UPDATE statement wrote (main.go:409-416 → SettingService.SetListen → internal/web/service/setting.go:439-441).

2. Web panel: Panel Settings → General → Listen IP (frontend/src/pages/settings/GeneralTab.tsx:187-193; the field description reads "The IP address for the web panel. (leave blank to listen on all IPs)"), then the Restart Panel button on the same page. Given your setup, note that saving 127.0.0.1 here will cut off your own browser session the moment the panel restarts, unless you are already reaching it through a local reverse proxy — which is presumably why you went to the database in the first place.

One caveat on reverting: the panel builds its bind address with net.JoinHostPort(listen, port) (internal/web/web.go:572), so an empty webListen binds all interfaces including IPv6, while the literal 0.0.0.0 that the menu/CLI writes binds IPv4 only. The CLI cannot write the empty value back — main.go:409 is if listenIP != "", so -listenIP "" is silently skipped. To get a truly blank value, clear the field in the web panel.

Two things in that same block worth looking at

For whoever picks this up, there are two concrete defects next to the gate, independent of the feature request:

  1. before_show_menu at x-ui.sh:2621 is not followed by return. before_show_menu() (x-ui.sh:126-129) calls show_menu, and show_menu's fallback branch is just LOGE "Please enter the correct number [0-28]" (x-ui.sh:3537-3539) — LOGE only echoes (x-ui.sh:14-16). So selecting 24 with a cert set, pressing Enter, then typing an invalid number at the main menu unwinds back into SSH_port_forwarding at line 2623 and prints the very submenu the gate just refused.
  2. The gate also blocks recovery. Someone who sets listenIP to 127.0.0.1 first and obtains a certificate afterwards has no menu path to 2. Clear listen IP (x-ui.sh:2670-2673) — and if the panel is bound to loopback the web UI is not reachable either, leaving the CLI as the only way out.

Also worth noting: the docs describe item 24 as "Bind the panel to localhost and tunnel over SSH" (docs/content/docs/en/guide/update-uninstall.mdx:40) with no mention of the SSL gate, so the behaviour is undocumented as well as unexpected.

I changed the title prefix from [Bug]: to [Feature]: to match the classification; the old title was "[Bug]: No easy way to change Listen IP address in tui menu with SSH Port Forwarding Management after SSL cert set." and the rest of your wording is untouched.

Related: #3933 asked the mirror-image question ("how do I switch from SSL Certificate Management to SSH Port Forwarding Management?") and hits the same gate, but it was a question and is already closed, so this issue stays open on its own.

Verdict: Feature request

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

<!-- gh-comment-id:5408948177 --> @github-actions[bot] commented on GitHub (Aug 25, 2026): Your observation is correct and it is deliberate in the script, not a malfunction: menu item 24 is written as an *alternative* to having a certificate, so as soon as both `webCertFile` and `webKeyFile` are set it prints that message and bounces you back to the main menu. What is genuinely missing is a place to change the panel's Listen IP that is independent of SSL — so I have re-classified this as an enhancement request rather than a bug, and below are the two supported ways to do it today (neither needs `sqlite3`). ## What the code actually does `x-ui.sh`, `SSH_port_forwarding()` — the gate is the first thing after the settings are read: ```bash # x-ui.sh:2619-2622 if [[ -n "$existing_cert" && -n "$existing_key" ]]; then echo -e "${green}Panel is secure with SSL.${plain}" before_show_menu fi ``` The design intent is visible in the branch immediately below it (`x-ui.sh:2623-2626`), which is the mirror image: ```bash if [[ -z "$existing_cert" && -z "$existing_key" && (-z "$existing_listenIP" || "$existing_listenIP" == "0.0.0.0") ]]; then echo -e "\n${red}Warning: No Cert and Key found! The panel is not secure.${plain}" echo "Please obtain a certificate or set up SSH port forwarding." fi ``` Certificate *or* SSH tunnel — the menu treats them as mutually exclusive, so it hides `1. Set listen IP` / `2. Clear listen IP` (`x-ui.sh:2639-2640`) once you have a cert. That has been the behaviour since the feature was added in `937bfb4c` ("SSH Port Forwarding (#2590)", Oct 2024), and it is unchanged on `v3.7.0` and on the default branch. ## Changing the Listen IP today **1. CLI — works regardless of SSL, no menu involved:** ```bash x-ui setting -listenIP 127.0.0.1 x-ui restart ``` Check it, and revert it, with: ```bash x-ui setting -getListen true x-ui setting -listenIP 0.0.0.0 x-ui restart ``` This is the exact call the hidden menu option makes (`x-ui.sh:2655` and `x-ui.sh:2671`), and it lands on the same `webListen` setting your `UPDATE` statement wrote (`main.go:409-416` → `SettingService.SetListen` → `internal/web/service/setting.go:439-441`). **2. Web panel:** Panel Settings → General → **Listen IP** (`frontend/src/pages/settings/GeneralTab.tsx:187-193`; the field description reads "The IP address for the web panel. (leave blank to listen on all IPs)"), then the **Restart Panel** button on the same page. Given your setup, note that saving `127.0.0.1` here will cut off your own browser session the moment the panel restarts, unless you are already reaching it through a local reverse proxy — which is presumably why you went to the database in the first place. One caveat on reverting: the panel builds its bind address with `net.JoinHostPort(listen, port)` (`internal/web/web.go:572`), so an empty `webListen` binds all interfaces including IPv6, while the literal `0.0.0.0` that the menu/CLI writes binds IPv4 only. The CLI cannot write the empty value back — `main.go:409` is `if listenIP != ""`, so `-listenIP ""` is silently skipped. To get a truly blank value, clear the field in the web panel. ## Two things in that same block worth looking at For whoever picks this up, there are two concrete defects next to the gate, independent of the feature request: 1. **`before_show_menu` at `x-ui.sh:2621` is not followed by `return`.** `before_show_menu()` (`x-ui.sh:126-129`) calls `show_menu`, and `show_menu`'s fallback branch is just `LOGE "Please enter the correct number [0-28]"` (`x-ui.sh:3537-3539`) — `LOGE` only echoes (`x-ui.sh:14-16`). So selecting 24 with a cert set, pressing Enter, then typing an invalid number at the main menu unwinds back into `SSH_port_forwarding` at line 2623 and prints the very submenu the gate just refused. 2. **The gate also blocks recovery.** Someone who sets `listenIP` to `127.0.0.1` first and obtains a certificate afterwards has no menu path to `2. Clear listen IP` (`x-ui.sh:2670-2673`) — and if the panel is bound to loopback the web UI is not reachable either, leaving the CLI as the only way out. Also worth noting: the docs describe item 24 as "Bind the panel to localhost and tunnel over SSH" (`docs/content/docs/en/guide/update-uninstall.mdx:40`) with no mention of the SSL gate, so the behaviour is undocumented as well as unexpected. I changed the title prefix from `[Bug]:` to `[Feature]:` to match the classification; the old title was "[Bug]: No easy way to change Listen IP address in tui menu with SSH Port Forwarding Management after SSL cert set." and the rest of your wording is untouched. Related: #3933 asked the mirror-image question ("how do I switch from SSL Certificate Management to SSH Port Forwarding Management?") and hits the same gate, but it was a question and is already closed, so this issue stays open on its own. Verdict: Feature request *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4293
No description provided.