从未签名的存储库强制更新

Sha*_*han 121 aptitude apt repository

我在 Ubuntu 16.04 中使用来自 Debian 多媒体的未签名存储库:

deb http://www.deb-multimedia.org jessie main
Run Code Online (Sandbox Code Playgroud)

要安装deb-multimedia-keyring,我正在运行:

apt-get update && apt-get install deb-multimedia-keyring -y
Run Code Online (Sandbox Code Playgroud)

这给出了一个错误:

W: GPG error: http://www.deb-multimedia.org jessie InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5C808C2B65558117
E: The repository 'http://www.deb-multimedia.org jessie InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Run Code Online (Sandbox Code Playgroud)

Pra*_*nia 138

您可以在您的sources.list(位于/etc/apt/sources.list)中设置选项:

deb [trusted=yes] http://www.deb-multimedia.org jessie main
Run Code Online (Sandbox Code Playgroud)

受信任的选项是关闭 GPG 检查的。详情请参阅man 5 sources.list

您可以使用 vim(或您喜欢的任何工具)或任何非终端编辑器(如 gedit)在终端中编辑文件。

  • 我的问题是添加了 add-apt-repository 的存储库。除了“/etc/apt/sources.list”中的源之外,请务必检查“/etc/apt/sources.list.d/”中是否有可能包含您尝试信任的源的任何“.list”文件` (6认同)
  • 它位于`/etc/apt/sources.list`。您可以使用 vim(或您喜欢的任何工具)或任何非终端编辑器(如 gedit)在终端中编辑它。 (2认同)

and*_*.46 75

您可以使用以下选项绕过一些重要的保护措施

--allow-unauthenticated
Run Code Online (Sandbox Code Playgroud)

从 apt-get 的手册页:

--allow-unauthenticated
    Ignore if packages can't be authenticated and don't prompt about
    it. This can be useful while working with local repositories, but
    is a huge security risk if data authenticity isn't ensured in
    another way by the user itself. The usage of the Trusted option for
    sources.list(5) entries should usually be preferred over this
    global override. Configuration Item:
    APT::Get::AllowUnauthenticated.
Run Code Online (Sandbox Code Playgroud)

但是在更广泛地使用此选项时要谨慎一点,保护措施到位是为了保护您的计算机而不是限制您的自由......

  • 注意:截至 2018 年 7 月,这似乎不再适用于 Ubuntu 18.04。 (62认同)
  • 我很幸运通过 [this other answer](https://superuser.com/questions/1331936/how-can-i-get-past-a-repository-is-not-尝试更新时已签名的消息)。 (28认同)
  • 在执行`sudo apt-get update --allow-unauthenticated`时告诉我“这个选项不能与其他选项一起解释” (3认同)
  • 有趣的; 也许我从我观察到的错误背后尝试的机器上可能还有其他不同的东西。在任何情况下,将 `[trusted=yes]` 字段添加到 sources.list 确实有效。感谢您的勤奋@andrew.46 :) (3认同)

小智 10

另一个通用的解决方案是

sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5C808C2B65558117
Run Code Online (Sandbox Code Playgroud)

注意:我没有使用这个存储库测试解决方案,但是我使用 Skype 存储库测试了它并且它工作得很好。

针对您的情况的另一种解决方案是安装密钥

wget http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2012.05.05_all.deb -O deb-multimedia-keyring.deb
sudo dpkg -i multimedia-keyring_all.deb
Run Code Online (Sandbox Code Playgroud)

通过在全步行描述这里


dra*_*788 8

如果您尝试从他们打包密钥的存储库中获取包并将它们包含在存储库中而不是其他地方,那么使用 dpkg 下载并安装密钥/密钥环包可能会非常烦人,而且很难做到这一点以易于编写脚本和可重复的方式。

如果您可以从密钥服务器安装密钥(如另一个答案中建议的那样apt-key adv),或者如果您可以通过 https 从受信任的来源下载它们并使用 apt-key 安装(例如wget https://trusted.key.site/my-trusted-key.gpg | sudo apt-key add -),则不建议使用以下脚本,但如果您不这样做没有其他办法了,就用这个吧。

echo "deb http://your.repo.domain/repository/ $(lsb_release -c -s) universe" | sudo tee /etc/apt/sources.list.d/your-repo-name.list

sudo apt -o Acquire::AllowInsecureRepositories=true \
-o Acquire::AllowDowngradeToInsecureRepositories=true \
update

## if the 'apt update' above fails it is likely due to previously
## having the GPG key and repository on the system, you can clean
## out the old lists with `sudo rm /var/lib/apt/lists/your.repo.domain*`

apt-get -o APT::Get::AllowUnauthenticated=true install repo-keyring-pkgname

## If you ever run `sudo apt-key del your-repos-keyID`
## you may have to `sudo apt remove --purge repo-keyring-pkgname`
## Update should run without the GPG warnings now that the key is installed

apt-get update
apt-get install somepkg-from-repo
Run Code Online (Sandbox Code Playgroud)

我最初把它放在一起是因为 i3 在他们的 sur5r 存储库中这样做,但后来我发现他们的密钥在 keyserver.ubuntu.com 列表中,所以我可以避免sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E3CA1A89941C42E6所有额外的软件包麻烦。


leo*_*das 6

您可以从密钥服务器获取 PUBLIC_KEY 并将其添加到 apt-key 中。假设密钥服务器是pgpkeys.mit.edu,您首先需要输入:

gpg --keyserver pgpkeys.mit.edu --recv-key KEY_IN_ERROR
gpg -a --export KEY_IN_ERROR | sudo apt-key add -
Run Code Online (Sandbox Code Playgroud)

将密钥 KEY_IN_ERROR 替换为错误消息中的密钥,即 5C808C2B65558117。

另外,如果您确实有兴趣添加未签名的存储库,您可以在sources.list中的所需存储库条目中添加一个标志,如下所示:

deb [allow-insecure=yes] http://www.deb-multimedia.org jessie main
Run Code Online (Sandbox Code Playgroud)

如果您想微调单个条目的安全设置,这非常有用。


小智 6

N:有关存储库创建和用户配置详细信息,请参阅 apt-secure(8) 联机帮助页。

回答:

  1. ls /etc/apt/sources.list.d

接下来尝试使用删除它们

  1. sudo rm -i /etc/apt/sources.list.d/{output of 1}

为每个人做

例如:sudo rm -i /etc/apt/sources.list.d/wireshark-dev-ubuntu-stable-focal.list

然后尝试

  1. sudo apt update

:)


xjc*_*jcl 6

这在某种程度上重复了现有的答案,但--allow-insecure-repositories--allow-unauthenticated在某些组合中有效。以不安全的 deadsnakes 存储库为例:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update --allow-insecure-repositories
sudo apt-get install python3.9* --allow-unauthenticated
Run Code Online (Sandbox Code Playgroud)