Skip to contentSkip to conversation

getpeereid() for Linux

DISCUSSION Andi Kleen 2 participants 4 messages Sep 5, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): tgsne23sou.fsf@mercury.rus.uni-stuttgart.de.suse.lists.linux.kernel

Andi Kleen

author
#1 lore raw
Quoted 3 lines · Florian Weimer

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:

It is implemented for unix sockets (see unix(7))
For TCP it is rather useless because it would work only locally. If you trust the localhost you're probably better off using the ident protocol for it.

-Andi

#2 lore raw
In reply to a message not in the archive
Quoted 7 lines · Andi Kleen
Quoted 3 lines · Florian Weimer

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:

It is implemented for unix sockets (see unix(7))

Hmm, it is not documented in my local copy (?). getpeereid() is different from the standard credential passing mechanism because it does not require cooperation of the other end.

Quoted 1 line

For TCP it is rather useless because it would work only locally.

Obviously, we need it only locally. ;-) The interface is useful if you are implementing poor man's VPN in user space.

Quoted 2 lines

If you trust the localhost you're probably better off using the ident protocol for it.

This means running just another server, even with root privileges. :-(

Signature · 3 lines
Florian Weimer 	                  [email protected]
University of Stuttgart           http://cert.uni-stuttgart.de/
RUS-CERT                          +49-711-685-5973/fax +49-711-685-5898
author
#3 lore raw
In reply to a message not in the archive
Quoted 8 lines · Florian Weimer
Quoted 6 lines · Andi Kleen
Quoted 3 lines · Florian Weimer

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:

Quoted 5 lines
Quoted 1 line

It is implemented for unix sockets (see unix(7))

Hmm, it is not documented in my local copy (?). getpeereid() is different from the standard credential passing mechanism because it does not require cooperation of the other end.

SO_PEERCRED doesn't need any cooperation from the other end (at least not for SOCK_STREAM)

Quoted 4 lines
Quoted 1 line

For TCP it is rather useless because it would work only locally.

Obviously, we need it only locally. ;-) The interface is useful if you are implementing poor man's VPN in user space.

There is netfilter owner match, but it is a bad hack.

I think you're better off with identd.

Quoted 5 lines
Quoted 3 lines

If you trust the localhost you're probably better off using the ident protocol for it.

This means running just another server, even with root privileges. :-(

identd doesn't need root.

-Andi

#4 lore raw
In reply to a message not in the archive
Quoted 2 lines · Andi Kleen

SO_PEERCRED doesn't need any cooperation from the other end (at least not for SOCK_STREAM)

Thanks. Over here, SO_PEERCRED is documented in socket(7). ;-)

Quoted 1 line

There is netfilter owner match, but it is a bad hack.

I certainly don't want to give a user process the right to add netfilter rules dynamically. :-/

Quoted 1 line

I think you're better off with identd.

Or some /proc parsing (which is probably what identd does, too).

Signature · 3 lines
Florian Weimer 	                  [email protected]
University of Stuttgart           http://cert.uni-stuttgart.de/
RUS-CERT                          +49-711-685-5973/fax +49-711-685-5898