fastCGI PHP如何通过auditd更改文件并逃脱检测?

有一天,我在Debian服务器上设置了一个小脚本,在文件发生变化时向我发送电子邮件。 它看起来像这样:

#!/bin/sh items=`find /var/www/vhosts -regex ".*/httpdocs/.*" -newer files_start -ls` if [ ! -z "$items" ] then touch files_start echo "$items" | mail -s "new file(s)" "[email protected]" fi 

我不断得到一个神秘的长度为0的文本文件(可以通过PHP和vhost用户,而不是Apache)进行修改,每天修改2-3次,所以我使用以下规则设置了auditd。

 auditctl -l LIST_RULES: exit,always watch=/var/www/vhosts/path/to/file.txt perm=rwa key=wh1 

正如预期的那样,我testing了它,

 ...comm="touch" exe="/bin/touch"... 

在得到下一个电子邮件与新的MODdate后,我跑ausearch:没有新的比赛!

这怎么可能发生?

—- —-更新

我通过其他方式发现,这个过程是PHP运行的,就像Apache调用的fastCGI一样。 PHP函数调用是:

 touch('path/to/file.txt'); 

所以问题就变成了:fastCGI PHP如何通过auditd改变文件并逃脱检测? 这开始看起来像一个审计错误。

删除该规则,并尝试这一点:

 auditctl -w <path-to-file> -p wa -k mystery-file 

还要确保/etc/init.d/auditd已启动。