You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2023/01/09 15:09:06 UTC

[GitHub] [hbase] curie71 opened a new pull request, #4951: HBASE-27528 log duplication issues in MasterRpcServices.

curie71 opened a new pull request, #4951:
URL: https://github.com/apache/hbase/pull/4951

   [HBASE-27528](https://issues.apache.org/jira/browse/HBASE-27528) MasterRpcServices record audit log in privileged operations **(grant, revoke)**.
   ```java
     public RevokeResponse revoke(RpcController controller, RevokeRequest request)
       throws ServiceException {
       try {
         ......
           server.cpHost.preRevoke(userPermission); // has audit log in AccessChecker
          ...... // removeUserPermission
           User caller = RpcServer.getRequestUser().orElse(null);
           if (AUDITLOG.isTraceEnabled()) {
             String remoteAddress = RpcServer.getRemoteAddress().map(InetAddress::toString).orElse("");
             AUDITLOG.trace("User {} (remote address: {}) revoked permission {}", caller,
               remoteAddress, userPermission); // duplicate auditlog
           }
           ......
     }
   ```
   but I found a path from `server.cpHost.preRevoke(userPermission);` to `AccessChecker audit log`
   (`preRevoke -> MasterCoprocessorHost.preRevoke -> AccessController.preRevoke -> preGrantOrRevoke -> accessChecker.requireXXXPermission -> logResult -> AUDITLOG.trace...`), which caused **log duplication**: 
   ```java
   public void requireGlobalPermission(User user, String request, Action perm, String namespace)
       throws IOException {
       AuthResult authResult;
       if (authManager.authorizeUserGlobal(user, perm)) {
         authResult = AuthResult.allow(request, "Global check allowed", user, perm, null);
         authResult.getParams().setNamespace(namespace);
         logResult(authResult);
       } else {
         authResult = AuthResult.deny(request, "Global check failed", user, perm, null);
         authResult.getParams().setNamespace(namespace);
         logResult(authResult);
         throw new AccessDeniedException(
           "Insufficient permissions for user '" + (user != null ? user.getShortName() : "null")
             + "' (global, action=" + perm.toString() + ")");
       }
     }
   ```
   the `logResult` auditlog contain all the infomation recorded by `MasterRpcServices.revoke` (`user, remote address, permission`) : 
   ```java
     public static void logResult(AuthResult result) {
       if (AUDITLOG.isTraceEnabled()) {
         User user = result.getUser();
         UserGroupInformation ugi = user != null ? user.getUGI() : null;
         AUDITLOG.trace(
           "Access {} for user {}; reason: {}; remote address: {}; request: {}; context: {};"
             + "auth method: {}",
           (result.isAllowed() ? "allowed" : "denied"),
           (user != null ? user.getShortName() : "UNKNOWN"), result.getReason(),
           RpcServer.getRemoteAddress().map(InetAddress::toString).orElse(""), result.getRequest(),
           result.toContextString(), ugi != null ? ugi.getAuthenticationMethod() : "UNKNOWN");
       }
     }
   ```
   Since **AccessChecker** integrates auditlogs for **permission check**, I'll delete the log in MasterRpcServices.
   And grant has the same problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] Apache9 commented on pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by GitBox <gi...@apache.org>.
Apache9 commented on PR #4951:
URL: https://github.com/apache/hbase/pull/4951#issuecomment-1386688621

   Request review from @apurtell and @wchevreuil. Will merge later if no objections.
   
   Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] Apache9 commented on pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by GitBox <gi...@apache.org>.
Apache9 commented on PR #4951:
URL: https://github.com/apache/hbase/pull/4951#issuecomment-1386673545

   I mean the removal seems OK, as if we do not enable AccessChecker, it does not make sense to call grant and revoke methods.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] Apache9 merged pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by GitBox <gi...@apache.org>.
Apache9 merged PR #4951:
URL: https://github.com/apache/hbase/pull/4951


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] Apache-HBase commented on pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on PR #4951:
URL: https://github.com/apache/hbase/pull/4951#issuecomment-1376187433

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   1m  7s |  Docker mode activated.  |
   | -0 :warning: |  yetus  |   0m  4s |  Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck  |
   ||| _ Prechecks _ |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   2m 38s |  master passed  |
   | +1 :green_heart: |  compile  |   0m 47s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   3m 50s |  branch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 27s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   2m 30s |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 47s |  the patch passed  |
   | +1 :green_heart: |  javac  |   0m 47s |  the patch passed  |
   | +1 :green_heart: |  shadedjars  |   4m 20s |  patch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 28s |  the patch passed  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  unit  | 218m  5s |  hbase-server in the patch passed.  |
   |  |   | 239m  4s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4951/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/4951 |
   | Optional Tests | javac javadoc unit shadedjars compile |
   | uname | Linux 44cb333c8455 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 3f1087fe82 |
   | Default Java | Eclipse Adoptium-11.0.17+8 |
   |  Test Results | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4951/1/testReport/ |
   | Max. process+thread count | 2579 (vs. ulimit of 30000) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4951/1/console |
   | versions | git=2.34.1 maven=3.8.6 |
   | Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] Apache9 commented on pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by GitBox <gi...@apache.org>.
Apache9 commented on PR #4951:
URL: https://github.com/apache/hbase/pull/4951#issuecomment-1376675022

   So the intention here is that, only if we have already enabled AccessChecker, calling grant and revoke is useful?
   AccessChecker is a coprocessor, so we will not always enable it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] curie71 commented on pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by "curie71 (via GitHub)" <gi...@apache.org>.
curie71 commented on PR #4951:
URL: https://github.com/apache/hbase/pull/4951#issuecomment-1399398660

   > I mean the removal seems OK, as if we do not enable AccessChecker, it does not make sense to call grant and revoke methods.
   
   Thanks for your review!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] Apache-HBase commented on pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on PR #4951:
URL: https://github.com/apache/hbase/pull/4951#issuecomment-1375892379

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   0m 17s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   2m 42s |  master passed  |
   | +1 :green_heart: |  compile  |   2m 21s |  master passed  |
   | +1 :green_heart: |  checkstyle  |   0m 34s |  master passed  |
   | +1 :green_heart: |  spotless  |   0m 43s |  branch has no errors when running spotless:check.  |
   | +1 :green_heart: |  spotbugs  |   1m 28s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   2m 32s |  the patch passed  |
   | +1 :green_heart: |  compile  |   2m 21s |  the patch passed  |
   | +1 :green_heart: |  javac  |   2m 21s |  the patch passed  |
   | +1 :green_heart: |  checkstyle  |   0m 35s |  the patch passed  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace issues.  |
   | +1 :green_heart: |  hadoopcheck  |   8m 36s |  Patch does not cause any errors with Hadoop 3.2.4 3.3.4.  |
   | +1 :green_heart: |  spotless  |   0m 40s |  patch has no errors when running spotless:check.  |
   | +1 :green_heart: |  spotbugs  |   1m 35s |  the patch passed  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  asflicense  |   0m 12s |  The patch does not generate ASF License warnings.  |
   |  |   |  30m 25s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4951/1/artifact/yetus-general-check/output/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/4951 |
   | Optional Tests | dupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile |
   | uname | Linux bf1addd02ddb 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/hbase-personality.sh |
   | git revision | master / 3f1087fe82 |
   | Default Java | Eclipse Adoptium-11.0.17+8 |
   | Max. process+thread count | 79 (vs. ulimit of 30000) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4951/1/console |
   | versions | git=2.34.1 maven=3.8.6 spotbugs=4.7.3 |
   | Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hbase] curie71 commented on pull request #4951: HBASE-27528 log duplication issues in MasterRpcServices.

Posted by GitBox <gi...@apache.org>.
curie71 commented on PR #4951:
URL: https://github.com/apache/hbase/pull/4951#issuecomment-1376685476

   > 
   
   I see, so the AccessChecker log access deny/allow at warn/info level may solve the log duplication problems?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org