forked from mtusi2026/mtusi2026lab7
lab7: обязательное mTLS LB->API с allowlist identity (SAN lb), health только на loopback, скрипт отрицательных проверок mtls_check
This commit is contained in:
@@ -28,6 +28,14 @@
|
||||
# because the API has not seen them. Nothing that may have reached the API is retried by
|
||||
# the LB: an uncertain POST is retried by the CLIENT with the same Idempotency-Key.
|
||||
# No sticky sessions: sessions live in Valkey, every replica serves every user.
|
||||
#
|
||||
# Lab 7, LB -> API = mandatory mTLS (contracts/trust-matrix.md). Every server line (traffic AND the
|
||||
# active health checks, which inherit `ssl`):
|
||||
# ssl verify required ca-file internal-ca.crt verifyhost api the replica must present a certificate
|
||||
# of the internal CA with SAN `api`: no MITM, no fake replica;
|
||||
# crt lb.pem our client identity (internal CA, SAN `lb`, EKU clientAuth).
|
||||
# The replica checks the chain AND the SAN allowlist (src/messenger/tls.py). Plaintext to the API is
|
||||
# impossible: the replicas have no plaintext listener on the network.
|
||||
|
||||
global
|
||||
log stdout format raw local0 info
|
||||
@@ -95,8 +103,8 @@ backend api
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host api
|
||||
http-check expect status 200
|
||||
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2 check resolvers docker init-addr none resolve-prefer ipv4 maxconn 200
|
||||
server-template api 8 api:8080
|
||||
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2 check resolvers docker init-addr none resolve-prefer ipv4 maxconn 200 ssl verify required ca-file /run/secrets/internal-ca.crt verifyhost api crt /run/secrets/lb.pem ssl-min-ver TLSv1.2
|
||||
server-template api 8 api:8443
|
||||
|
||||
# Degraded mode only (see the header): used when NO replica is fully ready.
|
||||
backend api_core
|
||||
@@ -106,8 +114,8 @@ backend api_core
|
||||
option httpchk
|
||||
http-check send meth GET uri /health/ready/core ver HTTP/1.1 hdr Host api
|
||||
http-check expect status 200
|
||||
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2 check resolvers docker init-addr none resolve-prefer ipv4 maxconn 200
|
||||
server-template core 8 api:8080
|
||||
default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2 check resolvers docker init-addr none resolve-prefer ipv4 maxconn 200 ssl verify required ca-file /run/secrets/internal-ca.crt verifyhost api crt /run/secrets/lb.pem ssl-min-ver TLSv1.2
|
||||
server-template core 8 api:8443
|
||||
|
||||
# Status page for the container healthcheck only: bound to the container's own loopback and NOT
|
||||
# published (lab 7: only the TLS ingress leaves the host). Operators use the admin socket
|
||||
|
||||
Reference in New Issue
Block a user