From 38d7c5e8400f2095108f5aec7a88d61816d6854c Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Thu, 30 Sep 2021 15:52:36 +0200 Subject: [PATCH] nvme/043: test hash and dh group variations for authenticated connections Signed-off-by: Hannes Reinecke --- tests/nvme/043 | 92 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/043.out | 18 +++++++++ 2 files changed, 110 insertions(+) create mode 100755 tests/nvme/043 create mode 100644 tests/nvme/043.out diff --git a/tests/nvme/043 b/tests/nvme/043 new file mode 100755 index 0000000..381ae75 --- /dev/null +++ b/tests/nvme/043 @@ -0,0 +1,92 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2022 Hannes Reinecke, SUSE Labs +# +# Test hash and dh group variations for authenticated connections + +. tests/nvme/rc + +DESCRIPTION="Test hash and DH group variations for authenticated connections" +QUICK=1 + +requires() { + _nvme_requires + _have_loop + _have_kernel_option NVME_AUTH + _have_kernel_option NVME_TARGET_AUTH + _require_nvme_trtype_is_fabrics + _require_nvme_cli_auth +} + + +test() { + local port + local subsys_name="blktests-subsystem-1" + local hostid + local hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + local file_path="${TMPDIR}/img" + local hash + local dhgroup + local hostkey + local ctrldev + + echo "Running ${TEST_NAME}" + + hostid="$(uuidgen)" + if [ -z "$hostid" ] ; then + echo "uuidgen failed" + return 1 + fi + + _setup_nvmet + + truncate -s 512M "${file_path}" + + _create_nvmet_subsystem "${subsys_name}" "${file_path}" + port="$(_create_nvmet_port "${nvme_trtype}")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}" + + for hash in "hmac(sha256)" "hmac(sha384)" "hmac(sha512)" ; do + + echo "Testing hash ${hash}" + + _set_nvmet_hash "${hostnqn}" "${hash}" + + _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + "${def_traddr}" "${def_trsvcid}" \ + "${hostnqn}" "${hostid}" \ + "${hostkey}" + + udevadm settle + + _nvme_disconnect_subsys "${subsys_name}" + done + + for dhgroup in "ffdhe2048" "ffdhe3072" "ffdhe4096" "ffdhe6144" "ffdhe8192" ; do + + echo "Testing DH group ${dhgroup}" + + _set_nvmet_dhgroup "${hostnqn}" "${dhgroup}" + + _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + "${def_traddr}" "${def_trsvcid}" \ + "${hostnqn}" "${hostid}" \ + "${hostkey}" + + udevadm settle + + _nvme_disconnect_subsys "${subsys_name}" + done + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem "${subsys_name}" + + _remove_nvmet_port "${port}" + + _remove_nvmet_host "${hostnqn}" + + rm "${file_path}" + + echo "Test complete" +} diff --git a/tests/nvme/043.out b/tests/nvme/043.out new file mode 100644 index 0000000..7419f91 --- /dev/null +++ b/tests/nvme/043.out @@ -0,0 +1,18 @@ +Running nvme/043 +Testing hash hmac(sha256) +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Testing hash hmac(sha384) +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Testing hash hmac(sha512) +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Testing DH group ffdhe2048 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Testing DH group ffdhe3072 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Testing DH group ffdhe4096 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Testing DH group ffdhe6144 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Testing DH group ffdhe8192 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete -- 2.49.0