forked from open-cluster-management-io/policy-collection
-
Notifications
You must be signed in to change notification settings - Fork 31
/
policy-idp-sample-github.yaml
95 lines (93 loc) · 3.96 KB
/
policy-idp-sample-github.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# This policy sets up the configuration for applying Github Identity provider to all managed clusters
# in the cluster-set :`authrealm-sample-github-clusterset` and with label authdeployment: sample-github
# This configures the AuthRealm resource as well as the managed-cluster placement rules
# PRE-REQS : The Github OAuth app must have been already created in Github.
# the placeholders CLIENTID and CLIENTSECRET in this file must be replaced with the values from this Github Oauth App
apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
annotations:
policy.open-cluster-management.io/standards: NIST SP 800-53
policy.open-cluster-management.io/categories: CM Configuration Management
policy.open-cluster-management.io/controls: CM-2 Baseline Configuration
name: policy-idp-sample-github
spec:
disabled: false
policy-templates:
- objectDefinition:
apiVersion: policy.open-cluster-management.io/v1
kind: ConfigurationPolicy
metadata:
name: policy-idp-sample-github
spec:
object-templates:
- complianceType: musthave
objectDefinition:
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: controller-manager
name: authrealm-sample-github-ns
- complianceType: musthave
objectDefinition:
apiVersion: cluster.open-cluster-management.io/v1beta2
kind: ManagedClusterSet
metadata:
name: authrealm-sample-github-clusterset
namespace: authrealm-sample-github-ns
- complianceType: musthave
objectDefinition:
apiVersion: cluster.open-cluster-management.io/v1alpha1
kind: Placement
metadata:
name: authrealm-sample-github-placement
namespace: authrealm-sample-github-ns
spec:
predicates:
- requiredClusterSelector:
labelSelector:
matchLabels:
authdeployment: sample-github
- complianceType: musthave
objectDefinition:
apiVersion: cluster.open-cluster-management.io/v1beta2
kind: ManagedClusterSetBinding
metadata:
name: authrealm-sample-github-clusterset
namespace: authrealm-sample-github-ns
spec:
clusterSet: authrealm-sample-github-clusterset
- complianceType: musthave
objectDefinition:
apiVersion: v1
data:
clientSecret: CLIENTSECRET # # Replace with Github OAuth App Client Secret
kind: Secret
metadata:
name: authrealm-sample-github-client-secret
namespace: authrealm-sample-github-ns
type: Opaque
- complianceType: musthave
objectDefinition:
apiVersion: identityconfig.identitatem.io/v1alpha1
kind: AuthRealm
metadata:
name: authrealm-sample-github
namespace: authrealm-sample-github-ns
spec:
identityProviders:
- github:
clientID: CLIENTID # Replace with Github OAuth App Client Id
clientSecret:
name: authrealm-sample-github-client-secret
mappingMethod: add
name: sample-github-idp
type: GitHub
placementRef:
name: authrealm-sample-github-placement
routeSubDomain: sample-github-idp
type: dex
remediationAction: inform
severity: medium
remediationAction: enforce