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

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

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

deb http://www.deb-multimedia.org jessie main

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

apt-get update && apt-get install deb-multimedia-keyring -y

这会出现错误:

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.

答案1

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

deb [trusted=yes] http://www.deb-multimedia.org jessie main

受信任的选项会关闭 GPG 检查。请参阅man 5 sources.list以了解详细信息。

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

答案2

你可以绕过一些重要保障使用以下选项:

--allow-unauthenticated

从 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.

但要谨慎使用此选项,因为有安全措施可以保护你的电脑没有限制你的自由……

编辑

--allow-unauthenticated从 Ubuntu 的新版本开始,--allow-insecure-repositories可以使用而不是。

为了执行更新,命令如下

sudo apt-get update --allow-insecure-repositories

答案3

另一个通用的解决方案是

sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5C808C2B65558117

注意:我没有用这个存储库测试解决方案,但我用 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

正如完整演练中所述:如何在 Debian 操作系统上安装 Debian 多媒体存储库

答案4

你可以从密钥服务器获取 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 -

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

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

deb [allow-insecure=yes] http://www.deb-multimedia.org jessie main

如果您想针对单个条目微调安全设置,这真的很有用。

相关内容