mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-21 03:25:56 +00:00
feat(relay): complete Phase 13.1 hardening, port pool scaling, and live load testing
This commit is contained in:
1 parent
c743157b97
commit
6e438cfe95
27 files changed
+1320
-222
No files matched your search
@@ -160,7 +160,7 @@ When a realm is hosted behind NAT or CGNAT without direct port exposure, the Pla
|
||||
|
||||
1. The Player Manager sends `allocate_relay`.
|
||||
2. The Host asks its connected outbound tunnel to `coa-relay` (`wss://coa-manager.duckdns.org/relay/v1/host`) for an allocation.
|
||||
3. `coa-relay` binds a dedicated pair of TCP ports from the dynamic game port pool (40000–40050) for `Auth` and `World`, generates a single-use token, and responds to the Host.
|
||||
3. `coa-relay` binds a dedicated pair of TCP ports from the dynamic game port pool (40000–43999) for `Auth` and `World`, binds to the player's source IP, generates a single-use token, and responds to the Host.
|
||||
4. The Host returns `relay_allocated{relay_host, auth_port, world_port, token, expires_at}` to the Player inside the encrypted control channel.
|
||||
5. The Player Manager points the client's `realmlist.wtf` to `relay_host:auth_port`.
|
||||
6. When the client contacts `auth_port`, `coa-relay` dynamically rewrites the `address` field in the `CMD_REALM_LIST` response (opcode `0x10`) to `relay_host:world_port`, seamlessly directing the client to the allocated world tunnel without patching AzerothCore or modifying the database.
|
||||
@@ -240,11 +240,14 @@ for the in-world refusal) instead of logging in with the game: the Manager must
|
||||
| A flood | per-address and per-realm channel limits, a byte budget, lifetimes, frame and request size limits, strict JSON; the Host handles requests one at a time and caps a channel at 60 requests |
|
||||
| Local theft of the player's files | the identity key and passwords are DPAPI-protected on Windows; on other systems only file permissions (stated) |
|
||||
|
||||
## 13. What remains before Relay
|
||||
## 13. Status: Remote Transfer & Game Relay Hardened (Phases 12.1 & 13.1)
|
||||
|
||||
1. **TLS completed**: Public domain `coa-manager.duckdns.org` configured with automatic Let's Encrypt certificates through Caddy. Coordinator connections use `wss://coa-manager.duckdns.org/coord/v1/...` and Registry uses `https://coa-manager.duckdns.org`. Port 80 redirects to 443. The TLS gate passed all 13 checks (see `docs/REGISTRY_DEPLOYMENT.md`).
|
||||
2. **A game route**: Relay or a direct route. Today only an owner-stated address makes `Join` start the game.
|
||||
3. **Moving a portable character onto a realm that is not its home** (import, update, session prepare over the channel): the Host side exists in the engine (Phases 7–9) but the messages to carry an offer and its answers between two Managers are not defined; `needs_transfer` says so.
|
||||
4. **Native login prefill**: the owner's audit run (section 10).
|
||||
5. The Host's realm key into the `SecretStore` (section 8), and a keyring store on Linux/macOS.
|
||||
6. A real login at the character-select screen is not driven by the Manager (by design); the gate set `account.online` the way the worldserver does (see the results).
|
||||
1. **TLS completed**: Public domain `coa-manager.duckdns.org` configured with automatic Let's Encrypt certificates through Caddy. Coordinator connections use `wss://coa-manager.duckdns.org/coord/v1/...`, Registry uses `https://coa-manager.duckdns.org`, and Relay uses `wss://coa-manager.duckdns.org/relay/v1/...`. Port 80 redirects to 443. All 13 TLS gate checks passed.
|
||||
2. **Phase 12.1 Remote Portable Character Transfer**: Completed and verified. Eliminates `needs_transfer`. Supports transactional offer, chunking, schema/hash validation, level projection, and idempotent session arming over the end-to-end encrypted Noise channel. Verified with large bounded payloads up to 4 MiB.
|
||||
3. **Phase 13 / 13.1 Game Relay Hardening**: Completed and deployed.
|
||||
- Dynamic port pool expanded to 4,000 ports (`40000–43999/tcp`), scaling capacity to 2,000 concurrent player sessions.
|
||||
- O(1) Fisher-Yates shuffle acquisition and O(1) release.
|
||||
- Expected source-IP binding on allocations to block port scanning / hijacks.
|
||||
- Dedicated least-privilege PostgreSQL role `coa_relay` with strictly scoped permissions.
|
||||
- Strict allocation lifecycle: immediate Auth reclamation, immediate World disconnect reclamation, active background reapers, and zero port leaks.
|
||||
4. **Native login prefill**: Documented audit in section 10; passwords copied/shown safely via DPAPI without intrusive process injection.
|
||||
@@ -33,14 +33,14 @@ Internet
|
||||
|
|
||||
+--> Coordinator (coa-coordinator:8081, networks coa-ingress + coa-db, no published port)
|
||||
|
|
||||
+--> Game Relay (coa-relay:8082, networks coa-ingress + coa-db, published 40000-40050/tcp)
|
||||
+--> Game Relay (coa-relay:8082, networks coa-ingress + coa-db, published 40000-43999/tcp)
|
||||
```
|
||||
|
||||
Rules:
|
||||
|
||||
- PostgreSQL must never be internet-exposed: no `ports:` entry, only on the `coa-db` internal network, no UFW rule for 5432.
|
||||
- Registry (8080), Coordinator (8081), and Relay control HTTP/WS (8082) have no published host ports; they are reverse-proxied exclusively through Caddy.
|
||||
- Game Relay publishes the dedicated TCP port range `40000:40050/tcp` for relayed WoW client game streams (Auth & World).
|
||||
- Game Relay publishes the dedicated TCP port range `40000:43999/tcp` for relayed WoW client game streams (Auth & World).
|
||||
- No admin dashboards or the Docker API on public interfaces. Caddy's admin API is disabled.
|
||||
|
||||
## Public ports
|
||||
@@ -50,7 +50,7 @@ Rules:
|
||||
| 22 | tcp | SSH, key only |
|
||||
| 80 | tcp | Caddy HTTP (redirects to HTTPS) |
|
||||
| 443 | tcp | Caddy HTTPS / WSS |
|
||||
| 40000-40050 | tcp | Game Relay WoW game traffic (Auth & World) |
|
||||
| 40000-43999 | tcp | Game Relay WoW game traffic (Auth & World) |
|
||||
|
||||
## Filesystem layout
|
||||
|
||||
|
||||
+14
-5
@@ -27,11 +27,20 @@ WoW Client (3.3.5)
|
||||
3. **No General Bearer Tokens**: Relay allocations are requested by the Host on behalf of a specific authenticated PlayerIdentity/session via the control plane. Allocations are bound to `RealmId`, `PlayerId`, have short lifetimes (default 120s before connection), and cannot be used for administrative or control plane operations.
|
||||
4. **Dumb Byte Tunnel**: The Relay never terminates WoW encryption or parses character data. The only packet inspection performed is rewriting the `address` field in the plaintext `CMD_REALM_LIST` response (opcode `0x10`) so the client seamlessly connects to the allocated WORLD port without patching AzerothCore or mutating MySQL `realmlist`.
|
||||
5. **Zero Plaintext Logging**: Relay logs contain only connection identifiers, timestamps, stream IDs, and byte counts. Zero credentials, account names, session keys, or packet contents are logged.
|
||||
6. **Resource Limits & Backpressure**:
|
||||
- Connection limits: max 16 concurrent hosts, max 256 allocations total, max 2 active allocations per player.
|
||||
- Timeouts: 10s challenge timeout, 60s idle timeout, 30s ping/pong keepalive.
|
||||
- Bounded streaming chunks: 16 KiB chunks with backpressure.
|
||||
- Dynamic port pool: 40000–40050/tcp. Unused or closed ports are immediately reclaimed.
|
||||
6. **Capacity Model & Resource Limits (Phase 13.1 Hardened)**:
|
||||
- **Port Pool Range**: `40000–43999/tcp` (4,000 dynamic TCP ports).
|
||||
- **Allocation Complexity**: O(1) acquisition via randomized Fisher-Yates swap/pop and O(1) release with index tracking.
|
||||
- **Capacity Model**: 4,000 available ports support up to 2,000 concurrent player sessions (2 ports per allocation: Auth + World).
|
||||
- **Source IP Binding**: Each allocation binds `expected_client_ip`. Unsolicited connections from unexpected IPs are immediately dropped and ports released.
|
||||
- **Strict Allocation Lifecycle**:
|
||||
- Auth port is released immediately as soon as authentication finishes or fails.
|
||||
- World port is released immediately upon client disconnect or session termination.
|
||||
- All ports belonging to a Host are reclaimed immediately upon Host tunnel drop.
|
||||
- An active 5s background reaper reclaims expired unconsumed allocations (120s timeout).
|
||||
- **Database Access Role**: Relay connects to PostgreSQL using the dedicated least-privilege role `coa_relay` (`USAGE` on public schema, `SELECT` restricted strictly to `(realm_id, public_key, published, advert_version)` on `realms`).
|
||||
- **Framing Limits**: Standard control messages capped at 4 KiB; remote character transfer offers and chunks permitted up to 4 MiB.
|
||||
- **Timeouts & Keepalive**: 10s challenge timeout, 60s idle timeout, 30s ping/pong keepalive.
|
||||
- **Bounded Streaming Chunks**: 16 KiB chunks with backpressure.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ Date configured: 2026-10-06 (UTC)
|
||||
| 22 | tcp | sshd (key only) |
|
||||
| 80 | tcp | Caddy (redirects HTTP to HTTPS on 443) |
|
||||
| 443 | tcp | Caddy (Let's Encrypt TLS: `/registry/*`, `/coord/*`, `/relay/*`) |
|
||||
| 40000-40050 | tcp | Game Relay WoW game traffic (Auth & World) |
|
||||
| 40000-43999 | tcp | Game Relay WoW game traffic (Auth & World) |
|
||||
|
||||
Everything else is closed, including 5432 (Postgres), 8080 (Registry internal), 8081 (Coordinator internal), 8082 (Relay control internal), 3306/3307, 2375/2376 (Docker API), 2019 (Caddy admin; admin API is disabled).
|
||||
|
||||
|
||||
Reference in new issue
Block a user