Let invites, SSO and health checks past Vouch
location / covered /invite/{token}, /oidc/callback, /device and
/healthz along with the web interface, so Vouch stood in front of all
of them. An invite link was the worst of it: it goes to somebody who has
no account anywhere yet, and Vouch bounced them to a login they cannot
pass. The OIDC callback was fragile for a different reason — the
authorization code it carries is single-use and short-lived, and a
second login round trip is a poor place to spend it.
Those four paths now proxy straight through. KeepOrg authenticates each
of them itself: an invite is a capability token, the callback is checked
against its state, a device code expires in ten minutes, and /healthz is
unauthenticated by design. /web keeps Vouch in front of it, and /api was
already exempt.
The proxy settings move to the server block, where every location
inherits them, and the upstream becomes a named block. location / has to
repeat the headers in full: a location that sets one proxy_set_header
replaces the inherited set rather than adding to it.
Checked with nginx -t and against a running keeporgd with a 401 standing
in for Vouch: /, /web and /web/* redirect to auth.tiredsysadmin.cc,
while /healthz, /invite/, /device and /oidc/* serve KeepOrg's own pages
and /api returns KeepOrg's 401.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
81094c0228
commit
967d9c0e2e
@@ -1,5 +1,9 @@
|
|||||||
### Deployed by https://git.rcmd.space/rcmd/keeporg
|
### Deployed by https://git.rcmd.space/rcmd/keeporg
|
||||||
|
|
||||||
|
upstream keeporg {
|
||||||
|
server 10.200.1.3:32970;
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
@@ -24,6 +28,27 @@ server {
|
|||||||
|
|
||||||
server_name keeporg.tiredsysadmin.cc;
|
server_name keeporg.tiredsysadmin.cc;
|
||||||
|
|
||||||
|
# Shared by every proxied location below. A location that sets any
|
||||||
|
# proxy_set_header of its own replaces this whole set instead of adding to
|
||||||
|
# it, which is why the Vouch-protected location repeats them.
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
# disable buffering uploads to prevent OOM on reverse proxy server and make uploads twice as fast (no pause)
|
||||||
|
proxy_request_buffering off;
|
||||||
|
|
||||||
|
# set timeout
|
||||||
|
proxy_read_timeout 600s;
|
||||||
|
proxy_send_timeout 600s;
|
||||||
|
send_timeout 600s;
|
||||||
|
|
||||||
location = /validate {
|
location = /validate {
|
||||||
proxy_pass http://127.0.0.1:30021/validate;
|
proxy_pass http://127.0.0.1:30021/validate;
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
@@ -39,48 +64,48 @@ server {
|
|||||||
return 302 https://auth.tiredsysadmin.cc/login?url=$scheme://$http_host$request_uri&vouch-failcount=$auth_resp_failcount&X-Vouch-Token=$auth_resp_jwt&error=$auth_resp_err;
|
return 302 https://auth.tiredsysadmin.cc/login?url=$scheme://$http_host$request_uri&vouch-failcount=$auth_resp_failcount&X-Vouch-Token=$auth_resp_jwt&error=$auth_resp_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The web interface, behind Vouch.
|
||||||
location / {
|
location / {
|
||||||
auth_request /validate;
|
auth_request /validate;
|
||||||
proxy_set_header X-Vouch-User $auth_resp_x_vouch_user;
|
proxy_set_header X-Vouch-User $auth_resp_x_vouch_user;
|
||||||
proxy_pass http://10.200.1.3:32970;
|
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
proxy_http_version 1.1;
|
proxy_pass http://keeporg;
|
||||||
proxy_redirect off;
|
|
||||||
|
|
||||||
# disable buffering uploads to prevent OOM on reverse proxy server and make uploads twice as fast (no pause)
|
|
||||||
proxy_request_buffering off;
|
|
||||||
|
|
||||||
# set timeout
|
|
||||||
proxy_read_timeout 600s;
|
|
||||||
proxy_send_timeout 600s;
|
|
||||||
send_timeout 600s;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Desktop and Android clients, which authenticate to KeepOrg itself with a
|
||||||
|
# bearer token. Sending them to a Vouch login page would break sync.
|
||||||
location /api {
|
location /api {
|
||||||
proxy_pass http://10.200.1.3:32970;
|
proxy_pass http://keeporg;
|
||||||
|
}
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
# Paths that have to work for somebody who has no Vouch account, or no
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
# account at all. KeepOrg authenticates each of them itself.
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
#
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
# /healthz uptime and container checks, unauthenticated by design
|
||||||
|
# /invite/ the invited person is signing up; an account is what they
|
||||||
|
# have come here to create
|
||||||
|
# /oidc/ the identity provider redirects back with a single-use
|
||||||
|
# authorization code, which a second login round trip spends
|
||||||
|
# /device a client device being approved from a browser
|
||||||
|
location = /healthz {
|
||||||
|
proxy_pass http://keeporg;
|
||||||
|
}
|
||||||
|
|
||||||
proxy_http_version 1.1;
|
location /invite/ {
|
||||||
proxy_redirect off;
|
proxy_pass http://keeporg;
|
||||||
|
}
|
||||||
|
|
||||||
# disable buffering uploads to prevent OOM on reverse proxy server and make uploads twice as fast (no pause)
|
location /oidc/ {
|
||||||
proxy_request_buffering off;
|
proxy_pass http://keeporg;
|
||||||
|
}
|
||||||
|
|
||||||
# set timeout
|
location = /device {
|
||||||
proxy_read_timeout 600s;
|
proxy_pass http://keeporg;
|
||||||
proxy_send_timeout 600s;
|
|
||||||
send_timeout 600s;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user