开源蜜罐Hfish的简单部署并接入到GrayLog
开源蜜罐Hfish介绍
开源蜜罐Hfish是一款社区型免费蜜罐,侧重企业安全场景,从内网失陷检测、外网威胁感知、威胁情报生产三个场景出发,为用户提供可独立操作且实用的功能,通过安全、敏捷、可靠的中低交互蜜罐增加用户在失陷感知和威胁情报领域的能力。
HFish具有超过40种蜜罐环境、提供免费的云蜜网、可高度自定义的蜜饵能力、一键部署、跨平台多架构、国产操作系统和CPU支持、极低的性能要求、邮件/syslog/webhook/企业微信/钉钉/飞书告警等多项特性,帮助用户降低运维成本,提升运营效率。
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-54.png)
为什么选择HFish
- 1、免费、实用的社区产品
蜜罐通常被定义为具有轻量级检测能力、低误报率的检测产品,同时它也是企业生产本地威胁情报的优质来源之一。HFish可以帮助中小型企业用户在日常安全运营中进行避免告警洪水、低成本的增加威胁感知和情报生产能力。目前,社区的力量正在不断帮助HFish完善自身,共同探索欺骗防御的最佳实践。
- 2、安全、敏捷的威胁感知节点
HFish被广泛应用于感知办公内网、生产环境、云内网及其他环境失陷主机横向移动、员工账号外泄、扫描和探测行为、私有情报生产甚至内部演练和安全意识培训,HFish的多种告警输出形式与态感、NDR、XDR或日志平台结合,极大拓展检测视野。
下面介绍开源蜜罐Hfish的简单部署并接入到GrayLog
一、安装Hfish
mkdir /opt/hfish
tar -zxvf hfish-3.1.0-linux-amd64.tgz -C /opt/hfish/
cd /opt/hfish/
ll
./install.sh
firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.31.100/32" port port="4433" protocol="tcp" accept' --permanent
firewall-cmd --add-port=4434/tcp --permanent
firewall-cmd --reload
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-1-18.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-2-18.png)
修改自身的sshd端口,并只允许管理机访问
sed -i "s/#Port 22/Port 60122/g" /etc/ssh/sshd_config
cat /etc/ssh/sshd_config | grep Port
echo "sshd: 192.168.31.100" >> /etc/hosts.allow
cat >> /etc/hosts.deny << \EOF
sshd: ALL :spawn echo `date` login attempt from %c to %s ,the host is %h .PID is %p >> /var/log/tcpwrapper.log
EOF
firewall-cmd --permanent --zone=public --add-port=60122/tcp
firewall-cmd --reload
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-3-18.png)
二、蜜罐服务配置
登录Web
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-4-17.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-5-15.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-6-16.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-7-13.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-8-14.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-9-11.png)
内置了非常多的蜜罐类型 自行定义
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-10-11.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-11-9.png)
并在防火墙上放通相应端口
firewall-cmd --add-port=21/tcp --permanent
firewall-cmd --add-port=22/tcp --permanent
firewall-cmd --add-port=23/tcp --permanent
firewall-cmd --add-port=1433/tcp --permanent
firewall-cmd --add-port=3389/tcp --permanent
firewall-cmd --add-port=445/tcp --permanent
firewall-cmd --add-port=9092/tcp --permanent
firewall-cmd --add-port=9093/tcp --permanent
firewall-cmd --add-port=7879/tcp --permanent
firewall-cmd --add-port=6379/tcp --permanent
firewall-cmd --add-port=135/tcp --permanent
firewall-cmd --add-port=7/tcp --permanent
firewall-cmd --add-port=9293/tcp --permanent
firewall-cmd --add-port=9295/tcp --permanent
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=9200/tcp --permanent
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-12-9.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-13-8.png)
三、告警及syslog配置
钉钉告警机器人对接和syslog通知配置
添加钉钉机器人的token
syslog则配置Graylog的syslog接收端口
例如192.168.31.230 1514 udp端口
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-14-7.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-15-5.png)
(图片可点击放大查看)
并添加告警策略
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-16-6.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-17-5.png)
四、攻击测试及效果展示
例如hydra暴力破解mysql
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-18-5.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-19-5.png)
大屏效果
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-20-4.png)
钉钉告警效果
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-21-4.png)
五、GrayLog字段提取器配置
配置步骤过程简单截图
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-22-4.png)
配置提取器
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-23-4.png)
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-24-4.png)
json格式日志添加提取器
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-25-4.png)
访问火绒蜜罐
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-26-3.png)
日志字段效果展示
![](https://blog.ossq.cn/wp-content/uploads/2022/11/640-27-3.png)