From nobody Fri Apr 19 21:38:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=protonmail.com ARC-Seal: i=1; a=rsa-sha256; t=1617804575; cv=none; d=zohomail.com; s=zohoarc; b=Llc8n6/8kQ0Yd4uQym8B2u9vrIIgYy/BWoSZ1KTjcdYbe9cjO2u1yyBYm2c9W9GIJhcpdDAbGto0+c3zGf/tIbtEjlhApaiwt1WBKJw8XheARuzeMnpMDu9Xi79i8tlApAJr0tttePt8znLPN6x2ttHuSahakQClFzLIwcC0E68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617804575; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=BJkOwMdALmm5/enar0Mz3MV0tWrPP7NXKE+u5Y3AO4k=; b=kISJcnS1dtI6w4mkwLMOl7BfstXMYH5oGWHj8QPOWsu7ao/AuAcBF8uBTdWALGok64S4CCveuOQttcugRJPGZddOlUTGdJhg9zxWKbB6YzrVJbXEq4Vz336BenHtM1qWyO+SUz8XWL0xkxWlRbwXkoIhI3ZMRO6lATPZhYftQcA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1617804575091255.4218562638829; Wed, 7 Apr 2021 07:09:35 -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-21-OQmRTM-mPum8tWYiqYowmA-1; Wed, 07 Apr 2021 10:09:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 21B4C18B6159; Wed, 7 Apr 2021 14:09:09 +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 8798919C46; Wed, 7 Apr 2021 14:09:08 +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 496031806D06; Wed, 7 Apr 2021 14:09:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 137E8niV024918 for ; Wed, 7 Apr 2021 10:08:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id C39AB2026D6A; Wed, 7 Apr 2021 14:08:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BECB22026D64 for ; Wed, 7 Apr 2021 14:08:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D93D885A5B5 for ; Wed, 7 Apr 2021 14:08:46 +0000 (UTC) Received: from mail-41103.protonmail.ch (mail-41103.protonmail.ch [185.70.41.103]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-454-HA9RVMn9Pvm26A1C1rganQ-1; Wed, 07 Apr 2021 10:08:44 -0400 Received: from mail-02.mail-europe.com (mail-02.mail-europe.com [51.89.119.103]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by mail-41103.protonmail.ch (Postfix) with ESMTPS id 4FFmLZ5QK0z4x060 for ; Wed, 7 Apr 2021 14:02:46 +0000 (UTC) X-MC-Unique: OQmRTM-mPum8tWYiqYowmA-1 X-MC-Unique: HA9RVMn9Pvm26A1C1rganQ-1 Date: Wed, 07 Apr 2021 13:52:04 +0000 To: "libvir-list@redhat.com" From: simonmartin76 Subject: [PATCH] add the ability to disable transport authentication (like esxi et al) Message-ID: <34NrS1SwQw4RnBjrliTqAntM28AHxeDreDW7SpFc6JiYOZEkH6308872WbeUUW5USlkun7_WrPGZ2Sa8vG8fMQg_Qlzn5X8T-OETPX_GwVk=@protonmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLYTO_END_DIGIT shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 137E8niV024918 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: simonmartin76 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Simon Martin --- src/hyperv/hyperv_driver.c | 5 +++++ src/hyperv/hyperv_util.c | 11 +++++++++++ src/hyperv/hyperv_util.h | 1 + 3 files changed, 17 insertions(+) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 17f5be1f0d..67e6e09f2d 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1728,6 +1728,11 @@ hypervInitConnection(virConnectPtr conn, hypervPriva= te *priv, /* FIXME: Currently only basic authentication is supported */ wsman_transport_set_auth_method(priv->client, "basic"); + if (priv->parsedUri->noVerify) { + wsman_transport_set_verify_peer(priv->client, 0); + wsman_transport_set_verify_host(priv->client, 0); + } + return 0; } diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c index d8a6e6cf5c..40e1540dfe 100644 --- a/src/hyperv/hyperv_util.c +++ b/src/hyperv/hyperv_util.c @@ -38,6 +38,7 @@ int hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri) { int result =3D -1; + int noVerify; size_t i; if (parsedUri =3D=3D NULL || *parsedUri !=3D NULL) { @@ -63,6 +64,16 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr ur= i) (*parsedUri)->transport); goto cleanup; } + } else if (STRCASEEQ(queryParam->name, "no_verify")) { + if (virStrToLong_i(queryParam->value, NULL, 10, &noVerify) < 0= || + (noVerify !=3D 0 && noVerify !=3D 1)) { + virReportError(VIR_ERR_INVALID_ARG, + _("Query parameter 'no_verify' has unexpect= ed value " + "'%s' (should be 0 or 1)"), queryParam->v= alue); + goto cleanup; + } + + (*parsedUri)->noVerify =3D noVerify !=3D 0; } else { VIR_WARN("Ignoring unexpected query parameter '%s'", queryParam->name); diff --git a/src/hyperv/hyperv_util.h b/src/hyperv/hyperv_util.h index 67d698450d..a0604d6830 100644 --- a/src/hyperv/hyperv_util.h +++ b/src/hyperv/hyperv_util.h @@ -28,6 +28,7 @@ typedef struct _hypervParsedUri hypervParsedUri; struct _hypervParsedUri { char *transport; + bool noVerify; }; int hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri); -- 2.17.1 Sent with ProtonMail Secure Email.