feat: add Minecraft proxy and refresh dependencies
This commit is contained in:
parent
a4d0880a0a
commit
cfaad47948
47 changed files with 2671 additions and 1005 deletions
95
docs/minecraft-java.md
Normal file
95
docs/minecraft-java.md
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# Rampart перед Minecraft Java
|
||||
|
||||
Rampart can proxy Minecraft Java Edition over TCP. It checks the bounded Java
|
||||
handshake, forwards the original bytes unchanged, and then tunnels the
|
||||
connection to one Paper backend. This is an early integration: it does not
|
||||
replace an upstream DDoS scrubbing network.
|
||||
|
||||
## Build and configure
|
||||
|
||||
Build the edge binary with the Minecraft handler:
|
||||
|
||||
```sh
|
||||
cargo build --release --features protocol-minecraft --bin rampart
|
||||
```
|
||||
|
||||
Use one backend per edge node. For a Paper server on the same host, the sample
|
||||
uses port `25566`; change it to the address reachable over your private network
|
||||
or WireGuard tunnel.
|
||||
|
||||
```toml
|
||||
whitelist = ["127.0.0.1", "::1"]
|
||||
|
||||
[bind]
|
||||
address = "0.0.0.0"
|
||||
port = 25565
|
||||
|
||||
[backend]
|
||||
upstreams = ["10.20.0.5:25566"]
|
||||
|
||||
[protocol.minecraft]
|
||||
enabled = true
|
||||
max_frame_bytes = 8192
|
||||
timeout_secs = 5
|
||||
send_proxy_protocol = true
|
||||
|
||||
[pow]
|
||||
enabled = false
|
||||
```
|
||||
|
||||
PoW must stay disabled for Minecraft Java: the current PoW exchange is plain
|
||||
text and is not part of the Minecraft protocol. Configure the edge firewall to
|
||||
allow public TCP `25565`, and keep Prometheus `9090` and the Paper backend port
|
||||
private.
|
||||
|
||||
## Preserve player IPs safely
|
||||
|
||||
When `send_proxy_protocol` is enabled, Rampart prepends a PROXY protocol v2 header
|
||||
before the Minecraft handshake. On Paper, enable `proxies.proxy-protocol` in
|
||||
`config/paper-global.yml`. Paper documents this option for HAProxy or similar
|
||||
proxies: [global configuration](https://docs.papermc.io/paper/reference/global-configuration/).
|
||||
|
||||
The PROXY header is not authenticated. Put the edge-to-Paper connection on a
|
||||
private network or WireGuard and firewall Paper's backend port to accept only
|
||||
the trusted edge IPs. Never expose a PROXY-enabled Paper port to arbitrary
|
||||
clients: they could forge the address in the header.
|
||||
|
||||
If Rampart runs in Docker, the container needs access to the configured backend
|
||||
address. The included sample image builds `protocol-minecraft`; the sample
|
||||
config keeps PROXY protocol disabled until Paper and the backend firewall are
|
||||
configured together.
|
||||
|
||||
## DDoS boundary
|
||||
|
||||
Rampart can reject connections and apply local rate limits after packets reach
|
||||
the edge host. It cannot keep a home uplink available when an attack saturates
|
||||
that link. Put a Minecraft-aware DDoS proxy or a provider with game DDoS
|
||||
filtering in front of the VDS, hide the home's public address, and carry
|
||||
accepted traffic to the home server through a restricted tunnel. Two ordinary
|
||||
VDS instances without upstream filtering do not provide that protection.
|
||||
|
||||
For a DDoS provider that sends PROXY protocol v2, enable inbound parsing only
|
||||
for that provider's TCP source ranges:
|
||||
|
||||
```toml
|
||||
[proxy_protocol]
|
||||
ingress_enabled = true
|
||||
# Replace these documentation ranges with the provider's actual ranges.
|
||||
trusted_cidrs = ["198.51.100.0/24", "2001:db8:1234::/48"]
|
||||
ingress_timeout_ms = 750
|
||||
max_header_bytes = 512
|
||||
```
|
||||
|
||||
Rampart rejects connections from unlisted peers when ingress mode is enabled,
|
||||
and it applies per-IP limits and bans using the verified header source address.
|
||||
Keep the allowlist current with the provider's published ranges. The header is
|
||||
not cryptographically authenticated, so never trust arbitrary internet peers.
|
||||
This MVP accepts PROXY v2 TCP4/TCP6 address headers without TLVs; confirm that
|
||||
format with the provider before enabling ingress mode.
|
||||
XDP operates on the network peer address and is not used to ban the claimed
|
||||
player address on this path.
|
||||
|
||||
The Minecraft handler supports status and login handshake states and forwards
|
||||
the connection as a TCP tunnel. It does not inspect encrypted login/game
|
||||
packets or implement Velocity forwarding. Bedrock Edition uses UDP and is not
|
||||
supported by this handler.
|
||||
Loading…
Add table
Add a link
Reference in a new issue