Repository navigation
HBASE-30578 Fix null-user ACL failures on master HBCK and Operation Details pages - #8936
jackMintao wants to merge 1 commit into
Conversation
…etails pages The master web UI JSPs invoke MasterRpcServices in-process through the short-circuit connection. Such calls have no RpcServer request user, so with hbase.security.authorization=true RSRpcServices.requirePermission sees a null user and denies the request: Insufficient permissions for user 'null' (global, action=ADMIN) This makes /hbck.jsp show errors for runHbckChore/runCatalogScan and makes /operationDetails.jsp return HTTP 500 for getLogEntries. Fix the two pages locally instead of widening RSRpcServices.requirePermission for every in-process ADMIN RPC: - operationDetails.jsp reads BalancerDecision/BalancerRejection directly from master.getNamedQueueRecorder(), like rsOperationDetails.jsp, instead of going through Admin#getLogEntries -> MasterRpcServices#getLogEntries. - hbck.jsp only calls HbckChore#runChore() and CatalogJanitor#scan() when InfoServer.canUserModifyUI() allows the request. Otherwise it shows the cached reports with an informational message. This prevents arbitrary or read-only UI visitors from triggering writes/metadata GC via a GET. RSRpcServices#requirePermission is deliberately unchanged so remote and in-process ADMIN RPC authorization is not broadened.
| pageContext.setAttribute("pageTitle", "HBase Master HBCK Report: " + master.getServerName()); | ||
| String hbckChoreErrorMessage = null; | ||
| final boolean canModifyUI = | ||
| InfoServer.canUserModifyUI(request, getServletContext(), master.getConfiguration()); |
There was a problem hiding this comment.
InfoServer.canUserModifyUI(request, getServletContext(), master.getConfiguration()) needs hbase.security.authentication.ui=kerberos, hadoop.security.authorization=true and hbase.master.ui.readonly=true, and it never reads hbase.security.authorization.
On a default cluster (hbase.security.authorization=false and non-Kerberos UI) the page therefore stops refreshing, and it shows the "read-only or not authorized" message. Today it refreshes, because NoopAccessChecker allows the runHbckChore/runCatalogScan without permission check.
Could we skip the gate when authorization is off: !readonly && (!AccessChecker.isAuthorizationSupported(conf) || InfoServer.canUserModifyUI(...))? Please validate my suggestion before applying it directly.
| } | ||
| if (cj != null) { | ||
| try { | ||
| cj.scan(); |
There was a problem hiding this comment.
The gate is the web UI admin list (hbase.security.authentication.spnego.admin.users/.groups), which is separate from HBase's global ADMIN (hbase:acl grants, superusers). cj.scan() garbage-collects merged and split parents, and HBASE-19400 added the ADMIN check on runCatalogScan. With this change a UI admin who has no HBase ADMIN can trigger it from a plain GET. Is that intended?
If not, could we also call master.getAccessChecker().requirePermission(webUser, ..., ADMIN) and show the info message on AccessDeniedException? A test with a UI admin who lacks HBase ADMIN would document either choice.
| List<RecentLogs.BalancerRejection> logList = Collections.emptyList(); | ||
| List<RecentLogs.BalancerDecision> decisionList = Collections.emptyList(); | ||
| if (master.isInitialized()) { | ||
| NamedQueueRecorder namedQueueRecorder = master.getNamedQueueRecorder(); |
There was a problem hiding this comment.
This also drops the ADMIN check that MasterRpcServices.getLogEntries applied to these reads, so the page now returns balancer decisions and rejections (including region plans) without ADMIN check.
Could we keep the same rule for this page, for example by checking ADMIN for the web user and showing an info note to others? If the open read is intended, could that be stated in the PR and split into its own JIRA?
JIRA: https://issues.apache.org/jira/browse/HBASE-30578
Problem
When
hbase.security.authorization=true, two master Web UI pages fail:/hbck.jsp(without?cache=true) showsInsufficient permissions for user 'null' (global, action=ADMIN)for bothrunHbckChoreandrunCatalogScan, and no new report is generated./operationDetails.jspreturns HTTP 500 with the sameAccessDeniedException.Both JSPs call master RPC services in-process.
master.getConnection()is ashort-circuit connection, so the JSP Jetty thread has no
RpcServer.CurCall;RSRpcServices.requirePermissiontherefore checks anulluser and denies.Fix
Keep
RSRpcServices.requirePermissionunchanged and fix the two pages at thepage boundary:
operationDetails.jspreadsBalancerDecision/BalancerRejectiondirectlyfrom
master.getNamedQueueRecorder(), matchingrsOperationDetails.jsp,instead of going through
Admin#getLogEntries -> MasterRpcServices#getLogEntries.hbck.jsponly callsHbckChore#runChore()andCatalogJanitor#scan()when
InfoServer.canUserModifyUI()allows the request. Otherwise it showsthe cached reports with an informational message. This prevents read-only or
unauthorized UI visitors from triggering writes/metadata GC via a plain GET.
A generic fallback in
RSRpcServices.requirePermissionwas deliberately notused: it would affect every in-process ADMIN-level RPC, not just these pages.
Tests
TestInfoServers#testHbckAndOperationDetailsReadOnly:read-only mode shows the informational message and
No Report created.(proves
runChorewas skipped), no error/ACL alert;/operationDetails.jsprenders.TestInfoServersACL#testHbckPagePermissions:with
hbase.security.authorization=true(MiniKdc/SPNEGO), the admin gets noread-only message, no error alert, no ACL error and a generated report; the
non-admin gets the read-only/cached-report message; the admin
/operationDetails.jspreturns HTTP 200 andOperations DetailswithoutACL errors. Before this fix it returned HTTP 500 in this environment.
mvn test-compile:BUILD SUCCESS.before, hbck had the two ACL errors and operationDetails was HTTP 500;
after, both pages are HTTP 200 with no ACL errors, read-only requests do not
change the CatalogJanitor report time, the authorized test path generates
reports, and a remote non-superuser is still denied for
catalogjanitor_run/get_balancer_decisions.Behavior note
InfoServer.canUserModifyUI()requireshbase.master.ui.readonly=false,Kerberos UI authentication,
hadoop.security.authorization=true, and a UIadministrator. In simple-auth clusters
/hbck.jspno longer auto-triggerschores; it shows cached reports and points admins to
hbck_chore_run/catalogjanitor_run. This matches the existingtable.jsp/snapshot.jspread-only behavior and avoids unauthenticated GET-triggered writes.
RSRpcServicesis untouched; remote RPC ACL behavior is unchanged.