Login Notifications via Statusnet

This will work for the Twitter API as well, but I have a Statusnet installation, so I’m going to use that.  If you put this in the global /etc/bashrc you’ll get notifications when anyone logs in.  You could also just put it in a particular user’s ~.bashrc if you only want notifications for that user.

curl -u user:pass http://myserver/statusnet/api/statuses/update.xml -d status=”`whoami` has logged into `hostname` on `date`”  >/dev/null 2>&1

Where user:pass is a username and password for Statusnet.  Now you’ll see a post on statusnet whenever someone logs in (i.e. sources their .bashrc).  It’s invisible to the user as far as the terminal goes, and will let you know immediately if someone’s managed to crack your server.  Of course it posts for legitimate logins too, but that can be good information.

I’ve got the Statusnet XMPP bot running, so I also get an instant message via my Jabber client.  Kinda neato to receive almost instant notifications of logins with a “ding!”

One thought on “Login Notifications via Statusnet”

  1. So I didn't annoy the rest of my users with a bunch of login stuff in the public timeline, I created a user named "security" for the login notices and put it in the "Sandbox." I can still see the notices by clicking on the username, but they don't show up in the public timeline. Also, since I'm following the "security" user, my XMPP notifications work.

Leave a Reply