Thanks to visit codestin.com
Credit goes to github.com

Skip to content

support for redhat simple signature verification#84

Merged
molepigeon merged 21 commits intomasterfrom
atomic2
Mar 26, 2020
Merged

support for redhat simple signature verification#84
molepigeon merged 21 commits intomasterfrom
atomic2

Conversation

@sjhx
Copy link
Member

@sjhx sjhx commented Feb 24, 2020

#70

@sjhx sjhx marked this pull request as ready for review March 23, 2020 21:16
@sjhx
Copy link
Member Author

sjhx commented Mar 24, 2020

I think this represents a reasonable initial release of support for RedHat simple signatures with follow on issues to make incremental improvements, e.g. we should have a README to describe the policy options for simple.

README.md Outdated
## How it works

Portieris uses a Kubernetes Mutating Admission Webhook to modify your Kubernetes resources at the point of creation, to ensure that Kubernetes pulls the signed version. When configured to do so, it enforces trust pinning, and blocks the creation of resources that use untrusted images.
Portieris uses a Kubernetes Mutating Admission Webhook to modify your Kubernetes resources at the point of creation, to ensure that Kubernetes runs only policy compliant images. When configured to do so, it can enforce Docker Content Trust with optional trust pinning, or can verify signatures created using RedHat's simple signing model and will prevent the creation of resources using untrused or unverified images.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: untrused

README.md Outdated
When you create or edit a workload, the Kubernetes API server sends a request to Portieris. The AdmissionRequest contains the content of your workload. For each image in your workload, Portieris finds a matching security policy.
If trust enforcement is enabled in the policy, Portieris pulls signature information for your image from the corresponding Notary server and, if a signed version of the image exists, creates a JSON patch to edit the image name in the workload to the signed image by digest. If a signer is defined in the policy, Portieris additionally checks that the image is signed by the specified role, and verifies that the specified key was used to sign the image.
If simple signing is specified by the policy, Portieris will verify the signature using using the public key and identity rules supplied in the policy and if verified similarly mutates the image name to a digest referencee to ensure that concurrent tag changes cannot influence the image being puuled.
While it is possible to require both DCT and Simple signing, alternatives are *not* allowed, if both are required conflicting digests will cause the image to be denied.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to put each of these sentences on their own line? If so, you need to put another newline between them - at the moment this renders to one block of text as before.

README.md Outdated
When you create or edit a workload, the Kubernetes API server sends a request to Portieris. The AdmissionRequest contains the content of your workload. For each image in your workload, Portieris finds a matching security policy. If trust enforcement is enabled in your policy, Portieris pulls signature information for your image from the corresponding Notary server and, if a signed version of the image exists, creates a JSON patch to edit the image name in the workload to the signed image by digest. If a signer is defined in the policy, Portieris additionally checks that the image is signed by the specified role, and verifies that the specified key was used to sign the image.
When you create or edit a workload, the Kubernetes API server sends a request to Portieris. The AdmissionRequest contains the content of your workload. For each image in your workload, Portieris finds a matching security policy.
If trust enforcement is enabled in the policy, Portieris pulls signature information for your image from the corresponding Notary server and, if a signed version of the image exists, creates a JSON patch to edit the image name in the workload to the signed image by digest. If a signer is defined in the policy, Portieris additionally checks that the image is signed by the specified role, and verifies that the specified key was used to sign the image.
If simple signing is specified by the policy, Portieris will verify the signature using using the public key and identity rules supplied in the policy and if verified similarly mutates the image name to a digest referencee to ensure that concurrent tag changes cannot influence the image being puuled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typos: referencee, puuled

README.md Outdated
When you create or edit a workload, the Kubernetes API server sends a request to Portieris. The AdmissionRequest contains the content of your workload. For each image in your workload, Portieris finds a matching security policy.
If trust enforcement is enabled in the policy, Portieris pulls signature information for your image from the corresponding Notary server and, if a signed version of the image exists, creates a JSON patch to edit the image name in the workload to the signed image by digest. If a signer is defined in the policy, Portieris additionally checks that the image is signed by the specified role, and verifies that the specified key was used to sign the image.
If simple signing is specified by the policy, Portieris will verify the signature using using the public key and identity rules supplied in the policy and if verified similarly mutates the image name to a digest referencee to ensure that concurrent tag changes cannot influence the image being puuled.
While it is possible to require both DCT and Simple signing, alternatives are *not* allowed, if both are required conflicting digests will cause the image to be denied.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps:

While it is possible to require both Notary and simple signing, the two methods must agree on the signed digest for the image. If the two methods return different signed digests, the image is denied.

// convert digest to patch
glog.Infof("Mutation #: %s %d Image name: %s", containerType, containerIndex, img.String())
if strings.Contains(container.Image, img.String()) {
// TODO: seems odd to have both tag and digest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a TODO and should be investigated, it is not a change from master, would an issue be better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made an issue #90

if key, ok := secret.Data["key"]; ok {
return key, nil
}
return nil, fmt.Errorf("Secret %q in %q does not contain a \"key\" attribte", secretName, namespace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: attribte

assert.Contains(t, err.Error(), tt.errMsg, "unexpected error")
} else {
assert.NoError(t, err)
//assert.Equal(t, tt.wantList, got)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commented out intentionally?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted is better

@molepigeon molepigeon merged commit 8a5adaf into master Mar 26, 2020
@molepigeon molepigeon deleted the atomic2 branch March 26, 2020 12:25
tim-gp pushed a commit to tim-gp/portieris that referenced this pull request Oct 1, 2020
* save

* wip-save

* unused

* wip-2

* wip

* wip

* pr check

* makefile fmt

* no dep on gpgme

* vet

* fix test invoke

* trust and simple concurrenltly

* review issues

* ease local testing

* improve ut tests

* e2e.simple

* README less DCT specific

* multiple simple policies and tests

* keys from secrets

* doc typos, code cleanliness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants