From nobody Mon Feb 9 00:30:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583771048; cv=none; d=zohomail.com; s=zohoarc; b=mixerO7uBKs+ww6k/aNVSrIpoIwgPFjttrqOtyMWwDDtg1FRfQBQxSpEkQVY9feu2nqx4mYIJgBSN3L3+aN3r2NGjroefo6AUJzWy35w7gvNoBc3VASzT/TC7H3kw08whcKsfZv9tkzXRpZ96aKRh4pOardfCRfk4kZhSFHDAhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583771048; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sSouqRTlbV8LCyYLsksIlf0+J6y9ddayb2yiyxvSfCQ=; b=RaOssad2tmMnkSLNhCAQwS0p2nfpcGpK2VigiqBFyxDHv9NFvY+b6g1d3bl4FHgxZmeyQon8LHuHuOc9KyxOMEn3UbkpenHUlg17Ubi52g0rUrxcKRu/701H9fU5VF4SSJ//8OWnsPGFAQOVTUKAfcGJXpzsnzy9vFJzJnoxAtw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583771048287174.91888104684904; Mon, 9 Mar 2020 09:24:08 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-89-vdY0sJV-NsuGFNlBTtrkrQ-1; Mon, 09 Mar 2020 12:24:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65E29DB61; Mon, 9 Mar 2020 16:23:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3903973890; Mon, 9 Mar 2020 16:23:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CFE7B1803C41; Mon, 9 Mar 2020 16:23:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 029GNPhX020796 for ; Mon, 9 Mar 2020 12:23:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8B43990779; Mon, 9 Mar 2020 16:23:25 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1225C9051C for ; Mon, 9 Mar 2020 16:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583771047; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=sSouqRTlbV8LCyYLsksIlf0+J6y9ddayb2yiyxvSfCQ=; b=FDjzhf6xxB/q8E6XGsBmzAlBi9s8i7YKfprryONLac1FJiOYvADhYdwPw718+wRmm2E0UQ 6uCmIvLHQ12aZLEXCJJKww3wY4sdBk44s2vUx18b1g7Dhvz70m0Xu+y/r5wLTw3nweTcA1 QsFzXPyqjscRUeyl3O3ndI/ONEQ4neg= X-MC-Unique: vdY0sJV-NsuGFNlBTtrkrQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/30] conf: Add support for modifying ssl validation for https/ftps disks Date: Mon, 9 Mar 2020 17:22:53 +0100 Message-Id: <58ba4825594a296a516c38bfa5c97227e3e119cf.1583770683.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To allow turning of verification of SSL cerificates add a new element to the disk source XML which will allow configuring the validation process using the 'verify' attribute. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/formatdomain.html.in | 9 ++++ docs/schemas/domaincommon.rng | 51 ++++++++++++++++++- src/conf/domain_conf.c | 18 +++++++ src/util/virstoragefile.c | 1 + src/util/virstoragefile.h | 1 + .../disk-network-http.xml | 9 ++++ 6 files changed, 87 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 7e7771725c..8f503f6967 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2857,6 +2857,7 @@ <driver name=3D'qemu' type=3D'raw'/> <source protocol=3D"https" name=3D"url_path"> <host name=3D"hostname" port=3D"443"/> + <ssl verify=3D"no"/> </source> <target dev=3D'hdf' bus=3D'ide' tray=3D'open'/> <readonly/> @@ -3383,6 +3384,14 @@ The offset and size values are in by= tes. Since 6.1.0 +
ssl
+
+ For https and ftps accessed storage = it's + possible to tweak the SSL transport parameters with this eleme= nt. + The verify attribute allows to turn on or of SSL + certificate validation. Supported values are yes = and + no. Since 6.1.0 +

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 529a98fc05..d179a25ee6 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1808,12 +1808,39 @@ + + + + + + + + + + + + + + https + + + + + + + + + + + + + + http - https @@ -1825,13 +1852,31 @@ + + + + + ftps + + + + + + + + + + + + + + sheepdog ftp - ftps tftp @@ -1909,6 +1954,8 @@ + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d8471acd2d..dd3a3a1439 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9350,6 +9350,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, g_autofree char *protocol =3D NULL; g_autofree char *haveTLS =3D NULL; g_autofree char *tlsCfg =3D NULL; + g_autofree char *sslverifystr =3D NULL; if (!(protocol =3D virXMLPropString(node, "protocol"))) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -9422,6 +9423,19 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, virStorageSourceInitiatorParseXML(ctxt, &src->initiator); + if ((src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_FTPS) && + (sslverifystr =3D virXPathString("string(./ssl/@verify)", ctxt))) { + int verify; + if ((verify =3D virTristateBoolTypeFromString(sslverifystr)) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("invalid ssl verify mode '%s'"), sslverifystr= ); + return -1; + } + + src->sslverify =3D verify; + } + return 0; } @@ -24531,6 +24545,10 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attr= Buf, virStorageSourceInitiatorFormatXML(&src->initiator, childBuf); + if (src->sslverify !=3D VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(childBuf, "\n", + virTristateBoolTypeToString(src->sslverify)); + return 0; } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index b133cf17f1..ca91fc65ba 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2270,6 +2270,7 @@ virStorageSourceCopy(const virStorageSource *src, def->cachemode =3D src->cachemode; def->discard =3D src->discard; def->detect_zeroes =3D src->detect_zeroes; + def->sslverify =3D src->sslverify; /* storage driver metadata are not copied */ def->drv =3D NULL; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 9af7b4f226..49718b51d8 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -281,6 +281,7 @@ struct _virStorageSource { virStorageEncryptionPtr encryption; bool encryptionInherited; virStoragePRDefPtr pr; + virTristateBool sslverify; virStorageSourceNVMeDefPtr nvme; /* type =3D=3D VIR_STORAGE_TYPE_NVME = */ diff --git a/tests/genericxml2xmlindata/disk-network-http.xml b/tests/gener= icxml2xmlindata/disk-network-http.xml index fde1222fd0..bdcc1977f2 100644 --- a/tests/genericxml2xmlindata/disk-network-http.xml +++ b/tests/genericxml2xmlindata/disk-network-http.xml @@ -25,6 +25,7 @@ + @@ -35,6 +36,14 @@ + + + + + + + + --=20 2.24.1