Install Wazuh Server on Rocky Linux with ELK Stack
Install Wazuh Server on Rocky Linux with ELK Stack
ELK Stack
How to install Wazuh server on Rocky Linux? In this tutorial, you will learn how to install
Wazuh server on Rocky Linux. Wazuh is a free, open source and enterprise-ready security
monitoring solution that helps you to gain security visibility into your infrastructure by
monitoring hosts at an operating system and application level. It provides the following
capabilities:
log analysis
file integrity monitoring
intrusions detection
policy and compliance monitoring
All-in-one deployment – Wazuh and the ELK stack components are installed on a single
server.
Multi-node (Distributed) deployment – Wazuh and ELK stack components are installed
on separate nodes.
In this setup, we will install both Wazuh server and ELK stack components on the same node.
In order to install and setup Wazuh server on Rocky Linux, there are two components that needs
to be installed.
Rocky Linux do not have Wazuh manager package on its repository list. As such you need to
install Wazuh repository as follows;
Install the Wazuh 4.x repository (current stable release as of this writing is
v4.3.10);
As you can see, Wazuh manager 4.3.10 is the current release as provided by the repos.
Therefore, Install Wazuh Manager on Rocky Linux by running the command below;
Once the installation is done, run the command below to start and enable it to run on system
boot;
Since we are using a single node deployment architecture, we will install ELK stack as well on
the same node.
Wazuh app requires Kibana to allow you access Wazuh manager dashboard. Elasticsearch is
required as it provides a distributed, multitenant-capable full-text search engine.
You will also need Filebeat, that collect Wazuh manager event data and pushes them to
Elasticsearch.
As of this writing, Wazuh 4.3.10 supports ELK 7.17.6 as per the compatibility matrix.
Therefore, the installation commands below installs ELK stack 7.17.6 on Rocky Linux.
Install the ELK/Elastic YUM repository
Install the ELK/Elastic repository to enable you install the stack components. Begin by importing
the ELK stack repository PGP signing Key;
Installing Elasticsearch
Note, since the installation is done from the ELK YUM repositories, you will get the current
latest and stable versions installed. However, we need version 7.17.6. Hence, use the command
below to install ES v7.17.6.
Once the installation is done, proceed to configure Elasticsearch. The default configuration file
for Elasticsearch is /etc/elasticsearch/elasticsearch.yml.
Open the configuration file for editing using your preferred text editor;
nano /etc/elasticsearch/elasticsearch.yml
You can optionally set the name of the cluster or go with the default;
# ---------------------------------- Cluster
-----------------------------------
...
cluster.name: wazuh-elk
For the network settings, we will the defaults since by default, it uses the loopback interface and
port 9200/tcp, which is fine for our case as we will only be accessing Elasticsearch locally from
the Wazuh server.
By default, Elasticsearch tries to discovers other nodes to form a cluster when started. Since we
are running a single node cluster, you need to specify the same by inserting the
line, discovery.type: single-node, under the Discovery section.
# --------------------------------- Discovery
----------------------------------
...
discovery.type: single-node
Configure the JVM heap size and set it to about half the memory available on the system.
vim /etc/elasticsearch/jvm.options.d/jvm.options
-Xms512m
-Xmx512m
There are other important Elasticsearch configuration settings you should consider, especially if
you are taking it to production. Check the Import Elasticsearch Configuration page for more tips.
Running Elasticsearch
Once you are done with Elasticsearch configurations, start and enable Elasticsearch to run on
system boot.
curl http://localhost:9200
{
"name" : "rocky9",
"cluster_name" : "wazuh-elk",
"cluster_uuid" : "hpGPgKhYRpetfkWh2oIjzw",
"version" : {
"number" : "7.17.6",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "f65e9d338dc1d07b642e14a27f338990148ee5b6",
"build_date" : "2022-08-23T11:08:48.893373482Z",
"build_snapshot" : false,
"lucene_version" : "8.11.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Once the installation is done, you can configure Kibana. The default configuration file for
Kibana is /etc/kibana/kibana.yml. Open the file editing.
vim /etc/kibana/kibana.yml
The default host and port settings configure Kibana to run on localhost:5601. We need to
change, the host especially, to enable us to reach Kibana externally.
# Kibana is served by a back end server. This setting specifies the port to
use.
# server.port: 5601
server.port: 5601
...
# To allow connections from remote users, set this parameter to a non-loopback
address.
#server.host: "localhost"
server.host: "192.168.56.144"
Next, you need to configure how Kibana will connect to Elasticsearch. By default, as depicted by
the setting below, Kibana can connect to Elasticsearch on loopback address, that is only if
Elasticsearch is set to listen on the loopback interface.
# The URLs of the Elasticsearch instances to use for all your queries.
#elasticsearch.hosts: ["http://localhost:9200"]
Running Kibana
Install Filebeat
Configuring Filebeat
mv /etc/filebeat/filebeat.yml{,.bak}
filebeat.modules:
- module: wazuh
alerts:
enabled: true
archives:
enabled: false
seccomp:
default_action: allow
syscalls:
- action: allow
names:
- rseq
logging.level: info
logging.to_files: true
logging.files:
path: /var/log/filebeat
name: filebeat
keepfiles: 7
permissions: 0644
EOL
wget https://packages.wazuh.com/4.x/filebeat/wazuh-filebeat-0.2.tar.gz -P
/tmp/
mkdir /usr/share/filebeat/module/wazuh
tar xzf /tmp/wazuh-filebeat-0.2.tar.gz -C /usr/share/filebeat/module/wazuh/ --
strip-components=1
filebeat setup \
--path.config /etc/filebeat \
--path.home /usr/share/filebeat \
--path.data /var/lib/filebeat \
--index-management -E setup.template.json.enabled=false
systemctl daemon-reload
systemctl enable --now filebeat
Check status;
For logs;
tail -f /var/log/filebeat/filebeat
You can now install Wazuh app Kibana plugin. Before you can proceed, ensure that you set the
owner of the
directories, /usr/share/kibana/optimize/ and /usr/share/kibana/plugins to kibana.
cd /usr/share/kibana
wazuh@4.3.10-4311
Start Kibana;
Once they are up, if you check the created indices, you should be able to see wazuh-alerts* index
created;
Now that your ELK stack is running, you can access Kibana interface, http://<server-IP-or-
resolvable-hostname>:5601.
Ensure that you open Port 5601/TCP on firewall, to allow external access to Kibana.
When you land on Kibana Interface, navigate to the menu and scroll down to see the Wazuh
App. See example screenshot below;
Upon clicking the app, it checks a few things like the Wazuh API connection and the version, the
availability of the default indices such as wazuh-alerts-* (default index).
And that marks the end of our guide on how to install Wazuh server with ELK stack on Rocky
Linux.
In our next guides, we will learn on how to install to and add Wazuh agents on end points being
monitored to collect and ship data to Kibana for visualization.