5.4. 使用 Kickstart 执行 RHEL 的强化安装


要使您的系统符合特定安全配置文件,如 DISA STIG、CIS 或 ANSSI,您可以准备定义强化配置的 Kickstart 文件,使用定制文件自定义它,并运行强化系统的自动安装。

先决条件

  • openscap-scanner 已安装在您的系统上。
  • scap-security-guide 软件包安装在您的系统中,软件包版本与您要安装的 RHEL 版本对应。因为所有支持的 RHEL 版本都使用相同的 SCAP 安全指南版本,请在生成 Kickstart 文件前更新软件包。

流程

  1. 从数据流文件中找到安全配置文件的 ID:

    $ oscap info /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
    Profiles:
    …
      Title: Australian Cyber Security Centre (ACSC) Essential Eight
    	Id: xccdf_org.ssgproject.content_profile_e8
      Title: Health Insurance Portability and Accountability Act (HIPAA)
    	Id: xccdf_org.ssgproject.content_profile_hipaa
      Title: PCI-DSS v3.2.1 Control Baseline for Red Hat Enterprise Linux 10
    	Id: xccdf_org.ssgproject.content_profile_pci-dss
    …
  2. 可选:如果要使用 XCCDF 定制文件自定义强化,您可以使用 openscap-utils 软件包提供的 autotailor 命令。如需更多信息,请参阅 使用 autotailor 自定义安全配置文件
  3. 从 SCAP 源数据流生成 Kickstart 文件:

    $ oscap xccdf generate fix --profile <profile_ID> --output <kickstart_file>.cfg --fix-type kickstart /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml

    + 将 <profile_ID > 替换为系统应该遵守的配置集 ID,例如 hipaa

    + 如果您使用定制文件,请使用-tailoring -file tailoring.xml 选项和自定义配置集 ID 将定制文件嵌入到生成的 Kickstart 文件中,例如:

    +

$ *oscap xccdf generate fix --tailoring-file tailoring.xml --profile _<custom_profile_ID>_ --output _<kickstart_file>_.cfg --fix-type kickstart ./ssg-rhel10-ds.xml*
  1. 进行检查,如果需要,手动修改生成的 <kickstart_file>.cfg,以适应您的部署需求。按照文件中的注释中的说明进行操作。

    注意

    有些更改可能会影响 Kickstart 文件安装的系统的合规性。例如,一些安全策略需要定义的分区或特定的软件包和服务。

  2. 使用 Kickstart 文件进行安装。要让安装程序使用 Kickstart,Kickstart 可以通过 web 服务器提供、在 PXE 中提供或嵌入到 ISO 镜像中。具体步骤请查看 自动安装 RHEL 文档中的 Semi-automated 安装:使 RHEL 安装程序可以使用的 Kickstart 文件 部分。
  3. 安装完成后,系统会自动重启。重启后,登录并查看保存在 /root 目录中的安装 SCAP 报告。

验证

  • 扫描系统的合规性,并将报告保存到 HTML 文件中以便查看:

    • 使用原始配置文件:

      # oscap xccdf eval --report report.html --profile <profile_ID> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
    • 使用定制配置文件:

      # oscap xccdf eval --report report.html --tailoring-file tailoring.xml --profile <custom_profile_ID> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部