[ 
https://issues.apache.org/jira/browse/HBASE-24184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

tianhang tang updated HBASE-24184:
----------------------------------
    Description: 
For the owner of snapshots(not global admin user), currently list_snapshots 
returns empty if i just use simple acls for authorization but not use 
authentication.

The code in AccessController.preListSnapshot:
{code:java}
if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)) {
// list it, if user is the owner of snapshot
AuthResult result = AuthResult.allow("listSnapshot " + snapshot.getName(),
"Snapshot owner check allowed", user, null, null, null);
accessChecker.logResult(result);
}{code}
And SnapshotManager.takeSnapshotInternal:
{code:java}
if (User.isHBaseSecurityEnabled(master.getConfiguration()) && user != null) {
  builder.setOwner(user.getShortName());
}
{code}
User.isHBaseSecurityEnabled:
{code:java}
public static boolean isHBaseSecurityEnabled(Configuration conf) {
  return "kerberos".equalsIgnoreCase(conf.get(HBASE_SECURITY_CONF_KEY));
}
{code}
So i think the logic of setOwner is used for authorization, not authentication, 
SnapshotManager should not only setOwner when hbase.security.authentication = 
kerberos, which cause listSnapshots returns empty when i just use simple acls.

  was:
For the owner of snapshots(not global admin user), currently list_snapshots 
returns empty if i just use simple acls for authorization but not use 
authentication.

The code in AccessController.preListSnapshot:
{code:java}
if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)) {
// list it, if user is the owner of snapshot
AuthResult result = AuthResult.allow("listSnapshot " + snapshot.getName(),
"Snapshot owner check allowed", user, null, null, null);
accessChecker.logResult(result);
}{code}
 

And SnapshotManager.takeSnapshotInternal:
{code:java}
if (User.isHBaseSecurityEnabled(master.getConfiguration()) && user != null) {
  builder.setOwner(user.getShortName());
}
{code}
User.isHBaseSecurityEnabled:
{code:java}
public static boolean isHBaseSecurityEnabled(Configuration conf) {
  return "kerberos".equalsIgnoreCase(conf.get(HBASE_SECURITY_CONF_KEY));
}
{code}
So i think the logic of setOwner is used for authorization, not authentication, 
SnapshotManager should not only setOwner when hbase.security.authentication = 
kerberos, which cause listSnapshots returns empty when i just use simple acls.


> listSnapshots returns empty when just use simple acl but not use 
> authentication
> -------------------------------------------------------------------------------
>
>                 Key: HBASE-24184
>                 URL: https://issues.apache.org/jira/browse/HBASE-24184
>             Project: HBase
>          Issue Type: Bug
>          Components: snapshots
>            Reporter: tianhang tang
>            Assignee: tianhang tang
>            Priority: Minor
>
> For the owner of snapshots(not global admin user), currently list_snapshots 
> returns empty if i just use simple acls for authorization but not use 
> authentication.
> The code in AccessController.preListSnapshot:
> {code:java}
> if (SnapshotDescriptionUtils.isSnapshotOwner(snapshot, user)) {
> // list it, if user is the owner of snapshot
> AuthResult result = AuthResult.allow("listSnapshot " + snapshot.getName(),
> "Snapshot owner check allowed", user, null, null, null);
> accessChecker.logResult(result);
> }{code}
> And SnapshotManager.takeSnapshotInternal:
> {code:java}
> if (User.isHBaseSecurityEnabled(master.getConfiguration()) && user != null) {
>   builder.setOwner(user.getShortName());
> }
> {code}
> User.isHBaseSecurityEnabled:
> {code:java}
> public static boolean isHBaseSecurityEnabled(Configuration conf) {
>   return "kerberos".equalsIgnoreCase(conf.get(HBASE_SECURITY_CONF_KEY));
> }
> {code}
> So i think the logic of setOwner is used for authorization, not 
> authentication, SnapshotManager should not only setOwner when 
> hbase.security.authentication = kerberos, which cause listSnapshots returns 
> empty when i just use simple acls.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to