Commit Graph

8 Commits

Author SHA1 Message Date
bolkedebruin
de31bfe8a0 Restrict the rdpgw-auth socket to its own UID by default (#190)
The auth daemon's gRPC socket was world-writable and accepted any
local UID that could connect to it. On a multi-tenant host any user
on the box could speak the gRPC API and run an arbitrary username/
password through PAM -- effectively an unauthenticated PAM oracle.

Create the socket with mode 0660 (Umask(0117)) and gate Accept on
SO_PEERCRED: only the daemon's own UID is allowed by default, plus
any operator-supplied --allow-uid / --allow-gid. Privilege-separated
deployments (rdpgw and rdpgw-auth as different users) need to list
the gateway's UID, or share a group; the existing path otherwise
would have been permissive.

The peer-credentials check is Linux-only; the non-Linux build keeps
the listener as-is and logs a warning, since rdpgw-auth itself
requires libpam and is effectively Linux-only in practice.
2026-04-30 18:59:48 +02:00
bolkedebruin
75ef8ce289 Require trusted-proxy CIDR allow-list for header authentication (#184)
Header auth previously trusted any request that carried the configured
user header, with no check that the request came from a known upstream
proxy. Anyone reaching rdpgw directly could mint an authenticated
session as any user by setting the header.

Add `Header.TrustedProxies` (CIDR list) checked against `RemoteAddr`
before reading the user header. Refuse the request with 401 when the
remote is outside the allow-list. Refuse to start when header
authentication is enabled but `Header.TrustedProxies` is empty.

The CIDR allow-list gates the immediate upstream only; operators must
still configure their proxy to strip duplicate inbound copies of the
user header so a client cannot smuggle one through the trusted hop.
Documented in docs/header-authentication.md.

TestHeaderAuthRequiresTrustedProxy is a 3-case table covering: no
allow-list (refused), outside allow-list (refused), inside allow-list
(allowed). Existing TestHeaderAuthenticated cases updated to declare
trust for httptest.NewRequest's default RemoteAddr (192.0.2.1).
2026-04-30 13:47:01 +02:00
Bolke de Bruin
8c4543b109 remove auto gen stuuf 2025-09-18 23:11:31 +02:00
Bolke de Bruin
866ed46fdc Extra docs 2025-09-18 23:09:40 +02:00
Bolke de Bruin
46d12c52be Add extra info on app gateway 2025-09-18 23:03:46 +02:00
Bolke de Bruin
75a7ca62a9 Add header authentication 2025-09-18 22:36:04 +02:00
Bolke de Bruin
da70e5967b Fix background 2024-03-18 11:22:30 +01:00
Bolke de Bruin
43493e9548 Add more docs 2024-03-18 11:18:44 +01:00