Skip to content
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

rgw: Rework of s3 LDAP Authentication code. #10307

Merged
merged 1 commit into from Aug 3, 2016

Conversation

pritha-srivastava
Copy link
Contributor

The LDAP authentication code has been reworked based
on the new authentication infrastructure.

Signed-off-by: Pritha Srivastava prsrivas@redhat.com

@pritha-srivastava
Copy link
Contributor Author

Things pending:

  1. Find appropriate files for class definitions.
  2. The old code for ldap handling has not been removed.
  3. The ACL bit is a little unclear to me.

{
//This is based on the assumption that the default acl strategy in
// get_perms_from_aclspec, will take care. Extra acl spec is not required.
return nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that -should- be true

@mattbenjamin
Copy link
Contributor

At a high level, this looks very good. Class definitions can go wherever, we need to support building with and without LDAP support. The code not removed is the actual auth hooks? Does this code actually run, then? I think the current ACL handling is correct, but :)

@pritha-srivastava
Copy link
Contributor Author

@mattbenjamin : This code runs. I replaced the logic in authorize_v2 with something similar to what is there for the swift authorize method and tested it, though I removed the test code before creating the PR.

@pritha-srivastava
Copy link
Contributor Author

@mattbenjamin : The code not removed is the piece which is there in authorize_v2. That bit can be removed when we have all the S3 AuthEngines in place. And the hooks like RGW_Auth_S3::init and init_impl and the respective variables.

@pritha-srivastava
Copy link
Contributor Author

@mattbenjamin : The code to build with and without ldap support is in rgw_ldap.h ( #if defined(HAVE_OPENLDAP)) . Is this what you were looking for or you meant something else?

@pritha-srivastava
Copy link
Contributor Author

Added code for specifying 'type' with the user. Also replaced some parts of the old code with the new AuthEngine and AuthApplier pieces.

@@ -149,6 +149,11 @@ void RGWRemoteAuthApplier::create_account(const rgw_user& acct_user,
{
rgw_user new_acct_user = acct_user;

if (!info.acct_type.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@mattbenjamin
Copy link
Contributor

The only significant point from my review is, I think, maybe preferring a non-string (perhaps an enumeration type) for account_type? Past that, is this ready to test?

@pritha-srivastava
Copy link
Contributor Author

@mattbenjamin : Reworked the 'type' related code based on your comment. Also, replaced other pieces of 'old' ldap code with the new one. And now have completely removed the old ldap code. This is ready to be tested.

enum RGWUserType
{
TYPE_NONE=0,
TYPE_KEYSTONE,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pritha-srivastava I'd put rgw first, then keystone and then ldap. Also, would make the value explicit (even though probably redundant)

@pritha-srivastava
Copy link
Contributor Author

@yehudasa : I have made changes related to the user source type. Can you please re-review.

@@ -427,6 +427,7 @@ void RGWUserInfo::dump(Formatter *f) const
encode_json("bucket_quota", bucket_quota, f);
encode_json("user_quota", user_quota, f);
encode_json("temp_url_keys", temp_url_keys, f);
encode_json("type", type, f);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pritha-srivastava maybe json encode this enum as a string, not as an int (e.g., look at rgw_meta_sync_info)

The LDAP authentication code has been reworked based
on the new authentication infrastructure.

Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
@mattbenjamin
Copy link
Contributor

mattbenjamin commented Aug 3, 2016

This will need a rebase due to refactoring for rebind(). I can do it, if you like?
Hmm, maybe not.
Never mind, no rebase needed.

@mattbenjamin
Copy link
Contributor

I've verified the LDAP auth behavior, including rebind. The one potential problem is related to the new stored user type: external-auth users already present in a cluster (e.g., RHCS 2.0) will be unable to authenticate. I worked around this by removing said users. We need a ruling on whether we need any accommodation (e.g., set user type?)

@mattbenjamin mattbenjamin changed the title [DNM] rgw: Rework of s3 LDAP Authentication code. rgw: Rework of s3 LDAP Authentication code. Aug 3, 2016
@mattbenjamin mattbenjamin merged commit f62f7ab into ceph:master Aug 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants