-
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
NSFS | NC | IAM Service - Access Keys CRUD API Implementation #8119
Conversation
5874f8a
to
c70583f
Compare
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.
please squash commits
c70583f
to
7aa9ded
Compare
@guymguym I will squash before merging (you can leave the request for changes until then). |
1aa05e3
to
8520bd5
Compare
@shirady please squash to be ready to merge |
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.
see comments posted above
36e39fa
to
fda5b8d
Compare
ecffc64
to
238e76e
Compare
b846b7a
to
74456d7
Compare
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.
posted some comments above. is the signature_utils change stable?
521a32e
to
b738275
Compare
b738275
to
4e8c0c0
Compare
Testing Instructions - Manual Testing in Containerized Environment:BackgroundSince I changed the function Debugging addition:We added printings in Requirements:
S3 Test
STS test
INFO[0000] ✅ Exists: NooBaaAccount "user1"
INFO[0000] ✅ NooBaaAccount "user1" Phase is Ready
# NooBaaAccount spec:
allow_bucket_creation: false
default_resource: noobaa-default-backing-store
force_md5_etag: false
INFO[0000] ✅ Exists: Secret "noobaa-account-user1"
Connection info:
AWS_ACCESS_KEY_ID : <user1 access key id>
AWS_SECRET_ACCESS_KEY : <user1 secret key id>
{
“Credentials”: {
“AccessKeyId”: “<>”,
“SecretAccessKey”: “<>”,
“SessionToken”: “<>”,
“Expiration”: “<>”
},
“AssumedRoleUser”: {
“AssumedRoleId”: “<>:my-session”,
“Arn”: “arn:aws:sts::<>:assumed-role/my-role/my-session”
},
“PackedPolicySize”: 0
}
make_bucket failed: s3://test-bucket An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied Endpoint logs:
Note related to STS: function make_auth_token(object = {}, jwt_options = {}) {
// Remote services/endpoints should not sign tokens
// if (config.NOOBAA_AUTH_TOKEN) return config.NOOBAA_AUTH_TOKEN; //SDSD try
// create and return the signed token
return jwt.sign(object, get_jwt_secret(), jwt_options);
} |
0958460
to
2efdab5
Compare
1. Implement the functions related to access keys in AccountSpaceFS (CRUD). 2. Add more properties to nsfs_account_schema inside access_key object (all of them are not required): - creation_date = the date the access-key object was created. - deactivated = boolean (we need to translate it to status which is 'Active' or 'Inactive'). 3. Clean the account cache after updating the account config using the IAM API. 4. Remove unused errors that were copied from STS' errors in IamErrors. 5. Change the param name from user_name to username in the ops. 6. Remove the mock variables that we used in the IAM boilerplate implementation. 7. Update unit test for access_keys function in accountspace_fs. 8. Add unit test in account_schema_validation related to the schema changes. 9. Update Get Started section that would be the demo for IAM access keys management (docs/dev_guide/nc_nsfs_iam_developer_doc.md). 10. Changes in nc_master_key_manager to allow an access key object with more properties and add tests for the edited functions (encrypt_access_keys and decrypt_access_keys of account). 11. Add the support for denying a request whose access key status is Inactive (in all services: S3, STS, IAM). 12. Instead of copying the master_key_id from the root account, we now take the most updated master_key_id. 13. Add a new RPC code for a deactivated access key. 14. Edit the function authorize_request_account_by_token adding the access key deactivated check, but also throwing errors on every missing component instead of using optional chaining. Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
2efdab5
to
d416089
Compare
Explain the changes
AccountSpaceFS
(CRUD).nsfs_account_schema
insideaccess_key
object (all of them are not required):creation_date
= the date the access-key object was created.deactivated
= boolean (we need to translate it to status which is 'Active' or 'Inactive').IamErrors
.user_name
tousername
in the ops.accountspace_fs
.account_schema_validation
related to the schema changes.Get Started
section that would be the demo for IAM access keys management (docs/dev_guide/nc_nsfs_iam_developer_doc.md
).nc_master_key_manager
to allow an access key object with more properties and add tests for the edited functions (encrypt_access_keys
anddecrypt_access_keys
of account).Inactive
(in all services: S3, STS, IAM).master_key_id
from the root account, we now take the activemaster_key_id
.authorize_request_account_by_token
adding the access key deactivated check, but also throwing errors on every missing component instead of using optional chaining.Issues:
List of GAPs:
list_access_keys
implementation.NoobaaEvent
at this point.get_access_key_last_used
we send dummy values (region
,last_used_date
,service_name
).IamError
class to have a template message.Testing Instructions:
Unit Tests
Please run:
sudo npx jest test_accountspace_fs.test.js
npx jest test_iam_utils.test.js
npx jest test_nc_nsfs_account_schema_validation.test.js
sudo npx jest test_nc_master_keys.test.js
(the teardown removes what you have in/etc/noobaa.conf.d
).Manual Tests
IAM changes in NC NSFS
Currently, we do not validate the input, so the test should use only valid input.
sudo node src/cmd/manage_nsfs account add --name shira-1002 --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
.sudo node src/cmd/nsfs --debug 5 --https_port_iam 7005
Note: before starting the server please add this line:
process.env.NOOBAA_LOG_LEVEL = 'nsfs';
in the endpoint.js (before the conditionif (process.env.NOOBAA_LOG_LEVEL) {
)alias s3-nc-user-1-iam='AWS_ACCESS_KEY_ID=<acess-key> AWS_SECRET_ACCESS_KEY=<secret-key> aws --no-verify-ssl --endpoint-url https://localhost:7005'
.s3-nc-user-1-iam iam create-user --user-name Bob --path '/division_abc/subdivision_xyz/'
s3-nc-user-1-iam iam create-access-key --user-name Bob
s3-nc-user-1-iam iam get-access-key-last-used --access-key-id <access-key>
s3-nc-user-1-iam iam update-access-key --access-key-id <access-key> --user-name Bob --status Inactive
s3-nc-user-1-iam iam delete-access-key --access-key-id <access-key> --user-name Bob
s3-nc-user-1-iam iam list-access-keys --user-name Bob
Other
Since I changed the function
authorize_request_account_by_token
I also tested it in a containerized environment with the operator.