Re: xinetd - how to figure out from which interface a connection is coming

2005-05-02 Thread Vic Cross
On Sun, May 01, 2005 at 04:24:02PM -0300, Ulisses Penna wrote:
 I realy need the local address. The xinetd is listening to all
 possible local interfaces: eth0:1 and eth0:2 and eth0:3 and so on.

It's a bit more work on the xinetd side, but you can set up xinetd to bind on
each interface separately, then modify the invocation of your shell script so
that the interface name is passed to it as part of the command line.  A bit of
an ugly hack, but it would certainly do the job for you.

Check out the bind parameter (or its synonym interface) in the man page
for xinetd.conf.

 Is there a clue/tip at the /proc/${PID} or something that can tell me?
 Or other location at /proc? Or some environment variable? Do I have
 to write a C app to find out the local IP?

Perhaps xinetd might set an environment variable that you can use?  Would be
easier than copying a xinetd configuration dozens (hundreds?) of times...

Cheers,
Vic Cross

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: xinetd - how to figure out from which interface a connection is coming

2005-05-01 Thread Ulisses Penna
Folks,

I think I didn't tell enough details ...

Post, Mark K wrote
 Check the value of the SSH_CONNECTION environment variable.

 Mark Post

Mark, the user only ssh to the zLinux in order to start a daemon and
then they logoff. Instead of giving each user a zLinux image we gave
to them an unique IP address ...


Sebastian Korte wrote
  Finding that, I can map the IP address (or
  interface) to the user.

 To find out the remote user ip? You can directly get the remote ip of
the user
 with env | grep REMOTE_HOST in you shell script. It's the shorter
 way.

 Sebastian

Sebastian, I already have the remote address (thank you anyway)

I realy need the local address. The xinetd is listening to all
possible local interfaces: eth0:1 and eth0:2 and eth0:3 and so on.

Each interface belongs to one user: user_1(eth0:1), user_2(eth0:2)
and so on.

So my 'local' need is to find out which interface the remote machine is
connected to. I mean, the remote machine had established a connection
to which interface: eth0:1 or eth0:2 or eth0:3 (which local one)??
Is there a clue/tip at the /proc/${PID} or something that can tell me?
Or other location at /proc? Or some environment variable? Do I have
to write a C app to find out the local IP?

Thank you anyway guys.
-
Ulisses de Sousa Penna
Analista Consultor - Banco do Brasil
Fone: +55-61-310-6320   Fax: +55-61-310-6435
-

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


xinetd - how to figure out from which interface a connection is coming

2005-04-26 Thread Ulisses Penna
Hi all,

I have a zLinux image that is used for lots of users (ssh) for an
internal app.
The Linux box is configured with various TCP/IP interfaces like:

ip_1 - eth0:0  (user_1)
ip_2 - eth0:1  (user_2)
ip_3 - eth0:2  (user_3)

and so on.

Each user has its own TCP/IP address. Then I have a xinetd service
called printBB that is started when a connection is coming to port 5000.

The server app that is running under the printBB xinetd service is a
*shell script*. My problem is to determine which interface was trigerred.
I know I can find the remote address but what I want is the local address.
I mean, the client application connected to which interface: ip_1 (eth0:0)
or (ip_2) (eth0:1) ... ? Finding that, I can map the IP address (or
interface) to the user.
Is there something at the /proc/${PID} that can help me (or
anywhere else)? Or do I have to write a small C program to find out the
local address/interface?

Thanks in advance.
-
Ulisses de Sousa Penna
Analista Consultor - Banco do Brasil
Fone: +55-61-310-6320   Fax: +55-61-310-6435
-

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: xinetd - how to figure out from which interface a connection is coming

2005-04-26 Thread Sebastian Korte
Ulisses,

 Finding that, I can map the IP address (or
 interface) to the user.

Do you really need the local adress the user is connected to? To find
out the remote user ip? You can directly get the remote ip of the user
with env | grep REMOTE_HOST in you shell script. It's the shorter
way.

Sebastian

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: xinetd - how to figure out from which interface a connection is coming

2005-04-26 Thread Post, Mark K
Check the value of the SSH_CONNECTION environment variable.


Mark Post

-Original Message-
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On Behalf Of
Ulisses Penna
Sent: Tuesday, April 26, 2005 7:33 AM
To: LINUX-390@VM.MARIST.EDU
Subject: xinetd - how to figure out from which interface a connection is
coming


Hi all,

I have a zLinux image that is used for lots of users (ssh) for an
internal app. The Linux box is configured with various TCP/IP interfaces
like:

ip_1 - eth0:0  (user_1)
ip_2 - eth0:1  (user_2)
ip_3 - eth0:2  (user_3)

and so on.

Each user has its own TCP/IP address. Then I have a xinetd service
called printBB that is started when a connection is coming to port 5000.

The server app that is running under the printBB xinetd service is
a *shell script*. My problem is to determine which interface was trigerred.
I know I can find the remote address but what I want is the local address. I
mean, the client application connected to which interface: ip_1 (eth0:0) or
(ip_2) (eth0:1) ... ? Finding that, I can map the IP address (or
interface) to the user.
Is there something at the /proc/${PID} that can help me (or anywhere
else)? Or do I have to write a small C program to find out the local
address/interface?

Thanks in advance.
-
Ulisses de Sousa Penna
Analista Consultor - Banco do Brasil
Fone: +55-61-310-6320   Fax: +55-61-310-6435
-

--
For LINUX-390 subscribe / signoff / archive access instructions, send email
to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390