2 个不稳定版本
0.2.0 | 2022 年 5 月 28 日 |
---|---|
0.1.0 | 2022 年 5 月 27 日 |
#2822 在 命令行工具
14KB
207 行
auth-tarball-from-git
通过 Git 仓库中签名的标签对 tarball 进行验证(具有可重复构建功能)。
签名的 git 标签包含提交对象的哈希值
object a631953b1241368b5f6bc471f9d89948f985fcb3
type commit
tag openpgp/v1.9.0
tagger Justus Winter <justus@sequoia-pgp.org> 1653320477 +0200
openpgp: Release 1.9.0.
-----BEGIN PGP SIGNATURE-----
iQEzBAABCgAdFiEEJWpOVeSnLZetJGjniNx+MzhfeR0FAmKLqx0ACgkQiNx+Mzhf
eR1w7gf+MSS1Su+kclHSKpVCg03TTyVdg+zx95FTlQjBtGaSRMbOAoWvCX53hZm9
/w2YZJdHTGAR50hFj78xnQjPg8bSEYrQD6HaMc/TYlFkrQcPQULCV8aNiiTlKPUC
GC0L8OecqG1tILejLtWkJpoSAh+oAK0QKjgyy3bYZU+KzCinV2+TC8LaAvcBSngt
R/Xu9g8X6CYf88mfO+IAyGeaDD+JMyQFp6q1fgzlFx/lA31iIg49vf1b9yQo2fxA
y8hnYu+dztZNMRcEL7Cl5UgFnT4tDv/rDlNpM136KHyvrXaqYC0GhNEoAsXX975L
9o0OzzRPOAxJj9/4Wigvu/fhOWRXSA==
=8qk5
-----END PGP SIGNATURE-----
如果我们没有签名的 tarball 但有签名的 git 标签,我们可以使用这个签名来证明 tarball 的真实性。为此,我们验证签名,然后尝试从标签中指定的提交生成一个相同的 tarball。这是可能的,因为只要参数相同,git archive
的输出是确定的。
使用 tarball 中的源代码是首选的,因为它可以使用现代加密哈希函数进行固定,而 git 只能提供 sha1。
签名验证使用 sequoia-pgp 而不是 gpg。
⚠️ 安全注意事项 ⚠️
签名的 git 标签仅验证 标签名称,而不是 仓库 URL。如果两个仓库都由 --keyring
中提供的密钥签名,则 v0.1.0
标签可以在一个仓库中重放至另一个仓库。
签名字符串中的哈希是 SHA1 哈希,已知存在安全问题(2005,2017,2020)。无论 pgp 签名质量如何,使用 git 验证 tarball 只能提供 sha1 级别的加密属性。
用法
# Sequoia
$ wget https://keys.openpgp.org/vks/v1/by-fingerprint/CBCD8F030588653EEDD7E2659B7DD433F254904A
$ wget https://gitlab.com/sequoia-pgp/sequoia/-/archive/openpgp/v1.9.0/sequoia-openpgp-v1.9.0.tar.gz
$ auth-tarball-from-git --keyring CBCD8F030588653EEDD7E2659B7DD433F254904A --tag openpgp/v1.9.0 https://gitlab.com/sequoia-pgp/sequoia sequoia-openpgp-v1.9.0.tar.gz
[2022-05-27T19:28:50Z INFO auth_tarball_from_git] Cloning repository from "https://gitlab.com/sequoia-pgp/sequoia"
[2022-05-27T19:28:54Z INFO auth_tarball_from_git] Tag successfully verified
[2022-05-27T19:28:54Z INFO auth_tarball_from_git] Reproducing archive...
[2022-05-27T19:28:55Z INFO auth_tarball_from_git] Reading input that should be verified...
[2022-05-27T19:28:55Z INFO auth_tarball_from_git] Comparing...
OK
# Monero
$ wget https://github.com/monero-project/monero/archive/refs/tags/v0.17.3.2.tar.gz
$ wget https://github.com/monero-project/monero/blob/master/utils/gpg_keys/luigi1111.asc
$ auth-tarball-from-git --keyring luigi1111.asc --tag v0.17.3.2 --prefix monero-0.17.3.2 https://github.com/monero-project/monero v0.17.3.2.tar.gz
[2022-05-27T19:30:03Z INFO auth_tarball_from_git] Cloning repository from "https://github.com/monero-project/monero"
[2022-05-27T19:30:06Z INFO auth_tarball_from_git] Tag successfully verified
[2022-05-27T19:30:06Z INFO auth_tarball_from_git] Reproducing archive...
[2022-05-27T19:30:08Z INFO auth_tarball_from_git] Reading input that should be verified...
[2022-05-27T19:30:08Z INFO auth_tarball_from_git] Comparing...
OK
依赖项
需要安装 sequoia-pgp 项目中的 sqv
来验证 pgp 签名。
资金
该项目由我自己通过 github sponsors 资助。
许可证
GPLv3+
依赖项
~9–23MB
~292K SLoC