The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Microsoft Security Advisory (910550): Macromedia Security Bulletin: MPSB05-07 Flash P iBot Security Advisories (RSS) - Microsoft 0 04-06-2008 01:50 AM
Microsoft Security Advisory (912945): Non-Security Update for Internet Explorer - 6/1 iBot Security Advisories (RSS) - Microsoft 0 12-24-2007 06:00 AM
Microsoft Security Advisory (910550): Macromedia Security Bulletin: MPSB05-07 Flash P iBot Security Advisories (RSS) - Microsoft 0 12-24-2007 06:00 AM
Mandriva Linux Security Update Advisory - gdm (MDKSA-2007:169) - Help Net Security iBot UNIX and Linux RSS News 0 08-22-2007 03:40 AM
Trustix Secure Linux Security Advisory - bind, clamav, curl ... - Help Net Security iBot UNIX and Linux RSS News 0 07-30-2007 03:40 AM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-30-2002
Registered User
 

Join Date: Sep 2001
Location: Johanessburg
Posts: 27
Need help with security

Hi there thanks for checking in.

I run a helpdesk with about 500 users login onto a network
and then onto a Unix box.

Sometimes people use other people's login's.:-(
All user's use there own PC.( I.P )
Is there a way that when somebody logs onto the unix box with a different I.P that the the system with e-mail me the I.P address
So that i can find the people who are doing this, which creates problems.

i'm thinking along the lines of a script that runs every 10-20 min's
in the background that uses the files in /var/adm/history

etc.

When you do a

who -u ( for the first time ) sleep 1000
root pts/tCe Jan 30 11:59 1:32 15442 000.00.000.000
helpdesk pts/tCe Jan 30 12:05 0.23 23633 196.13.235.333

who -u (for the Second time)
root pts/tCe Jan 30 11:59 1:32 15442 000.00.000.000
helpdesk pts/tCe Jan 30 12:05 0.23 23633 196.13.235.555

then it should pick up
That user "helpdesk" is not log onto 196.13.235.333 and it should E-mail me the I.P 196.13.235.555 including the User name that is supposed to log unto the unix box from that PC.

Please inform me if the above is unclear.

Thanks in advance

Nemex
Forum Sponsor
  #2 (permalink)  
Old 01-30-2002
thehoghunter
Guest
 

Posts: n/a
It seems you have a handle on what you want to do and where to get the information. What do you need help with?

Hint: scripting is only putting in a executable file what you could have done from the command line. Adding loops and conditions is to allow for your manually doing it in your head (When you see a different IP address on a specific user name, you realize you need to check it out ). So just put in the script the steps you are doing manually.
  #3 (permalink)  
Old 01-31-2002
Registered User
 

Join Date: Sep 2001
Location: Johanessburg
Posts: 27
I have a handle on what i want but i have no idea how to translate this with in a script.

Eg. how do i let the system recognize that the 2 I.P are diff and then have the system mail me ( mailx )
  #4 (permalink)  
Old 01-31-2002
thehoghunter
Guest
 

Posts: n/a
You would have to create a base file - this can be done on the fly in your script before you start checking on everyone.

In your script - who -u |awk '{print $1,$3}' - set a variable to these values. grep to see if the first $1 (the userid) is already in the file. If it is, do nothing but if it isn't write the userid and IP to the file.

Once you get a user id that is in the file and your script finds it in there, then you can start to compare the IP address.

UserIP-File format;
userid IP

joeuser 172.16.1.2
jackuser 172.16.1.3
janeuser 172.16.1.4

To compare what is on the system versus what is in the file, use your who -u command again, pulling the userid and IP into two variables. Check for the userid in the file - if it is there, compare the IP addresses. If different, then email yourself to check it out

You could do many more things with this...but I hope you get the idea.
  #5 (permalink)  
Old 01-31-2002
Registered User
 

Join Date: Sep 2001
Location: Johanessburg
Posts: 27
Thanks i Got

this is what i've done

who -u > IP
sleep 10000 ( 0% cpu )
who -u > IP2
diff IP IP2 > diff1
/usr/sbin/mailx helpdesk@rtt.co.za < /home/me/diff1

question ? how do i kick this off so that it runs in the back ground

do i just

cammand -D

would that be safe.
  #6 (permalink)  
Old 01-31-2002
Registered User
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Have you considered how you might use the crontab for running this process? Might be better than having a process that sleeps for long periods.....
__________________
Pete
  #7 (permalink)  
Old 01-31-2002
Registered User
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Just a thought too....rave a read about 'nohup'

Allows you to run processes in the background without requirement of a terminal for outputting to.
__________________
Pete
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0