Ubuntuβs default package repositories do not include Elasticsearch components. However, you can install them via APT by adding Elasticβs official package source. To enhance security and prevent package spoofing, all packages are signed with a GPG key, enabling the package manager to verify their authenticity. Before proceeding with the installation, letβs import the public GPG key and add the Elastic package source list.
Next, we need download the configuration file /etc/elasticsearch/elasticsearch.yml as follows:
Now, download the configuration file for creating the certificates:
In the following steps, a file will be generated containing a folder named after the instance specified here. This folder will store the necessary certificates and keys required for secure SSL communication with the Elasticsearch node. To create these certificates, use the elasticsearch-certutil tool with the following command: This command generates a certificate authority (CA) along with SSL certificates and keys based on the details provided in instances.yml, packaging them into a ZIP archive for easy access.
This command generates a certificate authority (CA) along with SSL certificates and keys based on the details provided in instances.yml, packaging them into a ZIP archive for easy access. Extract file /usr/share/elasticsearch/certs.zip
The next step is to create the directory /etc/elasticsearch/certs, and then copy the CA file, the certificate and the key there:
Now, enable Elasticsearch to start automatically on system boot.
To generate credentials for all pre-built roles and users in the Elastic Stack, run the following command:
This command will automatically create and assign passwords for built-in users such as elastic, kibana_system, and logstash_system
To check that the installation was made successfull, run the following command:
Installing Wazuh server
The Wazuh server collects and analyzes data from deployed agents, running the Wazuh manager, API, and Filebeat. To set up Wazuh, start by adding the repository:
Next, we will install the Wazuh manager package
Now, enable Wazuh manager service to start automatically on system boot.
Installing Filebeat
Filebeat is the tool on the Wazuh server that securely forwards alerts and archived events to Elasticsearch.
Install the Filebeat package with command:
Download the pre-configured Filebeat config file used to forward Wazuh alerts to Elasticsearch:
Download the alerts template for Elasticsearch:
Download the Wazuh module for Filebeat
Next, we need to update the /etc/filebeat/filebeat.yml with nano to configure
Copy the certificates into /etc/filebeat/certs/
To enable and start the Filebeat service, run the following commands:
Next, check test the connection to Elasticsearch by running.
Kibana installation and
configuration
Kibana is a powerful and user-friendly web interface for exploring, analyzing, and visualizing data stored in Elasticsearch.
Now, we need install the Kibana package
Copy the Elasticsearch certificates into the Kibana configuration folder:
Next,download the Kibana configuration file
The next step is to open the Kibana configuration file /etc/kibana/kibana.yml
Create the /usr/share/kibana/data directory
Next, install the Wazuh Kibana plugin. The installation of the plugin must be done from the Kibana home directory as follows:
Link Kibana's socket to privileged port 443:
Now, enable and start the Kibana service
Access the web interface using the password generated during the Elasticsearch installation process:
/usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto
Changed password for user apm_system
PASSWORD apm_system = RvO8Bof9goYCKz271iR1
Changed password for user kibana_system
PASSWORD kibana_system = 03qAiRFFq5LCgvU6JkrX
Changed password for user kibana
PASSWORD kibana = 03qAiRFFq5LCgvU6JkrX
Changed password for user logstash_system
PASSWORD logstash_system = MYkLunGQbIM0HPO5w4Y5
Changed password for user beats_system
PASSWORD beats_system = iz4KjmvwQAxtsxhlrxWA
Changed password for user remote_monitoring_user
PASSWORD remote_monitoring_user = 5tgED4CNOcNCrkNF48oF
Changed password for user elastic
PASSWORD elastic = o85WC5Aln3STkLyP4WD3