Build a SOC Lab with Wazuh: Connect Agents + Sysmon (Part 2)
Transcript
Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.
Welcome to part two of seven of the Wazuh SOC Analyst Challenge. In this one, we are going to be connecting our Windows and Ubuntu machines to Wazuh and installing Sysmon on both of them. And by the end, you will have both agents active and real telemetry flowing into your dashboard. Let's get right into it. All right, so let's get started. We are currently under the Wazuh dashboard and we do not have any agents currently registered. In the previous video, we downloaded and created a Windows ISO, which is what we are going to use to spin up a Windows virtual machine. And I will also create another Ubuntu server, and that will act as our second Ubuntu virtual machine. So, let's go ahead and select create a new virtual machine and we'll select 25 H2 or later. And for the installer disk image, I am going to select the same one that we used for our Wazuh server. And let's just keep it as Ubuntu 64-bit.
For the processors, I'll leave it as default. And for the memory, I am going to drop it down to 4 gigs. Now, depending on your specs, you can put this down to even 2 gigs if you want. But I'm going to leave it as four, put it as NAT, next, next, next. And for the
disk space, I believe 20 should be okay,
but just in case I am going to put it as 50 gigs. And next. Double-check the settings here. So, 50 gigs of disk space, 4 gigs of memory, NAT, and two CPUs.
Click on finish. And well, that's good to go. Let's create another one. And we are going to
do the same settings and we are going to select the Windows ISO. And I'll keep it as is. Next, next. For the memory for this one, I'm going to put it to 4 gigs as well. Use NAT. And I'll keep it at 60 gigs. Cool. Press
any key and the Windows setup should begin. Let's go through the setup really quickly here. Click into install now and while the setup is starting, let's head over to our Ubuntu 64-bit and let's go through this one. The name I'm going to put it as my differ. For the server name, I'll just say Ubuntu. Username is going to be my differ.
And the same password. I am going to also install OpenSSH.
And now we wait. Head back over to the Windows 10. For the activate Windows, I'm going to select I don't have a product key. And we want to select Windows 10 Pro.
Click into I accept and we want to select custom and next. All right, after a couple minutes, let's go ahead and continue on. Click on yes,
skip, and in the background, our Ubuntu
computer should be good to go as well.
So this one, the IP address is 192.168.136.129.
Again, yours is going to be different. So I am going to just put that in here. 192.168.136.129.
And then we also have a Windows machine, but it is taking its time to set up. Let's go ahead and select setup for personal use. We'll select offline account, limited experience, and let's type in let's say Bob for now. For the password,
and we'll put in our security questions. All right, finally, our setup is pretty much complete, but there is one or at least a couple of things that we want to do. The first is to enable remote desktop. So, I'll type in remote and then click into the remote desktop settings. From here, I'll click into enable remote desktop and confirm. Close that out.
Let's open up command prompt. So, I'll type in cmd and I'll do ipconfig. And take a look, our IP address is 192.168.136.130.
So, let's go ahead and type that in here. And because we did enable remote desktop, I can now remote directly from my host machine into my Windows virtual machine. So, I typed in remote desktop connection and I'll type in the IP address of 192.168.136.130.
From here, I'll enter in my username, which is Bob, and put in the password. And now we have connected into this computer via RDP. And this, in my opinion, is just much more easier to work with compared to, again, working in VMware Workstation. Now, let's head over to our Wazuh dashboard. And again, we do not have any agents installed. So, what we need to do here is click into the deploy new agent. And uh-oh, I timed out. So, I do need to log back in. Good thing we got our credentials here. And we want to select Hmm, you know what? Let's do Windows first. So, I'll click on the MSI.
And under our server address, you know what? Let me zoom in just a bit so it's a lot easier to see. Under the server address, we do want to put in our Wazuh server. So, that is 192.168.136.128.
And I am going to select remember server address. For optional settings, I am going to name this as my differ
Windows. And then the next step says, "Run the following commands to download and install the agent." So, I'll click on copy. And because we are currently RDP'd into our virtual machine, I'm going to go ahead and click into the start menu, type in PowerShell, and I'm going to run as an administrator. Click on yes. And then from here, let's go ahead and paste in that command. Hit enter. And while that goes out and does its thing, let's go ahead and minimize our RDP session. And let's take a look at step number five, which is start the agent. I'm going to go ahead and copy the command, go back into the RDP session, and we do see that it is completed. So, let's go ahead and paste that in. Hit enter. And we see the Wazuh service is starting, and then started successfully.
Let's go back into our Wazuh dashboard, click into back to agent list, and take a look. We have one agent. It is currently Well, the status says never connected. But if we wait, mhm, maybe 30 seconds to a minute, we can go ahead and refresh the page and take a look. All right. After refreshing the page, we have the IP address 192.168.136.130.
The operating system is Microsoft Windows 10, the version of the agent, and if we were to click into view agent details, we could start to see additional information. For example, how many cores, what is the memory, the CPU,
and the host name. And there are additional tabs that you can go through. For example, threat hunting, if you wanted to do some threat hunting, you can go over here. There's file integrity monitoring, configuration assessment, MITRE attack, and just a bunch more others here. So, that right there is our Windows agent. The next agent that we want to install is our Linux agent. So,
how do we do that? Well, we can click into the active agents, and then we can select deploy new agent. And the one that we want is Linux, and I will select this one right here, the deb amd64. Again, this is our Wazuh server address. For the agent name, I am going to type in myd Linux, and copy the command right here.
Now, I am going to open up a new tab, and this time around, I will SSH directly into our Ubuntu virtual machine. So, the username for this one was mydfr, and the IP address is 192.168.136.129.
Type in yes. Type in the password. And we are good to go. So, let's go ahead and paste in that command, and hit enter. Type in the password. Now, let's head back over to our Wazuh dashboard, and copy these commands. Go back into the terminal. Again, I am SSH'd into our Ubuntu server. Paste in the command, and hit enter. Perfect. Now, let's go back into our dashboard, click into back to agent list, and we do see a myd - Linux, and we'll wait just a couple seconds. All right, let's refresh the page here, and there you go. We have our Ubuntu 24.04.
Cool. Now, let's head over to our discovery. So, if we click into the hamburger icon, head over to explore, and go into discover, we want to select our archives. So, this index right here that we created back in video one. And what I want to do is essentially look for the data from our agents. How do we do that? Well, we can begin typing in some random queries here and hope for the best or we can select some of the available fields located on the left. And that's actually what I'm going to do. So, I do notice that there is a field name called agent.name.
If I click on the magnifying glass here, I can see that there is a my D for dash Linux, there is a Wazuh, and there is a my D for dash Windows. And if I want to just filter for any specific one, I can
click either the plus icon or the minus
icon. Now, the plus icon is going to filter for that specific value, as you can see once we hover over it, whereas the minus icon is going to filter out that particular value. So, let's say that I wanted to only look for my D for dash Windows. I'll click into the plus icon and now we have a total of 918 hits. Now again, yours is going to be different, but just something to keep in mind. Now, out of curiosity, if I were to type in Sysmon, would I see anything? And no, I do not. And that's actually expected because we don't have Sysmon installed. And that's the next thing that we're going to do. So, I'll head over to our RDP session. Now, I am currently on my Windows virtual machine.
And let's go ahead and open up Microsoft Edge. I'll click on start without your data, confirm and continue, and let's start browsing. So, what we want is Sysmon. So, let's go ahead and search that up and I'll select the learn.microsoft.com site and I'll download Sysmon. Now that this is downloaded, let's download a Sysmon configuration. So, I'll type in Sysmon configuration and SwiftOnSecurity works, but I personally like Olaf. So, this one right here. Scroll down, and I am going to select the Sysmon config.xml. From here, I'll click into the raw, right click, save as, and let's save it into our downloads directory. Perfect. Now, let's go ahead and open it up and extract our Sysmon by right clicking, select extract all, click on extract, and now let's drag and drop our Sysmon config into the extracted directory.
So, if we take a look, we should see Sysmon config here and also the executables. What I'm going to do is click into the file explorer so I can get the complete file path, right click,
copy, and let's go back into our PowerShell session. So, I'll type in CD for change directory, paste in our file path, and now we should be good to go. So, let me zoom in just a bit so it's a lot easier to see. And if I were to type in DIR, I would see Sysmon, Sysmon64, and Sysmon64a, and also our config. So, I am just going to type in Sysmon, hit tab for auto completion, and then I'm going to point it over to our configuration file. So, I'm going to type in {dash} I, and then type in Sysmon config, hit tab for auto completion, and enter. This is going to instruct Sysmon to install using this config file. Click into I agree, and just like that, Sysmon is started.
Just to confirm, I'll type in services, and then hit S on my keyboard and look for Sysmon, which is what I see right here. And it is currently running. Perfect. So, in theory, would I be able to see Sysmon data in Wazuh? Well, you would assume so, right? Cuz you did just download Sysmon, but let's take a look. If I were to refresh this, oh, there is one hit, but that is coming from our Sysmon service, rather than events generating from Sysmon. So, we
don't see any events sourcing from Sysmon yet. Why is that? Well, that's because with Wazuh and pretty much any other SIM, you will need to configure its settings to instruct the agent to push Sysmon data. And this is how you do it. So, we'll go back over to our RDP session, and I'll open up Notepad as an administrator. So, make sure that you select run as administrator. Click on yes, and we'll do file open, and you'll want to head over to where our Wazuh agent configuration is stored. That is located under the computer, so this PC. Go into the C drive, go into program files x86, and select ossec-agent.
What we're looking for here is the ossec.conf file, similar to the one that we used or configured in our Wazuh manager. Now, you might notice that, well, we don't really see the ossec.conf here. And that's because we are currently looking for only the dot text file extension. So, let's go ahead and select the drop down, and click into all files. From here, if we scroll down, we should start to see this one, ossec.conf. Let's go ahead and double click it, and this is the configuration file for our agent. Now, let me go ahead and zoom in, and we can see that the address is this right here, which again is our Wazuh manager, and it's going to the port of 1514.
So, if for whatever reason that your Wazuh manager is not seeing events from your Windows virtual machine, then there could be some network rules that is blocking your Windows virtual machine from hitting this particular port on this IP address. So, something to think about if you are not seeing events. Now, if we scroll down, you will see that there is something called local files.
This is where we configure our agent to tell our Wazuh server that we want to push these certain files. So, for example, you may see the location of security. This right here is the security event log. So, our agent is
instructing our Windows endpoint to push
our security event logs over to our Wazuh manager, which again is located under this address. Now, if we take a look at the local files, we can see that there is security. We can see that there is system and active response. Is that it? Hmm.
Oh, application. And now, that's it. So, there really isn't anything related to Sysmon, right? So, how do we configure that? Well, what we can do is copy one of these settings, so I'll copy the first one, which is pointing to our application, and I'll just go ahead and paste that in here, right? So, now we have two applications, and I am going to change this one to point it over to our Sysmon. But, what does that look like? Well, these, again, are event logs, and you can find them under the event viewer. Remember, we have application, we have security, and we have system. So, these are essentially under the Windows logs, under application, security, and system.
So, where exactly is Sysmon then? Well, that is under the application and services. If we expand that, go into Microsoft, go into Windows, I'll maximize this, and then we want to scroll all the way down until we see Sysmon, which is right here. So, we expand that, we have the operational log. If we click into it, well, we definitely see some events. In fact, how many? We see a total of 268 events. Now,
if we were to right-click, go into properties, what we want to do is take note of the full name. So, Microsoft-Windows-Sysmon/Operational.
Go ahead and copy that, and then go back over to our notepad, which is right here, and we want to replace the second application with what we just copied, which is going to be pointing over to our Sysmon logs. Go ahead and save that out, and as a question for you, what is it that we need to do anytime we modify the ossec.com file? Well, if you said restart the manager service, then you are correct. Or in this case, we need to restart the Wazuh agent service. So, let's open up our services, and I am going to hit W on my keyboard, and look for Wazuh, which is right here. Go ahead and right-click, and restart. Now, let's head over to our Wazuh dashboard, and do another refresh. Oh, take a look at that. We have 45 hits. So, now the question becomes, is this actually sourcing from Sysmon? Well, let's take a look. I'll expand the first event from the top, and let's scroll down, and look at the system channel. It's coming from Microsoft-Windows-Sysmon/Operational.
So, this confirms that Sysmon data is now flowing into our Wazuh dashboard from our Windows virtual machine. But, that's Windows. What about Linux? So, let's get started with that. I'll head over to our Ubuntu. So, this is our Linux virtual machine. Go ahead and clear out the screen, and I'll open up a new tab, and let's search out for Sysmon Linux. And the one that we want to select is the GitHub Sysmon for Linux. Let's scroll down, and we will see installation instructions, and we want to look for the one that's called Ubuntu. So, let's go ahead and copy these commands here, paste it in, and hit enter. Type in the password.
Once that's done, let's go and do the next step, which is sudo apt get update,
and install Sysmon for Linux. So, let's copy that, and paste it in. Go ahead and type in Y for yes, hit enter. Perfect. Now, I'm going to clear up the screen, and I'll do a Wget, and I'm going to download a Sysmon for Linux configuration file, and I am also going to put this link inside the free community. So, you can go ahead and join that, and take the link from there, if you choose to do so. Once that's done, type in ls -la just to make sure we see it, and we do. collect-all.
Now, we can type in sudo Sysmon-i, and point it over to our collect-all configuration file. And just like that, our Sysmon is now installed. So, the Sysmon logs are going to be located under the var log directory.
And if we type in ls, you will see a syslog. All of the Sysmon events are going to be captured under the syslog. So, if I just do tail syslog,
take a look. We have Linux Sysmon right here, and we also can see the event ID
of 11. Now, let's go into our Wazuh dashboard and let's remove our agent name, or actually, let's click into it, click into edit filter, and let's change our My D for Windows to My D for Linux.
Click on save. And there you go. If we expand the first event from the top, looking at the full log here, we can see a Linux Sysmon and also the event ID of
11. So, just as a proof of concept, let's go into our Ubuntu machine and I'll simply type in uname. We can see it as Linux. Now, go into our dashboard and let's search for uname. We have five hits. Looking at the most recent event, which is the one at the top, expand that. Looking at the full log here, we can see the image, so the process was uname.
So, it did capture that. Nice work. By now, you should have both your Windows and Ubuntu agents showing active in the dashboard with Sysmon giving you that deeper level of visibility on top. In the next video, we are going to start generating some activity on these machines, but more importantly, I am going to show you how to actually read some of the logs that it produces. That is it for the video, and I hope that you found that informative. If you did, let me know by hitting that like button and subscribe if you want to. Remember to stay curious and do things differently.





