How to find out what user has connected to local socket

How to find out what user has connected to local socket

Post by Marc SCHAEFE » Wed, 06 Sep 2000 21:18:33



: One way is to ask the identd service running on the local machine.  This method
: is portable to any OS that has an identd service.

But it isn't safe, even on the local machine, since there are ways,
notably with ssh redirects, to issue local connections as root although
you are on a remote system.

 
 
 

How to find out what user has connected to local socket

Post by Nikita V. Youshchenk » Thu, 07 Sep 2000 02:55:44




> : One way is to ask the identd service running on the local machine.
> : This method : is portable to any OS that has an identd service.

> But it isn't safe, even on the local machine, since there are ways,
> notably with ssh redirects, to issue local connections as root although
> you are on a remote system.

Hmm...  I am using LOCAL sockets (aha UNIX domain sockets) only. Is it
possible in the server (that is running as root) to determine UID of the
client just connected ?..  I badly need it ...

 
 
 

How to find out what user has connected to local socket

Post by Mike McDona » Thu, 07 Sep 2000 08:17:31






>> : One way is to ask the identd service running on the local machine.
>> : This method : is portable to any OS that has an identd service.

>> But it isn't safe, even on the local machine, since there are ways,
>> notably with ssh redirects, to issue local connections as root although
>> you are on a remote system.

> Hmm...  I am using LOCAL sockets (aha UNIX domain sockets) only. Is it
> possible in the server (that is running as root) to determine UID of the
> client just connected ?..  I badly need it ...

  Why don't you just have the client tell you who it is?

  Mike McDonald

 
 
 

How to find out what user has connected to local socket

Post by Denic » Thu, 07 Sep 2000 19:00:28





>> : One way is to ask the identd service running on the local machine.
>> : This method : is portable to any OS that has an identd service.

>> But it isn't safe, even on the local machine, since there are ways,
>> notably with ssh redirects, to issue local connections as root although
>> you are on a remote system.
>Hmm...  I am using LOCAL sockets (aha UNIX domain sockets) only. Is it
>possible in the server (that is running as root) to determine UID of the
>client just connected ?..  I badly need it ...

How about some options from netstat, for example:
  netstat -peva

or better yet

  lsof -U   ( lsof is very useful... )

--

<*> This moment's fortune cookie:
A debugged program is one for which you have not yet found the conditions
that make it fail.
                -- Jerry Ogdin

 
 
 

How to find out what user has connected to local socket

Post by Nikita V. Youshchenk » Thu, 07 Sep 2000 18:16:46







> >> : One way is to ask the identd service running on the local machine.
> >> : This method : is portable to any OS that has an identd service.

> >> But it isn't safe, even on the local machine, since there are ways,
> >> notably with ssh redirects, to issue local connections as root although
> >> you are on a remote system.

> > Hmm...  I am using LOCAL sockets (aha UNIX domain sockets) only. Is it
> > possible in the server (that is running as root) to determine UID of the
> > client just connected ?..  I badly need it ...

>   Why don't you just have the client tell you who it is?

Because it is insecure. Any other ideas ?
 
 
 

How to find out what user has connected to local socket

Post by Nikita V. Youshchenk » Fri, 08 Sep 2000 05:46:22






> >> : One way is to ask the identd service running on the local machine.
> >> : This method : is portable to any OS that has an identd service.

> >> But it isn't safe, even on the local machine, since there are ways,
> >> notably with ssh redirects, to issue local connections as root although
> >> you are on a remote system.

> >Hmm...  I am using LOCAL sockets (aha UNIX domain sockets) only. Is it
> >possible in the server (that is running as root) to determine UID of the
> >client just connected ?..  I badly need it ...

> How about some options from netstat, for example:
>   netstat -peva

Thank you.  This is at least something. Netstat may show the PID ...
Before I start looking into netstat source: maybe someone may answer
quickly, what C code should I write to obtain such information ?

Nikita

 
 
 

How to find out what user has connected to local socket

Post by Clarence Gardne » Sat, 09 Sep 2000 02:37:26








>> >> : One way is to ask the identd service running on the local machine.
>> >> : This method : is portable to any OS that has an identd service.

>> >> But it isn't safe, even on the local machine, since there are ways,
>> >> notably with ssh redirects, to issue local connections as root although
>> >> you are on a remote system.

>> > Hmm...  I am using LOCAL sockets (aha UNIX domain sockets) only. Is it
>> > possible in the server (that is running as root) to determine UID of the
>> > client just connected ?..  I badly need it ...

>>   Why don't you just have the client tell you who it is?

>Because it is insecure. Any other ideas ?

Here is something to think about.  I haven't tried this at all, and haven't
thought it through security-wise.

Have the client create a temporary file (so it will be the owner) with a
mode of 0600.  The fact that it has the file open means that it is the owner
of the file (or super-user; can't get around that).  (I'm ignoring any silliness
like the permissions changing after the open()).  Then, send the descriptor
to the server over your Unix domain socket.  The server can receive the
descriptor and do an fstat() on it to find the owner of the file (and be sure
that the permissions are 0600), and take that to be the uid of the client
process.

 
 
 

1. Did setup Linux, but having problems setting up Local Email between local users

I have a system on
which Linux has just been installed, but not
connected to anything for now, all I want is for
the various local users, to be able to send mail to
each other, I tested it and the mail never actually
gets delivered to the other local account ?  The
book I have said something about using Smail for
the configuration, but I could not find it.

Thanks a lot for any help in advance.

TJ.

2. Firewall solution for AIX?

3. Can't connect to local MySQL server through socket '/tmp/mysql.sock'

4. stunnel3.8p4 problem

5. RedHat 7.1 local INET sockets not connecting

6. CERN 3.0 'Icons.xbm' babbling bug

7. Can't connect to local MySQL server through socket '/tmp/mysql.sock'

8. Creating a mirror drive ... how do I do that?

9. Finding a socket's local port number

10. Socket to SMTP server - periodic time outs

11. newbie help with starting an apache server...users outside local network cant find server.

12. How do I find a local user group?

13. How to find out application that send outs packets on certain port