{"id":13626219,"url":"https://github.com/shafiqsaaidin/fail2ban-telegram-notification","last_synced_at":"2026-03-09T22:17:30.930Z","repository":{"id":55096250,"uuid":"122061971","full_name":"shafiqsaaidin/fail2ban-telegram-notification","owner":"shafiqsaaidin","description":"Send notification to Telegram when fail2ban ban and unband an IP Address to alert Network Admin","archived":false,"fork":false,"pushed_at":"2021-01-11T03:18:47.000Z","size":11,"stargazers_count":77,"open_issues_count":3,"forks_count":25,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-08-02T22:22:53.365Z","etag":null,"topics":["fail2ban-telegram-notification","notification","ssh","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shafiqsaaidin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-19T12:52:25.000Z","updated_at":"2024-07-14T21:09:08.000Z","dependencies_parsed_at":"2022-08-14T11:50:29.771Z","dependency_job_id":null,"html_url":"https://github.com/shafiqsaaidin/fail2ban-telegram-notification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafiqsaaidin%2Ffail2ban-telegram-notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafiqsaaidin%2Ffail2ban-telegram-notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafiqsaaidin%2Ffail2ban-telegram-notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafiqsaaidin%2Ffail2ban-telegram-notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shafiqsaaidin","download_url":"https://codeload.github.com/shafiqsaaidin/fail2ban-telegram-notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223716478,"owners_count":17191053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fail2ban-telegram-notification","notification","ssh","telegram","telegram-bot"],"created_at":"2024-08-01T21:02:13.171Z","updated_at":"2026-03-09T22:17:30.894Z","avatar_url":"https://github.com/shafiqsaaidin.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# fail2ban-telegram-notification\nSend notification to telegram when fail2ban ban an IP address and unband an IP address\n\n### Requirement\n- openssh\n- vsftpd \n- fail2ban\n- curl\n- telegram bot api\n\n### Installation\n`$ sudo apt install vsftpd fail2ban ssh-server`\n\n### Configuration\n#### Fail2ban\n- Create a copy of jail.conf `cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local`.\n- Create ban rules in jail.local \u003cbr\u003e\n   ignoreip = 127.0.0.1/8 192.168.1.101   \n   bantime = 3600  \n   findtime = 120   \n   maxretry = 3  \n  \n- Protect vsftpd with fail2ban. Make chage to [vsftpd] section in jail.local\n   enabled = true  \n   filter  = vsftpd  \n   action  =  \n   iptables[name=VSFTPD, port=21, protocol=tcp]  \n   telegram\n   \n - If you want to protect SSH with fail2ban add this to [sshd]  \n   enabled = true  \n   filter  = sshd   \n   maxretry = 3  \n   logpath = /var/log/auth.log  \n   action  =  \n   iptables[name=SSH, port=22, protocol=tcp]  \n   telegram \n   \n - Make script directory to place our shell script  \n `sudo mkdir /etc/fail2ban/scripts/`  \n in the following directory add `fail2ban-telegram.sh`  \n \n - Copy telegram.conf to `/etc/fail2ban/action.d/` directory  \n `cp telegram.conf /etc/fail2ban/action.d/`\n \n - 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](https://www.sohamkamani.com/blog/2016/09/21/making-a-telegram-bot/)\n \n### Start the service  \nsystemctl start ssh-server  \nsystemctl start vsftpd  \nsystemctl start fail2ban\n\n### Demo video\n[![Fail2ban with telegram notification](http://img.youtube.com/vi/LYLiCK5XGXk/0.jpg)](https://youtu.be/LYLiCK5XGXk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshafiqsaaidin%2Ffail2ban-telegram-notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshafiqsaaidin%2Ffail2ban-telegram-notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshafiqsaaidin%2Ffail2ban-telegram-notification/lists"}