mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6194] [MERGED] fix(nodes): apply a rotated master mTLS certificate without restarting the panel #6158
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6158
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6194
Author: @n0ctal
Created: 8/10/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @MHSanaei
Base:
main← Head:upstream-mtls-invalidate-pooled-clients📝 Commits (2)
89e82e4fix(mtls): invalidate pooled clients after credential rotationb558443fix(mtls): make connection reload read-only📊 Changes
24 files changed (+747 additions, -101 deletions)
View changed files
📝
docs/content/docs/en/reference/api/nodes.mdx(+56 -88)📝
docs/public/openapi.json(+30 -0)📝
frontend/public/openapi.json(+30 -0)📝
frontend/src/pages/api-docs/endpoints.ts(+5 -0)📝
internal/web/controller/node.go(+11 -0)📝
internal/web/runtime/tls_client.go(+131 -0)📝
internal/web/runtime/tls_client_test.go(+233 -0)➕
internal/web/runtime/tls_client_wire_test.go(+162 -0)📝
internal/web/service/node_mtls.go(+18 -0)📝
internal/web/service/node_mtls_test.go(+26 -0)📝
internal/web/service/setting_mtls.go(+19 -0)📝
internal/web/translation/ar-EG.json(+2 -1)📝
internal/web/translation/en-US.json(+2 -1)📝
internal/web/translation/es-ES.json(+2 -1)📝
internal/web/translation/fa-IR.json(+2 -1)📝
internal/web/translation/id-ID.json(+2 -1)📝
internal/web/translation/ja-JP.json(+2 -1)📝
internal/web/translation/pt-BR.json(+2 -1)📝
internal/web/translation/ru-RU.json(+2 -1)📝
internal/web/translation/tr-TR.json(+2 -1)...and 4 more files
📄 Description
Summary
Make the panel's outbound mTLS client transports observe a credential generation, so a rotated master certificate takes effect on the next request instead of after a panel restart. Adds
POST /panel/api/nodes/mtls/reloadClientto trigger it.Why
The panel caches an mTLS transport per node. When the master client certificate changes — first issuance, or an operator rotating the stored credential — cached transports keep their old TLS config and keep reusing pooled keep-alive connections authenticated with the previous leaf. The new certificate only takes effect once the process restarts.
That forces a panel restart into any credential rotation. On an installation where the panel supervises Xray, restarting the panel interrupts the data plane for something that is purely a control-plane change.
Scope
POST /panel/api/nodes/mtls/reloadClientverifies the current credential pair is readable, then invalidates. This covers rotation performed directly against settings, not only first issuance.TestRouteRegistryContractrun and fixed.Validation
go test ./...green;go test -race ./internal/web/runtimegreen; targeted controller/service/runtime tests green.Not proven: the endpoint has not been exercised through a fully started panel against a real remote node. That remains an integration check rather than a unit one.
Risk
Low. With no rotation the generation never advances and behaviour is unchanged. The endpoint only invalidates a cache; it does not mint, replace or delete any credential.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.