-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-1796. Add admin access check for write opertaions in SCMClientProtocolServer and SCMBlockProtocolServer. #5203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2cad7af
HDDS-1796. SCMClientProtocolServer#getContainerWithPipeline should ch…
08ee455
HDDS-1796. SCMClientProtocolServer#getContainerWithPipeline should ch…
ff4b93f
HDDS-1796. Fix for s3g secure acceptance tests failing.
24be0da
HDDS-1796. Fix for s3g secure acceptance tests failing.
b4f8d7e
HDDS-1796. Fix for s3g secure acceptance tests failing.
5a9a9e4
HDDS-1796. Fix for s3g secure acceptance tests failing.
b4ebf91
HDDS-1796. Fix for s3g secure acceptance tests failing.
a2af114
HDDS-1796. Fix for s3g secure acceptance tests failing.
adfa985
HDDS-1796. Fix for s3g secure acceptance tests failing.
e44f89f
HDDS-1796. Fix for s3g secure acceptance tests failing.
e656507
HDDS-1796. Fix for s3g secure acceptance tests failing.
8118063
HDDS-1796. Fix for s3g secure acceptance tests failing.
9d55be2
reset user in container.robot
ChenSammi 78cb77b
HDDS-1796. Removed checkAdminAccess for some SCM APIs.
6a9ef65
Merge remote-tracking branch 'origin/master' into HDDS-1796
3c7ba63
Merge branch 'HDDS-1796' of github.com:devmadhuu/ozone into HDDS-1796
ee5fc9e
HDDS-1796. Removed checkAdminAccess for some SCM APIs.
6875544
HDDS-1796. Removed checkAdminAccess for some SCM APIs.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -300,7 +300,7 @@ private ContainerWithPipeline getContainerWithPipelineCommon( | |
| @Override | ||
| public ContainerWithPipeline getContainerWithPipeline(long containerID) | ||
| throws IOException { | ||
| getScm().checkAdminAccess(null, true); | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
|
|
||
| try { | ||
| ContainerWithPipeline cp = getContainerWithPipelineCommon(containerID); | ||
|
|
@@ -321,6 +321,7 @@ public ContainerWithPipeline getContainerWithPipeline(long containerID) | |
| @Override | ||
| public List<HddsProtos.SCMContainerReplicaProto> getContainerReplicas( | ||
| long containerId, int clientVersion) throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| List<HddsProtos.SCMContainerReplicaProto> results = new ArrayList<>(); | ||
|
|
||
| Set<ContainerReplica> replicas = getScm().getContainerManager() | ||
|
|
@@ -344,7 +345,7 @@ public List<HddsProtos.SCMContainerReplicaProto> getContainerReplicas( | |
| @Override | ||
| public List<ContainerWithPipeline> getContainerWithPipelineBatch( | ||
| Iterable<? extends Long> containerIDs) throws IOException { | ||
| getScm().checkAdminAccess(null, true); | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
|
|
||
| List<ContainerWithPipeline> cpList = new ArrayList<>(); | ||
|
|
||
|
|
@@ -378,10 +379,12 @@ public List<ContainerWithPipeline> getExistContainerWithPipelinesInBatch( | |
| List<ContainerWithPipeline> cpList = new ArrayList<>(); | ||
| for (Long containerID : containerIDs) { | ||
| try { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| ContainerWithPipeline cp = getContainerWithPipelineCommon(containerID); | ||
| cpList.add(cp); | ||
| } catch (IOException ex) { | ||
| //not found , just go ahead | ||
| LOG.error("IOException - Admin Access Failed: {}", ex); | ||
| } | ||
| } | ||
| return cpList; | ||
|
|
@@ -449,6 +452,7 @@ public List<ContainerInfo> listContainer(long startContainerID, | |
| public List<ContainerInfo> listContainer(long startContainerID, | ||
| int count, HddsProtos.LifeCycleState state, | ||
| HddsProtos.ReplicationFactor factor) throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| boolean auditSuccess = true; | ||
| Map<String, String> auditMap = Maps.newHashMap(); | ||
| auditMap.put("startContainerID", String.valueOf(startContainerID)); | ||
|
|
@@ -516,6 +520,7 @@ public List<ContainerInfo> listContainer(long startContainerID, | |
| int count, HddsProtos.LifeCycleState state, | ||
| HddsProtos.ReplicationType replicationType, | ||
| ReplicationConfig repConfig) throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| boolean auditSuccess = true; | ||
| Map<String, String> auditMap = Maps.newHashMap(); | ||
| auditMap.put("startContainerID", String.valueOf(startContainerID)); | ||
|
|
@@ -595,7 +600,7 @@ public List<HddsProtos.Node> queryNode( | |
| HddsProtos.NodeOperationalState opState, HddsProtos.NodeState state, | ||
| HddsProtos.QueryScope queryScope, String poolName, int clientVersion) | ||
| throws IOException { | ||
|
|
||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| if (queryScope == HddsProtos.QueryScope.POOL) { | ||
| throw new IllegalArgumentException("Not Supported yet"); | ||
| } | ||
|
|
@@ -656,6 +661,7 @@ public List<DatanodeAdminError> startMaintenanceNodes(List<String> nodes, | |
|
|
||
| @Override | ||
| public void closeContainer(long containerID) throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), false); | ||
| final UserGroupInformation remoteUser = getRemoteUser(); | ||
| final Map<String, String> auditMap = Maps.newHashMap(); | ||
| auditMap.put("containerID", String.valueOf(containerID)); | ||
|
|
@@ -684,6 +690,7 @@ public void closeContainer(long containerID) throws IOException { | |
| public Pipeline createReplicationPipeline(HddsProtos.ReplicationType type, | ||
| HddsProtos.ReplicationFactor factor, HddsProtos.NodePool nodePool) | ||
| throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), false); | ||
| Map<String, String> auditMap = Maps.newHashMap(); | ||
| if (type != null) { | ||
| auditMap.put("replicationType", type.toString()); | ||
|
|
@@ -721,6 +728,7 @@ public List<Pipeline> listPipelines() { | |
| @Override | ||
| public Pipeline getPipeline(HddsProtos.PipelineID pipelineID) | ||
| throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| return scm.getPipelineManager().getPipeline( | ||
| PipelineID.getFromProtobuf(pipelineID)); | ||
| } | ||
|
|
@@ -731,6 +739,7 @@ public void activatePipeline(HddsProtos.PipelineID pipelineID) | |
| Map<String, String> auditMap = Maps.newHashMap(); | ||
| auditMap.put("pipelineID", pipelineID.getId()); | ||
| try { | ||
| getScm().checkAdminAccess(getRemoteUser(), false); | ||
| scm.getPipelineManager().activatePipeline( | ||
| PipelineID.getFromProtobuf(pipelineID)); | ||
| AUDIT.logWriteSuccess(buildAuditMessageForSuccess( | ||
|
|
@@ -865,6 +874,7 @@ public void transferLeadership(String newLeaderId) | |
|
|
||
| public List<DeletedBlocksTransactionInfo> getFailedDeletedBlockTxn(int count, | ||
| long startTxId) throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
|
||
| List<DeletedBlocksTransactionInfo> result; | ||
| Map<String, String> auditMap = Maps.newHashMap(); | ||
| auditMap.put("count", String.valueOf(count)); | ||
|
|
@@ -1221,19 +1231,22 @@ public Token<?> getContainerToken(ContainerID containerID) | |
|
|
||
| @Override | ||
| public long getContainerCount() throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| return scm.getContainerManager().getContainers().size(); | ||
| } | ||
|
|
||
| @Override | ||
| public long getContainerCount(HddsProtos.LifeCycleState state) | ||
| throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| return scm.getContainerManager().getContainers(state).size(); | ||
| } | ||
|
|
||
| @Override | ||
| public List<ContainerInfo> getListOfContainers( | ||
| long startContainerID, int count, HddsProtos.LifeCycleState state) | ||
| throws IOException { | ||
| getScm().checkAdminAccess(getRemoteUser(), true); | ||
| return scm.getContainerManager().getContainers( | ||
| ContainerID.valueOf(startContainerID), count, state); | ||
| } | ||
|
|
@@ -1328,6 +1341,7 @@ public DecommissionScmResponseProto decommissionScm( | |
| DecommissionScmResponseProto.newBuilder(); | ||
|
|
||
| try { | ||
| getScm().checkAdminAccess(getRemoteUser(), false); | ||
| decommissionScmResponseBuilder | ||
| .setSuccess(scm.removePeerFromHARing(scmId)); | ||
| } catch (IOException ex) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sortDatanodes is kind of a read operation, it doesn't change the in memory or persist state of pipeline.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ChenSammi for review. I understood and handled the comment. Pls re-review.