| 33 |
- |
1 |
#
|
|
|
2 |
# Author: Mike Rushton
|
|
|
3 |
#
|
|
|
4 |
# Referenced from from http://www.normyee.net/blog/2012/02/02/adding-cloudflare-support-to-fail2ban by NORM YEE
|
|
|
5 |
#
|
|
|
6 |
# To get your Cloudflare API key: https://www.cloudflare.com/my-account
|
|
|
7 |
#
|
|
|
8 |
|
|
|
9 |
[Definition]
|
|
|
10 |
|
|
|
11 |
# Option: actionstart
|
|
|
12 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
13 |
# Values: CMD
|
|
|
14 |
#
|
|
|
15 |
actionstart =
|
|
|
16 |
|
|
|
17 |
# Option: actionstop
|
|
|
18 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
19 |
# Values: CMD
|
|
|
20 |
#
|
|
|
21 |
actionstop =
|
|
|
22 |
|
|
|
23 |
# Option: actioncheck
|
|
|
24 |
# Notes.: command executed once before each actionban command
|
|
|
25 |
# Values: CMD
|
|
|
26 |
#
|
|
|
27 |
actioncheck =
|
|
|
28 |
|
|
|
29 |
# Option: actionban
|
|
|
30 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
31 |
# command is executed with Fail2Ban user rights.
|
|
|
32 |
# Tags: <ip> IP address
|
|
|
33 |
# <failures> number of failures
|
|
|
34 |
# <time> unix timestamp of the ban time
|
|
|
35 |
# Values: CMD
|
|
|
36 |
#
|
|
|
37 |
actionban = curl https://www.cloudflare.com/api_json.html -d 'a=ban' -d 'tkn=<cftoken>' -d 'email=<cfuser>' -d 'key=<ip>'
|
|
|
38 |
# Option: actionunban
|
|
|
39 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
40 |
# command is executed with Fail2Ban user rights.
|
|
|
41 |
# Tags: <ip> IP address
|
|
|
42 |
# <failures> number of failures
|
|
|
43 |
# <time> unix timestamp of the ban time
|
|
|
44 |
# Values: CMD
|
|
|
45 |
#
|
|
|
46 |
actionunban = curl https://www.cloudflare.com/api_json.html -d 'a=nul' -d 'tkn=<cftoken>' -d 'email=<cfuser>' -d 'key=<ip>'
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
[Init]
|
|
|
50 |
|
|
|
51 |
# Default Cloudflare API token
|
|
|
52 |
cftoken =
|
|
|
53 |
|
|
|
54 |
# Default Cloudflare username
|
|
|
55 |
cfuser =
|