-
Notifications
You must be signed in to change notification settings - Fork 80
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
NC | NSFS | CLI | Make Update Account Tolerance to Missing Master Key #8236
Conversation
aebeaab
to
646b644
Compare
3bbee87
to
c429ba5
Compare
c429ba5
to
ed104eb
Compare
@romayalon I added the suggested changes. |
5cb88ef
to
3952711
Compare
I Converted it to draft since there was an issue after rebase with the health tests. |
3952711
to
1fd4d1e
Compare
Signed-off-by: shirady <[email protected]>
1fd4d1e
to
1ebcee4
Compare
if (decrypt_secret_key) config_data.access_keys = await nc_mkm.decrypt_access_keys(config_data); | ||
return config_data; | ||
} catch (err) { | ||
dbg.warn('get_identity_config_data: with config_file_path', config_file_path, 'got an error', err); | ||
if (err.code === 'ENOENT' && silent_if_missing) return; | ||
if (return_encrypted_if_decryption_fails && err.rpc_code === 'INVALID_MASTER_KEY') return config_data; |
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.
As we discussed,
This solution creates a new master key under the hood, which means it tries to solve a big issue (master key disappeared) without letting the customer know about it. I don't think this is how we should do that, let's take some time for design.
I'm worried about temporary failures that we will create a new master key instead of fixing the issue.
Closing for now - would need design (see this comment). |
Explain the changes
regenerate
andaccess_key
andsecret_key
) when we cannot decrypt the current access keys.config_fs
fix JSDoc of the functionget_identity_config_data
.mamage_nsfs
add JSDoc to the functionfetch_existing_account_data
.Issues: Fixed partially #8104
master_key_id
points to a missing master key, the commands:account update
andaccount status
in noobaa-cli (manage_nsfs) will fail with an error.Note: A missing master key can happen when the master keys that were previously used cannot be recovered due to some issue.
Testing Instructions:
Unit Tests
Please run:
sudo npx jest test_nc_nsfs_bucket_cli.test.js
(for the change in point number 2 in the changes above).sudo npx jest test_nc_account_invalid_mkm_integration.test.js
Manual Testing
A. Missing master key
sudo node src/cmd/manage_nsfs account add --name shira-1001 --new_buckets_path /tmp/nsfs_root1 --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 /tmp/nsfs_root1
.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
(doesn't fail, but you will see the propertyencrypted_secret_key
).sudo node src/cmd/manage_nsfs account status --name shira-1001 --show_secrets
(will fail).sudo node src/cmd/manage_nsfs account update --name shira-1001 --regenerate
orsudo node src/cmd/manage_nsfs account update --access_key <access-key-id> --secret_key <secret-key>
.