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

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

我很清楚这样做很危险

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

 sudo apt-get --allow-unauthenticated upgrade 

apt-get手册页:

–allow-未经认证
如果无法对包进行身份validation并且不提示它,请忽略它。 这对像pbuilder这样的工具很有用。 配置项: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并避免所有额外的包裹麻烦。

使用以下内容创建/etc/apt/apt.conf.d/99allow_unauth

 APT { Get { AllowUnauthenticated "1"; }; }; 

感谢php-coder的评论 。