記事本   >>  網站技術
fail2ban 設定與操作

Fail2ban


關於 Fail2ban



安裝 Fail2ban



設定 Fail2ban



啟動 Fail2ban



測試 Fail2ban

檢視 Fail2ban 狀態

  • 通用檢查
    service fail2ban status

    Fail2ban (pid 1060) is running...     (表示運行中)
    Status
    |- Number of jail:      1                     (規則 1 條)
    `- Jail list:           apache-tcpwrapper  (規則名稱)

  • 檢查特定規則

    語法:  fail2ban-client status 規則名稱

    例如:  fail2ban-client status apache-tcpwrapper

測試 Fail2ban regex 規則是否有效

語法 : fail2ban-regex  "要檢查的檔案路徑、名稱"  "規則來源"

例如: fail2ban-regex /var/log/httpd/error_log /etc/fail2ban/filter.d/apache-tcpwrapper.conf

Running tests
=============

Use regex file : /etc/fail2ban/filter.d/apache-tcpwrapper.conf
Use log file   : /var/log/httpd/error_log


Results
=======

Failregex
|- Regular expressions:
|  [1] [[]client <HOST>[]] (File does not exist|script not found or unable to stat): /\S*
|
`- Number of matches:
   [1] 296 match(es)      (有 296條符合)

Ignoreregex
|- Regular expressions:
|
`- Number of matches:

  == 2015/06/24 補充 ==
  1. 如果出現 Lines: 2320 lines, 0 ignored, 2209 matched, 111 missed

    表示有 111 行類似但不完全符合規則,這時可以加上   --print-all-missed

    來顯示錯過那幾行內容,藉此觀察特徵來調整規則。

    ex. :  fail2ban-regex /var/log/httpd/error_log /etc/fail2ban/filter.d/apache-tcpwrapper.conf  --print-all-missed

  2. fail2ban 更新之後,重新啟動時出現  WARNING 'ignoreregex' not defined
    就要檢查以下幾個設定中是否有加上
    ignoreregex  這個設定。
    • fail2ban.conf
    • jail.conf
    • filter.d/ 目錄底下有用到的設定檔。
    以上補充。




進階搜尋
找商品說明
價錢: -
此分類無可選擇屬性

會員登入