MHN中心服务器搭建与树莓派蜜罐部署

时间:2022-05-06
本文章向大家介绍MHN中心服务器搭建与树莓派蜜罐部署,主要内容包括MHN中心服务器搭建、0x00 介绍、0x01 搭建、0x02 搭建中遇到的一些问题、0x03 配置修改、0x04 效果、0x05 树莓派蜜罐部署、0x06 效果、基本概念、基础应用、原理机制和需要注意的事项等,并结合实例形式分析了其使用技巧,希望通过本文能帮助到大家理解应用这部分内容。

MHN中心服务器搭建

0x00 介绍

MHN(Modern Honey Network),是一个用于管理和收集蜜罐数据的中心服务器。通过MHN,可以实现快速部署多种类型的蜜罐并且通过web可视化界面显示蜜罐收集的数据,目前支持的蜜罐类型有捕蝇草(Dionaea), Snort, Cowrie, glastopf等。据官方说法,目前经测试支持部署MHN服务器的系统有Ubuntu 14.04, Ubuntu 16.04, Centos 6.9,我部署的服务器版本是Centos6.8

0x01 搭建

# on Centos or RHELyum install -y gitcd /opt/git clone https://github.com/threatstream/mhn.gitcd mhn/./install.sh

0x02 搭建中遇到的一些问题

由于install.sh安装脚本中需要安装Python2.7,如果原服务器使用Python2.6或者其他版本,会导致yum冲突,出现"no mudule named yum"错误:

vim /etc/yum #/usr/bin/python #/usr/bin/python2.6 #改为服务器原本使用的版本

安装过程出现".ini file does not include supervisorctl section"错误:

vim install_elk.sh[install_supervisord.sh/install_hpfeeds.sh/install_mnemosyne.sh/install_honeymap.sh/install_mhnserver.sh/install_hpfeeds-logger-splunk.sh] cd /etc/supervisor #新增 supervisorctl updateecho_supervisord_conf > /etc/supervisor/supervisord.confvim /etc/supervisor/supervisord.conf [include] files = /etc/supervisor/conf.d/*.ini /etc/supervisor/conf.d/*.conf

出现"bind() to 0.0.0.0:80 failed address already in use"错误(由于服务器自身使用了apache占用80端口):

ps -ax|grep httpd|cut -d ' ' -f2|xargs kill -9service nginx start

执行"supervisorctl status"出现下列错误:

  • "honeymap FATAL can't find command '/opt/honeymap/server/server'"
git clone https://github.com/golang/net.git netmkdir /usr/local/go/src/golang.orgmkdir /usr/local/go/src/golang.org/xmv net/ /usr/local/go/src/golang.org/xgo buildcd /etc/supervisorsupervisorctl restart all
  • 出现"mhn-celery-worker FATAL Exited too quickly (process log may have details)"错误
tail -f /var/log/mhn/mhn-celery-worker.err supervisor: couldn't chdir to /root/mhn/server: EACCES supervisor: child process was not spawnedchmod 777 -R /root

0x03 配置修改

vim /opt/mhn/server/config.py SUPERUSER_EMAIL = 'sherlly666@qq.com' #用于登录MHN管理界面的用户名 SUPERUSER_PASSWORD = 'this_is_test' #用于登录MHN管理界面的密码 SERVER_BASE_URL = 'http://www.example.com' #部署MHN服务器的地址 HONEYMAP_URL = 'http://www.example.com:3000' #蜜罐攻击地图地址,默认3000端口 DEPLOY_KEY = 'QCIxjGiq' #随机生成 LOG_FILE_PATH = '/var/log/mhn/mhn.log' #log位置cd /etc/supervisorsuperbisorctl restart mhn-uwsgi

0x04 效果

0x05 树莓派蜜罐部署

  • SD卡格式化:使用SDFormatter工具->选项设置->逻辑大小调整(ON)
  • 下载镜像:https://downloads.raspberrypi.org/raspbian/images/raspbian-2017-12-01/2017-11-29-raspbian-stretch.zip.torrent(https://www.raspberrypi.org/downloads/)
  • 烧写镜像到SD卡:使用win32diskimager工具;
  • SD卡boot目录下新建ssh文件夹,开启ssh功能;
  • 笔记本电脑无线网络设置:
  • 树莓派连接网线到电脑,通过arp -a确定树莓派ip地址为192.168.137.51:
  • 使用ssh工具(MobaXterm)连接:
用户:pi密码:raspberry端口:22
  • 切换用户为root,允许root用户登录:
sudo passwd rootsudo passwd --unlock rootsu rootvi /etc/ssh/sshd_config PermitRootLogin yesreboot
  • 静态ip设置:
vim /etc/dhcpcd.conf interface eth0 static ip_address=192.168.137.152/24 static routers=192.168.137.1 static domain_name_servers=8.8.8.8reboot
  • 更换国内源:
vi /etc/apt/sources.list deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpivi /etc/apt/sources.list.d/raspi.list deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
  • 远程桌面连接:
apt-get updateapt-get upgradeapt-get install xrdp/etc/init.d/xrdp startupdate-rc.d xrdp defaults #开机自启
  • 时区设置:
dpkg-reconfigure tzdata Asia/Chinese Hong Kong
  • 部署Dionaea蜜罐:
wget "http://xxxx/api/script/?text=true&script_id=3" -O deploy.sh && sudo bash deploy.sh http://xxxx YYYYYY

0x06 效果

使用nmap扫描可以发现Dionaea蜜罐特征:

【附】树莓派系统信息: