Determining Local IP Address within .profile

Ben Lindstrom mouring at etoh.eviladmin.org
Fri Sep 6 06:14:48 EST 2002


On Thu, 5 Sep 2002, Kevin Steves wrote:

> On Wed, Sep 04, 2002 at 02:41:45PM +0100, Mario Paumann wrote:
> > I haven't found an easy solution to determine the local IP to which the remote SSH client is connected to the local SSHD. We use MC/Serviceguard which can create many Interfaces where a remote client could connect and we like to know within .profile which interface the client has connected to.
> >
> > I've looked at the sourcecode and maybe the following could do something I described :
> >
> > session.c:871 RCSID("$OpenBSD: session.c,v 1.142 2002/06/26 13:49:26 deraadt Exp $");
> > do_setup_env
> >
> >         child_set_env(&env, &envsize, "SSH_LOCAL_IP", get_local_ipaddr(packet_get_connection_in());
> >
> > what do you think of it ?
>
> I agree this is useful.
> See also: http://bugzilla.mindrot.org/show_bug.cgi?id=384
>
> I would perhaps be better if this all were exposed in just one environment
> variable, e.g.,
> SSH_CONNECTION=172.31.1.53 14932 192.168.1.9 24
>
> and deprecate SSH_CLIENT, but adding SSH_SERVER as in 384 may be
> less confusing.

hmm.. I think SSH_SERVER would be less confusing.  Trying to deprecate
SSH_CLIENT may be a lost cause since it is very well entrenched in how
people do business.

If this can't be solved cleanly via /etc/profile or via shell startup
scripts then I don't have as much of a quarm with bug 384.  Just wanted to
ensure that people explored other options first.

- Ben




More information about the openssh-unix-dev mailing list