Skip to content

Commit 704b5c3

Browse files
committed
docs: add information on how to reuse SAML group information in Kubernetes
1 parent 347a464 commit 704b5c3

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

omni.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ navigation:
8787
- "using-saml-with-omni/configure-unifi-identity-enterprise-for-omni"
8888
- "using-saml-with-omni/configure-workspace-one-access-for-omni"
8989
- "using-saml-with-omni/how-to-configure-entraid-for-omni"
90+
- "using-saml-with-omni/use-saml-groups-in-kubernetes"
9091
- "authentication-and-authorization.mdx"
9192
- "oidc-login-with-tailscale.mdx"
9293
- "how-to-manage-acls.mdx"

public/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,8 @@
21962196
"omni/security-and-authentication/using-saml-with-omni/auto-assign-roles-to-saml-users",
21972197
"omni/security-and-authentication/using-saml-with-omni/configure-unifi-identity-enterprise-for-omni",
21982198
"omni/security-and-authentication/using-saml-with-omni/configure-workspace-one-access-for-omni",
2199-
"omni/security-and-authentication/using-saml-with-omni/how-to-configure-entraid-for-omni"
2199+
"omni/security-and-authentication/using-saml-with-omni/how-to-configure-entraid-for-omni",
2200+
"omni/security-and-authentication/using-saml-with-omni/use-saml-groups-in-kubernetes"
22002201
]
22012202
},
22022203
"omni/security-and-authentication/authentication-and-authorization",
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: Use SAML groups information in Kubernetes
3+
---
4+
5+
6+
The procedure below describes how you can reuse SAML group information in Kubernetes for authorization.
7+
8+
Omni can extract SAML group information. For each group it will create a label on the identity in Omni.
9+
10+
Suppose you have your groups information in the SAML attribute "membership".
11+
Start the Omni container with the following flags.
12+
13+
14+
| Flag | Description |
15+
| ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
16+
| `--auth-saml-enabled` | Enable SAML authentication. |
17+
| `--auth-saml-url` | The URL to the IdP metadata file. |
18+
| `--auth-saml-label-rules='{"membership": "groups"}'` | This extracts the `membership` attribute from the SAML assertion into the label `saml.omni.sidero.dev/groups/groups` |
19+
20+
For example:
21+
22+
```bash
23+
--auth-saml-enabled=true
24+
--auth-saml-url=https://{your-saml-idp}/metadata/idp.xml
25+
--auth-saml-label-rules='{"membership": "groups"}'
26+
```
27+
28+
```
29+
--auth-saml-label-rules='{"membership" : "groups" }'
30+
```
31+
32+
This will extract value from the SAML attribute `memberhip` into the Omni user's identity resource label with the
33+
prefix `saml.omni.sidero.dev/groups`
34+
Restart Omni, and log in using SAML. If you navigate to <b>Settings > Users</b>, you will now see your groups in a label.
35+
If your SAML attribute memberships contains the values `group1` and `group2` you will see the following two labels (the interface omits the prefix `saml.omni.sidero.dev`)
36+
37+
```yaml
38+
groups/group1
39+
groups/group2
40+
```
41+
42+
You can now create an ACL that will create an impersonation in Kubernetes using this group information:
43+
44+
```yaml
45+
46+
metadata:
47+
namespace: default
48+
type: AccessPolicies.omni.sidero.dev
49+
id: access-policy
50+
spec:
51+
usergroups:
52+
group1:
53+
users:
54+
- labelselectors:
55+
- "saml.omni.sidero.dev/groups/group1=" --< Do not forget the `=` sign postfix
56+
clustergroups:
57+
staging:
58+
clusters:
59+
- match: staging-*
60+
production:
61+
clusters:
62+
- match: prod-*
63+
rules:
64+
- users:
65+
- groups/group1
66+
clusters:
67+
- group/staging
68+
- group/production
69+
kubernetes:
70+
impersonate:
71+
groups:
72+
- group1
73+
```
74+
75+
The impersonate rule will make sure that you will have the right group assigned in kubernetes.
76+
You can then use that information in a RoleBinding:
77+
78+
```yaml
79+
apiVersion: rbac.authorization.k8s.io/v1
80+
kind: RoleBinding
81+
metadata:
82+
name: group1-access
83+
namespace: group1
84+
roleRef:
85+
apiGroup: rbac.authorization.k8s.io
86+
kind: ClusterRole
87+
name: admin <--- or any other ClusterRole of course.
88+
subjects:
89+
- apiGroup: rbac.authorization.k8s.io
90+
kind: Group
91+
name: group1
92+
```
93+

0 commit comments

Comments
 (0)