-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Phase 1 support for operator privileges #65256
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
Phase 1 support for operator privileges #65256
Conversation
96ccc04
to
ceef13c
Compare
ceef13c
to
3d5f3b0
Compare
@tvernum The PR is ready for an initial look. I added some essential tests which prove the feature is working. It is still intentional light on tests because I'd like to get confirmation on the general approach before spending too much time for the coverage. I spent quite a bit time to ponder how to implement the test for ensuring every action is marked either "operator-only" or "non-operator" (It's an interesting exploration). I don't think there is an easy way of doing it, not possible with unit tests for sure. The main challenge is to ensure its current and future coverage for all possible actions. Most of the actions are from modules, including always on plugins (I collectively refer them as modules since that's how it's reported with |
x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java
Show resolved
Hide resolved
This is now added. The complexity in fact is not high. Quite a bit boilerplate code to add an API but otherwise pretty minimal. This pattern could be quite useful for other things as well, such as what KnownActionsTests were trying to achieve, and ensure actions are categorised under the right named privileges, etc. So other than not being an unit test, this approach seems to be about right. |
x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java
Show resolved
Hide resolved
...ternalClusterTest/java/org/elasticsearch/xpack/security/operator/NonOperatorOnlyActions.java
Outdated
Show resolved
Hide resolved
...erTest/java/org/elasticsearch/xpack/security/operator/OperatorPrivilegesSingleNodeTests.java
Outdated
Show resolved
Hide resolved
...erTest/java/org/elasticsearch/xpack/security/operator/OperatorPrivilegesSingleNodeTests.java
Show resolved
Hide resolved
...erTest/java/org/elasticsearch/xpack/security/operator/OperatorPrivilegesSingleNodeTests.java
Outdated
Show resolved
Hide resolved
...ator-privileges-tests/src/main/java/org/elasticsearch/example/actions/GetActionsRequest.java
Outdated
Show resolved
Hide resolved
...r-privileges-tests/src/main/java/org/elasticsearch/example/actions/RestGetActionsAction.java
Outdated
Show resolved
Hide resolved
…ecurity/operator/OperatorUserDescriptor.java Co-authored-by: Tim Vernum <[email protected]>
…rivileges-phase-one
@@ -567,24 +582,23 @@ public void testTokenRestMissing() throws Exception { | |||
}); | |||
} | |||
|
|||
public void authenticationInContextAndHeader() throws Exception { | |||
public void testAuthenticationInContextAndHeader() throws Exception { |
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.
This test was skipped for a long time because of the naming convention mismatch. I fixed it but it's not 100% the same as it was because things evolved.
@@ -202,6 +205,16 @@ public void authorize(final Authentication authentication, final String action, | |||
// sometimes a request might be wrapped within another, which is the case for proxied | |||
// requests and concrete shard requests | |||
final TransportRequest unwrappedRequest = maybeUnwrapRequest(authentication, originalRequest, action, auditId); | |||
|
|||
// Check operator privileges | |||
// TODO: audit? |
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.
I think auditing can be a follow up PR.
…ecurity/operator/FileOperatorUsersStore.java Co-authored-by: Tim Vernum <[email protected]>
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.
LGTM
...n/security/src/main/java/org/elasticsearch/xpack/security/operator/OperatorOnlyRegistry.java
Show resolved
Hide resolved
…ecurity/operator/OperatorOnlyRegistry.java Co-authored-by: Tim Vernum <[email protected]>
…rivileges-phase-one
In some Elastic Stack environments, there is a distinction between the operator of the cluster infrastructure and the administrator of the cluster. This distinction cannot be supported currently because the "administrator" often has the superuser role which grants each and every privilege of the cluster. This PR adds a new feature to protect a fixed set of APIs from the "administrator" even when it is a highly privileged user such as superuser. It enhances the Elasticsearch security model to have an additional layer of restriction in addition to the RBAC. Co-authored-by: Tim Vernum <[email protected]>
In some Elastic Stack environments, there is a distinction between the operator of the cluster infrastructure and the administrator of the cluster. This distinction cannot be supported currently because the "administrator" often has the superuser role which grants each and every privilege of the cluster. This PR adds a new feature to protect a fixed set of APIs from the "administrator" even when it is a highly privileged user such as superuser. It enhances the Elasticsearch security model to have an additional layer of restriction in addition to the RBAC. Co-authored-by: Tim Vernum <[email protected]>
This is a follow-up PR for #65256 to fix the xpack info and usage reports for operator privilegs. In summary, this PR ensures: * _xpack does not report operator privileges because it is categorised under security * _xpack/usage reports operator privileges status under the security section * _license/feature_usage reports last used time of operator privileges. It is up to the downstream to filter out this report if necessary.
Add documentation for operator privilegs. The docs cover features delivered by phase 1 (#65256) and 2 (#66684). Co-authored-by: Tim Vernum <[email protected]> Co-authored-by: lcawl <[email protected]> Co-authored-by: Adam Locke <[email protected]>
Add documentation for operator privilegs. The docs cover features delivered by phase 1 (elastic#65256) and 2 (elastic#66684). Co-authored-by: Tim Vernum <[email protected]> Co-authored-by: lcawl <[email protected]> Co-authored-by: Adam Locke <[email protected]>
Add documentation for operator privilegs. The docs cover features delivered by phase 1 (elastic#65256) and 2 (elastic#66684). Co-authored-by: Tim Vernum <[email protected]> Co-authored-by: lcawl <[email protected]> Co-authored-by: Adam Locke <[email protected]>
Add documentation for operator privilegs. The docs cover features delivered by phase 1 (#65256) and 2 (#66684). Co-authored-by: Tim Vernum <[email protected]> Co-authored-by: lcawl <[email protected]> Co-authored-by: Adam Locke <[email protected]>
Add documentation for operator privilegs. The docs cover features delivered by phase 1 (#65256) and 2 (#66684). Co-authored-by: Tim Vernum <[email protected]> Co-authored-by: lcawl <[email protected]> Co-authored-by: Adam Locke <[email protected]>
In some Elastic Stack environments, there is a distinction between the operator of the cluster infrastructure and the administrator of the cluster. This distinction cannot be supported currently because the "administrator" often has the
superuser
role which grants each and every privilege of the cluster.This PR adds a new feature to protect a fixed set of APIs from the "administrator" even when it is a highly privileged user such as
superuser
. It enhances the Elasticsearch security model to have an additional layer of restriction in addition to the RBAC.