smengcl opened a new pull request, #11868: URL: https://github.com/apache/ozone/pull/11868
Generated-by: Claude Code (Opus 5.5) ## What changes were proposed in this pull request? With `hadoop.security.authorization=true`, SCM and Recon accept `StorageContainerDatanodeProtocol` and `ReconDatanodeProtocol` calls from any principal the service ACL allows. HDFS `DatanodeProtocol` sets `clientPrincipal = dfs.datanode.kerberos.principal`, so the NameNode accepts it only from the DataNode principal. `StorageContainerDatanodeProtocolPB` and `ReconDatanodeProtocolPB` already declare `clientPrincipal`, but service authorization does not read them. `Server.authorize` loads the class named by `@ProtocolInfo`, which is the non PB interface, and `ServiceAuthorizationManager` reads `@KerberosInfo` from that class. Neither non PB interface had `clientPrincipal`, and HDDS-16245 removed `@KerberosInfo` from `StorageContainerDatanodeProtocol` entirely. `SecretKeyProtocolDatanode` keeps it for the same reason (HDDS-16246). This PR adds `clientPrincipal = hdds.datanode.kerberos.principal` to `@KerberosInfo` of `StorageContainerDatanodeProtocol` and `ReconDatanodeProtocol`. It only takes effect with Kerberos and `hadoop.security.authorization=true`. Operator visible effects in that setup: - Hadoop resolves `_HOST` from the caller's address and requires an exact match, so a Datanode that reaches SCM or Recon under a different hostname than the one in its principal is rejected. Datanodes already pass the same check on `SecretKeyProtocolDatanode` to SCM, so the new exposure is mainly Recon. - Freon `simulate-datanode` and `scm-throughput-benchmark` need the Datanode principal. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17613 ## How was this patch tested? Added `TestStorageContainerDatanodeProtocolPB#testServiceAuthorizationClientPrincipal`, which checks `SecurityUtil.getClientPrincipal` (what `ServiceAuthorizationManager` uses) on both non PB interfaces. It fails for each protocol when its `clientPrincipal` is removed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
