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 = '[email protected]' #用于登入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蜜罐特征:
【附】樹莓派系統資訊: