Skip to content

support KMS key for EBS encryption - #303

Merged
openshift-merge-robot merged 2 commits into
openshift:masterfrom
abhinavdahiya:encyrpted_key_id
Mar 16, 2020
Merged

openshift-merge-robot merged 2 commits into
openshift:masterfrom
abhinavdahiya:encyrpted_key_id

Conversation

@abhinavdahiya

@abhinavdahiya abhinavdahiya commented Mar 12, 2020 •

Copy link
Copy Markdown

For encyrpted EBS volumes allow users to provide ARN to the KMS keys to use. It uses the ID > ARN preference order similar to other functions

  • Why only ID and ARN?

the KMS keys don't really support filtering the KMS keys based on tags. 1 & 2

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 12, 2020

@JoelSpeed JoelSpeed Mar 13, 2020 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

// Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed
// CMK under which the EBS volume is encrypted.

Looking at the API reference it suggests a Key ID can also be used? If that's possible then we should probably support it.
Alternatively, if we don't want to, or it's not, maybe this should just be KMSKeyARN *string instead to not give the option to specify the ID?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Looking at the API reference it suggests a Key ID can also be used? If that's possible then we should probably support it.
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EbsBlockDevice.html

yeah looking at the docs, it seems like both ID and ARN styles are supported. So maybe we can support both. what the preference order between ID and ARN? I can make that change @JoelSpeed

Alternatively, if we don't want to, or it's not, maybe this should just be KMSKeyARN *string instead to not give the option to specify the ID?

Even if we do just want to support ARN, using the reference allows us to support filters at a later stage, when maybe AWS starts supporting that.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A quick look through the code suggests that ID is preferred as every other use is either just the ID or ID then filter, so I'd suggest ID then ARN in this case

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@JoelSpeed fixed in 2d397b5

For encyrpted EBS volumes allow users to provide ARN to the KMS keys to use. It uses the ID > ARN preference order similar to other functions

- Why only ID and ARN?

the KMS keys don't really support filtering the KMS keys based on tags. [1] & [2]

[1]: https://docs.aws.amazon.com/cli/latest/reference/kms/index.html#cli-aws-kms
[2]: https://docs.aws.amazon.com/cli/latest/reference/kms/describe-key.html

@JoelSpeed JoelSpeed left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2020
@abhinavdahiya

Copy link
Copy Markdown
Author

#303 (comment)

/assign @bison

},
}

if aws.StringValue(blockDeviceMappings[0].EBS.KMSKey.ID) != "" {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

may be include a v(3) log for each branch?

@abhinavdahiya abhinavdahiya Mar 16, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

hmm..

  • I don't see any such logging for other AWS References objects?
  • Also even if we log this, it can't be tied back the machine as there is no such context available.

but added it to f35cbbff @enxebre

@enxebre

enxebre commented Mar 16, 2020

Copy link
Copy Markdown
Member

/retest

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2020
@enxebre

enxebre commented Mar 16, 2020

Copy link
Copy Markdown
Member

/approve

@openshift-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 16, 2020
- When using the ARN for KMS key, the log output doesn't include the ARN value as it contains the AWS account ID which is usually sensitive.
- This current setup doesn't have a great way to tie EBS volume to the machine object, and therefore this log will be difficult to tie back to the machine object.
  which reduces the value to some degree.

@JoelSpeed JoelSpeed left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2020
@openshift-bot

Copy link
Copy Markdown

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot

Copy link
Copy Markdown

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
openshift-merge-robot merged commit 923caeb into openshift:master Mar 16, 2020
@enxebre

enxebre commented Apr 8, 2020 •

Copy link
Copy Markdown
Member

@abhinavdahiya are we e2e testing this with a user provided KMS key somewhere?
It seems to me that for customer managed keys we'd want to ensure that the installer (for masters) and the machine-api user (via cloud credentials operator) has the necessary permissions.
i.e.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "kms:Decrypt",
                "kms:Encrypt",
                "kms:RevokeGrant",
                "kms:GenerateDataKey",
                "kms:GenerateDataKeyWithoutPlaintext",
                "kms:DescribeKey",
                "kms:CreateGrant",
                "kms:ListGrants"
            ],
            "Resource": "*"
        }
    ]
}

Otherwise we are assuming them to be accessible for all principals by default, which might not necessarily be the case.

This popped out here https://bugzilla.redhat.com/show_bug.cgi?id=1815219. Although that is seeing in 4.3 the scenario is comparably here. Thoughts?
cc @JoelSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants