mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Martin Belanger <martin.nvme.dev@gmail.com>,
	Eric Biggers <ebiggers@kernel.org>
Cc: Hannes Reinecke <hare@kernel.org>,
	Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	keyrings@vger.kernel.org
Subject: Re: [PATCH v6 0/9] nvme-auth: switch to use the kernel keyring
Date: Wed, 25 Nov 2026 16:43:32 +0100	[thread overview]
Message-ID: <18f90b98-470e-4693-bf28-64d7cf3df078@suse.de> (raw)
In-Reply-To: <a71a3d9f-0f19-45f4-bc98-a5663ad537b2@gmail.com>

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@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

      reply	other threads:[~2026-11-25 15:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:10 Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 1/9] nvme-auth: modify nvme_auth_transform_key() to return status Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 2/9] nvme-keyring: add 'dhchap' key type Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 3/9] nvme-auth: switch to use 'struct key' Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 4/9] nvme: parse dhchap keys during option parsing Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 5/9] nvmet-auth: parse dhchap key from configfs attribute Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 6/9] nvme: allow to pass in key description as dhchap secret Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 7/9] nvme-auth: wait for authentication to finish when changing keys Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 8/9] nvme-fabrics: allow to pass in keyring by name Hannes Reinecke
2026-11-23 17:10 ` [PATCH v6 9/9] nvmet: add configfs attribute 'dhchap_keyring' Hannes Reinecke
2026-11-23 21:21 ` [PATCH v6 0/9] nvme-auth: switch to use the kernel keyring Eric Biggers
2026-11-24 10:30   ` Hannes Reinecke
2026-11-24 20:11     ` Eric Biggers
2026-11-24 20:50       ` Martin Belanger
2026-11-24 21:32         ` Eric Biggers
2026-11-24 22:13           ` Martin Belanger
2026-11-25  7:26             ` Hannes Reinecke
2026-11-25 12:18               ` Martin Belanger
2026-11-25 15:43                 ` Hannes Reinecke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18f90b98-470e-4693-bf28-64d7cf3df078@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=ebiggers@kernel.org \
    --cc=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.nvme.dev@gmail.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®