Anolis 安全基线:从默认态到生产加固的决策路径
默认态与操作链实测(双机 ops journey + 真实迁移产物);SELinux 策略编写(audit2allow)不在本页。
决策路径(按起点分)
Section titled “决策路径(按起点分)”# 现状核对(三形态输出不同)getenforce # Disabled/Permissive/Enforcingsystemctl is-active firewalld
# 云镜像 Disabled→启用路径(两步:配置+重标)sudo sed -i 's/^SELINUX=disabled/SELINUX=enforcing/' /etc/selinux/configsudo touch /.autorelabel && sudo reboot # 重标可能耗时
# 装机 permissive→enforcing(先看拒绝日志再切)sudo ausearch -m avc --recent | head # 无 AVC 再切
# firewalld 收紧sudo firewall-cmd --list-allsudo firewall-cmd --permanent --remove-service=cockpit && sudo firewall-cmd --reload
# SSH 加固(对照迁移后重置风险)sudo sshd -T | grep -E '^(passwordauthentication|permitrootlogin)'迁移后的特别提醒
Section titled “迁移后的特别提醒”迁移器把 SELinux 重置为 Enforcing(实测)——如果迁移前是 permissive,迁移后直接 enforcing 可能触发业务 AVC:先 ausearch 核对再决定。