-
-
Notifications
You must be signed in to change notification settings - Fork 28
feat: add build architecture article (#296) #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
RoyalOughtness
wants to merge
46
commits into
live
Choose a base branch
from
architecture
base: live
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
558c7de
feat: add build architecture article (#296)
RoyalOughtness 0b7c26f
fix
RoyalOughtness 69e3818
headers
RoyalOughtness ecd2edd
fix header
RoyalOughtness 4c90465
toc
RoyalOughtness 82c3aca
typo
RoyalOughtness 3b419c0
formatting fixes
RoyalOughtness cb6a3b7
fix columns
RoyalOughtness e2b5cc4
fix
RoyalOughtness a678c3f
fixes
RoyalOughtness 496714a
fixes
RoyalOughtness 8e207c2
caps fixes
RoyalOughtness e2246cc
fixes
RoyalOughtness a6b9e9a
add subtext
RoyalOughtness 17ca26c
various fixes
RoyalOughtness 354da73
fixes
RoyalOughtness 7a2a04d
changes
RoyalOughtness 202d402
fixes
RoyalOughtness b1a062f
css fixes
RoyalOughtness e652d74
fix
RoyalOughtness 23b3d4e
add margin auto for figure
RoyalOughtness 81336a9
fixes
RoyalOughtness 6dc7335
fix newlines
RoyalOughtness 2644a48
fix indentation again
RoyalOughtness 3ba32f5
content improvements
RoyalOughtness ccc95a6
toc changes
RoyalOughtness 3a0961f
additional note
RoyalOughtness 3cff0dd
content improvements
RoyalOughtness 0df47af
add links
RoyalOughtness 0cc0fd5
format
RoyalOughtness dbecc7e
reword
RoyalOughtness d0eaaa4
codacy
RoyalOughtness 1d9d08f
codacy
RoyalOughtness 8375eae
codacy
RoyalOughtness ce5f4a4
codacy
RoyalOughtness 803eefc
comments
RoyalOughtness fbc0c62
formatting
RoyalOughtness 9d96056
fix list nesting
RoyalOughtness 6b65f4c
use bullet point
RoyalOughtness 47e187c
fix links
RoyalOughtness ded48bd
formatting
RoyalOughtness dac9429
codacy
RoyalOughtness 9d94a3f
comment
RoyalOughtness dba6679
test unordered list in table
RoyalOughtness e95d1e1
fixes
RoyalOughtness 75b933f
fix
RoyalOughtness File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| --- | ||
| title: "Build architecture | secureblue" | ||
| description: "Build architecture for secureblue" | ||
| permalink: /articles/build-architecture | ||
| --- | ||
|
|
||
| # Build architecture | ||
|
|
||
| ## [Table of Contents](#table-of-contents) | ||
| {: #table-of-contents} | ||
|
|
||
| - [Introduction](#introduction) | ||
| - [Definitions](#definitions) | ||
| - [Mitigation logic](#mitigation-logic) | ||
| - [Provenance](#provenance) | ||
| - [Signatures](#signatures) | ||
| - [Egress auditing](#egress-auditing) | ||
| - [Branch protection](#branch-protection) | ||
| - [Build process](#build-process) | ||
| - [Trivalent Build](#trivalent-build) | ||
| - [Secureblue Build](#secureblue-build) | ||
| - [Image Updates](#image-updates) | ||
|
|
||
| ## [Introduction](#introduction) | ||
| {: #introduction} | ||
|
|
||
| Supply chain security is a priority for secureblue. During the the build process, we use complementary security mechanisms to protect against a variety of supply chain attack vectors. The documentation below covers each of these mechanisms, the protections they provide, and where secureblue uses these mechanisms. | ||
|
|
||
| ## [Definitions](#definitions) | ||
| {: #definitions} | ||
|
|
||
| | Security mechanism | Implementation tooling | Attack vectors | Scope | | ||
| |------------|---------------------------------------|-------------------------|--------------|---------------------------------| | ||
| | Provenance | [SLSA](https://slsa.dev) | <ul><li>Maintainer signing key theft</li><li>Rogue maintainers</li></ul> | • All secureblue [OCI](https://opencontainers.org/) images<br />• Trivalent RPM packages<br />• BlueBuild build tools | | ||
| | Signatures | [cosign](https://github.com/sigstore/cosign), [GPG](https://gnupg.org/) | • Artifact tampering<br />• Artifact forgery<br />• Registry credential theft | • All secureblue OCI images<br />• All secureblue ISOs and torrents<br />• All secureblue RPM packages<br />• All Fedora RPM packages<br />• All Flatpaks from Flathub ([centrally signed](https://flathub.org/repo/flathub.gpg))<br />• BlueBuild build tools | | ||
| | Egress auditing | [Harden-Runner](https://docs.stepsecurity.io/harden-runner) | • Maintainer secrets exfiltration<br />• Source code tampering<br />• Dependency tampering<br />• Registry credential theft | • All secureblue OCI image builds<br />• Trivalent RPM builds | | ||
| | Branch protection | [GitHub Rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets) | • Maintainer source code repository credential theft<br />• Rogue maintainers | • All secureblue source code repositories | | ||
|
|
||
| ## [Mitigation logic](#mitigation-logic) | ||
| {: #mitigation-logic} | ||
|
|
||
| ### [Provenance](#provenance) | ||
| {: #provenance} | ||
|
|
||
| To generate provenance, the build platform (in our case, [GitHub Actions](https://github.com/features/actions)) generates and signs an attestation file containing metadata about the build environment. Crucially, it cryptographically attests to the authenticity of runner and the source commit on which the artifact is being built. This attestation is then published in the repository or registry alongside the artifact. | ||
|
|
||
| On the client side, when the artifact is pulled, the signature of the attestation is [validated](https://github.com/slsa-framework/slsa-verifier) against the build platform's public key and the contents of the attestation are validated to confirm that the artifact was built: on an authorized runner from a commit in a specific branch in the source repository (in our case, protected by branch policies, pull request review, and maintainer login 2FA). This means that even in the event that a maintainer's artifact signing keys and artifact repository credentials were both stolen, any malicious builds pushed by the credential thief would be rejected by clients due to provenance validation. | ||
|
|
||
| ### [Signatures](#signatures) | ||
| {: #signatures} | ||
|
|
||
| A private key owned by the artifact maintainer is used in combination with a [hash](https://en.wikipedia.org/wiki/Cryptographic_hash_function) of the artifact to compute a [signature](https://en.wikipedia.org/wiki/Digital_signature). The signature is then provided alongside the artifact so that clients can verify the artifact signature before installing or using the artifact. For example, for our ISOs, each signature is shipped in a corresponding `-CHECKSUM` file. | ||
|
|
||
| Once the client has all of the required information, it can use the maintainer's public key to verify the signature, revealing a hash that it then compares against a locally-generated hash of the artifact. This means that in the event that an artifact registry was compromised or artifacts otherwise tampered with by malicious third parties, any corresponding signature file would either not be present or fail validation. | ||
|
|
||
| ### [Egress auditing](#egress-auditing) | ||
| {: #egress-auditing} | ||
|
|
||
| StepSecurity [Harden-Runner](https://docs.stepsecurity.io/harden-runner) provides network traffic controls and source code integrity monitoring, among other mechanisms. It restricts outbound traffic to a configurable list of authorized outbound domains, and enforces this at multiple levels (DNS, HTTPS, network layer, transport layer). It has several other functions as well, like monitoring the source code as the build progresses to ensure tampering doesn't occur, monitoring for anomalous privileged processes, etc. | ||
|
|
||
| ### [Branch protection](#branch-protection) | ||
| {: #branch-protection} | ||
|
|
||
| Branch protection via [rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets) prevents any changes being made to secureblue source code without those changes first meeting specific criteria. Among those criteria is a minimum number of code reviews from maintainers, excluding of course the author of the pull request should they be a maintainer. This means that in the event that a maintainer's source code repository credentials were stolen, the thief would be unable to push changes to the repository. This includes the repo owner credentials, since bypassing rulesets is only possible after 2FA has been granted. | ||
|
|
||
| ## [Build process](#build-process) | ||
| {: #build-process} | ||
|
|
||
| <figure> | ||
| <a href="/assets/architecture.png" target="_blank"> | ||
| <img src="/assets/architecture.png" alt="Secureblue Architecture"> | ||
| </a> | ||
| <figcaption>Tap or click image to open larger</figcaption> | ||
| </figure> | ||
|
|
||
| ### [Trivalent Build](#trivalent-build) | ||
| {: #trivalent-build} | ||
|
|
||
| #### SRPM Build Job | ||
|
|
||
| 1. Run on a [GitHub-hosted runner](https://docs.github.com/en/actions/concepts/runners/github-hosted-runners) | ||
| 1. Run with [StepSecurity Harden-Runner](https://docs.stepsecurity.io/harden-runner) provisioned | ||
| 1. Install the [Trivalent source cache](https://github.com/secureblue/trivalent-chromium-clean-source) package from [secureblue's COPR repos](https://copr.fedorainfracloud.org/coprs/secureblue/packages/) | ||
| - Validate the package's GPG signature | ||
| 1. Push built [SRPM](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html-single/packaging_and_distributing_software/index) to GitHub Artifacts | ||
|
|
||
| #### RPM Build Job | ||
|
|
||
| 1. Run on a GitHub-hosted runner | ||
| 1. Run on a secureblue-owned, AWS-hosted runner via [Runs-On](https://runs-on.com/) | ||
| 1. Run with StepSecurity Harden-Runner provisioned | ||
| 1. Pull SRPM from GitHub Artifacts | ||
| 1. Push built [RPM](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html-single/packaging_and_distributing_software/index) to GitHub Artifacts | ||
|
|
||
| #### Signing Job | ||
|
|
||
| 1. Run with StepSecurity Harden-Runner provisioned | ||
| 1. Pull RPM from GitHub Artifacts | ||
| 1. Sign and push the RPM to [secureblue's RPM repo](https://repo.secureblue.dev/secureblue.repo) | ||
|
|
||
| #### Provenance Job | ||
|
|
||
| 1. Run on a GitHub-hosted runner | ||
| 1. Run with StepSecurity Harden-Runner provisioned | ||
| 1. Fetch hash information from the Signing Job | ||
| 1. Fetch context information from the GitHub Control Plane | ||
| 1. Generate, sign, and push the attestation to GitHub Artifacts | ||
|
|
||
| ### [Secureblue Build](#secureblue-build) | ||
| {: #secureblue-build} | ||
|
|
||
| #### Build Job | ||
|
|
||
| 1. Run on a GitHub-hosted runner | ||
| 1. Run with StepSecurity Harden-Runner provisioned | ||
| 1. Pull base image from [Fedora Quay](https://quay.io/organization/fedora-ostree-desktops) | ||
| - Validate the image's cosign signature | ||
| 1. Install packages from [Fedora's repos](https://packages.fedoraproject.org/) | ||
| - Validate each package's GPG signature | ||
| 1. Install packages from secureblue's COPR repos | ||
| - Validate each package's GPG signature | ||
| 1. From [Negativo17](https://negativo17.org/), replace certain packages that Fedora [strips of patent-encumbered codecs](https://docs.fedoraproject.org/en-US/project/#_freedom) | ||
| - Validate each package's GPG signature | ||
| 1. Pull the Trivalent provenance from the [Trivalent repo](https://github.com/secureblue/Trivalent) | ||
| 1. From secureblue's RPM repo, install Trivalent | ||
| - Validate the repo metadata signature | ||
| - Validate the package's GPG signature | ||
| - Validate the package's provenance | ||
| 1. Sign and push the completed image to [GHCR](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) | ||
| - Push the image's signature to GHCR | ||
|
|
||
| #### Provenance Job | ||
|
|
||
| 1. Run on a GitHub-hosted runner | ||
| 1. Run with StepSecurity Harden-Runner provisioned | ||
| 1. Fetch digest information from the Build Job | ||
| 1. Fetch context information from the GitHub Control Plane | ||
| 1. Generate, sign, and push the attestation to GHCR | ||
|
|
||
| ### [Image Updates](#image-updates) | ||
| {: #image-updates} | ||
|
|
||
| 1. Pull the new image to the client machine | ||
| - Validate the image signature | ||
| - Validate the image's provenance | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.