Skip to content

Propagate permissions for all host-to-container socket mounts. - #1751

Merged
jglogan merged 1 commit into
apple:mainfrom
jglogan:socket-perms
Jun 18, 2026
Merged

Propagate permissions for all host-to-container socket mounts.#1751
jglogan merged 1 commit into
apple:mainfrom
jglogan:socket-perms

Conversation

@jglogan

@jglogan jglogan commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Allows socket mounts for non-user workloads.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

- Closes apple#1750.
- Applies permission code used for the `--ssh` mount to
  all host-to-container socket mounts.
- Adds a user option to the `doExec` test support function.
- Updates the `testRunCommandUnixSocketMount` to install
  `nc` in the test container, and check the socket
  permission, and check the mounted socket using `nc`
  as the guest user.
@github-actions

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 33.4%
Integration 21.11%
Combined 53.66%

@jglogan
jglogan merged commit 888582b into apple:main Jun 18, 2026
4 checks passed
@jglogan
jglogan deleted the socket-perms branch June 18, 2026 18:45
sylvaincombes added a commit to sylvaincombes/socktainer that referenced this pull request Jul 9, 2026
A container process running as a non-root user got EACCES on the relayed
docker.sock: apple/container 1.1.0 mirrors the host socket's mode onto the
root-owned guest-side socket (apple/container#1751), and socktainer's
control socket was created with umask-default 0755 — no write bit for the
guest user. Group-based modes can't help since the guest socket is always
root:root, so open the socket to 0666 and compensate by restricting
~/.socktainer to 0700: other host users are blocked at directory traversal
(the previous 0755 socket already denied them connect(2)), while the guest
mirror only copies the socket's own mode.

Live-verified on apple/container 1.1.0: --user 1000:1000 with the
docker.sock bind mount now connects out of the box; root baseline
unchanged. Also drops an accidentally duplicated create-directory /
remove-socket block in prepareUnixSocket.

Closes socktainer#288

Signed-off-by: Sylvain Combes <combes.sylvain@gmail.com>
sylvaincombes added a commit to sylvaincombes/socktainer that referenced this pull request Jul 10, 2026
A container process running as a non-root user got EACCES on the relayed
docker.sock: apple/container 1.1.0 mirrors the host socket's mode onto the
root-owned guest-side socket (apple/container#1751), and socktainer's
control socket was created with umask-default 0755 — no write bit for the
guest user. Group-based modes can't help since the guest socket is always
root:root, so open the socket to 0666 and compensate by restricting
~/.socktainer to 0700: other host users are blocked at directory traversal
(the previous 0755 socket already denied them connect(2)), while the guest
mirror only copies the socket's own mode.

Live-verified on apple/container 1.1.0: --user 1000:1000 with the
docker.sock bind mount now connects out of the box; root baseline
unchanged. Also drops an accidentally duplicated create-directory /
remove-socket block in prepareUnixSocket.

Closes socktainer#288

Signed-off-by: Sylvain Combes <combes.sylvain@gmail.com>
jianliang00 pushed a commit to jianliang00/container that referenced this pull request Aug 28, 2026
…#1751)

- Closes apple#1750.
- Applies permission code used for the `--ssh` mount to all
host-to-container socket mounts.
- Adds a user option to the `doExec` test support function.
- Updates the `testRunCommandUnixSocketMount` to install `nc` in the
test container, and check the socket permission, and check the mounted
socket using `nc` as the guest user.
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.

[Request]: Propagate permissions on all mounted Unix domain sockets from host into container.

2 participants