From nobody Sun Feb 8 19:03:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 149337788000748.7599782138941; Fri, 28 Apr 2017 04:11:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 360AA804E2; Fri, 28 Apr 2017 11:11:18 +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 9817778352; Fri, 28 Apr 2017 11:11:17 +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 7187818523D2; Fri, 28 Apr 2017 11:11:15 +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 v3SBAYlp004445 for ; Fri, 28 Apr 2017 07:10:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 689809533B; Fri, 28 Apr 2017 11:10:34 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEBE078352; Fri, 28 Apr 2017 11:10:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 360AA804E2 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 360AA804E2 From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 28 Apr 2017 13:10:26 +0200 Message-Id: <088a8c610ea8efc92f01cb893390124bb7c60fce.1493377776.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 3/4] conf: Add support for modifying ssl validation for https/ftps disks 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 28 Apr 2017 11:11:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 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. --- docs/formatdomain.html.in | 9 +++++ docs/schemas/domaincommon.rng | 47 ++++++++++++++++++= +++- src/conf/domain_conf.c | 21 +++++++++- src/util/virstoragefile.h | 1 + .../generic-disk-network-http.xml | 9 +++++ 5 files changed, 84 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 03961fb4b..f3bf63d6c 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2288,6 +2288,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/> @@ -2628,6 +2629,14 @@ protocol. Supported for 'rbd' since 1.2.= 11 (QEMU only). +
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 3.3.0 +

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6367c059c..ef09fa831 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1556,12 +1556,37 @@ + + + + + + + + + + + + + + + https + + + + + + + + + + + http - https @@ -1569,6 +1594,23 @@ + + + + + + ftps + + + + + + + + + + + @@ -1576,7 +1618,6 @@ sheepdog iscsi ftp - ftps tftp @@ -1622,6 +1663,8 @@ + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c40a5a7a6..ec45d89b7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7591,6 +7591,20 @@ virDomainDiskSourceParse(xmlNodePtr node, if (virDomainStorageHostParse(node, &src->hosts, &src->nhosts) < 0) goto cleanup; + + if ((src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS || + src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_FTPS) && + (tmp =3D virXPathString("string(./ssl/@verify)", ctxt))) { + int verify; + if ((verify =3D virTristateBoolTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("invalid ssl verify mode '%s'"), tmp); + goto cleanup; + } + VIR_FREE(tmp); + + src->sslverify =3D verify; + } break; case VIR_STORAGE_TYPE_VOLUME: if (virDomainDiskSourcePoolDefParse(node, &src->srcpool) < 0) @@ -20788,7 +20802,8 @@ virDomainDiskSourceFormatNetwork(virBufferPtr buf, VIR_FREE(path); - if (src->nhosts =3D=3D 0 && !src->snapshot && !src->configFile) { + if (src->nhosts =3D=3D 0 && !src->snapshot && !src->configFile && + src->sslverify =3D=3D VIR_TRISTATE_BOOL_ABSENT) { virBufferAddLit(buf, "/>\n"); } else { virBufferAddLit(buf, ">\n"); @@ -20810,6 +20825,10 @@ virDomainDiskSourceFormatNetwork(virBufferPtr buf, virBufferEscapeString(buf, "\n", src->snaps= hot); virBufferEscapeString(buf, "\n", src->configF= ile); + if (src->sslverify !=3D VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(buf, "\n", + virTristateBoolTypeToString(src->sslverify)); + virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 9ebfc1108..e995b97fe 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -238,6 +238,7 @@ struct _virStorageSource { virStorageSourcePoolDefPtr srcpool; virStorageAuthDefPtr auth; virStorageEncryptionPtr encryption; + virTristateBool sslverify; char *driverName; int format; /* virStorageFileFormat in domain backing chains, but diff --git a/tests/genericxml2xmlindata/generic-disk-network-http.xml b/tes= ts/genericxml2xmlindata/generic-disk-network-http.xml index 51c779502..2448af727 100644 --- a/tests/genericxml2xmlindata/generic-disk-network-http.xml +++ b/tests/genericxml2xmlindata/generic-disk-network-http.xml @@ -25,6 +25,7 @@ + @@ -35,6 +36,14 @@ + + + + + + + + --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list