From nobody Thu May 2 10:04:31 2024 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.zohomail.com; dkim=fail; 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 1513582167995161.38736061795498; Sun, 17 Dec 2017 23:29:27 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 8AC0561473; Mon, 18 Dec 2017 07:29:25 +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 1A14E69400; Mon, 18 Dec 2017 07:29:24 +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 BBA4D180474A; Mon, 18 Dec 2017 07:29: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 vBI7TGG6023974 for ; Mon, 18 Dec 2017 02:29:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 950DB66D35; Mon, 18 Dec 2017 07:29:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CF695C8A5 for ; Mon, 18 Dec 2017 07:29:14 +0000 (UTC) Received: from m15-114.126.com (m15-114.126.com [220.181.15.114]) by mx1.redhat.com (Postfix) with ESMTP id 8A32C4A6FA for ; Mon, 18 Dec 2017 07:29:12 +0000 (UTC) Received: from localhost.localdomain (unknown [58.213.111.46]) by smtp7 (Coremail) with SMTP id DsmowABXNh42bjdaLJEgAw--.55748S2; Mon, 18 Dec 2017 15:29:10 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=Rd4fIoSG3sCZQHl0u5 Ckm/1F0+jaG/GjgmZBKjGJZ+s=; b=IvzKxNJvIMcwaduRIQL25c3vqwb0Exiu4Q 9PmFH2sSmUXwv/gqqfuY5WJcqXWVHqrOvhzw+1Gdxpr8vhj51EfGBGu93ALr1+ho x11bjAUtTKhVmQV/LZQS1FO3TIgVKjtIP+jfSQz1DRu0vF8pNJjXBFVfjSNxT4kp 75DRzF82w= From: Chen Hanxiao To: libvir-list@redhat.com Date: Mon, 18 Dec 2017 15:27:16 +0800 Message-Id: <20171218072716.4719-1-chen_han_xiao@126.com> X-CM-TRANSID: DsmowABXNh42bjdaLJEgAw--.55748S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kw15Jr1rJr17Gr45uF45ZFb_yoW8ury3pF 9xCa4FkrW8JF1fArZ2ya4xJFy5Jr1kJr15WFsrua9rZr18CrWDCrsakryIgrWDJ3s5Aa1S 9F98CasY9w1kWr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UCYL9UUUUU= X-Originating-IP: [58.213.111.46] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbiaAKyrlQ9EL6ruwABsg X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 18 Dec 2017 07:29:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 18 Dec 2017 07:29:13 +0000 (UTC) for IP:'220.181.15.114' DOMAIN:'m15-114.126.com' HELO:'m15-114.126.com' FROM:'chen_han_xiao@126.com' RCPT:'' X-RedHat-Spam-Score: 1.99 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_PSBL, SPF_PASS, T_RP_MATCHES_RCVD) 220.181.15.114 m15-114.126.com 220.181.15.114 m15-114.126.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Chen Hanxiao Subject: [libvirt] [PATCH] deamon: TLS: use default value if ca_file, cert_file or key_file not set 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 18 Dec 2017 07:29:26 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Chen Hanxiao As the description of daemon/libvirtd.conf, setting key_file, cert_file or key_file will override the default value. But if we set any one of them, we need to set all the rest of them. This patch set default value to them as daemon/libvirtd.conf described. Signed-off-by: Chen Hanxiao --- daemon/libvirtd.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 6d3b83355..93983f63b 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -493,19 +493,28 @@ daemonSetupNetworking(virNetServerPtr srv, config->cert_file || config->key_file) { if (!config->ca_file) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No CA certificate path set to match = server key/cert")); - goto cleanup; + VIR_WARN("Using default path for ca_file"); + if (VIR_STRDUP(config->ca_file, LIBVIRT_CACERT) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No CA certificate path set to ma= tch server key/cert")); + goto cleanup; + } } if (!config->cert_file) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No server certificate path set to ma= tch server key")); - goto cleanup; + VIR_WARN("Using default path for cert_file"); + if (VIR_STRDUP(config->cert_file, LIBVIRT_SERVERCERT) = < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No server certificate path set t= o match server key")); + goto cleanup; + } } if (!config->key_file) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No server key path set to match serv= er cert")); - goto cleanup; + VIR_WARN("Using default path for key_file"); + if (VIR_STRDUP(config->key_file, LIBVIRT_SERVERKEY) < = 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No server key path set to match = server cert")); + goto cleanup; + } } VIR_DEBUG("Using CA=3D'%s' cert=3D'%s' key=3D'%s'", config->ca_file, config->cert_file, config->key_= file); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list