-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Allow packages to specify index privileges #112397
[Fleet] Allow packages to specify index privileges #112397
Conversation
I believe you should be able to use the I think the best course of action is to explore adding a test to the e2e-testing repo once the changes are in for the APM package as well. However, I'm not sure we have examples that use apm-server and test ingesting APM traces, so we would need to add that. |
…:hop-dev/kibana into feature-109047-override-index-privileges
…erride-index-privileges
Pinging @elastic/fleet (Team:Fleet) |
Moving out of draft as I have been able to test e2e, I've updated the test steps in the description. |
@@ -25,6 +25,11 @@ export interface NewPackagePolicyInputStream { | |||
data_stream: { | |||
dataset: string; | |||
type: string; | |||
elasticsearch?: { |
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 am wondering if we should update the saved object mapping here https://github.com/elastic/kibana/blob/master/x-pack/plugins/fleet/server/saved_objects/index.ts/#L251-L253 (as input is not enabled it probably change nothing)
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.
Hi @nchaulet I've added it now. Privileges may include cluster privileges in the future as well, I've set it as flattened as I dont think we would ever need to search on individual privileges?
FWIW, I intend to add a functional test for this in the apm-server repo. We have tests which run apm-server along with Elasticsearch, Kibana, and fleet-server already (e.g. see https://github.com/elastic/apm-server/blob/master/systemtest/fleet_test.go). Of course it would be great to have functional testing for Fleet specifically too, but it could perhaps be deferred. |
@elasticmachine merge upstream |
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.
🚀
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Page load bundle
Saved Objects .kibana field count
History
To update your PR or re-run it, just comment with: cc @hop-dev |
* tidy: move default index privs to const * add index privileges to package policy SO schema * add default index privileges const * add privileges to epm schema * add privileges to input stream types * use new const for default index privileges * permissions being added to policy * fix unit tests * add note about export * tidy: move default index privs to const * add index privileges to package policy SO schema * add default index privileges const * add privileges to epm schema * add privileges to input stream types * use new const for default index privileges * permissions being added to policy * fix unit tests * add note about export * remove outdated tests * return enabled check to start of function * add privileges to SO mapping Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* tidy: move default index privs to const * add index privileges to package policy SO schema * add default index privileges const * add privileges to epm schema * add privileges to input stream types * use new const for default index privileges * permissions being added to policy * fix unit tests * add note about export * tidy: move default index privs to const * add index privileges to package policy SO schema * add default index privileges const * add privileges to epm schema * add privileges to input stream types * use new const for default index privileges * permissions being added to policy * fix unit tests * add note about export * remove outdated tests * return enabled check to start of function * add privileges to SO mapping Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Mark Hopkin <[email protected]>
Summary
Closes #109047
This PR will not be ready to merge until we have tested it end to end.
Allow packages to specify a restricted set of index privileges as part of their manifest. There was previously some stub code which handled
permissions
however this was never fully implemented, @axw proposed moving these toelasticsearch.privileges.indices
.if a package has elasticsearch.privileges.indices in their data stream definition then:
delete
is not allowedTesting Steps
First I had to modify a package to specify index privileges in its manifest, for testing i used the custom logs package, these steps won't be necessary once elastic/apm-server#6139 is merged.
elastic-package build
elastic-package stack up -v -d --services package-registry
to start the package registry in docker locallyxpack.fleet.registryUrl: http://localhost:8080
We can now test if these privileges are added to the API key when I install the integration (on mac):
GET /.fleet-agents/_search
default_api_key
echo -n "<your token>" | base64
"has_all_requested":true
Checklist
Delete any items that are not applicable to this PR.