<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nayan Bhattarai on Medium]]></title>
        <description><![CDATA[Stories by Nayan Bhattarai on Medium]]></description>
        <link>https://medium.com/@nayanbhattarai_13918?source=rss-d96acf5dd5a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wljWZIIWaMTjh43Q</url>
            <title>Stories by Nayan Bhattarai on Medium</title>
            <link>https://medium.com/@nayanbhattarai_13918?source=rss-d96acf5dd5a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 20:42:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nayanbhattarai_13918/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Install SIEM in your home lab: Wazuh Edition]]></title>
            <link>https://medium.com/@nayanbhattarai_13918/install-siem-in-your-home-lab-wazuh-edition-5de9481f7a2e?source=rss-d96acf5dd5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5de9481f7a2e</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[security-operation-center]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[siem]]></category>
            <dc:creator><![CDATA[Nayan Bhattarai]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 15:35:44 GMT</pubDate>
            <atom:updated>2022-12-26T11:00:55.009Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Organizations try to integrate different tools to secure the end devices. They are struggling to find one tool under which various tools are integrated such as asset discovery, vulnerability assessment, Ensuring secure system configuration, and Monitoring all assets to detect attacks.</blockquote><h3>The Solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*TS653JP8KAq8-UCCUIqJwQ.png" /></figure><h4>WAZUH</h4><p>Wazuh is an open-source unified XDR and SIEM platform. Due to its free and open-source nature, many small and medium enterprises use it to monitor threats, incidents, compliance, and integrity. The ability of Wazuh to protect workloads across a virtualized, containerized, and cloud-based environment has made it popular among many security companies.</p><h4>HOW?</h4><p>In order to monitor endpoints with Wazuh, agents are deployed on the devices. As security events are collected from monitored endpoints, the Wazuh agent forwards them to the Wazuh server for log analysis and correlation.</p><h4>WHY Wazuh?</h4><p>A number of modules are integrated into the Wazuh platform in order to improve the overall security of an organization. Some of the important modules are listed below:</p><ul><li>System inventory</li><li>Vulnerability detector</li><li>Security configuration assessment (SCA)</li><li>Threat detection and response</li></ul><h3>Installing Wazuh Server</h3><p>There are different ways to deploy wazuh such as installing on the central server or installing different components on a different server. The main difference between centralized installation and installation of different components on different servers is that where centralized installation cannot provide scalability for example if the one component failed of wazuh failed on the central system then the whole system can go down whereas in distribution installation one can server can go down but all other servers can work properly.</p><h4>Deploying Wazuh Server using OVA</h4><p>There are different versions of the wazuh so firstly we should ensure our requirements before downloading the OVA file. There can be changes in the component of the wazuh for example wazuh 4.2 vs 4.3.</p><blockquote>Also, keep note that the version of elasticsearch and kibana should be matched.</blockquote><h4><strong>Wazuh 4.2 Components:</strong></h4><p><em>CentOS 7</em></p><p><em>Wazuh manager: 4.2.7</em></p><p><em>Open Distro for Elasticsearch: 1.13.2</em></p><p><em>Filebeat-OSS: 7.10.2</em></p><p><em>Kibana: 7.10.2</em></p><p><em>Wazuh Kibana plugin: 4.2.7–7.10.2</em></p><h4><strong>Wazuh 4.3 Components:</strong></h4><p><em>Wazuh manager 4.3.9</em></p><p><em>Wazuh indexer 4.3.9</em></p><p><em>Filebeat-OSS 7.10.2</em></p><p><em>Wazuh dashboard 4.3.9</em></p><p><strong>Now Let’s deploy</strong></p><ul><li>The first step is to download wazuh OVA file from the wazuh website. <a href="https://packages.wazuh.com/4.x/vm/wazuh-4.3.9.ova">Links to download OVA file.</a></li><li>The second step is to import the file into the virtual machine.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gsp_55286-bbPIav04xwsQ.png" /></figure><ul><li>Importing wazuh server from the download locations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Zk8Lx4wRWwgAOFNnYrXAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ewUWwmsmjvZEOTJX8fjR_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8FTkD9ulWny2oZcIMeqojA.png" /></figure><ul><li>Making changes to the Network setting in the virtual machine. Setting up the network into bridge mode.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tKeD0F69QIeKgBeps5U5xg.png" /></figure><ul><li>Now stating the wazuh server.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFTLHp31LltVrtro9ngD9w.png" /><figcaption>The default username and password ot the wazuh is wazuh:wazuh</figcaption></figure><ul><li>Now accessing the wazuh server from the web. By firing the URL of the wazuh server in the browser.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U5Hnn5D-SwTaUbjKvRh6ww.png" /><figcaption>Accessing Wazuh from the web.</figcaption></figure><h3>Manual Installation</h3><p>The first step is to download the Centos ISO file from Centos Website(<a href="http://repo.extreme-ix.org/centos/7.9.2009/isos/x86_64/">http://repo.extreme-ix.org/centos/7.9.2009/isos/x86_64/</a>). The next step will be installing centos on our virtual machine(For windows) and for macOS (VMware Fusion). For this lab, I am gone be using VMware Fusion. So choose the virtualization software as per the operating system. It is not that Mac users can’t install centos or vice versa on a virtual machine, you can so choose the software that can be friendly to you.</p><p>Then after installing virtualization tools, the next step will be installing the centos machine by importing an IOS file into the virtualization software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVQah0RaGkoY8v84ofN_wQ.png" /></figure><p>Fill in the required information about the user in the system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3JAurW3xzpdjrJ84GBtA3Q.png" /></figure><p>Now the installation progress starts as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwEZ-700O_X1LD7SF6FiLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pez5giGfdQkeQtHFpi8R5Q.png" /></figure><p>After completing the installation of centos. Now, we can check the IP address of the machine as shown in the figure below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7qdbmZHilqx4s4noQZP5qA.png" /><figcaption>Checking the IP address of the Server.</figcaption></figure><p>Note to be able to install the wazuh server we must be root. Hence next step will be creating a sudo user in the system and this can be done by adding the super-user from the GUI by filling in the required information as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KcshyQt-CzNa5Rhpkdz7Xg.png" /><figcaption>Searching for user settings.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kZdH32nsg3kcGHq2FHpuEw.png" /><figcaption>Creating superuser.</figcaption></figure><p>Now I have SSH to the centos system from my system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vOcOGoxFXE6YEEDZn6pwiQ.png" /></figure><h4>Now let’s install Wazuh</h4><p>Before installing wazuh components the first step is to install the required package by firing the command as shown below:</p><pre>yum install zip unzip curl</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFYjnv4ee-T6uDquWoHiLw.png" /></figure><p>The first step will be adding a GPG key to maintain and verify the integrity of a package. To know more about GPGvisit (<a href="https://www.redhat.com/sysadmin/rpm-gpg-verify-packages">https://www.redhat.com/sysadmin/rpm-gpg-verify-packages</a>).</p><pre>rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NhSVoFzHlhbU9c8hx7javw.png" /></figure><p>The second step will be adding a repo to our system by firing the command shown below:</p><pre>cat &gt; /etc/yum.repos.d/wazuh.repo &lt;&lt; EOF<br>[wazuh]<br>gpgcheck=1<br>gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH<br>enabled=1<br>name=EL-\\$releasever - Wazuh<br>baseurl=https://packages.wazuh.com/4.x/yum/<br>protect=1<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxkNZc9hJlnwd_uj9hh9Tg.png" /></figure><p>Now let’s install the wazuh manager by firing the following command in the terminal.</p><pre>yum install wazuh-manager-4.2.7-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xKUlnk3yeavAyuGaVlB_lA.png" /></figure><p>After installing now, enable and start the Wazuh manager service by firing the following command :</p><pre>systemctl daemon-reload<br>systemctl enable wazuh-manager<br>systemctl start wazuh-manager</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tIfH4FfIHD0mV6kZVJlp3Q.png" /></figure><blockquote>systemctl deamon-realload command means that the program can run continuously in the background and wakes up and handle the periodic service request. For example in our case deamon takes care of the sub-process to ensure the wazuh-manager and other required utility is working properly.</blockquote><blockquote>Note the systemctl enable wazuh-manager will tell the system to start wazuh manager upon reboot. Without this wazuh manager cannot be started after reboot.</blockquote><p>We should make sure the wazuh manager starts successfully by firing the following command.</p><pre>systemctl status wazuh-manager</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9Le9TGV3r1s7G2J42Hqhg.png" /></figure><blockquote>Note after starting the wazuh manager, along with the wazuh manager sub-process also started such as wazuh-authd, wazuh-db, wazuh-execd, and others that are responsible for advanced features within the wazuh manager. For example, the wazuh-log collector is responsible for collecting logs from the agent. If somehow the wazuh-log collector goes down then logs from the agent are not able to collect logs from the agent. Hence it is always recommended to check the subprocess as well. Another deamon is wazuh-remote which is responsible for executing commands in the agent. By configuring this deamon we can execute pretty much any command from the wazuh server to the agent.</blockquote><p>Now, let’s check the wazuh manager port on the system by firing up the following command:</p><pre>netstat -ltpnd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OmSpHJizmPwnY9KL2Q76DA.png" /></figure><blockquote>Port number 1515 is used for authentication i.e wazuh-authd and 1514 is used for executing commands on the agent device i.e wazuh-remoted. At first, an agent communicates to the wazuh manager on port 1515 for authentication. After successfully establishing a connection with wazuh server now agent forwards logs to the wazuh manager on port 1514 and as well it can also execute remote commands on the agent. For more information about wazuh manager port follow this link (<a href="https://documentation.wazuh.com/current/getting-started/architecture.html">https://documentation.wazuh.com/current/getting-started/architecture.html</a>)</blockquote><blockquote>Note: For beginners, it is recommended to disable the firewall in the wazuh manager because as a beginner we don’t know the required port of the wazuh and its components. For easy installation, we can disable the firewall simply by firing the following command:</blockquote><pre>systemctl disable firewalld</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*thXEfGWlIyLcAYrKasfE_w.png" /></figure><p>Now installing elasticsearch on the system:</p><p>The first step will be adding elasticsearch repo to our local repo. To add execute the following commands in the terminal.</p><pre>rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch</pre><pre>cat &gt; /etc/yum.repos.d/elastic.repo &lt;&lt; EOF<br>[elasticsearch-7.x]<br>name=Elasticsearch repository for 7.x packages<br>baseurl=https://artifacts.elastic.co/packages/7.x/yum<br>gpgcheck=1<br>gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch<br>enabled=1<br>autorefresh=1<br>type=rpm-md<br>EOF</pre><p>Now the step will be installing the elasticsearch.</p><pre>yum install elasticsearch-7.14.2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q_BzLBI2JtCmNXOPGwcrLw.png" /></figure><p>After installing elasticsearch now enable and start the elasticsearch service by firing the following command :</p><pre>systemctl daemon-reload<br>systemctl enable elasticsearch<br>systemctl start elasticsearch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_l-eEc2z2TsBHvp_ZMHoA.png" /></figure><p>At last list out the port required by the elasticsearch to function properly. Port 9200 is used by the elastic search for listening connection and 9300 is used by the elastic search for cluster communication.</p><p>Filebeat runs on a wazuh manager and also runs as a separate service from the wazuh manager. Filebeat is responsible for forwarding the logs from the wazuh manager to elastic search. Filebeat also known as logs shipper.</p><h4>Installing Filebeat:</h4><pre>yum install filebeat-7.14.2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6pe2dPs2zXVQiLifxuP__Q.png" /></figure><p>Now it is time to test whether the wazuh manager forwards the logs with the help of filebeat. To check this we need to execute the following command.</p><pre>filebeat test output</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x0WfWvS-vyUSFwuhUYXJ2A.png" /></figure><p>Downloading the alerts template for Elasticsearch:</p><pre>curl -so /etc/filebeat/wazuh-template.json [&lt;https://raw.githubusercontent.com/wazuh/wazuh/4.2/extensions/elasticsearch/7.x/wazuh-template.json&gt;](&lt;https://raw.githubusercontent.com/wazuh/wazuh/4.2/extensions/elasticsearch/7.x/wazuh-template.json&gt;)<br>chmod go+r /etc/filebeat/wazuh-template.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7M8jcTI-cdV19z539BRIyA.png" /></figure><p>Downloading the Wazuh module for Filebeat:</p><pre>curl -s https://packages.wazuh.com/4.x/filebeat/wazuh-filebeat-0.2.tar.gz | tar -xvz -C /usr/share/filebeat/module</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oOO_6XJxYQM8RD78pE9CKA.png" /></figure><p>Enabling and Starting the filebeat services:</p><pre>systemctl daemon-reload<br>systemctl enable filebeat<br>systemctl start filebeat</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LkAa36oKo94uMdcvR838Mg.png" /></figure><h4>Installing Kibana</h4><pre>yum install kibana-7.14.2 -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FX0WsAi4lLnHHVqeHHSCRA.png" /></figure><p>We are not going to use encryption for secure communication hence we need to modify our kibana configuration as below:</p><blockquote><a href="http://server.host/">Server.host</a>: should be the IP address of the kibana. (For our case we have to install wazuh manager elastic search and kibana on the same machine if had. installed these three components on a different server then we need to add IP addresses accordingly)</blockquote><p>The next is no comment out (#) from elasticsearch.password to the last point.</p><pre>nano /etc/kibana/kibana.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mC8iOq2Ahlv2d8q21hhBKQ.png" /></figure><p>Enabling and Starting kibana services:</p><pre>systemctl daemon-reload<br>systemctl enable kibana<br>systemctl start kibana</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*COgCUyWkvwF4glj5-juKdQ.png" /></figure><p>From the picture below we know all our servers are running such as port numbers 1514,1515, 8080, 55000, 92300, and 9300. From this we know our wazuh server is ready to receive logs from the agent so now, we can install the agent on our system and start collecting logs from the agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dy6j5BMIWpVRY_PU7eO5LQ.png" /></figure><h4>Installing the agent on the end system</h4><p>To do so now let’s install the wazuh agent on the system. For our case, we are going to install the wazuh agent on Linux. To install the agent on the system follow the following steps:</p><p><em>Navigate to the wazuh and from wazuh navigate to the agent tab.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbvMMUvQvvfUQomLa-86Pw.png" /><figcaption>Navigating to the agent tab.</figcaption></figure><p>After navigating to the agent tab, a new tab will popups then click on deploy agent. After clicking on deploy agent again a new window will pop up as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZGvMbbhdJLOsfiDYgfsFTQ.png" /></figure><p>Now select the Operating System for our case we select Debian/Ubuntu. After selecting the operating system now choose the system architecture i.e 64bit or 32-bit. In our case, we select x86_64 i.e 32-bit. Then step 3 fill in the IP address of the wazuh manager for our case <strong>192.168.101.27.</strong> After filling up the IP address then we should define a group for our case we choose the default group.</p><p>Now paste the command from step 5 from the screenshot into the system(end device).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glJDuHp3Lwy55Ty1DbdEyA.png" /></figure><p>Now starting the wazuh agent on the client devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QfuCPflqidTSOLTeEzcdew.png" /></figure><p>If the device shows Never connected on the dashboard then we should restart the wazuh agent by executing the following command as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UORFQIklej7a9YMDuyGlgg.png" /></figure><p>Checking the agent status on the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zDD3PxWz1kWCADvCeAoO1Q.png" /></figure><p>Now we successfully connected the agent to the wazuh manager.</p><p>Now let’s check whether the logs are coming to the kibana or not by navigating to the Analyst tab and under the Discover tab as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poYP1sJLJExM9Qpl4Bsi9A.png" /></figure><p><strong><em>A follow-up article will be published on how to add log sources from network devices and enroll new/custom log sources.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5de9481f7a2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>