mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6746] [Feature]: Option to update existing MTProto client secrets when the inbound's FakeTLS domain (SNI) changes #4496
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#4496
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?
Originally created by @Ramazik on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6746
Describe the bug
As is known, for clients using the MTProto protocol, the “MTProto secret” value is generated according to a specific formula, where the last part consists precisely of the “FakeTLS domain (SNI)”.
FakeTLS secret is generated as a unified hexadecimal string composed of three sequential parts:
• Prefix (1 byte): The constant magic byte 0xEE.
• Proxy Token (16 bytes): Random cryptographic bytes used for traffic decryption.
• SNI Domain (Variable length): The disguise domain name encoded in UTF-8.
Formula:
Final Secret (MTProto secret) = Hex(0xEE + 16-byte Token + UTF-8 Domain)
However, from the very beginning of the implementation of this protocol in the 3x-ui panel, changing the “FakeTLS domain (SNI)” value in the MTProto protocol’s inbound does not change the “MTProto secret” value for clients. To obtain the new correct value, you have to do this manually for each client by clicking the “Update MTProto secret” button (the circle with an arrow).
How to reproduce the problem
The description is provided above.
Expected behavior
Changing the “FakeTLS domain (SNI)” in the MTProto protocol’s inbound should change the “MTProto secret” values for clients.
Actual behavior
[Bug]: Changing the “FakeTLS domain (SNI)” in the MTProto protocol’s inbound configuration does not change the “MTProto secret” value for clients.
Relevant logs
Screenshots
No response
3x-ui version
3.9.0
Xray-core version
26.9.30
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
MS Edge 154
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Oct 5, 2026):
This is how the panel is designed to work, not a defect: the inbound's FakeTLS domain (SNI) is only the default used when a new client secret is generated, and every client keeps the domain already embedded in its own secret. Updating existing clients automatically when the default changes would be a new feature, so I've relabelled this as an enhancement request and left it open.
Why existing secrets don't change
frontend/src/pages/inbounds/form/protocols/mtproto.tsx:20showspages.inbounds.form.mtprotoFakeTlsDomainHint, which is (internal/web/translation/en-US.json:507):normalizeMtprotoSecret(internal/web/service/inbound.go:1002) callsHealMtprotoClientSecrets(internal/database/model/model.go:724). That function only uses the inbound domain when a client's secret has no domain of its own: The comment onmtprotoSecretDomain(model.go:700-703) gives the reason: "Each mtproto client carries its own domain inside its secret, so healing preserves it instead of forcing every client onto the inbound-level default."TestHealMtprotoClientSecrets(internal/database/model/model_mtproto_test.go:107-114) checks that a client secret forb.comstays unchanged when the inbound default isa.com: "a valid per-client secret must be left untouched".d97bd864("feat(mtproto): adopt dolonet/mtg-multi and make MTProto inbounds multi-client").There's a second reason not to rewrite secrets on their own. The secret is the value in each client's
tg://link, so changing it silently would break every link you've already handed out until clients import the new one.Workaround for now
Do what you're already doing: open each client and click the regenerate button next to MTProto secret. It calls
regenerateMtprotoSecret()(frontend/src/pages/clients/ClientFormModal.tsx:521), which builds a new secret from the inbound's current domain. Then send the new link to that client.What the feature could look like (for the maintainer)
When the inbound's
fakeTlsDomainchanges on save, offer an opt-in "also re-key clients that use the old domain" action. It would rewrite only the domain suffix and keep each secret's 16-byte random middle (mtprotoSecretMiddle,model.go:629), and it should warn that existing links will stop working. Clients that deliberately use a different domain would be left alone.I changed the title to describe this as a request. The old title was: "[Bug]: Changing the “FakeTLS domain (SNI)” in the MTProto protocol’s inbound configuration does not change the “MTProto secret” value for clients."
Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.
@Ramazik commented on GitHub (Oct 28, 2026):
@MHSanaei Hello. Please take note of my comment. Perhaps I don’t understand something, but I believe the AI agent’s reasoning and the change of the request status from [Bug] to [Feature] are incorrect.
There is no compelling argument not to consider this a bug. All subscription settings, when changed, can be viewed by a person on their subscription page, including changes to the MTProto inbound.
There is no compelling argument to worry about any value of the existing tg:// link for the client if the inbound parameters have already been changed, which means the configuration will be different.
There is no compelling argument to manually open the settings panel for each client and click the regeneration button next to the MTProto secret, as this takes a lot of time, especially if there are many clients.
@Ramazik commented on GitHub (Oct 28, 2026):
Please also pay attention to this comment: https://github.com/MHSanaei/3x-ui/pull/6963#issuecomment-6477282031