peercred
peercred
¶
Best-effort Unix peer credential reading for the daemon IPC boundary.
Single shared primitive for SO_PEERCRED (Linux). Two consumers:
ipc/server.py— peer-UID admission gate (identity check at accept).daemon/process.py— control-plane audit metadata (cancel/submit provenance).
Platforms without SO_PEERCRED (e.g. macOS) return None; callers must
decide their own fail-open/fail-closed policy.
Classes¶
PeerCredentials
dataclass
¶
Kernel-reported credentials of the process at the other socket end.
Functions:¶
read_peer_credentials
¶
Read SO_PEERCRED from the connection's socket.
Returns None when the platform provides no SO_PEERCRED or the
read fails — availability is platform-dependent, so absence is not
itself evidence of a foreign peer.