The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Telnet Session to AIX bluebee UNIX for Dummies Questions & Answers 1 08-07-2007 04:19 PM
Unix Telnet session mlucas UNIX for Dummies Questions & Answers 2 08-17-2006 11:26 AM
intercept the ip address of a telnet session paololrp IP Networking 2 09-28-2005 04:18 AM
Telnet Session pathanjalireddy Shell Programming and Scripting 6 04-06-2005 11:41 AM
Host IP address for a telnet session shauche UNIX for Advanced & Expert Users 1 05-14-2003 08:33 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-08-2002
sszago sszago is offline
Registered User
  
 

Join Date: Jan 2002
Posts: 1
Find the IP address that a telnet session uses

Hello Experts,
Happy New Year to all of us,

In AIX 4.3.3 I am trying to figure out how is possible to find out the IP address that a telnet session - user uses to login in to host machine. My objective is by finding the login IP address to allow the user to login or not.

All users uses the same .profile

I am trying to get information using the gethostbyaddr or gethostbyname functions.

Which value to I have to pass ftom .profile to the .c program such that provide the gethostbyaddr/gethostbyname with the right argument. In other words how I can pass from the .profile to .c program the IP address that is trying to log in.

Thanks in Advanced
  #2 (permalink)  
Old 01-08-2002
thalex thalex is offline
Registered User
  
 

Join Date: Nov 2001
Posts: 33
The gethostbyaddr returns a pointer to a hostent structure, which contains information obtained from one of the name resolutions services. The hostent structure is defined in the netdb.h file. Aka u can get the hostname of the connection, provided you know the ip address.

I dont get if the tcp server accepting connections is your program or it is any standard tcp server. If it is yours, then the listen(),accept() and inet_addr() will provide you with the ip address of the connection. If you dont know how it is done, this is it: Use first the socket(), then bind(), listen(),accept(),read(),close(),unlink(). Look for further details in your sockets reference manual in AIX.

If server is not yours, you can use the /etc/hosts.equiv file. I also dont get where the .profile gets involved.
  #3 (permalink)  
Old 01-08-2002
Neo's Avatar
Neo Neo is online now Forum Staff  
Administrator
  
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 6,781
Search the forums for the utilility lsof .... this utility compiles on many platforms and does wonders for understanding and seeing the relationship of processes to open files descriptor and sockets.. plus much more!!!
  #4 (permalink)  
Old 01-10-2002
S.P.Prasad S.P.Prasad is offline
Registered User
  
 

Join Date: Jan 2002
Location: India
Posts: 111
I tried this objective in SCO Unix with few lines scripting in .profile file:

for IP in `cat IPFile`
do
finger -fb | grep $IP > /dev/null
if [ $? -eq 0 ]
then
echo "You Are Not Allowed To Use Telnet Session In My System"
exit
fi
done


The IPFile contains all the IP's and hosts name in singular line format entry.
  #5 (permalink)  
Old 01-10-2002
thalex thalex is offline
Registered User
  
 

Join Date: Nov 2001
Posts: 33
I still dont get it. why dont u use /etc/hosts.equiv in AIX. Note that if u use your script, .profile can be bypassed.
  #6 (permalink)  
Old 01-18-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
thalex

The main problem with /etc/hosts.equiv is that it is a VERY bad security hole.

By using IP spoofing, anyone can break into your system. There are other good ways to check the users when the login.

If someone can login as one of your users via /etc/hosts.equiv that could be very dangerous.

Is /etc/securetty an option?
  #7 (permalink)  
Old 01-22-2002
thalex thalex is offline
Registered User
  
 

Join Date: Nov 2001
Posts: 33
Yes, but I assumed it was a local environment or something to use such a script. If it is public, then I guess he has to move to something more sophisticated like using firewalls. You can also download openssh for AIX that provides a good level of security, check http://freeware.bull.net. If more security is needed TCB should be considered.

Greetings Theodore
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0