5.6.6.8. Compliance Operator 用のカスタム SCC の作成
環境によっては、Compliance Operator の api-resource-collector に適切な権限が確実に提供されるように、カスタムの Security Context Constraints (SCC) ファイルを作成する必要があります。
前提条件
-
admin権限がある。
手順
restricted-adjusted-compliance.yamlという名前の YAML ファイルで SCC を定義します。SecurityContextConstraintsオブジェクト定義allowHostDirVolumePlugin: false allowHostIPC: false allowHostNetwork: false allowHostPID: false allowHostPorts: false allowPrivilegeEscalation: true allowPrivilegedContainer: false allowedCapabilities: null apiVersion: security.openshift.io/v1 defaultAddCapabilities: null fsGroup: type: MustRunAs kind: SecurityContextConstraints metadata: name: restricted-adjusted-compliance priority: 301 readOnlyRootFilesystem: false requiredDropCapabilities: - KILL - SETUID - SETGID - MKNOD runAsUser: type: MustRunAsRange seLinuxContext: type: MustRunAs supplementalGroups: type: RunAsAny users: - system:serviceaccount:openshift-compliance:api-resource-collector2 volumes: - configMap - downwardAPI - emptyDir - persistentVolumeClaim - projected - secretSCC を作成します。
$ oc create -n openshift-compliance -f restricted-adjusted-compliance.yaml出力例
securitycontextconstraints.security.openshift.io/restricted-adjusted-compliance created
検証
SCC が作成されたことを確認します。
$ oc get -n openshift-compliance scc restricted-adjusted-compliance出力例
NAME PRIV CAPS SELINUX RUNASUSER FSGROUP SUPGROUP PRIORITY READONLYROOTFS VOLUMES restricted-adjusted-compliance false <no value> MustRunAs MustRunAsRange MustRunAs RunAsAny 30 false ["configMap","downwardAPI","emptyDir","persistentVolumeClaim","projected","secret"]