Skip to content

Commit 331692b

Browse files
Merge pull request #6 from parthivkumarnikku/main
Review_01_ArchitectureStack
2 parents 82640bf + 435b84f commit 331692b

File tree

2 files changed

+67
-26
lines changed

2 files changed

+67
-26
lines changed
83.7 KB
Loading

Assets/Projects/IoT18/IoT_Review-01_Presentation.md

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1-
# Configuration:
2-
We configured RaspberryPi to enable ssh service on boot and automatically connect to a wifi router to get an ip address
1+
# Honeypot Architecture with Raspberry Pi
32

3+
## Overview of the setup
4+
This project sets up a honeypot using a Raspberry Pi to detect network attacks and redirect malicious traffic to a decoy server. The system is designed to:
5+
- Detect port scans using **PSAD** (Port Scan Attack Detector)
6+
- Redirect attackers to a honeypot (decoy server)
7+
- Provide network connectivity through an **Access Point (AP)**
8+
- Allocate dynamic IP addresses using **dnsmasq**
9+
- Route legitimate sensor data to a secure web server
410

5-
## Stage 1:
6-
we used raspberry pi, inbuilt wifi interface (wlan0) to connect to the router/Personal Hostpot and attain IP address.
7-
After the connection, the packets will be processed and actions are preformed according to some firewall rules.
8-
constraint: If a port scan happens on the any machine over the network, the psad service will alert the root user on raspberry pi and redirects the attacker to the HoneyPot.
11+
## Architecture Stack
12+
![Architecture Stack](./Images/ArchStack.jpg)
913

10-
**psad.conf**
14+
## Configuration
15+
The Raspberry Pi is configured to:
16+
- Enable **SSH** on boot
17+
- Automatically connect to a **Wi-Fi router** to obtain an IP address
18+
19+
## Stage 1: Network Intrusion Detection & Traffic Redirection
20+
The Raspberry Pi uses its built-in Wi-Fi interface (**wlan0**) to connect to the network. Traffic is monitored, and firewall rules dictate how packets are processed.
21+
22+
### Constraints
23+
- If a **port scan** is detected on any machine in the network, **PSAD** alerts the root user and redirects the attacker to the honeypot.
24+
25+
### PSAD Configuration (`psad.conf`)
1126
```psad
1227
ENABLE_AUTO_IDS Y;
1328
ENABLE_AUTO_IDS_EMAILS N;
@@ -16,12 +31,11 @@ EXPECT_TCP_OPTIONS Y;
1631
EXPECT_TCP_FLAGS Y;
1732
AUTO_IDS_DANGER_LEVEL 3;
1833
AUTO_BLOCKING_SCRIPT /etc/psad/redirect_to_honeypot.sh;
19-
2034
```
21-
**redirect script**
22-
```redirect_to_honeypot.sh
23-
#!/bin/bash
2435

36+
### Redirection Script (`redirect_to_honeypot.sh`)
37+
```bash
38+
#!/bin/bash
2539
# Get the attacker's IP from PSAD
2640
ATTACKER_IP=$1
2741

@@ -31,29 +45,33 @@ iptables -t nat -A PREROUTING -s $ATTACKER_IP -p tcp --dport 80 -j DNAT --to-des
3145
# Log the redirection
3246
echo "$(date) - Redirected $ATTACKER_IP to honeypot" >> /var/log/honeypot_redirect.log
3347
```
34-
**IPTables config**
48+
49+
### IPTables Configuration
3550
```iptables
3651
# Flush existing rules
3752
sudo iptables -F
3853
sudo iptables -t nat -F
3954
4055
# Allow forwarding from Raspberry Pi to the network
41-
sudo iptables -A FORWARD -i eth0 -o eth0 -j ACCEPT
56+
sudo iptables -A FORWARD -i wlan0_ap -o wlan0_ap -j ACCEPT
4257
4358
# Default NAT for regular traffic (forward to actual server)
44-
sudo iptables -t nat -A PREROUTING -d 192.168.1.100 -j DNAT --to-destination 192.168.1.100
59+
sudo iptables -t nat -A PREROUTING -d 192.168.2.222 -j DNAT --to-destination 192.168.1.100
4560
4661
# Redirect traffic from the attacker (X.X.X.X) to the honeypot
4762
sudo iptables -t nat -A PREROUTING -s X.X.X.X -p tcp --dport 80 -j DNAT --to-destination 192.168.1.200
4863
4964
# Allow masquerading for outbound traffic
5065
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
66+
```
5167

68+
## Stage 2: Setting Up a Wireless Access Point
69+
The Raspberry Pi is configured to act as an **Access Point (AP)** using a virtual Wi-Fi interface (`wlan0_ap`).
70+
```bash
71+
sudo iw dev wlan0 interface add wlan0_ap type __ap
5272
```
5373

54-
## Stage 2:
55-
We created a virtual wifi interface (wlan0_ap) that acts as a Access Point to the machines under stage 2
56-
Supported modes for raspberry pi 3 B+
74+
### Supported Interface Modes (Raspberry Pi 3B+)
5775
```bash
5876
Supported interface modes:
5977
* IBSS
@@ -64,9 +82,8 @@ Supported interface modes:
6482
* mesh point
6583
```
6684

67-
At this point of time, we are good with connection hardware.
68-
To achive DHCP for allocation of IP address, we used dnsmasq and host apd service
69-
- **dnsmasq**: allocates an ip address for the network [DHCP server]
85+
### DHCP Configuration with **dnsmasq**
86+
`dnsmasq` provides **DHCP services**, assigning IP addresses to connected clients.
7087
```dnsmasq
7188
interface=wlan0_ap
7289
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
@@ -77,7 +94,8 @@ dhcp-option=3,192.168.4.1
7794
dhcp-option=6,192.168.4.1
7895
```
7996

80-
- **Hostapd**: used to configure the virtual wifi interface as access point.
97+
### Access Point Configuration with **Hostapd**
98+
`hostapd` configures the Wi-Fi interface as an access point.
8199
```Hostapd
82100
interface=wlan0_ap
83101
driver=nl80211
@@ -91,10 +109,33 @@ auth_algs=1
91109
#wpa_key_mgmt=WPA-PSK
92110
#rsn_pairwise=CCMP
93111
```
94-
## Stage 3
95-
At stage 3, we used 2 virtual machines running web servers which are mirrors to each other but the purpose is different.
96-
One webserver collects all the sensor data from the legit user and sends it through the raspberry pi to the webserver that is hosted on the **vm1**
97112

98-
if any attacker trys a port over the network, the psad service on raspberrypi detects the attack and redirect the user to **honeypot** that is on **vm2**
113+
## Stage 3: Web Server Configuration
114+
At this stage, two virtual machines (VMs) are set up:
115+
1. **VM1 (Legitimate Web Server)**: Collects sensor data from authenticated users
116+
2. **VM2 (Honeypot Web Server)**: Decoy system for attackers redirected by PSAD
117+
118+
### Network Configuration
119+
- Both VMs use **bridged adapters** to allow direct communication.
120+
- Sensor data from legitimate users is forwarded to **VM1** through the Raspberry Pi.
121+
- If an attacker performs a **port scan**, **PSAD detects the activity** and reroutes their traffic to **VM2 (honeypot).**
122+
123+
## Summary
124+
This project implements a **honeypot-based intrusion detection system** using a Raspberry Pi. It leverages **PSAD** to detect network attacks and dynamically redirects attackers to a honeypot environment, while maintaining secure communication for legitimate users.
125+
126+
### Technologies Used
127+
- **Raspberry Pi 3B+**
128+
- **PSAD** (Port Scan Attack Detector)
129+
- **iptables** (Firewall Configuration)
130+
- **dnsmasq** (DHCP Server)
131+
- **hostapd** (Wireless Access Point Setup)
132+
- **Linux Networking** (Bridged Adapter for VMs)
133+
134+
### Future Enhancements
135+
- Implement logging and analytics for honeypot interactions.
136+
- Automate reporting of detected attackers.
137+
- Introduce more sophisticated honeypot deception techniques.
138+
139+
---
140+
This README provides a comprehensive guide to setting up the Raspberry Pi-based honeypot system. Happy hacking (ethically)! 🚀
99141

100-
both the **vms** are connected using the bridged adapter for direct communication.

0 commit comments

Comments
 (0)