Skip to content

Allow adding custom certificates to the OVMF DB #2627

Description

@bensmrs

Is there an existing issue for this?

  • There is no existing issue for this feature

What are you currently unable to do

Importing certificates to the SecureBoot DB is a bit tedious, as one has to go through the OVMF UI and manually browse filesystems to find and import certificates.

What do you think would need to be added

It would be nice to have additional keys, security.secureboot.db and security.secureboot.dbx, that take a list of certificates to add to the DB and DBX.
The feature would need to rework the NVRAM initialization, although I’m not yet 100% sure of all the implications (and I’m not sure of the available Go tooling for that).

Activity

  1. added theissue type on Nov 7, 2025
  2. stgraber commented on Nov 7, 2025

    @stgraber
    Member

    If you can somehow implement it, it'd definitely be nice to have it but last I checked, the NVRAM format wasn't exactly the most trivial thing to interact with from Go :)

  3. bensmrs commented on Nov 7, 2025

    @bensmrs
    MemberAuthor

    Well at least I can try, you can assign me to it; I may have some time for that in the coming weeks.

  4. stgraber commented on Nov 7, 2025

    @stgraber
    Member

    I seem to remember $someone having a rough implementation of the NVRAM structures in python. No idea how good those were and if they actually work in all situations given EDK2 has various version of the NVRAM (2MB and 4MB if my memory serves).

  5. stgraber commented on Nov 7, 2025

    @stgraber
    Member
  6. bensmrs commented on Nov 7, 2025

    @bensmrs
    MemberAuthor

    Ah, we’re allowing 2M images in Incus?

  7. stgraber commented on Nov 7, 2025

    @stgraber
    Member

    We're trying to avoid them like the plague but we don't always control what a distro may be shipping :)

  8. bensmrs commented on Nov 7, 2025

    @bensmrs
    MemberAuthor

    Rethinking about it, also adding keys to edit the NVRAM in order to set EFI variables would be great (admittedly, for very niche use cases). If I’m writing an EDK2 NVRAM parser, I might as well exploit it at its full potential. EFI vars have a hierarchical structure (owner GUID or familiar name that translates to its GUID, then variable name) and I’m not completely sure how it should be encoded in Incus configuration format. Would something along the lines of:

    nvram.{8BE4DF61-93CA-11D2-AA0D-00E0-98032B8C}.Boot0080: base64_encoded_string

    or its equivalent:

    nvram.Efi.Boot0080: base64_encoded_string

    be good?

  9. stgraber commented on Nov 7, 2025

    @stgraber
    Member

    Given we should be in control of what key namespace is supported (as we're not on hardware with vendor specific extensions), the latter should be fine, though I'd probably want it to be EFI rather than Efi ;)

    I also don't know what's best between individual nvram.XYZ config keys VS a raw.efi_nvram type approach. The individual keys would come with the expectation that individual key changes would be applied without messing up the rest whereas the raw.XYZ approach would be more compatible with us just applying the whole thing again.

  10. added this to the soon milestone on Nov 9, 2025
  11. modified the milestones: soon, incus-7.3 on Jun 27, 2026
  12. bensmrs commented on Jul 2, 2026

    @bensmrs
    MemberAuthor

    So, planning to start on that one. Thinking again about it, setting UEFI vars in the config is a way to do it, but it can be quite costly at each boot to re-apply them all. I think some users (me included) may also be interested in one-shot commands to get (offline and I guess online could be doable) and set (offline) variables, and even dissect and edit ESL blocks. I was thinking about an incus nvram or incus config nvram command, but am happy to change its name.
    Anyway, I’m currently having a look on the OVMF VARS format.

  13. stgraber commented on Jul 2, 2026

    @stgraber
    Member

    We have an instance action/debug API these days for one time actions, so that may be an option?

  14. bensmrs commented on Jul 2, 2026

    @bensmrs
    MemberAuthor

    Are you suggesting that people should not be encouraged to edit the NVRAM themselves, thus making us hide the goodies behind incus debug? :)
    Fine by me, but semantically, I’d interpret a debug command to give me an info/get some value somewhere, not set a value. That’s one thing for raw EFI vars, but importing a db key feels like a more common interaction to me. Putting it behind incus debug nvram import-xxx doesn’t seem ok.
    Should I rather split incus debug nvram for pure efivars interaction, and incus config secureboot for signature list operations?

  15. bensmrs commented on Jul 3, 2026

    @bensmrs
    MemberAuthor

    I’m a bit concerned by the fact that the VM config needs to be mounted; is there already a place (except for incus init) where we do offline operations on VM config?

  16. stgraber commented on Jul 3, 2026

    @stgraber
    Member

    I’m a bit concerned by the fact that the VM config needs to be mounted; is there already a place (except for incus init) where we do offline operations on VM config?

    We should have a bunch of cases that trigger a refresh of backup.yaml in that config drive. I'd expect all offline config changes as well as changes to profiles to do that.

  17. stgraber commented on Jul 3, 2026

    @stgraber
    Member

    Are you suggesting that people should not be encouraged to edit the NVRAM themselves, thus making us hide the goodies behind incus debug? :)

    To be honest I'm liking the name incus debug less and less given the options we've got in there :)

    We currently have:

    • dump-memory
    • nbd

    Both of those have dedicated API endpoints.

    Then we have the repair multiplexer with rebuild-config-volume being the only supported action on that. That's not exposed to the CLI.

    For NVRAM, I'm not really sure what the best path forward is as I think we want:

    • Ability to query it
    • Ability to make changes to it
    • Ability to seed it in an image
    • Maybe ability to seed it in a profile?

    The last one is the tricky one as if we want to also have it in profiles, then that gets pretty tricky on how to handle applying changes only where they need to and leaving the rest alone.

    If we skip the profile stuff, then we'd likely be looking at a /1.0/instances/NAME/nvram endpoint, analogous to what we've done recently for nbd and bitmaps.

    Thinking myself through this one, I think the way we could address all of the above (minus profiles) is:

    • Rename incus debug to incus advanced (keep debug as an alias)
    • Add a bitmaps sub-command to incus advanced (API coverage)
    • Add a repair sub-command to incus advanced (API coverage)
    • Introduce a VM-specific /1.0/instances/NAME/nvram endpoint
    • Add a nvram sub-comamnd to incus advanced

    I think that should fix a bunch of the weirdness around incus debug, actually expose all those more advanced endpoints in the CLI and give us a good place to put the NVRAM mangling stuff.

    @bensmrs how does that sound?

  18. bensmrs commented on Jul 3, 2026

    @bensmrs
    MemberAuthor

    Sounds better indeed ;)
    Although, I dunno about you but “advanced” feels a tad pedantic to me… I’d prefer “internal” or “internals”, which convey the meaning that we want, minus the “I’m a big brain advanced user”. But I may be overthinking it :)

  19. stgraber commented on Jul 3, 2026

    @stgraber
    Member

    incus i-know-what-i-am-doing or incus i-wont-complain-if-i-break-something ;)

    I think I'd avoid internal because we have an actual internal API (/internal/XYZ) and that could make things a bit confusing.

  20. stgraber commented on Jul 3, 2026

    @stgraber
    Member

    incus low-level could work but I don't love the hyphen in a top-level command.

  21. irhndt commented on Jul 3, 2026

    @irhndt
    Contributor

    Hi, coming out of the blue but what do you think of :
    incus inspect ?

  22. stgraber commented on Jul 3, 2026

    @stgraber
    Member

    incus inspect doesn't really fit with nbd, nvram, bitmaps or repair, all of which cause changes to the instance. inspect suggests more of a read-only type of thing which is part of the issue with the current debug name.

  23. bensmrs commented on Jul 7, 2026

    @bensmrs
    MemberAuthor

    incus quirks

  24. bensmrs commented on Jul 29, 2026

    @bensmrs
    MemberAuthor

    Deferring to 7.4 as 7.3 will only ship the NVRAM primitives which turned out to require way more care than I expected. 7.4 will ship helpers to manipulate ESLs and properly handle authenticated variables.

  25. modified the milestones: incus-7.3, incus-7.4 on Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions