From nobody Fri May 3 16:51:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1676483270; cv=none; d=zohomail.com; s=zohoarc; b=VONKQn3Z+uoZf7GXpFU8Q/5c8ab/AT0F/+lIZ9c6t1EcTCZwTkzXex6FvjxkYb3h1Cqn2falNrP89uaA78MJxtC5n/WbYSikCSC1kWmFSSHhpU3ZXGjoMlcUDzgxnF6aQL7rML39v33h0Zhiy3KTOQHtDHN17cqeGNZ72Cguw3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676483270; h=Content-Type:Content-Transfer-Encoding:Cc: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=Dyy/1RzvkVp1pdcd4XazalgcwoIuoecJZnqiF2nDZkw=; b=J+KZHCPbQuT9XdeoM/qZXVhgsknbAHe1xhV6yVsijnnes3lt8P9zPshJXo6UrIujzF9dmQGwXNofFVtnqRUSy5kjwWhwfQHe7w+BumZX5ELaoZkKVa5Vjhha81bcvbwT+RM1c8+gIVJwYyAN4+e6XwGSOa+Zu91zzJQAn1s45zk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 167648327043185.29857284381285; Wed, 15 Feb 2023 09:47:50 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-593-Xr-w_9iwMtWTO7C_j4murA-1; Wed, 15 Feb 2023 12:47:44 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 272673C218B0; Wed, 15 Feb 2023 17:47:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10446112132C; Wed, 15 Feb 2023 17:47:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0AD0F1946A49; Wed, 15 Feb 2023 17:47:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EB2F119465B6 for ; Wed, 15 Feb 2023 17:47:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D5FAF40C1106; Wed, 15 Feb 2023 17:47:17 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id F046140C1423; Wed, 15 Feb 2023 17:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676483269; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Dyy/1RzvkVp1pdcd4XazalgcwoIuoecJZnqiF2nDZkw=; b=AtgTZPI/+XrRQJ0EKbH61Z8OSOsgrmvDJaUdo+xmN+mEfMpnymjOZaYwqg6WCblPn36DqF zKdKOKUq0SSSlvJ52ALRd9YwD/6GQlmUMfPkd1oiVU8YJ3/zkV4N9v1tRfERn0Y/9bpWzX 2HWj53NmlUQURDVK29ezGUvy8exNkbM= X-MC-Unique: Xr-w_9iwMtWTO7C_j4murA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 1/5] crypto: TLS: introduce `check_pending` Date: Wed, 15 Feb 2023 17:47:08 +0000 Message-Id: <20230215174712.1894516-2-berrange@redhat.com> In-Reply-To: <20230215174712.1894516-1-berrange@redhat.com> References: <20230215174712.1894516-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, libvir-list@redhat.com, Peter Lieven , Hanna Reitz , Gerd Hoffmann , Ronnie Sahlberg , Paolo Bonzini , Antoine Damhet Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676483271932100002 From: Antoine Damhet The new `qcrypto_tls_session_check_pending` function allows the caller to know if data have already been consumed from the backend and is already available. Signed-off-by: Antoine Damhet Signed-off-by: Daniel P. Berrang=C3=A9 --- crypto/tlssession.c | 14 ++++++++++++++ include/crypto/tlssession.h | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/crypto/tlssession.c b/crypto/tlssession.c index b302d835d2..1e98f44e0d 100644 --- a/crypto/tlssession.c +++ b/crypto/tlssession.c @@ -493,6 +493,13 @@ qcrypto_tls_session_read(QCryptoTLSSession *session, } =20 =20 +size_t +qcrypto_tls_session_check_pending(QCryptoTLSSession *session) +{ + return gnutls_record_check_pending(session->handle); +} + + int qcrypto_tls_session_handshake(QCryptoTLSSession *session, Error **errp) @@ -615,6 +622,13 @@ qcrypto_tls_session_read(QCryptoTLSSession *sess, } =20 =20 +size_t +qcrypto_tls_session_check_pending(QCryptoTLSSession *session) +{ + return 0; +} + + int qcrypto_tls_session_handshake(QCryptoTLSSession *sess, Error **errp) diff --git a/include/crypto/tlssession.h b/include/crypto/tlssession.h index 15b9cef086..571049bd0e 100644 --- a/include/crypto/tlssession.h +++ b/include/crypto/tlssession.h @@ -248,6 +248,17 @@ ssize_t qcrypto_tls_session_read(QCryptoTLSSession *se= ss, char *buf, size_t len); =20 +/** + * qcrypto_tls_session_check_pending: + * @sess: the TLS session object + * + * Check if there are unread data in the TLS buffers that have + * already been read from the underlying data source. + * + * Returns: the number of bytes available or zero + */ +size_t qcrypto_tls_session_check_pending(QCryptoTLSSession *sess); + /** * qcrypto_tls_session_handshake: * @sess: the TLS session object --=20 2.39.1 From nobody Fri May 3 16:51:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1676483294; cv=none; d=zohomail.com; s=zohoarc; b=fwGfv6qIwe2HOfEoEFswWGC0AYesMCCJqCaZMzNIuyl4+brUE0iPtt5W/pEu5QqIDiORXsNChmzdcRYKOz8eZK0yL97oyPGNM/+2Z6uTt/4+K42zJR0UGBFJIWoI7pPDomczUbV0Q0L9xvLsdlvjtaB2i6mtiZXH2LwjatcfdjM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676483294; h=Content-Type:Content-Transfer-Encoding:Cc: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=drAf2ZqbcEMpmG5RYs9TvH1b9uvNGa+eyhPOGwfB6JQ=; b=RGsbXbEw0Y/r9czKVRFKHAGFhqci/UD4U9dghfJ505MxdvamfpwiCV0UvJkTusMxTFt3EaFIw/ZiW3T61xTgO506p1E0pamLHti+Pa3sSzJ1z5yQxpvFbM5J/2DSY5hrjPWQMKBeWv8890o2hA41EGOxsnxzrnxDptIKnAuH1hM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1676483294412344.4599474367135; Wed, 15 Feb 2023 09:48:14 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-652-pEd683skPQyzC9QgRqq43w-1; Wed, 15 Feb 2023 12:48:08 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE9633811F35; Wed, 15 Feb 2023 17:47:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACB70492B15; Wed, 15 Feb 2023 17:47:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 937431946589; Wed, 15 Feb 2023 17:47:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D43B919465B6 for ; Wed, 15 Feb 2023 17:47:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C72EF4014D03; Wed, 15 Feb 2023 17:47:20 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C4FD408573E; Wed, 15 Feb 2023 17:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676483293; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=drAf2ZqbcEMpmG5RYs9TvH1b9uvNGa+eyhPOGwfB6JQ=; b=VQBHr3lmhnIk0qu6TVZr0EX0ljTYm9moUN03J+iYCrdWypES8oPsAPbaZ+WzN6tDD7znKk RL9gX8PznL5GtAo/ZQvWK1gQPPxHRg+cn4IKJawWR9f7UhImCoggCv3kTQ+541U6jabeQp RFYW93NxEbkQS1FmIGAlqrxTivhllho= X-MC-Unique: pEd683skPQyzC9QgRqq43w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 2/5] io/channel-tls: fix handling of bigger read buffers Date: Wed, 15 Feb 2023 17:47:09 +0000 Message-Id: <20230215174712.1894516-3-berrange@redhat.com> In-Reply-To: <20230215174712.1894516-1-berrange@redhat.com> References: <20230215174712.1894516-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, libvir-list@redhat.com, Peter Lieven , Hanna Reitz , Gerd Hoffmann , Ronnie Sahlberg , Paolo Bonzini , Antoine Damhet , Charles Frey Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676483296006100001 From: Antoine Damhet Since the TLS backend can read more data from the underlying QIOChannel we introduce a minimal child GSource to notify if we still have more data available to be read. Signed-off-by: Antoine Damhet Signed-off-by: Charles Frey Signed-off-by: Daniel P. Berrang=C3=A9 --- io/channel-tls.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/io/channel-tls.c b/io/channel-tls.c index c730cb8ec5..8052945ba0 100644 --- a/io/channel-tls.c +++ b/io/channel-tls.c @@ -389,12 +389,76 @@ static void qio_channel_tls_set_aio_fd_handler(QIOCha= nnel *ioc, qio_channel_set_aio_fd_handler(tioc->master, ctx, io_read, io_write, o= paque); } =20 +typedef struct QIOChannelTLSSource QIOChannelTLSSource; +struct QIOChannelTLSSource { + GSource parent; + QIOChannelTLS *tioc; +}; + +static gboolean +qio_channel_tls_source_check(GSource *source) +{ + QIOChannelTLSSource *tsource =3D (QIOChannelTLSSource *)source; + + return qcrypto_tls_session_check_pending(tsource->tioc->session) > 0; +} + +static gboolean +qio_channel_tls_source_prepare(GSource *source, gint *timeout) +{ + *timeout =3D -1; + return qio_channel_tls_source_check(source); +} + +static gboolean +qio_channel_tls_source_dispatch(GSource *source, GSourceFunc callback, + gpointer user_data) +{ + return G_SOURCE_CONTINUE; +} + +static void +qio_channel_tls_source_finalize(GSource *source) +{ + QIOChannelTLSSource *tsource =3D (QIOChannelTLSSource *)source; + + object_unref(OBJECT(tsource->tioc)); +} + +static GSourceFuncs qio_channel_tls_source_funcs =3D { + qio_channel_tls_source_prepare, + qio_channel_tls_source_check, + qio_channel_tls_source_dispatch, + qio_channel_tls_source_finalize +}; + +static void +qio_channel_tls_read_watch(QIOChannelTLS *tioc, GSource *source) +{ + GSource *child; + QIOChannelTLSSource *tlssource; + + child =3D g_source_new(&qio_channel_tls_source_funcs, + sizeof(QIOChannelTLSSource)); + tlssource =3D (QIOChannelTLSSource *)child; + + tlssource->tioc =3D tioc; + object_ref(OBJECT(tioc)); + + g_source_add_child_source(source, child); +} + static GSource *qio_channel_tls_create_watch(QIOChannel *ioc, GIOCondition condition) { QIOChannelTLS *tioc =3D QIO_CHANNEL_TLS(ioc); + GSource *source =3D qio_channel_create_watch(tioc->master, condition); + + if (condition & G_IO_IN) { + qio_channel_tls_read_watch(tioc, source); + } =20 - return qio_channel_create_watch(tioc->master, condition); + return source; } =20 QCryptoTLSSession * --=20 2.39.1 From nobody Fri May 3 16:51:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1676483270; cv=none; d=zohomail.com; s=zohoarc; b=bVPUmsyoVL51afx+Pr7ZmBfcW97jF3UOwJa/dK1Nl6Qv0Mf1Q9qNSlvpzZiXecyszfKMwq0P3VLjfjHKacPTFimr28VcErg56Dx3eeAPv7YF+pd1LBpIZy+0r6/PbgoXU2GPg6wAg9p3IyoEJEyN+7LqDncPBOK+GBY1xV8PGeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676483270; h=Content-Type:Content-Transfer-Encoding:Cc: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=EnLTdQW1YqznaNEhJmicdWjmAUdsZw1qkvHUetsxoAQ=; b=UhnpjS9sDcbTGGPSpJAnEoGyvIZr8lzYpt4/mKLmu8/Ajny6YFqx9YcTPvxWI3lfGOSXk/rMAY1uNe2xOSI8cDhLtg5DpOEFJbMyXR2ya85WoyLmBgepJRFGnOWBo385MTClXelbZUl/geFhw3tvvJNpj0Ip66EDwG78LtuChqc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1676483270420383.4070708232614; Wed, 15 Feb 2023 09:47:50 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-561-ah7GgEJdOPe0mgpB--4wXw-1; Wed, 15 Feb 2023 12:47:45 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D073185CBEB; Wed, 15 Feb 2023 17:47:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC4C21121319; Wed, 15 Feb 2023 17:47:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CA5B819465BB; Wed, 15 Feb 2023 17:47:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5FBCA19465B6 for ; Wed, 15 Feb 2023 17:47:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4F1A74010D5F; Wed, 15 Feb 2023 17:47:22 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 419CB40C10FA; Wed, 15 Feb 2023 17:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676483269; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=EnLTdQW1YqznaNEhJmicdWjmAUdsZw1qkvHUetsxoAQ=; b=Gr6PhIrbkj9T+lyDeAGQgmuuV7c/bbkeBRTjWexNoL2CQTIRFXSkj2570gqIZVQHn/34wM 5W0dJUChG1ZUzNdsBNkfRiv9p6VEvlOU6WU7EcKoJ8IqBAAHCy5FJQOD0Ojgx0u6i0LZ3h ruHqUIjHiYYQs/C82Jy+hpaNTZi2Vb0= X-MC-Unique: ah7GgEJdOPe0mgpB--4wXw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 3/5] block: mention 'password-secret' option for -iscsi Date: Wed, 15 Feb 2023 17:47:10 +0000 Message-Id: <20230215174712.1894516-4-berrange@redhat.com> In-Reply-To: <20230215174712.1894516-1-berrange@redhat.com> References: <20230215174712.1894516-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fabiano Rosas , qemu-block@nongnu.org, libvir-list@redhat.com, Peter Lieven , Markus Armbruster , Hanna Reitz , Gerd Hoffmann , Ronnie Sahlberg , Paolo Bonzini Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676483271901100001 The 'password-secret' option was added commit b189346eb1784df95ed6fed610411dbf23d19e1f Author: Daniel P. Berrang=C3=A9 Date: Thu Jan 21 14:19:21 2016 +0000 iscsi: add support for getting CHAP password via QCryptoSecret API but was not mentioned in the command line docs Reviewed-by: Markus Armbruster Reviewed-by: Fabiano Rosas Signed-off-by: Daniel P. Berrang=C3=A9 --- qemu-options.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 88e93c6103..e79ff4d8fb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1892,8 +1892,8 @@ SRST ERST =20 DEF("iscsi", HAS_ARG, QEMU_OPTION_iscsi, - "-iscsi [user=3Duser][,password=3Dpassword]\n" - " [,header-digest=3DCRC32C|CR32C-NONE|NONE-CRC32C|NONE\n" + "-iscsi [user=3Duser][,password=3Dpassword][,password-secret=3Dsecret-= id]\n" + " [,header-digest=3DCRC32C|CR32C-NONE|NONE-CRC32C|NONE]\n" " [,initiator-name=3Dinitiator-iqn][,id=3Dtarget-iqn]\n" " [,timeout=3Dtimeout]\n" " iSCSI session parameters\n", QEMU_ARCH_ALL) --=20 2.39.1 From nobody Fri May 3 16:51:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1676483275; cv=none; d=zohomail.com; s=zohoarc; b=AdOCz0OF/VTaK8VmwCOUj/EWT3VdNbYgaVaUSwVxgv0r5jZqVGePqPaLQVeJFKQRHU3l0WpZQZAR5u8uZyV6lWQ4Z2kFqaTDUvOqzeqgLIctpJNllI9VTLBnFfAaBGdqXdawuOC7Q3a+7VoYauGbfPy4pU8RWHyjCKHnWV5NHUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676483275; h=Content-Type:Content-Transfer-Encoding:Cc: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=0e1HLlzsJGEHoE0lVggAi5If9lXbDs+2yHmSIZimhp8=; b=Z2ppwG1kNdJ2pRPys8u+BMgp/S1Zqvf6GqMY0ePnjLsx88WZ5AmFHTtIO6++hPvEqIx51FWrJOuKF6LtFFXHYIV/Eotw4bYZ4hjUurHIwJBC/OJopwvKiR26goc7zWLOZ5QG67DlMbzSn9QUfiLI7e3LAX4waiQ1QjR5wgadppM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1676483274943145.20764074847352; Wed, 15 Feb 2023 09:47:54 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-284-Hpw5nyItP822MRefuauYVg-1; Wed, 15 Feb 2023 12:47:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BDA2F3C218B8; Wed, 15 Feb 2023 17:47:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A95862026D4B; Wed, 15 Feb 2023 17:47:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 453C119465B1; Wed, 15 Feb 2023 17:47:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 959431946588 for ; Wed, 15 Feb 2023 17:47:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6C81040C1074; Wed, 15 Feb 2023 17:47:24 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F9424014D03; Wed, 15 Feb 2023 17:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676483273; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=0e1HLlzsJGEHoE0lVggAi5If9lXbDs+2yHmSIZimhp8=; b=awy2a2U0RY2++nzHxH49q4SmAfA8YHNAB0MRjhzXblQkQqBXeJkB1/SBgbeNBMNZ0Z5SKV gCQWeFACN4QsMtf1MPA8KJKBsHjFcVFtSakQfSaY6nFAFFj8eYL0K2srzB7GLyLWZhBW7O SQBUG/xXVOEbB4Zksx5UzRMS/vUU0Ww= X-MC-Unique: Hpw5nyItP822MRefuauYVg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 4/5] block: deprecate iSCSI 'password' in favour of 'password-secret' Date: Wed, 15 Feb 2023 17:47:11 +0000 Message-Id: <20230215174712.1894516-5-berrange@redhat.com> In-Reply-To: <20230215174712.1894516-1-berrange@redhat.com> References: <20230215174712.1894516-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fabiano Rosas , qemu-block@nongnu.org, libvir-list@redhat.com, Peter Lieven , Hanna Reitz , Gerd Hoffmann , Ronnie Sahlberg , Paolo Bonzini Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676483275949100001 Support for referencing secret objects was added in commit b189346eb1784df95ed6fed610411dbf23d19e1f Author: Daniel P. Berrang=C3=A9 Date: Thu Jan 21 14:19:21 2016 +0000 iscsi: add support for getting CHAP password via QCryptoSecret API The existing 'password' option is overdue for deprecation and subsequent removal. Reviewed-by: Fabiano Rosas Signed-off-by: Daniel P. Berrang=C3=A9 --- block/iscsi.c | 3 +++ docs/about/deprecated.rst | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c index b3e10f40b6..ed3e87a548 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1353,6 +1353,9 @@ static void apply_chap(struct iscsi_context *iscsi, Q= emuOpts *opts, } else if (!password) { error_setg(errp, "CHAP username specified but no password was give= n"); return; + } else { + warn_report("iSCSI block driver 'password' option is deprecated, " + "use 'password-secret' instead"); } =20 if (iscsi_set_initiator_username_pwd(iscsi, user, password)) { diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index cb1ec72347..d31ffa86d4 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -301,6 +301,14 @@ The above, converted to the current supported format:: =20 json:{"file.driver":"rbd", "file.pool":"rbd", "file.image":"name"} =20 +``iscsi,password=3Dxxx`` (since 8.0) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Specifying the iSCSI password in plain text on the command line using the +``password`` option is insecure. The ``password-secret`` option should be +used instead, to refer to a ``--object secret...`` instance that provides +a password via a file, or encrypted. + Backwards compatibility ----------------------- =20 --=20 2.39.1 From nobody Fri May 3 16:51:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1676483274; cv=none; d=zohomail.com; s=zohoarc; b=YFifxePRK1Z99tIXazGpksF85ET90bgGiXfC2S5wXrFqDtPmd8Ka/qcmj8aWD0D0/y7tbQhWdakpMI4w2/n7NTlq9hrchXjtTExMSKljiA+0mb21/bkSwDps3hkZibKoRPXavEH1vobZs7Q6mjM7hETJ/O37ZzmtSk8Ttig9G8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676483274; h=Content-Type:Content-Transfer-Encoding:Cc: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=ZYyIpth2qY/IKDsqYqqQ/otIdwzEb9yUf5pKk+6N/js=; b=K5f27aktDfZXgYdNFgI9brhKCbVSk//sAa1QDDJJfyAcZtikxo2fT0ZLGAcGgBexOkZkoWRTCuxQk9o0T7KcKGs9TWHoc+zzJl56liCZIIOZmv4ear9zVtFuXoMz4LSprhvL2ysmSRYGTOOM3FOllgarwZyN+l7Ypl43PzHxlVw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1676483274938487.1953404065455; Wed, 15 Feb 2023 09:47:54 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-163-dvZnlvNfNLOAXQAJNRRK9g-1; Wed, 15 Feb 2023 12:47:50 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0180280049F; Wed, 15 Feb 2023 17:47:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CC6D404CD84; Wed, 15 Feb 2023 17:47:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7A7D61946A6E; Wed, 15 Feb 2023 17:47:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5EE461946588 for ; Wed, 15 Feb 2023 17:47:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5160040ED76B; Wed, 15 Feb 2023 17:47:27 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA2C640C1074; Wed, 15 Feb 2023 17:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676483274; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=ZYyIpth2qY/IKDsqYqqQ/otIdwzEb9yUf5pKk+6N/js=; b=gbgRDvaCw+ao1jP2DyPzvF+0vkX3f46kAH89pN7B9crbD2vpZoHln0D/T5EozXkGqALqJL BDthdUSEWfVO4AXSy38yfEFrg73er21dt6q7i6Xu0Fhef39W8jLU0nXyssfTtr46o3R4z+ x2RPbCJlTMZxZ0z4HsEUmbRItFuW5BE= X-MC-Unique: dvZnlvNfNLOAXQAJNRRK9g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 5/5] ui: remove deprecated 'password' option for SPICE Date: Wed, 15 Feb 2023 17:47:12 +0000 Message-Id: <20230215174712.1894516-6-berrange@redhat.com> In-Reply-To: <20230215174712.1894516-1-berrange@redhat.com> References: <20230215174712.1894516-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fabiano Rosas , qemu-block@nongnu.org, libvir-list@redhat.com, Peter Lieven , Markus Armbruster , Hanna Reitz , Gerd Hoffmann , Ronnie Sahlberg , Paolo Bonzini Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676483275967100002 This has been replaced by the 'password-secret' option, which references a 'secret' object instance. Reviewed-by: Fabiano Rosas Reviewed-by: Markus Armbruster Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/about/deprecated.rst | 8 -------- docs/about/removed-features.rst | 7 +++++++ qemu-options.hx | 9 +-------- ui/spice-core.c | 15 --------------- 4 files changed, 8 insertions(+), 31 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index d31ffa86d4..2827b0c0be 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -66,14 +66,6 @@ and will cause a warning. The replacement for the ``nodelay`` short-form boolean option is ``nodelay= =3Don`` rather than ``delay=3Doff``. =20 -``-spice password=3Dstring`` (since 6.0) -'''''''''''''''''''''''''''''''''''''' - -This option is insecure because the SPICE password remains visible in -the process listing. This is replaced by the new ``password-secret`` -option which lets the password be securely provided on the command -line using a ``secret`` object instance. - ``-smp`` ("parameter=3D0" SMP configurations) (since 6.2) ''''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index 4a84e6174f..e901637ce5 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -428,6 +428,13 @@ respectively. The actual backend names should be used = instead. Use ``-drive if=3Dpflash`` to configure the OTP device of the sifive_u RISC-V machine instead. =20 +``-spice password=3Dstring`` (removed in 8.0) +''''''''''''''''''''''''''''''''''''''''''' + +This option was insecure because the SPICE password remained visible in +the process listing. This was replaced by the new ``password-secret`` +option which lets the password be securely provided on the command +line using a ``secret`` object instance. =20 QEMU Machine Protocol (QMP) commands ------------------------------------ diff --git a/qemu-options.hx b/qemu-options.hx index e79ff4d8fb..cafd8be8ed 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2135,7 +2135,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice, " [,tls-channel=3D[main|display|cursor|inputs|record|playback]]\= n" " [,plaintext-channel=3D[main|display|cursor|inputs|record|playb= ack]]\n" " [,sasl=3Don|off][,disable-ticketing=3Don|off]\n" - " [,password=3D][,password-secret=3D]\n" + " [,password-secret=3D]\n" " [,image-compression=3D[auto_glz|auto_lz|quic|glz|lz|off]]\n" " [,jpeg-wan-compression=3D[auto|never|always]]\n" " [,zlib-glz-wan-compression=3D[auto|never|always]]\n" @@ -2161,13 +2161,6 @@ SRST ``ipv4=3Don|off``; \ ``ipv6=3Don|off``; \ ``unix=3Don|off`` Force using the specified IP version. =20 - ``password=3D`` - Set the password you need to authenticate. - - This option is deprecated and insecure because it leaves the - password visible in the process listing. Use ``password-secret`` - instead. - ``password-secret=3D`` Set the ID of the ``secret`` object containing the password you need to authenticate. diff --git a/ui/spice-core.c b/ui/spice-core.c index 72f8f1681c..76f7c2bc3d 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -412,9 +412,6 @@ static QemuOptsList qemu_spice_opts =3D { .name =3D "unix", .type =3D QEMU_OPT_BOOL, #endif - },{ - .name =3D "password", - .type =3D QEMU_OPT_STRING, },{ .name =3D "password-secret", .type =3D QEMU_OPT_STRING, @@ -666,20 +663,8 @@ static void qemu_spice_init(void) } passwordSecret =3D qemu_opt_get(opts, "password-secret"); if (passwordSecret) { - if (qemu_opt_get(opts, "password")) { - error_report("'password' option is mutually exclusive with " - "'password-secret'"); - exit(1); - } password =3D qcrypto_secret_lookup_as_utf8(passwordSecret, &error_fatal); - } else { - str =3D qemu_opt_get(opts, "password"); - if (str) { - warn_report("'password' option is deprecated and insecure, " - "use 'password-secret' instead"); - password =3D g_strdup(str); - } } =20 if (tls_port) { --=20 2.39.1