๐Ÿงฉ Problem

I wanted to simulate a real-world security environment in my homelab where I could detect and respond to SSH brute-force attacks and at the same time monitor my devices


๐Ÿ› ๏ธ Solution Overview

I deployed Wazuh as a SIEM solution and configured it to detect SSH login attempts and automatically block malicious IPs.


๐Ÿ”ง Environment

  • Ubuntu Server (Wazuh Manager)
  • Linux target machine (with SSH enabled)
  • Public exposure via port forwarding

๐Ÿš€ Step 1: Install Wazuh

curl -sO https://packages.wazuh.com/4.14/wazuh-install.sh && sudo bash ./wazuh-install.sh -a

After installation, accessed dashboard:

https://<server-ip>

๐Ÿ”Œ Step 2: Deploy Wazuh Agent

On monitored machine:

wget https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_4.14.3-1_amd64.deb && sudo WAZUH_MANAGER='domain.com' dpkg -i ./wazuh-agent_4.14.3-1_amd64.deb

sudo systemctl daemon-reload sudo systemctl enable wazuh-agent sudo systemctl start wazuh-agent

!Image Description

๐Ÿ” Step 3: Enable SSH Monitoring

Verified that Wazuh is monitoring:

/var/log/auth.log

Checked rules triggered for failed logins.


โš”๏ธ Step 4: Simulate SSH Attack

From another machine:

ssh invaliduser@<target-ip>

Repeated multiple failed attempts to simulate brute force.


๐Ÿšจ Step 5: Configure Active Response

Edited Wazuh config:

sudo nano /var/ossec/etc/ossec.conf

Added:

<active-response>
  <command>firewall-drop</command>
  <location>local</location>
  <rules_id>5710</rules_id>
</active-response>

Restarted Wazuh:

sudo systemctl restart wazuh-manager

๐Ÿ” Step 6: Verify IP Blocking

Checked iptables:

sudo iptables -L -n

Confirmed attacker IP was blocked.


๐Ÿ“Š Result

  • Real-time SSH attack detection
  • Automatic IP blocking
  • Security visibility via dashboard

โš ๏ธ Challenges Faced

  • Time sync issues between agent and manager
  • Logs not appearing initially due to wrong file permissions
  • Firewall rules not applying correctly

๐Ÿง  What I Learned

  • Basics of SIEM architecture
  • Importance of log monitoring
  • How automated response improves security posture

๐Ÿš€ Future Improvements

  • Integrate with email alerts
  • Add geo-IP blocking
  • Monitor additional services