aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/233
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2022-03-04 19:36:08 +0000
committerEric Blake <eblake@redhat.com>2022-03-07 17:12:55 -0600
commit3da93d4bc6749d56349cd16340f07ca9825996ed (patch)
treef906608410dd7c4ea0180f623534c77e7057fb7e /tests/qemu-iotests/233
parentebc0141ba7e5d594ef9ea0efbf841e2e90edea7c (diff)
downloadqemu-3da93d4bc6749d56349cd16340f07ca9825996ed.zip
qemu-3da93d4bc6749d56349cd16340f07ca9825996ed.tar.gz
qemu-3da93d4bc6749d56349cd16340f07ca9825996ed.tar.bz2
tests/qemu-iotests: validate NBD TLS with hostname mismatch
This validates that connections to an NBD server where the certificate hostname does not match will fail. It further validates that using the new 'tls-hostname' override option can solve the failure. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20220304193610.3293146-11-berrange@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/233')
-rwxr-xr-xtests/qemu-iotests/23318
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
index 0502672..c24d877 100755
--- a/tests/qemu-iotests/233
+++ b/tests/qemu-iotests/233
@@ -107,6 +107,24 @@ $QEMU_NBD_PROG -L -b $nbd_tcp_addr -p $nbd_tcp_port --object $obj1 \
--tls-creds=tls0 2>&1 | _filter_qemu_nbd_exports
echo
+echo "== check TLS fail over TCP with mismatched hostname =="
+obj1=tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0
+$QEMU_IMG info --image-opts --object $obj1 \
+ driver=nbd,host=localhost,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | _filter_nbd
+$QEMU_NBD_PROG -L -b localhost -p $nbd_tcp_port --object $obj1 \
+ --tls-creds=tls0 | _filter_qemu_nbd_exports
+
+echo
+echo "== check TLS works over TCP with mismatched hostname and override =="
+obj1=tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0
+$QEMU_IMG info --image-opts --object $obj1 \
+ driver=nbd,host=localhost,port=$nbd_tcp_port,tls-creds=tls0,tls-hostname=127.0.0.1 \
+ 2>&1 | _filter_nbd
+$QEMU_NBD_PROG -L -b localhost -p $nbd_tcp_port --object $obj1 \
+ --tls-creds=tls0 --tls-hostname=127.0.0.1 | _filter_qemu_nbd_exports
+
+echo
echo "== check TLS with different CA fails =="
obj=tls-creds-x509,dir=${tls_dir}/client2,endpoint=client,id=tls0
$QEMU_IMG info --image-opts --object $obj \