From nobody Thu Feb 12 18:31:39 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; 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=1770905364; cv=none; d=zohomail.com; s=zohoarc; b=KtubzPuuFR0MCK7auNH2HaP7FLev+AOQvqSKx2z2uadGHWVWGsWxNWtvk6ye6xv1L9dGKnX7z9wwbZZglcLY+3od0fF/DD6Ym8D8zcCH11iSeQyXkMtGlX9w2kUr0qgU89jRWZF2po7fGfHagxRfpYiSBsGAkzSYFVaf23gYWR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770905364; 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=dJcZUHhrukXBGbD8eA+ey/EfBNGFjfdiFuWobXTcpos=; b=Kaiqy+vUUAdGPOB/umoBnx2AGUAoDLWM/cL0iULs19No0CXBT5srVW6aiSO2UPwStDNDJl31k9SmQiwfiGG9EeQjLfaimx5yvMWaIRHaaaS/127qc39iInSRI96sTevRy7ghmQkLWbPmXnRJCeFMUBil9wqr0ZNCnQUlWTp12KU= 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 1770905363945211.23952800210054; Thu, 12 Feb 2026 06:09:23 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id B7B9144F92; Thu, 12 Feb 2026 09:09:22 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 93A4944EB8; Thu, 12 Feb 2026 07:50:28 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 324123F252; Thu, 12 Feb 2026 07:50:15 -0500 (EST) Received: from mx1.osci.io (unknown [8.43.85.229]) (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 BA87B446C3 for ; Thu, 12 Feb 2026 07:38:34 -0500 (EST) Received: by mx1.osci.io (Postfix, from userid 995) id CF89828C88; Tue, 10 Feb 2026 12:57:02 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mx1.osci.io (Postfix) with ESMTPS id 2F0DC28C85 for ; Tue, 10 Feb 2026 12:57:02 -0500 (EST) Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-66-Mk-SNLi3N2CcXoRghEDWYw-1; Tue, 10 Feb 2026 12:56:59 -0500 Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-82436a49592so3226115b3a.2 for ; Tue, 10 Feb 2026 09:56:59 -0800 (PST) Received: from armenon-kvm.armenon-thinkpadp16vgen1.bengluru.csb ([49.36.106.234]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-824418a70fesm13782658b3a.45.2026.02.10.09.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Feb 2026 09:56:57 -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=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, 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=1770746221; 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=dJcZUHhrukXBGbD8eA+ey/EfBNGFjfdiFuWobXTcpos=; b=Eg8xbzGvqDYEdkp5pjJqxY7bTlOalfvFmQ65wZo6JBtt2mFG1tDvyZrudvE8y56/UjmyLo a5Bf6WCPYazJLheoHXCtgbpOdfkMnmdtgrEscMjYXSslS/BrJIK5BqcRbVXwQdmMD5GFl7 sfn7PRTMBRg1ETwQZT3eXgIxxzMSN+g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770746221; 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=dJcZUHhrukXBGbD8eA+ey/EfBNGFjfdiFuWobXTcpos=; b=Eg8xbzGvqDYEdkp5pjJqxY7bTlOalfvFmQ65wZo6JBtt2mFG1tDvyZrudvE8y56/UjmyLo a5Bf6WCPYazJLheoHXCtgbpOdfkMnmdtgrEscMjYXSslS/BrJIK5BqcRbVXwQdmMD5GFl7 sfn7PRTMBRg1ETwQZT3eXgIxxzMSN+g= X-MC-Unique: Mk-SNLi3N2CcXoRghEDWYw-1 X-Mimecast-MFC-AGG-ID: Mk-SNLi3N2CcXoRghEDWYw_1770746218 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770746218; x=1771351018; 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=dJcZUHhrukXBGbD8eA+ey/EfBNGFjfdiFuWobXTcpos=; b=GiGek12j4Paar+Lxghlox1wn9dj9jv3M6TQhMycznAvMo6UzoWfYu0TcqUiekCmyOH XKqcvHhRc9fpM6sgX1wB+FbCr8SCh9vofYc5moOBgZIPVqPvf6xUgETIDnx19qfo0shM t/RQ+jYpnc9i/VdcIVkLyDBise2Ft2vCHQaDZtR7R/Su6ZmFQp4tirPCnklJLIr/DGUH srM2al4Fp1X/hRBIJHLQRNFwGhiuuQcElXjRlzhWcULvCIz50THfAjf9G7XTtc57FBLx ri8pKDBOveW3HCT3iuxOrJje3FSZ/T3T/6v6E/FN9NK5Adpa2bWHOzV5/uU8GnRIT1o7 hxmw== X-Gm-Message-State: AOJu0YwYgUeLLpY8PJQDEPaWKn5JDrA0067joofRI8Aonpo5QXKxvZ38 exUxkZu+yb6vo0EoSz2oS9Ms4UbU7WX75+fSvrCK9k5oZg98f53uVdntJEtlSu53lVPaxY8l44R k8zYOW5QRhD13dgIhm8/eV8ip58t88toNq4kwV4vontYaYZdyC20P1o4NOHbPGUep/UHFUNw4SH +tuE9ReW47hPPCaucKRhlY0HKdsaizqBe/wLcSbx5LHg== X-Gm-Gg: AZuq6aIXH51NByHATUkDNyX8DOZ+M/MpgzNSdufMyzb3fD/hd27m3ktERbklhcIJVDT +PbC2rvhF3ZnhRMKNNjdHC3uuSe8qWdNHG19xY1lX/lmbiR3+oapsx0pQp5KdW2GqrD/Ff3z4Z7 0cM249KLu40x1QeDCdeYlAucKpXchZd9m/b3jDZjcd+4nhF9BBnI+S4BWWr4Fw+SAbmoyqSH6Rv 5r5WG2KC1jeizLKDSHEmF66FSsgxtdz1kDU6Xd/eoysZaYMmLbGhbwT/hyeLicA00VHEly3R4nm VAdXr/1yXjKeEQfa3e8ANw/AjHE0ykZJYW80KNSWnIAkdG1Xrnihef26mnWL6nJztNeD5F286Oe imzTROdGdXuxClZ5nEype6uKMJblzB8152gFtge0IvO6F8ZmEouiiCP6KRsT39zBLbrimWg== X-Received: by 2002:a05:6a00:909b:b0:822:7fd8:ffbd with SMTP id d2e1a72fcca58-82487ae8cc2mr2899713b3a.59.1770746218186; Tue, 10 Feb 2026 09:56:58 -0800 (PST) X-Received: by 2002:a05:6a00:909b:b0:822:7fd8:ffbd with SMTP id d2e1a72fcca58-82487ae8cc2mr2899693b3a.59.1770746217633; Tue, 10 Feb 2026 09:56:57 -0800 (PST) To: devel@lists.libvirt.org Subject: [PATCH v6 6/6] docs: secret: Add documentation of secret encryption feature Date: Tue, 10 Feb 2026 23:26:43 +0530 Message-ID: <20260210175643.23351-7-armenon@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20260210175643.23351-1-armenon@redhat.com> References: <20260210175643.23351-1-armenon@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: XPuQ0Sublpqhi-si6ECIuYyITwTPavOCYggzSKJUotY_1770746218 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YCFCSQWVVEFYCEDOW55QSEN2YCUTTLC6 X-Message-ID-Hash: YCFCSQWVVEFYCEDOW55QSEN2YCUTTLC6 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: 1770905374450158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Arun Menon 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 | 105 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 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..4908339f2d --- /dev/null +++ b/docs/secretencryption.rst @@ -0,0 +1,105 @@ +.. role:: since + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D +Secret storage and encryption +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D + +.. contents:: + +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.1.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/random 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/random 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. + +Upgrading Libvirt for secret encryption +--------------------------------------- +Starting 12.1.0, secrets can be stored on the disk in an encrypted format,= rather than +the default base64 encoding. + +Any secret created before upgrading libvirt, remain stored in their origin= al base64 +format on the disk. +A pre-existing secret will only be encrypted if you explicitly update its = value using +**virsh secret-set-value** after the upgrade, provided that encryption is = enabled in +secret.conf configuration file. + +It is important to note that encrypted secrets are not backwards compatibl= e. In case of +a downgrade to an older version of libvirt, the encrypted secrets will not= be loaded from +the disk. Therefore, before reverting to an older version libvirt, make su= re that all the +secrets have been reverted to the standard base64 format, to avoid service= disruptions. --=20 2.51.1