概要 †
fail2banのNginx Shellshock用フィルタです。
フィルタ対象フォーマット †
1
|
| [27/Sep/2014:23:46:16 +0900],401,-,0.000,188,118.192.48.6,"GET /cgi-bin/count.cgi HTTP/1.1","() { :; }; echo Mozilla: `echo kUOm4N0953`;"
|
/etc/fail2ban/filter.d/nginx-shellshock.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 = ^\[.*\],.+?,.+?,.+?,.+?,<HOST>,.+?,".*?\(.*?\).*?{.*$
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
|
その他 †
- /etc/fail2ban/jail.local例
1
2
3
4
5
6
7
8
| -
!
| [nginx-shellshock]
enabled = true
filter = nginx-shellshock
logpath = /opt/nginx/log/*/access.log
port = http,https
bantime = 3600
maxretry = 1
|
- 反映
1
2
3
4
| -
!
-
!
| fail2ban-regex <対象ログパス> /etc/fail2ban/filter.d/nginx-shellshock.conf
service fail2ban restart
|
検証時の環境 †