构建 Ubuntu 24.04 CIS Level 1 评估镜像
本指南生成一个 Ubuntu 24.04 映像,该映像请求 OpenFactory 的固定 CIS 1 级修复路径并收集来宾证据。它不生产经过认证或自动生产就绪的服务器。
对于其他发行版,cis-benchmarks 功能当前仅应用有限的可移植基线。请勿通过更改 base_image 和保留 CIS 声明来调整本指南。
提示
Create an Ubuntu 24.04 headless evaluation image with SSH, firewall,
audit logging, and the cis-benchmarks feature. Use key-only SSH,
disable root login, and add a locked-password operator account in sudo.
Add a scenario that waits for first-boot CIS remediation and runs the
Ubuntu 24.04 Level 1 server benchmark plus service and network smoke tests.
Do not call the result compliant; preserve failed controls and exceptions.查看标准化配方
重要字段应类似于:
{
"name": "ubuntu24-cis-l1-evaluation",
"base_image": "ubuntu-24.04",
"os": {
"features": [
"headless",
"ssh",
"firewall",
"audit-logging",
"cis-benchmarks"
],
"services": [
{
"name": "ssh",
"enabled": true,
"config": {
"port": 22,
"allow_root": false,
"disable_password_auth": true
}
}
],
"users": [
{
"username": "operator",
"groups": ["sudo"],
"shell": "/bin/bash"
}
],
"security": {
"hardening_level": "standard",
"audit_logging": true,
"fail2ban": false
}
},
"scenarios": [
{
"id": "ubuntu24-cis-evidence",
"name": "Ubuntu 24.04 CIS Level 1 evidence",
"enabled": true,
"tests": ["boot", "login", "packages", "services"],
"cis_benchmark": "CIS_Ubuntu_Linux_24.04_LTS_Benchmark_v1.0.0",
"cis_level": "L1"
}
]
}该帐户没有配方密码,因此应保持密码锁定状态,直到提供批准的密钥或部署时凭据。在禁用密码验证之前,请确认生成的访问路径与您的环境匹配。
构建路径的作用
对于 Ubuntu 24.04,该功能会暂存固定 ansible-lockdown/UBUNTU24-CIS 角色的经过摘要验证的存档。首次启动会应用所选的 1 级服务器配置文件并写入就绪或故障证据。该版本还包含帐户控制、警告横幅、服务状态、文件系统设置、来源和选定网络行为的功能断言。
该角色适用于 OpenFactory 的图像工作流程。检查生成的清单和补丁,而不是假设它与默认上游运行相同。
验收标准
不要停留在“构建完成”。要求:
- 一个可用的神器及其摘要;
- 首次启动修复准备就绪且无故障标记;
- 考虑所有适用的选定基准检查;
- 对每个失败、跳过或不适用的控制进行明确处置;
- 通过批准的密钥工作流程成功进行 SSH 访问;
- 防火墙、时间同步、日志记录、更新、重启和恢复测试;
- 硬化后应用烟雾测试;和
- 所有者批准的部署运行手册。
级别 2 不是当前固定的修复配置文件,并且不能像此路径提供它一样请求该级别。如果需要 2 级,请将其视为单独的工程和验证项目。
请参阅 CIS 基准证据 了解结果解释。