Implement Lab 7 service security
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
maxconn 256
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
timeout connect 1s
|
||||
timeout client 60s
|
||||
timeout server 60s
|
||||
timeout check 3s
|
||||
retries 0
|
||||
http-error status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"API temporarily unavailable","request_id":"%[unique-id]"}}' hdr X-Request-Id %[unique-id]
|
||||
|
||||
resolvers docker
|
||||
nameserver local 127.0.0.11:53
|
||||
resolve_retries 2
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 1s
|
||||
hold nx 1s
|
||||
hold obsolete 1s
|
||||
|
||||
frontend public
|
||||
bind :8443 ssl crt /run/tls/localhost.pem
|
||||
unique-id-format %[uuid()]
|
||||
stick-table type ip size 10k expire 1m store http_req_rate(10s)
|
||||
acl login method POST
|
||||
acl login_route path /api/v1/auth/sessions
|
||||
http-request track-sc0 src if login login_route
|
||||
http-request return status 429 content-type application/json lf-string '{"error":{"code":"rate_limited","message":"Too many login requests","request_id":"%[unique-id]"}}' hdr X-Request-Id %[unique-id] hdr X-Instance-Id ingress hdr Retry-After 10 if login login_route { sc_http_req_rate(0) gt 12 }
|
||||
use_backend api_live if { path /health/live }
|
||||
default_backend api_ready
|
||||
|
||||
backend api_ready
|
||||
balance roundrobin
|
||||
option httpchk GET /health/ready
|
||||
http-check expect status 200
|
||||
default-server inter 1s fall 2 rise 1 resolvers docker init-addr libc,none ssl verify required ca-file /run/tls/ca.crt crt /run/tls/lb-ingress.pem
|
||||
server first api1:8080 check verifyhost api1 sni str(api1) check-sni api1
|
||||
server second api2:8080 check verifyhost api2 sni str(api2) check-sni api2
|
||||
|
||||
backend api_live
|
||||
balance roundrobin
|
||||
option httpchk GET /health/live
|
||||
http-check expect status 200
|
||||
default-server inter 1s fall 2 rise 1 resolvers docker init-addr libc,none ssl verify required ca-file /run/tls/ca.crt crt /run/tls/lb-ingress.pem
|
||||
server first api1:8080 check verifyhost api1 sni str(api1) check-sni api1
|
||||
server second api2:8080 check verifyhost api2 sni str(api2) check-sni api2
|
||||
Reference in New Issue
Block a user