Wazuh API for Kibana

870 views
Skip to first unread message

Matt Schenkman

unread,
Nov 26, 2020, 6:52:12 PM11/26/20
to Wazuh mailing list
Hi,

We've configured Wazuh and can successfully access the API via web browser or CURL command. However, the Kibana app fails to connect to the API with an error of:

3005 - Request failed with status code 404

Our yml on Kibana is super simple and references the IP of the wazuh server, which is separate from ELK. The API yaml on Wazuh is pretty simple as well, listening on 0.0.0.0 and disabling SSL.

Any help would be appreciated as I feel like it's simple and staring me in the face.

Here's the odd thing: If I check the dev tools and test connection, the check-api references the IP of the ELK server, not the Wazuh-manager.

Thanks in advance!

elw...@wazuh.com

unread,
Nov 27, 2020, 1:46:16 AM11/27/20
to Wazuh mailing list
Hello Matt,

Having the ckeck-api references to the IP of ELK instead of Wazuh manager may points to that the IP is not specified in the correct file YAML. Can you please check /usr/share/kibana/optimize/wazuh/config/wazuh.yml that it has the correct IP, Note that by default (Step 8 https://documentation.wazuh.com/4.0/installation-guide/open-distro/distributed-deployment/step-by-step-installation/kibana/index.html#kibana) the communication and is encrypted and following credentials must be used :

hosts:
  - default:
     url: https://localhost
     port: 55000
     username: wazuh
     password: wazuh



If that did not fix it. Please share the version of Wazuh and Kibana used also the YAML file (with the path) you are referring to, Screenshots and more information will be helpful.

Hope this helps,
Regards,
Wali

Matt Schenkman

unread,
Nov 27, 2020, 8:17:10 AM11/27/20
to elw...@wazuh.com, Wazuh mailing list
Thanks Wali.

Here's the output of the yml file:

hosts:
  - elastic:
     url: http://10.10.10.225

     port: 55000
     username: wazuh
     password: wazuh

.225 is remote to the kibana server, which is at .245

SSL is disabled in the config.js for wazuh API.

we're on Elastic and Kibana 7.9.2 and Wazuh 4.0.2 which might explain the issue. I'm trying to get the pre-reqs setup.

--
You received this message because you are subscribed to a topic in the Google Groups "Wazuh mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wazuh/nU8d6NqzGPY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wazuh+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wazuh/52f06745-c11b-4f61-b376-404813414d1fn%40googlegroups.com.


--
Matt Schenkman
IT Operations Manager
FCP Euro
 
m. 347.416.NERD
e. matt.sc...@fcpeuro.com
w. fcpeuro.com
facebooklinkedintwitteryoutubefacebooklinkedin
Every Part You Buy Is GUARANTEED FOR LIFE

Matt Schenkman

unread,
Nov 27, 2020, 2:52:50 PM11/27/20
to elw...@wazuh.com, Wazuh mailing list
We updated Kibana and Elasticsearch to 7.9.3, and finally found another .js file that we had to update to reference the correct external IP. Now we have this:

image.png


I appreciate that this is open source, but the documentation seems significantly off.

Thanks,
~Matt

Juan Carlos

unread,
Nov 27, 2020, 3:16:12 PM11/27/20
to Wazuh mailing list
Hello Matt,
With the latest revision of the Wazuh Kibana App a fix was released because under certain conditions the Index Pattern title was being overwritten.
The easiest way to work around this issue is to delete the index pattern and then open again the Wazuh Kibana Plugin. To do this select the menu on the top left corner, then Stack Management → Index Patterns → Select the offending index pattern and then the delete button:
  DeletePattern.png

When opening the Wazuh app it will briefly indicate the pattern is missing and that it will then recreate it.

Let us know if the issue persists or if you have any other questions that we could help with.
Best Regards,
Juan Carlos Tello

Matt Schenkman

unread,
Nov 27, 2020, 4:01:35 PM11/27/20
to Juan Carlos, Wazuh mailing list
All I have in stack management are the 2 indices it created for wazuh that it can't find (monitoring and stats)

image.png

Still gives me a handful of errors (same as the original screenshot)

The selected index-pattern is not present.
No template found for the selected index-pattern.
Health Check. Error: Could not locate that index-pattern (id: 02684010-2e75-11eb-b623-fdf4cfd851bb), [click here to re-create it](management/kibana/indexPatterns)

Juan Carlos

unread,
Nov 27, 2020, 6:10:46 PM11/27/20
to Wazuh mailing list
Hi Matt,
It would be under Index Patterns instead of Index Management.
My previous screenshot was from Open Distro so I apologize if things look different in your environment.
In your case you may find it here:
indexpatterns.png
However it is also true that if the wazuh-alerts-YYYY-mm-dd has not been created filebeat has not the shipped the data to Elasticsearch.
For this, I recommend verifying the Filebeat configuration by running:
filebeat test output
on the Wazuh Manager computer. If it doesn't indicate any issue, make sure the service is running (systemctl start filebeat)

Let us know if this works.
Best Regards,
Juan Carlos Tello

Matt Schenkman

unread,
Nov 27, 2020, 7:34:36 PM11/27/20
to Juan Carlos, Wazuh mailing list
  I fixed a filebeat error and am now getting successful test outputs. We send directly to elastic and skip logstash, unless you tell me that's what's breaking this.

elasticsearch: http://10.10.10.245:9200...
  parse url... OK
  connection...
    parse host... OK
    dns lookup... OK
    addresses: 10.10.10.245
    dial up... OK
  TLS... WARN secure connection disabled
  talk to server... OK
  version: 7.9.3

Service is up and running.



Matt Schenkman

unread,
Nov 28, 2020, 7:03:15 PM11/28/20
to Wazuh mailing list
I mean to say that the service is running, I fixed an error that was preventing filebeat from sending, and am still getting the same database errors I shared above.

Juan Carlos

unread,
Nov 30, 2020, 3:43:44 AM11/30/20
to Wazuh mailing list
Hi Matt,
I'm glad the Filebeat error has been found and fixed.
Did you delete the index pattern?
If by database errors you mean:
Health Check. Error: Could not locate that index-pattern (id: 02684010-2e75-11eb-b623-fdf4cfd851bb), [click here to re-create it](management/kibana/indexPatterns)
Then deleting the index pattern and opening the Wazuh app within Kibana should remedy this.

Best Regards,
Juan Carlos Tello

Matt Schenkman

unread,
Nov 30, 2020, 8:37:13 AM11/30/20
to Juan Carlos, Wazuh mailing list
I deleted the index patterns and restarted everything. It did not fix the issue.

elw...@wazuh.com

unread,
Dec 1, 2020, 5:48:47 AM12/1/20
to Wazuh mailing list
Hello Matt,

Would you please perform the following :

  • Make sure Filebeat is reading the `alerts.json` with `lsof /var/ossec/logs/alerts/alerts.json` should outputs :

    COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
    filebeat  2795   root    8r   REG    8,1    56915 70016512 /var/ossec/logs/alerts/alerts.json
    ossec-int 3837 ossecm    4r   REG    8,1    56915 70016512 /var/ossec/logs/alerts/alerts.json
    ossec-ana 4182  ossec   11w   REG    8,1    56915 70016512 /var/ossec/logs/alerts/alerts.json



  • Load the template and Wazuh module : filebeat setup --index-management -E output.logstash.enabled=false -E 'output.elasticsearch.hosts=["localhost:9200"]'


  • Restart Filebeat : systemctl restart filebeat


If the above did not fix it. Please share following :


Hope this helps.

Regards,
Wali

elw...@wazuh.com

unread,
Dec 2, 2020, 5:40:29 AM12/2/20
to Wazuh mailing list
Hello Matt,

Glad you figured out the issue.

Indeed you can use the public API of virustotal but be aware of the limitations : https://documentation.wazuh.com/4.0/user-manual/capabilities/virustotal-scan/about.html#terms-of-service

Could you please elaborate on this question: Will everything without an alert history show as empty like the vulnerability module? 

Please make sure to use reply all so that everyone can benefit from the discussion.

Regards,
Wali

Matt Schenkman

unread,
Dec 2, 2020, 7:17:24 AM12/2/20
to elw...@wazuh.com, Wazuh mailing list
No problem. So we're starting to enable different modules like docker listener. I fixed an issue where the index pattern didn't include the whole string of wazuh-alerts-4.x-* and once I updated that the vulnerability module showed days.

We're now having an issue where the docket listener is configured on the docker server but sunny start and points back to the listener file. No other helpful errors.

Thanks for your help so far!

Matt Schenkman

unread,
Dec 2, 2020, 9:44:23 PM12/2/20
to elw...@wazuh.com, Wazuh mailing list
So, we're almost there. The only thing I'm not getting data returning for is Security Audit module. Can you shed some light? There's no config specifically for it in the docs that I saw.

elw...@wazuh.com

unread,
Dec 3, 2020, 4:37:58 AM12/3/20
to Wazuh mailing list
Hello Matt,

Glad you are making progress with everything.

Regarding the Audit module, it requires having auditd installed in the agents and monitor the audit.log file. A thorough guide on how to achieve the same here https://wazuh.com/blog/monitoring-root-actions-on-linux-using-auditd-and-wazuh/.

Hope this helps.
Regards,
Wali


Matt Schenkman

unread,
Dec 3, 2020, 7:50:29 AM12/3/20
to elw...@wazuh.com, Wazuh mailing list
Ok, so I was understanding the doc about who-dat and systemd. Right on. So it looks like we're pretty good at this point. Anything else to note or recommend? Thanks for the help.

elw...@wazuh.com

unread,
Dec 3, 2020, 8:22:00 AM12/3/20
to Wazuh mailing list
Hello Matt,

Great then :D.

Following resources can be helpful  :



You can also join the slack channel if you prefer:  https://wazuh.com/community/join-us-on-slack/

Regards,
Wali

Matt Schenkman

unread,
Dec 3, 2020, 7:08:41 PM12/3/20
to elw...@wazuh.com, Wazuh mailing list
Ok, riddle me this:

DockerListener wasn't working at all. We get a cryptic error in the ossec.log:  wazuh-modulesd:docker-listener: ERROR: Cannot launch Docker integration. Please check the file '/var/ossec/wodles/docker/DockerListener'

We've not modified anything inside DockerListener.

As a test, I saw that there was an additional file called DockerListener.py installed on the wazuh-manager when we installed the listener over there attempting to get it working as the documentation was a little unclear. We copied that .py file to the agent in question and, upon manual execution of the python script, logs are received in ELK for DockerListener events.

There's almost no doc on the Listener, so any help you could provide would be appreciated. I emulated what I saw on Github, which was a .py Listener alone, but it didn't help either.

Thanks,
~Matt

Matt Schenkman

unread,
Dec 4, 2020, 3:06:26 PM12/4/20
to Wazuh mailing list
OK, so I fixed it. I am attaching the steps taken. Right or wrong, this allows the DockerListener.py to run on a given machine via the Wazuh agent. I saw that the DockerListener installed on the wazuh-manager by accident had a functional DockerListener as well as a .py. I had to edit it a little for lack of the /framework folders

Install Agent
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | tee -a /etc/apt/sources.list.d/wazuh.list
apt update
apt install wazuh-agent

Install Python for Docker
apt install python-pip
pip install docker

Edit Config
cd /var/ossec/etc/ossec.conf
add ManagerIP
add Docker Listener wodle:

<wodle name="docker-listener">
    <disabled>no</disabled>
</wodle>

Fix Broken default DockerListener
mv DockerListener DockerListener.py
copy dockerlistener config from below
nano DockerListener

paste in:

#!/bin/sh
# Copyright (C) 2015-2020, Wazuh Inc.
# Created by Wazuh, Inc. <in...@wazuh.com>.
# This program is free software; you can redistribute it and/or modify it under the terms of GPLv2

WPYTHON_BIN="/usr/bin/python"
SCRIPT_PATH_NAME="$0"

DIR_NAME="$(cd $(dirname ${SCRIPT_PATH_NAME}); pwd -P)"
SCRIPT_NAME="$(basename ${SCRIPT_PATH_NAME})"

case ${DIR_NAME} in
    */active-response/bin | */wodles*)
        if [ -z "${WAZUH_PATH}" ]; then
            WAZUH_PATH="$(cd ${DIR_NAME}/../..; pwd)"
        fi

        PYTHON_SCRIPT="${DIR_NAME}/${SCRIPT_NAME}.py"
    ;;
    */bin)
        if [ -z "${WAZUH_PATH}" ]; then
            WAZUH_PATH="$(cd ${DIR_NAME}/..; pwd)"
        fi

        PYTHON_SCRIPT="${WAZUH_PATH}/framework/scripts/${SCRIPT_NAME}.py"
    ;;
     */integrations)
        if [ -z "${WAZUH_PATH}" ]; then
            WAZUH_PATH="$(cd ${DIR_NAME}/..; pwd)"
        fi

        PYTHON_SCRIPT="${DIR_NAME}/${SCRIPT_NAME}.py"
    ;;
esac


${WPYTHON_BIN} ${PYTHON_SCRIPT} "$@"

chown root:ossec DockerListener
chmod +x DockerListener

Systemctl enable wazuh-agent
systemctl start wazuh-agent

I had to remove a $ wazuh variable in the last line which got it running.

elw...@wazuh.com

unread,
Dec 10, 2020, 4:00:41 AM12/10/20
to Wazuh mailing list
Hello Matt,

Glad to see that everything is fixed now.

Hope you will enjoy it.

Regards,
Wali
Reply all
Reply to author
Forward
0 new messages