Friday, February 1, 2013

SSH Login Prowl Notifications Linux

SSH Prowl Notifications Linux.

Get notifications for events on your IPhone is a nice thing.
You can get notifications for every event that you like.

Here is a small HowTo for Prowl notifications for SSH Logins on your Linux box.

Short Version
  1. Get a Prowl account and API Key: https://www.prowlapp.com
  2. Install the IPhone app.
  3. Download the Prowl Script: https://prowl.weks.net/static/prowl.pl
  4. Edit your /etc/bashrc file

Step by Step

Register at https://www.prowlapp.com/register.php
Generate your API Key at https://www.prowlapp.com/api_settings.php

Download the Prowl Perl Script at https://prowl.weks.net/static/prowl.pl
I have placed it at "/usr/bin/" and "chmod 755" on "/usr/bin/prowl.pl"

Install the Prowl APP on your IPhone. And Login with your new account.

I had to install on my Centos 6.3
perl-WWW-Curl
openssl-perl
perl-Crypt-SSLeay

To get this Script running.


To Enable SSH Login Notifications for every login.
edit
"/etc/bashrc"
and add at the bottom
/usr/bin/prowl.pl -apikey="YOUR API KEY" -application="prowl.pl" -event="Notification" -notification="SSH Login @Home User: `id`"

Send a Test Notification:
/usr/bin/prowl.pl -apikey="YOUR API KEY" -application="prowl.pl" -event="Notification" -notification="SSH Login @Home User: `id`"

Just Replace the "SSH Login @Home User: `id`" with your notifications...

Thats it.

If you Like you can enable a log

touch /var/log/prowl.log
chmod 755  /var/log/prowl.log
vi /etc/bashrc and add above your prowl script line

echo "###" >>/var/log/prowl.log
echo "`date`" >>/var/log/prowl.log
echo "SSH Login" >>/var/log/prowl.log
echo "`id`" >>/var/log/prowl.log
/usr/bin/prowl.pl -apikey="YOUR API KEY" -application="prowl.pl" -event="Notification" -notification="SSH Login @Home User: `id`"2>&1 >>/var/log/prowl.log