Skip to content

Commit 1a58ab6

Browse files
authored
Merge pull request #37 from naXa777/sync
2 parents e8b5e7e + 24a7e12 commit 1a58ab6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+660
-242
lines changed

action.d/abuseipdb.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2024/05/20
22
# Fail2ban configuration file
33
#
44
# Action to report IP address to abuseipdb.com
@@ -81,7 +81,7 @@ actioncheck =
8181
# use my (Shaun's) helper PHP script by commenting out the first #actionban
8282
# line below, uncommenting the second one, and pointing the URL at
8383
# wherever you install the helper script. For the PHP helper script, see
84-
# <https://wiki.shaunc.com/wikka.php?wakka=ReportingToAbuseIPDBWithFail2Ban>
84+
# <https://github.com/parseword/fail2ban-abuseipdb/>
8585
#
8686
# Tags: See jail.conf(5) man page
8787
# Values: CMD

action.d/apprise.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2024/09/02
22
# Fail2Ban configuration file
33
#
44
# Author: Chris Caron <[email protected]>
@@ -11,7 +11,7 @@
1111
# Notes.: command executed once at the start of Fail2Ban.
1212
# Values: CMD
1313
#
14-
actionstart = printf %%b "The jail <name> as been started successfully." | <apprise> -t "[Fail2Ban] <name>: started on `uname -n`"
14+
actionstart = printf %%b "The jail <name> has been started successfully." | <apprise> -t "[Fail2Ban] <name>: started on `uname -n`"
1515

1616
# Option: actionstop
1717
# Notes.: command executed once at the end of Fail2Ban

action.d/blocklist_de.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2019/06/29
22
# Fail2Ban configuration file
33
#
44
# Author: Steven Hiscocks
@@ -31,6 +31,9 @@
3131

3232
[Definition]
3333

34+
# bypass reporting of restored (already reported) tickets:
35+
norestored = 1
36+
3437
# Option: actionstart
3538
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
3639
# Values: CMD

action.d/bsd-ipfw.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2023/11/18
22
# Fail2Ban configuration file
33
#
44
# Author: Nick Munger
@@ -81,7 +81,7 @@ block = ip
8181
# Option: blocktype
8282
# Notes.: How to block the traffic. Use a action from man 5 ipfw
8383
# Common values: deny, unreach port, reset
84-
# ACTION defination at the top of man ipfw for allowed values.
84+
# ACTION definition at the top of man ipfw for allowed values.
8585
# Values: STRING
8686
#
8787
blocktype = unreach port

action.d/cloudflare-token.conf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/12/15
1+
## Version 2025/03/01
22
#
33
# Author: Logic-32
44
#
@@ -51,11 +51,12 @@ actionban = curl -s -X POST "<_cf_api_url>" \
5151
# <time> unix timestamp of the ban time
5252
# Values: CMD
5353
#
54-
actionunban = id=$(curl -s -X GET "<_cf_api_url>?mode=<cfmode>&notes=<notes>&configuration.target=<cftarget>&configuration.value=<ip>" \
55-
<_cf_api_prms> \
56-
| awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'id'\042/){print $(i+1)}}}' \
57-
| tr -d ' "' \
58-
| head -n 1)
54+
actionunban = id=$(curl -s -G -X GET "<_cf_api_url>" \
55+
--data-urlencode "mode=<cfmode>" --data-urlencode "notes=<notes>" --data-urlencode "configuration.target=<cftarget>" --data-urlencode "configuration.value=<ip>" \
56+
<_cf_api_prms> \
57+
| awk -F"[,:}]" '{for(i=1;i<=NF;i++){if($i~/'id'\042/){print $(i+1)}}}' \
58+
| tr -d ' "' \
59+
| head -n 1)
5960
if [ -z "$id" ]; then echo "<name>: id for <ip> cannot be found using target <cftarget>"; exit 0; fi; \
6061
curl -s -X DELETE "<_cf_api_url>/$id" \
6162
<_cf_api_prms> \

action.d/complain.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2023/11/22
22
# Fail2Ban configuration file
33
#
44
# Author: Russell Odom <[email protected]>, Daniel Black
@@ -17,7 +17,7 @@
1717
#
1818
# Please do not use this action unless you are certain that fail2ban
1919
# does not result in "false positives" for your deployment. False
20-
# positive reports could serve a mis-favor to the original cause by
20+
# positive reports could serve a misfavor to the original cause by
2121
# flooding corresponding contact addresses, and complicating the work
2222
# of administration personnel responsible for handling (verified) legit
2323
# complains.

action.d/firewallcmd-ipset.conf

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2024/11/07
22
# Fail2Ban action file for firewall-cmd/ipset
33
#
44
# This requires:
@@ -19,36 +19,36 @@ before = firewallcmd-common.conf
1919

2020
[Definition]
2121

22-
actionstart = <ipstype_<ipsettype>/actionstart>
22+
actionstart = <ipsbackend_<ipsetbackend>/actionstart>
2323
firewall-cmd --direct --add-rule <family> filter <chain> 0 <actiontype> -m set --match-set <ipmset> src -j <blocktype>
2424

25-
actionflush = <ipstype_<ipsettype>/actionflush>
25+
actionflush = <ipsbackend_<ipsetbackend>/actionflush>
2626

2727
actionstop = firewall-cmd --direct --remove-rule <family> filter <chain> 0 <actiontype> -m set --match-set <ipmset> src -j <blocktype>
2828
<actionflush>
29-
<ipstype_<ipsettype>/actionstop>
29+
<ipsbackend_<ipsetbackend>/actionstop>
3030

31-
actionban = <ipstype_<ipsettype>/actionban>
31+
actionban = <ipsbackend_<ipsetbackend>/actionban>
3232

3333
# actionprolong = %(actionban)s
3434

35-
actionunban = <ipstype_<ipsettype>/actionunban>
35+
actionunban = <ipsbackend_<ipsetbackend>/actionunban>
3636

37-
[ipstype_ipset]
37+
[ipsbackend_ipset]
3838

39-
actionstart = ipset -exist create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
39+
actionstart = ipset -exist create <ipmset> <ipsettype> timeout <default-ipsettime> maxelem <maxelem> <familyopt>
4040

4141
actionflush = ipset flush <ipmset>
4242

43-
actionstop = ipset destroy <ipmset>
43+
actionstop = ipset destroy <ipmset> 2>/dev/null || { sleep 1; ipset destroy <ipmset>; }
4444

4545
actionban = ipset -exist add <ipmset> <ip> timeout <ipsettime>
4646

4747
actionunban = ipset -exist del <ipmset> <ip>
4848

49-
[ipstype_firewalld]
49+
[ipsbackend_firewalld]
5050

51-
actionstart = firewall-cmd --direct --new-ipset=<ipmset> --type=hash:ip --option=timeout=<default-ipsettime> <firewalld_familyopt>
51+
actionstart = firewall-cmd --direct --new-ipset=<ipmset> --type=<ipsettype> --option=timeout=<default-ipsettime> --option=maxelem=<maxelem> <firewalld_familyopt>
5252

5353
# TODO: there doesn't seem to be an explicit way to invoke the ipset flush function using firewall-cmd
5454
actionflush =
@@ -61,6 +61,11 @@ actionunban = firewall-cmd --ipset=<ipmset> --remove-entry=<ip>
6161

6262
[Init]
6363

64+
# Option: ipsettype
65+
# Notes: specifies type of set, see `man --pager='less -p "^SET TYPES"' ipset` for details
66+
# Values: hash:ip, hash:net, etc... Default: hash:ip
67+
ipsettype = hash:ip
68+
6469
# Option: chain
6570
# Notes specifies the iptables chain to which the fail2ban rules should be
6671
# added
@@ -78,15 +83,21 @@ default-ipsettime = 0
7883
# Values: [ NUM ] Default: 0 (managed by fail2ban by unban)
7984
ipsettime = 0
8085

81-
# expresion to caclulate timeout from bantime, example:
86+
# Option: maxelem
87+
# Notes: maximal number of elements which can be stored in the ipset
88+
# You may want to increase this for long-duration/high-volume jails
89+
# Values: [ NUM ] Default: 65536
90+
maxelem = 65536
91+
92+
# expression to calculate timeout from bantime, example:
8293
# banaction = %(known/banaction)s[ipsettime='<timeout-bantime>']
8394
timeout-bantime = $([ "<bantime>" -le 2147483 ] && echo "<bantime>" || echo 0)
8495

85-
# Option: ipsettype
86-
# Notes.: defines type of ipset used for match-set (firewalld or ipset)
96+
# Option: ipsetbackend
97+
# Notes.: defines the backend of ipset used for match-set (firewalld or ipset)
8798
# Values: firewalld or ipset
8899
# Default: ipset
89-
ipsettype = ipset
100+
ipsetbackend = ipset
90101

91102
# Option: actiontype
92103
# Notes.: defines additions to the blocking rule
@@ -119,4 +130,4 @@ firewalld_familyopt = --option=family=inet6
119130
# DEV NOTES:
120131
#
121132
# Author: Edgar Hoch, Daniel Black, Sergey Brester and Mihail Politaev
122-
# firewallcmd-new / iptables-ipset-proto6 combined for maximium goodness
133+
# firewallcmd-new / iptables-ipset-proto6 combined for maximum goodness

action.d/firewallcmd-rich-rules.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2024/08/07
22
# Fail2Ban configuration file
33
#
44
# Author: Donald Yandt
@@ -36,7 +36,7 @@ actioncheck =
3636
#
3737
# Because rich rules can only handle single or a range of ports we must split ports and execute the command for each port. Ports can be single and ranges separated by a comma or space for an example: http, https, 22-60, 18 smtp
3838

39-
fwcmd_rich_rule = rule family='<family>' source address='<ip>' port port='$p' protocol='<protocol>' %(rich-suffix)s
39+
fwcmd_rich_rule = rule family=\"<family>\" source address=\"<ip>\" port port=\"$p\" protocol=\"<protocol>\" %(rich-suffix)s
4040

4141
actionban = ports="<port>"; for p in $(echo $ports | tr ", " " "); do firewall-cmd --add-rich-rule="%(fwcmd_rich_rule)s"; done
4242

action.d/iptables-ipset-proto4.conf

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2023/11/18
22
# Fail2Ban configuration file
33
#
44
# Author: Daniel Black
@@ -28,7 +28,7 @@ before = iptables.conf
2828
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
2929
# Values: CMD
3030
#
31-
actionstart = ipset --create f2b-<name> iphash
31+
actionstart = ipset --create f2b-<name> maxelem <maxelem> iphash
3232
<_ipt_add_rules>
3333

3434

@@ -62,6 +62,14 @@ actionban = ipset --test f2b-<name> <ip> || ipset --add f2b-<name> <ip>
6262
#
6363
actionunban = ipset --test f2b-<name> <ip> && ipset --del f2b-<name> <ip>
6464

65-
# Several capabilities used internaly:
65+
# Several capabilities used internally:
6666

6767
rule-jump = -m set --match-set f2b-<name> src -j <blocktype>
68+
69+
[Init]
70+
71+
# Option: maxelem
72+
# Notes: maximal number of elements which can be stored in the ipset
73+
# You may want to increase this for long-duration/high-volume jails
74+
# Values: [ NUM ] Default: 65536
75+
maxelem = 65536

action.d/iptables-ipset.conf

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2022/08/06
1+
## Version 2024/11/07
22
# Fail2Ban configuration file
33
#
44
# Authors: Sergey G Brester (sebres), Daniel Black, Alexander Koeppe
@@ -25,7 +25,7 @@ before = iptables.conf
2525
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
2626
# Values: CMD
2727
#
28-
actionstart = ipset -exist create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
28+
actionstart = ipset -exist create <ipmset> <ipsettype> timeout <default-ipsettime> maxelem <maxelem> <familyopt>
2929
<_ipt_add_rules>
3030

3131
# Option: actionflush
@@ -40,7 +40,7 @@ actionflush = ipset flush <ipmset>
4040
#
4141
actionstop = <_ipt_del_rules>
4242
<actionflush>
43-
ipset destroy <ipmset>
43+
ipset destroy <ipmset> 2>/dev/null || { sleep 1; ipset destroy <ipmset>; }
4444

4545
# Option: actionban
4646
# Notes.: command executed when banning an IP. Take care that the
@@ -60,13 +60,18 @@ actionban = ipset -exist add <ipmset> <ip> timeout <ipsettime>
6060
#
6161
actionunban = ipset -exist del <ipmset> <ip>
6262

63-
# Several capabilities used internaly:
63+
# Several capabilities used internally:
6464

6565
rule-jump = -m set --match-set <ipmset> src -j <blocktype>
6666

6767

6868
[Init]
6969

70+
# Option: ipsettype
71+
# Notes: specifies type of set, see `man --pager='less -p "^SET TYPES"' ipset` for details
72+
# Values: hash:ip, hash:net, etc... Default: hash:ip
73+
ipsettype = hash:ip
74+
7075
# Option: default-ipsettime
7176
# Notes: specifies default timeout in seconds (handled default ipset timeout only)
7277
# Values: [ NUM ] Default: 0 (no timeout, managed by fail2ban by unban)
@@ -77,7 +82,13 @@ default-ipsettime = 0
7782
# Values: [ NUM ] Default: 0 (managed by fail2ban by unban)
7883
ipsettime = 0
7984

80-
# expresion to caclulate timeout from bantime, example:
85+
# Option: maxelem
86+
# Notes: maximal number of elements which can be stored in the ipset
87+
# You may want to increase this for long-duration/high-volume jails
88+
# Values: [ NUM ] Default: 65536
89+
maxelem = 65536
90+
91+
# expression to calculate timeout from bantime, example:
8192
# banaction = %(known/banaction)s[ipsettime='<timeout-bantime>']
8293
timeout-bantime = $([ "<bantime>" -le 2147483 ] && echo "<bantime>" || echo 0)
8394

0 commit comments

Comments
 (0)