-
Notifications
You must be signed in to change notification settings - Fork 18.1k
x/sys/unix: want more platform support for UNIX domain socket peer credentials #41659
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
Comments
What are the mechanisms available on other systems? |
So Solaris and illumos have getpeerucred. I believe BSD systems have SO_LOCAL and LOCAL_PEERCRED and LOCAL_PEERPID. There is also a version of SO_PEERCRED that uses sockpeercred instead of ucred. This is a mess of non portable APIs. But it would be nice if I could access this tags and not have to resort to cgo. |
Change https://golang.org/cl/294989 mentions this issue: |
FWIW, https://golang.org/cl/292330 added this for Darwin already, courtesy of @bradfitz . I'm about to send CLs adding support on the BSDs and possibly Illumos/Solaris as well. Once these landed in |
Follow CL 292330 which added these on darwin. Generated on FreeBSD 13.0BETA3 For golang/go#41659 Change-Id: I30eeef43c4f61a9449f3fe8b5cc0033f46dfe822 Reviewed-on: https://go-review.googlesource.com/c/sys/+/294989 Trust: Tobias Klauser <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
This was initially requested in #1101, however that issue was hijacked to instead cover sending over credentials and file descriptors, and it deemed resolved in 2017. This would be really nice to have a cross platform API for this. |
Change https://go.dev/cl/669835 mentions this issue: |
What version of Go are you using (
go version
)?(Although I use many different versions of Go on illumos, Linux, darwin, etc.)
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputFeature request
As this is a feature request, I'm not including typical bug report details.
What I'd like is a way for us to obtain peer credentials more broadly. I am most interested in illumos/solaris (which uses getpeerucred() in libc, but I see this being useful for Darwin, FreeBSD, and possibly others.
With Linux we can do GetsockoptUcred with SO_PEERCRED. Which is great. I would like to have a similar way to do this for other platforms (platform specific probably) without having to resort to cgo if possible.
The text was updated successfully, but these errors were encountered: