feat: import lab 7 security implementation
This commit is contained in:
+107
-2
@@ -1,6 +1,7 @@
|
||||
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
|
||||
# These are logical interface suggestions; map actual framework names in REPORT.md.
|
||||
APP_HOST=0.0.0.0
|
||||
# Host process (make run); the container binds 0.0.0.0 in Dockerfile.
|
||||
APP_HOST=127.0.0.1
|
||||
APP_PORT=8080
|
||||
APP_ENV=lab
|
||||
SESSION_TTL_SECONDS=3600
|
||||
@@ -11,6 +12,9 @@ SESSION_STORE=postgres
|
||||
CACHE_URL_FILE=/run/secrets/cache_url
|
||||
API_REPLICAS=2
|
||||
IDEMPOTENCY_TTL_SECONDS=86400
|
||||
# Lab 4 logical names (skeleton). Containers get S3_ENDPOINT from compose.yaml
|
||||
# (https://s3:8333), make run overrides it with https://localhost:S3_HOST_PORT;
|
||||
# keys come from the lines below.
|
||||
S3_ENDPOINT=https://s3:9000
|
||||
S3_REGION=us-east-1
|
||||
S3_BUCKET=messenger-attachments
|
||||
@@ -18,17 +22,46 @@ S3_ACCESS_KEY_ID_FILE=/run/secrets/s3_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE=/run/secrets/s3_secret_access_key
|
||||
MAX_UPLOAD_BYTES=10485760
|
||||
MAX_IMAGE_PIXELS=40000000
|
||||
# Lab 5 logical names (skeleton). BROKER_URL_FILE is not used: relay and worker
|
||||
# get BROKER_HOST and their identity files (BROKER_CERT_FILE, BROKER_KEY_FILE,
|
||||
# BROKER_CRL_FILE) from compose.yaml; lab 7 has no broker password at all —
|
||||
# mTLS with certificate login (REPORT.md, «Конфигурация»).
|
||||
BROKER_URL_FILE=/run/secrets/broker_url
|
||||
WORKER_CONCURRENCY=2
|
||||
JOB_MAX_ATTEMPTS=5
|
||||
JOB_TIMEOUT_SECONDS=60
|
||||
STAGING_RETENTION_SECONDS=86400
|
||||
# Lab 6 names (skeleton). service.name is fixed by each entry point
|
||||
# (messenger-api, messenger-worker, messenger-relay), so OTEL_SERVICE_NAME is
|
||||
# not read; compose.yaml points api, worker and relay at the Collector by name.
|
||||
# Only deployment.environment.name is accepted in OTEL_RESOURCE_ATTRIBUTES.
|
||||
# Lab 7: the endpoint must be https (the otel-gateway mTLS front of the
|
||||
# Collector); CA and identity files are CLIENT_TLS_CA_FILE and TELEMETRY_*_FILE
|
||||
# set in compose.yaml, OTEL_EXPORTER_OTLP_CERTIFICATE / _CLIENT_* are not read.
|
||||
# make run sets OTEL_SDK_DISABLED=true for host processes.
|
||||
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
|
||||
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
|
||||
# TLS and OpenBao: actual paths/ports depend on your implemented trust matrix.
|
||||
# Lab 7 names (skeleton). PUBLIC_BASE_URL is https://localhost:HTTPS_HOST_PORT
|
||||
# (HAProxy, the only API port). TLS_CERT_FILE, TLS_KEY_FILE, TLS_CA_FILE
|
||||
# (and TLS_CRL_FILE, TLS_CLIENT_AUTH, TLS_ALLOWED_CLIENTS) are read by the API
|
||||
# replicas, but compose.yaml sets them to /run/secrets/api.* — the values
|
||||
# below are not used; make run passes the ingress pair itself. Stand PKI files
|
||||
# come from make pki-stand (.pki/stand/), the CA key stays outside the repo.
|
||||
# OpenBao (openbao-secrets): compose.yaml sets BAO_ADDR and the identity files
|
||||
# (BAO_CERT_FILE, BAO_KEY_FILE, BAO_CRL_FILE) of every service, make run uses
|
||||
# https://localhost:BAO_HOST_PORT with the pair from .pki/stand/; the CA is
|
||||
# CLIENT_TLS_CA_FILE, BAO_CACERT is not read. The root token and unseal shares
|
||||
# stay with the operator (make bao-*), never here. ARGON2_* below are the
|
||||
# skeleton's floor (19 MiB, t=2, p=1); the API's defaults come from the
|
||||
# measurement (make argon2-params, src/config.py Auth) and compose does not
|
||||
# pass these lines to containers. KDF_* and LOGIN_* (hash budget, failed-login
|
||||
# limits) also live in src/config.py with defaults. PostgreSQL, Valkey and S3
|
||||
# accept only TLS 1.3: clients trust CLIENT_TLS_CA_FILE (compose.yaml sets
|
||||
# /run/secrets/ca.crt, make run — .pki/stand/ca.crt) and check host names,
|
||||
# so make run reaches the stand storages at localhost, not 127.0.0.1.
|
||||
PUBLIC_BASE_URL=https://localhost:8443
|
||||
TLS_CA_FILE=/run/secrets/ca.crt
|
||||
TLS_CERT_FILE=/run/secrets/service.crt
|
||||
@@ -39,3 +72,75 @@ BAO_CACERT=/run/secrets/bao-ca.crt
|
||||
ARGON2_MEMORY_KIB=19456
|
||||
ARGON2_ITERATIONS=2
|
||||
ARGON2_PARALLELISM=1
|
||||
|
||||
# Compose and make run. make env fills the empty passwords and keys locally.
|
||||
# Lab 7: the stand LB listens only HTTPS on 127.0.0.1:HTTPS_HOST_PORT
|
||||
# (HOST_PORT of earlier labs is not read any more).
|
||||
HTTPS_HOST_PORT=8443
|
||||
# Lab 7 (openbao-secrets): OpenBao on 127.0.0.1 for the operator commands
|
||||
# (make bao-*) and host processes (make run). The passwords of the process roles,
|
||||
# VALKEY_PASSWORD and the S3 keys below reach the processes only through OpenBao:
|
||||
# make up / make bao-seed copies them there (a new version only on a change),
|
||||
# the storages and their bootstraps still read them from this file. After a change
|
||||
# run make up: it restarts the processes that loaded the previous version.
|
||||
BAO_HOST_PORT=8200
|
||||
# Lab 7 (storage-roles): POSTGRES_USER/POSTGRES_PASSWORD is the server
|
||||
# superuser — only the postgres container, postgres-bootstrap (make db-up runs
|
||||
# the same module) and the operator get it. Each process logs in with its own
|
||||
# role: migrate (schema owner, migrations), api (replicas, make run), worker,
|
||||
# relay (and make replay), cleaner. postgres-bootstrap sets the role passwords
|
||||
# (SCRAM verifier); each process reads only its own one, from OpenBao. make env
|
||||
# fills the empty ones; a new value applies on the next make up / make db-up.
|
||||
POSTGRES_USER=messenger
|
||||
POSTGRES_DB=messenger
|
||||
POSTGRES_PASSWORD=
|
||||
POSTGRES_MIGRATE_PASSWORD=
|
||||
POSTGRES_API_PASSWORD=
|
||||
POSTGRES_WORKER_PASSWORD=
|
||||
POSTGRES_RELAY_PASSWORD=
|
||||
POSTGRES_CLEANER_PASSWORD=
|
||||
POSTGRES_HOST_PORT=5433
|
||||
# Valkey ACL (storage-roles): the default user is off; VALKEY_PASSWORD is the
|
||||
# password of the api user (replicas, make run), VALKEY_OPERATOR_PASSWORD — of
|
||||
# the operator user (healthcheck, fault hook, scripts/lab7.py, bench/). Both
|
||||
# are read by the valkey container only: infra/valkey/start.sh writes their
|
||||
# SHA-256 into the ACL file on a tmpfs.
|
||||
VALKEY_PASSWORD=
|
||||
VALKEY_OPERATOR_PASSWORD=
|
||||
VALKEY_HOST_PORT=6380
|
||||
LOG_LEVEL=INFO
|
||||
SHUTDOWN_TIMEOUT=5
|
||||
# S3 (SeaweedFS): the root pair and the signing key stay with the s3 server;
|
||||
# api, worker and cleaner have their own users created by s3-bootstrap.
|
||||
S3_HOST_PORT=8334
|
||||
S3_ROOT_ACCESS_KEY=
|
||||
S3_ROOT_SECRET_KEY=
|
||||
S3_JWT_SIGNING_KEY=
|
||||
S3_API_ACCESS_KEY=
|
||||
S3_API_SECRET_KEY=
|
||||
S3_WORKER_ACCESS_KEY=
|
||||
S3_WORKER_SECRET_KEY=
|
||||
S3_CLEANER_ACCESS_KEY=
|
||||
S3_CLEANER_SECRET_KEY=
|
||||
# RabbitMQ: lab 7 (messaging-telemetry-mtls) — mTLS only, login by the
|
||||
# certificate of the relay or worker identity (EXTERNAL), no password. The
|
||||
# host port leads to the same TLS listener (make run-relay / run-worker with
|
||||
# their pair from .pki/stand/). A BROKER_PASSWORD line left in an older .env is
|
||||
# not read by anything and may be deleted.
|
||||
BROKER_HOST_PORT=5673
|
||||
WORKER_PREFETCH=2
|
||||
RENDER_MEMORY_MB=768
|
||||
UPLOAD_MAX_UNFINISHED=300
|
||||
# Observability (lab 6): Grafana on 127.0.0.1, admin password generated by
|
||||
# make env. Lab 7 (telemetry-backends-tls): HTTPS only, https://localhost:<port>
|
||||
# with the stand CA (.pki/stand/ca.crt). Telemetry knobs (defaults = full telemetry; track 1 changes them):
|
||||
# OTEL_SDK_DISABLED=true switches the SDK off in api, worker and relay;
|
||||
# OTEL_TRACES_SAMPLER_ARG is the share of root traces kept (0..1);
|
||||
# OTEL_METRIC_EXPORT_INTERVAL is in ms; TELEMETRY_HISTOGRAM_BUCKETS is
|
||||
# default or coarse.
|
||||
GRAFANA_HOST_PORT=3180
|
||||
GRAFANA_ADMIN_PASSWORD=
|
||||
OTEL_SDK_DISABLED=false
|
||||
OTEL_TRACES_SAMPLER_ARG=1.0
|
||||
OTEL_METRIC_EXPORT_INTERVAL=15000
|
||||
TELEMETRY_HISTOGRAM_BUCKETS=default
|
||||
|
||||
Reference in New Issue
Block a user