How to get Pushbullet notifications on Fail2ban's ban actions
- Receive Pushbullet notifications when Fail2ban’s ban action is triggered.
- Those notifications should include the protocol, banned ip, and geo location.
1. Get your Pushbullet access token
Visit this page and get your access token.
Download the code,
change MyPushbulletChannel and MyPushbulletToken to yours,
and build it:
Now you got the executable binary: pushbullet-fail2ban.
To make things sure, you can test it:
If you get a message like this, everything is good so far:
5. Configure Fail2ban
Firstly, duplicate your current ban action:
then append a line at the end of actionban, which will execute pushbullet-fail2ban:
(Of course, you should edit /path/to/this/ to yours.)
Now, edit your jail.local file:
banaction should be edited like this:
Finally, restart the Fail2ban service:
Geo ip info is provided by FreeGeoIP.
If you want to see more about the geo ip (like zip code, longitude/latitude, or etc.),
edit the lines near the call of getFreeGeoIpResult() function.