Skip to contentSkip to conversation

Document shared state signing

PATCH Superseded Antonin Godard 2 participants 3 messages Apr 17 – Apr 20

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Document shared state signing

Document the shared state signing feature. Add a new document in the Security manual, and definitions for the variables involved in this process in the variable glossary.

[YOCTO #15217]

---
 documentation/overview-manual/concepts.rst       |   6 +
 documentation/ref-manual/variables.rst           |  50 +++++
 documentation/security-manual/index.rst          |   1 +
 documentation/security-manual/sstate-signing.rst | 272 +++++++++++++++++++++++
 4 files changed, 329 insertions(+)
documentation/overview-manual/concepts.rst +6 -0
index ab723d7c3..f0b336226 100644
@@ -1240,6 +1240,12 @@ variable is the function that determines whether a given dependency
 needs to be followed, and whether for any given relationship the
 function needs to be passed. The function returns a True or False value.
 
+.. note::
+
+   Is is possible to sign these artifacts with :wikipedia:`GPG
+   <GNU_Privacy_Guard>`. See :doc:`/security-manual/sstate-signing` in the Yocto
+   Project Security Manual for more information.
+
 Images
 ------
 
documentation/ref-manual/variables.rst +50 -0

62 lines not on this page · raw message

documentation/security-manual/index.rst +1 -0
index 3453940f5..a767cd9c6 100644
@@ -14,6 +14,7 @@ Yocto Project Security Manual
    securing-images
    vulnerabilities
    read-only-rootfs
+   sstate-signing
 
 .. include:: /boilerplate.rst
 
documentation/security-manual/sstate-signing.rst new file +272 -0

272 lines not on this page · raw message

---
base-commit: 2c12ec7bf29aedeacf82970a9d2eb262fde4670e
change-id: 20260417-sstate-signing-f96c75ce1917

#1 lore raw

Hi Antonin,

didn't know that we can sign the sstate - thanks for writing things down! Just a few typos.

Quoted 38 lines · Antonin Godard via lists.yoctoproject.org

Document the shared state signing feature. Add a new document in the Security manual, and definitions for the variables involved in this process in the variable glossary.

[YOCTO #15217]

---
 documentation/overview-manual/concepts.rst       |   6 +
 documentation/ref-manual/variables.rst           |  50 +++++
 documentation/security-manual/index.rst          |   1 +
 documentation/security-manual/sstate-signing.rst | 272 +++++++++++++++++++++++
 4 files changed, 329 insertions(+)
documentation/overview-manual/concepts.rst +6 -0
index ab723d7c3..f0b336226 100644
@@ -1240,6 +1240,12 @@ variable is the function that determines whether a given dependency
 needs to be followed, and whether for any given relationship the
 function needs to be passed. The function returns a True or False value.
 
+.. note::
+
+   Is is possible to sign these artifacts with :wikipedia:`GPG
+   <GNU_Privacy_Guard>`. See :doc:`/security-manual/sstate-signing` in the Yocto
+   Project Security Manual for more information.
+
 Images
 ------
 
documentation/ref-manual/variables.rst +0 -0
index 317b75913..7387a5d25 100644
@@ -10097,6 +10097,25 @@ system and gives an overview of their function and contents.
 
       For details on the process, see the :ref:`ref-classes-staging` class.

[...]

documentation/ref-manual/variables.rst system and gives an overview of their function and contents. · line 10164

Quoted 3 lines
documentation/ref-manual/variables.rst +3 -0
+   :term:`SSTATE_VERIFY_SIG`
+      The :term:`SSTATE_VERIFY_SIG` variable controls whether to enable of
+      disable the :ref:`shared state <overview-manual/concepts:setscene tasks

s/whether to enable of disable/whether to enable or disable/

Quoted 1 line

+ and shared state>` artifacts signing feature.

[...]

Quoted 6 lines
documentation/security-manual/sstate-signing.rst new file +0 -0
new file mode 100644
index 000000000..1845b890f

documentation/security-manual/sstate-signing.rst line 10

Quoted 10 lines
documentation/security-manual/sstate-signing.rst new file +10 -0
@@ -0,0 +1,272 @@
+.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
+
+Shared State Signing
+********************
+
+The :term:`OpenEmbedded Build System` build system has a built-in mechanism
+allowing to save execution time by re-using pre-built artifacts: the
+:ref:`shared state cache (sstate cache) <overview-manual/concepts:shared state
+cache>`. These artifacts are stored in a directory (:term:`SSTATE_DIR`) are not
+signed by default.

The last sentence probably misses a conjunction, what about

s/are not signed by default/and are not signed by default/ ?

Quoted 4 lines
documentation/security-manual/sstate-signing.rst new file +4 -0
+
+This document goes through the steps to enable shared state signing.
+This feature is fully dependent on :wikipedia:`GPG <GNU_Privacy_Guard>`, meaning
+examples shown in this document will use the ``gpg`` command-line tool.

[...]

documentation/security-manual/sstate-signing.rst line 93

Quoted 13 lines
documentation/security-manual/sstate-signing.rst new file +13 -0
+Shared State Location
+---------------------
+
+Our build system needs to be configured to sign new sstate artifacts when they
+are generated. The generation of new artifacts is done once a task has finished
+being executed.
+
+For the following sections let's assume that our build system has the shared
+state directory location (:term:`SSTATE_DIR`) defined as follows::
+
+   SSTATE_DIR = "${TOPDIR}/sstate-cache"
+
+Assuming this directory and our temporary directory (:term:`TMPDIR`) is empty,

s/is empty/are empty/

Quoted 14 lines
documentation/security-manual/sstate-signing.rst new file +14 -0
+as an example throughout this document, let's run the ``create_recipe_spdx``
+task of the ``gettext-minimal-native`` recipe:
+
+.. code-block:: console
+
+   $ bitbake gettext-minimal-native -c create_recipe_spdx
+
+After execution, our shared state directory should be populated with new files:
+
+.. code-block:: console
+
+   $ find $BUILDDIR/sstate-cache/ -name "*gettext-minimal-native*create_recipe_spdx*"
+   sstate-cache/universal/a3/6e/sstate:gettext-minimal-native:x86_64-linux:1.0:r0:x86_64:14:a36ef66df6b8c0cb5a849bc70a99dcfd61e4bacd11cefe6bbaf4978b2b3b617a_create_recipe_spdx.tar.zst
+   sstate-cache/universal/a3/6e/sstate:gettext-minimal-native:x86_64-linux:1.0:r0:x86_64:14:a36ef66df6b8c0cb5a849bc70a99dcfd61e4bacd11cefe6bbaf4978b2b3b617a_create_recipe_spdx.tar.zst.siginfo

[...]

Quoted 5 lines
documentation/security-manual/sstate-signing.rst new file +4 -0
+Verifying Signed Shared State Artifacts
+=======================================
+
+Now that we have setup our build to sign shared state artifacts,

let's see how

s/we have setup our build/we have set up our build/

Quoted 8 lines
documentation/security-manual/sstate-signing.rst new file +8 -0
+we can verify them with the public key counterpart of the private key.
+
+.. note::
+
+   Signature of shared state and its verification can happen on two different
+   hosts, meaning one host can be in charge of the signature while another only
+   verifies the artifacts. This is preferred as the private key should not be
+   shared spread on multiple hosts.

[...]

documentation/security-manual/sstate-signing.rst line 272

Quoted 2 lines
documentation/security-manual/sstate-signing.rst new file +2 -0
+   As you can see, this does not prevent :term:`BitBake` from continuing, but
+   the the real task is executed instead of re-using the shared state.

s/but the the real task/but the real task/

Best regards,
Ulrich

Quoted 13 lines

---
base-commit: 2c12ec7bf29aedeacf82970a9d2eb262fde4670e
change-id: 20260417-sstate-signing-f96c75ce1917

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9276): https://lists.yoctoproject.org/g/docs/message/9276
Mute This Topic: https://lists.yoctoproject.org/mt/118875161/3618626
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/docs/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 4 lines
Pengutronix e.K.                           | Ulrich Ölmann               |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw

Hi,

Quoted 4 lines · Ulrich Ölmann

Hi Antonin,

didn't know that we can sign the sstate - thanks for writing things down! Just a few typos.

Thanks for the review! Glad you learned something thanks to it :) v2 should be on its way soon

Antonin