Giter Club home page Giter Club logo

fail2ban-mailgun's Introduction

Scripted email messages for fail2ban actions via Mailgun

When fail2ban executes and action, we run these scripts to send the appropriate email with Mailgun

Install

Download the app and set up config files.

$ cd /usr/local/bin
$ git clone https://github.com/scimusmn/fail2ban-mailgun.git
$ cd fail2ban-mailgun
$ cp mailgun_api.default.conf /etc/mailgun_api.conf

Edit the api.conf file, adding your Mailgun API details.

Define a new action in fail2ban at: /etc/fail2ban/action.d/mailgun.conf

[Definition]
actionstart =
actionstop =
actioncheck =
actionban = /usr/local/bin/fail2ban-mailgun/mail.sh ban
actionun = /usr/local/bin/fail2ban-mailgun/mail.sh unban

Modify or add an action entry in the jail you wish to configure. We're assuming that you've copied jail.conf to jail.local and will be adding this rule to the SSH jail entry.

[ssh]

enabled  = true
port     = ssh
filter   = sshd
logpath  = /var/log/auth.log
maxretry = 6
action = %(action_)s
    mailgun

The last part states to set the action to the default action variable, likely defined above in your jail.local file, and then to add the mailgun action to the ban process.

fail2ban-mailgun's People

Contributors

bryankennedy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

phumpal

fail2ban-mailgun's Issues

No ip in email

Notifications of ban/unban are sent via Mailgun without issue however no IP is included in the email.

For example here's a recent notification.

fail2ban banned IP: <ip>

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.