Repository navigation
Add STACKIT KMS integration #5
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
Open
Gottox
wants to merge
5
commits into
main
Choose a base branch
from
feature/kms-integration
base: main
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.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5e8f869
docs: regenerate the configuration reference
Gottox e5b9d9a
feat(secureboot): decrypt the file-based SecureBoot keys with STACKIT…
Gottox 30dc6aa
hack/dev: point the external URL at localhost
Gottox 6a40c14
hack/dev: add a STACKIT KMS SecureBoot setup
Gottox 146cc35
fix golint
Gottox 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
|
||
| package cmd | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "go.uber.org/zap" | ||
|
|
||
| "github.com/siderolabs/image-factory/internal/secureboot" | ||
| ) | ||
|
|
||
| // buildSecureBootServiceWithStackit prefers the STACKIT KMS backed SecureBoot service when it is | ||
| // configured and falls back to the upstream backends otherwise. | ||
| func buildSecureBootServiceWithStackit(ctx context.Context, logger *zap.Logger, opts Options) (*secureboot.Service, error) { | ||
| if !opts.SecureBoot.Enabled || opts.SecureBoot.STACKITKMS.KeyID == "" { | ||
| return buildSecureBootService(opts) | ||
| } | ||
|
|
||
| svc, err := secureboot.NewStackitKMSService( | ||
| ctx, | ||
| logger, | ||
| secureboot.StackitKMSOptions(opts.SecureBoot.STACKITKMS), | ||
| opts.SecureBoot.File.SigningKeyPath, | ||
| opts.SecureBoot.File.SigningCertPath, | ||
| opts.SecureBoot.File.PCRKeyPath, | ||
| ) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to initialize SecureBoot service: %w", err) | ||
| } | ||
|
|
||
| return svc, nil | ||
| } |
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 |
|---|---|---|
|
|
@@ -590,6 +590,57 @@ Region is the AWS region containing the KMS keys. | |
|
|
||
| --- | ||
|
|
||
| ### `secureBoot.stackitKMS` | ||
|
|
||
| STACKITKMS decrypts the file-based SecureBoot keys with STACKIT KMS. | ||
|
|
||
| --- | ||
|
|
||
| ### `secureBoot.stackitKMS.projectID` | ||
|
|
||
| - **Type:** `string` | ||
| - **Env:** `SECUREBOOT_STACKITKMS_PROJECTID` | ||
|
|
||
| ProjectID is the STACKIT project UUID the key ring belongs to. | ||
|
|
||
| --- | ||
|
|
||
| ### `secureBoot.stackitKMS.region` | ||
|
|
||
| - **Type:** `string` | ||
| - **Env:** `SECUREBOOT_STACKITKMS_REGION` | ||
|
|
||
| Region is the STACKIT region of the key ring, for example eu01. | ||
|
|
||
| --- | ||
|
|
||
| ### `secureBoot.stackitKMS.keyRingID` | ||
|
|
||
| - **Type:** `string` | ||
| - **Env:** `SECUREBOOT_STACKITKMS_KEYRINGID` | ||
|
|
||
| KeyRingID is the UUID of the key ring. | ||
|
|
||
| --- | ||
|
|
||
| ### `secureBoot.stackitKMS.keyID` | ||
|
|
||
| - **Type:** `string` | ||
| - **Env:** `SECUREBOOT_STACKITKMS_KEYID` | ||
|
|
||
| KeyID is the UUID of the aes_256_gcm key the key files are encrypted with. | ||
|
|
||
| --- | ||
|
|
||
| ### `secureBoot.stackitKMS.keyVersion` | ||
|
|
||
| - **Type:** `int64` | ||
| - **Env:** `SECUREBOOT_STACKITKMS_KEYVERSION` | ||
|
|
||
| KeyVersion is the version of the KMS key, defaults to 1. | ||
|
|
||
| --- | ||
|
|
||
| ### `secureBoot.enabled` | ||
|
|
||
| - **Type:** `bool` | ||
|
|
@@ -605,6 +656,15 @@ Artifacts defines names and references for various images used by the factory. | |
|
|
||
| --- | ||
|
|
||
| ### `artifacts.overrideSourceImageRegistry` | ||
|
|
||
| - **Type:** `string` | ||
| - **Env:** `ARTIFACTS_OVERRIDESOURCEIMAGEREGISTRY` | ||
|
|
||
| Replace the image registry defined in the extension/overlay image with the one defined here | ||
|
|
||
| --- | ||
|
|
||
| ### `artifacts.core` | ||
|
|
||
| Core contains configuration for core images used by the image factory. | ||
|
|
@@ -878,6 +938,15 @@ RefreshInterval specifies how often the image factory should refresh its connect | |
|
|
||
| --- | ||
|
|
||
| ### `artifacts.skipVersionfilter` | ||
|
|
||
| - **Type:** `bool` | ||
| - **Env:** `ARTIFACTS_SKIPVERSIONFILTER` | ||
|
|
||
| Whether to skip beta/alpha versions and such when obtaining valid Talos versions | ||
|
|
||
| --- | ||
|
|
||
| ### `authentication` | ||
|
|
||
| Authentication settings. | ||
|
|
@@ -1532,12 +1601,14 @@ artifacts: | |
| namespace: siderolabs | ||
| registry: ghcr.io | ||
| repository: "" | ||
| overrideSourceImageRegistry: "" | ||
| refreshInterval: 5m0s | ||
| schematic: | ||
| insecure: false | ||
| namespace: siderolabs/image-factory | ||
| registry: ghcr.io | ||
| repository: schematics | ||
| skipVersionfilter: false | ||
| talosVersionRecheckInterval: 15m0s | ||
| audit: | ||
| file: | ||
|
|
@@ -1676,6 +1747,12 @@ secureBoot: | |
| pcrKeyPath: "" | ||
| signingCertPath: "" | ||
| signingKeyPath: "" | ||
| stackitKMS: | ||
| keyID: "" | ||
| keyRingID: "" | ||
| keyVersion: 1 | ||
| projectID: "" | ||
| region: "" | ||
| ``` | ||
|
|
||
| ### Environment Variables | ||
|
|
@@ -1699,11 +1776,13 @@ IF_ARTIFACTS_INSTALLER_INTERNAL_INSECURE=false | |
| IF_ARTIFACTS_INSTALLER_INTERNAL_NAMESPACE=siderolabs | ||
| IF_ARTIFACTS_INSTALLER_INTERNAL_REGISTRY=ghcr.io | ||
| IF_ARTIFACTS_INSTALLER_INTERNAL_REPOSITORY= | ||
| IF_ARTIFACTS_OVERRIDESOURCEIMAGEREGISTRY= | ||
| IF_ARTIFACTS_REFRESHINTERVAL=5m0s | ||
| IF_ARTIFACTS_SCHEMATIC_INSECURE=false | ||
| IF_ARTIFACTS_SCHEMATIC_NAMESPACE=siderolabs/image-factory | ||
| IF_ARTIFACTS_SCHEMATIC_REGISTRY=ghcr.io | ||
| IF_ARTIFACTS_SCHEMATIC_REPOSITORY=schematics | ||
| IF_ARTIFACTS_SKIPVERSIONFILTER=false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same ⏫
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't find a nice way to do that. But I'll look into it! |
||
| IF_ARTIFACTS_TALOSVERSIONRECHECKINTERVAL=15m0s | ||
| IF_AUDIT_FILE_MAXAGE=30 | ||
| IF_AUDIT_FILE_MAXBACKUPS=16 | ||
|
|
@@ -1806,4 +1885,9 @@ IF_SECUREBOOT_ENABLED=false | |
| IF_SECUREBOOT_FILE_PCRKEYPATH= | ||
| IF_SECUREBOOT_FILE_SIGNINGCERTPATH= | ||
| IF_SECUREBOOT_FILE_SIGNINGKEYPATH= | ||
| IF_SECUREBOOT_STACKITKMS_KEYID= | ||
| IF_SECUREBOOT_STACKITKMS_KEYRINGID= | ||
| IF_SECUREBOOT_STACKITKMS_KEYVERSION=1 | ||
| IF_SECUREBOOT_STACKITKMS_PROJECTID= | ||
| IF_SECUREBOOT_STACKITKMS_REGION= | ||
| ``` | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you use some underscores pls to myke it more readable :)