[PR #6667] [CLOSED] fix: preserve panel TLS during web updates #6401

Closed
opened 2026-11-02 04:08:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6667
Author: @libmur-dev
Created: 9/27/2026
Status: ❌ Closed

Base: main ← Head: fix/tls-update-safety


📝 Commits (3)

  • f22f880 fix: preserve panel TLS during web updates
  • 9b2765a fix(tls): preserve legacy ACME renewal targets
  • fa003aa Merge branch 'main' into fix/tls-update-safety

📊 Changes

6 files changed (+1214 additions, -436 deletions)

View changed files

📝 .github/workflows/ci.yml (+15 -0)
➕ deploy/test/tls-update-safety.sh (+260 -0)
📝 install.sh (+276 -129)
📝 internal/web/service/panel/panel.go (+18 -14)
📝 update.sh (+322 -141)
📝 x-ui.sh (+323 -152)

📄 Description

Summary

  • run web updates explicitly in non-interactive mode and preserve existing panel TLS settings
  • never start ACME merely because webCertFile is empty
  • isolate new panel certificates under /root/cert/panel/... while preserving existing ACME install targets
  • discover both legacy /root/cert/<name> and isolated panel certificates in the SSL menu
  • preserve certificate and ACME state on failures, verify acme.sh, and stage/validate certificate-key pairs before promotion
  • report the TLS scheme and URL that were actually configured
  • apply the same safety rules in update.sh, install.sh, and x-ui.sh

Incident cause

The detached web updater did not mark the update as non-interactive. When read received EOF, the TLS prompt selected its IP-ACME default. That flow reused /root/cert/ip and deleted both certificate files and ACME state on issuance/install failures, so an unrelated service sharing that directory lost its active pair. The update then printed an HTTPS URL even when panel TLS had not been configured.

Upgrade compatibility

For identifiers already tracked by acme.sh, the scripts retain the saved Le_RealFullChainPath/Le_RealKeyPath. If older records lack those fields, an existing tracked legacy pair remains in place. Only new panel certificates use the isolated directory, preventing renewal retargeting for Xray or existing panel installations.

Tests

  • bash -n update.sh install.sh x-ui.sh deploy/test/tls-update-safety.sh
  • bash deploy/test/tls-update-safety.sh
    • non-interactive HTTP and existing-TLS web updates
    • existing pair and ACME-record preservation on issuance failure
    • legacy ACME renewal-target preservation in all three scripts
    • new-certificate isolation and legacy/new SSL-menu discovery

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6667 **Author:** [@libmur-dev](https://github.com/libmur-dev) **Created:** 9/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/tls-update-safety` --- ### 📝 Commits (3) - [`f22f880`](https://github.com/MHSanaei/3x-ui/commit/f22f8809382bbc7cf2217b641b3f406241a7c630) fix: preserve panel TLS during web updates - [`9b2765a`](https://github.com/MHSanaei/3x-ui/commit/9b2765abac0b33ddfc97f3f38d6c429b686f38dc) fix(tls): preserve legacy ACME renewal targets - [`fa003aa`](https://github.com/MHSanaei/3x-ui/commit/fa003aa6ebebbffe2920472f9fdf6e3d3823557a) Merge branch 'main' into fix/tls-update-safety ### 📊 Changes **6 files changed** (+1214 additions, -436 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+15 -0) ➕ `deploy/test/tls-update-safety.sh` (+260 -0) 📝 `install.sh` (+276 -129) 📝 `internal/web/service/panel/panel.go` (+18 -14) 📝 `update.sh` (+322 -141) 📝 `x-ui.sh` (+323 -152) </details> ### 📄 Description ## Summary - run web updates explicitly in non-interactive mode and preserve existing panel TLS settings - never start ACME merely because `webCertFile` is empty - isolate new panel certificates under `/root/cert/panel/...` while preserving existing ACME install targets - discover both legacy `/root/cert/<name>` and isolated panel certificates in the SSL menu - preserve certificate and ACME state on failures, verify `acme.sh`, and stage/validate certificate-key pairs before promotion - report the TLS scheme and URL that were actually configured - apply the same safety rules in `update.sh`, `install.sh`, and `x-ui.sh` ## Incident cause The detached web updater did not mark the update as non-interactive. When `read` received EOF, the TLS prompt selected its IP-ACME default. That flow reused `/root/cert/ip` and deleted both certificate files and ACME state on issuance/install failures, so an unrelated service sharing that directory lost its active pair. The update then printed an HTTPS URL even when panel TLS had not been configured. ## Upgrade compatibility For identifiers already tracked by acme.sh, the scripts retain the saved `Le_RealFullChainPath`/`Le_RealKeyPath`. If older records lack those fields, an existing tracked legacy pair remains in place. Only new panel certificates use the isolated directory, preventing renewal retargeting for Xray or existing panel installations. ## Tests - `bash -n update.sh install.sh x-ui.sh deploy/test/tls-update-safety.sh` - `bash deploy/test/tls-update-safety.sh` - non-interactive HTTP and existing-TLS web updates - existing pair and ACME-record preservation on issuance failure - legacy ACME renewal-target preservation in all three scripts - new-certificate isolation and legacy/new SSL-menu discovery --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:30 +07:00
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#6401
No description provided.