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

ASF GitHub Bot updated HBASE-30578:
-----------------------------------
    Labels: pull-request-available  (was: )

> Master UI HBCK and Operation Details pages fail with AccessDeniedException 
> for user 'null' when authorization is enabled
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-30578
>                 URL: https://issues.apache.org/jira/browse/HBASE-30578
>             Project: HBase
>          Issue Type: Bug
>          Components: master, security, UI
>    Affects Versions: 2.6.7
>         Environment: * HBase 2.6.7 (Hadoop 3.4.3), JDK 8
>  * {{hbase.security.authorization=true}}
>  * {{AccessController}} loaded as master / regionserver / region coprocessor
>  * {{hbase:acl}} created
>  * Simple authentication for the reproduction; the same happens in a secure 
> cluster because the UI JSP calls are in-process
>            Reporter: mintao
>            Priority: Major
>              Labels: pull-request-available
>
> When HBase authorization is enabled, two master Web UI pages fail:
>  * {{/hbck.jsp}} (without {{{}?cache=true{}}}) shows: {{Failed generating a 
> new hbck_chore report; ... AccessDeniedException: Insufficient permissions 
> for user 'null' (global, action=ADMIN)}} and the same for 
> {{{}catalogjanitor_run{}}}; no new report is generated.
>  * {{/operationDetails.jsp}} returns HTTP 500 with the same 
> {{{}AccessDeniedException{}}}.
> The pages work when {{hbase.security.authorization=false}} (or when no ACL 
> check is hit), which makes the failure look like a UI problem. It is an 
> in-process RPC context problem.
>  
> h2. Steps to reproduce
>  # Configure {{hbase.security.authorization=true}} and load 
> {{AccessController}} on master and region servers.
>  # Start a 2.6.x cluster and wait for the master to be active.
>  # Open {{http://<master-info-host>:<port>/hbck.jsp}} (do not add 
> {{{}?cache=true{}}}).
>  # Open {{{}http://<master-info-host>:<port>/operationDetails.jsp{}}}.
> h2. Actual behavior
> {{/hbck.jsp}} returns HTTP 200 but contains two error alerts:
> 代码块
>  
> Failed generating a new hbck_chore report; using cache; try again or run
> hbck_chore_run in the shell: 
> org.apache.hadoop.hbase.security.AccessDeniedException:
> Insufficient permissions for user 'null' (global, action=ADMIN)
> Failed generating a new catalogjanitor report; using cache; try again or run
> catalogjanitor_run in the shell: 
> org.apache.hadoop.hbase.security.AccessDeniedException:
> Insufficient permissions for user 'null' (global, action=ADMIN)
> No Report created.}}
> {{/operationDetails.jsp}} returns HTTP 500:
> 代码块
>  
> org.apache.hadoop.hbase.security.AccessDeniedException:
> Insufficient permissions for user 'null' (global, action=ADMIN)}}
> The master log shows the matching path:
> 代码块
>  
> {{AccessChecker.requirePermission(AccessChecker.java:...)
> RSRpcServices.requirePermission(RSRpcServices.java:...)
> MasterRpcServices.getLogEntries(MasterRpcServices.java:...)
> (or MasterRpcServices.rpcPreCheck for runHbckChore/runCatalogScan)}}
> h2. Expected behavior
>  * {{/operationDetails.jsp}} displays the balancer decision/rejection 
> ring-buffer data.
>  * {{/hbck.jsp}} displays the cached reports and, when the UI is writable and 
> the requester is an authorized UI administrator, generates fresh HBCK / 
> CatalogJanitor reports.
>  * A read-only or unauthorized UI request must not be able to trigger 
> {{HbckChore#runChore()}} or {{CatalogJanitor#scan()}} (the latter performs 
> metadata GC after split/merge).
> h2. Root cause
> Both JSPs call master RPC services in-process:
>  * {{{}hbck.jsp{}}}: {{master.getMasterRpcServices().runHbckChore(null, 
> null)}} and {{{}runCatalogScan(null, null){}}}.
>  * {{{}operationDetails.jsp{}}}: 
> {{{}master.getConnection().getAdmin().getLogEntries(...){}}}.
> {{master.getConnection()}} is a {{{}ShortCircuitingClusterConnection{}}}; for 
> the local master it returns {{{}ShortCircuitMasterConnection{}}}, which calls 
> {{MasterRpcServices}} directly. No {{RpcServer.CurCall}} is set on the Jetty 
> thread, so {{RpcServer.getRequestUser()}} is empty.
> {{RSRpcServices.requirePermission}} currently does:
> java
>  
> {{accessChecker.requirePermission(RpcServer.getRequestUser().orElse(null), 
> request, null, perm);}}
> {{AuthManager.authorizeUserGlobal(null, action)}} returns false, so the ACL 
> check denies with user {{{}'null'{}}}. The same happens for {{rpcPreCheck}} 
> (runHbckChore/runCatalogScan) and {{{}getLogEntries{}}}.
> The HTTP user authenticated by the master Web UI is not propagated into the 
> RPC/ACL context.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to