Skip to content

Commit c4fb8eb

Browse files
authored
Merge pull request openfaas#45 from bo0tzz/main
docs: oidc auth through tsidp
2 parents d9c95c3 + c641a32 commit c4fb8eb

File tree

3 files changed

+169
-0
lines changed

3 files changed

+169
-0
lines changed

omni.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ navigation:
7878
- "using-saml-with-omni/configure-workspace-one-access-for-omni"
7979
- "using-saml-with-omni/how-to-configure-entraid-for-omni"
8080
- "authentication-and-authorization.mdx"
81+
- "oidc-login-with-tailscale.mdx"
8182
- "how-to-manage-acls.mdx"
8283
- "omni-kms-disk-encryption.mdx"
8384
- "rotate-siderolink-join-token"

public/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,7 @@
17341734
]
17351735
},
17361736
"omni/security-and-authentication/authentication-and-authorization",
1737+
"omni/security-and-authentication/oidc-login-with-tailscale",
17371738
"omni/security-and-authentication/how-to-manage-acls",
17381739
"omni/security-and-authentication/omni-kms-disk-encryption",
17391740
"omni/security-and-authentication/rotate-siderolink-join-token"
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
title: OIDC login with Tailscale
3+
---
4+
5+
Tailscale provides seamless OIDC authentication through [tsidp](https://github.com/tailscale/tsidp). When accessing Omni through tailscale, you can make use of this through the following steps.
6+
7+
### Prerequisites
8+
9+
You will need [a tailscale account](https://login.tailscale.com/start) with the MagicDNS and HTTPS certificates features enabled.
10+
11+
### Tailscale setup
12+
13+
Browse to https://login.tailscale.com/admin/acls/file to edit the access controls for your tailnet, and add the following JSON to the grants section:
14+
15+
```json tsidp-grant.json
16+
"grants": [
17+
{
18+
"src": ["*"],
19+
"dst": ["*"],
20+
"app": {
21+
"tailscale.com/cap/tsidp": [
22+
{
23+
"users": ["*"],
24+
"resources": ["*"],
25+
"allow_admin_ui": true,
26+
"allow_dcr": true,
27+
"extraClaims": {
28+
"email_verified": true
29+
},
30+
"includeInUserInfo": true
31+
}
32+
]
33+
}
34+
}
35+
]
36+
```
37+
38+
On https://login.tailscale.com/admin/settings/keys, generate a new auth key. Make sure to select "Reusable" so it can be used for both tsidp and the tailscale reverse proxy we'll use for Omni.
39+
Finally, go to https://login.tailscale.com/admin/dns and note your Tailnet DNS name.
40+
41+
### Prepare deployment
42+
43+
Create a new folder with the following files, replacing secrets and your Tailnet DNS name as needed:
44+
45+
```env .env
46+
TS_AUTHKEY=your-generated-key
47+
OIDC_ISSUER_URL=https://tsidp.your-tailnet.ts.net
48+
```
49+
50+
Generate a private key for Omni:
51+
```bash
52+
gpg --quick-generate-key "Omni (Used for etcd data encryption) how-to-guide@siderolabs.com" rsa4096 cert never
53+
gpg --list-secret-keys
54+
gpg --quick-add-key <fingerprint> rsa4096 encr never
55+
gpg --export-secret-key --armor how-to-guide@siderolabs.com > omni.asc
56+
```
57+
58+
```json serve-config.json
59+
{
60+
"TCP": {
61+
"443": {
62+
"HTTPS": true
63+
},
64+
"8090": {
65+
"HTTPS": true
66+
},
67+
"8100": {
68+
"HTTPS": true
69+
}
70+
},
71+
"Web": {
72+
"omni.your-tailnet.ts.net:443": {
73+
"Handlers": {
74+
"/": {
75+
"Proxy": "http://omni:8080"
76+
}
77+
}
78+
},
79+
"omni.your-tailnet.ts.net:8090": {
80+
"Handlers": {
81+
"/": {
82+
"Proxy": "http://omni:8090"
83+
}
84+
}
85+
},
86+
"omni.your-tailnet.ts.net:8100": {
87+
"Handlers": {
88+
"/": {
89+
"Proxy": "http://omni:8100"
90+
}
91+
}
92+
}
93+
}
94+
}
95+
```
96+
97+
```yaml docker-compose.yml
98+
services:
99+
tsidp:
100+
image: ghcr.io/tailscale/tsidp:latest
101+
environment:
102+
- TAILSCALE_USE_WIP_CODE=1
103+
- TS_HOSTNAME=tsidp
104+
volumes:
105+
- tsidp-data:/var/lib/tsidp
106+
env_file:
107+
- .env
108+
command:
109+
- "--dir=/var/lib/tsidp"
110+
111+
omni-tailscale:
112+
image: tailscale/tailscale:latest
113+
environment:
114+
- TS_SERVE_CONFIG=/config/serve.json
115+
- TS_HOSTNAME=omni
116+
- TS_STATE_DIR=/var/lib/tailscale
117+
env_file:
118+
- .env
119+
volumes:
120+
- ./serve-config.json:/config/serve.json:ro
121+
- ts-state:/var/lib/tailscale
122+
123+
omni:
124+
image: ghcr.io/siderolabs/omni:latest
125+
volumes:
126+
- omni-data:/_out/etcd
127+
- ./omni.asc:/omni.asc:ro
128+
- /dev/net/tun:/dev/net/tun
129+
cap_add:
130+
- NET_ADMIN
131+
command:
132+
- --private-key-source=file:///omni.asc
133+
- --advertised-api-url=https://omni.your-tailnet.ts.net/
134+
- --machine-api-advertised-url=https://omni.your-tailnet.ts.net:8090/
135+
- --advertised-kubernetes-proxy-url=https://omni.your-tailnet.ts.net:8100/
136+
- --siderolink-wireguard-advertised-addr=omni.your-tailnet.ts.net:50180
137+
- --auth-oidc-enabled
138+
- --auth-oidc-provider-url=${OIDC_ISSUER_URL}
139+
- --auth-oidc-client-id=${OIDC_CLIENT_ID}
140+
- --auth-oidc-client-secret=${OIDC_CLIENT_SECRET}
141+
- --auth-oidc-scopes=openid
142+
- --auth-oidc-scopes=profile
143+
- --auth-oidc-scopes=email
144+
- --initial-users=your-user@tsidp.your-tailnet.ts.net
145+
146+
volumes:
147+
tsidp-data:
148+
ts-state:
149+
omni-data:
150+
```
151+
152+
### OIDC client setup
153+
154+
At this point all that's left to do is to set up the OIDC client configuration. Start up only tsidp:
155+
```bash
156+
docker compose up tsidp
157+
```
158+
Then browse to https://tsidp.your-tailnet.ts.net and create a new client. For the redirect URI, use `https://omni.your-tailnet.ts.net/oidc/consume`.
159+
Copy the client ID and secret, and add them to your .env file:
160+
```env .env
161+
...
162+
OIDC_CLIENT_ID=paste-client-id-here
163+
OIDC_CLIENT_SECRET=paste-secret-here
164+
```
165+
166+
Now start up the complete stack with `docker compose up` and browse to https://omni.your-tailnet.ts.net/. You should be prompted to log in with your tailscale user and then taken to the Omni UI.
167+
If login fails, you may need to change the `--initial-users` flag to match the user displayed on the login screen.

0 commit comments

Comments
 (0)