public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: getpeereid() for Linux
@ 2001-09-05 15:51 Jesse Pollard
  2001-09-05 15:53 ` Florian Weimer
  0 siblings, 1 reply; 12+ messages in thread
From: Jesse Pollard @ 2001-09-05 15:51 UTC (permalink / raw)
  To: Florian.Weimer, Michael Bacarella; +Cc: linux-kernel

Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>
> Michael Bacarella <mbac@nyct.net> writes:
> 
> > There's no need. The equivalent functionality can already be
> > implemented in userspace.
> 
> Well, it doesn't work with TCP.  Uh-oh, I see I forgot to mention the
> following: I need this functionality for local TCP connections, not
> just UNIX domain sockets.

It doesn't work on BSD either. The manpage says:
(http://www.openbsd.org/cgi-bin/man.cgi?query=getpeereid&sektion=2&apropos=0&mnpath=OpenBSD+Current)

     getpeereid() returns the effective user ID and group ID of the peer con-
     nected to the UNIX domain socket s.

     One common use is for UNIX domain servers to determine the credentials of
     clients that have connected to it.

It is not possible to get a creditential from TCP connections yet. That
requires an extension to IPSec to even be able to carry credentials. There
is no reliable communication path (even for identd) to be able to pass
credentials.

-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@navo.hpc.mil

Any opinions expressed are solely my own.

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: getpeereid() for Linux
@ 2001-09-05 16:19 Jesse Pollard
  2001-09-05 16:36 ` Florian Weimer
  0 siblings, 1 reply; 12+ messages in thread
From: Jesse Pollard @ 2001-09-05 16:19 UTC (permalink / raw)
  To: Florian.Weimer, Jesse Pollard; +Cc: Michael Bacarella, linux-kernel

Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>:
> 
> Jesse Pollard <pollard@tomcat.admin.navo.hpc.mil> writes:
> 
> > It is not possible to get a creditential from TCP connections yet. That
> > requires an extension to IPSec to even be able to carry credentials. There
> > is no reliable communication path (even for identd) to be able to pass
> > credentials.
> 
> I need the credentials only for local connections, though.  This is
> technically possible.  A userspace implementation partially cloning
> ident seems to be a possible approach.

It won't be reliable. Even the documentation for ident (at least the version
I looked at a while ago, might be different now, but I don't think so) says
that the data returned is not reliable. (even fuser doesn't always get this
right when trying to identify processes with open sockets).

Part of the problem is that TCP sockets don't carry the same information
that domain sockets have (could be partially wrong here, it just may not
be filled in since the source of the data can't supply it). The other
part is that it depends on what allocated the socket. Ownership is established
at socket allocation time, and the socket can be passed to a totally different
user. Identity of the user of the socket is therefore lost.

-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@navo.hpc.mil

Any opinions expressed are solely my own.

^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <tgsne23sou.fsf@mercury.rus.uni-stuttgart.de.suse.lists.linux.kernel>]
* getpeereid() for Linux
@ 2001-09-05  9:14 Florian Weimer
  2001-09-05 13:38 ` Michael Bacarella
  0 siblings, 1 reply; 12+ messages in thread
From: Florian Weimer @ 2001-09-05  9:14 UTC (permalink / raw)
  To: linux-kernel

Would anyone like to give me a helping hand in implementing the
getpeereid() syscall for Linux?  See the following page for the
documentation of the OpenBSD implementation:

http://www.openbsd.org/cgi-bin/man.cgi?query=getpeereid&sektion=2&apropos=0&manpath=OpenBSD+Current

I think I could work out the kernel data structures to gather the
relevant data from, however, I won't get all the locking stuff right.

OTOH, is there any chance that the addition of such a syscall would be
accepted?

Thanks to /proc, it is possible to implement the user ID part of the
syscall in userland, at least for TCP sockets, but this isn't enough.
(I've got a such an implementation which seems to work quite well,
just in case you are interested.)

-- 
Florian Weimer 	                  Florian.Weimer@RUS.Uni-Stuttgart.DE
University of Stuttgart           http://cert.uni-stuttgart.de/
RUS-CERT                          +49-711-685-5973/fax +49-711-685-5898

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2001-09-05 20:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-05 15:51 getpeereid() for Linux Jesse Pollard
2001-09-05 15:53 ` Florian Weimer
2001-09-05 20:26   ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2001-09-05 16:19 Jesse Pollard
2001-09-05 16:36 ` Florian Weimer
     [not found] <tgsne23sou.fsf@mercury.rus.uni-stuttgart.de.suse.lists.linux.kernel>
2001-09-05  9:52 ` Andi Kleen
2001-09-05 10:05   ` Florian Weimer
2001-09-05 10:48     ` Andi Kleen
2001-09-05 10:56       ` Florian Weimer
2001-09-05  9:14 Florian Weimer
2001-09-05 13:38 ` Michael Bacarella
2001-09-05 14:35   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox