关于 cis-benchmarks
面向安全与合规团队,提供 CIS 安全基准的评估、实施和审计方法,并介绍 OpenSCAP、Lynis、InSpec 与 kube-bench 的用法。
主要功能
- 01CIS 基准扫描示例
- 02OpenSCAP 与 Lynis 审计
- 03InSpec 控制项编写
- 04Kubernetes 基准检查
- 05发现项修复工作流
- 06持续评估最佳实践
适用场景
- 01评估系统安全合规情况
- 02建立安全基线并加固系统
- 03检查 Kubernetes 节点与控制平面
- 04跟踪基准偏差和例外
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ bagelhole/ devops-security-agent-skills --skill cis-benchmarks安装后在 Claude Code 中输入/cis-benchmarks确认已加载。
详细介绍
CIS 基准
实施并审计 CIS 安全基准。
何时使用此技能
在以下情况下使用此技能:
- 评估安全合规性
- 实施安全基线
- 满足法规要求
- 按标准强化系统
评估工具
OpenSCAP
# Install
apt install openscap-scanner scap-security-guide
# Run CIS benchmark scan
oscap xccdf eval \
--profile xccdf_org.ssgproject.content_profile_cis \
--results results.xml \
--report report.html \
/usr/share/xml/scap/ssg/content/ssg-ubuntu2204-ds.xml
Lynis
# Install
apt install lynis
# Run audit
lynis audit system
# Generate report
lynis audit system --report-file /tmp/lynis-report.dat
InSpec
# cis-profile/controls/ssh.rb
control 'cis-ssh-1' do
impact 1.0
title 'Ensure SSH root login is disabled'
describe sshd_config do
its('PermitRootLogin') { should eq 'no' }
end
end
control 'cis-ssh-2' do
impact 0.7
title 'Ensure SSH password authentication is disabled'
describe sshd_config do
its('PasswordAuthentication') { should eq 'no' }
end
end
# Run InSpec
inspec exec cis-profile -t ssh://user@target
Kubernetes CIS
# kube-bench
docker run --rm -v /etc:/etc:ro -v /var:/var:ro \
aquasec/kube-bench:latest run --targets node
# Check specific sections
kube-bench run --targets master --check 1.1,1.2
修复工作流
workflow:
1_scan:
- Run automated assessment
- Generate baseline report
2_analyze:
- Review findings
- Identify false positives
- Prioritize by risk
3_remediate:
- Apply fixes
- Document exceptions
- Verify changes
4_validate:
- Re-run assessment
- Confirm remediation
- Generate compliance report
最佳实践
- 强化前先建立基线
- 记录例外情况
- 自动化评估
- 跟踪合规情况的变化
- 定期重新评估
- 对配置进行版本控制
相关技能
- linux-hardening - Linux 安全
- vulnerability-scanning - 安全扫描
评论
支持 Markdown