GithubHelp home page GithubHelp logo

carlosacchi / fail2ban-telegram-notification Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 25 KB

Send notification to telegram when fail2ban ban an IP address and unband an IP address from SSHD service

Shell 100.00%

fail2ban-telegram-notification's Introduction

Version Buils

Fail2ban Telegram Notification

Send notification to telegram when fail2ban ban an IP address and unband an IP address from SSHD service

Requirement

  • fail2ban version: v0.10.2
  • telegram bot api

Installation

$ sudo apt install fail2ban

Configuration

Fail2ban

  • Create a copy of jail.conf cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local.

  • Create ban rules in jail.local
    ignoreip = 127.0.0.1/8 192.168.1.101
    bantime = 3600
    findtime = 120
    maxretry = 3

  • If you want to protect SSH with fail2ban add this to [sshd]
    enabled = true
    filter = sshd
    maxretry = 3
    logpath = /var/log/auth.log
    action = telegram

  • Make script directory to place our shell script
    sudo mkdir /etc/fail2ban/scripts/
    in the following directory add fail2ban-telegram.sh

  • Copy telegram.conf to /etc/fail2ban/action.d/ directory
    cp telegram.conf /etc/fail2ban/action.d/

  • Edit fail2ban-telegram.sh and replace the apiToken and chatId with your api. You must create telegram bot first and get the api key here

Start the service

sudo systemctl start fail2ban

fail2ban-telegram-notification's People

Contributors

carlosacchi avatar shafiqsaaidin avatar

Stargazers

 avatar weiting avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

weiting-tw

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.