使用root账户远程连接到RockyLinux执行
- 安装必要的软件 yum -y install aide audispd-plugins openscap openscap-scanner scap-security-guide
- 进入/tmp目录 cd /tmp/
- 生成合规需要的脚本
oscap xccdf generate fix --template urn:xccdf:fix:script:sh --profile xccdf_org.ssgproject.content_profile_pci-dss --output fix.sh /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml
- 执行修复脚本 sh fix.sh
等待执行完成。
- useradd -m -s /bin/bash -G wheel user1 passwd user1 创建用于远程登录系统的账户user1
- 编辑/etc/ssh/sshd_config, 添加 AllowUsers user1@* 允许user1远程登录系统
- systemctl restart sshd.service 确认没有报错后,用user1 远程登录系统。
- user1能够远程登录成功后,用root用户重启系统 shutdown /r
重启后,使用user1远程登录系统,执行合规验证
cd /tmp/
sudo oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_pci-dss --results result-pci.xml --report report-pci.html /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml