Goal: To create a Splunk alert that the n8n hook can catch it.
Alert Setup:
I will be setting up an alert to catch failed login attempts on my Windows VM. This will help catch any brute force attempts. To do this I need to make a rule that detects Events with an ID of 4625. One way to artificially create alerts for the sake of testing is by using RDP and purposely failing to connect. To do this I had to make sure the RDP port (3389) was open for my host machine to attempt to connect.
Attempting to connect using this rule was not working. I was using RDP to attempt to connect using "localhost:3389" but I believe this was making the computer try to RDP to itself. To fix this I am changing the rule so the host port is now "3390".
After changing the Host Port, RDP started working correctly (localhost:3390) and I was now able to continue with triggering the Events.
After creating the events, I navigated back to the web UI for Splunk and made sure I installed "Splunk Addon for Microsoft Windows". Then afterwards all that was left was to filter to check for the events to have be captured (I did this by filtering out the event log with "index=caser-project EventCode=4625 | stats count by _time,ComputerName,user,src_ip").
To create the alert, I click on "save as" on the top right and save it as "Brute-Force". I then changed it to "Run on Cron Schedule" and changed the Cron Expression to "* * * * *" so that it runs every minute for testing purposes.
Under Triger Actions, I added a triggered alert, as well as a Webhook. For the Webhook URL I will be using the n8n Webhook to catch the alert.
To get the URL I had to log into the n8n Web UI, "start from scratch", "add first step", and then searched for "Webhook". Then on the window that popped up, I changed the HTTP Method to "POST" and copied the POST URL. I then pasted the URL and saved the new Splunk Alert.
The last thing to do is to make sure that n8n can hook in the alert. For this I simply went back to the n8n server and selected "Listen for Test Event". Then after a short while, it received the test output, notifying me that the system is working properly.
Everything is starting to come together now and I didn't really feel like there were too many issues with this part. Setting up the RDP was probably what took the longest because for a short while I wasn't sure why it wasn't letting me connect to the VM until it occurred to me that I hadn't port forwarded the proper port for it to be listening on. I thought about changing it to a Bridged network, but I don't want it to appear on my home network since this is going to be a testing environment. This was a very fun way to get back into things after my 2 week vacation. I will be finishing this project up very soon and then I can get to implementing other components like active directory.
Comments
Post a Comment