41 lines
1.4 KiB
INI
41 lines
1.4 KiB
INI
# Lab 7 ingress: TLS (public CA, hostname localhost) from clients, mTLS to every API replica.
|
|
global
|
|
log stdout format raw local0
|
|
maxconn 1024
|
|
ssl-default-bind-options ssl-min-ver TLSv1.2
|
|
ssl-default-server-options ssl-min-ver TLSv1.2
|
|
|
|
defaults
|
|
log global
|
|
mode http
|
|
option httplog
|
|
option http-keep-alive
|
|
timeout connect 2s
|
|
timeout client 30s
|
|
timeout server 30s
|
|
timeout check 2s
|
|
timeout http-request 10s # slow-header (Slowloris) protection
|
|
|
|
resolvers docker
|
|
nameserver docker-dns 127.0.0.11:53
|
|
resolve_retries 3
|
|
timeout resolve 1s
|
|
timeout retry 1s
|
|
hold valid 2s
|
|
hold obsolete 2s
|
|
|
|
frontend public_https
|
|
bind :8443 ssl crt /pki/lb-public/keystore.pem
|
|
http-request set-header X-Real-IP %[src] # overwritten here: the API trusts it for rate limiting (only this LB may connect)
|
|
http-response set-header Strict-Transport-Security "max-age=31536000"
|
|
default_backend api_replicas
|
|
|
|
backend api_replicas
|
|
balance roundrobin
|
|
option httpchk
|
|
http-check send meth GET uri /health/ready
|
|
http-check expect status 200
|
|
# mTLS to the replica: verify the API certificate (CA + hostname "api"), present the LB identity (CN/SAN "lb").
|
|
default-server inter 1s fall 2 rise 1 ssl verify required ca-file /pki/lb/ca.crt verifyhost api sni str(api) crt /pki/lb/keystore.pem check
|
|
server-template api 10 api:8443 resolvers docker init-addr libc,none
|