openSUSE / open-build-service

Build and distribute Linux packages from sources in an automatic, consistent and reproducible way #obs
https://openbuildservice.org
GNU General Public License v2.0
924 stars 436 forks source link

Support GnuPG signatures on anything that changes source content #5305

Open JanZerebecki opened 6 years ago

JanZerebecki commented 6 years ago

Support optional end-to-end trust / content authentication in addition to transport authentication.

Support GnuPG (OpenPGP) signatures on anything that changes sources (build inputs). For some content adding multiple signatures by different people might be useful, for others like review request this can be mapped in multiple reviews. Use hash chains like in git to include history and other relevant parts in the content that is signed. (Signing other changes like comments would also be nice, but important things first.)

As a first step: On the server only check if the signature is correct but don't use it for authorisation. On the CLI when using content from the server add verification and checking of the signatures key against a set of GnuPG keyrings; add information related to the key in certain output. Have a way to configure the client to fail when a signature is missing e.g. on content from a user, on content in a project/package with wildcards; when content in a project/packages does not have n signatures from a specified list of keys; support calling out to supply this information shortly before verification.

As an alternatives I have considered 1) other standards supporting signatures (S/MIME and its relatives) 2) giving up on falsifiable software computations and security 3) increasing security in each link of the transport way / of the transitively trusted set.

adrianschroeter commented 6 years ago

It sounds that you could write a source service doing that. You can configure project wide services, which run on each source change. The package would turn into broken, if the service exits with an error.

Does this sound reasonable?

JanZerebecki commented 6 years ago

That wouldn't protect the history (leading to no rollback protection), nor the meta data in submit requests (the submit target, who accepted it, etc). But what would make it unusable in practice is that the signature would either need to be stored externally (which could solve protecting the history by storing in this external place the history with the signatures over it, but then that would conflict with one of the goals of obs, having the history of a project available in it and being able to build without external network) or accepting a submit request could not add a signature from the project maintainer.

Maybe using an external store is (despite the above) the way to go. For that to be sufficiently usable, creating a submit request, accepting a review, accepting a request, and creating a commit need to add a signature to this external store. Are there hooks so this functionality can be added on the client? Is there a hook on the server so that accepting a submit request can be refused when a correct signature wasn't added to the external store?

Can the content of a submit request be edited (to add a signature) by review acceptance or request acceptance? Does obs keep a hash chain of the revisions of a source package? Does obs keep a hash of each revision? Which hash functions are supported? Are multiple hash functions supported in parallel? Is there a way to upgrade in case a hash function gets broken?

JanZerebecki commented 2 years ago

There is git support being worked on on that will solve this completely. https://build.opensuse.org/project/show/devel:ALP currently uses a git repo for the project and git submodules for each package. What is missing is signature checking before any parsing or building.

JanZerebecki commented 2 years ago

Signed changes is only a small part of higher level requirements for end to end supply chain integrity, which are:

Most of it probably will be provided by OBS (even if indirectly e.g. by https://github.com/openSUSE/obs-build/ ). But, I'm unsure where some of these requirements can be provided. Some part of acceptance into a product (AKA gating) is currently provided by bots for Factory in https://github.com/openSUSE/openSUSE-release-tools/ and not sure for Leap, there are bots for maintenance updates for SLE. Testing is mostly provided by openQA and some package specific steps not integrated with OBS.

(Of interest may also be some mentions of sigstore: https://github.com/openSUSE/open-build-service/search?q=sigstore https://github.com/openSUSE/obs-docu/search?q=sigstore )

Conan-Kudo commented 2 years ago

This is impossible to implement. This would require changing fundamentally how OBS works, since we'd need to preserve the build environments of every build like Koji does.

JanZerebecki commented 2 years ago

OBS publishes the build environment of every build in the _buildenv file. So, what do you mean?

Conan-Kudo commented 2 years ago

You will not be able to reconstruct the environment with the _buildenv file, the artifacts will not exist.

JanZerebecki commented 2 years ago

If everything is reproducible you only need the source which is already available in the OBS history and could reproduce the artifacts. But it is useful to have an artefact archive for allowing incremental improvement and allowing easier locating of errors. (This is important as one likely only enforces reproducibility in a statistical sense, for performance reasons.) That is why I listed it in the requirements, with a link to the archive Bernhard implemented and currently uses successfully:

It is not necessary to do that in OBS, as OBS already provides the necessary APIs to be able to do this externally. Though you could be too slow and miss an artifact download. So it is better to implement this additional optional feature in OBS.

How does that require fundamentally changing OBS?

JanZerebecki commented 2 years ago

Example for a provenance file: https://sources.suse.com/_slsa/SUSE:SLE-15-SP4:Update/standard/x86_64/5a/5a9e94b5dd6396e0b2f60e808bf06c220137e19943adf13c7ccd1d35645ab2c9.prov

adrianschroeter commented 1 year ago

On Dienstag, 14. Juni 2022, 17:31:40 CEST Neal Gompa (ニール・ゴンパ) wrote:

You will not be able to reconstruct the environment with the _buildenv file, the artifacts will not exist.

They do exist in SLSA mode, but this works only for stable distributions. (Not Factory or devel projects)

--

Adrian Schroeter @.***> Build Infrastructure Project Manager

SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev