All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Hannes Reinecke <hare@suse.de>, Sagi Grimberg <sagi@grimberg.me>
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <keith.busch@wdc.com>,
	Omar Sandoval <osandov@fb.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH 04/10] nvme/rc: add functions for in-band authentication
Date: Mon, 13 Dec 2021 22:50:38 +0000	[thread overview]
Message-ID: <370e4204-0b1d-b402-c0b8-b3d44f774176@nvidia.com> (raw)
In-Reply-To: <20211123074940.113390-5-hare@suse.de>

On 11/22/21 11:49 PM, Hannes Reinecke wrote:
> Add functions to enable in-band authentication.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

> ---
>   tests/nvme/rc | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 73 insertions(+)
> 
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index c284602..6e08b41 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -73,6 +73,17 @@ _require_nvme_trtype_is_fabrics() {
>   	return 0
>   }
>   
> +_require_nvme_cli_auth() {
> +	local hostkey
> +
> +	hostkey="$(nvme gen-dhchap-key -n nvmf-test-subsys 2> /dev/null)"
> +	if [ $? -ne 0 ] ; then
> +		SKIP_REASON="nvme gen-dhchap-key command missing"
> +		return 1
> +	fi
> +	return 0
> +}
> +
>   _test_dev_nvme_ctrl() {
>   	echo "/dev/char/$(cat "${TEST_DEV_SYSFS}/device/dev")"
>   }
> @@ -253,6 +264,25 @@ _create_nvmet_subsystem() {
>   	_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
>   }
>   
> +_create_nvmet_host() {
> +	local nvmet_subsystem="$1"
> +	local nvmet_hostnqn="$2"
> +	local nvmet_hostkey="$3"
> +	local nvmet_ctrlkey="$4"
> +	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
> +	local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
> +
> +	mkdir "${host_path}"

perhaps check return value of above mkdir and abort early ?

> +	echo 0 > "${cfs_path}/attr_allow_any_host"
> +	ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}"
> +	if [[ "${nvmet_hostkey}" ]] ; then
> +		echo "${nvmet_hostkey}" > "${host_path}/dhchap_key"
> +	fi
> +	if [[ "${nvmet_ctrlkey}" ]] ; then
> +		echo "${nvmet_ctrlkey}" > "${host_path}/dhchap_ctrl_key"
> +	fi
> +}
> +
>   _remove_nvmet_ns() {
>   	local nvmet_subsystem="$1"
>   	local nsid=$2
> @@ -272,6 +302,13 @@ _remove_nvmet_subsystem() {
>   	rmdir "${subsys_path}"
>   }
>   
> +_remove_nvmet_host() {
> +	local nvmet_host="$1"
> +	local host_path="${NVMET_CFS}/hosts/${nvmet_host}"
> +
> +	rmdir "${host_path}"
> +}
> +
>   _create_nvmet_passthru() {
>   	local nvmet_subsystem="$1"
>   	local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
> @@ -308,6 +345,42 @@ _remove_nvmet_subsystem_from_port() {
>   	rm "${NVMET_CFS}/ports/${port}/subsystems/${nvmet_subsystem}"
>   }
>   
> +_set_nvmet_hostkey() {
> +	local nvmet_hostnqn="$1"
> +	local nvmet_hostkey="$2"
> +	local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
> +
> +	echo "${nvmet_hostkey}" > \
> +	     "${cfs_path}/dhchap_key"
> +}
> +
> +_set_nvmet_ctrlkey() {
> +	local nvmet_hostnqn="$1"
> +	local nvmet_ctrlkey="$2"
> +	local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
> +
> +	echo "${nvmet_ctrlkey}" > \
> +	     "${cfs_path}/dhchap_ctrl_key"
> +}
> +
> +_set_nvmet_hash() {
> +	local nvmet_hostnqn="$1"
> +	local nvmet_hash="$2"
> +	local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
> +
> +	echo "${nvmet_hash}" > \
> +	     "${cfs_path}/dhchap_hash"
> +}
> +
> +_set_nvmet_dhgroup() {
> +	local nvmet_hostnqn="$1"
> +	local nvmet_dhgroup="$2"
> +	local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
> +
> +	echo "${nvmet_dhgroup}" > \
> +	     "${cfs_path}/dhchap_dhgroup"
> +}
> +
>   _find_nvme_dev() {
>   	local subsys=$1
>   	local subsysnqn
> 


  reply	other threads:[~2021-12-13 22:55 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23  7:49 [PATCHv3 blktests 00/10] Testsuite for nvme in-band authentication Hannes Reinecke
2021-11-23  7:49 ` [PATCH 01/10] nvme/rc: do not print error message when no nvme device is found Hannes Reinecke
2021-12-13 22:43   ` Chaitanya Kulkarni
2021-11-23  7:49 ` [PATCH 02/10] nvme/rc: clear allowed_hosts subdirectory Hannes Reinecke
2021-12-13 22:44   ` Chaitanya Kulkarni
2021-11-23  7:49 ` [PATCH 03/10] nvme/rc: clear hosts directory in _cleanup_nvmet() Hannes Reinecke
2021-12-13 22:45   ` Chaitanya Kulkarni
2021-11-23  7:49 ` [PATCH 04/10] nvme/rc: add functions for in-band authentication Hannes Reinecke
2021-12-13 22:50   ` Chaitanya Kulkarni [this message]
2021-11-23  7:49 ` [PATCH 05/10] nvme/rc: add more arguments to _nvme_connect_subsys() Hannes Reinecke
2021-12-13 22:51   ` Chaitanya Kulkarni
2021-11-23  7:49 ` [PATCH 06/10] nvme/039: create authenticated connections Hannes Reinecke
2021-12-13 22:55   ` Chaitanya Kulkarni
2021-12-14  7:09     ` Hannes Reinecke
2021-12-13 23:01   ` Chaitanya Kulkarni
2021-12-14  7:16     ` Hannes Reinecke
2021-12-14  7:36       ` Chaitanya Kulkarni
2021-12-13 23:03   ` Chaitanya Kulkarni
2021-11-23  7:49 ` [PATCH 07/10] nvme/040: test dhchap key types for " Hannes Reinecke
2021-11-23  7:49 ` [PATCH 08/10] nvme/041: test hash and dh group variations " Hannes Reinecke
2021-11-23  7:49 ` [PATCH 09/10] nvme/042: test bi-directional authentication Hannes Reinecke
2021-11-28 13:36   ` Sagi Grimberg
2021-11-28 17:34     ` Hannes Reinecke
2021-12-08 13:09       ` Sagi Grimberg
2021-12-10 12:06         ` Hannes Reinecke
2021-12-12  9:53           ` Sagi Grimberg
2021-12-12 12:38             ` Hannes Reinecke
2022-03-28 11:20               ` Sagi Grimberg
2022-03-28 12:02                 ` Hannes Reinecke
2022-03-28 13:29                   ` Hannes Reinecke
2021-11-23  7:49 ` [PATCH 10/10] nvme/043: test re-authentication Hannes Reinecke
2022-06-05 23:58 ` [PATCHv3 blktests 00/10] Testsuite for nvme in-band authentication Chaitanya Kulkarni
2022-06-06  0:36   ` Chaitanya Kulkarni
2022-03-28 10:18 [PATCHv4 " Hannes Reinecke
2022-03-28 10:18 ` [PATCH 04/10] nvme/rc: add functions for " Hannes Reinecke
2022-06-10 11:33 [PATCHv5 blktests 00/10] Testsuite for nvme " Hannes Reinecke
2022-06-10 11:33 ` [PATCH 04/10] nvme/rc: add functions for " Hannes Reinecke

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=370e4204-0b1d-b402-c0b8-b3d44f774176@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=osandov@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.