hani-fouladgar opened a new pull request, #12087:
URL: https://github.com/apache/ozone/pull/12087

   ## What changes were proposed in this pull request?
   
   HDDS-13890 added support for adding SCMs to a running datanode with `ozone 
admin reconfig --service=DATANODE`. On a Kerberos-enabled cluster, the 
reconfiguration reports success, but the datanode can't connect to the new 
SCMs. Each attempt fails with `GSS initiate failed [Caused by GSSException: No 
valid credentials provided]`, so the new SCMs stay in safemode. Connections to 
the existing SCMs still work, and restarting the datanode fixes it.
   
   **Root cause:** `ReconfigurableBase.startReconfigurationTask()` starts the 
reconfiguration thread from inside the RPC handler, which runs as the remote 
caller. The new thread inherits the identity of the admin who ran the CLI. 
`SCMConnectionManager.buildScmEndpoint()` then created the SCM RPC proxy with 
`UserGroupInformation.getCurrentUser()`, which on that thread is the caller's 
remote UGI. That UGI has no Kerberos credentials. At startup the current user 
is the datanode's keytab login user, which is why existing endpoints and a 
restart work.
   
   **Fix:** `buildScmEndpoint()` now creates the proxy with 
`UserGroupInformation.getLoginUser()`. The datanode→SCM connection then always 
authenticates as the datanode, whichever thread builds it. This also covers 
endpoints rebuilt by `refreshSCMServer()`.
   
   **Security considerations:** the datanode's identity is not exposed to 
callers.
   - Reconfiguration is admin-only (`checkAdminPrivilege`).
   - The new SCM addresses are read from the datanode's own `ozone-site.xml`, 
not taken from the RPC request.
   - The resulting connection is the same one the datanode would open after a 
restart.
   
   The register, heartbeat and report traffic on this proxy is the datanode's 
own, so it should run under the datanode's identity rather than the CLI user's.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17762
   
   ## How was this patch tested?
   
   - Added 
`TestSCMConnectionManager#addSCMServerUsesLoginUserWhenCalledAsRemoteUser`. It 
calls `addSCMServer` inside 
`UserGroupInformation.createRemoteUser("admin").doAs(...)` and checks that the 
SCM RPC proxy is created with the login user. It fails without the fix, because 
the proxy is created as `admin`, and passes with it.
   - Ran the existing `TestSCMConnectionManager` tests and checkstyle on 
`hdds-container-service`; all pass.


-- 
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]

Reply via email to