git-ecosystem / trace2receiver

GOLANG based OTEL custom collector receiver component for Trace2 data
MIT License
44 stars 7 forks source link

On Windows capture and log the username of named pipe client peer #18

Open jeffhostetler opened 10 months ago

jeffhostetler commented 10 months ago

On Windows the collector (usually) runs as a Control Panel Service process and therefore inherits whatever system identity (LOCAL SERVICE). Logging the username of the collector in the OTLP data stream is not very useful.

We should use the feature of named pipes to get the (Windows) SID of the client process upon receiving an incoming named pipe connection and map that to a username and log that.

This is PII-sensitive, so it should only be done if requested in the pii.yml.

On Linux/Mac Unix domain sockets have a similar feature and IIRC is already being used.

jeffhostetler commented 10 months ago

To get the client peer data you need the OS handle to the pipe (rather than just the GO wrapper). This wasn't available at the time, so I couldn't do it then. But now that I've forked the relevant parts of the go-winio libraries to handle the multi-threaded problems, we can hack it a little further to get the peer data.