Notification of logging into servers

I'm looking to find a way to implement a way to notify via email that somebody is logging into any of our servers we have.... Does anyone have an idea and advice as to how to implement this?
RVFB ITAsked:
Who is Participating?
 
NVITCommented:
One way...
1. Download Blat (or other command-line mailer)
2. Add this to your user logon script:
blat -server yourserver -to you@company.com -f administrator@company.com -subject "%username% logged in from %computername% at %time%" -body "%USERNAME% logged in from %computername% at %time%"

Open in new window

0
 
RVFB ITAuthor Commented:
we use gmail... wondering if you could elaborate those parameters based on knowing that fact? i've looked at syntax for blat and tried a couple times with no luck
0
 
NVITCommented:
>> we use gmail
To use w/ gmail, you have to setup a connection via an SSL tunnel. See:
- http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/
- http://blog.frogslayer.com/sending-an-email-through-google-smtp-via-windows-command-line/
- http://www.stunnel.org/

>> ...elaborate those parameters
See http://www.blat.net/syntax/syntax.html for parameter descriptions.

Testing in a CMD prompt before adding or calling it from your logon script helps, too.

I've tested this, which works. Make a .bat file of it:
- For testing/issues, un-REM the debug and log lines below.

setlocal

set svr=-server yourserver.company.com
set to=-to you@company.com
set from=-f administrator@company.com
set subject=-s "%username% logged in from %computername% on %date% %time%"
set body=-body "%USERNAME% logged in from %computername% on %date% %time%"
REM set debug=-debug
REM set log=-log \\server\share\blat-debug.txt

blat %from% %svr% %to% %subject% %body% %debug% %log%

Open in new window

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
RVFB ITAuthor Commented:
I added Stunnel and when i try to run the following in a batch file, a DOS window just continuously loops and keeps executing this forever and ever... I starred my password out for security of my email account... I feel like i'm really close to having this, but can't get past this batch script file for some reason... why is it doing an infinite loop? and i never get an email..

set SERVER=127.0.0.1:1099
set USER=kchilton@rvfbank.com
set PW=*****
set FROMNAME=Server Logon Notification
set TO=kchilton@rvfbank.com
set SUBJECT="%username% logged in from %computername% at %time%"
set BODY="%username% logged in from %computername% at %time%"
blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -cc %CC% -subject %SUBJECT% -body %BODY%
0
 
RVFB ITAuthor Commented:
NewVillageIt

I tried your batch script too and it just does an infinite loop and never sends me an email.... dont know what i'm missing here
0
 
RVFB ITAuthor Commented:
I ended up going with the SendEmail command line mailer... It didn't involved Stunnel and was simpler and got me the results I wanted in the end. Thanks!
0
 
NVITCommented:
Thanks for the update, Keith. I appreciate it. I'm glad you found a simpler solution SendEmail. I'll consider SendEmail, also.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.