Hi Dave,

Great question!  You should be able to get exactly what you want by doing 
the following:

1. Create a TransportCredentials 
<https://godoc.org/google.golang.org/grpc/credentials#TransportCredentials> 
with 
a ServerHandshake function that gets the information you need from the 
net.Conn* and includes it in the returned AuthInfo 
<https://godoc.org/google.golang.org/grpc/credentials#AuthInfo>.  (It can 
return the net.Conn passed to it without doing any handshaking or wrapping.)
2. In your service's RPC handler, retrieve the AuthInfo from the context 
using peer.FromContext 
<https://godoc.org/google.golang.org/grpc/peer#FromContext>.

* - It sounds like you may have also been unsure of how to get the info 
from the net.Conn; I found this example 
<https://gist.github.com/jsimonetti/d2a822ff8c5b95297b2f#gistcomment-2221225> 
to 
show how to do that.

Thanks,
Doug


On Monday, February 26, 2018 at 2:38:59 PM UTC-8, Dave Quigley wrote:
>
> Hello,
>
> I am writing a client which uses gRPC to communicate remotely to another 
> gRPC service but also locally receives requests using gRPC on a UNIX domain 
> socket. Part of the request to the remote service is some information about 
> the requesting process such as the uid and gid it is running as. Normally I 
> would be able to get a ucred structure using SO_PEERCRED on the socket 
> descriptor however I don't see a way to do that in the interfaces provided 
> to Go. I can't rely on the process to provide that info in its request 
> because there is no guarantee that it won't lie so the best way is to get 
> this information from the kernel itself. Does anyone know how I might 
> accomplish this? Would this require modifications to the core grpc 
> libraries?
>
> Dave
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/9eaf468e-3d6c-4b9b-bd1c-ccf75250ff35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to