Reverse proxy, security, and access control¶
Expose Paladio safely behind Caddy, Nginx, or Traefik with WebSocket upgrade support for /api/ws/* and /mcp, enforce production cryptographic keys, manage trip Role-Based Access Control (RBAC), and reset locked-out passwords from the server CLI.
Production security checklist¶
Running Paladio on a LAN or public domain with ENVIRONMENT=production activates strict startup and encryption invariants across backend/app/core/.
- Generate dedicated secrets: Set high-entropy values for
POSTGRES_PASSWORD,JWT_SECRET_KEY(openssl rand -hex 32), andWALLET_ENCRYPTION_KEY(valid 32-byte URL-safe base64 Fernet key generated viaopenssl rand 32 | openssl base64 -A | tr '+/' '-_'). IfJWT_SECRET_KEYorWALLET_ENCRYPTION_KEYis omitted, Paladio auto-generates and persists0600keys in/data/.jwt_secretand/data/.wallet_keywhen the/datavolume is writable, and fails fast inENVIRONMENT=productionif/datais not writable. - Restrict CORS origins & configure public API URL: When exposing Paladio at a public domain behind TLS, set
ALLOWED_ORIGINS=https://paladio.example.comonapiandPALADIO_PUBLIC_API_URL=https://paladio.example.com/apionfrontend. - Keep public registration closed: Leave
ALLOW_PUBLIC_REGISTRATION=false(the default) and create household or team accounts from Settings (/configunder Authorized Users). - Keep internal services off the host:
docker-compose.ymlkeeps PostgreSQL (5432), Redis (6379), and Valhalla (8002) strictly on the internal Docker network so onlyfrontend(3000) andapi(8000) bind host ports (adddocker-compose.dev.ymlif you need localhost DB/Redis/Valhalla ports for development).
Reverse proxy configurations (with WebSockets)¶
Route /api/* and /mcp to 127.0.0.1:8000 (backend FastAPI) and all remaining traffic to 127.0.0.1:3000 (Next.js frontend), preserving Upgrade and Connection headers for /api/ws/stream and /api/ws/trip-agent/{trip_id}.
server {
listen 443 ssl http2;
server_name paladio.example.com;
location /api/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 3600s;
}
location /mcp {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_buffering off;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
# Add these labels to your api and frontend services when routing via Traefik:
# api:
# - "traefik.http.routers.paladio-api.rule=Host(`paladio.example.com`) && (PathPrefix(`/api`) || PathPrefix(`/mcp`))"
# - "traefik.http.services.paladio-api.loadbalancer.server.port=8000"
# frontend:
# - "traefik.http.routers.paladio-ui.rule=Host(`paladio.example.com`)"
# - "traefik.http.services.paladio-ui.loadbalancer.server.port=3000"
Authentication, trip RBAC, and password resets¶
Paladio protects user credentials with PBKDF2-HMAC-SHA256 (100,000 iterations, 32-byte random salt, constant-time hmac.compare_digest), HS256 JWTs, and three-tier per-trip access control (core/access.py).
- Trip access levels:
OWNER(trip.user_id == user.id),EDITOR(anyTripParticipantModellinked to that user account), andVIEWER(read-only access enforced byassert_trip_access). Legacy local trips withtrip.user_id IS NULLgrant local owner access automatically in single-user self-hosted deployments. - Sovereign CLI password reset: If an administrator loses their password, reset it directly on the host without external recovery emails: