From nobody Mon Feb 2 09:26:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1767982743; cv=none; d=zohomail.com; s=zohoarc; b=EIh8sPDqtKnGEWhgLRyxImTxz+oCldYKr1NBfVN++D3hyJCpWGFyA2KKSJPRA0ojMCF/FBidwN5qE+aEMSbB0ZezTcmOjVWqisRsMpov2JC2dUGWRFb1N3SjxoXywUbQqm0VdP5Ws42teOIFUu94ZwkkTwQks0ozkdjuJr3a91o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767982743; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=NMLKTVgOID2ZVVWcJiLaxsBvyoc6Cpy2r0z4jFERyG8=; b=UJDDGaDr7bBqXYeo4y+n8w907TTu0EnUEq67toqALMrxLrmWCcx5aqvLiKcRZbKA/eZVbAPmc8gTensz6ZKdtkU1FHyaFk9AyiwQ3gu5Nu3KIs24DYTqVfJkS+qRMPNLo/EwpXNLMEVGhV8mXmPHiasyecNgxgyh0BLGQ9BB0Q8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1767982743906684.4055367632726; Fri, 9 Jan 2026 10:19:03 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0CA5943E53; Fri, 9 Jan 2026 13:19:03 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id ABF6B44213; Fri, 9 Jan 2026 13:10:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id A002343FDA; Fri, 9 Jan 2026 13:10:13 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5685C43E7B for ; Fri, 9 Jan 2026 13:09:55 -0500 (EST) Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-211-tbvOgy8yNSmboGTOwT0BYw-1; Fri, 09 Jan 2026 13:09:53 -0500 Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c56848e6f45so527678a12.2 for ; Fri, 09 Jan 2026 10:09:53 -0800 (PST) Received: from armenon-kvm.armenon-thinkpadp16vgen1.bengluru.csb ([49.36.108.228]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a3e3cc8803sm111020495ad.71.2026.01.09.10.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 10:09:51 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767982195; h=from:from: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; bh=NMLKTVgOID2ZVVWcJiLaxsBvyoc6Cpy2r0z4jFERyG8=; b=JVXDjnPU9uegtxM+l98H4HRxeU02a01HOjNkfw8ghAHtocKgo7QjsMO959EEXaeptiClfn HFcqLdQoQRS+GtxWEqwy2N443OpvAaVy63lWdasbWgBggCF8hxRa0KNDGGGwH9tH7fB8lt +9f/X6pciqjKyy9/F2Jc0fhWjWmWsBc= X-MC-Unique: tbvOgy8yNSmboGTOwT0BYw-1 X-Mimecast-MFC-AGG-ID: tbvOgy8yNSmboGTOwT0BYw_1767982192 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767982192; x=1768586992; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NMLKTVgOID2ZVVWcJiLaxsBvyoc6Cpy2r0z4jFERyG8=; b=u4/X4eFYSYyF9UV0/IICdEAIJNVhjR+j08uilNCFMIda/B3IIZUw7hVPyCXk5ArA7w rJ0ejP60HSKmeUC3L4L8/2lk9x2T66TDrjOeNwW1zFwirwjWY+QdTPB8ofJg8JDnXDZ4 pMgHQxnL40lh41jb6OuEcWGRWZqkQnimXMm2CvsOdWtgBrxaA0e0tk/s7uPck8mxBjkZ 23q01h3ZLzEjqulxphyywfBv+t3aqnt7MpfCSz8Qi8JQx6Vg+ipDM+JezmoOrcs2R70a TOIiS58GTSoFFAd7C1yxX0mYmxbj2NXJO1/bulFlFL94hBCdDTd5iE6HluBKGREi5bLr N/dw== X-Gm-Message-State: AOJu0Yz005d5So2Ea0UzsdZZoPSESr2dXGkCk1daVGJ9SXRH5/lCbC4e +lUYNqa1jSqJ/VZxIss6jraWl+N0FrqFKrtU7DI9pLfcHX828ofkWacHIdR77ba9r6E4JhkXrkD QEA/YLmZQCHralbShsu43CAwurozv65vIQu8LNUO84EOlH05QIPeSEzLaFJTokScAGspVk8NUmI ohid0Z0MS0tIHGWecojm/HIW+Cg22a5Rq9NcfcT4TY0w== X-Gm-Gg: AY/fxX6tupUcGPa3lfTSV9KNxztQ+abaBDq0Kk8N55dssqjzrr6ITM6+iFeC/wCAOxk FHkJGQqekl8HDHIZ0NpmrabwIm7MYYLI9TpNEVNGZY4+uVSLv8f5WApOW3sSKhe9cSItMZAjDuQ +W4B6z2WNc4Tr5+lLNS4H1Io6x7leay/UZQergU3q9wTmrC/V8PukIVKWbblMHdPJfya+YE6SM4 VMfvXRzk3/ckbzxHHlVvnMcxGJo1p2deKEByIXbchsWv2erzZ0V/pktGzYiRmQ83dppr9k2aKR7 mLIN0YO98HWa42SLWjPaHjM646xhbetwpvxan6DZ62bTnPXJ7nLhnyyMf1mTQtDGJxO8rixDGD+ Yq3AGhR4iUYzYCU+LMqAEPoPFMJOD5ZJT9EIc9VANeDakBmUDg9st/lpYnQ== X-Received: by 2002:a17:903:2cb:b0:2a0:ccee:b354 with SMTP id d9443c01a7336-2a3ee47f36fmr107164815ad.35.1767982191899; Fri, 09 Jan 2026 10:09:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEByZb5wWOraeWdNdhyl1B8TzyqBkAbUGqMA7czsADXMzg4z/06ABFY3swkgoGh5Hn+EQlUnA== X-Received: by 2002:a17:903:2cb:b0:2a0:ccee:b354 with SMTP id d9443c01a7336-2a3ee47f36fmr107164625ad.35.1767982191400; Fri, 09 Jan 2026 10:09:51 -0800 (PST) To: devel@lists.libvirt.org Subject: [PATCH v4 6/6] docs: secret: Add documentation of secret encryption feature Date: Fri, 9 Jan 2026 23:39:36 +0530 Message-ID: <20260109180936.127454-7-armenon@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20260109180936.127454-1-armenon@redhat.com> References: <20260109180936.127454-1-armenon@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 6bkuk--ns_tBWwZknh035eeDgxc5j1iY4cMY6nRE9Go_1767982192 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GEODMIV6U2UZ5B64BNKQRK6XARKRYDAX X-Message-ID-Hash: GEODMIV6U2UZ5B64BNKQRK6XARKRYDAX X-MailFrom: armenon@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Arun Menon X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Arun Menon via Devel Reply-To: Arun Menon X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1767982749093158500 Content-Type: text/plain; charset="utf-8"; x-default="true" Document the new encryption of secrets feature in secretencryption.rst. Signed-off-by: Arun Menon --- docs/drvsecret.rst | 4 ++ docs/meson.build | 1 + docs/secretencryption.rst | 86 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 docs/secretencryption.rst diff --git a/docs/drvsecret.rst b/docs/drvsecret.rst index 76a9097d2b..234551d5ae 100644 --- a/docs/drvsecret.rst +++ b/docs/drvsecret.rst @@ -63,3 +63,7 @@ the traditional system or session libvirt connections to = QEMU. Normal practice would be to open the secret driver in embedded mode any time one of the ot= her drivers is opened in embedded mode so that the two drivers can interact in-process. + +Further reading +---------------------------- +- `Secret Encryption `__ diff --git a/docs/meson.build b/docs/meson.build index 21e0b19c25..0e74f9c4bf 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -97,6 +97,7 @@ docs_rst_files =3D [ 'programming-languages', 'python', 'remote', + 'secretencryption', 'securityprocess', 'ssh-proxy', 'storage', diff --git a/docs/secretencryption.rst b/docs/secretencryption.rst new file mode 100644 index 0000000000..0762fec685 --- /dev/null +++ b/docs/secretencryption.rst @@ -0,0 +1,86 @@ +.. role:: since + +Secret storage and encryption +----------------------------- + +The secret objects can either be ephemeral or persistent. +Ephemeral secrets are only kept in memory, never stored persistently on th= e disk. +See `Secrets `__ + +:since:`Since 12.0.0` if a secret is defined as persistent, then it is sto= red **encrypted** on the disk. + + +Systemd Credentials Sealing +--------------------------- + +Out of the box, secrets are sealed using systemd credentials. This ties the +encrypted secret files to the specific host. + +The `virt-secret-init-encryption` service automatically generates a random +32-byte key and encrypts it using `systemd-creds`, storing the result in +`/var/lib/libvirt/secrets/secrets-encryption-key`. The `virtsecretd` servi= ce +then automatically loads this key securely via the systemd `LoadCredential= Encrypted` +mechanism. + +Disabling Systemd Credentials +----------------------------- + +You can control encryption behavior by editing the `secret.conf` configura= tion +file located in ``@SYSCONFDIR@/libvirt/secret.conf`` or ``$XDG_CONFIG_HOME= /libvirt/secret.conf`` +depending on how the daemon was started (system mode or session mode respe= ctively). + +To **disable encryption entirely** (which effectively disables the use of = any +systemd credentials for this purpose): + +:: + + encrypt_data =3D 0 + +Setting ``encrypt_data =3D 0`` takes precedence over any available systemd +credentials. If you have existing encrypted secrets, this setting will pre= vent +the secret driver from loading the encryption key, making those secrets +inaccessible. New or updated secrets will be stored in plain base64 format. + +To **use a custom encryption key** instead of the systemd credential. +Defining a custom key path takes precedence over the systemd credential + +:: + + secrets_encryption_key =3D "/path/to/custom/key" + +Configuring Encryption on Non-Systemd Hosts +------------------------------------------- + +On hosts without systemd, or if you prefer to manage the key manually, you= can +create a raw encryption key and configure libvirt to use it. + +Generate a random 32-byte key: + +:: + + dd if=3D/dev/urandom of=3D/path/to/key/file bs=3D32 count=3D1 + +Update `secret.conf` to point to this key: + +:: + + secrets_encryption_key =3D "/path/to/key/file" + +Manual Systemd Credential Creation +---------------------------------- + +If you want to use systemd credentials but need to customize the encryptio= n parameters +(for example, to specify which TPM PCRs to bind to), you can generate the +credential file manually. + +To create the default `/var/lib/libvirt/secrets/secrets-encryption-key` ma= nually +using `systemd-creds` (adjusting arguments to `systemd-creds encrypt` as n= eeded): + +:: + + dd if=3D/dev/urandom bs=3D32 count=3D1 | \ + systemd-creds encrypt --name=3Dsecrets-encryption-key - \ + /var/lib/libvirt/secrets/secrets-encryption-key + +You can pass extra arguments to `systemd-creds encrypt `__, +such as ``--tpm2-device=3D...`` or ``--tpm2-pcrs=3D...``, to customize the= sealing policy. --=20 2.51.1