Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine: update chmod command for gpg keys on debian #17070

Merged
merged 2 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions engine/install/debian.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ Docker from the repository.
2. Add Docker's official GPG key:

```console
$ sudo mkdir -m 0755 -p /etc/apt/keyrings
$ sudo install -m 0755 -d /etc/apt/keyrings
$ curl -fsSL {{ download-url-base }}/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg
```

3. Use the following command to set up the repository:
Expand All @@ -119,18 +120,6 @@ Raspbian.
$ sudo apt-get update
```

> Receiving a GPG error when running `apt-get update`?
>
> Your default [umask](https://en.wikipedia.org/wiki/Umask){: target="blank"
> rel="noopener" } may be incorrectly configured, preventing detection of the
> repository public key file. Try granting read permission for the Docker
> public key file before updating the package index:
>
> ```console
> $ sudo chmod a+r /etc/apt/keyrings/docker.gpg
> $ sudo apt-get update
> ```
Comment on lines -122 to -132
Copy link
Member

Choose a reason for hiding this comment

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

🎉

before we fully celebrate, let's also get some more eyes on this in case we're overlooking scenarios where someone could still run into this.

Overall I think we should be fine (assuming users just ran the steps above), and I guess if someone ran those steps with the old variant, they would already have run into the issue.

Copy link
Member

Choose a reason for hiding this comment

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

Oh! 🤦 I think there is still a situation; we now fixed the directory permissions, but we don't explicitly set read permissions on the docker.gpg itself.

I guess we could either keep a note (but I hate "too many notes" as they distract from the overall flow), or we could add a line to always set the permissions;

$ curl -fsSL {{ download-url-base }}/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg

I double-checked and yes, looks like we still may have to (here's with a 0066 umask);

umask 0066
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker2.gpg


ls -l /etc/apt/keyrings/
total 8
-rw-r--r-- 1 root root 2760 Jun  7  2022 docker.gpg
-rw------- 1 root root 2760 Apr  8 16:20 docker2.gpg

umask 0022

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added chmod to the previous step - I agree that too many notes creates clutter and makes it hard to read


2. Install Docker Engine, containerd, and Docker Compose.

<ul class="nav nav-tabs">
Expand Down
15 changes: 2 additions & 13 deletions engine/install/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ Docker from the repository.
2. Add Docker's official GPG key:

```console
$ sudo mkdir -m 0755 -p /etc/apt/keyrings
$ sudo install -m 0755 -d /etc/apt/keyrings
$ curl -fsSL {{ download-url-base }}/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg
```

3. Use the following command to set up the repository:
Expand All @@ -115,18 +116,6 @@ Docker from the repository.
$ sudo apt-get update
```

> Receiving a GPG error when running `apt-get update`?
>
> Your default [umask](https://en.wikipedia.org/wiki/Umask){: target="blank"
> rel="noopener" } may be incorrectly configured, preventing detection of the
> repository public key file. Try granting read permission for the Docker
> public key file before updating the package index:
>
> ```console
> $ sudo chmod -R a+rx /etc/apt/keyrings
> $ sudo apt-get update
> ```

2. Install Docker Engine, containerd, and Docker Compose.

<ul class="nav nav-tabs">
Expand Down