lab7: локальная PKI (public-ca для ingress, internal-ca для сервисов), HTTPS ingress на 8443, без открытого 8080

This commit is contained in:
Alexey Bodanyuk
2026-11-27 16:09:46 +03:00
parent 6435b6a1c5
commit 7c43d31dc7
5 changed files with 210 additions and 16 deletions
+7 -3
View File
@@ -74,7 +74,9 @@ defaults
http-error status 504 content-type application/json lf-string "{\"error\":{\"code\":\"unavailable\",\"message\":\"API-реплика не ответила вовремя; повторите с тем же Idempotency-Key\",\"request_id\":\"%[var(txn.request_id)]\"}}" hdr X-Request-Id "%[var(txn.request_id)]"
frontend public
bind :8080
# Lab 7: the ONLY public listener is HTTPS. Certificate of the public CA (SAN localhost,
# 127.0.0.1, ::1; scripts/init_pki.py), TLS 1.2+. There is no plaintext listener to fall back to.
bind :8443 ssl crt /run/secrets/ingress.pem ssl-min-ver TLSv1.2 alpn http/1.1
# One request id end to end: keep a valid client X-Request-Id, otherwise create one; the
# API echoes it, and errors generated by the LB itself carry the same value.
http-request set-header X-Request-Id %[uuid()] unless { req.hdr(x-request-id) -m reg ^[A-Za-z0-9._:-]{1,128}$ }
@@ -107,9 +109,11 @@ backend api_core
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
# Local-only status page (127.0.0.1:8404 on the host): which replica is UP/DOWN right now.
# 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
# (`docker compose exec lb ...`, scripts/lbctl.py).
frontend stats
bind :8404
bind 127.0.0.1:8404
stats enable
stats uri /
stats refresh 2s