From nobody Mon Feb 9 01:00:52 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 1493312839535208.29635439336323; Thu, 27 Apr 2017 10:07:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 14E80C04BD40; Thu, 27 Apr 2017 17:07: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 DDB1084964; Thu, 27 Apr 2017 17:07: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 8F52118523D2; Thu, 27 Apr 2017 17:07:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3RH4WUx028583 for ; Thu, 27 Apr 2017 13:04:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id A5F668275B; Thu, 27 Apr 2017 17:04:32 +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 DE514171A2; Thu, 27 Apr 2017 17:04:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 14E80C04BD40 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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 14E80C04BD40 From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 27 Apr 2017 19:04:25 +0200 Message-Id: <502be3df0445b9d722aa16a4642b14591b9d6d92.1493312426.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/3] qemu: command: Implement ssl verification configuration 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 27 Apr 2017 17:07:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Allow disabling of SSL certificate validation for HTTPS and FTPS drives in qemu. --- src/qemu/qemu_command.c | 27 ++++++++++++++++++= ++-- .../qemuxml2argv-disk-drive-network-http.args | 2 +- .../qemuxml2argv-disk-drive-network-http.xml | 1 + 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 980559859..a54b48eaf 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1537,14 +1537,37 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: case VIR_STORAGE_NET_PROTOCOL_ISCSI: case VIR_STORAGE_NET_PROTOCOL_FTP: - case VIR_STORAGE_NET_PROTOCOL_FTPS: case VIR_STORAGE_NET_PROTOCOL_TFTP: case VIR_STORAGE_NET_PROTOCOL_SSH: case VIR_STORAGE_NET_PROTOCOL_LAST: break; - case VIR_STORAGE_NET_PROTOCOL_HTTP: + case VIR_STORAGE_NET_PROTOCOL_FTPS: + if (disk->src->sslverify !=3D 0) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCK_CURL_OPTIONS= )) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this qemu does not support ssl optio= ns")); + goto cleanup; + } + + virBufferAsprintf(buf, "file.sslverify=3D%s,", + virTristateSwitchTypeToString(disk->src-= >sslverify)); + } + break; + case VIR_STORAGE_NET_PROTOCOL_HTTPS: + if (disk->src->sslverify !=3D 0) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCK_CURL_OPTIONS= )) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this qemu does not support ssl optio= ns")); + goto cleanup; + } + + virBufferAsprintf(buf, "file.sslverify=3D%s,", + virTristateSwitchTypeToString(disk->src-= >sslverify)); + } + /* fallthrough */ + case VIR_STORAGE_NET_PROTOCOL_HTTP: if (disk->src->ncookies > 0) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCK_CURL_OPTIONS= )) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.ar= gs b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.args index fb4a3506f..e1bfd42a8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.args @@ -30,7 +30,7 @@ file.cookie=3Dtest=3Dtestcookievalue; test2=3Dblurb,forma= t=3Draw,if=3Dnone,\ id=3Ddrive-virtio-disk2' \ -device virtio-blk-pci,bus=3Dpci.0,addr=3D0x5,drive=3Ddrive-virtio-disk2,\ id=3Dvirtio-disk2 \ --drive 'file=3Dhttps://example.org:1234/test4.img,\ +-drive 'file=3Dhttps://example.org:1234/test4.img,file.sslverify=3Doff,\ file.cookie=3Dtest=3Dtestcookievalue; test2=3Dblurb,format=3Draw,if=3Dnone= ,\ id=3Ddrive-virtio-disk3' \ -device virtio-blk-pci,bus=3Dpci.0,addr=3D0x6,drive=3Ddrive-virtio-disk3,\ diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xm= l b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xml index c5da23604..114480024 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-http.xml @@ -47,6 +47,7 @@ testcookievalue blurb + --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list