wazuh / wazuh-dashboard-plugins

Plugins for Wazuh Dashboard
https://wazuh.com/
GNU General Public License v2.0
427 stars 176 forks source link

Wazuh Dashboard gets stuck in a loop after being idle #3929

Open MiguelCasaresRobles opened 2 years ago

MiguelCasaresRobles commented 2 years ago
Wazuh indexer Rev Security
4.3.0 4301-1 Indexer
Browser
Chrome, Firefox, Safari, etc

Description Wazuh Dashboard gets stuck in a loop after being idle and getting back to it. Attached gif for reference:

app

It is not loading anything and it enters in a loop between the health-check and the settings call.

Either we are not handling properly the token expiration of the Wazuh API or the expiration logout time.

Preconditions Open Wazuh Dashboard, be idle for a while, and get back to the panel and try to click on somewhere.

Steps to reproduce Click on anywhere.

Desvelao commented 2 years ago

Research

The problem could be related to the user session expired and when the user does some action that causes a request to the Kibana server, the response is one with the status 401. This triggers the redirections.

For Wazuh dashboard or Kibana with Open Distro for Elasticsearch, the default session expiration time is 1h.

Replication

  1. Prerequisites: 0.1. Kibana with Open Distro for Elasticsearch and security enabled. Add the next settings to the kibana.yml configuration file:
    opendistro_security.cookie.ttl: 60000
    opendistro_security.session.ttl: 60000

    This configuration sets the sessition expiration time to 60s.

0.2. Restart the Kibana service to applying the changes

  1. Login to Kibana and go to the plugin of Wazuh to the Modules/Modules directory
  2. Don't interact with the plugin. Wait for at least 60s, that is the time the session expires. To be sure, add some seconds. Use a timer to control the time.
  3. Open the main menu of the Wazuh plugin and see the browser URL bar, it should change constantly creating a loop. A redirection to the login page could happen eventually. The first request has status 401 due the session expired. image

Note: If you take too long to interact with the plugin after waiting the required time, the page could redirects without interaction. It seems it could be caused to a request done and the response has status 401 and redirecting for some mechanins to the login page. image

This was replicated with: