Files
bpmforge e0d82a4ed0 Kryptkeeper 1.0.0
First stable release. Notes: docs/release/RELEASE_NOTES_v1.0.0.md
Lab record: docs/release/LIVE_RESULTS_v1.0.0.md
2026-10-19 14:43:23 -04:00

85 lines
3.8 KiB
Nginx Configuration File

server {
listen 8080;
root /usr/share/nginx/html;
index index.html;
# W19-23: the hub serves TLS by default (self-issued from its own CA --
# see cmd/kryptkeeper/tls.go). proxy_ssl_verify on + trusted_certificate
# make nginx actually check that cert rather than tunnel to it blind;
# proxy_ssl_name pins the name checked against the cert's SANs to
# "kryptkeeper" (the compose service name docker-compose.yml's
# KRYPTKEEPER_TLS_SANS includes), independent of whatever the upstream
# DNS/Host resolution happens to be.
# W30-19: Server-Sent Events. Exact-match so it wins over the /api/ prefix
# block below. nginx does not inherit proxy_* between sibling locations, so
# the TLS/header directives are repeated. Buffering and caching MUST be off
# or heartbeats and events sit in a proxy buffer; the 3600s timeouts keep
# the idle-looking stream (15 s heartbeats) from being reaped at the 60 s
# default.
location = /api/v1/events {
proxy_pass https://kryptkeeper:8080;
proxy_ssl_trusted_certificate /etc/kryptkeeper/tls/ca.pem;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;
proxy_ssl_name kryptkeeper;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
chunked_transfer_encoding on;
}
location /api/ {
proxy_pass https://kryptkeeper:8080;
proxy_ssl_trusted_certificate /etc/kryptkeeper/tls/ca.pem;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;
proxy_ssl_name kryptkeeper;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# APPEND to (never pass through) X-Forwarded-For: the hub reads it
# right-to-left and believes only what a trusted proxy wrote, so the
# client's own header must not survive as the last hop.
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /healthz {
proxy_pass https://kryptkeeper:8080;
proxy_ssl_trusted_certificate /etc/kryptkeeper/tls/ca.pem;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;
proxy_ssl_name kryptkeeper;
}
location /readyz {
proxy_pass https://kryptkeeper:8080;
proxy_ssl_trusted_certificate /etc/kryptkeeper/tls/ca.pem;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;
proxy_ssl_name kryptkeeper;
}
# OWASP-003: baseline headers for the static dashboard. They sit in this
# location only (nginx drops inherited add_header the moment a block
# declares its own, and /api/ responses already carry the hub's headers).
# The CSP was checked against the Vite build (one module script and one
# stylesheet from /assets, no inline script, no eval). style-src keeps
# 'unsafe-inline' for component libraries that inject <style>. connect-src
# 'self' assumes the default same-origin API base; a build with an
# external VITE_API_BASE must add that origin. No HSTS on purpose: this
# server listens on plain HTTP, so HSTS belongs to whichever TLS front end
# terminates it.
location / {
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
add_header X-Frame-Options "DENY" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self'; worker-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
try_files $uri $uri/ /index.html;
}
}