2017-03-31 78 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腳本可執行。