Skip to content
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

[newPlatform] Migration of Routers #2592

Closed
5 tasks done
Tracked by #2591
jsanchez91 opened this issue Nov 4, 2020 · 4 comments
Closed
5 tasks done
Tracked by #2591

[newPlatform] Migration of Routers #2592

jsanchez91 opened this issue Nov 4, 2020 · 4 comments
Assignees

Comments

@jsanchez91
Copy link
Contributor

jsanchez91 commented Nov 4, 2020

Parent issue #2591

Description

Migrating the router files to the new plugin format.
This involves adapting the related controllers.

Tasks

Routers:

Pending integration with frontend

@Desvelao
Copy link
Member

Desvelao commented Dec 17, 2020

Endpoint context

Created a wazuh key with the next methods:

  • logger: Kibana server logger
  • security: instance to the current security platform.
  • plugins: access to plugins
  • api: contains a client to do request to Wazuh API. It's a wrapper of ApiInterceptor.

These are availables in the context param of endpoint handlers.
context.wazuh

api

It contains a client to do requests to Wazuh API endpoints as the internal user configurated for each host in the wazuh.yml or use the current user.

// Internal user
context.wazuh.api.client.asInternalUser.authenticate(apiIHostID: string)
context.wazuh.api.client.asInternalUser.request(method: string, path: string, data: any, options: {apiHostID: string})

// Current user
context.wazuh.api.client.asCurrentUser.authenticate(apiIHostID: string, authContext: any)
context.wazuh.api.client.asCurrentUser.request(method: string, path: string, data: any, options: {apiHostID: string})

@Desvelao
Copy link
Member

Desvelao commented Dec 17, 2020

Changes

  • Replaced the calls with the legacy Elasticsearch client by the provided by the new platform contained in the context.core.elasticsearch.client.
  • Replaced request to .kibana index by calls with the current user using the saved objects client context.core.savedObjects.client

@Desvelao
Copy link
Member

Changes

  • Moved some .js backend files to .ts

@frankeros frankeros assigned frankeros and Desvelao and unassigned frankeros Jan 13, 2021
@Desvelao
Copy link
Member

Desvelao commented Jan 14, 2021

Removed the next not used endpoints in the PR:

  • /api/pci/{requirement}
  • /api/gdpr/{requirement}
  • /api/nist/{requirement}
  • /api/tsc/{requirement}
  • /api/hipaa/{requirement}
  • /api/monitoring
  • /api/agents
  • /elastic/index-patterns
  • /reports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants