You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/v1/admin/reverse_proxy_authentication.md
+90-11Lines changed: 90 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,14 @@ menu:
8
8
9
9
This authentication method is often used for [SSO](http://en.wikipedia.org/wiki/Single_sign-on) (Single Sign-On), especially for large organizations.
10
10
11
-
The authentication is handled by another system. Kanboard does not store your password and assumes you are already authenticated.
11
+
The authentication is handled by another system.
12
+
Kanboard does not store your password and assumes you are already authenticated.
12
13
13
14
## Requirements
14
15
15
-
- Apache authentication on the same server or a properly configured reverse proxy.
16
+
- Apache or another web server with authentication capabilities (e.g., Basic Auth, LDAP, OAuth, SAML)
17
+
- A reverse proxy configured to authenticate users and forward authentication headers to Kanboard
18
+
- Network configuration ensuring Kanboard is only accessible through the reverse proxy
16
19
17
20
## How Does This Work?
18
21
@@ -25,15 +28,83 @@ The authentication is handled by another system. Kanboard does not store your pa
25
28
26
29
### Setting Up Your Reverse Proxy
27
30
28
-
This is outside the scope of this documentation. Ensure the reverse proxy sends the user login via an HTTP header and identify which header is used.
31
+
This is outside the scope of this documentation. You must configure your reverse proxy to authenticate users and pass the authenticated username via an HTTP header to Kanboard.
When reverse proxy authentication is enabled, Kanboard trusts the configured header (for example `REMOTE_USER` or `HTTP_X_AUTHENTICATED_USER`).
44
+
If an attacker can reach Kanboard directly (bypassing the reverse proxy) or can inject headers that your proxy forwards, they could impersonate another user.
45
+
46
+
To avoid this, configure your reverse proxy so that:
47
+
48
+
- Kanboard is not reachable directly from untrusted networks (only through the reverse proxy).
49
+
- The proxy removes any incoming authentication headers from the client request.
50
+
- The proxy sets the authentication header itself, using a value coming from the proxy authentication step.
51
+
52
+
Nginx example (strip client-supplied headers, then set your own):
53
+
54
+
```nginx
55
+
location / {
56
+
# Strip any client-supplied authentication headers to prevent spoofing
57
+
proxy_set_header X-Forwarded-User "";
58
+
proxy_set_header REMOTE_USER "";
59
+
60
+
# Set the authentication header from the authenticated user
61
+
# For HTTP Basic Auth, use $remote_user
62
+
proxy_set_header X-Forwarded-User $remote_user;
63
+
64
+
# For auth_request module, use a variable from your auth subrequest:
Apache example (unset, then set from the authenticated user):
78
+
79
+
```apache
80
+
# Strip any client-supplied authentication headers to prevent spoofing
81
+
RequestHeader unset X-Forwarded-User
82
+
RequestHeader unset REMOTE_USER
83
+
84
+
# Set the authentication header from the authenticated user
85
+
# This example assumes Apache HTTP Basic Auth or similar module
86
+
RequestHeader set X-Forwarded-User "%{REMOTE_USER}e"
87
+
88
+
# Alternative: if using mod_auth_openidc or similar OAuth/OIDC module:
89
+
# RequestHeader set X-Forwarded-User "%{OIDC_CLAIM_preferred_username}e"
90
+
```
91
+
92
+
Also ensure the upstream Kanboard server only accepts connections from the reverse proxy (for example, firewall rules, binding Kanboard to `127.0.0.1`, or allowing only the proxy IP).
29
93
30
94
### Setting Up Kanboard
31
95
32
-
Create a custom `config.php` file or copy the `config.default.php` file:
96
+
Since Kanboard version 1.2.49, it is mandatory to configure the `TRUSTED_PROXY_NETWORKS` option when enabling reverse proxy authentication.
97
+
This setting specifies the list of trusted proxy networks in CIDR format that are permitted to set the authentication header.
98
+
99
+
For instance, if your reverse proxy operates on the same server as Kanboard, you can configure it as follows: `127.0.0.1/32,::1/128`.
- If the proxy is the same web server that runs Kanboard, according to the [CGI protocol](http://www.ietf.org/rfc/rfc3875), the header name will be `REMOTE_USER`. For example, Apache adds `REMOTE_USER` by default if `Require valid-user` is set.
62
-
- If you use a different header for `REVERSE_PROXY_USER_HEADER`, the value must be prefixed by `HTTP_`, all hyphens must be replaced by underscores, and the string must be in all capitals because it is fetched from the `$_SERVER` array. For example, `X-Proxy-Username` becomes `HTTP_X_PROXY_USERNAME`.
63
-
- If Apache is a reverse proxy to another Apache running Kanboard, the header `REMOTE_USER` is not set (the same behavior applies to IIS and Nginx).
64
-
- If you have a real reverse proxy, the [HTTP ICAP draft](http://tools.ietf.org/html/draft-stecher-icap-subid-00#section-3.4) proposes the header to be `X-Authenticated-User`. This de facto standard has been adopted by several tools.
65
-
{{</ hint >}}
131
+
#### Custom Header Names
132
+
133
+
If you want to use a custom HTTP header for `REVERSE_PROXY_USER_HEADER` option, you must follow PHP's `$_SERVER` variable naming convention:
0 commit comments