概要 †
fail2banのNginx auth用フィルタです。
フィルタ対象フォーマット †
1
2
3
4
| -
!
-
!
| 2014/10/15 21:02:02 [error] 12342014/10/15 21:34:09 [error] 1234
|
/etc/fail2ban/filter.d/nginx-auth.conf †
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| -
|
|
|
|
|
!
-
|
!
-
|
|
!
-
|
|
|
!
|
[INCLUDES]
before = common.conf
[Definition]
failregex = ^.*\[error\].* user .*, client: <HOST>,.*$
ignoreregex =
|
その他 †
- /etc/fail2ban/jail.local例
1
2
3
4
5
6
7
8
| -
!
| [nginx-auth]
enabled = true
filter = nginx-auth
logpath = /opt/nginx/log/*/error.log
port = http,https
bantime = 900
maxretry = 5
|
- 反映
1
2
3
4
| -
!
-
!
| fail2ban-regex <対象ログパス> /etc/fail2ban/filter.d/nginx-auth.conf
service fail2ban restart
|
検証時の環境 †