On Friday I ran across Sandrino Di Mattia’s post “Posting successful SSH logins to Slack” which was very easy and a very nifty idea. Already most of my notifications from various systems (Datadog, Tutum, Twitter, etc) are gathered into a notification channel on Slack, so I jumped on the chance to try out this script. It worked great, but I realized there was one major issue: my slack notifications are plentiful and passive. I have only a few internet accessible servers and I care about them a great deal, so I want to know if anyone is accessing them (since it should only be me). So I added push notifications for successful SSH logins!
Right now I’m using
PushBullet for Android (and web browser extension) and it works fairly well. They also have an API that’s well documented and easy to use. So I rolled a PushBullet push notification into the previous script.
You can look at my code on github/ShakataGaNai/ssh-notifications which I’ve published under CC-0 (in case anyone cares about licensing for 1 line of code). Being a single additional command, there isn’t much to note but a sample of the notifications are the image above.
Please feel free to use/abuse as you see fit. Instructions for use are included in the README.md file.