<?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 SealTeamSecs on Medium]]></title>
        <description><![CDATA[Stories by SealTeamSecs on Medium]]></description>
        <link>https://medium.com/@sealteamsecs?source=rss-77c948225513------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Q771AvslKGBcf00oxN4Agw.jpeg</url>
            <title>Stories by SealTeamSecs on Medium</title>
            <link>https://medium.com/@sealteamsecs?source=rss-77c948225513------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:12:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sealteamsecs/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[Local LLM Installation Guide: Install Llama3 using Ollama]]></title>
            <link>https://medium.com/@sealteamsecs/local-llm-installation-guide-install-llama3-using-ollama-ef8cf68bb461?source=rss-77c948225513------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef8cf68bb461</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[gen-ai-tools]]></category>
            <category><![CDATA[llama-2]]></category>
            <category><![CDATA[llama-3]]></category>
            <dc:creator><![CDATA[SealTeamSecs]]></dc:creator>
            <pubDate>Wed, 15 May 2024 02:29:52 GMT</pubDate>
            <atom:updated>2024-05-15T02:29:52.961Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why Install an LLM Locally?</h3><p>Installing a large language model (LLM) like Llama3 locally comes with several benefits:</p><ol><li>Privacy: Your data stays on your device, ensuring higher privacy.</li><li>Speed: Local installations can be faster since there’s no need to communicate with remote servers.</li><li>Control: You have full control over the environment, configurations, and updates.</li><li>Accessibility: Work offline without relying on an internet connection.</li></ol><h3>What is Ollama?</h3><p>Ollama is an AI tool designed to allow users to set up and run large language models, like Llama, directly on their local machines. This tool is ideal for a wide range of users, from experienced AI professionals to hobbyists keen to delve into natural language processing without depending on cloud services.</p><p>The main goal of Ollama is to offer a platform that is accessible, efficient, and easy to use for running advanced AI models locally. By enabling local execution, Ollama provides users with faster processing, improved privacy, and the flexibility to customize and develop models suited to their specific needs.</p><p>Now, let’s get Ollama set up on your device!</p><h3>Step 1: Installing Ollama on Windows</h3><p>For this exercise, I am running a Windows 11 with an NVIDIA RTX 3090. This is important for this because the setup and installation, you might need</p><p>First, we’ll install Ollama using Windows Subsystem for Linux (WSL).</p><p>Note: You don’t need to do this step if you’re using Ubuntu without WSL.</p><h4>Open Your Terminal</h4><p>Fire up your terminal and type the following command to install WSL:</p><pre>wsl - install</pre><h3>Step 2: Setting Up Ollama on Ubuntu (and Linux Subsystem)</h3><p>Now that WSL is set up, it’s time to install Ollama on Ubuntu. If you’re using a different Linux distribution, these steps should still work with minor tweaks.</p><h3>Update and Upgrade Your System</h3><p>Let’s make sure your system is up-to-date:</p><pre>sudo apt update<br>sudo apt upgrade -y</pre><h3>Install Ollama</h3><p>Run this command to download and install Ollama:</p><pre>curl -fsSL https://ollama.com/install.sh | sh</pre><h3>Check if Ollama is Running</h3><p>To verify that Ollama is running, open your browser and go to:</p><pre>http://localhost:11434</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*YNM54NntHE5NB6-5Uoam-Q.png" /></figure><h3>Pull and Run Llama3</h3><p>At this point, Ollama is running, but we need to install an LLM. Let’s pull and run Llama3, one of Ollama’s coolest features:</p><pre>ollama pull llama3<br>ollama run llama3</pre><p>This will take some time to download since llama3 is about 4GB. You can also look at other models (you can install multiple models). You can find the list of installable models here: <a href="https://ollama.com/library">https://ollama.com/library</a></p><p>After you install and run llama3 (or whichever model you choose) you should be able to type in your terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3IA-OKh2WigzBtJGZ9Uww.png" /></figure><p>The great part about this is that no internet connection is necessary!</p><p>That’s it! Now you have llama3 running! But What if you don’t like chatting in the terminal? That’s the cool part, now you can add a WebUI and keep a history of chats!</p><h3>Step 3: Installing the WebUI</h3><p>Ollama’s WebUI makes managing your setup a breeze. Here’s how to get it up and running. (I ran the following commands in Windows WSL)</p><h3>Install Docker</h3><p>Docker is essential for the WebUI. Follow these steps to install it:</p><ol><li>Add Docker’s Official GPG Key:</li></ol><pre>sudo apt-get update<br>sudo apt-get install ca-certificates curl<br>sudo install -m 0755 -d /etc/apt/keyrings<br>sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc<br>sudo chmod a+r /etc/apt/keyrings/docker.asc</pre><p>2. Add the Repository to Apt Sources:</p><pre>echo \<br>&quot;deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \<br>$(. /etc/os-release &amp;&amp; echo &quot;$VERSION_CODENAME&quot;) stable&quot; | \<br>sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null<br>sudo apt-get update</pre><p>3. Install Docker:</p><pre>sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</pre><h3>Run Docker</h3><p>Now, let’s run Docker to set up the WebUI:</p><pre>sudo docker run -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main</pre><h3>Access the WebUI</h3><p>Open your browser and go to:</p><p><a href="http://localhost:8080/">http://localhost:8080</a></p><p>Sign up on the web portal, and you’re good to go!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wpNIcZ3Ihb_u78z5U7Kg0w.png" /><figcaption>Make sure to select the model you would like to use!</figcaption></figure><p>Congratulations! You’ve successfully installed Ollama on your device. Now you can explore its features and make the most of this powerful tool. If you run into any issues or have questions, feel free to leave a comment below. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef8cf68bb461" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring OpenCTI]]></title>
            <link>https://medium.com/@sealteamsecs/configuring-opencti-8734b7033e1d?source=rss-77c948225513------2</link>
            <guid isPermaLink="false">https://medium.com/p/8734b7033e1d</guid>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[SealTeamSecs]]></dc:creator>
            <pubDate>Wed, 06 Mar 2024 02:10:05 GMT</pubDate>
            <atom:updated>2024-03-06T02:10:05.207Z</atom:updated>
            <content:encoded><![CDATA[<p>In the last <a href="https://medium.com/@sealteamsecs/setting-up-opencti-abfd8cf21952">post</a>, we discussed installing OpenCTI. Now we’re going to talk about setting it up to be usable. If you haven’t already installed it, now would be a good time to go back to my previous post and do that.</p><h3>Let’s Get Some Data</h3><p>We will do a quick walk through of the interface later, but looking at the interface won’t mean much until you have data coming in.</p><ol><li><strong>Connectors</strong></li></ol><p>OpenCTI has a lot of pre-built connectors that allow for ingesting data. You can find the list <a href="https://github.com/OpenCTI-Platform/connectors/tree/master/external-import">here</a>. For this write-up I am going to use a couple of the free ones.</p><p>Let’s start by pulling in data from MITRE. I like this connector because it ingests a lot of known APTs, tools, and the MITRE ATT&amp;CK as well.</p><p>Setting up a connector is super simple. First, just go into the connector you’d like and open the “docker-compose.yml”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xaHVp-6lKn7LTk7UYMASUw.png" /></figure><p>Once in the docker-compose file, select everything below the “services:” line and copy it into your Portainer Editor for your OpenCTI stack, then scroll down and paste it at the bottom (right above the “volumes:” line):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*kx9itn7MqGVSFayOvR334w.png" /></figure><p>Then make a few modifications, setting the following :<br> — OPENCTI_TOKEN=${OPENCTI_ADMIN_TOKEN}<br> — CONNECTOR_ID=ChangeMe</p><p>The “CONNECTOR_ID” will need to be set to a UUID. You can generate a new one <a href="https://www.uuidgenerator.net/">here</a>.</p><p>Once you update the stack, you can go back into OpenCTI and you should start to see data coming in. The main areas (for the MITRE connector) that data comes in, is under:</p><ol><li>Threats →Intrusion sets</li><li>Arsenal → Malware</li><li>Arsenal → Tools</li><li>Techniques → Attack patterns</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnZtq3hbNDkuwXRW01nRlw.png" /></figure><p>Now you can see APT profiles being ingested.</p><p><strong>My Favorite (Free) Connectors:</strong></p><ul><li>cisa-known-exploited-vulnerabilities</li><li>alienvault (requires free account on AlienVault)</li><li>malwarebazaar-recent-additions</li></ul><h3>My Favorite Features</h3><ol><li>RSS Feeds</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t7rPp14YF81YTrtLT_4lXA.png" /></figure><p>2. Investigations (Clustering)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0dGjVmySoe60PhkKvpJVSw.png" /></figure><p>3. Live Triggers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ao2Z5h4Sq-YiaparllcVow.png" /></figure><p>4. Endless Visualizations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Ioj4SNJIHdK75GmMIxlNQ.png" /></figure><p><strong>Conclusion</strong></p><p>OpenCTI continues to be developed but already has amazing visualizations, tons of integrations, and is super intuitive to use. I have worked with products that cost $200k+ that have fewer capabilities than this. I would highly recommend playing around with it and seeing if you can use it for your cybersecurity program. (FYI, I am not affiliated with this at all, simply a fan).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8734b7033e1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing OpenCTI]]></title>
            <link>https://medium.com/@sealteamsecs/setting-up-opencti-abfd8cf21952?source=rss-77c948225513------2</link>
            <guid isPermaLink="false">https://medium.com/p/abfd8cf21952</guid>
            <category><![CDATA[opencti]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[SealTeamSecs]]></dc:creator>
            <pubDate>Tue, 05 Mar 2024 20:20:23 GMT</pubDate>
            <atom:updated>2024-03-05T21:13:48.846Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is OpenCTI?</h3><p><a href="https://filigran.io/">OpenCTI</a> is an open-source platform designed to facilitate the management of cyber threat intelligence (CTI). It provides a structured environment that allows organizations to store, organize, visualize, and share their knowledge on cyber threats efficiently. The platform is built with collaboration in mind, allowing multiple teams within an organization to contribute to and benefit from a centralized intelligence repository.</p><h3>Why OpenCTI?</h3><ol><li>Centralized Intelligence Repository: OpenCTI can be used as a single source of truth for all cyber threat intelligence data. This centralized approach ensures that data is consistently formatted, easily accessible, and can be correlated across different pieces of intelligence.</li><li>Enhanced Incident Response: By incorporating intelligence directly into the incident note-taking platform, OpenCTI allows responders to quickly access relevant information during an incident. This immediate access to correlated data, including past events, victims, or Indicators of Compromise (IOCs), enables faster and more informed decision-making.</li><li>Streamlined Collaboration: OpenCTI’s collaborative framework encourages information sharing both within the organization and with external partners. This collective effort not only enriches the intelligence data but also fosters a culture of shared responsibility in cybersecurity defense.</li><li>Improved Threat Analysis and Visualization: The platform’s advanced analytical tools and visualization capabilities allow teams to identify patterns, trends, and connections within the data. These insights can lead to the discovery of previously unnoticed threats and vulnerabilities.</li><li>Easier Correlation and Attribution: With OpenCTI, correlating cyber threats with specific actors, campaigns, or incidents becomes significantly easier. This ability enhances an organization’s understanding of the threat landscape, enabling more targeted and effective defense strategies.</li></ol><h3>Installation</h3><h3>1. Setup an EC2 server on AWS</h3><p>Begin by launching an EC2 instance through the AWS Management Console. For running OpenCTI, I recommend selecting:</p><ul><li>Instance Type: Ubuntu Server (e.g., t2.xlarge) for a good balance of performance and cost.</li><li>Storage: Allocate at least 100GB of storage to accommodate the application and data.</li></ul><p>This setup ensures that your OpenCTI instance has enough resources to perform efficiently. In this installation, we will only be using one server, but if you need, you can create a swarm, which would allow multiple smaller servers to be utilized.</p><h3>2. Install Docker</h3><p>Docker is essential for running containerized applications like OpenCTI. Here’s how to install Docker on your Ubuntu EC2 instance:</p><ol><li>Update your package index and install necessary packages:</li></ol><pre>sudo apt-get update<br>sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common</pre><p>2. Add Docker’s official GPG key:</p><pre>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -</pre><p>3. Verify the key with the fingerprint:</p><pre>sudo apt-key fingerprint 0EBFCD88</pre><p>4. Add the Docker repository:</p><pre>sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable&quot;</pre><p>5. Update your package index and install Docker Engine and Docker Compose:</p><pre>sudo apt-get update<br>sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose</pre><p>6. Add your user to the Docker group to run Docker commands without ‘sudo’</p><pre>sudo usermod -aG docker $USER</pre><p>7. Restart your EC2 instance</p><h3>3. Install Portainer</h3><p>Portainer simplifies Docker container management. Follow these steps to install it:</p><ol><li>Create a directory for Portainer and navigate into it:</li></ol><pre>mkdir -p /opt/portainer &amp;&amp; cd /opt/portainer</pre><p>2. Download the Portainer Agent stack file:</p><pre>curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml</pre><p>3. Open the file with nano (or your preferred editor) and modify the &quot;ports&quot; section for external access:</p><pre>ports:<br>  - &quot;19000:9000&quot;<br>  - &quot;18000:8000&quot;</pre><p>4. Deploy Portainer using Docker:</p><pre>docker stack deploy --compose-file=portainer-agent-stack.yml portainer</pre><h3>4. Configuring OpenCTI on Portainer</h3><ol><li>Login to Portainer: Access Portainer by navigating to http://&lt;Your-EC2-Public-IP&gt;:19000. Use the setup wizard to create an admin account.</li><li>Create a New Stack: Choose a name for your stack and use the web editor to paste the contents of OpenCTI’s Docker Compose file from <a href="https://github.com/OpenCTI-Platform/docker/blob/master/docker-compose.yml">GitHub</a>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*hQ8wUmJjJrsveOjkE101BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmzOxduwYWBeSR_Opcz4wg.png" /></figure><p>3. Configuration Files: Download the .env.sample file from <a href="https://github.com/OpenCTI-Platform/docker/blob/master/.env.sample">GitHub </a>repository, rename it to .env, and modify the necessary variables:</p><ul><li>OPENCTI_ADMIN_PASSWORD=changeme</li><li>OPENCTI_ADMIN_TOKEN=ChangeMe_UUIDv4 (Generate a UUID <a href="https://www.uuidgenerator.net/version4">here</a>)</li><li>MINIO_ROOT_PASSWORD=changeme</li><li>RABBITMQ_DEFAULT_PASS=changeme</li></ul><p>That’s it. You should be able to access your OpenCTI instance on &lt;http://&lt;Your-EC2-Public-IP&gt;:8080&gt; using your username and password that you setup in your .env file.</p><p>Right now your OpenCTI instance might be a little empty. In the next write-up, we will discuss how to begin ingesting data and how to configure OpenCTI in a way that your teams can use it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abfd8cf21952" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DLL Search Order Hijacking]]></title>
            <link>https://medium.com/@sealteamsecs/dll-search-order-hijacking-c9c46ea9026c?source=rss-77c948225513------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9c46ea9026c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[dll-hijacking]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[SealTeamSecs]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 20:39:35 GMT</pubDate>
            <atom:updated>2023-09-08T20:39:35.055Z</atom:updated>
            <content:encoded><![CDATA[<h3>Summary</h3><p>Dynamic Link Library files hold procedures that Windows applications can call during execution. DLLs allow multiple programs to reference them simultaneously, saving memory, and allowing for easier modification of multiple applications.</p><p>Unless explicitly defined in the application, Microsoft Windows, by default, searches for DLL files in the following order:</p><ol><li>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs</li><li>Application Directory</li><li>C:\Windows\System32</li><li>C:\Windows\System</li><li>C:\Windows</li><li>Current Directory</li><li>PATH variables directory</li></ol><p>DLL Search Order Hijacking works by placing a DLL with the same name in a directory that is higher in the hierarchy or removing the legitimate DLL and replacing it with another, malicious DLL. This malicious DLL can trick some analysts by appearing to be a legitimate file.</p><h3>Simple Example</h3><p>In this example, I wrote a simple Windows executable that calls a DLL file (HelloWorld.dll). In this case, the legitimate DLL would be located in C:\Windows\System32.</p><p>Reviewing the search order, there are two possibilities for hijacking the malicious DLL. The first would be to place a malicious DLL higher in the hierarchy (the KnownDLLs registry or the application’s directory). The other possibility is to delete the legitimate DLL and place the malicious file lower in the hierarchy (C:\Windows\System folder or C:\Windows).</p><p>The images below show a simple DLL file that prints a statement when an executable call it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RGy33VQMWvBIQcNc.JPG" /><figcaption><em>Legitimate DLL that will be stored in C:\Windows\System32</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/0*yVR-Z47I68aR3aK6.JPG" /><figcaption><em>Source code of a poorly written application that references HelloWorld.dll but does not specify the file path for HelloWorld.dll</em></figcaption></figure><p>In the image below, we can see that HelloWorldRunner.exe is located in the C:\Users\SANSDFIR\Desktop\DLLSearch directory alone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2g5aW0NGjjB_6jb6.JPG" /><figcaption><em>Directory Listing</em></figcaption></figure><p>When we run HelloWorldRunner.exe, we receive the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j9LlJnQiWVRUsB6P.JPG" /></figure><p>Now we will create a malicious DLL file and name it HelloWorld.dll. This will be stored in the same directory that the executable is located in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XRU5SLOOkYS2IDu4.JPG" /><figcaption><em>This DLL file will open calculator.exe — this could also contain malicious C2 code</em></figcaption></figure><p>We will place this DLL file higher up in the search order:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/0*JecUl3eBBXS0jVt9.JPG" /></figure><p>Now when we run the same executable, it will reference this “malicious” DLL first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CvjJmKN9E-tXgImT.JPG" /><figcaption><em>Notice the text output changed and calculator opened</em></figcaption></figure><h3>Detection</h3><p>The first way to monitor for DLL Search Order Hijacking may be to identify DLLs in each of the directories to identify duplicate DLLs. If a DLL is found with the same name in C:\Windows\System32 and C:\Windows, this may indicate malicious activity. In addition, when an application is run, the application’s directory may also need to be searched.</p><p>A flaw in the method above is that it will not detect DLL Hijacking when the legitimate DLL is deleted. One solution to this may be to log the location (and name) of DLLs along with the applications that are using those DLLs. If the location of a DLL changes, additional analysis can be performed or action can be taken. Due to the large number of DLLs and files, it may be possible (and necessary) to only log applications that are using the Search Order and ignore those applications that are using the fully qualified path name of the DLL.</p><p>Source code can be found <a href="https://github.com/sealteamsecs/Projects/tree/main/DLLSearchOrderHijack-master">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9c46ea9026c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Drop in the (S3) Bucket]]></title>
            <link>https://medium.com/@sealteamsecs/a-drop-in-the-s3-bucket-733dc6cc9b74?source=rss-77c948225513------2</link>
            <guid isPermaLink="false">https://medium.com/p/733dc6cc9b74</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[SealTeamSecs]]></dc:creator>
            <pubDate>Tue, 22 Aug 2023 02:39:06 GMT</pubDate>
            <atom:updated>2023-08-22T02:39:06.654Z</atom:updated>
            <content:encoded><![CDATA[<p>Full Code: <a href="https://github.com/sealteamsecs/pythonscripts/blob/main/OpenS3Scanner.py">SealTeamSecs</a></p><p><strong>Introduction</strong></p><p>One of AWS’s most popular services, the Simple Storage Service (S3), offers scalable object storage, making it a go-to solution for hosting static websites, backups, big data, and much more. However, with great power comes great responsibility. Misconfigurations in S3 bucket permissions can lead to unintended public access, exposing sensitive data to anyone who knows where to look.</p><p>Fortunately, even with misconfigured S3 buckets, you have security by obscurity, because abuse of these buckets would require knowing the bucket name. Setting aside a threat actor’s ability to find S3 buckets by monitoring traffic to and from applications, many organizations use naming conventions that are common and easily guessed. These common naming conventions provide us a starting point.</p><p>Enter my Python script: a tool designed to scan AWS S3 buckets and identify those that are open to the public. I do want to give a huge shout-out because this script is heavily influenced by the open-source tool, <a href="https://github.com/smicallef/spiderfoot">Spiderfoot</a>. Spiderfoot provides a plethora of modules for reconnaissance, and my script borrows some of its methodologies to efficiently pinpoint open S3 buckets. I made some modifications to the script to allow it to run as a stand-alone script and make it easier to modify for keywords.</p><p><strong>S3 Bucket Format</strong></p><p>Let’s start by taking a look at the format that is used for S3 buckets. AWS documentation says the format for the URL is:</p><pre>https://&lt;bucket-name&gt;.s3.&lt;region-code&gt;.amazonaws.com/</pre><p>In that format, you’ll notice 2 variables. The first is “bucket name” and the second, “region-code”.</p><p>Region code is simple, this is a relatively static list but changes depending on what region you create your bucket in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*ZLY2KFj4HvskYHD4XO6EYA.png" /></figure><p>If you know which regions you or your organization uses, this can help improve the speed of the script. If you’re not sure, you can get a list of all of the regions <a href="https://docs.aws.amazon.com/general/latest/gr/s3.html">here</a>.</p><p>The other variable in the naming convention is “bucket-name”. This is where the real challenge comes when attempting to find open buckets. This can be very dynamic. There are a few naming convention requirements (You can find the requirements <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html">here</a>), but for the most part, they can be whatever you want.</p><p><strong>Python S3 Scanner:</strong></p><p>The script is relatively simple. By inputting a second-level domain (SLD), the script generates potential S3 bucket URLs using common keywords and checks each one for public accessibility. The result? A list of buckets that might be leaking data, ready for further investigation or immediate remediation.</p><p>The code is broken into 3 main parts.</p><p>The first is to generate the static list of AWS regions:</p><pre>    aws_regions = [<br>        &quot;us-east-2&quot;,&quot;us-east-1&quot;,&quot;us-west-1&quot;,&quot;us-west-2&quot;,&quot;af-south-1&quot;,<br>        &quot;ap-east-1&quot;,&quot;ap-south-2&quot;,&quot;ap-southeast-3&quot;,&quot;ap-southeast-4&quot;,<br>        &quot;ap-south-1&quot;,&quot;ap-northeast-3&quot;,&quot;ap-northeast-2&quot;,&quot;ap-southeast-1&quot;,<br>        &quot;ap-southeast-2&quot;,&quot;ap-northeast-1&quot;, &quot;ca-central-1&quot;, &quot;eu-central-1&quot;,<br>        &quot;eu-west-1&quot;,&quot;eu-west-2&quot;,&quot;eu-south-1&quot;,&quot;eu-west-3&quot;,&quot;eu-south-2&quot;,<br>        &quot;eu-north-1&quot;,&quot;eu-central-2&quot;,&quot;il-central-1&quot;, &quot;me-south-1&quot;,<br>        &quot;me-central-1&quot;,&quot;sa-east-1&quot;,&quot;us-gov-east-1&quot;,&quot;us-gov-west-1&quot;<br>    ]</pre><p>As I said earlier, if you know the region(s) that you or your organization use, this list can be shortened to include only those regions. This will help reduce the amount of time to complete the script.</p><p>The second part of the script is to create a list of common keywords that might be included in the naming convention of your S3 bucket:</p><pre>    # Common keywords to test in the URL<br>    common_keywords = [<br>        &quot;alpha&quot;, &quot;api&quot;, &quot;app&quot;, &quot;assets&quot;, &quot;backup&quot;, &quot;beta&quot;, <br>        &quot;blog&quot;, &quot;bucket&quot;, &quot;cdn&quot;, &quot;client&quot;, &quot;cloud&quot;, &quot;config&quot;, &quot;content&quot;, <br>        &quot;dashboard&quot;, &quot;data&quot;, &quot;demo&quot;, &quot;dev&quot;, &quot;development&quot;, &quot;docs&quot;, &quot;documents&quot;, &quot;exports&quot;, &quot;files&quot;,<br>        &quot;forum&quot;, &quot;ftp&quot;, &quot;help&quot;, &quot;imports&quot;, &quot;labs&quot;, &quot;login&quot;, &quot;mail&quot;, <br>        &quot;media&quot;, &quot;mobile&quot;, &quot;news&quot;, &quot;orders&quot;, &quot;partner&quot;, &quot;portal&quot;, &quot;private&quot;, &quot;prod&quot;, <br>        &quot;production&quot;, &quot;public&quot;, &quot;raw&quot;, &quot;records&quot;, &quot;releases&quot;, &quot;reports&quot;, &quot;s3&quot;, &quot;sandbox&quot;, &quot;sdk&quot;, <br>        &quot;secure&quot;, &quot;shop&quot;, &quot;smtp&quot;, &quot;software&quot;, &quot;stage&quot;, &quot;staging&quot;, &quot;static&quot;, <br>        &quot;store&quot;, &quot;support&quot;, &quot;temp&quot;, &quot;test&quot;, &quot;testing&quot;, &quot;tools&quot;, <br>        &quot;uploads&quot;, &quot;vendor&quot;, &quot;web&quot;, &quot;wiki&quot;, &quot;www&quot;<br>    ]</pre><p>I recommend modifying this list based on your knowledge of your organization.</p><p>The third part of the script is generating the URL to check against:</p><pre>    # Define URL patterns using placeholders for the sld, keyword, and region.<br>    # This will allow easy addition of new patterns in the future.<br>    url_patterns = [<br>        &quot;https://{sld}.s3.{region}.amazonaws.com&quot;,<br>        &quot;https://{keyword}-{sld}.s3.{region}.amazonaws.com&quot;,<br>        &quot;https://{sld}-{keyword}.s3.{region}.amazonaws.com&quot;,<br>        &quot;https://{keyword}{sld}.s3.{region}.amazonaws.com&quot;,<br>        &quot;https://{sld}{keyword}.s3.{region}.amazonaws.com&quot;,<br>        &quot;https://{keyword}.{sld}.s3.{region}.amazonaws.com&quot;<br>    ]</pre><p>This will generate different patterns of URLs, combining the user’s input ({sld}) and the keywords ({keyword}).</p><p><strong>Testing the Script</strong></p><p>Let’s try running the script against an intentionally misconfigured S3 bucket. You’ll want to input a term that aligns with your organization, I typically pick the SLD of my organization while testing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*KfI4wnGJWqy4GJgy7KFnPw.png" /></figure><p>After a few minutes, you’ll see the following results (your results will vary):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*h190Q2Wp-SWpAIPOAmccEg.png" /></figure><p>Let’s check the results by visiting the URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*HhWdPAD5sPcbgqBgr31brg.png" /></figure><p>There you have it, you can now see the contents of the S3 bucket. Fortunately AWS has modified the defaults and has made it increasingly difficult to configure your S3 bucket to be this accessible but you’d be surprised how many open buckets still exist.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=733dc6cc9b74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating ELK Research Environment In AWS (Part 2)]]></title>
            <link>https://medium.com/@sealteamsecs/creating-elk-research-environment-in-aws-part-2-5ace757045c4?source=rss-77c948225513------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ace757045c4</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[SealTeamSecs]]></dc:creator>
            <pubDate>Wed, 09 Aug 2023 14:03:53 GMT</pubDate>
            <atom:updated>2023-08-09T14:03:53.671Z</atom:updated>
            <content:encoded><![CDATA[<h3>Summary</h3><p>In the previous posting, we setup ELK stack on an Ubuntu server in AWS. In this post, we will configure a Windows Server to send logs to Logstash, allowing us to simulate a SIEM, learn KQL, and run suspicious activity on the server.</p><p><strong>Step 1: Setup a Windows Server</strong></p><p>Similar to how we setup the Ubuntu Server, we will visit the EC2 Launch page in AWS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*paQLllzk3yQrL7rdLlRNqg.png" /></figure><p>Click the “Launch instance” button.</p><p>Provide the server with a name (you can pick any name you want).</p><p>Select a Windows Amazon Machine Image (AMI). For this write-up, I chose Microsoft Windows Server 2022 Base.</p><p>For Instance Type, I chose the t2.medium with 2 vCPU and 4 GiB Memory. This can be adjusted based on the activities you will be performing on this device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*jQeyY1SwckdyKD71KC12eg.png" /></figure><p>After this, you can create a new key pair or select an existing one. This will be used to RDP into the Windows Server.</p><p>For the Network Settings, for right now, we will, “Create security group” and allow RDP. It is recommended to specify the IP addresses that you will allow to connect to this, but, for this example, we will allow traffic from anywhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*5YZCtuQOCARdszI07Mc9pw.png" /></figure><p>The last thing before building the server is to add storage. This will vary wildly, depending on what you plan to install on this server. For this example, I will add 30GB of storage. If you anticipate using this for Digital Forensics, you may want to add more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*T2ZzoHlKuOkqR21pGaY6BA.png" /></figure><p>After this, just select “Launch instance” and wait for the server to build.</p><p><strong>Step 2: Configuring ELK Client</strong></p><p>Let’s log into the server using Windows’ default RDP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*PFTkn_p_OdlMJCC9osIOeA.png" /></figure><p>The default username is: Administrator</p><p>To obtain the password, you will need to select the Actions →Security → Get Windows password option in the AWS Instances page.</p><p>Once logged in, download Sysmon (this will be used to send Powershell logs to Logstash). You can download Sysmon <a href="https://download.sysinternals.com/files/Sysmon.zip">here</a>.</p><p>Extract the files and open PowerShell. Once PowerShell is open, change to the directory that you extracted sysmon to.</p><p>Run the following command and select “Agree” on the popup:</p><pre>.\Sysmon64.exe -i</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*yZ7T5u7io46RJz_k4b18sQ.png" /></figure><p>Next, download WinLogBeat <a href="https://www.elastic.co/downloads/beats/winlogbeat">here</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*axhrpAzbj9URAxiaUxWB9Q.png" /></figure><p>Extract the files to C:\Program Files (or any directory you want).</p><p>In the extracted folder, you will find a file named winlogbeat.yml. This is the configuration file and we want to modify this file.</p><p>Open the file in a text editor and scroll down to the “Elasticsearch Output” section. We want to make sure this is entirely commented out (there are 3 lines that need to be commented):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*b2z6bqiFTcTrWVKil-heJw.png" /></figure><p>Once this is commented out, we can scroll down and configure it to send logs to Logstash. Look for the Logstash Output” section and uncomment 2 lines to look like this screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*BjO4HuKYCejpyDqeu9_50Q.png" /></figure><p>Ensure to use your Ubuntu ELK server’s private IP (if the Ubuntu Server is hosted somewhere else or in another VPC, you may need to use the Public IP address).</p><p>Once this is done, save the file and return to PowerShell. Change to the directory where the winlogbeat files were extracted.</p><p>Run the following commands in order to install WinLogBeat and begin sending logs to Kibana:</p><pre>.\install-service-winlogbeat.ps1<br>Start-Service winlogbeat</pre><p><strong>Step 3: Setup Index Pattern</strong></p><p>To begin searching logs, you will need to setup an index to place logs into. To do this, in Kibana, go to the Left-menu and select “Stack Management” (at the bottom). Then select “Index Patterns” under Kibana and choose “Create index pattern”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHsDZXGnO4gkBIeVhquhgQ.png" /></figure><p>In the Name field, select the most recent winlogbeat pattern. In the Timestamp field, select “timestamp”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MfQh3rVR1-JA-SpK4xGgIg.png" /></figure><p>After this is done, you should be able to go into the “Discover” tab and begin viewing logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*UhzhCTm6SYMhY15l01pvSQ.png" /></figure><p>Congratulations! You now have logs being sent to ELK. This is a great start to setting up a lab environment. Keep in mind, this is sending Windows Event Logs to Kibana, but ELK also has packetbeat, which sends network logs to ELK as well. This can be downloaded <a href="https://www.elastic.co/downloads/beats/packetbeathttps://www.elastic.co/downloads/beats/packetbeat">here</a>. The process for configuring is essentially the same as WinLogBeat.</p><p>Later, we will go over setting up forensics tools on a device in AWS, then building an AMI that can allow us to quickly build servers with pre-installed software.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ace757045c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating ELK Research Environment In AWS (Part 1)]]></title>
            <link>https://medium.com/@sealteamsecs/creating-elk-research-environment-in-aws-part-1-cc10f418cc5a?source=rss-77c948225513------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc10f418cc5a</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[SealTeamSecs]]></dc:creator>
            <pubDate>Wed, 09 Aug 2023 13:58:18 GMT</pubDate>
            <atom:updated>2023-08-09T13:58:18.804Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>ELK (Elasticsearch, Logstash, and Kibana) is a combination of three open-source products from Elastic. Together, they form a powerful stack for managing, analyzing, and visualizing data in real-time. Here’s a brief overview of each component:</p><ol><li>Elasticsearch: This is a NoSQL database that’s used for storing logs and other time-series data. It’s built on Lucene and provides a distributed, multitenant-capable, full-text search engine with an HTTP web interface and schema-free JSON documents.</li><li>Logstash: This is a data processing pipeline that ingests data from multiple sources simultaneously, transforms it, and then sends it to a “stash” like Elasticsearch.</li><li>Kibana: This is a data visualization dashboard for Elasticsearch. It provides visualization capabilities on top of the content indexed in an Elasticsearch cluster, allowing users to create bar, line, and scatter plots, or pie charts, and maps on top of large volumes of data.</li></ol><p>The ELK Stack is widely used for log and event data analysis in various IT environments, cybersecurity, business analytics, and more. Here are some of its key benefits:</p><ul><li>Centralized Logging: ELK Stack provides a centralized logging system which makes it easy to search and analyze logs from different machines in one place.</li><li>Real-Time Processing: ELK Stack allows for real-time data processing, which means you can get insights and visualize data in real-time.</li><li>Scalability: Elasticsearch, the heart of the ELK Stack, is highly scalable. It allows you to store and index large volumes of data.</li><li>Powerful Data Analysis and Visualization: With Kibana, you can create various charts, graphs, and dashboards to visualize and make sense of your data.</li><li>Open Source: The ELK Stack is open source, which means it’s free to use and has a large community of developers contributing to its development and improvement.</li></ul><h3>Purpose of this Article</h3><p>The purpose of this article is to provide a comprehensive, step-by-step guide on setting up the ELK stack in a AWS. We aim to empower readers with the knowledge and skills to create a robust, scalable, and efficient log management system using open-source technologies. Please note that, while this article is written for AWS, the information can very easily be converted to be used in other cloud environments or using a home-lab setup as well.</p><h3>Prerequisites</h3><p>The only prerequisite for this is having an AWS account to setup the servers.</p><h3>Part 1: Setting up ELK on Ubuntu</h3><p><strong>Step 1: Building the Ubuntu Server</strong></p><p>Ubuntu will be the Operating System we will use to install the ELK stack. To set this up, we will select EC2 from the Services dropdown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*paQLllzk3yQrL7rdLlRNqg.png" /></figure><p>Click the “Launch instance” button.</p><p>Provide the server with a name (you can pick any name you want).</p><p>Select an Ubuntu Amazon Machine Image (AMI). For this write-up, I chose Ubuntu Server 22.04 LTS (HVM).</p><p>For Instance Type, I chose the t2.medium with 2 vCPU and 4 GiB Memory. This can be adjusted based on the number of logs you will be processing but should be enough for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*kh_dBE_0IGLXgscPE2JYgA.png" /></figure><p>After this, you can create a new key pair or select an existing one. This will be used to SSH into the Ubuntu server to setup and install ELK. Depending on how you will be connecting to your server, you will need to select the Private Key file format (I used .ppk because I will be using Putty to SSH to the Ubuntu Server).</p><p>For the Network Settings, for right now, we will, “Create security group” and allow SSH and HTTP and HTTPS (we will modify this later). It is recommended to specify the IP addresses that you will allow to connect to this, but, for this example, we will allow traffic from anywhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*S5hNw90AerRHRdVE6IkbPg.png" /></figure><p>**We will need to add an exception for inbound traffic to port 5044 after the creation of the server</p><p>The last thing before building the server is to add storage. This will vary wildly, depending on the amount of logs you will be storing. For this example, I will add 30GB of storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*KyQtYe2cnvjD5fFaDWKGpQ.png" /></figure><p>After this, just select “Launch instance” and wait for the server to build.</p><p>Now that we’ve built the server, let’s modify the security rules to allow devices to send logs to this server.</p><p>To do this, select the newly created server on the Instances page and visit the Security tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*D8wv1vX2U8P-_uISkwH35g.png" /></figure><p>Scroll down to Inbound rules → Edit inbound rules</p><p>Now click “Add rule” and select “Custom TCP”. Under Port Range, put 5044. For the Source field, you can specify the IP range you will be sending logs from (if you’re following this, it will be the private IP range that your Ubuntu server is in):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mPW25XGG4TsKF6LanAPY_Q.png" /></figure><p><strong>Step 2: Configuring Elastic</strong><br>After your server is built and Instance state is Running, you will be able to see the Private and Public IP address. Note these 2 items because they will be needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UyPEpyMKxjF7vGFLnz7Weg.png" /></figure><p>Let’s log into the server using Putty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*_0XH8_dQdVG1KW4S2oG5Sw.png" /></figure><p>In the Host Name field, place the public IP address of your Ubuntu server.</p><p>To login to the server, you will need to use the private key you created above. This can be added to the Putty Configuration by going to Connection →SSH →Auth and then Browsing to where you downloaded the private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*SWzQRlgEqQPA7VuJXteluQ.png" /></figure><p>The default username for Ubuntu in AWS is: ubuntu</p><p>Once logged in, you will want to run the following commands:</p><pre>sudo apt update<br>sudo apt install nginx<br>sudo ufw allow &#39;Nginx HTTP&#39;<br>sudo ufw status<br>systemctl status nginx</pre><p>The commands above install NGINX, which is not required, but it can act as a reverse proxy for Kibana, which means that it can forward requests from clients to Kibana and then return the responses from Kibana back to the clients. This can be useful for several reasons:</p><ul><li>Load Balancing: If you have multiple instances of Kibana, Nginx can distribute the incoming traffic among them.</li><li>SSL Termination: If you want to secure the communication between clients and Kibana using SSL/TLS, Nginx can handle the SSL termination, which means it will handle the encryption and decryption of traffic. This offloads the SSL processing from Kibana.</li><li>Access Control: Nginx can restrict access to Kibana based on IP address, request type, or other criteria.</li></ul><pre>curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch |sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main&quot; | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list<br>sudo apt update<br>sudo apt install elasticsearch</pre><p>These commands install ElasticSearch.</p><p>After installing ElasticSearch, we want to make one small configuration change. We can do this by altering the elasticsearch.yml:</p><pre>sudo nano /etc/elasticsearch/elasticsearch.yml</pre><p>Then uncommenting the line for network.host and changing it to “localhost”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*mBcwdMzufH0km2ePHmSzHQ.png" /></figure><p>Now we can restart the Elastic Search service:</p><pre>sudo systemctl start elasticsearch<br>sudo systemctl enable elasticsearch</pre><p><strong>Step 3: Configuring Kibana</strong></p><p>Install and start the Kibana service</p><pre>sudo apt install kibana<br>sudo systemctl enable kibana<br>sudo systemctl start kibana</pre><p>Now we want to add a password to Kibana so that we can login:</p><pre>echo &quot;kibanaadmin:`openssl passwd -apr1`&quot; | sudo tee -a /etc/nginx/htpasswd.users</pre><p>In this command, we are creating a username: kibanaadmin</p><p>This will ask for a password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*8ixYAnGEC24I3HCKJdVfow.png" /></figure><p><strong>Step 4: Modify NGINX for Kibana Web Access</strong></p><p>We can create an nginx file that will allow us to access Kibana via the web browser.</p><pre>sudo nano /etc/nginx/sites-available/&lt;servers public IP&gt;</pre><p>Replacing &lt;servers public IP&gt; with your public IP address. Then, delete any content in this file (if any) and add the following:</p><pre>server {<br>    listen 80;<br><br>    server_name your_domain;<br><br>    auth_basic &quot;Restricted Access&quot;;<br>    auth_basic_user_file /etc/nginx/htpasswd.users;<br><br>    location / {<br>        proxy_pass http://localhost:5601;<br>        proxy_http_version 1.1;<br>        proxy_set_header Upgrade $http_upgrade;<br>        proxy_set_header Connection &#39;upgrade&#39;;<br>        proxy_set_header Host $host;<br>        proxy_cache_bypass $http_upgrade;<br>    }<br>}</pre><p>Make sure to replace your_domain with the domain name you are using (or the Public IP address of your server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*sNCd6dh51xIQhAnyWzdRbw.png" /></figure><p>The let’s create a symbolic link to this file:</p><pre>sudo ln -s /etc/nginx/sites-available/&lt;servers public IP&gt; /etc/nginx/sites-enabled/&lt;servers public IP&gt;<br>sudo nginx -t<br>sudo systemctl reload nginx<br>sudo systemctl restart nginx</pre><p><strong>Step 5: Configuring Logstash</strong></p><p>Install Logstash using the following command:</p><pre>sudo apt install logstash</pre><p>Once logstash is installed, let’s create the configuration:</p><pre>sudo nano /etc/logstash/conf.d/02-beats-input.conf</pre><p>Add the following:</p><pre>input {<br>  beats {<br>    port =&gt; 5044<br>  }<br>}</pre><p>Next, let’s modify logstash, elasticsearch configuration file:</p><pre>sudo nano /etc/logstash/conf.d/30-elasticsearch-output.conf</pre><p>Add the following:</p><pre>output {<br>  if [@metadata][pipeline] {<br> elasticsearch {<br>   hosts =&gt; [&quot;localhost:9200&quot;]<br>   manage_template =&gt; false<br>   index =&gt; &quot;%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}&quot;<br>   pipeline =&gt; &quot;%{[@metadata][pipeline]}&quot;<br> }<br>  } else {<br> elasticsearch {<br>   hosts =&gt; [&quot;localhost:9200&quot;]<br>   manage_template =&gt; false<br>   index =&gt; &quot;%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}&quot;<br> }<br>  }<br>}</pre><p>Finally, let’s check the configuration to make sure it is correct:</p><pre>sudo -u logstash /usr/share/logstash/bin/logstash --path.settings /etc/logstash -t</pre><p>And restart the service:</p><pre>sudo systemctl start logstash<br>sudo systemctl enable logstash</pre><p>Congratulations, we can now login to Kibana:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*PqbC4KUWURJb9Bap4XbrZw.png" /><figcaption>Username and password from step 3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*IAbIgEz7Dh1v4DqjSrCAjQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc10f418cc5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>