# Fail2Ban configuration file
#
# Author: Chris Caron <lead2gold@gmail.com>
#
# 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
#                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.
#
#       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 exclusively 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 jail:
#         ```
#         action = %(action_)s
#                  apprise[args='--tag fail2ban']
#         ```
#
#    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 jail:
#         ```
#         action = %(action_)s
#                  apprise[config='/etc/fail2ban/apprise.yaml',args='--tag f2b']
#         ```
#
#    Config Example #3: Apprise API
#      1. In jail:
#         ```
#         action = %(action_)s
#                  apprise[config='http://apprise.example.ca/get/mykey',args='-g f2b']
#         ```

[Definition]

# Option:  actionstart
# Notes.:  command executed once at the start of Fail2Ban.
# Values:  CMD
#
actionstart = printf %%b "The jail <name> has been started successfully." | <apprise> -t "[Fail2Ban] <name>: started on `uname -n`"

# Option:  actionstop
# Notes.:  command executed once at the end of Fail2Ban
# Values:  CMD
#
actionstop = printf %%b "The jail <name> has been stopped." | <apprise> -t "[Fail2Ban] <name>: stopped on `uname -n`"

# Option:  actioncheck
# Notes.:  command executed once before each actionban command
# Values:  CMD
#
actioncheck =

# Option:  actionban
# Notes.:  command executed when banning an IP. Take care that the
#          command is executed with Fail2Ban user rights.
# Tags:    See jail.conf(5) man page
# Values:  CMD
#
actionban = printf %%b "The IP <ip> has just been banned by Fail2Ban after <failures> attempts against <name>" | <apprise> -n "warning" -t "[Fail2Ban] <name>: banned <ip> from `uname -n`"

# Option:  actionunban
# Notes.:  command executed when unbanning an IP. Take care that the
#          command is executed with Fail2Ban user rights.
# Tags:    See jail.conf(5) man page
# Values:  CMD
#
actionunban =

[Init]

# Define location of the default apprise configuration file to use
#
config = /etc/fail2ban/apprise.conf

# Support passing in arguments for example: "-g fail2ban"
#
args =
#
apprise = apprise -c "<config>" <args>
