Skip to content

x/sys/unix: GetsockoptPeerSec support #16374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tiran opened this issue Jul 14, 2016 · 2 comments
Closed

x/sys/unix: GetsockoptPeerSec support #16374

tiran opened this issue Jul 14, 2016 · 2 comments

Comments

@tiran
Copy link

tiran commented Jul 14, 2016

Go doesn't have an interface to get the peer security context of a Unix socket. This is basically the same issue as #3836 but for SO_PEERSEC. SO_PEERSEC retrieves the peer's SELinux or AppArmor label. The return value a NULL-terminated string with maximum 255 chars. SO_PEERSEC is a Linux-only option for getsockopt.

Python example:

>>> import socket
>>> a, b = socket.socketpair()
>>> a.getsockopt(socket.SOL_SOCKET, socket.SO_PEERSEC, 255)
'system_u:object_r:unlabeled_t:s0\x00'

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version go1.6.2 linux/amd64
  2. What operating system and processor architecture are you using (go env)?
    Fedora 24 X86_64
@bradfitz
Copy link
Contributor

Since the syscall package is frozen for feature additions, this is probably most appropriate for the golang.org/x/sys/unix repo, which we also help maintain.

@bradfitz bradfitz changed the title syscall interface GetsockoptPeerSec missing x/sys/unix: GetsockoptPeerSec support Jul 14, 2016
@bradfitz bradfitz added this to the Unreleased milestone Jul 14, 2016
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/83275 mentions this issue: unix: add GetsockoptString on Linux

@golang golang locked and limited conversation to collaborators Dec 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants