Fail2ban: ignoreregexが機能しない

作成日 2012年12月21日  ·  3コメント  ·  ソース: fail2ban/fail2ban

設定ファイルのignoreregexオプションは機能しません(v0.8.4)。
fail2ban-regexでテストすると、「正規表現をコンパイルできません」というエラーもスローされません。

fail2ban-regex error.log /etc/fail2ban/filter.d/suhosin.conf

一致するものはまったくありません:

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

例:
suhosin.conf

[Definition]
failregex = suhosin\[\d*\].*\(attacker\s'<HOST>'.*
ignoreregex = suhosin\[\d*\].*(memory_limit).*\(attacker\s'<HOST>'.*

エラーログ

Dec 17 15:51:13 server suhosin[27622]: ALERT - ASCII-NUL chars not allowed within request variables - dropped variable      'action' (attacker '67.210.100.166', file '/bla.php')
Dec 17 15:51:13 server suhosin[27624]: ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'board' (attacker '67.210.100.166', file '/bla.php')
Dec 17 15:51:13 server suhosin[27624]: ALERT - ASCII-NUL chars not allowed within request variables - dropped variable 'topic' (attacker '67.210.100.166', file '/bla.php')
Dec 20 18:58:21 server suhosin[4088]: ALERT - script tried to increase memory_limit to 120000000 bytes which is above the allowed value (attacker '123.123.123.123', file '/bla.php', line 10)
Dec 20 18:58:32 server suhosin[4051]: ALERT - script tried to increase memory_limit to 120000000 bytes which is above the allowed value (attacker '123.123.123.123', file '/bla.php', line 10)

私はすべてのsuhosin攻撃を一致させ、memory_limitを増加させようとしているすべての攻撃を差し引こうとしています。

最も参考になるコメント

:+1:
ああ、あなたは正しいです。 正しい3番目のパラメータを指定していただきありがとうございます。
これを投稿する前にmanページを読むべきでした。
とにかくこれは動作します:

fail2ban-regex error.log /etc/fail2ban/filter.d/suhosin.conf /etc/fail2ban/filter.d/suhosin.conf

問題を解決します。 メリークリスマス。 さよなら。

全てのコメント3件

説明的である:ignoreregexを指定しましたか?

$> /usr/bin/fail2ban-regex | head
Usage: /usr/bin/fail2ban-regex [OPTIONS] <LOG> <REGEX> [IGNOREREGEX]

したがって、ignoregexをたとえばsshd.confに追加する場合(ただし、回避する必要があります)
ignoreregexのマッチングが完全に適用されるため、前面に固定
行、時間/日付を削除せずに)-それはすべて良いです

$> ./fail2ban-regex testcases/files/logs/sshd config/filter.d/sshd.conf config/filter.d/sshd.conf  2>/dev/null | grep -A2 Ignoreregex 
Ignoreregex: 2 total
|- #) [# of hits] regular expression
|  1) [2] \s*(?:\S+ )?(?:kernel: \[\d+\.\d+\] )?(?:@vserver_\S+ )?(?:(?:\[\d+\])?:\s+[\[\(]?sshd(?:\(\S+\))?[\]\)]?:?|[\[\(]?sshd(?:\(\S+\))?[\]\)]?:?(?:\[\d+\])?:)?\s*(?:error: PAM: )?Authentication failure for .* from <HOST>\s*$

$> grep ignoreregex config/filter.d/sshd.conf
# Option:  ignoreregex
ignoreregex = %(__prefix_line)s(?:error: PAM: )?Authentication failure for .* from <HOST>\s*$

2012年12月21日金曜日、Jens-AndréKochは次のように書いています。

設定ファイルのignoreregexオプションは機能しません(v0.8.4)。
fail2ban-regexでテストする場合、「通常のコンパイルができません
式」エラーがスローされます。
一致するものはまったくありません:

Ignoreregex
|-正規表現:

`-一致数:

一般的な構成オプションがありませんか、これはバグですか?

ヤロスラフ・O・ハルチェンコ
心理脳科学科博士研究員
ダートマス大学、419 Moore Hall、Hinman Box 6207、ハノーバー、NH 03755
電話:+1(603)646-9834ファックス:+1(603)646-1419
WWW: http

:+1:
ああ、あなたは正しいです。 正しい3番目のパラメータを指定していただきありがとうございます。
これを投稿する前にmanページを読むべきでした。
とにかくこれは動作します:

fail2ban-regex error.log /etc/fail2ban/filter.d/suhosin.conf /etc/fail2ban/filter.d/suhosin.conf

問題を解決します。 メリークリスマス。 さよなら。

メリークリスマス! ;)

2012年12月21日金曜日、Jens-AndréKochは次のように書いています。

[1]:+ 1:
ああ、あなたは正しいです。 正しい3番目のパラメータを指定していただきありがとうございます。
これを投稿する前にmanページを読むべきでした。
とにかくこれは動作します:
fail2ban-正規表現error.log / etc / fail2ban / filter.d / suhosin.conf
/etc/fail2ban/filter.d/suhosin.conf

問題を解決します。 メリークリスマス。 さよなら。


このメールに直接返信するか、[2] GitHubで表示してください。

参考文献

目に見えるリンク

  1. https://github.com/fail2ban/fail2ban/issues/100#issuecomment -11623202

ヤロスラフ・O・ハルチェンコ
心理脳科学科博士研究員
ダートマス大学、419 Moore Hall、Hinman Box 6207、ハノーバー、NH 03755
電話:+1(603)646-9834ファックス:+1(603)646-1419
WWW: http

このページは役に立ちましたか?
0 / 5 - 0 評価