# nginx in front of atria-proxy: mutual TLS passed through. # From https://trustatria.com/install, "Behind nginx", way 1. # # nginx forwards the TCP connection without opening it, so the TLS # handshake, and the agent's client certificate with it, reaches the proxy # untouched. Nothing changes for the agent. The proxy changes only where it # listens: # # /etc/atria/atria-proxy.env # ATRIA_LISTEN_ADDR=127.0.0.1:8443 # only nginx reaches the proxy # # Where this goes: /etc/nginx/nginx.conf, at the top level beside http { }. # Never in conf.d/ or sites-enabled/: both are included inside http { }, # where a stream block is an error. # # Needs the stream module, a separate package on both families: # sudo apt install libnginx-mod-stream # Debian, Ubuntu # sudo dnf install nginx-mod-stream # RHEL, AlmaLinux, Rocky # # Replace agents.example.com with the hostname your agents dial. The proxy's # own certificate must name it: enter it when you generate the certificate # on dash.trustatria.com. stream { map $ssl_preread_server_name $atria_backend { agents.example.com 127.0.0.1:8443; # atria-proxy default 127.0.0.1:8444; # every other HTTPS site here } server { listen 443; listen [::]:443; ssl_preread on; # reads the SNI, never terminates TLS proxy_pass $atria_backend; # No proxy_protocol here: the proxy does not read it, and the # handshake would fail. } } # Port 443 belongs to the stream block now. Each HTTPS site already on this # host moves to the default route above: in its http server { }, replace # "listen 443 ssl;" with # # listen 127.0.0.1:8444 ssl; # # Those sites then see every client as 127.0.0.1. No other HTTPS sites on # this host: drop the default line from the map. # # Apply: # sudo setsebool -P httpd_can_network_connect 1 # RHEL with SELinux: # sudo semanage port -a -t http_port_t -p tcp 8444 # these two lines # sudo nginx -t && sudo systemctl reload nginx # sudo systemctl restart atria-proxy