Giter Site home page Giter Site logo

fail2ban-mattermost-notifications's Introduction

fail2ban-mattermost-notifications

Receive Mattermost notifications when Fail2ban triggers an action (ban, unban, start, stop)

mattermost_notif mattermost_notif

Requirements

  • curl
  • geoiplookup

Usage

  • Copy mattermost.sh (/opt/scripts/mattermost.sh for example) and set your webhook url (line 3)
  • Copy mattermost.conf into /etc/fail2ban/action.d and set the right script location
  • Update your jails and include the mattermost action

Example with the Nginx jail

[nginx-http-auth]
enabled = true
port    = http,https
logpath = %(nginx_error_log)s
action = ufw
         mattermost

That's it !

fail2ban-mattermost-notifications's People

Contributors

mbelloiseau avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

prhr

fail2ban-mattermost-notifications's Issues

Does this still work and does the server have to be local?

Follow your steps including plugging in my webhook url.

Nothing is working. Swag log looks clean

Testing with Vaultwarden logs (See bottom rows of jails config)

I have my vaultwarden log mounted at /logs/bitwarden/vaultwarden.log and Sonarr at /logs/sonarr/sonarr.txt

My Jails file

## Version 2020/05/10 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/jail.local
# This is the custom version of the jail.conf for fail2ban
# Feel free to modify this and add additional filters
# Then you can drop the new filter conf files into the fail2ban-filters
# folder and restart the container

[DEFAULT]

# Changes the default ban action from "iptables-multiport", which causes issues on some platforms, to "iptables-allports".
banaction = iptables-allports

# "bantime" is the number of seconds that a host is banned.
bantime  = 600

# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime  = 600

# "maxretry" is the number of failures before a host get banned.
maxretry = 5


[ssh]

enabled = false


[nginx-http-auth]

enabled  = true
filter   = nginx-http-auth
port     = http,https
logpath  = /config/log/nginx/error.log
#action =  mattermost

[nginx-badbots]

enabled  = true
port     = http,https
filter   = nginx-badbots
logpath  = /config/log/nginx/access.log
maxretry = 2
#action = mattermost

[nginx-botsearch]

enabled  = true
port     = http,https
filter   = nginx-botsearch
logpath  = /config/log/nginx/access.log
#action =  mattermost

[nginx-deny]
enabled  = true
port     = http,https
filter   = nginx-deny
logpath  = /config/log/nginx/error.log
#action = mattermost

[sonarr]
enabled  = true
filter = sonarr-auth
maxretry = 3
logpath  = /logs/sonarr/sonarr.txt
#action = mattermost


[vaultwarden]
enabled = true
port = 80,443,8081
filter = vaultwarden
logpath = /logs/bitwarden/vaultwarden.log
action = mattermost

[vaultwarden-admin]
enabled = true
port = 80,443,8081
filter = vaultwarden-admin
logpath = /logs/bitwarden/vaultwarden.log
action =  mattermost

View of logs inside swag container

root@7db4dd4e3f23:/logs/bitwarden# ls
2-20  config.json  db.sqlite3  db.sqlite3-shm  db.sqlite3-wal  icon_cache  logs  rsa_key.der  rsa_key.pem  rsa_key.pub.der  rsa_key.pub.pem  vaultwarden.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.