wazuh / wazuh-packages

Wazuh - Tools for packages creation
https://wazuh.com
GNU General Public License v2.0
105 stars 96 forks source link

Wazuh dashboard configuration file not installed in the Ubuntu Jammy Test_stack test #2656

Closed rauldpm closed 2 months ago

rauldpm commented 11 months ago

Description

In the analysis of the issue https://github.com/wazuh/wazuh-jenkins/issues/5953#issuecomment-1832432796, an error has been found in the installation of the Wazuh dashboard, which, despite being installed correctly, it has not installed the configuration file in addition to other files. This error has not been reproduced again.

root@ip-172-31-11-107:/tmp# apt install ./dashboard-4.6.0.deb 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'wazuh-dashboard' instead of './dashboard-4.6.0.deb'
The following NEW packages will be installed:
  wazuh-dashboard
0 upgraded, 1 newly installed, 0 to remove and 221 not upgraded.
Need to get 0 B/179 MB of archives.
After this operation, 965 MB of additional disk space will be used.
Get:1 /tmp/dashboard-4.6.0.deb wazuh-dashboard amd64 4.6.0-1 [179 MB]
Selecting previously unselected package wazuh-dashboard.
(Reading database ... 71699 files and directories currently installed.)
Preparing to unpack /tmp/dashboard-4.6.0.deb ...
Unpacking wazuh-dashboard (4.6.0-1) ...
Setting up wazuh-dashboard (4.6.0-1) ...
Scanning processes...                                                                                                                                                                                              
Scanning candidates...                                                                                                                                                                                             
Scanning linux images...                                                                                                                                                                                           

Running kernel seems to be up-to-date.

Restarting services...
Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart getty@tty1.service
 systemctl restart networkd-dispatcher.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@ip-172-31-11-107:/tmp# NODE_NAME=dashboard
root@ip-172-31-11-107:/tmp# mkdir /etc/wazuh-dashboard/certs
tar -xf ./wazuh-certificates.tar -C /etc/wazuh-dashboard/certs/ ./$NODE_NAME.pem ./$NODE_NAME-key.pem ./root-ca.pem
mv -n /etc/wazuh-dashboard/certs/$NODE_NAME.pem /etc/wazuh-dashboard/certs/dashboard.pem
mv -n /etc/wazuh-dashboard/certs/$NODE_NAME-key.pem /etc/wazuh-dashboard/certs/dashboard-key.pem
chmod 500 /etc/wazuh-dashboard/certs
chmod 400 /etc/wazuh-dashboard/certs/*
chown -R wazuh-dashboard:wazuh-dashboard /etc/wazuh-dashboard/certs
root@ip-172-31-11-107:/tmp# systemctl daemon-reload
systemctl enable wazuh-dashboard
systemctl start wazuh-dashboard
Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-dashboard.service → /etc/systemd/system/wazuh-dashboard.service.
root@ip-172-31-11-107:/tmp# systemctl status wazuh-dashboard
× wazuh-dashboard.service - wazuh-dashboard
     Loaded: loaded (/etc/systemd/system/wazuh-dashboard.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2023-11-29 17:10:31 UTC; 10s ago
    Process: 26473 ExecStart=/usr/share/wazuh-dashboard/bin/opensearch-dashboards -c /etc/wazuh-dashboard/opensearch_dashboards.yml (code=exited, status=1/FAILURE)
   Main PID: 26473 (code=exited, status=1/FAILURE)
        CPU: 289ms

Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]:     at Module._compile (node:internal/modules/cjs/loader:1196:14)
Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]:     at Module.load (node:internal/modules/cjs/loader:1074:32) {
Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]:   errno: -2,
Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]:   syscall: 'open',
Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]:   code: 'ENOENT',
Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]:   path: '/etc/wazuh-dashboard/opensearch_dashboards.yml'
Nov 29 17:10:31 ip-172-31-11-107 opensearch-dashboards[26473]: }
Nov 29 17:10:31 ip-172-31-11-107 systemd[1]: wazuh-dashboard.service: Main process exited, code=exited, status=1/FAILURE
Nov 29 17:10:31 ip-172-31-11-107 systemd[1]: wazuh-dashboard.service: Failed with result 'exit-code'.
root@ip-172-31-11-107:/tmp# ls -l /etc/wazuh-dashboard/
total 8
dr-x------ 2 wazuh-dashboard wazuh-dashboard 4096 Nov 29 17:10 certs
-rw-r----- 1 wazuh-dashboard wazuh-dashboard  226 Nov 29 17:06 opensearch_dashboards.keystore
root@ip-172-31-11-107:/tmp# ls -l /usr/share/wazuh-dashboard/
total 1304
-rw-r-----   1 wazuh-dashboard wazuh-dashboard   11358 Jun  3 03:10 LICENSE.txt
-rw-r-----   1 wazuh-dashboard wazuh-dashboard 1250329 Jun  3 03:10 NOTICE.txt
-rw-r-----   1 wazuh-dashboard wazuh-dashboard    1933 Jun  3 03:10 README.txt
-r--r-----   1 wazuh-dashboard wazuh-dashboard       6 Oct 24 07:52 VERSION
drwxr-x---   2 wazuh-dashboard wazuh-dashboard    4096 Jun  3 03:10 assets
drwxr-x---   2 wazuh-dashboard wazuh-dashboard    4096 Nov 29 17:06 bin
drwxr-x---   2 wazuh-dashboard wazuh-dashboard    4096 Oct 24 07:52 config
drwxr-x---   2 wazuh-dashboard wazuh-dashboard    4096 Jun  3 03:10 data
-rw-r-----   1 wazuh-dashboard wazuh-dashboard    6293 Jun  3 03:24 manifest.yml
drwxr-x---   7 wazuh-dashboard wazuh-dashboard    4096 Nov 29 17:06 node
drwxr-x--- 625 wazuh-dashboard wazuh-dashboard   20480 Nov 29 17:06 node_modules
-rw-r-----   1 wazuh-dashboard wazuh-dashboard     837 Oct 24 07:52 package.json
drwxr-x---  11 wazuh-dashboard wazuh-dashboard    4096 Nov 29 17:06 plugins
drwxr-x---  11 wazuh-dashboard wazuh-dashboard    4096 Nov 29 17:06 src

The content of the installation directory should be:

[root@wazuh-server wazuh-user]# ls -l /etc/wazuh-dashboard/
total 12
dr-x------ 2 wazuh-dashboard wazuh-dashboard  83 Oct 24 13:38 certs
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 304 Oct 24 08:06 node.options
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 226 Oct 24 13:38 opensearch_dashboards.keystore
-rw-r----- 1 wazuh-dashboard wazuh-dashboard 766 Nov 16 14:30 opensearch_dashboards.yml

Related

Tasks

juliamagan commented 2 months ago

With the changes to 5.0, we will not invest time here. In addition, these tests have been deprecated in 4.10.0.