Attestation for kernel patches
One might wonder why this work is needed at all, given that email attestation has been widely available for almost exactly as long as the kernel has existed; Phil Zimmermann first released PGP in 1991. PGP (and its successor, GnuPG) have always been painful to use, though, even before considering their interference with patches and the review process in particular; PGP-signed mail can require escaping characters or be mangled by mail transfer agents. It is safe to say that nobody bothers checking the few PGP signatures that exist on patches sent via email.
Ryabitsev's goal is to make attestation easy enough that even busy kernel developers will be willing to add it to their workflow. The scheme he has come up with is, for now, meant for integration with processes that involve using git send-email to send out a set of patches, though it is not tightly tied to that workflow. A developer can add attestation to their process by creating a directory full of patches and sending them out via git send-email in the usual manner; attestation is then done as a separate step, involving an additional email message.
In particular, the developer will run the attest-patches tool found in Ryabitsev's korg-helpers repository. It will look at each patch and split it into three components:
- Some patch metadata: specifically the author's name and email address, along with the subject line.
- The commit message.
- The patch itself.
The tool will use sha256sum to create a separate SHA-256 checksum for each of the three components. The three checksums are then joined, in an abbreviated form, to create a sort of unique ID for the patch that looks like:
2a02abe0-215cf3f1-2acb5798
The attest-patches tool creates a file containing this "attestation ID", along with the full checksums for all three components:
2a02abe0-215cf3f1-2acb5798: i: 2a02abe02216f626105622aee2f26ab10c155b6442e23441d90fc5fe4071b86e m: 215cf3f133478917ad147a6eda1010a9c4bba1846e7dd35295e9a0081559e9b0 p: 2acb5798c366f97501f8feacb873327bac161951ce83e90f04bbcde32e993865
A block like this is generated for each patch given to attest-patches. The result happens to be a file in the YAML format, but one can live in ignorance of that fact without ill effect. The file is then passed to GnuPG for signing. The final step is to email this file to signatures@kernel.org, where it will appear on a public mailing list; attest-patches can perform this step automatically.
On the receiving end, a reviewer or subsystem maintainer runs get-lore-mbox with the -aA options; -A does not actually exist yet but one assumes it will appear shortly. As the tool creates a mailbox file suitable for feeding to git am, it will verify the attestation for each of the patches it finds. That is done by generating its own attestation ID for each patch, then using that ID to search for messages on the signatures mailing list. If any messages are found, the full checksum for each of the three patch components is checked. The GPG signature in the file is also checked, of course.
If the checks pass — meaning that an applicable signature message exists, the checksums match the patches in question, and the message is signed by a developer known to the recipient — then get-lore-mbox will create the requested mailbox file, adding a couple of tags to each patch describing the attestation that was found. Otherwise the tool will abort after describing where things went wrong.
A test run of the system has already been done; Kees Cook generated an
attestation message for this
patch series. He said that this
mechanism would be "utterly trivial
" to add to his normal
patch-generation workflow.
Jason Donenfeld, instead, was unconvinced
of the value of this infrastructure. He argued that "maintainers
should be reading commits as they come in on the mailing list
" and
that attestation would make the contribution process harder. He asked:
"is the lack of signatures on email patches a real problem we're
facing?
"
Ryabitsev responded that he saw this mechanism as addressing two specific threats:
- An "
overworked, tired maintainer
" may be tempted to perform cursory reviews of patches from trusted developers; attestation at least lets them know that those patches actually came from their alleged author. - Maintainers might diligently review patches arriving in email, then use a tool like get-lore-mbox to fetch those patches for easy application. If lore.kernel.org has been compromised, it could return a modified form of those patches and the maintainer may well never notice. Once again, attestation should block any such attack.
He ended with a hope that the process he has developed is easy enough that developers will actually use it.
Whether that will actually happen remains to be seen. The use of signed
tags on pull requests is still far from universal, despite the fact that
they, too, are easy to generate and Linus Torvalds requires them for
repositories not hosted on kernel.org. Based on past discussions, it seems
unlikely that Torvalds will require attestation for emailed patches. So if
patch attestation is to become widespread in the kernel community, it will
be as a result of lower-level maintainers deciding that it makes sense. Of
course, a successful attack could change attitudes quickly.
Index entries for this article | |
---|---|
Kernel | Development tools |
Kernel | Security/Patch verification |
Posted Mar 2, 2020 23:47 UTC (Mon)
by flussence (guest, #85566)
[Link] (5 responses)
Posted Mar 3, 2020 4:12 UTC (Tue)
by logang (subscriber, #127618)
[Link]
Posted Mar 3, 2020 4:19 UTC (Tue)
by qyliss (subscriber, #131684)
[Link]
Posted Mar 5, 2020 12:02 UTC (Thu)
by atnot (subscriber, #124910)
[Link]
Posted Mar 12, 2020 3:52 UTC (Thu)
by OrbatuThyanD (guest, #114326)
[Link] (1 responses)
git needs alternatives, stat. gpg needs to be allowed to die.
Posted Mar 13, 2020 3:43 UTC (Fri)
by flussence (guest, #85566)
[Link]
Posted Mar 3, 2020 7:35 UTC (Tue)
by nim-nim (subscriber, #34454)
[Link]
Posted Mar 3, 2020 10:07 UTC (Tue)
by unixbhaskar (guest, #44758)
[Link]
Well, if you insist, sooner or later it will get under the hood. Kai, this is not criticizing, but it might be easy for a few people, think about the rest.
Posted Mar 3, 2020 21:16 UTC (Tue)
by dkg (subscriber, #55359)
[Link]
It would be simpler to add some sort of --sign-with option to git send-email, and some sort of --require-signature-from option to git am, and use e-mail PGP/MIME (or S/MIME, i don't really care) cryptographic signatures.
Then users could add the appropriate options to their git config and move on with their existing workflow.
One legitimate concern with this counter-proposal is that the "patch metadata" won't be automatically covered by the signature. This has been a long-standing flaw in cryptographic e-mail signatures, but it has a very simple resolution (replicating the relevant e-mail headers inside the cryptographic payload), which is already in use by multiple e-mail clients.
Posted Mar 4, 2020 7:11 UTC (Wed)
by gdt (subscriber, #6284)
[Link] (1 responses)
Posted Mar 31, 2020 10:22 UTC (Tue)
by madalinbucur (guest, #122118)
[Link]
The whole thing relies on the signature sent to a certain mailing list.
Attestation for kernel patches
Attestation for kernel patches
My git configuration already signs every commit with my key from a smart card and it's a shame that the send-email flow loses that information.
Attestation for kernel patches
Attestation for kernel patches
Attestation for kernel patches
Attestation for kernel patches
Attestation for kernel patches
Attestation for kernel patches
The proposed mechanism seems surprisingly convoluted for its intended purpose.
Attestation for kernel patches
Attestation for kernel patches
Attestation for kernel patches
Can't a rogue patch sender also sign and send to that signature mailing list?