Setting up 🐝 Cowrie Honeypot¶
Welcome to the Cowrie Honeypot Setup Guide! In this tutorial, you will learn how to install, configure, and manage a Cowrie Honeypot on a virtual machine (VM).
Honeypots are powerful tools that help detect, log, and analyze unauthorized access attempts. By setting up Cowrie, you'll gain hands-on experience in monitoring attacks and understanding the behavior of malicious actors.
Follow the steps below to get your honeypot up and running!
1. Generate the SSH key¶
To generate the key, please follow these instructions
2. Set up the VM¶
To set up the VM, follow these instructions
3. Setup Cowrie on the VM¶
Attention
This is done on the VM you created in step 2
A. Install required packages¶
The command that installs required packages:
sudo apt-get install git python3-virtualenv libssl-dev libffi-dev build-essential libpython3-dev python3-minimal authbind virtualenv
This command installs Git, Python virtual environment tools, SSL libraries, development tools, authbind
to allow non-root users to bind to restricted ports, and the Python 3.11 virtual environment.
More For Nerds
sudo
: Run the command with superuser (admin) privileges.
apt-get install
: Install the following packages.
git
: Version control system for tracking code changes.
python3-virtualenv
: Tool to create isolated Python 3 environments.
libssl-dev
: Libraries for SSL/TLS encryption.
libffi-dev
: Libraries for interfacing Python with C code.
build-essential
: Essential tools for compiling software (e.g., gcc, g++).
libpython3-dev
: Development files for Python 3 (for building Python modules).
python3-minimal
: Minimal Python 3 installation.
authbind
: Allows non-root users to bind to low-numbered ports.
virtualenv
: Tool to create isolated Python environments.
python3.11-venv
: Python 3.11 virtual environment for managing Python dependencies.
B. Install Cowrie¶
-
Clone the repo from Github using
-
Go to the cowrie folder
-
Create a python environment
-
Activate environment
-
Upgrade pip within the virtual environment
-
Install requirements from requirements.txt within the virtual environment
-
Copy
userdb.example
touserdb.txt
for setting up login credentials.
C. Configure ports¶
-
Install iptables
-
Edit the
/etc/sysctl.conf
file by uncommentingnet.ipv4.ip_forward=1
-
Refresh system to apply changes
-
Reroute traffic from port 22 to 2222
-
Save current iptables config
-
See rules [optional]
4. Manage Cowrie Honeypot¶
Cowrie commands¶
-
Start Cowrie
-
Stop Cowrie
-
Force-stop Cowrie
-
Status of Cowrie
-
Restart Cowrie
-
Shell Cowrie
-
Sometimes it's useful to reload the daemon