From fda4701633ef3788d2cb7a35f5f6b9d3f9ce2e9f Mon Sep 17 00:00:00 2001 From: Yankee030 Date: Wed, 3 Dec 2025 14:16:27 -0500 Subject: [PATCH] Add Discord webhook notification action --- config/action.d/discord-webhook.conf | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 config/action.d/discord-webhook.conf diff --git a/config/action.d/discord-webhook.conf b/config/action.d/discord-webhook.conf new file mode 100644 index 00000000..68e25d75 --- /dev/null +++ b/config/action.d/discord-webhook.conf @@ -0,0 +1,51 @@ +# Fail2Ban configuration file for Discord Webhook notifications +# +# Author: JY +# +# +# [Usage] +# +# To enable this action, add the following to your jail.local file: +# +# [DEFAULT] +# action = %(action_)s +# discord-webhook[webhook="YOUR_DISCORD_WEBHOOK_URL"] +# +# Or for a specific jail: +# +# [sshd] +# action = discord-webhook[webhook="YOUR_DISCORD_WEBHOOK_URL"] +# + +[Definition] + +# Option: actionstart +actionstart = curl -X POST -H "Content-Type: application/json" \ + -d '{"content": ":white_check_mark: [Fail2Ban] Jail **** has been started on ****."}' \ + + +# Option: actionstop +actionstop = curl -X POST -H "Content-Type: application/json" \ + -d '{"content": ":octagonal_sign: [Fail2Ban] Jail **** has been stopped on ****."}' \ + + +# Option: actioncheck +actioncheck = + +# Option: actionban +actionban = curl -X POST -H "Content-Type: application/json" \ + -d '{"content": ":lock: [Fail2Ban] **BANNED** \n**Jail:** \n**IP:** \n**Failures:** \n**Host:** "}' \ + + +# Option: actionunban +actionunban = curl -X POST -H "Content-Type: application/json" \ + -d '{"content": ":unlock: [Fail2Ban] **UNBANNED** \n**Jail:** \n**IP:** \n**Host:** "}' \ + + +[Init] + +# Default name of the jail +name = default + +# Discord Webhook URL (Override this in your jail.local) +webhook = https://discord.com/api/webhooks/your-default-webhook