Skip to content

feat(hub): create unix socket group-writable (0660) - #158

Merged
jamofer merged 1 commit into
mainfrom
feat/sec2-unix-socket-group-perms
Jul 21, 2026
Merged

feat(hub): create unix socket group-writable (0660)#158
jamofer merged 1 commit into
mainfrom
feat/sec2-unix-socket-group-perms

Conversation

@jamofer

@jamofer jamofer commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

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 no chmod, landing at 0755 under systemd's umask. Connecting to an AF_UNIX socket needs write permission, so only the owning can-hub user 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_InitUnix takes a mode_t and chmods the socket right after bind(), before listen() (fails closed if chmod fails).
  • Hub passes a fixed DEFAULT_UNIX_SOCKET_MODE 0660 — no flag, the default is good enough.

Testing

  • make test green (384/384), make release clean
  • Manual: freshly created hub.sock is 660

Notes

Security, intended: the unix socket carries the full admin plane (pins, ACLs, kick) with no per-client identity, so can-hub group membership = hub admin + unrestricted CAN r/w. Documented in doc/hub.md as sudo-equivalent. Single socket by design, no admin/consumer split.

@jamofer
jamofer merged commit f244565 into main Jul 21, 2026
6 checks passed
@jamofer
jamofer deleted the feat/sec2-unix-socket-group-perms branch July 21, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant