-
Notifications
You must be signed in to change notification settings - Fork 187
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
Support AWS KMS credentials using decryption secretRef #641
Conversation
4fb4b50
to
92851a2
Compare
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.
Please extend the documentation to cover AWS KMS:
- Explain static keys here https://github.com/fluxcd/kustomize-controller/blob/main/docs/spec/v1beta2/kustomization.md#decryption-secret-reference
- Explain IRSA here https://github.com/fluxcd/kustomize-controller/blob/main/docs/spec/v1beta2/kustomization.md#controller-global-decryption
PS. For IRSA you can take some of the info from https://fluxcd.io/docs/guides/mozilla-sops/#encrypting-secrets-using-various-cloud-providers
@stefanprodan I think it might be redundant to explain IRSA in both the sops guide and the kustomization docs, since IRSA is sufficiently explained in the sops guide (the wording can be improved to be clearer though), so maybe we can link that guide in the kustomization docs? |
@aryan9600 it's fine to link to the guide, but we need a section like this one https://github.com/fluxcd/kustomize-controller/blob/main/docs/spec/v1beta2/kustomization.md#gcp-kms for AWS. |
@stefanprodan we already have that, if i'm not mistaken: https://github.com/fluxcd/kustomize-controller/blob/main/docs/spec/v1beta2/kustomization.md#aws. we could add the link to the sops guide (and make the guide clearer) in this section? |
There is no documentation which instructs how to supply a SecretRef and what data the Secret must contain for AWS. Which is explained in detail for any other custom implementation we have. See: https://github.com/fluxcd/kustomize-controller/blob/main/docs/spec/v1beta2/kustomization.md#azure-key-vault-secret-entry |
Yep, I'm working on that, I was talking about the ISRA stuff 😅 |
2e62ca8
to
6477928
Compare
7134c39
to
4a25078
Compare
Fuzzing tests are failing because of invalid fuzzing tests in |
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.
This is shaping up well, couple of nitpicks mostly around making our lives easier when we look at this again in a couple months 😄
6bfdba4
to
2942001
Compare
internal/sops/awskms/keysource.go
Outdated
// CredsProvider is a wrapper around aws.CredentialsProvider used for authenticating | ||
// when using AWS KMS. |
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.
// CredsProvider is a wrapper around aws.CredentialsProvider used for authenticating | |
// when using AWS KMS. | |
// CredsProvider is a wrapper around aws.CredentialsProvider used for authenticating | |
// towards AWS KMS. |
internal/sops/awskms/keysource.go
Outdated
// createKMSConfig returns a Config configured with the appropriate credentials. | ||
func (key MasterKey) createKMSConfig() (*aws.Config, error) { | ||
// Uses the credentialsProvider if present, otherwise default to reading credentials | ||
// from the enviornment. |
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.
// from the enviornment. | |
// from the environment. |
internal/sops/awskms/keysource.go
Outdated
} | ||
|
||
// ToMap converts the MasterKey to a map for serialization purposes. | ||
func (key MasterKey) ToMap() map[string]interface{} { |
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.
This should be above private methods.
internal/sops/awskms/keysource.go
Outdated
// epResolver IS ONLY MEANT TO BE USED FOR TESTS. | ||
// it can be used to override the endpoint that the AWS client resolves to | ||
// by default. it's hacky but there is no other choice, since you can't | ||
// specify the endpoint as an env var like you can do with an access key. | ||
epResolver aws.EndpointResolver |
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.
// epResolver IS ONLY MEANT TO BE USED FOR TESTS. | |
// it can be used to override the endpoint that the AWS client resolves to | |
// by default. it's hacky but there is no other choice, since you can't | |
// specify the endpoint as an env var like you can do with an access key. | |
epResolver aws.EndpointResolver | |
// epResolver can be used to override the endpoint the AWS client resolves | |
// to by default. This is mostly used for testing purposes as it can not be | |
// injected using e.g. an environment variable. The field is not publicly | |
// exposed, nor configurable. | |
epResolver aws.EndpointResolver |
internal/sops/keyservice/options.go
Outdated
@@ -56,6 +57,16 @@ func (o WithAgeIdentities) ApplyToServer(s *Server) { | |||
s.ageIdentities = age.ParsedIdentities(o) | |||
} | |||
|
|||
// WithAWSKeys configurs the AWS credentials on the Server |
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.
// WithAWSKeys configurs the AWS credentials on the Server | |
// WithAWSKeys configures the AWS credentials on the Server. |
@@ -43,6 +44,11 @@ type Server struct { | |||
// When nil, the request will be handled by defaultServer. | |||
azureToken *azkv.Token | |||
|
|||
// awsCredsProvider is the Credentials object used for Encrypt and Decrypt | |||
// operations of AWS KMS requests. | |||
// When nil, the request will be handled by defaultServer. |
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.
This is no longer correct.
2942001
to
b9a3ca6
Compare
b9a3ca6
to
8b907d3
Compare
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.
Stellar job 💯
8b907d3
to
000d6db
Compare
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.
two tiny nits, apart from that LGTM
great work @aryan9600!
000d6db
to
3be256f
Compare
What are we going to do about fuzzing? We can't merge this and have all PRs from now on failing. Can we disable the AWS tests? |
We will disable them for the time being whilst we wait for the fix upstream. The approach we discussed so far is picking a different conditional tag for our own fuzz tests. |
cf31abd
to
28d40d7
Compare
Signed-off-by: Sanskar Jaiswal <[email protected]>
Signed-off-by: Sanskar Jaiswal <[email protected]>
Signed-off-by: Sanskar Jaiswal <[email protected]>
Signed-off-by: Sanskar Jaiswal <[email protected]>
Signed-off-by: Sanskar Jaiswal <[email protected]>
8873d41
to
3f61e59
Compare
Signed-off-by: Sanskar Jaiswal <[email protected]>
3f61e59
to
d7307bb
Compare
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.
Great job @aryan9600! 👏 👏
LGTM
Can we please change the license on this ( |
Signed-off-by: Sanskar Jaiswal <[email protected]>
Adds support for using
.spec.decryption
to refer to custom AWS KMS credentials and override global decryption configuration.Signed-off-by: Sanskar Jaiswal [email protected]