-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add export-enrolled-keys command #303
Conversation
We already have Would |
I may be missing something but the use case of the new command is to export the build-in certificates from brand new hardware. I thought that maybe a combination of flags of the
I could try setting Kairos specific background for better understandingTo make it even more clear, this is our full user scenario:
The above is an one-off procedure. As soon as the Kairos OS has been prepared, any machine booting that OS in setup mode, will automatically get the same certificates enrolled. This allows the user to prepare thousands of machines with less effort. We already have tooling that will prepare the OS and the input to that is the set of keys to sign the efi file but also the keys to enroll automatically when the system boots. So, what we need from sbctl is to allow the user to prepare such a set of keys in an easy way. The process I had in mind was:
the result of the above will be fed to the |
It seems that sbctl can do all things already for us except maybe exporting the builtin keys to be used later on another machine to prepare the rest of the keys. We are investigating here: kairos-io/enki#91 @nianyush will give it a try with |
I suspect the code paths is a bit non-obvious which is why the optionrom check is being triggered. I think we should be able to move things around for this to work properly :) If this doesn't work at all or becomes too confusing I'm totes open for the original idea of having a new command. |
i can confirm that these two commands works for me to generate the auth/esl file.
Although in qemu vm, -f option didnt work for me. It seems my qemu vm is missing dbDefault efivar. However, i can still achieve my goal with -a since i have my factory keys already enrolled in the system.
|
Cool, so we can fix the UX here to make it better and easier to work with then introducing a new command :) |
Yes, and one more command i think it might be helpful is to export auth/esl from enrolled keys in the system directly. Because currently |
it would be similar to
|
You mean like the command introduced in this PR? I'm confused now :D |
@jimmykarily --export works if you have your custom keys imported using sbctl import-keys. But if you dont have keys created/imported by sbctl. It would fail
|
@nianyush so the desired command would simply export the enrolled keys without importing anything first. If you check this PR code, that's exactly what it does (exports the "der" version but that we can change or make configurable). So what I'm trying to understand is whether the command introduced in this PR is still needed or not. |
Then the answer would probably be yes for me:) @jimmykarily |
49c192b
to
337f7c0
Compare
6706bfa
to
b593893
Compare
b593893
to
af2f4da
Compare
af2f4da
to
995874c
Compare
I've added a couple of tests and added a flag for the export format ("der" or "esl"). @Foxboron if you prefer this functionality to be implemented by the |
I agree that lumping this up with |
tests/integrations/export_enrolled_keys/export_enrolled_keys_test.go
Outdated
Show resolved
Hide resolved
tests/integrations/export_enrolled_keys/export_enrolled_keys_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
379066c
to
a97104c
Compare
Squashed commits |
Thanks! |
This PR introduces an
export-enrolled-keys
command that allows the user to export the already enrolled keys to a directory for backup reasons (e.g. before making any changes on new hardware) and to prepare a directory that can be used as a "custom certs" when enrolling keys.User scenario:
This PR is only one of the things needed to implement the above scenario. Currently the export directory structure is the one expected by the
enroll-keys
command but the location is arbitrary. The user would have to copy the directory to the appropriate location (the db directory) in order to be read by the "enroll-keys" command.In my opinion, it's the
enroll-keys
command that should be changed to be more flexible and read keys from arbitrary locations but this can be discussed on another ticket/PR.Note: I would have written a test for this but waiting for this refactoring first: #302
I'm opening this draft PR to collect some early feedback, until I can write the tests.