-
Notifications
You must be signed in to change notification settings - Fork 52
/
restrict-role-secrets.yaml
116 lines (116 loc) · 4.63 KB
/
restrict-role-secrets.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Copyright 2024 Google LLC
#
# This is “Software” that is licensed under the “General Software” section of
# the Service Specific Terms (https://cloud.google.com/terms/service-terms) for
# usage in accordance with the following “Scope of Use”: This file may only be
# used on an Anthos cluster, including any associated ci/cd use. “Anthos
# cluster” is defined as “A Cluster (of any kind) registered to a fleet project
# where the Anthos API is enabled”.
apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sRestrictRoleRules
metadata:
name: cis-k8s-v1.7.1-restrict-role-secrets
labels:
policycontroller.gke.io/bundleName: cis-k8s-v1.7.1
annotations:
policycontroller.gke.io/bundleVersion: 202403.0-preview
policycontroller.gke.io/constraintData: |-
"{
bundleName: 'cis-k8s-v1.7.1',
bundleDisplayName: 'CIS Kubernetes Benchmark v1.7.1',
bundleLink: 'https://cloud.google.com/anthos-config-management/docs/how-to/using-cis-k8s-benchmark',
bundleVersion: '202403.0-preview',
bundleDescription: 'Use the CIS Kubernetes Benchmark 1.7.1 policy bundle with Policy Controller to evaluate the compliance of your cluster resources against the CIS Kubernetes Benchmark, which is a set of recommendations for configuring Kubernetes to support a robust security posture.',
controlNumbers: '[5.1.2]',
severity: 'UNSPECIFIED',
description: 'Restricts the use of secrets in `Roles` and `ClusterRoles`.',
remediation: 'The use of secrets permission in `Roles` and `ClusterRoles` is restricted. Remove all secret rules from your `Roles` and `ClusterRoles`. See "RoleBinding and ClusterRoleBinding" for more information: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding',
minimumTemplateLibraryVersion: '1.15.2',
constraintHash: '18bfe530c0d7097b94831126846b2b5280dcffdbd33039b20c1186d4218f606b'
}"
spec:
enforcementAction: dryrun
match:
excludedNamespaces:
- anthos-identity-service
- cert-manager
- gatekeeper-system
- gke-connect
- gke-gmp-system
- gke-system
- gmp-public
- gmp-system
- kube-system
- apigee
kinds:
- apiGroups:
- rbac.authorization.k8s.io
kinds:
- Role
- ClusterRole
parameters:
disallowedRules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
exemptions:
clusterRoles:
- name: ^anthos-baremetal-operator.+$
regexMatch: true
- name: ^cap-manager-role.+$
regexMatch: true
- name: capi-aggregated-manager-role
- name: ^capi-kubeadm-bootstrap-manager-role.+$
regexMatch: true
- name: ^capi-manager-role.+$
regexMatch: true
- name: cert-manager-cainjector
- name: ^cert-manager-controller.+$
regexMatch: true
- name: cert-manager-controller-challenges
- name: cert-manager-controller-clusterissuers
- name: cert-manager-controller-certificates
- name: cert-manager-controller-issuers
- name: cert-manager-controller-orders
- name: cluster-admin
- name: gkeonprem-p4sa
- name: kube-state-metrics
- name: istiod-gke-system
- name: lifecycle-controllers-deployer
- name: lifecycle-controllers-manager
- name: ^preflightcheck-operator.+$
regexMatch: true
- name: stackdriver-operator
- name: system:controller:clusterrole-aggregation-controller
- name: system:controller:expand-controller
- name: system:controller:generic-garbage-collector
- name: system:controller:namespace-controller
- name: system:controller:persistent-volume-binder
- name: system:kube-controller-manager
- name: vmruntime-vmruntime-manager-role
# for GKE
- name: admin
- name: edit
- name: servicemesh
- name: system:aggregate-to-edit
- name: system:controller:resourcequota-controller
- name: system:gke-common-webhooks
- name: system:glbc-status
- name: metering
- name: gatekeeper-manager-role
- name: system:kubestore-collector
- name: system:cloud-controller-manager
- name: system:cloud-controller-manager
- name: istio-reader-clusterrole-managed
- name: config-management-operator
- name: system:node
- name: resource-group-manager-role
- name: policycontroller
# for Apigee
- name: ^apigee.*$
regexMatch: true