feat(hub): create unix socket group-writable (0660) - #158
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Create the hub's unix socket with mode
0660(owner + group read/write) instead of leaving it at the umask default.Why
Audit SEC-2. The socket was created by
bind()with nochmod, landing at0755under systemd's umask. Connecting to anAF_UNIXsocket needs write permission, so only the owningcan-hubuser could use it — group members were locked out. 0660 lets any user in the hub's group use it (usermod -aG can-hub <user>).How
TcpServerTransport_InitUnixtakes amode_tandchmods the socket right afterbind(), beforelisten()(fails closed if chmod fails).DEFAULT_UNIX_SOCKET_MODE 0660— no flag, the default is good enough.Testing
make testgreen (384/384),make releasecleanhub.sockis660Notes
Security, intended: the unix socket carries the full admin plane (pins, ACLs, kick) with no per-client identity, so
can-hubgroup membership = hub admin + unrestricted CAN r/w. Documented indoc/hub.mdas sudo-equivalent. Single socket by design, no admin/consumer split.