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

我在Debian多媒体deb http://www.deb-multimedia.org jessie main Ubuntu 16.04中使用了一个未签名的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. 

提前致谢

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

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

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

您可以在sources.list设置选项:

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

可信选项是关闭GPG检查的。 有关详细信息,请参阅man 5 sources.list

另一种通用的解决方案是

 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 

正如在这里完整的描述

如果你试图从存储库中获取一个包,并将它们打包并将它们包含在存储库中而不是其他地方,那么使用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 

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

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

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