如何绕过/忽略apt的gpg签名检查?

您所在的位置:网站首页 关闭证书验证 如何绕过/忽略apt的gpg签名检查?

如何绕过/忽略apt的gpg签名检查?

2024-05-13 23:34| 来源: 网络整理| 查看: 265

问题描述

我访问的所有key-servers都超时了。我需要安装包而不检查公钥的签名。有没有办法绕过所有签名检查/忽略所有签名错误或傻瓜认为签名传递?

我很清楚这样做很危险

最佳解决方案

将--allow-unauthenticated选项传递给apt-get,如下所示:

sudo apt-get --allow-unauthenticated upgrade

从apt-get的手册页:

–allow-unauthenticated Ignore if packages can’t be authenticated and don’t prompt about it. This is useful for tools like pbuilder. Configuration Item: APT::Get::AllowUnauthenticated.

您可以在/etc/apt/apt.conf.d/目录中使用自己的配置文件使此设置永久化。文件名可以是99myown,它可能包含以下行:

APT::Get::AllowUnauthenticated "true";

这样,每次要安装软件时都不需要使用该选项。注意:我不建议默认设置此选项,它会绕过可能允许攻击者危害您的计算机的签名检查。

次佳解决方案

也许您可以尝试创建文件/etc/apt/apt.conf(如果您创建它将会读取)并插入此代码:

APT{Ignore {"gpg-pubkey"; }};

第三种解决方案

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

如果您可以从密钥服务器安装密钥或通过https从受信任的源下载密钥,则不建议使用以下脚本,但如果您没有其他任何方式,则可以使用此脚本。

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并避免所有额外的包麻烦。

参考资料 How do I bypass/ignore the gpg signature checks of apt?



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3