私有仓库:以下签名无效。

在我的仿生“客户端”上,我得到:
GPG error: http://repo.localpod/Dml/ldom-debs/ubuntu bionic InRelease: The following signatures were invalid: ADE541A20ACF8997C01BDCF7090678A30132048A

请注意,它说的是“无效”,而不是缺失!
这些是我自己的 .deb 包,收集在一个仓库中。 (对于 trusty 和 xenial 版本都可以正常工作)
我使用类似以下方式签署了该仓库:(通过 reprepro 的 conf/distributions 进行调用)
gpg --batch --yes --keyring $KeyP --secret-keyring $KeyS -a --no-permission-warning   --detach-sign --default-key 'ldom install service' --output $3 $1
$1 = .../Release
$2 = .../InRelease

好的,我试过了:
 wget  http://repo.localpod/Dml/ldom-debs/ubuntu/dists/bionic/InRelease
 and: 
 # gpgv --keyring /etc/apt/trusted.gpg "InRelease"
 gpgv: Signature made Thu 24 May 2018 12:20:29 PM CEST
 gpgv:                using DSA key 090678A30132048A
 gpgv: Good signature from "ldom install service <tbuunix@...dk>"

这不是 apt-get 如何检查签名的方式吗?还是密钥太旧了?类型错误?

完整错误信息:

 apt-key list
 pub   rsa2048 2014-06-24 [SC]
      754A 1A7A E731 F165 D5E6  D4BD 0E08 A149 DE57 BFBE
uid           [ unknown] SaltStack Packaging Team <packaging@saltstack.com>
sub   rsa2048 2014-06-24 [E]

pub   dsa1024 2013-06-10 [SCA]
      ADE5 41A2 0ACF 8997 C01B  DCF7 0906 78A3 0132 048A
uid           [ unknown] LDOM install service <tbuunix@....dk>
sub   elg1024 2013-06-10 [E]

root@ubu18:~# apt-get update
 Get:1 http://repo.localpod/Dml/ldom-debs/ubuntu bionic InRelease [1,154 B]
 Err:1 http://repo.localpod/Dml/ldom-debs/ubuntu bionic InRelease
   The following signatures were invalid:  ADE541A20ACF8997C01BDCF7090678A30132048A
 Reading package lists... Done
 W: GPG error: http://repo.localpod/Dml/ldom-debs/ubuntu bionic InRelease: The  following signatures were invalid: ADE541A20ACF8997C01BDCF7090678A30132048A
 E: The repository 'http://repo.localpod/Dml/ldom-debs/ubuntu bionic 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.

任何关于我可能遗漏的线索,都将受到欢迎... 谢谢,
/holger 解决方法:
最终我按照指南(https://www.digitalocean.com/community/tutorials/how-to-use-reprepro-for-a-secure-package-repository-on-ubuntu-14-04)进行操作 ----> 大致如此。 ----> 仍然有些'正在进行中',但这里有一些提示:
使用一个(全新的)Docker镜像:
docker run -it -v /your/packages:/debs ubuntu:18.04
apt update
apt install -y vim inetutils-ping curl wget netcat telnet aptitude man manpages bash-completion rng-tools reprepro iproute2

rebuild your packages:

cd  /debs/src
ls -d */DEBIAN  | xargs -n1 dirname | xargs -n1 dpkg-deb -vD --build

时间关键的事情。 使用现有的钥匙:
    gpg --import /debs/.../secring.gpg

获取一个新的密钥:

gpg --full-generate-key
#rsa 4
#bits  4096
#your_key_name
#passphrase

#
gpg --edit-key your_key_name
#addkey
#(4) RSA (sign only)
#4096
#0
#yes
#yes
#save

gpg --list-secret
gpg --list-key


gpg --export .....your..key.....number............... > keyfile
apt-key add keyfile

好的,是时候进行reprepro设置了:
mkdir /debs/u18repo
cd /debs/u18repo
cat <<END >conf/options
ask-passphrase
END

cat <<END >conf/distributions
Codename: bionic
Components: main
Architectures: amd64
SignWith: .....your..key.....number...............
END
reprepro -b /debs/u18repo includedeb bionic /debs/src/*.deb

gpg --export .....your..key.....number............... > keyfile

测试一下:
apt-key add keyfile
echo "deb file:////debs/u18repo/ bionic main" >> "/etc/apt/sources.list"
apt update

现在,如果你在客户端上共享/debs/u18repo(使用httpd),并使用以下命令导入密钥:apt-key add http:/.../keyfile 然后运行apt update应该可以正常工作...

你能解决这个问题吗?我在我的bionic私有存储库中也遇到了同样的问题。 - Kenny Rasschaert
3嗯,是的(也不是...)-看看我的“更新”关于解决方法。我会保持开放,希望一些Ubuntu/Debian的超级用户能够给出一个解释,解释我失败的原因。 :) - Holger Morgen
2个回答

我遇到了同样的问题。 在InRelease文件中有一个PGP签名的消息,它应该包含:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

这意味着使用SHA256进行签名。SHA1是弱算法,不应使用。因此,如果存在SHA1,则需要更新您的gnupg配置以使用sha256。

在我的情况下:

echo "personal-digest-preferences SHA256 SHA384 SHA512 SHA224 RIPEMD160" >> ~/.gnupg/gpg.conf

然后像往常一样使用gpg重新签署InRelease文件。


3天啊,我绝对猜不到这就是问题所在。非常感谢你,你真的值得一枚奖章。 - bviktor
1太棒了。没有这个,我就完蛋了。 - k_o_

我曾经遇到过完全相同的问题。
确保您使用的所有密钥都是以二进制格式而不是ASCII加密格式。 如果其中任何一个密钥是以ASCII加密格式,使用-将其转换为二进制格式。
gpg --dearmor

根据this所述:
“我们避免使用ASCII编码的文件的原因是它们无法直接被SecureApt使用。”
此外,请确保在您的~/.gnupg/gpg.conf文件中包含以下行或类似内容。
cert-digest-algo SHA256
digest-algo SHA256