-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Generate datastore_crypto_key on install if not provided #266
Merged
Merged
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2845c03
allow structured .Values.st2.datastore_crypto_key
cognifloyd 1671330
generate datastore_crypto_key on install if not defined
cognifloyd f898ebd
typo fix
cognifloyd 6a83c12
update helm to use randBytes from sprig 3.2+
cognifloyd b76fe6d
newer version of helm
cognifloyd 98ee61e
fix template quotes
cognifloyd 7f2fd1d
reduce escaping in json
cognifloyd 4fba001
template default_datastore_crypto_key via yaml
cognifloyd ea8b857
add note about minimum required helm version
cognifloyd b99913b
add changelog entry
cognifloyd 61f5a2c
datastore_crypto_key is always required now
cognifloyd bed1b47
move default_datastore_crypto_key from values to conf file
cognifloyd bb37eaa
simplify datastore_crypto_key selection logic
cognifloyd b6ddc52
Merge branch 'master' into generate-crypto-key
cognifloyd 742d1ba
Merge branch 'master' into generate-crypto-key
cognifloyd ad8a4f8
Revert "datastore_crypto_key is always required now"
cognifloyd 2d44709
Allow disabling the datastore_crypto_key
cognifloyd bdf62be
handle unset datastore_crypto_key so ne can compare strings
cognifloyd 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 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This is used to generate st2.datastore_crypto_key on install if not defined in values. | ||
|
||
# The formula is based on an st2-specific version of python's base64.urlsafe_b64encode | ||
# randBytes returns a base64 encoded string | ||
# 32 bytes = 256 bits / 8 bits/byte | ||
|
||
aesKeyString: '{{ randBytes 32 | replace "+" "-" | replace "_" "/" | replace "=" "" }}' | ||
mode: CBC | ||
size: 256 | ||
|
||
hmacKey: | ||
hmacKeyString: '{{ randBytes 32 | replace "+" "-" | replace "_" "/" | replace "=" "" }}' | ||
size: 256 | ||
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
Looks like it's making the impossible possible :)
Overall I'm worried about the implementation and if that's a good way or not to try this in the chart really.
Even the slightest security risk behind the implementation/diff is sufficient to avoid the drill here generating the K/V crypto key.
I'd rely on someone better from the @StackStorm/tsc with security to review this. Maybe @punkrokk ?
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.
If there is a security issue with this formula, then st2-core would need to change, and every installation everywhere would have to update their datastore crypto key. This chart would, of course, also have to be updated to match whatever formula st2-core uses to generate these keys. I think the formula is easier to understand here than in st2-core, so it should be fairly simple to migrate this if ever needed in the future.
That said, I look forward to hearing what @punkrokk or other @StackStorm/TSC members have to say about this.
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.
No worries. To be clear, I'm good with this new feature itself.
However, I'm looking for feedback if the key generation here is cryptographically secure. I didn't look what st2 does under the hood, but I'd trust those who good at this and if trying to mimic the st2 behavior for st2-krypto-key-generation in the Helm template engine is good enough.
I think the folks would need to dig deeper into the code you provided 👍