Initial commit: Rampart v0.2.0

Multi-layer DDoS protection for Minecraft servers.

- rampart-core: Edge node with XDP/eBPF + Rust L7 filtering
- rampart-manager: REST API with JWT auth, Redis sync
- rampart-cli: CLI tool for operators
- velocity-plugin: Domain check, HMAC verify, server registry, load balancer
- paper-plugin: Auto-registration, heartbeat, HMAC verify
- dashboard: React + Vite web UI for management
This commit is contained in:
loki5512344 2026-07-20 20:53:32 +02:00
commit cf9608ce5d
Signed by: boba
GPG key ID: 253067914055423B
159 changed files with 15341 additions and 0 deletions

35
deploy/config/edge.toml Normal file
View file

@ -0,0 +1,35 @@
[bind]
address = "0.0.0.0"
port = 25565
[backend]
address = "velocity"
port = 25577
[hmac]
secret = "test_secret_32_bytes_long_for_integration_test"
[workers]
count = 2
[limits]
handshake_timeout_secs = 5
max_connections_per_ip = 10
rate_limit_status_pps = 2
rate_limit_login_pps = 5
rate_limit_burst = 10
[store]
redis_url = "redis://redis:6379/0"
blacklist_cache_ttl_secs = 300
[logging]
level = "debug"
format = "text"
[metrics]
enabled = true
port = 9090
[xdp]
enabled = false

View file

@ -0,0 +1,2 @@
velocity:
enabled: false

View file

@ -0,0 +1,7 @@
server-port=25566
online-mode=false
motd=Rampart Test Server
max-players=20
spawn-protection=0
difficulty=peaceful
gamemode=creative

View file

@ -0,0 +1,12 @@
bind = "0.0.0.0:25577"
motd = "Rampart Test"
online-mode = false
show-max-players = 100
player-info-forwarding-mode = "NONE"
try-compressions-on-connect = false
[servers]
paper = "paper:25566"
[forced-hosts]
"play.example.com" = "paper"

48
deploy/docker-compose.yml Normal file
View file

@ -0,0 +1,48 @@
services:
redis:
image: redis:7-alpine
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 1s
retries: 5
edge:
build:
context: ..
dockerfile: deploy/docker/Dockerfile.edge
ports:
- "25565:25565"
environment:
RAMPART_CONFIG: /etc/rampart/config.toml
volumes:
- ./config/edge.toml:/etc/rampart/config.toml:ro
depends_on:
redis:
condition: service_healthy
velocity:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.velocity
environment:
RAMPART_HMAC_SECRET: test_secret_32_bytes_long_for_integration_test
RAMPART_ALLOWED_DOMAINS: play.example.com
ports:
- "25577:25577"
depends_on:
- paper
paper:
build:
context: ../..
dockerfile: deploy/docker/Dockerfile.paper
environment:
EULA: "true"
RAMPART_HMAC_SECRET: test_secret_32_bytes_long_for_integration_test
RAMPART_ALLOWED_DOMAINS: play.example.com
ports:
- "25566:25566"
depends_on:
- redis

View file

@ -0,0 +1,20 @@
FROM rust:1.84-slim-bookworm AS builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY Cargo.toml Cargo.lock rustfmt.toml ./
COPY crates/ ./crates/
RUN cargo build --release --bin rampart-core && \
cp target/release/rampart-core /app/rampart-core && \
strip /app/rampart-core
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/rampart-core /usr/local/bin/rampart-core
EXPOSE 25565 9090
ENTRYPOINT ["rampart-core"]

View file

@ -0,0 +1,22 @@
FROM eclipse-temurin:21-jre-bookworm
ARG PAPER_VERSION=1.21.4
ARG PAPER_BUILD=latest
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# Download Paper
RUN curl -fsSLo /opt/paper.jar \
"https://api.papermc.io/v2/projects/paper/versions/${PAPER_VERSION}/builds/${PAPER_BUILD}/downloads/paper-${PAPER_VERSION}-${PAPER_BUILD}.jar" || \
echo "Falling back to direct download..." && \
curl -fsSLo /opt/paper.jar \
"https://papermc.io/api/v2/projects/paper/versions/${PAPER_VERSION}/builds/${PAPER_BUILD}/downloads/paper-${PAPER_VERSION}-${PAPER_BUILD}.jar"
COPY deploy/config/server.properties /opt/server.properties
COPY deploy/config/paper-global.yml /opt/paper-global.yml
COPY plugins/paper/build/libs/rampart-paper-*.jar /opt/plugins/
EXPOSE 25566
WORKDIR /opt
CMD ["java", "-jar", "/opt/paper.jar", "--nogui"]

View file

@ -0,0 +1,20 @@
FROM eclipse-temurin:21-jre-bookworm
ARG VELOCITY_VERSION=3.4.0-SNAPSHOT
ARG VELOCITY_BUILD=latest
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# Download Velocity
RUN curl -fsSLo /opt/velocity.jar \
"https://api.papermc.io/v2/projects/velocity/versions/${VELOCITY_VERSION}/builds/${VELOCITY_BUILD}/downloads/velocity-${VELOCITY_VERSION}-${VELOCITY_BUILD}.jar" || \
curl -fsSLo /opt/velocity.jar \
"https://versions.velocitypowered.com/download/${VELOCITY_VERSION}.jar"
COPY deploy/config/velocity.toml /opt/velocity.toml
COPY plugins/velocity/build/libs/rampart-velocity-*.jar /opt/plugins/
EXPOSE 25577
WORKDIR /opt
CMD ["java", "-jar", "/opt/velocity.jar", "/opt/velocity.toml"]