Apache 2.4異常日誌

Apache 2.4異常日誌

自從幾天以來,我收到了一些黑客攻擊的嘗試,但實際上一切似乎都很好。

但我看到了一些我無法解釋的日誌:

127.0.0.1:443 216.218.206.66 - - [09/Oct/2015:04:49:29 +0200] "GET / HTTP/1.1" 404 4857 "-" "-"
127.0.0.1:80 220.181.108.177 - - [09/Oct/2015:07:56:11 +0200] "-" 408 0 "-" "-"
127.0.0.1:443 199.115.117.88 - - [09/Oct/2015:10:35:04 +0200] "GET /admin/i18n/readme.txt HTTP/1.1" 404 5081 "-" "python-requests/2.8.0"

這是我的日誌配置:

# - Exeption
SetEnvIf Request_URI "\.jpg$|\.jpeg$|\.gif$|\.png$|\.ico|\.icon|\.css$|\.js$|piwik\.php$|frogglogin\.php" dontlog
SetEnvIf User-agent "(bot|baidu)" dontlog

CustomLog ${APACHE_LOG_DIR}/access.log vhost_combined env=!dontlog
  • 如何選擇到達 127.0.0.1 的請求?
  • 我該怎麼做才能防止 408 錯誤?
  • 看到這些攻擊的到來我該驚慌嗎?

謝謝

附:

這是個好主意嗎 ?

<VirtualHost 127.0.0.1>
# [ Default restriction ]
<Directory />
    Order deny,allow
    Deny from all
    allow from 127.0.0.1
</Directory>
</VirtualHost>

答案1

公用 IP 位址無法直接到達您的環回位址。這是 NAT 的問題,apache 可能會將這些 IP 位址轉換為環回,因為要么是您告訴 apache 這樣做,要么是設定錯誤。

對此不必驚慌,受到殭屍網路和/或旨在嘗試登入頁面等的自動化應用程式的攻擊是正常的。

當這種嘗試正在進行時,我寧願檢查:

  netstat -an (or adding additional parameters)

檢查連接。

答案2

這就是我如何擺脫這個:

我在所有定義的虛擬主機之後添加了此配置,以捕獲“其他”請求(與任何其他虛擬主機不匹配的請求)。最重要的是虛擬位置(最後)和命令ServerAlias *

#---------------#
# [ LOCALHOST ] #
#---------------#
# Local host for other:
# ServerName localhost
# ServerName 88.xxx.xxx.xxx
# ServerName xxxxxxxx.net
# and more ...
# need to be at the last position
<VirtualHost *:80 *:443>
# [ Server Domain ]
ServerName localhost
ServerAlias *
# [ Server Root ]
DocumentRoot /var/www/home/
# [ Cancel trafic ]
RewriteCond %{REQUEST_URI} !errors\/hack\.htm
RewriteRule .*? - [END,R=406]
# [ Custom Log ]
CustomLog ${APACHE_LOG_DIR}/hack.log combined
</VirtualHost>

相關內容