lab7: HTTPS+mTLS, OpenBao AppRole, Argon2id, rate limits, hardening

This commit is contained in:
2026-11-19 20:48:27 +03:00
parent 20afc2c790
commit 5e98b1b5af
67 changed files with 3169 additions and 87 deletions
+29 -28
View File
@@ -1,41 +1,42 @@
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
# These are logical interface suggestions; map actual framework names in REPORT.md.
# Credentials for PostgreSQL/S3/broker are generated by the operator into
# ./secrets and injected into OpenBao by scripts/openbao_bootstrap.py.
APP_HOST=0.0.0.0
APP_PORT=8080
APP_ENV=lab
SERVICE_VERSION=7.0.0
SESSION_TTL_SECONDS=3600
# Choose credentials locally. File paths contain no secret values.
DATABASE_URL_FILE=/run/secrets/database_url
# Optional on 3, required use on 4 in lab2; Redis OR Valkey:
SESSION_STORE=postgres
CACHE_URL_FILE=/run/secrets/cache_url
API_REPLICAS=2
IDEMPOTENCY_TTL_SECONDS=86400
# lab7: TLS / OpenBao
PKI_DIR=/pki
OPENBAO_ADDR=https://openbao:8200
OPENBAO_CA=/pki/ca.crt
OPENBAO_ROLE_ID_FILE=/run/secrets/openbao_role_id
OPENBAO_SECRET_ID_FILE=/run/secrets/openbao_secret_id
S3_ENDPOINT=https://s3:9000
S3_REGION=us-east-1
S3_BUCKET=messenger-attachments
S3_ACCESS_KEY_ID_FILE=/run/secrets/s3_access_key_id
S3_SECRET_ACCESS_KEY_FILE=/run/secrets/s3_secret_access_key
S3_CA=/pki/ca.crt
BROKER_CA=/pki/ca.crt
MAX_UPLOAD_BYTES=10485760
MAX_IMAGE_PIXELS=40000000
BROKER_URL_FILE=/run/secrets/broker_url
WORKER_CONCURRENCY=2
JOB_MAX_ATTEMPTS=5
JOB_TIMEOUT_SECONDS=60
STAGING_RETENTION_SECONDS=86400
OTEL_SERVICE_NAME=messenger-api
# Worker must set a distinct service.name.
OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
LOGIN_RATE_LIMIT=5
LOGIN_RATE_WINDOW_SECONDS=60
# lab5: durable broker + worker (broker credentials live in OpenBao)
BROKER_USER=change-me
BROKER_PASSWORD=change-me
JOB_QUEUE=attachment_jobs
STAGING_PREFIX=staging
MAX_JOB_ATTEMPTS=5
THUMBNAIL_SIZE=256
THUMBNAIL_QUALITY=85
# lab6: observability over TLS
OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4317
OTEL_CA=/pki/ca.crt
OTEL_METRIC_INTERVAL_MS=10000
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
# TLS and OpenBao: actual paths/ports depend on your implemented trust matrix.
PUBLIC_BASE_URL=https://localhost:8443
TLS_CA_FILE=/run/secrets/ca.crt
TLS_CERT_FILE=/run/secrets/service.crt
TLS_KEY_FILE=/run/secrets/service.key
BAO_ADDR=https://openbao:8200
BAO_CACERT=/run/secrets/bao-ca.crt
# No root token here. Bootstrap operator -> short-lived service auth -> scoped token.
ARGON2_MEMORY_KIB=19456
ARGON2_ITERATIONS=2
ARGON2_PARALLELISM=1
GRAFANA_ADMIN_PASSWORD=change-me