Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only verify the first GPG signature #569

Merged
merged 7 commits into from
Jan 21, 2020

Conversation

phmccarty
Copy link
Contributor

The only package in Clear Linux OS that (occasionally) has its source archive signed by multiple keys is gnupg, so to unblock updates for it, only verify the first signature from the .sig file.

When only one signature is present in the sig file (the common case), pass the entire sig file to gpg --verify ..., keeping the existing behavior.

For the implementation, I refactored parse_key into a more generic parse_gpg_packets function, and also updated tests.

Note that supporting verification of multiple signatures is much more involved, so I opened an enhancement request yesterday for that (#567).

To prepare for more general parsing of GPG key and signature files,
implement a new function, parse_gpg_packets(), and start using it where
appropriate.

Signed-off-by: Patrick McCarty <[email protected]>
The only package in Clear Linux OS that (occasionally) has its source
archive signed by multiple keys is `gnupg`, so to unblock updates for
it, only verify the first signature from the .sig file.

When only one signature is present in the sig file (the common case),
pass the entire sig file to `gpg --verify ...`, keeping the existing
behavior.

Signed-off-by: Patrick McCarty <[email protected]>
@phmccarty phmccarty requested review from bryteise and bwarden January 17, 2020 02:30
@phmccarty
Copy link
Contributor Author

If this approach looks okay, I will look at adding an additional test for verification of the first GPG signature when multiple signatures are encountered.

@phmccarty
Copy link
Contributor Author

Hmm, I'm seeing test errors for the travis CI in my fork... Interesting that those errors do not happen on Clear.

@phmccarty
Copy link
Contributor Author

phmccarty commented Jan 17, 2020

The reason for test failure on Ubuntu is that "packet separator" lines (beginning with # off=) from the gpg --list-packets output are not present, and my changes rely on them being present.

@bryteise
Copy link
Member

Well hopefully the separator you are using isn't something they change to often.

autospec/pkg_integrity.py Outdated Show resolved Hide resolved
There are only two GPG packet types that autospec needs to know about
for now ("signature" and "user ID"), so update `parse_gpg_packets` to
only add those packets for tracking.

Also, update unit tests to account for packets that are now skipped,
thus reducing the size of the packets list.

Signed-off-by: Patrick McCarty <[email protected]>
Older versions of gnupg do not print the "packet separator" lines in
`gpg --list-packets` output, so the length information is not parsed by
autospec and thus verification must be skipped for now.

Signed-off-by: Patrick McCarty <[email protected]>
In this function, returning `None` indicates success, so instead, a
GPGCliStatus instance should be returned for the new error cases.

Signed-off-by: Patrick McCarty <[email protected]>
@phmccarty
Copy link
Contributor Author

This series is ready for review again. I added two new tests for the multi-signature scenarios and fixed some error propagation issues in the GPGCli.verify method, thereby fixing the test for the error case when packet separator lines are not present in gpg --list-packets.

@phmccarty phmccarty merged commit 4d9d887 into clearlinux:master Jan 21, 2020
@phmccarty phmccarty deleted the gpg-single-sig branch January 21, 2020 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants