Skip to content

Commit 4e6d567

Browse files
committed
docs: add Portainer setup guide with tsidp configuration
Signed-off-by: Cleberson Saller <[email protected]>
1 parent 335dc10 commit 4e6d567

10 files changed

+100
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ tsidp can be used as IdP server for any application that supports custom OIDC pr
191191
> Note: If you'd like to use tsidp to login to a SaaS application outside of your tailnet rather than a self-hosted app inside of your tailnet, you'll need to run tsidp with `--funnel` enabled.
192192

193193
- [Proxmox](docs/proxmox/README.md)
194+
- [Portainer](docs/portainer/README.md)
194195

195196
### TODOs
196197

docs/portainer/README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Portainer setup with tsidp
2+
3+
This doc will cover the OAuth configuration for Portainer using tsidp. If you want a guide on how to setup tsidp, you can check the [Proxmox](../proxmox/README.md) guide.
4+
5+
## Configure Portainer to use tsidp
6+
7+
This example assumes:
8+
- Portainer server: https://portainer.yourtailnet.ts.net:9443
9+
- tsidp instance: https://idp.yourtailnet.ts.net
10+
11+
> NOTE: This guide will use Portainer Business Edition, but the steps can be applied to the Community Edition as well.
12+
13+
14+
### Add a new claim to the Tailscale Access Control
15+
1. **Visit** `https://login.tailscale.com/admin/acls/file`
16+
2. On the Policy JSON, inside the `tsidp` app, add the following `extraClaims` property:
17+
```json
18+
"extraClaims": {
19+
"groups": [
20+
"group_1",
21+
"group_2",
22+
...
23+
]
24+
}
25+
```
26+
It is reccomended to map the group names (`group_1`, `group_2`, ...) to groups inside Portainer to ease the setup process
27+
These groups can be created following the policies you already have configured on Tailscale. If you do not have any policies in place, you can create a single group called `admin` and link all the users to this group.
28+
![Tailscale Access Control](tailscale-access-control.png)
29+
30+
### Register Portainer as a Client in tsidp
31+
32+
1. **Visit** `https://idp.yourtailnet.ts.net` and click "Add New Client"
33+
34+
![Add New Client](add-oidc-client.png)
35+
36+
2. **Configure the client**:
37+
- Add redirect URIs for each way you access Proxmox
38+
- Save the generated Client ID and Client Secret; you'll use these next
39+
40+
![Configure the client](tsidp-multiple-uri-redirects.png)
41+
42+
43+
### Configure the Groups to allow resource access
44+
1. Navigate to User-related → Teams
45+
2. Create a new team. You can call it whatever you want, but, to ease the configuration process, we will call it with the same name we configured on the [Add a new claim to the Tailscale Access Control](#add-a-new-claim-to-the-tailscale-access-control) step.
46+
47+
![Portainer groups view](group-view.png)
48+
49+
3. Go to **Environment-related** -> **Groups** -> on the `Unassigned` group, click on **Manage access**
50+
4. On the **Create access** section, select the group you just created and the role you want to associate to it.
51+
5. Click on **+ Create access**
52+
53+
![Environment group access](environment-group-access.png)
54+
55+
56+
### Configure OpenID Connect in Portainer
57+
58+
1. **Navigate to** Settings → Authentication → **OAuth**
59+
60+
![Configure OAuth](oauth-screen.png)
61+
62+
2. **Set the following options:**
63+
- **Use SSO**: Enabled
64+
- **Hide internal authentication prompt**: Enabled if you want to force SSO, otherwise, disabled.
65+
- **Automatic user provisioning**: Enabled
66+
- **Automatic team membership**: Enabled
67+
- **Claim name**: `groups` - the same we configured on [Add a new claim to the Tailscale Access Control](#add-a-new-claim-to-the-tailscale-access-control)
68+
- **Statically assigned teams**: click on the `add team mapping` button
69+
- **Claim value regex**: `admin` maps to `admin` team
70+
> This step should be repeated for all the groups created on the [Add a new claim to the Tailscale Access Control](#add-a-new-claim-to-the-tailscale-access-control).
71+
- **Default team**: No team
72+
- **Assign admin rights to group(s)**: Enabled
73+
- **claim value regex**: `admin`
74+
75+
3. **Configure the Custom OAuth provider** with these settings:
76+
- **Client ID**: (from tsidp)
77+
- **Client Secret**: (from tsidp)
78+
- **Authorization URL**: `https://idp.yourtailnet.ts.net/authorize`
79+
- **Access token URL**: `https://idp.yourtailnet.ts.net/token`
80+
- **Resource URL**: `https://idp.yourtailnet.ts.net/userinfo`
81+
- **Redirect URL**: `https://portainer.yourtailnet.ts.net:9443`
82+
- **Logout URL**: Blank
83+
- **User identifier**: `username`
84+
- **Scopes**: `openid email profile`
85+
- **Auth style**: `Auto Detect`
86+
87+
![Configured Authenticatin Settings](authentication-settings-finalized.png)
88+
89+
90+
### Test the Authentication
91+
92+
1. **Open an incognito browser window** and navigate to `https://portainer.yourtailnet.ts.net:9443`
93+
94+
2. **Log in with OAuth**
95+
- Authentication should work immediately
96+
- Portainer will auto-create a user account (due to "Automatic user provisioning: enabled")
97+
- You should be able to see all environments configured on your Portainer installation.
98+
99+
![Login with OAuth](login-with-oauth.png)

docs/portainer/add-oidc-client.png

96.5 KB
Loading
920 KB
Loading
333 KB
Loading

docs/portainer/group-view.png

249 KB
Loading
143 KB
Loading

docs/portainer/oauth-screen.png

695 KB
Loading
116 KB
Loading
67.9 KB
Loading

0 commit comments

Comments
 (0)