From 6cdb5738ec2f840291157744e39f4878f319728b Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Wed, 28 Jan 2026 21:49:42 -0500 Subject: [PATCH 1/7] improved apprise fail2ban integration (support tagging) --- config/action.d/apprise.conf | 6 +++++- config/jail.conf | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/config/action.d/apprise.conf b/config/action.d/apprise.conf index c6ce539a..3d80b2eb 100644 --- a/config/action.d/apprise.conf +++ b/config/action.d/apprise.conf @@ -45,5 +45,9 @@ actionunban = # Define location of the default apprise configuration file to use # config = /etc/fail2ban/apprise.conf + +# Support passing in arguments for example: "-g fail2ban" # -apprise = apprise -c "" +apprise_args = +# +apprise = apprise -c "" diff --git a/config/jail.conf b/config/jail.conf index d0b3fa44..47fa1c35 100644 --- a/config/jail.conf +++ b/config/jail.conf @@ -228,11 +228,16 @@ action_xarf = %(action_)s xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath="%(logpath)s", port="%(port)s"] # ban & send a notification to one or more of the 50+ services supported by Apprise. -# See https://github.com/caronc/apprise/wiki for details on what is supported. +# See https://appriseit.com/services/ for details on what is supported. +# See https://appriseit.com/getting-started/configuration/ for information on how to prepare +# an Apprise configuration file. Both YAML and TEXT formats are supported # -# You may optionally over-ride the default configuration line (containing the Apprise URLs) -# by using 'apprise[config="/alternate/path/to/apprise.cfg"]' otherwise -# /etc/fail2ban/apprise.conf is sourced for your supported notification configuration. +# By default apprise attempts to load the configuration file found in +# /etc/fail2ban/apprise.conf unless you over-ride this. +# +# Leverage apprise_args to optionally identify tags (--tag ) entries +# apprise[config="/alternate/path/to/apprise.cfg", apprise_args='-g fail2ban'] +# apprise[config="/alternate/path/to/apprise.yaml", apprise_args='--tag fail2ban'] # action = %(action_)s # apprise From 8afd0c89560d5af2ab97507e19a9d18ec1cff23e Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Wed, 28 Jan 2026 21:55:04 -0500 Subject: [PATCH 2/7] updated ChangeLog to reflect Apprise updates --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index ab0afcf3..d054c154 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ ver. 1.1.1-dev-1 (20??/??/??) - development nightly edition ----------- ### Compatibility +* `action.d/apprise.conf` updated to support tagging and other command line +* `jail.conf` updated apprise inline reference/documentation +options * `action.d/iptables.conf` rewritten due to support of multiple chains (gh-3909), therefore user-level derivations (action including iptables-based action) may become incompatible, e. g. some tags if used need to be replaced, e. g. `` with `$chain` or `<_ipt_for_proto-iter>` with `<_ipt-iter>`; From 8a8afefd70bc98a42dbddbb3a3cd8e39948a4756 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sun, 1 Feb 2026 19:45:44 -0500 Subject: [PATCH 3/7] applied updates based on PR feedback --- config/action.d/apprise.conf | 67 ++++++++++++++++++++++++++++++++++-- config/jail.conf | 15 +++----- 2 files changed, 69 insertions(+), 13 deletions(-) diff --git a/config/action.d/apprise.conf b/config/action.d/apprise.conf index 3d80b2eb..e025da2f 100644 --- a/config/action.d/apprise.conf +++ b/config/action.d/apprise.conf @@ -2,8 +2,69 @@ # # Author: Chris Caron # +# ban & send a notification to one or more of the 120+ services supported by +# Apprise. +# - See https://appriseit.com/services/ for details on what is supported. +# - See https://appriseit.com/getting-started/configuration/ for information +# on how to prepare an Apprise configuration file. # - +# This plugin requires that Apprise is installed on your system: +# +# pip install apprise +# +# Breakdown: +# config provide a path to an Apprise Config file +# Thie default is /etc/fail2ban/apprise.conf if not provided. +# Both YAML and TEXT formats are supported. +# You can even point your configuration to an Apprise API +# endpoint. +# +# args Provide additional arguments to support the Apprise CLI. +# See https://appriseit.com/cli/usage/ for additional options. +# the --tag (-g) is incredibly useful for integrating with +# fail2ban as you can exculsively have it target specific +# notifications this way. +# +# Config Example #1: Simple +# 1. Create a /etc/fail2ban/apprise.conf +# ``` +# # /etc/fail2ban/apprise.conf +# fail2ban=mailto://user:pass@example.com +# ``` +# 2 In /etc/fail2ban/jail.conf +# ``` +# # ... +# apprise[args='--tag fail2ban'] +# action = %(action_)s +# apprise +# # ... +# ``` +# +# Config Example #2: YAML an Custom path +# 1. Create a /etc/fail2ban/apprise.conf +# ``` +# # /etc/fail2ban/apprise.yaml +# urls: +# - mailto://user:pass@example.com: +# tags: f2b +# ``` +# 2. In /etc/fail2ban/jail.conf +# ``` +# # ... +# apprise[config='/etc/fail2ban/apprise.yaml',args='--tag f2b'] +# action = %(action_)s +# apprise +# # ... +# ``` +# +# Config Example #3: Apprise API +# 1. in /etc/fail2ban/jail.conf +# ``` +# # ... +# apprise[config='http://apprise.example.ca/get/mykey',args='-g f2b'] +# action = %(action_)s +# apprise +# # ... [Definition] # Option: actionstart @@ -48,6 +109,6 @@ config = /etc/fail2ban/apprise.conf # Support passing in arguments for example: "-g fail2ban" # -apprise_args = +args = # -apprise = apprise -c "" +apprise = apprise -c "" diff --git a/config/jail.conf b/config/jail.conf index 47fa1c35..d53de584 100644 --- a/config/jail.conf +++ b/config/jail.conf @@ -227,17 +227,12 @@ action_mwl = %(action_)s action_xarf = %(action_)s xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath="%(logpath)s", port="%(port)s"] -# ban & send a notification to one or more of the 50+ services supported by Apprise. -# See https://appriseit.com/services/ for details on what is supported. -# See https://appriseit.com/getting-started/configuration/ for information on how to prepare -# an Apprise configuration file. Both YAML and TEXT formats are supported +# Apprise Integration # -# By default apprise attempts to load the configuration file found in -# /etc/fail2ban/apprise.conf unless you over-ride this. -# -# Leverage apprise_args to optionally identify tags (--tag ) entries -# apprise[config="/alternate/path/to/apprise.cfg", apprise_args='-g fail2ban'] -# apprise[config="/alternate/path/to/apprise.yaml", apprise_args='--tag fail2ban'] +# Leverage args to optionally identify tags (--tag ) entries +# - See action.d/apprise.conf for more details in your current installation +# - config= default is /etc/fail2ban/apprise.conf unless you over-ride it. +# apprise[args='--tag fail2ban'] # action = %(action_)s # apprise From 36e28359ed907ba720611db4c89c0b6da02293f3 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sun, 1 Feb 2026 19:51:26 -0500 Subject: [PATCH 4/7] fixed spelling --- config/action.d/apprise.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/action.d/apprise.conf b/config/action.d/apprise.conf index e025da2f..783c740b 100644 --- a/config/action.d/apprise.conf +++ b/config/action.d/apprise.conf @@ -14,7 +14,7 @@ # # Breakdown: # config provide a path to an Apprise Config file -# Thie default is /etc/fail2ban/apprise.conf if not provided. +# The default is /etc/fail2ban/apprise.conf if not provided. # Both YAML and TEXT formats are supported. # You can even point your configuration to an Apprise API # endpoint. @@ -22,7 +22,7 @@ # args Provide additional arguments to support the Apprise CLI. # See https://appriseit.com/cli/usage/ for additional options. # the --tag (-g) is incredibly useful for integrating with -# fail2ban as you can exculsively have it target specific +# fail2ban as you can exclusively have it target specific # notifications this way. # # Config Example #1: Simple From 1a802bee93a4aa942d3869784b2f81a4964e1a1f Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sun, 1 Feb 2026 20:18:07 -0500 Subject: [PATCH 5/7] further feedback from PR --- config/jail.conf | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/config/jail.conf b/config/jail.conf index d53de584..aa2da268 100644 --- a/config/jail.conf +++ b/config/jail.conf @@ -227,14 +227,11 @@ action_mwl = %(action_)s action_xarf = %(action_)s xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath="%(logpath)s", port="%(port)s"] -# Apprise Integration -# -# Leverage args to optionally identify tags (--tag ) entries -# - See action.d/apprise.conf for more details in your current installation -# - config= default is /etc/fail2ban/apprise.conf unless you over-ride it. -# apprise[args='--tag fail2ban'] +# ban & send a notification to one or more of the 120+ services supported by Apprise. # action = %(action_)s -# apprise +# apprise[config="/alternate/path/to/apprise.yaml", args='--tag fail2ban'] +# See https://github.com/caronc/apprise/wiki for details on what is supported. +# Or action.d/apprise.conf for more details how to configure or customize it. # ban IP on CloudFlare & send an e-mail with whois report and relevant log lines # to the destemail. From f457cf81319f80d2be0f55dc32551e095a4c73ac Mon Sep 17 00:00:00 2001 From: "Sergey G. Brester" Date: Mon, 2 Feb 2026 02:31:19 +0100 Subject: [PATCH 6/7] ChangeLog adjusted move from compat to enhancement section --- ChangeLog | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d054c154..abb9a424 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,9 +11,6 @@ ver. 1.1.1-dev-1 (20??/??/??) - development nightly edition ----------- ### Compatibility -* `action.d/apprise.conf` updated to support tagging and other command line -* `jail.conf` updated apprise inline reference/documentation -options * `action.d/iptables.conf` rewritten due to support of multiple chains (gh-3909), therefore user-level derivations (action including iptables-based action) may become incompatible, e. g. some tags if used need to be replaced, e. g. `` with `$chain` or `<_ipt_for_proto-iter>` with `<_ipt-iter>`; @@ -101,6 +98,7 @@ options by first ban (and automatically reloaded by update after small latency to avoid expensive stats check on every compare); the entries inside the file can be separated by comma, space or new line with optional comments (text following chars `#` or `;` after space or newline would be ignored up to next newline) +* `action.d/apprise.conf` - updated to support tagging and other command line args (gh-4141) * `action.d/*-ipset.conf`: - parameter `ipsettype` to set type of ipset, e. g. hash:ip, hash:net, etc (gh-3760) * `action.d/iptables.conf` - action and few derivatives of it extended to handle multiple chains, From 025adbf48598b5fa014c73e4e158caa58efb3c87 Mon Sep 17 00:00:00 2001 From: "Sergey G. Brester" Date: Mon, 2 Feb 2026 02:37:26 +0100 Subject: [PATCH 7/7] fixes apprise action configuration examples --- config/action.d/apprise.conf | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/config/action.d/apprise.conf b/config/action.d/apprise.conf index 783c740b..4b8708a3 100644 --- a/config/action.d/apprise.conf +++ b/config/action.d/apprise.conf @@ -34,9 +34,8 @@ # 2 In /etc/fail2ban/jail.conf # ``` # # ... -# apprise[args='--tag fail2ban'] # action = %(action_)s -# apprise +# apprise[args='--tag fail2ban'] # # ... # ``` # @@ -51,9 +50,8 @@ # 2. In /etc/fail2ban/jail.conf # ``` # # ... -# apprise[config='/etc/fail2ban/apprise.yaml',args='--tag f2b'] # action = %(action_)s -# apprise +# apprise[config='/etc/fail2ban/apprise.yaml',args='--tag f2b'] # # ... # ``` # @@ -61,9 +59,8 @@ # 1. in /etc/fail2ban/jail.conf # ``` # # ... -# apprise[config='http://apprise.example.ca/get/mykey',args='-g f2b'] # action = %(action_)s -# apprise +# apprise[config='http://apprise.example.ca/get/mykey',args='-g f2b'] # # ... [Definition]