-
Notifications
You must be signed in to change notification settings - Fork 525
Add Sigstore on workload attestor for SPIRE #3159
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
Merged
amartinezfayo
merged 113 commits into
spiffe:main
from
willallves:adding-sigstore-cosign
Jan 5, 2023
Merged
Changes from all commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
c4fce5d
Added Sigstore workload attestor for SPIRE
willallves ddc2f14
Fix hcl on k8s tests
willallves 8401e1b
Adjust on log message
willallves 1a6ebf9
Adjust lint error
willallves 7f7fa32
removed unnecessary code
willallves 99cd939
refactor: A check has been created to verify if p.sigstore is differe…
06f50e6
fix: fixed lint errors
ef113d8
fix: fixed lint errors
626e65b
fix: fixed lint errors
484f203
refactor: pr adjustments related to cosign
3f350ce
refactor: pr adjustments of logs of errors
ee57747
refactor: pr adjustments of logs for errors
2e59f95
fixing CI error
willallves 0309e5e
dependency test
willallves 7375df4
progress: solving dependency errors, apply marcos diff (#36)
willallves c0d8bea
PR adjustments of code organization and change imageID to a list of s…
matheusdefarias 26c469f
feat: adding plugin mutex lock to configureSigstore. (#37)
rodrigolc cd0a350
SelectorsFromSignature pointer refactor (#33)
rodrigolc 99132f1
K8s test refactor (#43)
rodrigolc d1832ca
Moving the initial state of sigstore on suite to setup (#40)
tjamir b28df1d
refactor: refactor of sigstorecache code (#44)
matheusdefarias 680744e
Refactor of ValidateImage and validateRefDigest functions (#48)
matheusdefarias cdcb7cf
refactor: refactor of sigstore.go code related to subject assignment …
matheusdefarias 43953d2
Removed RFC doc link (#57)
willallves cb3f0e4
Add sigstore toggle (#56)
rodrigolc 296a8c4
Adding sigstore cosign adjustments pr 20220715 (#59)
matheusdefarias 7609c37
Adding log label (#60)
rodrigolc 5e9c2cd
Fixed dependencies
willallves 3fb506d
Fix k8s posix (#70)
rodrigolc 558ebbc
Fixing sigstore docs (#71)
rodrigolc 18da14d
Fix sigstore (#72)
rodrigolc 45f6ad4
fixing rebase
willallves 02c548e
Refactory on k8s unit tests (#90)
willallves 525d7ea
refactor: deleted commented code, empty lines and changed code locati…
matheusdefarias 9611882
refactor: changed DeepEqual to require.Equal and other changes (#81)
matheusdefarias cda7f50
Update doc/plugin_agent_workloadattestor_k8s.md
willallves 8f934a2
refactor: pr requests to change from deepEqual to require.Equal, remo…
matheusdefarias 09d16b4
Removed unnecessary code (#99)
willallves 3dc5505
Added rekor text in docs (#101)
willallves ce48b93
Added test case for last element added as first of list (#106)
willallves 0d6903c
fix: refactoring so sigstore errors make attestation fail completely …
rodrigolc 01d87eb
tests: removed repeated tests of failing parsing rekorURL on mock (#112)
rodrigolc 99c39fb
Fix sigstore_tests (#91)
rodrigolc e022699
Refactor hook struct (#122)
rodrigolc 1f933d7
Fixed shorts comments (#114)
willallves c484d0f
Refactor: made requested changes in the sigstore.go file (#94)
joaoguazzelli 8446994
Fix check empty rekorURL (#128)
rodrigolc e08825d
refactor: refactored SelectorValuesFromSignature to error out on all …
rodrigolc c2ea801
Removed private functions on tests (#135)
willallves 28d9a09
Refactor contains usage (#129)
rodrigolc 6a7143c
Adding error SelectorsFromSignatures (#136)
rodrigolc 65fd90b
test: add hashed manifest test case (#137)
joaoguazzelli 7322b8c
fix: fixed lint errors
willallves d7a6c75
cosign v1.9.0 for v1.12.1
willallves 382eb84
Move sigstore out of windows build (#150)
ddd0d6d
Update pkg/agent/plugin/workloadattestor/k8s/k8s_posix_test.go
willallves abef8bd
Update pkg/agent/plugin/workloadattestor/k8s/k8s_posix_test.go
willallves 27cfc53
Update pkg/agent/plugin/workloadattestor/k8s/k8s_posix_test.go
willallves db72307
fixed: tables md (#156)
willallves 834ab88
Validation changed if key present (#158)
willallves 7288800
Added more a test case (#160)
willallves 37386f8
fixing rekorUrl handling (#163)
rodrigolc c1986c0
feat: implementation of sigstore cache check overflow test function (…
matheusdefarias d2c1f64
fix: removed unnecessary if statement (#166)
joaoguazzelli 1373575
fix: added independent cache for each test in TestCacheimpl_PutSignat…
joaoguazzelli 0e8bcf8
Adding sigstore cosign pr adjustments 01112022 (#169)
matheusdefarias 6c4cec1
Adjusting Marcos's comments (#174)
willallves e6634a9
refactor: added a comment to verifyFunction in sigstore.go file (#179)
matheusdefarias b1c7fb7
Adding sigstore cosign pr adjustments 24112022 (#180)
matheusdefarias 4488f2c
Fix error declaration (#182)
joaoguazzelli b0cc07b
fix: per marcos' comments (#181)
rodrigolc 764ed3c
Moving functions and declarations (#183)
rodrigolc f41fb65
Empty scheme not allowed anymore (#184)
rodrigolc 4fe4258
cleanup test structs (#185)
rodrigolc 36e05dc
misc: simplified errors and code flow (#186)
rodrigolc 5ff4f7f
fix: removed noop false early return (#187)
rodrigolc a93dc2b
misc: reordered shouldSkipImage returns so images with empty IDs are …
rodrigolc 2858b2f
misc: removed unused "verified" bool (#189)
rodrigolc 7c06461
Add OIDC issuer to allowed subject list (#175)
rodrigolc 0b171a2
fix: added error message validation (#195)
joaoguazzelli a30f06e
Removing default rekor url (#178)
rodrigolc 37bcb4f
misc: removed ineffective called boolean (#191)
rodrigolc 122a16c
misc: hardcoding AttestContainerSignature reference values (#194)
rodrigolc 7d5069d
misc: moved fields from single field struct (#193)
rodrigolc 5e87db1
refactor: changed some sigstore_test.go code as suggested (#190)
matheusdefarias 51e071a
misc: removed verbose message from require statements (#192)
rodrigolc 917443e
feat: add private deployment validator (#170)
joaoguazzelli 0a85665
missing refactor comments (#196)
rodrigolc 1844192
fix: added missing arg to checkOptsFunction call (#197)
rodrigolc fae20d1
fix: updated loglines and tests (#198)
rodrigolc 322f4cf
Merge commit '84aa2c1eb9724ab55cb7eb791628b18c57d3ffcd' into adding-s…
rodrigolc d6989be
fixing go.mod and go.sum
rodrigolc 58841eb
misssing typo fix from merge
rodrigolc fd38fb0
fixed go mod
willallves ad249c5
fix merge
willallves eaf5c50
Adjusting on go.mod
willallves 66b9b66
adjust *.md
willallves f81bdcc
adjust *.md
willallves 66d3b01
adjust *.md
willallves c875b50
Missing Fixes (#199)
rodrigolc 05520d1
merge spire/main into adding-sigstore-cosign
willallves 1f4a382
refactor: removed some empty lines and moved unexported functions and…
matheusdefarias 2e693e3
Add fixes (#201)
joaoguazzelli ba9e424
refactor: removed some tests from k8s_windows_test.go file as suggest…
matheusdefarias feb4f85
markdown table fixes (#203)
rodrigolc ef3aa2e
moved OIDC token issuer Object Identifier var to sigstore.go (#204)
rodrigolc 3306e22
Clean some code
7a9a5bb
Merge remote-tracking branch 'upstream/main' into adding-sigstore-cosign
1399ff5
minor change
7c333d5
clean code and solve a configuration issue
2a1b78a
Merge main
abf8449
Merge branch 'main' into adding-sigstore-cosign
3ea2c7d
Merge main into branch
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,6 +359,30 @@ plugins { | |
# node_name: The name of the node. Overrides the value obtained by | ||
# the environment variable specified by node_name_env. | ||
# node_name = "" | ||
|
||
# experimental: Experimental features. | ||
experimental { | ||
# sigstore: sigstore options. Enables signature checking. | ||
# sigstore { | ||
# rekor_url: The URL for the rekor STL Server to use with cosign. Required. | ||
# rekor_url = "https://rekor.sigstore.dev" | ||
|
||
# skip_signature_verification_image_list: List of images that should | ||
# not be verified by cosign. They will receive a default | ||
# sigstore-validation:passed selector, but no other sigstore related selectors. | ||
# skip_signature_verification_image_list = ["sha:image1hash","sha:image2hash"] | ||
|
||
# allowed_subjects_list: Map of subjects that image signatures | ||
# will be checked against, keyed by OIDC Provider URI. | ||
# Signatures from subjects outside this list will be ignored. These should be email addresses. | ||
# allowed_subjects_list { | ||
# "https://accounts.google.com" = ["[email protected]","[email protected]"] | ||
# } | ||
|
||
# enforce_sct: to be set as false in case of a private deployment not using the public CT | ||
# enforce_sct = true | ||
# } | ||
} | ||
} | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -59,6 +59,43 @@ since [hostprocess](https://kubernetes.io/docs/tasks/configure-pod-container/cre | |
| `use_anonymous_authentication` | If true, use anonymous authentication for kubelet communication | | ||
| `node_name_env` | The environment variable used to obtain the node name. Defaults to `MY_NODE_NAME`. | | ||
| `node_name` | The name of the node. Overrides the value obtained by the environment variable specified by `node_name_env`. | | ||
| `experimental` | The experimental options that are subject to change or removal. | | ||
|
||
| Experimental options | Description | | ||
|----------------------|----------------------------------------------------------------------------------------------------------------------------- | | ||
| `sigstore` | Sigstore options. Options described below. See [Sigstore workload attestor for SPIRE](#sigstore-workload-attestor-for-spire) | | ||
|
||
| Sigstore options | Description | | ||
|------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `skip_signature_verification_image_list` | The list of images, described as digest hashes, that should be skipped in signature verification. Defaults to empty list. | | ||
| `allowed_subjects_list` | A map of allowed subject strings, keyed by the OIDC Provider URI, that are trusted and are allowed to sign container images artifacts. Defaults to empty. If empty, no workload will pass signature validation, unless listed on `skip_signature_verification_image_list`. (eg. `"https://accounts.google.com" = ["[email protected]","[email protected]"]`). | | ||
| `rekor_url` | The rekor URL to use with cosign. Required. See notes below. | | ||
| `enforce_sct` | A boolean to be set to false in case of a private deployment, not using public CT | | ||
|
||
> **Note** Cosign discourages the use of image tags for referencing docker images, and this plugin does not support attestation of sigstore selectors for workloads running on containers using tag-referenced images, which will then fail attestation for both sigstore and k8s selectors. In cases where this is necessary, add the digest string for the image in the `skip_signature_verification_image_list` setting (eg. `"sha256:abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"`). Note that sigstore signature attestation will still not be performed, but this will allow k8s selectors to be returned, along with the `"k8s:sigstore-validation:passed"` selector. | ||
|
||
<!-- different notes --> | ||
|
||
> **Note** Since the SPIRE Agent can also go through workload attestation, it will also need to be included in the skip list if either its image is not signed or has a digest reference string. | ||
|
||
<!-- different notes --> | ||
|
||
> **Note** The sigstore project contains a transparency log called Rekor that provides an immutable, tamper-resistant ledger to record signed metadata to an immutable record. While it is possible to run your own instance, a public instance of rekor is available at `https://rekor.sigstore.dev/`. | ||
|
||
## Sigstore workload attestor for SPIRE | ||
|
||
### Platform support | ||
|
||
This capability is only supported on Unix systems. | ||
|
||
The k8s workload attestor plugin also has capabilities to validate container images signatures through [sigstore](https://www.sigstore.dev/) | ||
|
||
Cosign supports container signing, verification, and storage in an OCI registry. Cosign aims to make signatures invisible infrastructure. For this, we’ve chosen the Sigstore ecosystem and artifacts. Digging deeper, we are using: Rekor (signature transparency log), Fulcio (signing certificate issuer and certificate transparency log) and Cosign (container image signing tool) to guarantee the authenticity of the running workload. | ||
|
||
> **Note** you can provide your own CA roots signed through TUF via the cosign initialize command. | ||
This effectively securely pins the CA roots. We allow you to also specify trusted roots via the `SIGSTORE_ROOT_FILE` flag | ||
|
||
### K8s selectors | ||
|
||
| Selector | Value | | ||
|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
|
@@ -77,6 +114,15 @@ since [hostprocess](https://kubernetes.io/docs/tasks/configure-pod-container/cre | |
| k8s:pod-init-image | An Image OR ImageID of any init container in the workload's pod, [as reported by K8S](https://pkg.go.dev/k8s.io/api/core/v1#ContainerStatus). Selector value may be an image tag, such as: `docker.io/envoyproxy/envoy-alpine:v1.16.0`, or a resolved SHA256 image digest, such as `docker.io/envoyproxy/envoy-alpine@sha256:bf862e5f5eca0a73e7e538224578c5cf867ce2be91b5eaed22afc153c00363eb` | | ||
| k8s:pod-init-image-count | The number of init container images in workload's pod | | ||
|
||
Sigstore enabled selectors (available when configured to use sigstore) | ||
|
||
| Selector | Value | | ||
|----------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| k8s:${containerID}:image-signature-content | A containerID is an unique alphanumeric number for each container. The value of the signature itself in a hash (eg. "k8s:000000:image-signature-content:MEUCIQCyem8Gcr0sPFMP7fTXazCN57NcN5+MjxJw9Oo0x2eM+AIgdgBP96BO1Te/NdbjHbUeb0BUye6deRgVtQEv5No5smA=") | | ||
| k8s:${containerID}:image-signature-subject | OIDC principal that signed it (eg. "k8s:000000:image-signature-subject:[email protected]") | | ||
| k8s:${containerID}:image-signature-logid | A unique LogID for the Rekor transparency log (eg. "k8s:000000:image-signature-logid:samplelogID") | | ||
| k8s:${containerID}:image-signature-integrated-time | The time (in Unix timestamp format) when the image signature was integrated into the signature transparency log (eg. "k8s:000000:image-signature-integrated-time:12345") | | ||
| k8s:sigstore-validation | The confirmation if the signature is valid, has value of "passed" (eg. "k8s:sigstore-validation:passed") | | ||
> **Note** `container-image` will ONLY match against the specific container in the pod that is contacting SPIRE on behalf of | ||
> the pod, whereas `pod-image` and `pod-init-image` will match against ANY container or init container in the Pod, | ||
> respectively. | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.