-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate db_encrypted_fields_keyfile
Pulpcore 3.15 will require a Fernet symmetric encryption key to encrypt certain sensitive database fields. This is expected to contain 32 pseudorandom bytes in url-safe base64-encoded format, with padding.
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'securerandom' | ||
|
||
Puppet::Functions.create_function(:'pulpcore::generate_fernet_key') do | ||
# @return 32 byte url-safe base64-encoded (with padding) Fernet symmetric encryption key | ||
dispatch :generate_fernet_key do | ||
return_type 'Pattern[/\A([a-zA-Z]|\d|-|_){43}=\z/]' | ||
end | ||
|
||
def generate_fernet_key | ||
SecureRandom.urlsafe_base64(32)+"=" | ||
end | ||
end |
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