# Configure Wazuh and Hive

After doing all of these, our next step is to configure hive and the Wazuh. As a first step let start the configuration of the hive.

First will focus on the Cassandra which is database of the hive. to do the configuration of the Cassandra navigate to the following.

```bash
/etc/cassandra/cassandra.yaml
```

First Change the Cassandra Cluster name.

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2Fk5IQrjVxzcwr8dQSZkEE%2Fimage.png?alt=media&#x26;token=1e88794a-200b-4b5e-afa1-11ab66b3944b" alt="" width="563"><figcaption><p>Cassandra Cluster Name</p></figcaption></figure>

Next change the listen address from [localhost](http://localhost/) to your hive address. in my example that is 192.168.200.200

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FxnHUg7E6nICheiipaGUM%2Fimage.png?alt=media&#x26;token=05d47065-4cbd-47f9-9750-19aa29c447b0" alt="" width="563"><figcaption><p>Cassandra Listen Address</p></figcaption></figure>

Now change the rpc\_address. Replace the [localhost](http://localhost/) with your hive IP address same as the above listen\_address- In my case 192.168.200.200

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FceM7Y8mp7RTm17TrWry7%2Fimage.png?alt=media&#x26;token=8a15dcdd-bf92-4157-a190-f66bf17ac2dd" alt=""><figcaption><p>Cassandra rpc_address</p></figcaption></figure>

Next change the seed address. but please remember do not change the port number **7000**.

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2F50w6YYZR7JkLUFcgumei%2Fimage.png?alt=media&#x26;token=e15e7e7b-68ab-4d84-8adf-c483d881fcdd" alt="" width="563"><figcaption><p>Cassandra Seeds Port</p></figcaption></figure>

Then stop the cassandra service.

```bash
systemctl stop cassandra.service
```

After that you can remove the older files which is in the Cassandra by using the below command.

```bash
sudo rm -rf /var/lib/cassandra/*
```

Now you can start the Cassandra service using this command

```bash
systemctl start cassandra.service
```

To make sure whether the Cassandra service is running or not, you can use the below command.

```bash
systemctl start cassandra.service
```

As you can see the service is running after our changes.

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FrEOOW1GTHdanTztXvcss%2Fimage.png?alt=media&#x26;token=91d9c681-8f99-4269-abce-0d0452889691" alt="" width="563"><figcaption><p>Cassandra service is active and running</p></figcaption></figure>

The next thing we have to configure is Elasticsearch. the purpose of the Elasticsearch is querying the data. you can find the config file of the Elasticsearch under,

```bash
/etc/elasticseach/elasticsearch.yml
```

What you have to do is, find the cluster name and rename it as you want. in my example I'm changing my cluster name in to “ thehive”

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FTI75mcpeXeqvvn4oVEZH%2Fimage.png?alt=media&#x26;token=50190151-7b6a-47b0-9b29-465994659d0e" alt="" width="563"><figcaption><p>Elasticsearch Cluster Name</p></figcaption></figure>

Also uncomment the [node.name](http://node.name/) and leave it as node-1

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FQYYM4dEjWF3ujVWh8Keo%2Fimage.png?alt=media&#x26;token=df3b0e58-592c-4a6b-9810-bda3753adda3" alt="" width="563"><figcaption><p>Elasticsearch Node Name</p></figcaption></figure>

When you scrolling down you will see the **network.host** IP address. uncomment that and added your hive IP address. in my case IP address was 192.168.200.200

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FQPtYAMTbrd857imTKzvl%2Fimage.png?alt=media&#x26;token=84142281-9af1-47c8-b33a-dc5235d80551" alt="" width="563"><figcaption><p>Elasticsearch Network Host IP</p></figcaption></figure>

In Elasticsearch by default http port is 9200. if you want you can uncomment that and enable the port and use customer port number. I'm going to uncomment that and enable that but using the same port.

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2F2741dPboobWCDf9M1L7h%2Fimage.png?alt=media&#x26;token=10cd697b-9921-4658-a2df-409b2190e78b" alt="" width="563"><figcaption><p>Elasticsearch http port</p></figcaption></figure>

In order to start the Elasticsearch, it will need the discovery seed or cluster initial master node. In my case I'm going to uncomment the initial master node like below. and please keep remember to remove the node 2 because we don't have a node-2 at this stage. if you are planning to setup or you are setting up a node-2 you can keep it as it is.

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2F9VXKcNqOX4Q8BtSfWCvC%2Fimage.png?alt=media&#x26;token=58b7c4a6-bae7-480b-a59c-3b6000a71000" alt=""><figcaption><p>Elasticsearch Master Nodes</p></figcaption></figure>

Now save all the configurations and go ahead and **start** the Elasticsearch service by using below command.

```bash
systemctl start elasticseach
```

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FfDxBYR9doOryLG0bdU0B%2Fimage.png?alt=media&#x26;token=d0ffb64c-55fb-450b-9101-79cbd55b2758" alt="" width="563"><figcaption><p>Elasticsearch Start</p></figcaption></figure>

Once this is done, we can enable the service using below command

```bash
systemctl enable elasticsearch
```

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2Fisc6JYtEafE4OoUO1lwu%2Fimage.png?alt=media&#x26;token=b6308a78-806b-4fb8-a463-936ef12e69f8" alt="" width="563"><figcaption><p>Elasticsearch service enable</p></figcaption></figure>

To make sure the service you can run this command.

```bash
systemctl status elasticseach
```

As you can see it is active and running..

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FplsVUIBizbRgLlAFniIx%2Fimage.png?alt=media&#x26;token=8e2b02ea-8511-46ea-aec6-32b49a5d2449" alt="" width="563"><figcaption><p>Elasticsearch service running</p></figcaption></figure>

{% hint style="info" %}
Once you have done that please make a note to double check that Cassandra service as well. some times that service may hanged or stopped.
{% endhint %}

```bash
systemctl status cassandra.service
```

<figure><img src="https://2577361618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbNl888Hjdph9qbHHEGkB%2Fuploads%2FujOcUvk19wBDgAPrYEfO%2Fimage.png?alt=media&#x26;token=a7383e72-2d4c-49cb-8dab-2cf5636140a8" alt="" width="563"><figcaption><p>Cassandra Service is Running</p></figcaption></figure>
