nix
nix copied to clipboard
Setting LOCAL_PEERCRED / SO_PASSCRED sockopt on connecting to existing Unix file socket
trafficstars
I know it's possible to create a new local file socket with passcred enabled, so we can get a client's pid/uid/gid, but is it possible to set the same socket option (and LOCAL_PEERCRED for MacOS) when connecting to an existing file socket, so the process that created the socket can read my pid/uid/gid?
Apologies if this is trivial but I can't spot it from the docs.
Are you asking if something is possible in Nix, or in MacOS? This isn't the right place to ask about the latter. For the former, that sounds like something you would do with setsockopt, right? If Nix doesn't have a binding for the right sockopt, we could add it.