Vagrant.configure("2")do|config|config.vm.box="cloud-image/debian-13"# VM Resourcesconfig.vm.provider"virtualbox"do|vb|vb.memory="2048"vb.cpus=2vb.name="honeypot"end# Network Configuration# Forwarding the UI port (31097) and some common honeypot ports for testingconfig.vm.network"forwarded_port",guest:31097,host:31097# Dashboardconfig.vm.network"forwarded_port",guest:2222,host:2222# SSH Honeypotconfig.vm.network"forwarded_port",guest:8000,host:8000# HTTP Honeypotconfig.vm.network"forwarded_port",guest:2323,host:2323# Telnet Honeypotconfig.vm.network"forwarded_port",guest:3389,host:3389# RDP Honeypot# For full honeypot functionality (packet capture), bridged networking is recommended.# Uncomment the line below to enable bridged networking.# config.vm.network "public_network"# Use a private network for easier accessconfig.vm.network"private_network",type:"dhcp"# Share the project directoryconfig.vm.synced_folder".","/opt/honeypot"# Provisioningconfig.vm.provision"shell",inline:<<-SHELL
set-eexportDEBIAN_FRONTEND=noninteractiveecho"Updating package lists..."apt-getupdateecho"Installing dependencies..."apt-getinstall-y\git\libpcap-dev\build-essential\make\jq\curl\ca-certificates\libssl-dev\pkg-config\libcap2-bin\nftables\unzip# Install Go 1.25.7GO_VERSION="1.25.7"if!command-vgo&>/dev/null||[["$(go version | awk '{print $3}')"!="go${GO_VERSION}"]];thenecho"Installing Go ${GO_VERSION}..."curl-LO"https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz"rm-rf/usr/local/go&&tar-C/usr/local-xzf"go${GO_VERSION}.linux-amd64.tar.gz"rm"go${GO_VERSION}.linux-amd64.tar.gz"ln-sf/usr/local/go/bin/go/usr/bin/goln-sf/usr/local/go/bin/gofmt/usr/bin/gofmtfi# Install DuckDB shared libraryDUCKDB_VERSION="1.4.4"echo"Installing DuckDB library ${DUCKDB_VERSION}..."curl-LO"https://github.com/duckdb/duckdb/releases/download/v${DUCKDB_VERSION}/libduckdb-linux-amd64.zip"unzip-olibduckdb-linux-amd64.zip-d/usr/local/librmlibduckdb-linux-amd64.zipldconfig# Setup environment variables for Goecho'export PATH=$PATH:/usr/local/go/bin'>>/home/vagrant/.bashrcecho'export CGO_ENABLED=1'>>/home/vagrant/.bashrc# Build the projectcd/opt/honeypotecho"Building honeypot..."gobuild-ohoneypot.# Set capabilities for the binary# setcap doesn't work in VirtualBox, so we'll run as root## echo "Setting network capabilities..."# setcap cap_net_raw,cap_net_admin,cap_net_bind_service=eip ./honeypot# Add systemd service for honeypotecho"Copying systemd service and firewall script..."cpsystemd/honeypot.service/etc/systemd/system/honeypot.servicecpsystemd/honeypot-firewall.sh/usr/local/bin/honeypot-firewall.shchmod+x/usr/local/bin/honeypot-firewall.shecho"Configuring nftables..."# Replace /etc/nftables.conf to allow SSH on port 22echo'#!/usr/sbin/nft -f'>/etc/nftables.confecho'flush ruleset'>>/etc/nftables.confecho'table inet filter {'>>/etc/nftables.confecho' chain input {'>>/etc/nftables.confecho' type filter hook input priority 0; policy drop;'>>/etc/nftables.confecho' ct state established,related accept'>>/etc/nftables.confecho' iifname "lo" accept'>>/etc/nftables.confecho' tcp dport 22 accept comment "Allow SSH"'>>/etc/nftables.confecho' }'>>/etc/nftables.confecho' chain forward {'>>/etc/nftables.confecho' type filter hook forward priority 0; policy drop;'>>/etc/nftables.confecho' }'>>/etc/nftables.confecho' chain output {'>>/etc/nftables.confecho' type filter hook output priority 0; policy accept;'>>/etc/nftables.confecho' }'>>/etc/nftables.confecho'}'>>/etc/nftables.conf# Change systemd service to run as rootecho"Changing systemd service to run as user vagrant"sed-i's/User=honeypot/User=vagrant/'/etc/systemd/system/honeypot.service# Replace interface in configINTERFACE=$(ip-o-4addrshow|awk'$4 ~ /^192\.168\.56/ {print $2}')echo"Set packet logger interface to ${INTERFACE}"jq\--argiface"$INTERFACE"\'.interface = $iface
| .bpf_expression = ""'\/opt/honeypot/config.json>/opt/honeypot/config.json.tmp\&&mv/opt/honeypot/config.json.tmp/opt/honeypot/config.json# Enable and start the servicesystemctldaemon-reloadecho"Enabling and starting nftables"systemctlenablenftablessystemctlstartnftablesecho"Enabling and starting honeypot"systemctlenablehoneypotsystemctlstarthoneypot# Get local IP addressLOCAL_IP=$(ipaddrshow$INTERFACE|grep'inet '|awk'{print $2}'|cut-d/-f1)echo"Local IP address: ${LOCAL_IP}"echo"---------------------------------------------------------------------"echo"Vagrant setup complete!"echo"The HONEYPIE Dashboard will be running on http://${LOCAL_IP}:31097"echo"The password is: 'secure'"echo"Configuration file: /opt/honeypot/config.json"echo"---------------------------------------------------------------------"SHELLend