Skip to content

install(ubuntu): place key in /etc/apt/keyrings#5350

Merged
skshetry merged 4 commits intomainfrom
improve-ubuntu-install
Mar 7, 2025
Merged

install(ubuntu): place key in /etc/apt/keyrings#5350
skshetry merged 4 commits intomainfrom
improve-ubuntu-install

Conversation

@skshetry
Copy link
Copy Markdown
Collaborator

@skshetry skshetry commented Mar 4, 2025

The script that we have is a huge security risk. We were adding our key unconditionally to be trusted by apt for any package from any repo.

Instead, we should create a .list file for the repository to tell apt where to find the key for that specific repo, which is what this PR does.

As recommended in https://manpages.ubuntu.com/manpages/jammy/en/man8/apt-key.8.html#deprecation.

Also, see https://askubuntu.com/questions/1286545/what-commands-exactly-should-replace-the-deprecated-apt-key.

Also related: #3683.

@shcheklein shcheklein temporarily deployed to dvc-org-improve-ubuntu--q3t67c March 4, 2025 17:50 Inactive
Comment thread content/docs/install/linux.md Outdated
@shcheklein shcheklein temporarily deployed to dvc-org-improve-ubuntu--q3t67c March 4, 2025 17:51 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 4, 2025

Link Check Report

There were no links to check!

@shcheklein shcheklein temporarily deployed to dvc-org-improve-ubuntu--q3t67c March 6, 2025 03:23 Inactive
@skshetry skshetry requested review from 0x2b3bfa0 and Copilot March 6, 2025 03:23
@skshetry skshetry marked this pull request as ready for review March 6, 2025 03:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR updates the installation instructions for Debian/Ubuntu by replacing the deprecated apt-key commands with the new method of placing the GPG key in /etc/apt/keyrings.

  • Removed commands using apt-key and /etc/apt/trusted.gpg.d
  • Introduced commands to install wget and gpg, create /etc/apt/keyrings, and place the key appropriately

Reviewed Changes

File Description
content/docs/install/linux.md Updated Ubuntu installation instructions to use keyrings instead of deprecated apt-key commands

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comment thread content/docs/install/linux.md Outdated
$ sudo apt install wget gpg
$ sudo mkdir -p /etc/apt/keyrings
$ wget -qO - https://dvc.org/deb/iterative.asc | sudo gpg --dearmor -o /etc/apt/keyrings/packages.iterative.gpg
$ echo "deb [signed-by=/etc/apt/keyrings/packages.iterative.gpg] https://dvc.org/deb/ stable main" | sudo tee /etc/apt/sources.list.d/dvc.list
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

dvc.list had trusted=yes which I have dropped here.

Comment thread content/docs/install/linux.md Outdated
@shcheklein shcheklein temporarily deployed to dvc-org-improve-ubuntu--q3t67c March 6, 2025 03:25 Inactive
Comment on lines +108 to 115
$ sudo apt install wget gpg
$ sudo mkdir -p /etc/apt/keyrings
$ wget -qO - https://dvc.org/deb/iterative.asc | sudo gpg --dearmor -o /etc/apt/keyrings/packages.iterative.gpg
$ echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/packages.iterative.gpg] https://dvc.org/deb/ stable main" | sudo tee /etc/apt/sources.list.d/dvc.list
$ sudo chmod 644 /etc/apt/keyrings/packages.iterative.gpg /etc/apt/sources.list.d/dvc.list
$ sudo apt update
$ sudo apt install dvc
```
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This uses a mixture of instructions from vscode and eza. Compared to VSCode, Instead of placing gpg key in a temporary location, we download it directly.

@skshetry skshetry requested a review from shcheklein March 6, 2025 03:32
Copy link
Copy Markdown
Contributor

@0x2b3bfa0 0x2b3bfa0 left a comment

Choose a reason for hiding this comment

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

I'll refrain from recommending "pearls" like this... 😸 🧶

# install -D -groot -oroot -m644 <(wget -qO- https://dvc.org/deb/iterative.gpg) /etc/apt/keyrings/packages.iterative.gpg
# install -D --group=root --owner=root --mode=u=rw,g=r,o=r <(echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/packages.iterative.gpg] https://dvc.org/deb/ stable main") /etc/apt/sources.list.d/dvc.list

@skshetry skshetry merged commit 657edf5 into main Mar 7, 2025
4 checks passed
@skshetry skshetry deleted the improve-ubuntu-install branch March 7, 2025 04:35
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.

4 participants