Bug 829621

Summary: rpm database corruption after gpg keys import
Product: Red Hat Enterprise Linux 6 Reporter: GV <rhel>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: Patrik Kis <pkis>
Severity: high Docs Contact:
Priority: medium    
Version: 6.2CC: pkis, rhel
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: rpm-4.8.0-29.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 10:51:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
.gnupg directory
none
.rpmmacros
none
key1.txt
none
key2.txt
none
autocorr-de-3.2.1-19.6.el6_0.5.noarch.rpm
none
autocorr-en-3.2.1-19.6.el6_0.5.noarch.rpm none

Description GV 2012-06-07 06:23:01 UTC
# rm -rf .gnupg
# gpg --gen-key 
...
# gpg -k
/root/.gnupg/pubring.gpg
------------------------
pub   1024R/16A3CBC5 2012-06-07
uid                  RPM Test <rpm@test>
sub   1024R/C351AA24 2012-06-07

# gpg --export -a 16A3CBC5 > key1.txt
# rpm --import key1.txt
# wget http://ftp-stud.hs-esslingen.de/Mirrors/centos/6.2/os/x86_64/Packages/autocorr-en-3.2.1-19.6.el6_0.5.noarch.rpm
....
# wget http://ftp-stud.hs-esslingen.de/Mirrors/centos/6.2/os/x86_64/Packages/autocorr-de-3.2.1-19.6.el6_0.5.noarch.rpm
...
# echo "%_gpg_name RPM Test <rpm@test>" > .rpmmacros
# rpmsign --resign autocorr-*
Enter pass phrase: 
Pass phrase is good.
autocorr-de-3.2.1-19.6.el6_0.5.noarch.rpm:
autocorr-en-3.2.1-19.6.el6_0.5.noarch.rpm:
# rpm -ivh autocorr-*
Preparing...                ########################################### [100%]
   1:autocorr-en            ########################################### [ 50%]
   2:autocorr-de            ########################################### [100%]
# rpm -qa | grep ^gpg-p
gpg-pubkey-16a3cbc5-4fd045f8
gpg-pubkey-c105b9de-4e0fd3a3
gpg-pubkey-e684206e-3df4643e
gpg-pubkey-0608b895-4bd22942
# gpg --gen-key 
...
# gpg -K
/root/.gnupg/secring.gpg
------------------------
sec   1024R/16A3CBC5 2012-06-07
uid                  RPM Test <rpm@test>
ssb   1024R/C351AA24 2012-06-07

sec   4096R/D10DBDA5 2012-06-07
uid                  RPM Test <rpm@test>
ssb   4096R/60E5C974 2012-06-07

# gpg --export -a "RPM Test" > key2.txt
# rpm -ev gpg-pubkey-16a3cbc5-4fd045f8
# rpm --import key2.txt
# rpm -qa | grep ^gpg-p
error: rpmdbNextIterator: skipping h#     337 Header V4 RSA/SHA1 Signature, key ID 16a3cbc5: BAD
gpg-pubkey-c105b9de-4e0fd3a3
gpg-pubkey-e684206e-3df4643e
error: rpmdbNextIterator: skipping h#     336 Header V4 RSA/SHA1 Signature, key ID 16a3cbc5: BAD
gpg-pubkey-d10dbda5-4fd04703
gpg-pubkey-0608b895-4bd22942
# rpm -q autocorr-en
error: rpmdbNextIterator: skipping h#     336 Header V4 RSA/SHA1 Signature, key ID 16a3cbc5: BAD
package autocorr-en is not installed
# rpm -q autocorr-de
error: rpmdbNextIterator: skipping h#     337 Header V4 RSA/SHA1 Signature, key ID 16a3cbc5: BAD
package autocorr-de is not installed

Comment 2 Panu Matilainen 2012-07-02 10:59:22 UTC
Please attach the (public) test keys and re-signed autocorr* packages them for reproduction purposes.

Comment 3 GV 2012-07-02 17:11:36 UTC
Sorry, I do not have those keys anymore. Anyway, I generated a new set of keys and everything was uploaded.

The problem I see with the corruption is because the second file (key2.txt) has 2 keys inside instead of one. rpm in Fedora 17 report an error when I'm trying to import the keys from second file.

Comment 4 GV 2012-07-02 17:12:22 UTC
Created attachment 595777 [details]
.gnupg directory

Comment 5 GV 2012-07-02 17:12:48 UTC
Created attachment 595778 [details]
.rpmmacros

Comment 6 GV 2012-07-02 17:13:16 UTC
Created attachment 595779 [details]
key1.txt

Comment 7 GV 2012-07-02 17:13:37 UTC
Created attachment 595780 [details]
key2.txt

Comment 8 GV 2012-07-02 17:14:09 UTC
Created attachment 595781 [details]
autocorr-de-3.2.1-19.6.el6_0.5.noarch.rpm

Comment 9 GV 2012-07-02 17:14:48 UTC
Created attachment 595782 [details]
autocorr-en-3.2.1-19.6.el6_0.5.noarch.rpm

Comment 10 Panu Matilainen 2012-07-03 07:57:08 UTC
h(In reply to comment #3)
> The problem I see with the corruption is because the second file (key2.txt)
> has 2 keys inside instead of one. rpm in Fedora 17 report an error when I'm
> trying to import the keys from second file.

Ah, that one... I suspected that much but wanted to be sure you hadn't discovered some other similar case. But yes, it needs fixing, thanks for filing the bug.

Comment 12 RHEL Program Management 2012-07-10 08:10:20 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 13 RHEL Program Management 2012-07-11 01:52:13 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 14 RHEL Program Management 2012-08-14 21:59:57 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 20 errata-xmlrpc 2013-02-21 10:51:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0461.html