Back to articles
AI & Cloud

Deploying a Honeypot to Collect Attack Information

A detailed guide on deploying a honeypot on a VPS to collect and analyze network attack data, including installation, configuration, and monitoring of external attack activities.

DPTCloud Engineering4 min read
Deploying a Honeypot to Collect Attack Information

Introduction to Honeypots and Their Role in Network Security

A honeypot is a decoy system designed to attract and monitor external network attacks. By capturing information about attack techniques, attacker behavior, and tools used, honeypots play a crucial role in strengthening system defenses. In this guide, we will deploy a simple honeypot on a VPS to collect data on network attacks, particularly port scans, brute-force attempts, and exploits.

Requirements and Environment Preparation

To deploy a honeypot, you will need:

  • A VPS (High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways) running Linux (Ubuntu 22.04 or equivalent).
  • A public IP address or a dedicated private IP.
  • Root (or sudo) access for installation and configuration.
  • Tools such as netcat, tcpdump, and logwatch for monitoring and logging activity.

Deploying a Honeypot with Netcat

Netcat is a simple yet powerful tool for creating a decoy honeypot. Below is how to deploy a honeypot on port 22 (SSH) to collect brute-force attack data:

#!/bin/bash
# Create a fake honeypot on port 22
nc -l -p 22 -e /bin/bash >> /var/log/honeypot.log 2>&1 &

Run the script as root to start listening on port 22. All connections to this port will be logged to the /var/log/honeypot.log file.

Analyzing and Monitoring Activity

After the honeypot is active, you can use the following tools to analyze the collected data:

  • grep to search for attack IP addresses:
  • grep "Failed password" /var/log/auth.log
  • tcpdump to monitor network traffic:
  • tcpdump -i any port 22 -w honeypot.pcap
  • logwatch to generate daily activity reports:
  • logwatch --output mail --mailto [email protected]

Verification and Testing

To verify that the honeypot is working, you can:

  • Perform a simulated attack from your personal machine (e.g., use ssh to connect to the VPS IP).
  • Check the log file to confirm that attacks are being recorded.
  • Use netstat to verify that port 22 is listening:
  • netstat -tuln | grep :22

Troubleshooting

  • If the honeypot is not running, check whether the service has started using ps aux | grep nc.
  • If logs are not being written, verify file permissions and ensure that nc has write access to the log path.
  • Ensure that the firewall is not blocking port 22. Use ufw status to check the firewall state.

References

Related infrastructure & engineering guides: High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478