NC | CLI | List Accounts When Decrypt Access Keys Fails #8781
+152
−21
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.
Explain the changes
return_encrypted_on_decryption_error
and we will neither return thesecret_key
nor theencrypted_secret_key
in case of failure of access keys decryption.get_identity_config_data
add a case in try-catch clause for the decryption failure and add the property ofdecryption_err
in case there was failure of access keys decryption that is related toINVALID_MASTER_KEY
and remove theencrypted_secret_key
property (added a helper function for that).test_nc_account_invalid_mkm_integration.test.js
so we can add additional account and rename the filemaster_keys.json
for the test.Issues:
Testing Instructions:
Automatic Tests:
Please run:
sudo npx jest test_nc_account_invalid_mkm_integration.test.js -t 'cli with renamed master key file'
npx jest test_config_fs.test.js -t 'remove_encrypted_secret_key'
Manual Tests
sudo node src/cmd/manage_nsfs account add --name <account-name> --new_buckets_path /Users/buckets/ --access_key <access-key> --secret_key <secret-key> --uid <uid> --gid <gid>
Note: before creating the account need to give permission to the
new_buckets_path
:chmod 777 /Users/buckets/
.master_key.json
:sudo mv /etc/noobaa.conf.d/master_keys.json /etc/noobaa.conf.d/temp_master_keys.json
sudo node src/cmd/manage_nsfs account list --wide --show_secrets
(should not fail, but you will see the propertyencrypted_secret_key
anddecryption_err
).sudo node src/cmd/manage_nsfs account status --name <account-name> --show_secrets
(will fail - we didn't handle this case).Before this fix we had this error (added partial output):