-
Notifications
You must be signed in to change notification settings - Fork 164
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
kernel : enable module signing #3116
Conversation
45ba090
to
01db481
Compare
@shjala , your approach let to the kernel build system generate the keys. But I think we should allow (and simplify) the usage of custom keys. You could put pre-generated keys under pkg/kernel/certs and use them. I think it makes more easy to use customized keys. What do you think? |
Can you change the commit message?
|
01db481
to
8a40837
Compare
@rene I can add a |
You need to generate the cert file and pass its path to CONFIG_MODULE_SIG_KEY. You can use custom location if you want. |
Yeah sure, but if we just copy the custom generated key to certs/signing_key.pem then it is simple and clean and the default case, so no need for extra doc:
|
You mean, copy the generated key to the final container's image? Well, that's an approach as well. But I'm wondering that some manufacturer(s) (really concerned about security) will eventually want to use his(their) own key, that's why I asked what do you think.... but for me copy the generated key it's also fine... |
@rene The current way is good because it throws the key away after build, no chance of leaking it and signing malicious modules. But what I mean by |
Got it, yes, looks good this way. |
@rene 👍, I will add necessary changes. |
6d0e9d9
to
5023e4b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm tryig to understand the implications of the throwaway key, but I don't see the code which generates it and uses it, so I need some help.
My concern is around buiding the same release of EVE-OS (x.y.x-kvm-amd64) mutiple times and whether or not that would result in different bits (hence different sha256) for the kernel?
Separately, once we nailed this down for pkg/kernel we should also apply it to pkg/new-kernel.
The kernel build process will generate it, to be exact here, then if the kernel configs for automatic signing are set, during
yes it will be different, will that be a problem? my understanding is that we have one official release per-version, right?
sure, that's the plan. |
Today we build using the github runners and publish the resulting artificates on the releases page. Also, as we do a patch (to the pkg/foo source somewhere) and build the x.y.1 patch release it would make sense to be able to do a binary comparison with the artifacts produced for x.y.0 to make sure the right components changed. Both of those would be problematic with the random module signing key. I wonder about the threat model and whether a fixed module signing key (stored in github) would be as effective as a random one. Let's discuss offline or on the EVE call? |
sure. |
There are two artifacts that are affected, one is kernel itself (public key is inserted in the kernel key ring during build) and second one are the modules. Signature is appended at the end of each module file, and stripping the module will remove it so still possible to do a byte by byte binary comparison of individual modules. For kernel I think pinpointing the embedded key offset and size and skipping over that part for binary comparison is possible. |
5023e4b
to
0a210a6
Compare
d2e2a5a
to
b57fde0
Compare
Given that two months ago or so I had to compare two different EVE images/builds on short order, I'd like to see the tools to do such comparison with the above ignores as part of this PR, otherwise we will not be able to do such emergency comparisons. |
I did binary diff between two consecutive (identical) builds of the kernel from master:
this is the result on unziped kernel images :
visual diff also shows lot of differences : there is two much difference and hard to pinpoint what is what (to skip over). @eriknordmark how did you performed the image comparison before? |
I also did a binary diff on two builds from master and two builds from IMHO, it makes sense to build the release versions in a secure environment and upload them to Github. |
The last option to enforce some policy on module loading is using the LoadPin LSM, to for example enforce loading of kernel modules only form RO rootfs, but EVE is not using something like dm-verity and root can remount the rootfs as RW. |
233fadc
to
955afda
Compare
@eriknordmark added the diff script. |
07425be
to
8da98ff
Compare
I will fix the complains once the script is reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you document the example usage and output from the rootfs-diff script (in the BUILD.md I assume)?
8da98ff
to
dcc9d5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some yetus issues (but ignore any ones about "ro" being a typo if you have those).
Enable build time module signing and enforce loading only signed modules at run-time. Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
dcc9d5e
to
a2bd471
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Enable build time module signing and enforce loading only signed modules at run-time.
I will send another PR for new-kernel.