Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deividgdt/fail2ban_telegram_notifications
Sending fail2ban notifications using a Telegram bot
https://github.com/deividgdt/fail2ban_telegram_notifications
bot fail2ban fail2ban-telegram-notifications notifications telegram
Last synced: 3 months ago
JSON representation
Sending fail2ban notifications using a Telegram bot
- Host: GitHub
- URL: https://github.com/deividgdt/fail2ban_telegram_notifications
- Owner: deividgdt
- License: gpl-3.0
- Created: 2020-04-18T17:59:17.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T13:12:33.000Z (over 3 years ago)
- Last Synced: 2024-10-11T02:29:08.080Z (4 months ago)
- Topics: bot, fail2ban, fail2ban-telegram-notifications, notifications, telegram
- Language: Shell
- Homepage:
- Size: 39.1 KB
- Stars: 25
- Watchers: 5
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fail2ban Telegram Notifications
![](https://deividsdocs.files.wordpress.com/2020/04/telegram_notifications_fail2ban.jpg)
Sending **fail2ban** notifications using a **Telegram** bot
## Installation and configuration
- Add the following two lines, for example, to **SSHD** in the file **/etc/fail2ban/jail.conf**, make sure to tab the word **telegram**.
```sh
action = iptables[name=SSH, port=22, protocol=tcp]
telegram
```
Example:
![](https://deividsdocs.files.wordpress.com/2020/04/fail2ban-sshd-conf.png)
- Download the file **telegram.conf** and move it to **/etc/fail2ban/action.d/**
- Download the file **send_telegram_notif.sh** move it to **/etc/fail2ban/scripts/**
- Modify the file **/etc/fail2ban/scripts/send_telegram_notif.sh** and add your **Token** and your **Chat ID**:```sh
telegramBotToken=YOUR_BOT_TOKEN
telegramChatID=YOUR_CHAT_ID
```
- Make the file executable```sh
chmod +x /etc/fail2ban/scripts/send_telegram_notif.sh
```
- Restart the fail2ban service and enjoy!```sh
systemctl restart fail2ban
```
## Usage
+ /etc/fail2ban/scripts/send_telegram_notif.sh -a [ start || stop ] || [ -n $NAME -b $IP || -n $NAME -u $IP ]"
+ -a (action)
+ -n (jail name)
+ -b (ban)
+ -u (unban)
## Buy me a coffe
[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/U7U01LTQB)