You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mageas ef9f1c9eb9
Initial commit
1 month ago
README.org Initial commit 1 month ago

README.org

Fail2Ban

Discord Notifications

The original author of this method is Gilbn.

Add The Discord Notifications Action

Add a new file in /etc/fail2ban/action.d/discord_notifications.conf.

option description
norestored https://github.com/fail2ban/fail2ban/pull/1669
name name of the jail in jail.local, default = [your-jail-name]
ban_webhook discord ban webhook url
unban_webhook discord unban webhook url
status_webhook discord status webhook url
[Definition]

norestored = 1

actionstart = curl -X POST "<status_webhook>" \
            -H "Content-Type: application/json" \
            -d '{"username":"Fail2Ban","avatar_url":"","content":"","embeds":[{"color":2531945,"timestamp":"","author":{"name":"<name>"},"image":{},"thumbnail":{},"footer":{},"fields":[]}],"components":[]}'

actionstop = curl -X POST "<status_webhook>" \
            -H "Content-Type: application/json" \
            -d '{"username":"Fail2Ban","avatar_url":"","content":"","embeds":[{"color":10820909,"timestamp":"","author":{"name":"<name>"},"image":{},"thumbnail":{},"footer":{},"fields":[]}],"components":[]}'

actioncheck =

actionban = curl -X POST "<ban_webhook>" \
            -H "Content-Type: application/json" \
            -d '{"username":"Fail2Ban","avatar_url":"","content":"","embeds":[{"title":"<ip>","color":<color>,"description":"<bantime> seconds after <failures> failures.","timestamp":"","url":"https://db-ip.com/<ip>","author":{},"image":{},"thumbnail":{},"footer":{"text":"<name>"},"fields":[]}],"components":[]}'

actionunban = curl -X POST "<unban_webhook>" \
            -H "Content-Type: application/json" \
            -d '{"username":"Fail2Ban","avatar_url":"","content":"","embeds":[{"title":"<ip>","color":<color>,"description":"","timestamp":"","url":"https://db-ip.com/<ip>","author":{},"image":{},"thumbnail":{},"footer":{"text":"<name>"},"fields":[]}],"components":[]}'

[Init]

name = default

ban_webhook =
unban_webhook =
status_webhook =

Update jail.local

Update your /etc/fail2ban/jail.local.

Examples of integrations:

action = discord_notifications[color=1728436]

action = iptables-allports[name=vaultwarden, chain=FORWARD]
         discord_notifications[color=14358003]