From nobody Mon Feb 9 00:55:43 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1605279753; cv=none; d=zohomail.com; s=zohoarc; b=m1AsIwVH5XuhvxRcvTiDt3H1w7u9EkoiX5hmhOzgt0PuorwdY/rdI360Bl6ilKj/LrAt8cO0rOUWfI0eUqkXTbMXpMZSQSgAaLSnMMVj+tguko+XowXneG15bnJGLfucL6sMVS6pNcGT9k/qT+FI8dMZU95AcrrsFk79djeP/FY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605279753; 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=L27/TBMkIdqVPKkqbKL7vHyBKOkhAUO60CxUHsnZ3dk=; b=Dke1axDYNtEVNj/yiIb440jWWm0WgGVQsO0p6wIP1uAxOHLN0IU7rjBtM3KbtqWJYkMYEBe1xv9jYGy4MHGVsplBGb0CO9J5IJjR9dlSVFeWjQIIAhJIbYMEsiuxWmyaDmG0NXSGdb3wPrPheNG0PM6nUnZaU/q1y8R9Npbc09o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605279753794937.2504589962209; Fri, 13 Nov 2020 07:02:33 -0800 (PST) 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-157-KBBLi4TEPH6te1ZxxVcSsg-1; Fri, 13 Nov 2020 10:02:29 -0500 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 A883864157; Fri, 13 Nov 2020 15:02:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F17675126; Fri, 13 Nov 2020 15:02:23 +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 4602358103; Fri, 13 Nov 2020 15:02:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ADF1hY8017174 for ; Fri, 13 Nov 2020 10:01:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6050719930; Fri, 13 Nov 2020 15:01:43 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DBED3C04 for ; Fri, 13 Nov 2020 15:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605279752; 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=L27/TBMkIdqVPKkqbKL7vHyBKOkhAUO60CxUHsnZ3dk=; b=HaT9m1o6Uu8dU9CH1Va3MrmdBlqsc7TOT+kcp6fTAoBLJ5Ujvwn+9amRkaIW+EeeZ8fSfl 91R27GLVJq9FZI5A6kpJkOH/W4IvGGpi8ki0AQo09TkOVGGcZjHfSpYrf+BovyccBZlFTm TTRGVy7+KH3wvArQP3XuGKk9ooVANZM= X-MC-Unique: KBBLi4TEPH6te1ZxxVcSsg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] qemu: conf: Allow individual control of default value for *_tls_x509_verify Date: Fri, 13 Nov 2020 16:01:32 +0100 Message-Id: <1dc6205486ce30a09c0b6e253b91dbb930edf13d.1605279624.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Store whether "default_tls_x509_verify" was provided and enhance the SET_TLS_VERIFY_DEFAULT macro so that indiviual users can provide their own default if "default_tls_x509_verify" config option was not provided. For now we keep setting it to 'false'. Signed-off-by: Peter Krempa --- src/qemu/qemu.conf | 6 ++++++ src/qemu/qemu_conf.c | 22 ++++++++++++++-------- src/qemu/qemu_conf.h | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 6f7d2b14f7..6f9d940477 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -40,6 +40,12 @@ # client-cert.pem - the client certificate signed with the ca-cert.pem # client-key.pem - the client private key # +# If this option is supplied it provides the default for the "_verify" opt= ion +# of specific TLS users such as vnc, backups, migration, etc. The specific +# users of TLS may override this by setting the specific "_verify" option. +# +# When not supplied the specific TLS users provide their own defaults. +# #default_tls_x509_verify =3D 1 # diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 2fb2f021c2..c3a61816a4 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -406,8 +406,10 @@ virQEMUDriverConfigLoadDefaultTLSEntry(virQEMUDriverCo= nfigPtr cfg, if ((rv =3D virConfGetValueString(conf, "default_tls_x509_cert_dir", &= cfg->defaultTLSx509certdir)) < 0) return -1; cfg->defaultTLSx509certdirPresent =3D (rv =3D=3D 1); - if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->default= TLSx509verify) < 0) + if ((rv =3D virConfGetValueBool(conf, "default_tls_x509_verify", &cfg-= >defaultTLSx509verify)) < 0) return -1; + if (rv =3D=3D 1) + cfg->defaultTLSx509verifyPresent =3D true; if (virConfGetValueString(conf, "default_tls_x509_secret_uuid", &cfg->defaultTLSx509secretUUID) < 0) return -1; @@ -1240,16 +1242,20 @@ virQEMUDriverConfigSetDefaults(virQEMUDriverConfigP= tr cfg) #undef SET_TLS_X509_CERT_DEFAULT -#define SET_TLS_VERIFY_DEFAULT(val) \ +#define SET_TLS_VERIFY_DEFAULT(val, defaultverify) \ do { \ - if (!cfg->val## TLSx509verifyPresent) \ - cfg->val## TLSx509verify =3D cfg->defaultTLSx509verify; \ + if (!cfg->val## TLSx509verifyPresent) {\ + if (cfg->defaultTLSx509verifyPresent) \ + cfg->val## TLSx509verify =3D cfg->defaultTLSx509verify; \ + else \ + cfg->val## TLSx509verify =3D defaultverify;\ + }\ } while (0) - SET_TLS_VERIFY_DEFAULT(vnc); - SET_TLS_VERIFY_DEFAULT(chardev); - SET_TLS_VERIFY_DEFAULT(migrate); - SET_TLS_VERIFY_DEFAULT(backup); + SET_TLS_VERIFY_DEFAULT(vnc, false); + SET_TLS_VERIFY_DEFAULT(chardev, false); + SET_TLS_VERIFY_DEFAULT(migrate, false); + SET_TLS_VERIFY_DEFAULT(backup, false); #undef SET_TLS_VERIFY_DEFAULT diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index da03a184c1..8748212a82 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -108,6 +108,7 @@ struct _virQEMUDriverConfig { char *defaultTLSx509certdir; bool defaultTLSx509certdirPresent; bool defaultTLSx509verify; + bool defaultTLSx509verifyPresent; char *defaultTLSx509secretUUID; bool vncAutoUnixSocket; --=20 2.28.0