$ sudo rpm -i package.rpm
error: package.rpm: Header V4 RSA/SHA1 signature: BAD, key ID 1234567
error: package.rpm cannot be installed
$ rpm --version
RPM version 4.4.2.3
It turns out that CentOS 5 doesn't support V4 signatures, is very picky about whether your public key has subkeys, and none of this is documented outside of an ancient bug and a bunch of angry blog posts and stack overflow questions. If you read all of that you'll get a bunch of conflicting advice, so I'll add another shout into the wind that might help someone in the future. Here's a working setup:
Signing system is Ubuntu trusty:
$ lsb_release -rdNote that your signing key can have subkeys when signing (by default gpg creates a subkey), but if you just export your public key with the subkey as normal and attempt to use it for verification it will look like this (V3 sig, but still marked "BAD") on CentOS 5:
Description: Ubuntu 14.04.1 LTS
Release: 14.04
$ rpmsign --version
RPM version 4.11.1
$ rpmsign --define "%_gpg_name My GPGName" --define "__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --digest-algo=sha1 --batch --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning -u \\\"%{_gpg_name}\\\" -sbo %{__signature_filename} %{__plaintext_filename}" --resign package.rpm
$ rpm -Kv package.rpm
package.rpm:
Header V3 RSA/SHA1 Signature, key ID 1234567: OK
Header SHA1 digest: OK (aaaaaaaaaaaaaaabbbbbbbbbbbb)
V3 RSA/SHA1 Signature, key ID 1234567: OK
MD5 digest: OK (aaaaaaaabbbbbbbbb)
$ rpm -Kv new2.rpmand since gpg doesn't seem to give you a way to export a master without subkeys, on your Ubuntu signing machine you need to delete the subkey and export again:
new2.rpm:
Header V3 RSA/SHA1 signature: BAD, key ID 1234567
Header SHA1 digest: OK (aaaaaaaaaaaaaaabbbbbbbbbbbb)
V3 RSA/SHA1 signature: BAD, key ID 1234567
MD5 digest: OK (aaaaaaaabbbbbbbbb)
$ gpg --edit 1234567Then on your Centos 5 system (I was using 5.11):
gpg> key 1
gpg> delkey
gpg> save
gpg> quit
gpg --export --armor 1234567 > 1234567_master.pub
$ sudo rpm --import 1234567_master.pubSimple right?
$ rpm -Kv new2.rpm
new2.rpm:
Header V3 RSA/SHA1 signature: OK, key ID 1234567
Header SHA1 digest: OK (aaaaaaaaaaaaaaabbbbbbbbbbbb)
V3 RSA/SHA1 signature: OK, key ID 1234567
MD5 digest: OK (aaaaaaaabbbbbbbbb)
No comments:
Post a Comment