<?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 Khalid Chbail on Medium]]></title>
        <description><![CDATA[Stories by Khalid Chbail on Medium]]></description>
        <link>https://medium.com/@khalid.chbail4?source=rss-14219e4b50cb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YnIMmVAlWRAfwhz9ccm1jA.png</url>
            <title>Stories by Khalid Chbail on Medium</title>
            <link>https://medium.com/@khalid.chbail4?source=rss-14219e4b50cb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 23:37:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@khalid.chbail4/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[Building a Home SOC Lab (Part 1)- ELK Stack SIEM solution]]></title>
            <link>https://medium.com/@khalid.chbail4/building-a-home-soc-lab-part-1-elk-stack-siem-solution-b82dd396836f?source=rss-14219e4b50cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b82dd396836f</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Khalid Chbail]]></dc:creator>
            <pubDate>Mon, 06 May 2024 09:19:06 GMT</pubDate>
            <atom:updated>2024-07-05T14:37:37.684Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Home SOC Lab - ELK Stack SIEM solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*d0sFbYXssunZcZuEYVCKbg.gif" /></figure><p>Welcome to our journey in building a Home SOC (Security Operations Center) Lab! Here, we’ll explore the process of creating a simulation of a SOC environment right from the comfort of your home. Our focus will be on implementing the ELK Stack SIEM (Security Information and Event Management) solution, a powerful toolset for centralizing log management, detecting security threats, and facilitating incident response. Whether you’re a cybersecurity enthusiast, a hobbyist, or an aspiring professional, this journey will provide you with practical guidance and hands-on experience in building your very own SOC lab.</p><p>In this part, our focus will be on the detailed implementation phase. We will proceed step by step to establish our SOC lab environment and thoroughly test its functionality.</p><p>Let the hunt begin!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/0*1BlXKaCQgyYJ2xm9.png" /></figure><h3><strong>Pfsense Firewall:</strong></h3><p>Firewalls serve as the primary defense mechanism within a network, acting as a boundary between the external internet and an internal network. Understanding and configuring firewalls are fundamental aspects of cybersecurity.</p><p>Think of pfSense as a special version of FreeBSD, which works like a digital bouncer for our network. It stands at the door, checking who’s allowed in and who’s not. Using a simple web interface, we can tell it the rules to follow for letting data in and out of our network.</p><p><em>Implementing:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*XdaH_ZXgjfYleLQbMQ5uZw.png" /><figcaption>On VMware</figcaption></figure><p>pfSense will serve as a bridge for our network, which is why we’re setting it up as a router with three interfaces:</p><ol><li>NA: This interface will handle Network Address Translation (NAT), ensuring access to the internet for devices on our network.</li><li>NA2: This is the LAN interface.</li><li>NA3: This interface will be dedicated to the Kali machine, which we’ll use in the next phase of the project for testing purposes.</li><li>NA4: The interface to which both the SIEM and the Threat Intelligence system will connect.</li></ol><blockquote>This article will assist you to install and configure pfsense rules correctly:<strong> </strong><a href="https://medium.com/@justinmangaoang/installing-and-configuring-pfsense-8d89f01d9c5d"><strong>Installing and Configuring pfSense</strong></a></blockquote><p>After we finish installing, we’ll need to set up the IP addresses for the interfaces:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*FulFsrdf_gtxJ07Lv3mZsw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*p-V7PPA_hdRiSlxGJQLYfA.png" /></figure><p>At the moment, we’ll skip setting up the interface specifically for the Kali machine. We’ll save that for the next phase.</p><p>We’ll access the pfSense web GUI by entering 10.0.0.1 into our host computer’s browser. You might encounter an error, but don’t worry. Just choose Advanced and then Accept the Risk and Continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zOGI2GkrW5jo29yLaNiY3Q.png" /><figcaption>pfSense GUI</figcaption></figure><h3>Snort (Network Intrusion Detection &amp; Prevention System):</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*oiUGFovC862L_fya.png" /></figure><p><em>what is snort?</em></p><p>Snort is recognized as the leading Open Source Intrusion Prevention System (IPS) globally. It operates by utilizing a set of rules to identify potentially malicious network activity, generating alerts for users upon detecting packets that match these rules.</p><p>In addition to alerting, Snort can also be deployed inline, enabling it to actively block these packets. It serves three primary functions:</p><ol><li>Packet Sniffer: Similar to tools like tcpdump, Snort captures and analyzes network traffic packets.</li><li>Packet Logger: It logs network traffic, aiding in the debugging of network issues.</li><li>Network Intrusion Prevention System (IPS): Snort can function as a comprehensive system for actively preventing and mitigating network intrusions.</li></ol><blockquote>In our lab, Snort will operate as a packet sniffer &amp; logger at the same time. It will monitor the traffic within our network, observing for any suspicious activity. Upon detecting packets that match predefined rules, it will generate alerts, which will be sent to the SIEM.</blockquote><h3>Snort rules:</h3><p>Snort rules are like the gatekeepers of a network, sniffing out potential threats and vulnerabilities. They’re essentially filters that examine network traffic and trigger alerts or take action when they detect suspicious or malicious activity. Let me break it down with a simple an example to illustrate how Snort rules can be used to detect a broader range of threats. Let’s say we want to detect suspicious SQL injection attempts targeting a web server.</p><pre>alert tcp any any -&gt; any 443 (msg:&quot;SQL Injection Attempt Detected&quot;; flow:to_server,established; content:&quot;SELECT&quot;; nocase; http_uri; pcre:&quot;/(\%27)|(\&#39;)|(\-\-)|(\%23)|(#)/i&quot;; metadata:service http;)</pre><ul><li>alert tcp any any -&gt; any 443: This specifies the header for a TCP rule, targeting traffic from any external IP address to the HTTP servers on any port they&#39;re listening on.</li><li>msg:&quot;SQL Injection Attempt Detected&quot;;: This is the message that will be logged when the rule matches.</li><li>flow:to_server,established;: This specifies that we&#39;re interested in the traffic going to the server side of the connection and only want to inspect established connections.</li><li>content:&quot;SELECT&quot;; nocase; http_uri;: This checks if the word &quot;SELECT&quot; (case-insensitive) appears in the HTTP URI.</li><li>pcre:&quot;/(\%27)|(\&#39;)|(\-\-)|(\%23)|(#)/i&quot;;: This is a PCRE (Perl Compatible Regular Expression) that looks for common SQL injection patterns like single quote (%27), double dash (--), and hash (#) in the HTTP URI.</li><li>metadata:service http;: This provides metadata about the service being targeted, in this case, HTTP.</li></ul><blockquote>This rule is quite comprehensive. It checks for the presence of the word “SELECT” in the URI (indicating a SQL query), and then uses a regular expression to look for common SQL injection patterns. If any of these patterns are found in the URI of the HTTP request, Snort will generate an alert.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v9m6HW6C8SI_2RWW.jpeg" /></figure><p>The Elastic Stack, formerly known as ELK, consists of four essential components:</p><ol><li>Elasticsearch: The search engine and analytics platform.</li><li>Logstash: The data processing pipeline.</li><li>Kibana: The data visualization tool.</li><li>Beats: An additional integration (for logs collecting).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*tHyXtTZzpN3YqhyX.png" /><figcaption>ELK Architecture</figcaption></figure><p>When used well, these parts make a strong system for handling big data in real-time. Businesses often use the Elastic/ELK stack to:</p><ol><li>Conduct comprehensive log analysis.</li><li>Perform real-time analytics.</li><li>Address challenges requiring exploration, analysis, and visualization of extensive data volumes.</li></ol><h3>Implementation:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*ZlL264X8YG2fvTMUx4uW7Q.png" /><figcaption>Our SIEM environment (Ubuntu server)</figcaption></figure><p><em>Step 1: Install Dependencies:</em></p><p><strong>Install java</strong></p><p>To run the ELK stack smoothly, make sure you’ve got Java 8 installed. While some parts work with Java 9, Logstash isn’t one of them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*a-v6VwTQAGMG5b6d3fw1TQ.png" /><figcaption>The output you are looking for is 1.8.x_xxx. That would indicate that Java 8 is installed.</figcaption></figure><p>If you’ve already got Java 8 up and running, feel free to move on to the next step: <strong>installing Nginx</strong>.</p><p>However, if you haven’t installed Java 8 yet, here’s what you need to do: Open a terminal window and type in the following command:</p><pre>sudo apt-get install openjdk-8-jdk</pre><p><strong>Install Nginx:</strong></p><p>Nginx serves as both a web server and a proxy server. It’s handy for setting up password-protected access to the Kibana dashboard.</p><p>To get Nginx installed, just enter the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*SK6rfOXwuVRn8ToW_NIBbQ.png" /><figcaption>sudo apt-get install nginx</figcaption></figure><p><em>Step 2: Add Elastic Repository:</em></p><p>Elastic repositories give you access to all the open-source software in the ELK stack. To get started with them, let’s begin by importing the GPG key.</p><p>Simply enter the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*dx4BYOvaT1CIjzfGSJolWw.png" /></figure><pre>wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -</pre><pre>sudo apt-get install apt-transport-https</pre><pre>echo &quot;deb https://artifacts.elastic.co/packages/7.x/apt stable main&quot; | sudo tee –a /etc/apt/sources.list.d/elastic-7.x.list</pre><p><em>Step 3: Install &amp; configure Elasticsearch:</em></p><p>Install Elasticsearch:</p><pre>sudo apt-get install elasticsearch</pre><p>Configure Elasticsearch:</p><p>we will edit the configuration file by:</p><pre>sudo apt-get install elasticsearch</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*Wj_uiQyG8HKqnn3flBt4tw.png" /><figcaption>Scroll down into “Network” &amp; edit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*teIYbjGXiQEgqks1POeXWw.png" /><figcaption>Scroll down into “Discovery” &amp; edit</figcaption></figure><pre>sudo nano /etc/elasticsearch/jvm.options</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*BBxNubj2JHtqQCBJ.png" /><figcaption>Find the lines starting with <strong>-Xms</strong> and <strong>-Xmx</strong>. In the example below, the maximum (<strong>-Xmx</strong>) and minimum (<strong>-Xms</strong>) size is set to 512MB</figcaption></figure><p>start and enable elasticsearch:</p><pre>sudo systemctl start elasticsearch.service</pre><pre>sudo systemctl enable elasticsearch.service</pre><p><em>Step 4: Install &amp; Configure Kibana:</em></p><pre>sudo apt-get install kibana</pre><pre>sudo nano /etc/kibana/kibana.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*9srfZKHbifjn2z7bbiPLkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*Grp0Gxhj8p5C70rYI77a3A.png" /></figure><p><strong>Start and Enable Kibana:</strong></p><pre>sudo systemctl start kibana</pre><pre>sudo systemctl enable kibana</pre><p>To hop into Kibana, just pop open your web browser and head over to this address:</p><pre><br>http://localhost:5601</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoBSi-G-wb8D7SaCJ4pnkA.png" /></figure><p>To keep our article concise, we’ll cover the rest of implementation details (snort, linking pfsense, Beats, the triplet :Cortex, theHive &amp; MISP…) in upcoming sections. Afterward, we’ll thoroughly test our environment against a variety of known attacks to ensure everything functions as expected. If you have any questions or observations, please don’t hesitate to contact me via LinkedIn <a href="https://www.linkedin.com/in/khalid-chbail-b13b55228/"><strong>Khalid Chbail</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b82dd396836f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>