2017-03-31 52 views
0

我们正在尝试设置Apache Mod Evasion以防止将来在我们的某台服务器上发生DOS攻击。除了电子邮件通知外,一切似乎都运作良好。该堆栈在Ubuntu Server 16.04上运行PHP 7.1和Apache2.4。Mod Evasion电子邮件通知问题

sudo su - www-data -s /bin/bash -c 'echo "this is the body" | mail -s "Subject" [email protected] [email protected]' 

这里是国防部evasion.conf:

<IfModule mod_evasive20.c> 
    DOSHashTableSize 3097 
    DOSPageCount  1 
    DOSSiteCount  1 
    DOSPageInterval  10 
    DOSSiteInterval  10 
    DOSBlockingPeriod 10 

    DOSEmailNotify  root 
    #DOSSystemCommand "su - someuser -c '/sbin/... %s ...'" 
    DOSLogDir   "/var/log/mod_evasive" 
</IfModule> 

这里是ssmtp.conf文件:

[email protected] 
FromLineOverride=YES 

Debug=YES 
UseSTARTTLS=YES 
UseTLS=YES 
mailhub=email-smtp.us-east-1.amazonaws.com:465 
AuthUser=####### 
AuthPass=####### 
AuthMethod=LOGIN 

这里

电子邮件通过测试命令工作正常是revaliases文件:

root:[email protected]:email-smtp.us-east-1.amazonaws.com:25 
www-data:[email protected]:email-smtp.us-east-1.amazonaws.com:25 

回答

0

mod_evasive具有邮寄者调用的硬编码命令,在source-code内定义为MAILER,并且在例如这bug report

#define MAILER "/bin/mail %s" 

%s由指令发送邮件时DOSEmailNotify的值取代。但是,现在大多数系统不使用/bin/main,您可能需要使用sendmail。你可以做的是创建一个包装脚本/bin/mail(假设这个二进制文件根本不存在或未被使用)。

#!/bin/bash 
if [ "$1" != "" ] 
then 
     /usr/sbin/sendmail -t "$1" 
fi 

调整的路径,你sendmail二进制,最终使使用chmod 0755 /bin/mail脚本可执行。