[PATCH v6 0/9] nvme-auth: switch to use the kernel keyring
Hannes Reinecke
hare at suse.de
Wed Nov 25 07:43:32 PST 2026
Hey Martin,
On 11/25/26 1:18 PM, Martin Belanger wrote:
>
>
> On 11/25/26 02:26, Hannes Reinecke wrote:
>> And the other problem with your approach is that DH-CHAP
>> key don't actually have 'names'; they are just binary blobs.
>> If we want to refer to them by name we first would need to
>> agree on what the name actually _is_.
>>
>> What we could do is to store the key serial in struct
>> nvmf_ctrl_options; that would allow keysd to provision
>> the keys and rotate them via 'keyctl update' (or whatever
>> it's doing internally). And would get away from the
>> business of having to come up with a name for the key.
>
> Yes, a key serial works for me. The kernel then needs no name for
> the key. The key description stays a userspace matter:
>
> - The admin names each secret in the configuration: the connection
> configuration of nvme-cli or nvme-discoverd refers to the secret by
> that name, and nvme-keysd's configuration (or the KMIP server) holds
> the secret under the same name.
> - At boot, nvme-keysd adds each secret to the keyring with
> add_key("dhchap", <name>, ...). The name becomes the key
> description.
> - At connect, libnvme takes the name from the connection
> configuration, looks up the serial with keyctl_search() and passes
> the serial to the kernel, as tls_key= does for TLS. libnvme already
> does this lookup today, to check that the key exists before the
> connect.
>
> For rotation, the serial must stay the same when the secret changes,
> so that a connected controller uses the new secret at its next
> authentication. For this, v7 needs an .update operation in the
> dhchap key type (user_update() should do). nvme-keysd then rotates a
> secret with add_key() under the same description, which replaces the
> payload of the existing key. nvme-keysd does not need to know which
> controllers use the key, and no sysfs or configfs write is needed.
>
Okay, good point. Will be doing that.
> For the sysfs and configfs attributes:
>
> - For a key from the keyring, a read returns the key serial, as
> tls_key and tls_configured_key do. The serial names the key the
> controller uses. The description is available with keyctl describe.
> - A write of a serial is rejected. The serial is set at connect, and
> after that the keyring is the only way to change the secret. I do
> not want a second way to change a key: a writable serial would be
> one, and it would let a write point the controller at any dhchap
> key on the system.
> - A write of a raw secret (DHHC-1:...) keeps the current behavior,
> because existing tools use it.
>
> The same applies to dhchap_key and dhchap_ctrl_key in nvmet configfs.
>
Okay, I see to get this included for the next round.
I will also move keyring handling towards linking any additional keyring
into the .nvme keyring for in-kernel usage. That will get us away from
the problem of not being able to access users-specified keyrings, and
also makes the internal interfaces easier.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare at suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
More information about the Linux-nvme
mailing list