Red Hat Training
A Red Hat training course is available for RHEL 8
8.4. 使用 RHEL 镜像构建器创建一个预强化的镜像
有了 OpenSCAP 和 RHEL 镜像构建器集成,您可以创建可在虚拟机中部署的预强化镜像。
前提条件
-
您以 root 用户身份或
welder
组成员的身份登录。
流程
使用 TOML 格式创建蓝图,其内容如下:
name = "blueprint_name" description = "blueprint_description" version = "0.0.1" modules = [] groups = [] distro = "" [customizations] [[customizations.user]] name = "scap-security-guide" description = "Admin account" password = secure_password_hash key = ssh-key home = "/home/scap-security-guide" group = ["wheel"] [[customizations.filesystem]] mountpoint = "/tmp" size = "20 GiB" [customizations.openscap] datastream = "/usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml " profile_id = "cis"
启动 OpenSCAP 镜像的构建:
# composer-cli compose start blueprint_name qcow2
其中 blueprint_name 是蓝图名称。
镜像构建就绪后,您可以在部署中使用预先强化的镜像。请参阅创建虚拟机。
验证
在虚拟机中部署预先强化的镜像后,可以执行配置合规性扫描,以验证镜像是否与所选安全配置集一致。
重要
执行配置合规性扫描不能保证系统是合规的。如需更多信息,请参阅配置合规性扫描。
- 使用 SSH 连接到镜像。
运行
oscap
扫描程序。# scap-workbench
在 SCAP Workbench 上:
- 选择您要扫描的系统版本。点 Load content。
- 选择您要扫描的配置集,然后点 Scan。OpenSCAP 检查系统的所有要求。
- 单击 Scan,以使用所选的配置文件扫描您的系统。
- 扫描完成后,点 Show Report。