From fbd60207806fd75dbbac2bf032e1af1547cd8aa1 Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Sun, 27 Feb 2022 16:34:34 +0800 Subject: [PATCH] [zh] Translate mapping PSP to PSS page --- .../psp-to-pod-security-standards.md | 341 ++++++++++++++++++ 1 file changed, 341 insertions(+) create mode 100644 content/zh/docs/reference/access-authn-authz/psp-to-pod-security-standards.md diff --git a/content/zh/docs/reference/access-authn-authz/psp-to-pod-security-standards.md b/content/zh/docs/reference/access-authn-authz/psp-to-pod-security-standards.md new file mode 100644 index 0000000000..97f6663629 --- /dev/null +++ b/content/zh/docs/reference/access-authn-authz/psp-to-pod-security-standards.md @@ -0,0 +1,341 @@ +--- +title: 从 PodSecurityPolicy 映射到 Pod 安全性标准 +content_type: concept +weight: 95 +--- + + + + + +下面的表格列举了[PodSecurityPolicy](/zh/docs/concepts/policy/pod-security-policy/) +对象上的配置参数,这些字段是否会变更或检查 Pod 配置,以及这些配置值如何映射到 +[Pod 安全性标准(Pod Security Standards)](/zh/docs/concepts/security/pod-security-standards/) +之上。 + + +对于每个可应用的参数,表格中给出了 +[Baseline](/zh/docs/concepts/security/pod-security-standards/#baseline) 和 +[Restricted](/zh/docs/concepts/security/pod-security-standards/#restricted) +配置下可接受的取值。 +对这两种配置而言不可接受的取值均归入 +[Privileged](/zh/docs/concepts/security/pod-security-standards/#priveleged) +配置下。“无意见”意味着对所有 Pod 安全性标准而言所有取值都可接受。 + + +如果想要了解如何一步步完成迁移,可参阅 +[从 PodSecurityPolicy 迁移到内置的 PodSecurity 准入控制器](/zh/docs/tasks/configure-pod-container/migrate-from-psp/)。 + + + + +## PodSecurityPolicy 规约 {#podsecuritypolicy-spec} + + +下面表格中所列举的字段是 `PodSecurityPolicySpec` 的一部分,是通过 `.spec` +字段路径来设置的。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
从 PodSecurityPolicySpec 字段映射到 Pod Security 标准
PodSecurityPolicySpec类型Pod 安全性标准中对应设置
privileged检查性质Baseline & Restricted: false / 未定义 / nil
defaultAddCapabilities更改性质 & 检查性质需求满足下面的 allallowedCapabilities
allowedCapabilities检查性质 + +

Baseline:下面各项的子集

+
    +
  • AUDIT_WRITE
  • +
  • CHOWN
  • +
  • DAC_OVERRIDE
  • +
  • FOWNER
  • +
  • FSETID
  • +
  • KILL
  • +
  • MKNOD
  • +
  • NET_BIND_SERVICE
  • +
  • SETFCAP
  • +
  • SETGID
  • +
  • SETPCAP
  • +
  • SETUID
  • +
  • SYS_CHROOT
  • +
+ +

Restricted:空 / 未定义 / nil 或包含 NET_BIND_SERVICE 的列表

+
requiredDropCapabilities更改性质 & 检查性质 +

Baseline:无意见

+

Restricted:必须包含 ALL

+
volumes检查性质 +

Baseline除下列取值之外的任何值

+
    +
  • hostPath
  • +
  • *
  • +
+

Restricted:下列取值的子集

+
    +
  • configMap
  • +
  • csi
  • +
  • downwardAPI
  • +
  • emptyDir
  • +
  • ephemeral
  • +
  • persistentVolumeClaim
  • +
  • projected
  • +
  • secret
  • +
+
hostNetwork检查性质Baseline & Restrictedfalse / 未定义 / nil
hostPorts检查性质Baseline & Restricted:未定义 / nil / 空
hostPID检查性质Baseline & Restrictedfalse / 未定义 / nil
hostIPC检查性质Baseline & Restrictedfalse / 未定义 / nil
seLinux更改性质 & 检查性质 +

Baseline & Restricted: + + seLinux.ruleMustRunAs,且 options 如下: +

+
    + +
  • user 未设置("" / 未定义 / nil)
  • +
  • role 未设置("" / 未定义 / nil)
  • +
  • type 未设置或者取值为 container_tcontainer_init_tcontainer_kvm_t 之一
  • +
  • level 是任何取值
  • +
+
runAsUser变更性质 & 检查性质 +

Baseline:任何取值

+

RestrictedruleMustRunAsNonRoot

+
runAsGroup变更性质(MustRunAs)& 检查性质 + 无意见 +
supplementalGroups变更性质 & 检查性质 + 无意见 +
fsGroup变更性质 & 验证性质 + 无意见 +
readOnlyRootFilesystem变更性质 & 检查性质 + 无意见 +
defaultAllowPrivilegeEscalation变更性质 + 无意见(非变更性质) +
allowPrivilegeEscalation变更性质 & 检查性质 + +

只有设置为 false 时才执行变更动作

+

Baseline:无意见

+

Restrictedfalse

+
allowedHostPaths检查性质无意见(volumes 优先)
allowedFlexVolumes检查性质无意见(volumes 优先)
allowedCSIDrivers检查性质无意见(volumes 优先)
allowedUnsafeSysctls检查性质Baseline & Restricted:未定义 / nil / 空
forbiddenSysctls检查性质无意见
allowedProcMountTypes
(alpha feature)
检查性质Baseline & Restricted["Default"] 或者未定义 / nil / 空
runtimeClass
 .defaultRuntimeClassName
变更性质无意见
runtimeClass
 .allowedRuntimeClassNames
检查性质无意见
+ + +## PodSecurityPolicy 注解 {#podsecuritypolicy-annotations} + + +下面表格中所列举的[注解](/zh/docs/concepts/overview/working-with-objects/annotations/) +可以通过 `.metadata.annotations` 设置到 PodSecurityPolicy 对象之上。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
将 PodSecurityPolicy 注解映射到 Pod 安全性标准
PSP 注解类型Pod 安全性标准中对应设置
seccomp.security.alpha.kubernetes.io
/defaultProfileName
变更性质无意见
seccomp.security.alpha.kubernetes.io
/allowedProfileNames
检查性质 + +

Baseline"runtime/default," (其中尾部的逗号允许取消设置)

+

Restricted"runtime/default" (没有尾部逗号)

+

localhost/* 取值对于 Baseline 和 Restricted 都是可接受的

+
apparmor.security.beta.kubernetes.io
/defaultProfileName
变更性质无意见
apparmor.security.beta.kubernetes.io
/allowedProfileNames
检查性质 + +

Baseline"runtime/default," (其中尾部的逗号允许取消设置)

+

Restricted"runtime/default" (没有尾部逗号)

+

localhost/* 取值对于 Baseline 和 Restricted 都是可接受的

+
+