gateway reaches the controller over tls with its own client leaf when the tcp listener is on
This commit is contained in:
parent
17fffaae79
commit
187ed82de0
1 changed files with 768 additions and 49 deletions
|
|
@ -45,6 +45,39 @@ let
|
|||
sslCertificateKey = tlsKey;
|
||||
};
|
||||
|
||||
# Dial another service on this hive BY NAME over https, verified.
|
||||
# nginx verifies nothing by default (`proxy_ssl_verify` is off), so a
|
||||
# `proxy_pass https://…` without this is encrypted but unauthenticated
|
||||
# — invisibly, it works and keeps working against any certificate at
|
||||
# all. Full reasoning for every directive here (plus two real
|
||||
# footguns — session-cache keying, and a `Host`-header clobber that
|
||||
# can recurse a subrequest into itself) is in docs/4-implementation/networking/gateway.md's
|
||||
# "Dialing another vhost by name" section — read it before touching
|
||||
# this.
|
||||
verifiedProxyTo = name: ''
|
||||
proxy_ssl_verify on;
|
||||
proxy_ssl_verify_depth 3;
|
||||
proxy_ssl_trusted_certificate ${caBundle};
|
||||
proxy_ssl_name ${name};
|
||||
proxy_ssl_server_name on;
|
||||
proxy_set_header Host ${name};
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Server $hostname;
|
||||
'';
|
||||
|
||||
# `verifiedProxyTo`, plus the client certificate nginx presents to an
|
||||
# upstream that demands one (`ssl_verify_client on`). Opt-in per call: the
|
||||
# plain form sends none, which is what every existing caller wants.
|
||||
verifiedProxyToWithClientCert =
|
||||
name:
|
||||
{ certificate, key }:
|
||||
verifiedProxyTo name
|
||||
+ ''
|
||||
proxy_ssl_certificate ${certificate};
|
||||
proxy_ssl_certificate_key ${key};
|
||||
'';
|
||||
|
||||
hstsDirectives = lib.concatStringsSep "; " (
|
||||
[ "max-age=${toString cfg.hsts.maxAge}" ]
|
||||
++ lib.optional cfg.hsts.includeSubDomains "includeSubDomains"
|
||||
|
|
@ -82,26 +115,7 @@ in
|
|||
else
|
||||
vhostTls;
|
||||
|
||||
# Dial another service on this hive BY NAME over https, verified.
|
||||
# nginx verifies nothing by default (`proxy_ssl_verify` is off), so a
|
||||
# `proxy_pass https://…` without this is encrypted but unauthenticated
|
||||
# — invisibly, it works and keeps working against any certificate at
|
||||
# all. Full reasoning for every directive here (plus two real
|
||||
# footguns — session-cache keying, and a `Host`-header clobber that
|
||||
# can recurse a subrequest into itself) is in docs/4-implementation/networking/gateway.md's
|
||||
# "Dialing another vhost by name" section — read it before touching
|
||||
# this.
|
||||
verifiedProxyTo = name: ''
|
||||
proxy_ssl_verify on;
|
||||
proxy_ssl_verify_depth 3;
|
||||
proxy_ssl_trusted_certificate ${caBundle};
|
||||
proxy_ssl_name ${name};
|
||||
proxy_ssl_server_name on;
|
||||
proxy_set_header Host ${name};
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Server $hostname;
|
||||
'';
|
||||
inherit verifiedProxyTo verifiedProxyToWithClientCert;
|
||||
|
||||
# Security headers added at the server scope on every vhost.
|
||||
# nginx's add_header inheritance rule: a location that defines its
|
||||
|
|
|
|||
Loading…
Reference in a new issue