Skip to content

Commit 7278345

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

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-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: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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 Omni with the following parameter:
12+
13+
```
14+
--auth-saml-label-rules='{"membership" : "groups" }'
15+
```
16+
17+
This will extract value from the SAML attribute `memberhip` into the Omni user's identity resource label with the
18+
prefix `saml.omni.sidero.dev/groups`
19+
Restart Omni, and log in using SAML. If you navigate to <b>Settings > Users</b>, you will now see your groups in a label.
20+
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`)
21+
22+
```yaml
23+
groups/group1
24+
groups/group2
25+
```
26+
27+
You can now create an ACL that will create an impersonation in Kubernetes using this group information:
28+
29+
```yaml
30+
31+
metadata:
32+
namespace: default
33+
type: AccessPolicies.omni.sidero.dev
34+
id: access-policy
35+
spec:
36+
usergroups:
37+
group1:
38+
users:
39+
- labelselectors:
40+
- "saml.omni.sidero.dev/groups/group1=" --< Do not forget the `=` sign postfix
41+
clustergroups:
42+
staging:
43+
clusters:
44+
- match: staging-*
45+
production:
46+
clusters:
47+
- match: prod-*
48+
rules:
49+
- users:
50+
- groups/group1
51+
clusters:
52+
- group/staging
53+
- group/production
54+
kubernetes:
55+
impersonate:
56+
groups:
57+
- group1
58+
```
59+
60+
The impersonate rule will make sure that you will have the right group assigned in kubernetes.
61+
You can then use that information in a RoleBinding:
62+
63+
```yaml
64+
apiVersion: rbac.authorization.k8s.io/v1
65+
kind: RoleBinding
66+
metadata:
67+
name: group1-access
68+
namespace: group1
69+
roleRef:
70+
apiGroup: rbac.authorization.k8s.io
71+
kind: ClusterRole
72+
name: admin <--- or any other ClusterRole of course.
73+
subjects:
74+
- apiGroup: rbac.authorization.k8s.io
75+
kind: Group
76+
name: group1
77+
```
78+

0 commit comments

Comments
 (0)