# nginx in front of atria-proxy: nginx terminates TLS (proof mode). # From https://trustatria.com/install, "Behind nginx", way 2. # # nginx completes the handshake, so the proxy behind it never sees the # agent's client certificate. The agent signs a proof with that certificate # on every request instead, in the TA-Authorization header, bound to the # method, the URL and the body. The proxy side: # # /etc/atria/atria-proxy.env # ATRIA_AUTH_MODE=proof # ATRIA_PUBLIC_URL=https://agents.example.com # exactly what agents address # ATRIA_LISTEN_ADDR=127.0.0.1:8443 # nginx is the only caller # ATRIA_CA_CERT=/usr/share/atria/atria-ca.pem # still required # # Keep ATRIA_TLS_CERT and ATRIA_TLS_KEY: not served here, but the # # proxy signs its calls to Atria with them. # # Where this goes: an http server { }. RHEL family: # /etc/nginx/conf.d/atria-proxy.conf. Debian, Ubuntu: # /etc/nginx/sites-available/atria-proxy, linked into sites-enabled/. # # Replace agents.example.com with the hostname your agents dial, the same # value as ATRIA_PUBLIC_URL. Point ATRIA_PUBLIC_URL at an internal address # instead and every request is refused: each proof is bound to the URL the # agent called. server { listen 443 ssl; listen [::]:443 ssl; server_name agents.example.com; # Your own certificate for that hostname, not the Atria one. ssl_certificate /etc/ssl/example/fullchain.pem; ssl_certificate_key /etc/ssl/example/privkey.pem; # Optional gate at your edge: refuse anything without an Atria # certificate before it reaches the proxy. Agents must then present # their certificate in the handshake as well. nginx checks the chain # and the dates, not revocation: the proxy still checks the proof and # the revocation list on every request. #ssl_client_certificate /usr/share/atria/atria-ca.pem; #ssl_verify_client on; # A backstop: keeps // in the path should a URI part ever be added to # proxy_pass below. The proxy refuses an ambiguous path rather than # guessing what it means. merge_slashes off; # The proxy accepts bodies up to 2 MB; nginx's own default is 1 MB. client_max_body_size 2m; location / { # Exactly this: nothing after the port, no rewrite. nginx then # forwards the path byte for byte as the agent sent it. The proof # binds the method, the URL and a hash of the body; with a trailing # "/" here nginx rebuilds the path, and a request whose path that # changes is refused as forged. proxy_pass http://127.0.0.1:8443; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # TA-Authorization (the proof) and TA-Proxy-Pass (the backend an # agent picks) pass through unchanged by default. Do not clear or # rewrite either. # Longer than ATRIA_UPSTREAM_TIMEOUT (30s by default), or nginx gives # up first and the audit log records a decision the caller never saw. proxy_read_timeout 60s; } } # Apply: # sudo setsebool -P httpd_can_network_connect 1 # RHEL with SELinux only # sudo nginx -t && sudo systemctl reload nginx # sudo systemctl restart atria-proxy