Files
kaizoku/SECURITY_DEPLOYMENT.md

4.4 KiB

Security deployment — 2026-10-24

The code hardening does not change the live VPS, DNS, certificates, Nginx Proxy Manager (NPM), firewall, or existing containers. These steps complete the infrastructure findings from the tools.coreplay.eu assessment. Existing URLs continue to work until you explicitly migrate them.

Keep backends private

The default Compose host binding is loopback. A containerized NPM cannot reach another container through its own 127.0.0.1. On the same Docker host, create a private proxy network once (docker network create coreplay-proxy), attach NPM to it in its own Compose configuration, then use the supplied overlay:

docker compose -f docker-compose.yaml -f deploy/compose.proxy.yaml config
docker compose -f docker-compose.yaml -f deploy/compose.proxy.yaml up -d

The overlay removes host port publishing and adds the proxy network while preserving the default network and existing volumes. It requires a current Docker Compose with !reset support. Set the NPM upstream to kaizoku:8421 using HTTP and preserve the public Host header. Check the rendered Compose configuration before recreating containers. Never use down -v during upgrades. If NPM runs on another machine, use a private VPN/interface and a firewall rule allowing only that proxy, rather than publishing the port to the Internet.

Separate browser origins

Path-scoped cookies, CSRF tokens and content policies do not isolate applications sharing https://tools.coreplay.eu. Create separate DNS records and NPM Proxy Hosts for pwatcher.coreplay.eu, cbzcleaner.coreplay.eu and kaizoku.coreplay.eu (and workspace.coreplay.eu when used), with valid certificates and Force SSL. For this application configure:

KAIZOKU_BASE_URL=https://kaizoku.coreplay.eu
KAIZOKU_ALLOW_REMOTE=1

Keep the existing credentials and all persistent mounts. Remove the old mount path from the public URL only when the dedicated hostname is ready. Forward the URI without prefix stripping. Recreate the app container to apply environment changes, sign in again on the new origin, and remove the old proxy location after verifying pages, APIs, images and logout. Avoid redirects that rehost one app on another app's origin. Keep cookies host-only; do not set Domain=.coreplay.eu. For trusted HTTP development, local settings remain supported; public production URLs should explicitly use HTTPS.

Limit authentication at NPM

Merge deploy/coreplay-security-http.conf ONCE into NPM's persistent /data/nginx/custom/http_top.conf (an http-context include). It defines a shared per-client login budget of five requests/minute with a burst of five for POSTs to the known login endpoints, including both existing and dedicated-host URLs. Append deploy/npm-login-rate-limit.conf in each affected Proxy Host's Advanced configuration. Ordinary polling uses an empty limiter key and is not counted. Application-level authentication and throttling remain enabled, including for Basic Auth API requests. Keep any existing NPM access lists in place.

Nginx uses the connecting address. If another proxy/CDN precedes NPM, configure its real-IP trust only for that proxy's actual source networks; never trust all forwarded addresses. The application limits may be stricter, especially when several users share one connecting proxy IP.

Run nginx -t inside the NPM container before reloading. Preserve existing custom configuration rather than replacing it. NPM's documented include points and Docker networking pattern are described in its advanced configuration guide.

Intentional domain root

Append deploy/npm-tools-root.conf only to the shared tools.coreplay.eu Proxy Host. Its exact / location returns 404 without changing the existing app path locations. Do not apply this root snippet to dedicated app hosts, where / is an application page. Once every app has migrated, remove the old locations and use NPM's 404 host for the retired tools hostname.

Verify after rollout

From outside the VPS, inspect each login page's HTTPS headers and cookie flags; confirm unauthenticated sensitive APIs are denied and cross-origin mutations are rejected. Check docker ps --format 'table {{.Names}}\t{{.Ports}}' and the host firewall: no app backend should be reachable through the public IP. Confirm the root returns 404 and app login/navigation still work. Review NPM/app logs for 429s and CSP violations after rollout. Existing data must remain available.