-
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] Add scoped AgentService #119017
[Fleet] Add scoped AgentService #119017
Conversation
x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts
Outdated
Show resolved
Hide resolved
Love that approach it could works well with Fleet superuser privilege requirement removal, and it's seems easy enough to consume. |
cd7799c
to
d27c1df
Compare
@paul-tavares Would you be able to take over fixing the security solution issues in this PR? |
@joshdover yes, I can do that. Will start now, but may need to go into Monday |
Hi @joshdover , I'm also going to see if we (endpoint) can maybe wrap this. Maybe I'll change our services interface to instead receive in an |
) {} | ||
|
||
asScoped(req: KibanaRequest): EndpointScopedFleetServicesInterface { | ||
const { |
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.
FYI: Endpoint team:
I would like at some point to maybe use this to also scope the the other services from fleet. Each of those normally takes in either an ES scoped client or a scoped SO client, so we could adjust the other services here so that we no longer have to pass in these client explicitly. Example for the packagePolicy.list()
method:
{
list: packagePolicy.list.bind(packagePolicy, soScopedClient)
}
and then we could just packagePolicy.list(options)
- no more need to pass in the decencies (in this case the SO Client)
This is the purpose of the |
++ that was what I was thinking as well. Switch over to using AgentClient and no longer rely on the AgentService interface. |
…coped-agent-service # Conflicts: # x-pack/plugins/fleet/server/mocks/index.ts # x-pack/plugins/fleet/server/plugin.ts # x-pack/plugins/fleet/server/routes/setup/handlers.test.ts # x-pack/plugins/fleet/server/types/request_context.ts # x-pack/plugins/security_solution/server/endpoint/routes/metadata/handlers.ts # x-pack/plugins/security_solution/server/endpoint/services/metadata/endpoint_metadata_service.ts
…coped-agent-service
@paul-tavares I noticed that endpoint has a few other code paths that query I plan to add a follow up PR that introduces APIs for querying these and I think it will be necessary to switch over those usages as well in order to support these indices becoming system indices (so the end user cannot access them out of the box, not even superuser). |
Re: usage of I'm not too familiar with discussions around those indexes, but I know that @pzl worked closely with the OSQuery team when we started to use them (I think OSQuery was the first). you mentioned creating an API, but I wonder if you mean providing a server-side service that we can consume - is that what you meant? cc/ @ashokaditya FYI |
@joshdover |
Pinging @elastic/fleet (Team:Fleet) |
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.
Asset management LGTM
Thank you @joshdover
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.
🚢 it 😄
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
History
To update your PR or re-run it, just comment with: |
@@ -32,7 +32,7 @@ import { | |||
|
|||
export class TelemetryReceiver { | |||
private readonly logger: Logger; | |||
private agentService?: AgentService; | |||
private agentClient?: AgentClient; |
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.
Security Telemetry change looks good!
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 ✨ 🚀 🌔
Approving minor import change on security telemetry instrumentation.
Co-authored-by: Paul Tavares <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Co-authored-by: Paul Tavares <[email protected]> Co-authored-by: Josh Dover <[email protected]> Co-authored-by: Paul Tavares <[email protected]>
Co-authored-by: Paul Tavares <[email protected]>
Summary
Closes #116182
This updates the agent service currently exposed on Fleet's server-side plugin API to now supply a "scoped" and "internal user" interface of the same client to allow plugins and Fleet's internal implementation code to get authz out-of-the-box on these actions and support the switch to system indices.
In this first iteration, I have only included the changes to support external usages in other plugins of the 4 currently supported APIs. In the next PR, I'll add the additional APIs we use internally in Fleet and switch over our implementation to use this service internally.
Example usage, from a HTTP request handler
From a server-side background process, for example in telemetry collectors:
Checklist
Delete any items that are not applicable to this PR.
For maintainers