Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

[18.09] backport loosen permissions on /etc/docker directory #56

Conversation

thaJeztah
Copy link
Member

backport of moby#37847 for 18.09

git checkout -b 18.09_backport_more_permissive_daeon_conf_dir ce-engine/18.09
git cherry-pick -s -S -x cecd9817177093be99c1c9bb0dcf43ccec14ad1d

cherry-pick was clean; no conflicts

related: moby#37840, docker/cli#1358, moby#37619

The /etc/docker directory is used both by the dockerd daemon
and the docker cli (if installed on the saem host as the daemon).

In situations where the /etc/docker directory does not exist,
and an initial key.json (legacy trust key) is generated (at the
default location), the /etc/docker/ directory was created with
0700 permissions, making the directory only accessible by root.

Given that the 0600 permissions on the key itself already protect
it from being used by other users, the permissions of /etc/docker
can be less restrictive.

This patch changes the permissions for the directory to 0755, so
that the CLI (if executed as non-root) can also access this directory.

NOTE: "strictly", this patch is only needed for situations where no custom
location for the trustkey is specified (not overridden with --deprecated-key-path),
but setting the permissions only for the "default" case would make
this more complicated.

make binary shell

make install

ls -la /etc/ | grep docker

dockerd
^C

ls -la /etc/ | grep docker
drwxr-xr-x 2 root root    4096 Sep 14 12:11 docker

Signed-off-by: Sebastiaan van Stijn github@gone.nl
(cherry picked from commit cecd981)
Signed-off-by: Sebastiaan van Stijn github@gone.nl

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

The `/etc/docker` directory is used both by the dockerd daemon
and the docker cli (if installed on the saem host as the daemon).

In situations where the `/etc/docker` directory does not exist,
and an initial `key.json` (legacy trust key) is generated (at the
default location), the `/etc/docker/` directory was created with
0700 permissions, making the directory only accessible by `root`.

Given that the `0600` permissions on the key itself already protect
it from being used by other users, the permissions of `/etc/docker`
can be less restrictive.

This patch changes the permissions for the directory to `0755`, so
that the CLI (if executed as non-root) can also access this directory.

> **NOTE**: "strictly", this patch is only needed for situations where no _custom_
> location for the trustkey is specified (not overridden with `--deprecated-key-path`),
> but setting the permissions only for the "default" case would make
> this more complicated.

```bash
make binary shell

make install

ls -la /etc/ | grep docker

dockerd
^C

ls -la /etc/ | grep docker
drwxr-xr-x 2 root root    4096 Sep 14 12:11 docker
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit cecd981)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added this to the 18.09.0 milestone Sep 18, 2018
@thaJeztah
Copy link
Member Author

ping @ijc @vdemeester @justincormack

Copy link

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌮

Copy link

@andrewhsu andrewhsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

spoke with @justincormack and this seems like a palatable change

@andrewhsu andrewhsu merged commit 34b3cf4 into docker-archive:18.09 Sep 28, 2018
@thaJeztah thaJeztah deleted the 18.09_backport_more_permissive_daeon_conf_dir branch October 1, 2018 11:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants