192 |
- |
1 |
# Fail2ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Action to report IP address to abuseipdb.com
|
|
|
4 |
# You must sign up to obtain an API key from abuseipdb.com.
|
|
|
5 |
#
|
|
|
6 |
# NOTE: These reports may include sensitive Info.
|
|
|
7 |
# If you want cleaner reports that ensure no user data see the helper script at the below website.
|
|
|
8 |
#
|
|
|
9 |
# IMPORTANT:
|
|
|
10 |
#
|
|
|
11 |
# Reporting an IP of abuse is a serious complaint. Make sure that it is
|
|
|
12 |
# serious. Fail2ban developers and network owners recommend you only use this
|
|
|
13 |
# action for:
|
|
|
14 |
# * The recidive where the IP has been banned multiple times
|
|
|
15 |
# * Where maxretry has been set quite high, beyond the normal user typing
|
|
|
16 |
# password incorrectly.
|
|
|
17 |
# * For filters that have a low likelihood of receiving human errors
|
|
|
18 |
#
|
|
|
19 |
# This action relies on a api_key being added to the above action conf,
|
|
|
20 |
# and the appropriate categories set.
|
|
|
21 |
#
|
|
|
22 |
# Example, for ssh bruteforce (in section [sshd] of `jail.local`):
|
|
|
23 |
# action = %(known/action)s
|
193 |
- |
24 |
# abuseipdb[abuseipdb_apikey="my-api-key", abuseipdb_category="18,22"]
|
192 |
- |
25 |
#
|
193 |
- |
26 |
# See below for categories.
|
192 |
- |
27 |
#
|
|
|
28 |
# Added to fail2ban by Andrew James Collett (ajcollett)
|
|
|
29 |
|
193 |
- |
30 |
## abuseIPDB Categories, `the abuseipdb_category` MUST be set in the jail.conf action call.
|
192 |
- |
31 |
# Example, for ssh bruteforce: action = %(action_abuseipdb)s[abuseipdb_category="18,22"]
|
|
|
32 |
# ID Title Description
|
|
|
33 |
# 3 Fraud Orders
|
|
|
34 |
# 4 DDoS Attack
|
|
|
35 |
# 9 Open Proxy
|
|
|
36 |
# 10 Web Spam
|
|
|
37 |
# 11 Email Spam
|
|
|
38 |
# 14 Port Scan
|
|
|
39 |
# 18 Brute-Force
|
|
|
40 |
# 19 Bad Web Bot
|
|
|
41 |
# 20 Exploited Host
|
|
|
42 |
# 21 Web App Attack
|
|
|
43 |
# 22 SSH Secure Shell (SSH) abuse. Use this category in combination with more specific categories.
|
|
|
44 |
# 23 IoT Targeted
|
|
|
45 |
# See https://abuseipdb.com/categories for more descriptions
|
|
|
46 |
|
|
|
47 |
[Definition]
|
|
|
48 |
|
|
|
49 |
# bypass action for restored tickets
|
|
|
50 |
norestored = 1
|
|
|
51 |
|
|
|
52 |
# Option: actionstart
|
|
|
53 |
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
|
|
54 |
# Values: CMD
|
|
|
55 |
#
|
|
|
56 |
actionstart =
|
|
|
57 |
|
|
|
58 |
# Option: actionstop
|
|
|
59 |
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
|
|
60 |
# Values: CMD
|
|
|
61 |
#
|
|
|
62 |
actionstop =
|
|
|
63 |
|
|
|
64 |
# Option: actioncheck
|
|
|
65 |
# Notes.: command executed once before each actionban command
|
|
|
66 |
# Values: CMD
|
|
|
67 |
#
|
|
|
68 |
actioncheck =
|
|
|
69 |
|
|
|
70 |
# Option: actionban
|
|
|
71 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
72 |
# command is executed with Fail2Ban user rights.
|
|
|
73 |
#
|
|
|
74 |
# ** IMPORTANT! **
|
|
|
75 |
#
|
|
|
76 |
# By default, this posts directly to AbuseIPDB's API, unfortunately
|
|
|
77 |
# this results in a lot of backslashes/escapes appearing in the
|
|
|
78 |
# reports. This also may include info like your hostname.
|
|
|
79 |
# If you have your own web server with PHP available, you can
|
|
|
80 |
# use my (Shaun's) helper PHP script by commenting out the first #actionban
|
|
|
81 |
# line below, uncommenting the second one, and pointing the URL at
|
|
|
82 |
# wherever you install the helper script. For the PHP helper script, see
|
|
|
83 |
# <https://wiki.shaunc.com/wikka.php?wakka=ReportingToAbuseIPDBWithFail2Ban>
|
|
|
84 |
#
|
|
|
85 |
# Tags: See jail.conf(5) man page
|
|
|
86 |
# Values: CMD
|
|
|
87 |
#
|
|
|
88 |
actionban = lgm=$(printf '%%.1000s\n...' "<matches>"); curl -sSf "https://api.abuseipdb.com/api/v2/report" -H "Accept: application/json" -H "Key: <abuseipdb_apikey>" --data-urlencode "comment=$lgm" --data-urlencode "ip=<ip>" --data "categories=<abuseipdb_category>"
|
|
|
89 |
|
|
|
90 |
# Option: actionunban
|
|
|
91 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
92 |
# command is executed with Fail2Ban user rights.
|
|
|
93 |
# Tags: See jail.conf(5) man page
|
|
|
94 |
# Values: CMD
|
|
|
95 |
#
|
|
|
96 |
actionunban =
|
|
|
97 |
|
|
|
98 |
[Init]
|
|
|
99 |
# Option: abuseipdb_apikey
|
|
|
100 |
# Notes Your API key from abuseipdb.com
|
|
|
101 |
# Values: STRING Default: None
|
|
|
102 |
# Register for abuseipdb [https://www.abuseipdb.com], get api key and set below.
|
|
|
103 |
# You will need to set the category in the action call.
|
|
|
104 |
abuseipdb_apikey =
|