feat(gateway): TLS auto + rate limit + IP allowlist su write endpoint

Configura il gateway Caddy per il deploy su cerbero-mcp.tielogic.xyz:

- Build custom Caddy con plugin mholt/caddy-ratelimit (Dockerfile +
  build via xcaddy).
- TLS automatico via Let's Encrypt (richiede DNS A record + porte
  80/443 raggiungibili), HSTS preload, header di sicurezza.
- Rate limit per IP (60 req/min sui read, 10 req/min sui write,
  sliding window).
- Allowlist IP sui write endpoint (place_*, cancel_*, set_*, close_*,
  transfer_*, amend_*, switch_*): IP non in WRITE_ALLOWLIST → 403.
- Default WRITE_ALLOWLIST copre loopback + Docker bridge: bot sulla
  stessa macchina (host o container) funziona senza configurazione,
  IP pubblici esterni vanno aggiunti esplicitamente.
- Smoke test e README aggiornati per il nuovo URL gateway.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
AdrianoDev
2026-04-27 23:24:06 +02:00
parent c2fd8330ca
commit 867180f4bf
6 changed files with 114 additions and 11 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ Il file `run.sh` verifica:
- sentiment `get_funding_rates BTC`
Variabili di ambiente:
- `GATEWAY` — URL base gateway (default `http://localhost:8080`)
- `GATEWAY` — URL base gateway (default `http://localhost`; in produzione `https://cerbero-mcp.tielogic.xyz`)
- `TOKEN_FILE` — path al token bearer di lettura (default `secrets/observer.token`)
Exit code 0 = tutto OK, 1 = uno o più check falliti.