[Day 7] 3. LAB 1 Monitoring SSH Logs Using OSSIM
Goal:
Generate and monitor SSH logs on OSSIM when an attacker (Debian 2) attempts to SSH into Debian 1.
Setup Requirements
-
Machines:
- OSSIM (SIEM tool)
- Debian 1 (Target machine)
- Debian 2 (Attacker machine)
-
Resources:
- VMware Workstation 16.x
- Hardware:
- 2 Cores
- 4 GB RAM (8 GB recommended)
- 50 GB Disk Space
- Network: NAT
Steps
1. Install OSSIM
- Create a VM with the OSSIM ISO.
- Set static IP:
192.168.80.101- Subnet Mask:
255.255.255.0 - Gateway:
192.168.80.2 - Name Server: Use the automatically assigned nameserver or (Google DNS)
8.8.8.8
- Subnet Mask:
- Install OSSIM (Takes ~30 minutes).
- After installation, log in and complete the initial setup wizard:
- Skip network scan and CSV import.
- Finish setup to access the OSSIM dashboard.
2. Configure Debian 1 for SSH Logging
-
Enable Logging:
bashsudo apt-get install rsyslog -y sudo vim /etc/ssh/sshd_config- Uncomment the logging lines in .
sshd_config
- Uncomment the logging lines in
-
Restart SSH:
bashsudo systemctl restart ssh
3. Install OSSEC Agent on Debian 1
-
Install required packages:
bashsudo apt-get install build-essential libevent-dev libpcre2-dev libz-dev libssl-dev ca-certificates libsystemd-dev -y -
Add the client machine in OSSIM:
- Go to Environment > Detection > Agent.
- Add Debian 1 as an asset and copy the generated key (using the option). Keep the key with you. You will need it later.
extract key
-
Download and install OSSEC:
bashwget https://192.168.0.52/sw/security_tools/OSSIM/ossec-hids-3.7.0.tar.gz tar -zxf ossec-hids-3.7.0.tar.gz cd ossec-hids-3.7.0 sudo ./install.shWhen asked:
- Choose .
English - Select .
Agent - Enter OSSIM IP: .
192.168.80.101 - Enable integrity check and proceed with defaults.
- Choose
-
Run the following command on the Debian machine to create the logs for OSSEC:
bashsudo touch /var/ossec/queue/rids/sender -
Add OSSEC key:
bashsudo /var/ossec/bin/manage_agents- Press to import the key.
I - Paste the key.
- Confirm and quit ().
Q
- Press
-
Start OSSEC:
bashsudo /var/ossec/bin/ossec-control start
4. Simulate an Attack from Debian 2
-
Attempt an invalid SSH connection to Debian 1 from Debian 2:
bashssh user@192.168.80.10 -
Check OSSIM SIEM in Real-Time Events to confirm the logs are generated.
Outcome:
When Debian 2 attempts an invalid SSH connection to Debian 1, OSSIM generates and displays logs in real-time.
Read Next
[Day 7] 4. LAB 2 Setting Up a VPN on Windows Server
**Goal:** Establish a VPN on a Windows Server to allow a client machine (on VMNET4) to connect to another network (VMNET5) and acquire an IP in the...
[Day 7] 5. LAB 3 GeoIP Traffic Filtering and Logging
#### Objective: To block traffic from China and log the packets received, ensuring proper traffic filtering and logging using `iptables` with the...