-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
KMS: on-demand key rotation #12342
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
KMS: on-demand key rotation #12342
Changes from 11 commits
d132b3b
3c0b110
b3e4043
ed9938f
e8f05e0
9594a82
c1afb6b
c44d62b
3d27bd9
ed64624
80f6a2f
c4bf067
b5a8bc2
b815b4f
4ac3a5a
111c0f4
86a5e5a
e9d77a4
c7d3f36
dfae403
1b16b8c
dae661a
0fab5ca
4efcb81
cdf1517
b76b522
1857312
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,7 @@ class KmsKey: | |
is_key_rotation_enabled: bool | ||
rotation_period_in_days: int | ||
next_rotation_date: datetime.datetime | ||
on_demand_rotation_start_date: datetime.datetime | ||
|
||
def __init__( | ||
self, | ||
|
@@ -284,6 +285,7 @@ def __init__( | |
self.crypto_key = KmsCryptoKey(self.metadata.get("KeySpec"), custom_key_material) | ||
self.rotation_period_in_days = 365 | ||
self.next_rotation_date = None | ||
self.on_demand_rotation_start_date = None | ||
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. For simplicity current implementation is limited to tracking a single on demand rotation. As part of implementing 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. After some discussion we've decided not to replicate AWS behavior for 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. This, along with @bentsku comment, are the last two things we need to address. After that, we're good to merge the PR 🚢 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. Both issues fixed 🚀 |
||
|
||
def calculate_and_set_arn(self, account_id, region): | ||
self.metadata["Arn"] = kms_key_arn(self.metadata.get("KeyId"), account_id, region) | ||
|
@@ -597,6 +599,9 @@ def _update_key_rotation_date(self) -> None: | |
days=self.rotation_period_in_days | ||
) | ||
|
||
def _update_on_demand_rotation_start_date(self) -> None: | ||
self.on_demand_rotation_start_date = datetime.datetime.now() | ||
|
||
agseco marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# An example of how the whole policy should look like: | ||
# https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-overview.html | ||
# The default statement is here: | ||
|
Uh oh!
There was an error while loading. Please reload this page.