Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -870,13 +870,17 @@ private KeyProvider.KeyVersion getDEK(FileEncryptionInfo feInfo)
OzoneKMSUtil.checkCryptoProtocolVersion(feInfo);
KeyProvider.KeyVersion decrypted = null;
try {
// Do proxy thing only when current UGI not matching with login UGI
// In this way, proxying is done only for s3g where
// s3g can act as proxy to end user.

// After HDDS-5881 the user will not be different,
// as S3G uses single RpcClient. So we should be checking thread-local
// S3Auth and use it during proxy.
UserGroupInformation loginUser = UserGroupInformation.getLoginUser();
if (!ugi.getShortUserName().equals(loginUser.getShortUserName())) {
UserGroupInformation proxyUser = UserGroupInformation.createProxyUser(
ugi.getShortUserName(), loginUser);
UserGroupInformation proxyUser;
if (getThreadLocalS3Auth() != null) {
UserGroupInformation s3gUGI = UserGroupInformation.createRemoteUser(
getThreadLocalS3Auth().getAccessID());
proxyUser = UserGroupInformation.createProxyUser(
s3gUGI.getShortUserName(), loginUser);
decrypted = proxyUser.doAs(
(PrivilegedExceptionAction<KeyProvider.KeyVersion>) () -> {
return OzoneKMSUtil.decryptEncryptedDataEncryptionKey(feInfo,
Expand Down