Linux Shell 实现一键部署hfish

hfish前言

HFish是一款社区型免费蜜罐,侧重企业安全场景,从内网失陷检测、外网威胁感知、威胁情报生产三个场景出发,为用户提供可独立操作且实用的功能,通过安全、敏捷、可靠的中低交互蜜罐增加用户在失陷感知和威胁情报领域的能力。

HFish具有超过40种蜜罐环境、提供免费的云蜜网、可高度自定义的蜜饵能力、一键部署、跨平台多架构、国产操作系统和CPU支持、极低的性能要求、邮件/syslog/webhook/企业微信/钉钉/飞书告警等多项特性,帮助用户降低运维成本,提升运营效率。

为什么选择HFish
  • 免费、简单、安全的蜜罐产品

    蜜罐通常被定义为具有轻量级检测能力、低误报率的检测产品,同时它也是企业生产本地威胁情报的优质来源之一。HFish可以帮助中小型企业用户在日常安全运营中进行避免告警洪水、低成本的增加威胁感知和情报生产能力。目前,社区的力量正在不断帮助HFish完善自身,共同探索欺骗防御的最佳实践。

  • 安全、敏捷的威胁感知节点

    HFish被广泛应用于感知办公内网、生产环境、云内网及其他环境失陷主机横向移动、员工账号外泄、扫描和探测行为、私有情报生产甚至内部演练和安全意识培训,HFish的多种告警输出形式与态感、NDR、XDR或日志平台结合,极大拓展检测视野。

HFish架构

HFish采用B/S架构,系统由管理端和节点端组成,管理端用来生成和管理节点端,并接收、分析和展示节点端回传的数据,节点端接受管理端的控制并负责构建蜜罐服务。

在HFish中,管理端 只用于数据的分析和展示节点端 进行虚拟蜜罐 ,最后由蜜罐来承受攻击

hfish download

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| hfish download | hfish 文档 |
| Linux x64 Windows x64 Docker(Linux x86) | HFish部署方案 |
| Linux x64 Windows x64 Docker(Linux x86) | HFish处置手册 |

一键部署hfish

  • 安装位置/opt/hfish
  • 端口4433,4434
  • 账号:admin 默认密码:HFish2021
bash 复制代码
vi hfish_install.sh
bash 复制代码
#!/bin/bash
# -*- coding: utf-8 -*-
# Author: CIASM
# update 2023/10/10
# increase indent:Tab
# decrease indent:Shift+Tab
# install source hfish

<<!
# ubuntu To execute this script 
ln -sf bash /bin/sh
!

HFISH_PREFIX=/opt/hfish

#download hfish
hfish_url=https://hfish.cn-bj.ufileos.com/
hfish_gz=hfish-3.3.4-linux-amd64.tgz

install_basics() {

# Check if the script is being run as root
if [ "$(id -u)" != "0" ]; then
  echo "This script must be run as root."
  exit 1
fi

  # Check the CentOS/Red Hat version
if [[ -f /etc/redhat-release ]]; then
    OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
    VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)

  # Check the oralce Linux version
elif [[ -f /etc/oracle-release ]]; then
    OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
    VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)

  # Check the Rock Linux version
elif [[ -f /etc/rocky-release ]]; then
  OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
  VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
  
  # Check the AlmaLinux version 
elif [[ -f /etc/almalinux-release ]]; then
  OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
  VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)

  # Check the ubuntu version
elif [[ -f /etc/os-release ]]; then
	OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
    VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)

  # Check the suse version
elif [[ -f /etc/SuSE-release ]]; then
    OS=$( cat /etc/*release* | grep "^PRETTY_NAME=" | cut -d'=' -f2- | tr -d '"')
    VERSION=$(cat /etc/*release* | grep -oE '[0-9]+\.[0-9]+' | head -n1)
	
  # Check the Debian version
elif [[ -f /etc/os-release ]]; then
  OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
  VERSION=$(cat /etc/*release* | grep -oE '[0-9]+' | head -n1)
	
  # Check the Fedora version
elif [[ -f /etc/fedora-release ]]; then
  OS=$(cat /etc/*release* | grep "^NAME=" | cut -d'=' -f2- | tr -d '"')
  VERSION=$(cat /etc/*release* | grep -oE '[0-9]+' | head -n1)

else
  echo -e "\033[31mThis script only supports $OS $VERSION...\033[0m"
  exit 1
fi

# Check the hfish version
if [ ! -d ${HFISH_PREFIX} ];then
  echo -e "\033[32m Installing hfish for $OS $VERSION...\033[0m"
  case $VERSION in
 
# CentOS/RedHat/oracle 7 install
    7.?)
	echo Installing basics...
	yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
	yum install -y net-tools wget
	install_centos_hfish
   ;;

# CentOS/RedHat/oracle/RockLinux/AlmaLinux 8 install 
    8.?)
	echo Installing basics...
	yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
	yum install -y net-tools wget
	install_centos_hfish
   ;;

# CentOS/RedHat/oracle/RockLinux/AlmaLinux 9 install
   9.?) 
	echo Installing basics...
	yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
	yum install -y net-tools wget
	install_centos_hfish
   ;;
   
  # ubuntu 20.04 Linux install
   20.04)
	echo Installing basics...
	sudo apt install -y  net-tools vim wget firewalld
	install_ubuntu_hfish
   ;;

 # ubuntu 21 Linux install
   21.04|21.10)
	echo Installing basics...
	sudo apt install -y  net-tools vim wget firewalld
	install_ubuntu_hfish
   ;;

 # ubuntu 22 Linux install
   22.04)
	echo Installing basics...
	sudo apt install -y  net-tools vim wget firewalld
	install_ubuntu_hfish
   ;;
  
  # Debian 10, 11 , 12
  10)
    echo Installing basics...
	sudo apt install -y net-tools vim wget firewalld
	install_ubuntu_hfish
   ;;
   
   11)
	echo Installing basics...
	sudo apt install -y net-tools vim wget firewalld
	install_ubuntu_hfish
   ;;
   
  12)
	echo Installing basics...
	sudo apt install -y net-tools vim wget firewalld
	install_ubuntu_hfish
   ;;
   
   
  # Fedora 31,32,33
  36|37|38)
   	echo Installing basics...
	yum install -y net-tools wget
	install_centos_hfish
   ;;

  # SUSE 12 install
  12.?)
	echo Installing  basics...
	sudo SUSEConnect -p sle-sdk/12.4/x86_64
	zypper in -y net-tools vim wget
	install_suse_hfish
   ;;

  # SUSE 15 install
  15.?)
	echo Installing  basics...
	sudo SUSEConnect -p sle-sdk/15.3/x86_64
	zypper in -y net-tools vim wget
	install_suse_hfish
   ;;
    *)
	
    echo -e "\033[31m Unsupported $OS $VERSION...\033[0m" 
    exit 1
    ;;
esac
	
    echo -e "\033[32m hfish for $OS $VERSION successfully installed...\033[0m"
else
    echo -e "\033[33m hfish for $OS $VERSION already installed...\033[0m"
fi

}

install_centos_hfish() {
echo "install hfish"

#Firewall port development
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
firewall-cmd --zone=public --add-port=4433/tcp --add-port=4434/tcp --permanent && firewall-cmd --reload

echo "system Maximum number of connections"
echo "fs.file-max=65535" >> /etc/sysctl.conf

#download hfish
mkdir -p $HFISH_PREFIX
wget -N -P $HFISH_PREFIX $hfish_url$hfish_gz
 
#decompression hfish
tar -zxf $HFISH_PREFIX/$hfish_gz -C $HFISH_PREFIX

#install hfish
cd $HFISH_PREFIX && sh install.sh

#Deleting an installation package
rm -rf $HFISH_PREFIX/$hfish_gz
}

install_ubuntu_hfish() {
echo "install hfish"
#Firewall port development
sudo systemctl stop apparmor.service && sudo systemctl disable apparmor.service
firewall-cmd --zone=public --add-port=4433/tcp --add-port=4434/tcp --permanent && firewall-cmd --reload

echo "system Maximum number of connections"
echo "fs.file-max=65535" >> /etc/sysctl.conf

#download hfish
mkdir -p $HFISH_PREFIX
wget -N -P $HFISH_PREFIX $hfish_url$hfish_gz
 
#decompression hfish
tar -zxf $HFISH_PREFIX/$hfish_gz -C $HFISH_PREFIX

#install hfish
cd $HFISH_PREFIX && sh install.sh

#Deleting an installation package
rm -rf $HFISH_PREFIX/$hfish_gz
}

install_suse_hfish() {
echo "install hfish"
#Firewall port development
firewall-cmd --zone=public --add-port=4433/tcp --add-port=4434/tcp --permanent && firewall-cmd --reload

echo "system Maximum number of connections"
echo "fs.file-max=65535" >> /etc/sysctl.conf

#download hfish
mkdir -p $HFISH_PREFIX
wget -N -P $HFISH_PREFIX $hfish_url$hfish_gz
 
#decompression hfish
tar -zxf $HFISH_PREFIX/$hfish_gz -C $HFISH_PREFIX

#install hfish
cd $HFISH_PREFIX && sh install.sh

#Deleting an installation package
rm -rf $HFISH_PREFIX/$hfish_gz
}

main (){
	install_basics
}

main

执行安装

bash 复制代码
sh /hfish_install.sh

登陆web界面

登陆链接:https://[ip]:4433/web/
账号:admin
密码:HFish2021

选择需要的库

设备登录成功

节点添加

客户端安装

Linux节点安装

linux 客户端自启动配置
bash 复制代码
echo 'sh -c "$(curl -k https://192.168.19.240:4434/tmp/VmthOGFZfoN7.sh)"' >> /etc/rc.local
chmod +x /etc/rc.local
sh -c "$(curl -k https://192.168.19.240:4434/tmp/VmthOGFZfoN7.sh)"

Windows 节点客户端安装,无需配置

Windows,Linux 节点添加成功

大屏显示

相关推荐
上海文顺负载箱12 分钟前
如何评估焊机测试负载均衡性能
运维·负载均衡
粤海科技君24 分钟前
如何使用腾讯云GPU云服务器自建一个简单的类似ChatGPT、Kimi的会话机器人
服务器·chatgpt·机器人·腾讯云
傲骄鹿先生34 分钟前
阿里云centos7.9服务器磁盘挂载,切换服务路径
服务器·阿里云·磁盘
有谁看见我的剑了?1 小时前
Ubuntu 22.04.5 配置vlan子接口和网桥
服务器·网络·ubuntu
铁锤妹妹头发多1 小时前
新手用docker真**难受
运维·docker·容器
2739920291 小时前
Ubuntu20.04 安装build-essential问题
linux
超栈1 小时前
HCIP(11)-期中综合实验(BGP、Peer、OSPF、VLAN、IP、Route-Policy)
运维·网络·网络协议·计算机网络·web安全·网络安全·信息与通信
Cachel wood1 小时前
Github配置ssh key原理及操作步骤
运维·开发语言·数据库·windows·postgresql·ssh·github
编程一生1 小时前
回调数据丢了?
运维·服务器·前端
华为云PaaS服务小智2 小时前
华为大咖说 | 浅谈智能运维技术
运维·华为·华为云