| 加固项 | 快速体检 |
|---|---|
| 适用平台 | Linux |
| 风险等级 | 低 |
| 判读 | 输出即基线快照,供横向与纵向对比 |
巡检脚本骨架(只读)
巡检脚本骨架(只读)
{
echo '== UID0 =='; awk -F: '$3==0{print $1}' /etc/passwd
echo '== LISTEN =='; ss -tulnp | awk 'NR>1{print $1,$5}' | sort -u | head -20
echo '== SUID-COUNT =='; find / -xdev -perm -4000 -type f 2>/dev/null | wc -l
echo '== RUNNING-SVC =='; systemctl list-units --type=service --state=running --no-pager | wc -l
echo '== FIREWALL =='; systemctl is-active firewalld 2>/dev/null || ufw status 2>/dev/null | head -1
echo '== AUDIT-RULES =='; auditctl -l 2>/dev/null | wc -l
} | tee /tmp/baseline-$(date +%F).txt脚本保持只读:带修复动作的“一键加固”脚本上生产前必须在测试机演练并准备回滚。