TCPShield / RealIP

The Spigot, Bungee and Velocity plugin that parses client IP addresses passed from the TCPShield network.
https://tcpshield.com
MIT License
151 stars 53 forks source link

TCPShield alters timestamps? and protocol version of packets #34

Closed Sabinno closed 3 years ago

Sabinno commented 3 years ago

I use a game management panel called AMP by CubeCoders; it is quite popular and is updated regularly.

I tried to use AMP's "sleep" feature (which effectively shuts down the server until a player pings the server, then immediately starts it on the fly) with a server and noticed that I was getting this error:

[23:50:38] [Minecraft:esabin Warning] : Sleep packet timestamp doesn't match! (Expected 1611964238278, got 0) [23:50:38] [Minecraft:esabin Warning] : Unable to get protocol version. Sleep mode will be unavailable.

I started a brand new instance, installed Paper 1.16.5 (latest as of writing), then started the server with sleep mode enabled. Works perfectly. I then installed ProtocolLib (latest as of writing); still works great. Lastly, I installed TCPShield 2.4 (latest as of writing); sleep mode is now broken and produced the error shown above.

Absolutely no configuration was changed from default on the test servers.

I have concluded that TCPShield messes with timestamps of packets or their protocol version in such a non-standard way that they cause problems with other applications. Is there a way to fix this?

JosiahWhite commented 3 years ago

This is likely due to our plugin blocking connections from hosts that did not connect through the TCPShield network and the plugin is trying to find the protocol version by connecting directly. The solution for this would be to identify the source IP address by enabling debug mode on the TCPShield plugin so that it shows blocked connections, and adding the according IP to a new file under the ip-whitelist directory created by this plugin.

Sabinno commented 3 years ago

Whitelisting 127.0.0.1 fixed the issue, as that is where the request originates. Thanks for the heads up!