7.3. 配置合规性扫描

7.3.1. RHEL 中的配置合规性

您可以使用配置合规性扫描来遵循特定组织定义的基准。例如,如果您与美国政府合作,您可能需要使您的系统与操作系统保护配置文件(OSPP)保持一致,如果您是一个支付处理器,您可能需要使您的系统与支付卡行业数据安全标准(PCI-DSS)保持一致。您还可以执行配置合规性扫描来强化您的系统安全。

红帽建议您遵循 SCAP 安全指南软件包中提供的安全内容自动化协议(SCAP)的内容,因为它符合红帽针对受影响组件的最佳实践。

SCAP 安全指南软件包提供了符合 SCAP 1.2 和 SCAP 1.3 标准的内容。openscap 扫描器实用程序与SCAP安全指南包中提供的SCAP 1.2和SCAP 1.3内容兼容。

重要

执行配置合规性扫描不能保证系统是合规的。

SCAP 安全指南套件以数据流文档的形式为多个平台提供配置文件。数据流是包含定义、基准、配置文件和单个规则的文件。每条规则都规定了合规的适用性和要求。RHEL 提供多个配置文件来遵守安全策略。除了行业标准之外,红帽数据流还包含用于修复失败规则的信息。

合规性扫描资源的结构

Data stream
   ├── xccdf
   |      ├── benchmark
   |            ├── profile
   |            |    ├──rule reference
   |            |    └──variable
   |            ├── rule
   |                 ├── human readable data
   |                 ├── oval reference
   ├── oval          ├── ocil reference
   ├── ocil          ├── cpe reference
   └── cpe           └── remediation

配置文件是基于安全策略的一组规则,如 OSPP、PCI-DSS 和健康保险可移植性和责任法案(HIPAA)。这可让您以自动化的方式审核系统,以符合安全标准。

您可以修改(定制)配置文件来自定义某些规则,例如密码长度。有关配置文件定制的更多信息,请参阅 使用 SCAP Workbench 自定义安全配置文件

7.3.2. OpenSCAP 扫描的可能结果

根据应用到 OpenSCAP 扫描的数据流和配置文件,以及系统的各种属性,每个规则可能会产生一个特定的结果。以下是可能的结果,以及其含义的简要解释:

Pass
扫描没有发现与此规则有任何冲突。
Fail
扫描发现与此规则有冲突。
Not checked
OpenSCAP 对此规则不执行自动评估。手动检查您的系统是否符合此规则。
Not applicable
此规则不适用于当前配置。
Not selected
此规则不是配置文件的一部分。OpenSCAP 不评估此规则,也不会在结果中显示这些规则。
Error
扫描遇到了错误。要获得更多信息,您可以输入带有 --verbose DEVEL 选项的 oscap 命令。考虑打开 bug 报告
Unknown
扫描遇到了意外情况。要获得更多信息,您可以输入带有 '--verbose DEVEL 选项的 oscap 命令。考虑打开 bug 报告

7.3.3. 查看配置文件是否符合配置合规

在决定使用配置文件进行扫描或补救前,您可以使用 oscap info 子命令列出它们并检查其详细描述。

前提条件

  • openscap-scannerscap-security-guide 软件包已安装。

流程

  1. 列出 SCAP 安全指南项目所提供的带有安全合规配置文件的所有可用文件:

    $ ls /usr/share/xml/scap/ssg/content/
    ssg-rhel9-ds.xml
  2. 使用 oscap info 子命令显示有关所选数据流的详细信息。包含数据流的 XML 文件由其名称中的 -ds 字符串表示。在 Profiles 部分,您可以找到可用的配置文件及其 ID 列表:

    $ oscap info /usr/share/xml/scap/ssg/content/ssg-rhel9-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 9
        Id: xccdf_org.ssgproject.content_profile_pci-dss
    ...
  3. 从数据流文件中选择一个配置文件,并显示所选配置文件的更多详情。为此,可使用带有 --profile 选项的 oscap info ,后跟上一命令输出中显示的 ID 的最后一部分。例如,HIPPA 配置文件的 ID 是: xccdf_org.ssgproject.content_profile_hipaa--profile 选项的值为 hipaa

    $ oscap info --profile hipaa /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml
    ...
    Profile
    	Title: [RHEL9 DRAFT] Health Insurance Portability and Accountability Act (HIPAA)
    	Id: xccdf_org.ssgproject.content_profile_hipaa
    
    	Description: The HIPAA Security Rule establishes U.S. national standards to protect individuals’ electronic personal health information that is created, received, used, or maintained by a covered entity. The Security Rule requires appropriate administrative, physical and technical safeguards to ensure the confidentiality, integrity, and security of electronic protected health information.  This profile configures Red Hat Enterprise Linux 9 to the HIPAA Security Rule identified for securing of electronic protected health information. Use of this profile in no way guarantees or makes claims against legal compliance against the HIPAA Security Rule(s).

其他资源

7.3.4. 评估配置是否符合特定基准

要确定您的系统是否符合特定基准,请按照以下步骤操作:

前提条件

  • openscap-scannerscap-security-guide 软件包已安装
  • 您知道系统应遵守的基准中的配置文件的 ID。要查找 ID,请参阅 查看配置合规性配置文件

步骤

  1. 使用所选配置文件评估系统的合规性,并将扫描结果保存在 report.html HTML 文件中,例如:

    $ oscap xccdf eval --report report.html --profile hipaa /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml
  2. 可选:使用 machine1 主机名、在端口 22 上运行的 SSH 扫描远程系统,以及 joesec 用户名合规性,并将结果保存到 remote-report.html 文件中:

    $ oscap-ssh joesec@machine1 22 xccdf eval --report remote_report.html --profile hipaa /usr/share/xml/scap/ssg/content/ssg-rhel9-ds.xml

其他资源

  • scap-security-guide(8) man page
  • /usr/share/doc/scap-security-guide/ 目录中的 SCAP 安全指南 文档
  • /usr/share/doc/scap-security-guide/guides/ssg-rhel9-guide-index.html - [Red Hat Enterprise Linux 9 的安全配置指南]与 scap-security-guide-doc 软件包一起安装
  • OpenSCAP 内存消耗问题