This is an automated email from the ASF dual-hosted git repository.

smengcl pushed a commit to branch ozone-2.1
in repository https://gitbox.apache.org/repos/asf/ozone.git

commit 694cceef37bf5666064a8ffc6002c78a9d00b767
Author: Andy Huang <[email protected]>
AuthorDate: Thu Oct 15 12:07:18 2026 +0800

    HDDS-16842. Check admin rights in OM bootstrap RPC (#11502)
    
    (cherry picked from commit 347e210acd0a0e8f85efbc028732eaf4cfe4f542)
    
    Conflicts:
            
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMAdminRpcAuthorization.java
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../ozone/protocolPB/OMInterServiceProtocolServerSideImpl.java     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OMInterServiceProtocolServerSideImpl.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OMInterServiceProtocolServerSideImpl.java
index 444a1a5ef9c..031b75f05dc 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OMInterServiceProtocolServerSideImpl.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OMInterServiceProtocolServerSideImpl.java
@@ -17,10 +17,14 @@
 
 package org.apache.hadoop.ozone.protocolPB;
 
+import static org.apache.hadoop.hdds.utils.HddsServerUtil.getRemoteUser;
+import static 
org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.PERMISSION_DENIED;
+
 import com.google.protobuf.RpcController;
 import com.google.protobuf.ServiceException;
 import java.io.IOException;
 import org.apache.hadoop.ozone.om.OzoneManager;
+import org.apache.hadoop.ozone.om.exceptions.OMException;
 import org.apache.hadoop.ozone.om.helpers.OMNodeDetails;
 import org.apache.hadoop.ozone.om.protocolPB.OMInterServiceProtocolPB;
 import org.apache.hadoop.ozone.om.ratis.OzoneManagerRatisServer;
@@ -63,6 +67,9 @@ public BootstrapOMResponse bootstrap(RpcController controller,
         .build();
 
     try {
+      if (ozoneManager.isAdminAuthorizationEnabled() && 
!ozoneManager.isAdmin(getRemoteUser())) {
+        throw new OMException("Only administrators are authorized to perform 
bootstrap.", PERMISSION_DENIED);
+      }
       omRatisServer.addOMToRatisRing(newOmNode);
     } catch (IOException ex) {
       return BootstrapOMResponse.newBuilder()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to