在 CentOS(或任何 Linux 系统)上,**“exploit 报警”**通常有两个含义,我分开说,并给出可执行方案。
如果你是 被发现系统被攻击/漏洞利用,需要告警和响应:
# 查看异常登录
last
lastb
# 查看 secure 日志
tail -f /var/log/secure
# 查看 cron / shell 历史
cat ~/.bash_history
AIDE(文件完整性监控)
yum install aide -y
aide --init
mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
aide --check
Fail2Ban(防爆破)
yum install epel-release -y
yum install fail2ban -y
systemctl enable --now fail2ban
# 示例:异常登录邮件告警
echo "Alert: root login" | mail -s "CentOS Alert" admin@example.com
也可用 Prometheus + Alertmanager / ELK + Wazuh 做企业级告警。
如果你是 安全运维/蓝队,想“发现 exploit 行为就报警”:
auditctl -w /etc/passwd -p wa -k exploit_alert
ausearch -k exploit_alert
# Falco 示例规则
- rule: Shell in Container
desc: Detect shell execution
condition: evt.type=execve and proc.name in (bash, sh)
output: "Shell executed"
priority: WARNING
yum install clamav -y
clamscan -r /var/www
如果你能补充说明:
我可以给你 更精准的配置方案。