You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rocky Linux 9中移除CIS Level 2 RH配置文件及安装后安全配置文件管理方法咨询

Rocky Linux 9中移除CIS Level 2 RH配置文件及安装后安全配置文件管理方法咨询

嗨Arvind,针对你在Rocky Linux 9上遇到的CIS安全配置文件限制问题,我整理了一套实操方案,帮你移除现有配置、管理安装后的安全配置文件,顺便聊聊OpenSCAN扫描的小细节:

一、移除当前的CIS Level 2 RH安全配置文件

CIS配置是通过应用一系列系统规则实现的,我们可以通过回滚到系统默认安全配置来解除这些限制,步骤如下:

  1. 先确保安装了scap安全指南工具包(如果还没装的话):

    sudo dnf install scap-security-guide -y
    
  2. 查看系统支持的所有安全配置文件,确认默认配置的ID:

    oscap info /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml | grep -A 20 "Profiles:"
    

    你会在输出里找到类似 xccdf_org.ssgproject.content_profile_default 的默认配置文件ID,记下来备用。

  3. 应用默认配置文件,覆盖之前的CIS规则:

    sudo oscap xccdf eval --remediate --profile xccdf_org.ssgproject.content_profile_default /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml
    

    执行这个命令后,系统会逐步把所有设置恢复到Rocky Linux 9的默认状态,之前的CIS限制就会解除了。

二、安装后添加/切换安全配置文件

如果之后你想切换到其他安全配置(比如CIS Level 1、标准安全配置等),可以用同样的工具操作:

  1. 先筛选出你感兴趣的配置文件,比如找所有CIS相关的:

    oscap info /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml | grep -i cis
    

    输出里会显示类似 xccdf_org.ssgproject.content_profile_cis(CIS Level 1)、xccdf_org.ssgproject.content_profile_cis_server_l2(你之前用的Level 2)这样的ID。

  2. 应用目标配置文件:

    sudo oscap xccdf eval --remediate --profile <目标配置文件ID> /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml
    

    举个例子,如果你想切换到CIS Level 1,命令就是:

    sudo oscap xccdf eval --remediate --profile xccdf_org.ssgproject.content_profile_cis /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml
    

三、关于OpenSCAN扫描结果的小提示

你提到应用CIS配置后扫描只有62%的通过率,这是很常见的情况——有些CIS规则依赖特定的服务安装状态、系统环境,自动修复可能无法覆盖所有场景。

如果回滚到默认配置后,建议先执行上面的修复命令,再重新扫描,这样结果会更准确:

# 先应用默认配置修复
sudo oscap xccdf eval --remediate --profile xccdf_org.ssgproject.content_profile_default /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml
# 再执行扫描
sudo oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_default --results scan_results.xml /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml

备注:内容来源于stack exchange,提问作者Arvind Saxena

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 07:39:49