Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Secure-Shell
[Top] [All Lists]

Re: Running a script on login

Subject: Re: Running a script on login
Date: Sun, 11 Sep 2005 15:00:03 -0300

You can use something like this in /etc/hosts.allow

sshd : xxx.xxx.xxx/8 : spawn (echo -e "External ssh connection from %h
" | mail -s "SSH connection from Internet" xxx@gmail.com) : ALLOW





Chris Jensen wrote:

Hi,
I'm trying to figure out how to run a script upon a successful login
(of any user) via openssh.
The ssh server is being setup for very limited remote access, so we'd
like to monitor logins by having an email sent to the administrator
whenever a user is successfully logged in.
We only want the script to trigger for openssh logins (local logins
we're not interested in), but I can't figure out how to set this up
other than in the .bash_profile
The other thing I considered was having a cron job watch the
authentication logs, but I'd prefer something that runs only when
necissary than having to constantly poll the logs.

I've googled and come up with nothing, and read through all the config
options and can't find anything. I also thought of using a PAM module
to do this, but can't find anything appropriate.

Any ideas?

Regards
Chris

 


<Prev in Thread] Current Thread [Next in Thread>