资讯动态

RHEL 8 - CIS安全合规基线、SCAP、SSG和合规扫描、漏洞扫描

发布时间:2026/10/14 3:50:10 来源:尧图企业网站定制
《OpenShift 4.x HOL教程汇总》文章目录CIS互联网安全中心SCAP安全内容自动化协议SCAP Security Guide - SSG安装 SCAP Security Guide了解 SCAP Security Guide 中包含的内容用 OpenSCAP 进行 CIS 合规扫描查看 DataStream 文件包含的 ProfileCIS 合规扫描全面扫描局部扫描使用本地 oval 文件扫描查看 CIS 合规扫描结果了解 SSG DS 定义文件内容。定制 CIS 基线扫描指标修复不符合合规基线的项目直接修复生成修复 Ansible 剧本转换文件分解 DataStream 文件将 XCCDF 文档从适合机器处理的XML格式转为适合人工查看的HTML格式用 OpenSCAP 进行 OVAL 安全漏洞扫描参考CIS互联网安全中心CIS互联网安全中心提供各种网络安全相关服务它制作了各种安全基准以保护系统免受不断变化的安全威胁。CIS 基准是目标系统安全配置的最佳实践。CIS 基准适用于 25 多个供应商产品系列的 100 多个 CIS 基准是通过由全球网络安全专业人员和主题专家组成的独特的基于共识的流程开发的。CIS 基准是唯一一种基于共识的最佳实践安全配置指南已被政府、企业、行业和学术界开发和接受。这些基准以 PDF 的形式免费提供给 CIS 成员PDF 中的内容是可读的但不能直接被扫描工具使用。CIS 为付费会员提供了一些 XCCDF1 格式的基准可以被工具使用不过这些基准不包含改变服务器状态以达到合规性所需的自动化和补救步骤。CIS 基准包括多种 Profile 配置1 级 Profile是一个基本建议可以相当迅速地实施其设计不会对性能产生广泛影响。1 级 Profile 基准的目的是降低企业的攻击面同时保持机器的可用性不妨碍业务功能。2 级 Profile是 深度防御级别建议旨在为安全至关重要的环境服务。如果不适当地或不谨慎地实施与 2 级 Profile 相关的建议会对你的组织产生不利影响。STIG Profile取代了以前的 3 级。STIG Profile 提供了所有针对 STIG 的建议。其他 Profile 即1级和2级中的建议的重叠部分在 STIG Profile 中也有适用。SCAP安全内容自动化协议安全内容自动化协议 (SCAP) 由 NIST 组织制定的一套信息安全评估标准体系。SCAP安全指南实施了由权威机构 PCI DSSSTIG 和 USGCB推荐的安全指南。SCAP 安全指南将这些安全指南转换为机器可读的格式可以使用它来审核目标系统。SCAP 由两部分组成Protocol协议与Content内容。Protocol 是指 SCAP 由一系列现有的公开标准构成这些公开标准被称为 SCAP ElementSCAP元素。Protocol 规范了这些 Element 之间如何协同工作Content 指按照 Protocol 的约定利用 Element 描述生成的应用于实际检查工作的数据。SCAP标准包含以下组件XCCDFOVALDataStreamARFCPECVECWE。XCCDF-可扩展配置清单描述格式。该语言用于描述安全检查表文档生成组织和定制合规情境自动合规性测试以及合规性评分。在评估XCCDF基准时通常会处理 XCCDF文件OVAL 文件和 CPE 词典。OVAL-开放漏洞和评估语言。它用来描述系统的安全漏洞或所需的配置。OVAL 定义了计算机中某些对象的安全状态例如配置文件、文件权限、进程。OVAL定义是通过 scanner 解释器进行评估的。CPE-通用平台枚举。CPE用来描述漏洞影响了什么组件的什么版本是信息技术系统软件和程序包的结构化命名方案。CVE-通用漏洞和披露。它是公开披露的安全漏洞列表。CWE-通用弱点列举。它是由 MITRE 公司支持的用来描述已知的安全弱点和缺陷。CWE 提供了关于预防、实施和缓解弱点的信息。DataStream-是一种将其他 SCAP 组件打包到一个文件中的格式。因为单个文件更易于处理所以RedHat建议使用 DataStream。ARF-资产报告格式。它合并了多个结果文件OVAL 结果和 XCCDF 结果通常也称为 Result DataStream。SCAP Security Guide - SSG为了实现自动化安全基线扫描Red Hat 向用户提供“scap-security-guidelines”软件包包含了基于SCAP的基准扫描合规性、自动化修复所需内容openscap-scanner: 基于 SCAP 的命令扫描工具。scap-security-guide: 是 SCAP 的内容包含定义合规 Profile 以及补救修复所需的文件如红帽 Ansible 自动化平台 Playbook 或 Bash 脚本。scap-workbench: 基于 SCAP 的图形界面扫描工具。其中安全合规 Profile、修复执行脚本通过 SSG 构建系统构建成“scap-security-guidelines”软件包。在 SSG 中红帽推荐使用 DataStream它是一种 XML 文件可将其他SCAP组件打包成一个文件。这在分发 SCAP 内容时很有用因为单个文件更容易处理。如果想对本地系统进行配置或漏洞扫描那么必须具备以下条件一个工具oscap 或 SCAP WorkbenchSCAP 内容可以是 DataStream、XCCDF、OVAL三种格式安装 SCAP Security Guide如果没有配置 RHEL 的 Yum Repo可以参考《RHEL 8 - 配置基于安装 ISO 文件的 YUM Repo》配置 Yum。以下使用的是 RHEL 8.4 的 ISO 作为 Yum Repo。scap-security-guide 运行所需要的包有以下三个文件$ ll /mnt/rhel8/AppStream/Packages/scap* -r--r--r--.449root root8093716Feb172021/mnt/rhel8/AppStream/Packages/scap-security-guide-0.1.54-5.el8.noarch.rpm -r--r--r--.449root root6226080Feb172021/mnt/rhel8/AppStream/Packages/scap-security-guide-doc-0.1.54-5.el8.noarch.rpm -r--r--r--.116root root1940900Feb122021/mnt/rhel8/AppStream/Packages/scap-workbench-1.2.0-8.el8.x86_64.rpm然后运行以下命令可在安装相关的 OpenSCAP 组件分别是扫描工具 “openscap-scanner” 、SCAP 内容 “scap-security-guide” 和 SCAP 内容的说明文档 “scap-security-guide-doc”。$ yuminstallopenscap-scanner scap-security-guide scap-security-guide-doc另外还可从 https://access.redhat.com/downloads 中查找对应 RHEL 版本的 “scap-security-guide” 相关的软件包。我们还可以单独下载 “scap-security-guide”。由于不同版本的 RHEL 对应不同的 “scap-security-guide” 可从 https://access.redhat.com/articles/6337261 中查找特定版本 RHEL 对应的 “scap-security-guide” 。然后可从 https://github.com/ComplianceAsCode/content/releases 中下载对应版本的 scap-security-guide 打包文件。注意在 https://github.com/ComplianceAsCode/content/releases 下载的 scap-security-guide 包含更全的内容除了包含 RHEL 外还包含其他各种常用 Linux 甚至还包含 RHCOS 的内容。了解 SCAP Security Guide 中包含的内容在 OpenSCAP 的 “scap-security-guide” 目录中提供了用于自动化检查和修复的脚本其中包含 Ansible Playbook、Bash Shell 和 Anaconda Kickstart 三种类型的脚本。其中 Ansible 脚本支持 check-mode 和 run-mode 两种模式分别用来进行检查合规和设置修复合规配置而 Bash Shell 脚本用来设置修复合规配置部分修复是由 Shell 脚本。$ ll /usr/share/scap-security-guide total12drwxr-xr-x.2root root4096Feb1109:58 ansible drwxr-xr-x.2root root4096Feb1109:58bashdrwxr-xr-x.2root root4096Feb1109:58 kickstart使用 OpenSCAP 可以对目标进行合规基线检查其中除了 RHEL 6/7/8 外还支持对 JRE 等软件进行检查。合规检查的方法和项目在以下文件中有描述。每个文件名在 “ssg-XXXXXX” 后面是不同的合规检查描述规范。$ls/usr/share/xml/scap/ssg/content ssg-firefox-cpe-dictionary.xml ssg-jre-cpe-dictionary.xml ssg-rhel6-cpe-dictionary.xml ssg-rhel7-cpe-dictionary.xml ssg-rhel8-cpe-dictionary.xml ssg-firefox-cpe-oval.xml ssg-jre-cpe-oval.xml ssg-rhel6-cpe-oval.xml ssg-rhel7-cpe-oval.xml ssg-rhel8-cpe-oval.xml ssg-firefox-ds-1.2.xml ssg-jre-ds-1.2.xml ssg-rhel6-ds-1.2.xml ssg-rhel7-ds-1.2.xml ssg-rhel8-ds-1.2.xml ssg-firefox-ds.xml ssg-jre-ds.xml ssg-rhel6-ds.xml ssg-rhel7-ds.xml ssg-rhel8-ds.xml ssg-firefox-ocil.xml ssg-jre-ocil.xml ssg-rhel6-ocil.xml ssg-rhel7-ocil.xml ssg-rhel8-ocil.xml ssg-firefox-oval.xml ssg-jre-oval.xml ssg-rhel6-oval.xml ssg-rhel7-oval.xml ssg-rhel8-oval.xml ssg-firefox-xccdf.xml ssg-jre-xccdf.xml ssg-rhel6-xccdf.xml ssg-rhel7-xccdf.xml ssg-rhel8-xccdf.xml查看说明 SCAP 内容的指导描述文档可以看到 SSG 为每类合规检查对象提供了哪些检查 Profile。$ls/usr/share/doc/scap-security-guide/guides/ ssg-firefox-guide-default.html ssg-rhel6-guide-stig.html ssg-rhel7-guide-rhelh-stig.html ssg-firefox-guide-index.html ssg-rhel6-guide-usgcb-rhel6-server.html ssg-rhel7-guide-rhelh-vpp.html ssg-firefox-guide-stig.html ssg-rhel6-PCIDSS-RHEL-6-guide-default.html ssg-rhel7-guide-rht-ccp.html ssg-jre-guide-default.html ssg-rhel6-PCIDSS-RHEL-6-guide-pci-dss_centric.html ssg-rhel7-guide-standard.html ssg-jre-guide-index.html ssg-rhel7-guide-anssi_nt28_enhanced.html ssg-rhel7-guide-stig.html ssg-jre-guide-stig.html ssg-rhel7-guide-anssi_nt28_high.html ssg-rhel7-PCIDSS-RHEL-7-guide-default.html ssg-rhel6-guide-C2S.html ssg-rhel7-guide-anssi_nt28_intermediary.html ssg-rhel7-PCIDSS-RHEL-7-guide-pci-dss_centric.html ssg-rhel6-guide-CS2.html ssg-rhel7-guide-anssi_nt28_minimal.html ssg-rhel8-guide-anssi_bp28_enhanced.html ssg-rhel6-guide-CSCF-RHEL6-MLS.html ssg-rhel7-guide-C2S.html ssg-rhel8-guide-anssi_bp28_intermediary.html ssg-rhel6-guide-default.html ssg-rhel7-guide-cis.html ssg-rhel8-guide-anssi_bp28_minimal.html ssg-rhel6-guide-desktop.html ssg-rhel7-guide-cjis.html ssg-rhel8-guide-cis.html ssg-rhel6-guide-fisma-medium-rhel6-server.html ssg-rhel7-guide-cui.html ssg-rhel8-guide-cui.html ssg-rhel6-guide-ftp-server.html ssg-rhel7-guide-default.html ssg-rhel8-guide-default.html ssg-rhel6-guide-index.html ssg-rhel7-guide-e8.html ssg-rhel8-guide-e8.html ssg-rhel6-guide-nist-CL-IL-AL.html ssg-rhel7-guide-hipaa.html ssg-rhel8-guide-hipaa.html ssg-rhel6-guide-pci-dss.html ssg-rhel7-guide-index.html ssg-rhel8-guide-index.html ssg-rhel6-guide-rht-ccp.html ssg-rhel7-guide-ncp.html ssg-rhel8-guide-ospp.html ssg-rhel6-guide-server.html ssg-rhel7-guide-ospp.html ssg-rhel8-guide-pci-dss.html ssg-rhel6-guide-standard.html ssg-rhel7-guide-pci-dss.html ssg-rhel8-guide-stig.html在浏览器中打开 “ssg-rhel8-guide-cis.html” 文件可以在下图的描述中查看该文档对应的是哪种 Profile。在 Profile 的说明中检查项目和规则被分为若干大类见下图。注意下图中 SSG 对 CIS 的项目分类和 CIS 官方分类有区别在本文后面介绍如何对合规结果按照 CIS 的分类重新排序项目指标。为了了解 “ssg-rhel8-guide-cis.html” 文档的内容可以在文档中找到名为 “Set Lockouts for Failed Password Attempts” 的 Group如下图的组包含3个规则截图有限只显示了 1 个规则。在上图下方的 References 区域是使用该规则所有的合规项目其中 “5.4.3” 会链接到 CIS。我们可以在 CIS 网站获得《CIS RHEL 8 Benchmark》文档并确认编号 “5.4.3” 的内容也是限制用户密码重用的规则。注意在上面 SSG 的 ssg-rhel8-guide-cis.html 文件中使用的引用的 CIS 编号是和 SSG 的版本以及 CIS 的版本相关。两者的版本如果不兼容则无法对应上。注意无论在 ssg-rhel8-guide-cis.html 文件中还是在《CIS RHEL 8 Benchmark》文档中都提供了项目的修复代码但两者的代码有一定差异。还可在 ssg-rhel8-guide-cis.html 中查找 Rule ID 为 “xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny” 的规则它对应的是上图中 CIS 为 “5.4.2” 的条目。用 OpenSCAP 进行 CIS 合规扫描查看 DataStream 文件包含的 Profile执行命令查看 ssg-rhel8-ds.xml 中支持包含的 Profile其中有一个的 Title 为 “CIS Red Hat Enterprise Linux 8 Benchmark”。另外从 Id 名称可以知道该 Data Stream 中所有 Profile 使用的是 XCCDF 格式定义的。$ oscap info /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml Document type: Source Data Stream Imported:2021-02-17T10:44:54 Stream: scap_org.open-scap_datastream_from_xccdf_ssg-rhel8-xccdf-1.2.xml Generated:(null)Version:1.3Checklists: Ref-Id: scap_org.open-scap_cref_ssg-rhel8-xccdf-1.2.xml WARNING: Datastream componentscap_org.open-scap_cref_security-data-oval-com.redhat.rhsa-RHEL8.xmlpoints out to the remotehttps://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml.Use--fetch-remote-resourcesoption to download it. WARNING: Skippinghttps://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xmlfilewhichis referenced from datastream Status: draft Generated:2021-02-17 Resolved:trueProfiles: Title: ANSSI-BP-028(enhanced)Id: xccdf_org.ssgproject.content_profile_anssi_bp28_enhanced Title: ANSSI-BP-028(intermediary)Id: xccdf_org.ssgproject.content_profile_anssi_bp28_intermediary Title: ANSSI-BP-028(minimal)Id: xccdf_org.ssgproject.content_profile_anssi_bp28_minimal Title: CIS Red Hat Enterprise Linux8Benchmark Id: xccdf_org.ssgproject.content_profile_cis Title: Unclassified InformationinNon-federal Information Systems and Organizations(NIST800-171)Id: xccdf_org.ssgproject.content_profile_cui 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: Protection ProfileforGeneral Purpose Operating Systems Id: xccdf_org.ssgproject.content_profile_ospp Title: PCI-DSS v3.2.1 Control BaselineforRed Hat Enterprise Linux8Id: xccdf_org.ssgproject.content_profile_pci-dss Title: DISA STIGforRed Hat Enterprise Linux8Id: xccdf_org.ssgproject.content_profile_stig Referenced check files: ssg-rhel8-oval.xml system: http://oval.mitre.org/XMLSchema/oval-definitions-5 ssg-rhel8-ocil.xml system: http://scap.nist.gov/schema/ocil/2 security-data-oval-com.redhat.rhsa-RHEL8.xml system: http://oval.mitre.org/XMLSchema/oval-definitions-5 Checks: Ref-Id: scap_org.open-scap_cref_ssg-rhel8-oval.xml Ref-Id: scap_org.open-scap_cref_ssg-rhel8-ocil.xml Ref-Id: scap_org.open-scap_cref_ssg-rhel8-cpe-oval.xml Ref-Id: scap_org.open-scap_cref_security-data-oval-com.redhat.rhsa-RHEL8.xml Dictionaries: Ref-Id: scap_org.open-scap_cref_ssg-rhel8-cpe-dictionary.xml可以注意到上面有 “WARNING” 提示这是因为 ssg-rhel8-ds.xml 文件引用了在线的 com.redhat.rhsa-RHEL8.xml 文件。可以根据提示在以上命令中通过增加 ‘--fetch-remote-resources’ 参数还可以根据提示下载 https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml 文件到 /usr/share/xml/scap/ssg/content 目录中然后再修改 ssg-rhel8-ds.xml 文件以下部分的 2 处远程引用即可修复告警。执行命令查看名为 xccdf_org.ssgproject.content_profile_cis 的 Profile 信息。注意可以根据 Description 了解当前 CIS Profile 的版本为 “v1.0.0”。$ oscap info --fetch-remote-resources--profilexccdf_org.ssgproject.content_profile_cis /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml Document type: Source Data Stream Imported:2021-02-17T10:44:54 Stream: scap_org.open-scap_datastream_from_xccdf_ssg-rhel8-xccdf-1.2.xml Generated:(null)Version:1.3Downloading: https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml... ok Profile Title: CIS Red Hat Enterprise Linux8Benchmark Id: xccdf_org.ssgproject.content_profile_cis Description: This profile defines a baseline that aligns to the CenterforInternet Security® Red Hat Enterprise Linux8Benchmark™, v1.0.0, released 09-30-2019. This profile includes CenterforInternet Security® Red Hat Enterprise Linux8CIS Benchmarks™ content.CIS 合规扫描全面扫描执行以下命令使用 ssg-rhel8-ds.xml 中名为 “CIS Red Hat Enterprise Linux 8 Benchmark” 对应的 Profile Id 进行合规扫描。将扫描结果保存在 cis-result.xml 文件中该文件可用于 OpenSCAP 工具后续处理不适合人直接查阅而供人查看的扫描报告是 cis-report.html。$ oscap xccdfeval--profilexccdf_org.ssgproject.content_profile_cis --results-arf cis-results.xml--reportcis-report.html --fetch-remote-resources /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml局部扫描执行以下命令只使用 CIS Profile这里使用了 CIS 的简称中的 “content_rule_accounts_passwords_pam_faillock_deny” 规则进行扫描。$ oscap xccdfeval--profilecis--rulexccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny--reportcis-rule-report.html --fetch-remote-resources /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml Downloading: https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml... ok Title Set Deny For Failed Password Attempts Rule xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny Ident CCE-80667-9 Result fail使用本地 oval 文件扫描如果在执行上述扫描命令时不使用--fetch-remote-resources参数则在运行时提示以下警告。解决方案是将 rhel-8.oval.xml.bz2 下载到本地然后使用--local-files参数。WARNING: Datastream componentscap_org.open-scap_cref_security-data-oval-v2-RHEL8-rhel-8.oval.xml.bz2points out to the remotehttps://access.redhat.com/security/data/oval/v2/RHEL8/rhel-8.oval.xml.bz2.Use--fetch-remote-resourcesoption to download it.下载 rhel-8.oval.xml.bz2 文件。注意需要将其改名为 security-data-oval-v2-RHEL8-rhel-8.oval.xml.bz2。wgethttps://access.redhat.com/security/data/oval/v2/RHEL8/rhel-8.oval.xml.bz2mkdir/opt/scap-resourcescprhel-8.oval.xml.bz2 /opt/scap-resources/security-data-oval-v2-RHEL8-rhel-8.oval.xml.bz2然后使用带有--local-files参数的命令扫描。$ oscap xccdfeval--local-files /opt/scap-resources\--profilecis\--rulexccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny\--reportcis-rule-report.html /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml WARNING: Usinglocalfile/opt/scap-resources/security-data-oval-v2-RHEL8-rhel-8.oval.xml.bz2instead ofhttps://access.redhat.com/security/data/oval/v2/RHEL8/rhel-8.oval.xml.bz2--- Starting Evaluation --- Title Lock Accounts After Failed Password Attempts Rule xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny Ident CCE-80667-9 Result pass查看 CIS 合规扫描结果了解 SSG DS 定义文件内容。可以查看扫描结果文件 cis-results.xml从 “Group rules by” 下拉框中选择下图的 CIS 地址此时下方的扫描结果就会按照 CIS 分类和编号进行重新排序。在扫描结果文件中可以根据 Rule ID 查找 “xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny”可以看到该规则的检查结果。查看上图的 “Set Deny For Failed Password Attempts” 链接可以得到下图详细的扫描结果。从中可以看出名为 “xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny” 的 Rule ID 对应的是内容为 “oval:ssg-accounts_passwords_pam_faillock_deny:def:1” 的 “OVAL Definition ID”。在 “ssg-rhel8-ds.xml” 文件中可以找到 “oval:ssg-accounts_passwords_pam_faillock_deny:def:1” 的 OVAL Definition ID它定义了规则是如何实现的。其下有 8 个 “oval-def:criterion”每个都包含了一个 “test_ref” 例如 “oval:ssg-test_accounts_passwords_pam_faillock_preauth_silent_system-auth:tst:1”。这 8 个 “test_ref” 对应上图下方显示的OVAL test results 的 8 个项目。下面结合上面一个test-ref的内容进行进一步分析。查找上图第一个 “oval-def:criterion” 对应的 test-ref“oval:ssg-test_accounts_passwords_pam_faillock_preauth_silent_system-auth:tst:1”可以获得下图的内容其中包含了 OVAL 需要检查的对象和状态。然后在 “ssg-rhel8-ds.xml” 文件中查找上图中 “oval:ssg-object_accounts_passwords_pam_faillock_when_lines_skipped_system-auth:obj:1” 可以得到下图的内容。根据上图的 var_ref 在文件中查找 “oval:ssg-object_accounts_passwords_pam_faillock_when_lines_skipped_system-auth:obj:1”可以看到下图对象。根据上图的 object_ref 在文件中查找 “oval:ssg-object_accounts_passwords_pam_faillock_lines_value_system-auth:obj:1”可以看到下图内容它定义了实现规则的操作。在 “ssg-rhel8-ds.xml” 文件中查找 “oval:ssg-state_var_accounts_passwords_pam_faillock_deny_value_upper_bound:ste:1” 和 “oval:ssg-state_var_accounts_passwords_pam_faillock_deny_value_lower_bound:ste:1”它们是向上数第 4 个图中绿框中的内容可以看到下图 2 个对象分别定义了表达式。根据上图的 var_ref 在文件中查找 “oval:ssg-var_accounts_passwords_pam_faillock_deny:var:1”可以看到下图的内容。此时一个用 XCCDF 定义的规则就分析完了。定制 CIS 基线扫描指标修改 “ssg-rhel8-ds.xml” 文件在下图的 CIS Profile 区域将 “xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny” 后的 selected 设置为 “false”。执行命令再次扫描然后查看扫描结果。$ oscap xccdfeval--profilexccdf_org.ssgproject.content_profile_cis --results-arf customize-cis-results.xml--reportcustomize-cis-report.html --fetch-remote-resources /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml确认已经找不到 “content_rule_accounts_passwords_pam_faillock_deny”了而且 failed 状态的数量也少了 1 个。修复不符合合规基线的项目直接修复可以使用 “–remediate” 参数在扫描的同时直接修复发现问题项目。$ oscap xccdfeval--profilecis--rulexccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny--resultsone-cis-results.xml--remediate--fetch-remote-resources /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml Downloading: https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL8.xml... ok Title Set Deny For Failed Password Attempts Rule xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny Ident CCE-80667-9 Result fail --- Starting Remediation --- Title Set Deny For Failed Password Attempts Rule xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny Ident CCE-80667-9 Result fixed生成修复 Ansible 剧本先运行命令根据扫描结果文件生成基于 Ansible 的修复文件。$ oscap xccdf generate fix --fix-type ansible--outputPlaybookToRemediate.yml --fetch-remote-resources --result-idcis-result.xml然后运行以下命令针对当前主机执行Ansible脚本。$ ansible-playbook-ilocalhost,-clocalPlaybookToRemediate.yml最后可再次进行扫描确认已经有大部分项目通过扫描少量还不能通过基线的项目需要手动修复。$ oscap xccdfeval--profilexccdf_org.ssgproject.content_profile_cis --fetch-remote-resources--reportcustomize-cis-report.html /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml转换文件所有 SCAP 包含的对象都是用 XML 来进行描述因此可以对基于 XML 规范的 SCAP 内容文档进行格式转换、内容拆分组合。分解 DataStream 文件执行命令可以将在 ssg-rhel8-ds.xml 文件中包含的内容分解出来。$ oscap ds sds-split --fetch-remote-resources /usr/share/xml/scap/ssg/content/ssg-rhel8-ds.xml ssg-rhel8-ds-extracted/ $ls-1ssg-rhel8-ds-extracted/ scap_org.open-scap_cref_ssg-rhel8-cpe-dictionary.xml scap_org.open-scap_cref_ssg-rhel8-xccdf-1.2.xml security-data-oval-com.redhat.rhsa-RHEL8.xml ssg-rhel8-cpe-oval.xml ssg-rhel8-ocil.xml ssg-rhel8-oval.xml将 XCCDF 文档从适合机器处理的XML格式转为适合人工查看的HTML格式以下将根据 ssg-rhel8-xccdf.xml 中的 CIS Profile 生成 HTML 格式的 Guide 文件。$ oscap xccdf generate guide--profilecis /usr/share/xml/scap/ssg/content/ssg-rhel8-xccdf.xmlrhel8-cis-guide.html以下将根据适合机器处理的 cis-results.xml 扫描结果文件生成 HTML 格式的 Report 文件以方便人工阅读。$ oscap xccdf generate report cis-results.xmlcis-report.html用 OpenSCAP 进行 OVAL 安全漏洞扫描红帽安全队为 RHEL 的漏洞提供了基于 OVAL 的扫描定义用户能够执行漏洞扫描以诊断系统是否受到 CVE 漏洞攻击。使用 OpenSCAP 不但可以直接根据 OVAL 进行漏洞扫描还可以根据 OVAL XCCDF 或 Source DataStream 文件进行漏洞扫描后面两种的扫描结果格式更友好。执行以下命令前面是根据 Source DataStream 进行 CVE 漏洞扫描后面是根据 OVAL XCCDF 进行 CVE 漏洞扫描。$wgethttps://www.redhat.com/security/data/metrics/ds/com.redhat.rhsa-all.ds.xml $ oscap xccdfeval--resultscve-results.xml--reportcve-report.html com.redhat.rhsa-all.ds.xml $wgethttps://www.redhat.com/security/data/metrics/com.redhat.rhsa-all.xccdf.xml $wgethttps://www.redhat.com/security/data/oval/com.redhat.rhsa-all.xml $ oscap xccdfeval--resultscve-results.xml--reportcve-report.html com.redhat.rhsa-all.xccdf.xml参考https://access.redhat.com/articles/6337261https://access.redhat.com/sites/default/files/attachments/scap-security-guide-0.1.50-scap-1.3-rhel8.ziphttps://github.com/ComplianceAsCode/content/releaseshttp://www.open-scap.org/security-policies/choosing-policy/https://www.redhat.com/en/blog/center-internet-security-cis-compliance-red-hat-enterprise-linux-using-openscaphttps://ncp.nist.gov/repositoryhttps://static.open-scap.org/openscap-1.3/oscap_user_manual.htmlhttps://www.redhat.com/en/blog/center-internet-security-cis-compliance-red-hat-enterprise-linux-using-openscaphttp://static.open-scap.org/openscap-1.3/oscap_user_manual.html

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价 →
↑