6.11. 使用特定基准评估容器或容器镜像的安全性合规
您可以评估您的容器或容器镜像是否符合特定的安全基线,如操作系统保护配置文件(OSPP)、支付卡行业数据安全标准(PCI-DSS)以及健康保险流通与责任法案(HIPAA)。
注意
oscap-podman
命令从 RHEL 8.2 开始提供。对于RHEL 8.1和8.0,请参阅 Using OpenSCAP for scanning containers in RHEL 8。
先决条件
-
openscap-utils
和scap-security-guide
软件包已安装。 - 有对系统的 root 访问权限。
流程
查找容器或容器镜像的 ID:
-
要查找容器的 ID,请输入
podman ps -a
命令。 -
要查找容器镜像的 ID,请输入
podman images
命令。
-
要查找容器的 ID,请输入
评估容器或容器镜像是否符合配置文件,并将扫描结果保存到一个文件中:
oscap-podman <ID> xccdf eval --report <scan-report.html> --profile <profileID> /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
# oscap-podman <ID> xccdf eval --report <scan-report.html> --profile <profileID> /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 替换:
-
使用容器或容器镜像的 ID 替换
<ID>
-
使用
oscap
保存扫描结果的文件名替换<scan-report.html>
-
使用系统应该遵循的配置文件 ID 替换
<profileID>
,例如hipaa
、ospp
或pci-dss
-
使用容器或容器镜像的 ID 替换
验证
在您选择的浏览器中检查结果,例如:
firefox <scan-report.html> &
$ firefox <scan-report.html> &
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
注意
标记为 notapplicable
的规则仅适用于裸机和虚拟化系统,不适用于容器或容器镜像。