[Bug] Source IP dependent handshake failure #182
Replies: 5 comments 10 replies
|
Thanks, we are looking into this. |
|
I've got some players who can get in to the server and others who can't after Gone back to not using sv_listingHostOverride for now |
|
Some findings from attempting a TLS-terminating same-host reverse proxy (a single nginx in front of the game port, so
To be clear, we're not asking to support MITM-style proxying of the connect flow — the address binding looks intentional and reasonable. Leaving this here so the constraints are documented for others attempting proxy setups, and because of point 3. |
|
A fix for this bug has been implemented and is available in the latest patch b96/97. Please try again and let us know if the issue persists. Thanks for your help! |
|
I can confirm also still having issues on this with b106 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
The server closes the websocket for the
GET /handshakerequest if the HTTP reverse proxy defined in sv_listingHostOverride does not forward traffic to the backend server from the same IP as the HTTP connect endpoint. There seems to be overly strict source IP verification between the two stages of the websocket handshake which breaks various configurations.I assume this might cause problems even without sv_listingHostOverride if the source IP of a connecting player does not remain constant between TCP connections (e.g. ISPs that use CGNAT, Starlink, mobile data connections) - unconfirmed.
Example configuration using placeholder IPs and domains:
In this example, the FiveM server is hosted at 10.0.0.1 and the reverse proxy server is hosted at 10.0.0.0. The intention is that the FiveM client will connect to 10.0.0.0:443 as the HTTP connect endpoint, and TCP traffic destined for 10.0.0.0:30120 will be forwarded to the FiveM server at 10.0.0.1:30120 without the use of an HTTP reverse proxy on port 30120.
When connecting through the server list, the client sends a GET /challenge HTTPS request to 10.0.0.0:443 (TCP). This is forwarded to the FiveM server at 10.0.0.1:30120 (TCP) along with an X-Real-IP and X-Forwarded-For header containing the IP address of the HTTP client (player). All headers from the original request are forwarded to the backend.
After this, the client then sends the GET /handshake request to 10.0.0.0:30120, which is routed directly to 10.0.0.1 without the use of an HTTP reverse proxy.
The second request (GET /handshake) which is sent to TCP port 30120 will succeed only if the GET /challenge request and the GET /handshake request are forwarded to 10.0.0.1 from the same source IP, for example 10.0.0.5. If there is a load balancer or other system in place which may forward either the initial GET /handshake request or any subsequent TCP connections to port 30120 from different source/forwarding IPs, the handshake will fail with the following error:
If the HTTP requests sent to https://fivem.yourdomain.com and the subsequent TCP connection to 10.0.0.0:30120 are forwarded to 10.0.0.1:30120 from a different IP within the 10.0.0.0/24 range which was set in sv_listingHostOverride, the handshake will fail.
If everything is forwarded to 10.0.0.1:30120 from a fixed source such as 10.0.0.5, the handshake then succeeds.
See also #183 which may be a secondary issue that the client reaches if all traffic is forwarded from the same IP.
Issue type
Both / Unsure
Repro rate
Always
Server build version
FXServer-early-access b94 win32
OS
No response
CPU
No response
GPU
No response
RAM
No response
Storage type
None
Connection type
None
ISP and bandwidth
No response
DxDiag
No response
Network graph
No response
Platform
None
OS version / distribution
No response
CPU
No response
RAM
No response
Using txAdmin?
Yes
Hosting provider
None
Machine type
None
/perf endpoint output
No response
DDoS protection
No response
ulimit -n value (Linux only)
No response
Docker Compose file (Docker only)
No response
Steps to Reproduce
Expected Behavior
The connection should succeed if any of the following conditions are met in combination with an HTTP reverse proxy on https://fivem.yourdomain.com
To support various routing configurations, the FiveM server should accept the
GET /handshakerequest on the basis that the source IP of theGET /handshakerequest is the same as the IP which was present in the X-Forwarded-For / X-Real-IP HTTP request headers in theGET /challengerequest tohttps://fivem.yourdomain.comfrom sv_listingHostOverride.To support a transparent TCP proxy, the FiveM server should accept the
GET /handshakerequest if the source IP of the request is present in sv_proxyIPRanges.Actual Behavior
The client fails to connect to the server.
Evidence
No response
Additional Context
No response
All reactions