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


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

先决条件

  • openscap-scanner 已安装在您的系统上。
  • scap-security-guide 软件包安装在您的系统中,软件包版本与您要安装的 RHEL 版本对应。如需更多信息,请参阅 RHEL 中的 SCAP 安全指南支持的版本。使用不同的版本可能会导致冲突。

    注意

    如果您的系统有与要安装的版本相同的 RHEL 版本,您可以直接安装 scap-security-guide 软件包。

流程

  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
    …
    Copy to Clipboard
  2. 可选:如果要使用 XCCDF Tailoring 文件自定义强化,您可以使用 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
    Copy to Clipboard

    如果您使用定制文件,请使用-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
    Copy to Clipboard
  4. 检查,如果需要,手动修改生成的 < kickstart_file>.cfg,以满足您的部署需求。按照文件中注释中的说明进行操作。

    注意

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

  5. 使用 kickstart 文件进行安装。要让安装程序使用 kickstart,可以通过 Web 服务器(在 PXE 中提供或嵌入到 ISO 镜像中)提供 kickstart。具体步骤请查看 自动安装 RHEL 文档中的 完全和半自动化 章节。
  6. 安装完成后,系统会自动重启。重新引导后,登录并查看保存在 /root 目录中的安装 SCAP 报告。

验证

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

    • 使用原始配置集:

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

      # oscap xccdf eval --report report.html --tailoring-file tailoring.xml --profile <custom_profile_ID> /usr/share/xml/scap/ssg/content/ssg-rhel10-ds.xml
      Copy to Clipboard
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat