mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
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#4246
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 @rokokol on GitHub (Aug 18, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6256
Describe the bug
#5350fixed the ban half: the generated3x-iplaction now covers UDP as well as TCP, which I can confirm on 3.6.0. The other half is still TCP-only.When a client exceeds its IP limit,
CheckClientIpJob.disconnectClientTemporarilyremoves and re-adds the user through the Xray API so established sessions drop immediately. That path is guarded by:hysteriafalls intodefault, so a Hysteria2 client over its limit keeps its current QUIC session until the fail2ban rule times it out, instead of being dropped at once. On a link with a long idle timeout that is a noticeable window, and it differs from what the same limit does to a VLESS client.How to reproduce the problem
Limit IP = 1./var/log/x-ui/3xui.logrecords the violation, fail2ban bans IP B.Expected behavior
Either the Xray API user removal covers
hysteriatoo, or the limitation is stated in the docs next toLimit IP, so the difference between protocols is not discovered in production.Actual behavior
The disconnect is skipped and only the warning above is logged.
3x-ui version
3.6.0
Xray-core version
26.7.28
How did you install 3x-ui?
Install script
Operating system
Ubuntu 24.04
@github-actions[bot] commented on GitHub (Aug 18, 2026):
Confirmed on
main. The guard you quoted is still present and is the cause; this is a separate defect from #5350 (which changed the generated Fail2ban action), so this issue stays open rather than being closed as a duplicate.Title: IP-limit force-disconnect skips Hysteria2 (and WireGuard) because
disconnectClientTemporarilyuses a stale protocol allowlistSeverity: Medium
Category: Correctness
Why this matters: on a Hysteria2 inbound the panel falls back to Fail2ban alone, while
vmess/vless/trojan/shadowsocksinbounds get both the ban and an immediate teardown through the Xray API. Enforcement of the sameLimit IPvalue therefore differs by protocol, and the difference is only visible in a warning line in the log.What I found:
internal/web/job/check_client_ip_job.go:637-645— the allowlist, introduced with the comment "Only perform remove/re-add for protocols supported by XrayAPI.AddUser".buildUserAccountininternal/xray/api.go:533has a realcase "hysteria"at line 614 returninghysteriaAccount.Account{Auth: ...}, and acase "wireguard"at line 622. So the job's list is narrower than whatXrayAPI.AddUseractually supports, andwireguardis skipped for the same reason.internal/web/runtime/local.go:115gatesAddUseronly on MTProto, andAddClientat line 132 passesauthin the user map, so ordinary client add/edit on a Hysteria2 inbound already goes throughAlterInbound.clientConfigby marshalingmodel.Clientatinternal/web/job/check_client_ip_job.go:627, andAuthcarries the JSON tagauth(internal/database/model/model.go:879), so the map already contains the fieldbuildUserAccountrequires forhysteria— no extra plumbing like the shadowsockscipherpatch at lines 649-658.buildUserAccountreturns(nil, nil)for anything it does not know, andAddUserreturns early atinternal/xray/api.go:678-680.Recommendation for @MHSanaei:
One caveat, and the reason the second half of your "Expected behavior" may still apply: whether xray-core's Hysteria2 inbound tears down an in-flight QUIC session on
RemoveUser, or only refuses new authentications, is core-side behaviour I could not verify from this repository. If it is the latter, the documented-limitation route is the accurate outcome. Either way the docs are currently silent on it —docs/content/docs/en/config/clients.mdx:20listsLimit IPas applying to "all" protocols and mentions only Fail2ban enforcement, with no note about the immediate-disconnect path or its protocol scope.Confidence: High that the allowlist at line 640 is what skips the disconnect for
hysteria, and thatAddUsersupports the protocol. Medium that widening the allowlist alone produces an immediate drop of the established session, for the core-side reason above.This reply was generated automatically. A maintainer may follow up.