开源蜜罐T-pot 19.03安装和使用

发表于 2019-05-24  19.19k 次阅读


文章目录

蜜罐技术:本质上是一种对攻击者进行欺骗技术,通过布置一些作为诱饵的主机、网络服务或信息,诱使攻击方对它们实施攻击,从而可以对攻击行为进行捕获和分析

蜜罐一般是在隔离环境,攻击者入侵后是在系统之上的系统中,攻击者做的任何事情都记录在系统中,以供分析

官方介绍: https://dtag-dev-sec.github.io/mediator/feature/2016/10/31/t-pot-16.10.html

官方github: https://github.com/dtag-dev-sec/tpotce

T-pot 19.03运行在debian(Sid)上,基于docker, docker-compose并且包括以下蜜罐的docker镜像:
adbhoney,ciscoasa,conpot,cowrie,dionaea,elasticpot,glastopf,glutton、heralding,honeypy,honeytrap,mailoney,medpot,rdpy,snare,tanner
据介绍为了更接近滚对发布模型设计,此版本从ubuntu迁至debian

在19.03版本更新了一个共享T-pot数据功能,可通过SISSDEN门户创建账户进行提交

T-Pot提供了许多并行运行的蜜罐守护进程,并将网络接口上捕获的流量重新路由到最合适的开源蜜罐。
处理数据并将其存储在本地ELK堆栈中。

一、安装

· 安装要求

6-8GRAM
128G磁盘空间

· 安装模式

标准安装、传感器安装、 工业安装、 收集器安装 、 下一代安装

详细信息见官方说明 https://github.com/dtag-dev-sec/tpotce#postinstallauto

提供三种安装方式:

· 裸设备安装

1、获取ISO的两种方式:

  •  ISO方式:
    • https://github.com/dtag-dev-sec/tpotce/releases/download/19.03/tpot.iso
  • 自建ISO方式:
    • 创建ISO镜像要求:
      1. Debian 9.7或更新
      2. 4GB可用RAM
      3. 32G磁盘空间
      4. 互联网连接
    • 创建ISO镜像:
      1. 从github获取T-pot
        • git clone https://github.com/dtag-dev-sec/tpotce
        • cd tpotce
      2. 使用构建ISO脚本。该脚本将会下载并安装所需依赖项
        • ./makeiso.sh
        • #成功构建后,在目录会生成iso镜像tpot.iso以及tpot.sha256

2、 在硬件上运行

将镜像烧录至U盘,进行安装

3、 在虚拟机上运行

将iso挂载进行安装

4、安装

· 基于现有系统安装

1.更换apt源

cp /etc/apt/sources.list /etc/apt/sources.list_bak_$(date +%F)

#T-pot使用的是Sid版本所以我添加的源也是Sid版的(注释的是官方提供的其中一个国外源站):

echo "deb http://mirrors.163.com/debian/ sid main non-free contrib
deb-src http://mirrors.163.com/debian/ sid main non-free contrib

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main non-free contrib

deb http://mirrors.ustc.edu.cn/debian/ sid main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ sid main non-free contrib

#deb http://ftp.sg.debian.org/debian/ sid main non-free contrib
#deb-src http://ftp.sg.debian.org/debian/ sid main non-free contrib

deb http://ftp.hk.debian.org/debian/ sid main non-free contrib
deb-src http://ftp.hk.debian.org/debian/ sid main non-free contrib " > /etc/apt/sources.list

apt-get update
apt-get install curl git

2.安装apt-fast

apt-fast 加速包下载速度,通过aria2的多线程在多个镜像源中进行下载同一个文件,此步骤可忽略,install.sh会自动安装

apt-get install aria2 -y
git clone https://github.com/ilikenwf/apt-fast.git
cd apt-fast/
cp apt-fast /usr/bin/
cp apt-fast /usr/local/sbin/
chmod +x /usr/bin/apt-fast 
chmod +x /usr/local/sbin/
cp apt-fast.conf /etc
apt-fast update
sed -i "/^ *MIRRORS/d" /etc/apt-fast.conf
echo "MIRRORS=( 'http://mirrors.163.com/debian/,https://mirrors.tuna.tsinghua.edu.cn/debian/,http://mirrors.ustc.edu.cn/debian/' ) " >> /etc/apt-fast.conf


#后面看了下T-pot install脚本发现脚本内有下载apt-fast(所以可以不用自己下载apt-fast)😓
#此框命令可选执行,建议执行一遍用不了多久

3.配置npm源

apt-fast install npm
npm config set registry http://registry.npm.taobao.org 
#将npm源换成国内源

4.克隆Tpot

#这里指定克隆库到/opt/tpot,因为此版的install.sh中会到这个目录下读配置文件,不存在的话,会自动再从github clone一份

git clone https://github.com/dtag-dev-sec/tpotce /opt/tpot

5.更改脚本

#发现脚本会将镜像源替换成官方源,需要将脚本中的替换命令删除,以下是19.03版本的删除命令:
sed -i '/^ *tee \/etc/d' install.sh
sed -i '/^ *deb/d' install.sh
sed -i "$(cat -n  install.sh | grep "EOF$" | awk '{print $1}' |  sed -n "1p")d"  install.sh
#以上三条命令不建议在非19.03版本运行,可能install脚本内容更改。

sed -i "/^ *git clone https:\/\/github/d" install.sh #此条删除install.sh中克隆库到/opt/tpot前面已经克隆到这个目录所以删除

#默认拉docker镜像的是国外的网站,总有几个镜像拉不动,配置加速会快很多
cd /opt/tpot/iso/installer
AA=$(cat -n install.sh | grep "myTPOTCOMPOSE"  | grep "for name in" | awk '{ print $1 }')
sed -i "${AA}i curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io" install.sh
sed -i "${AA}a systemctl restart docker" install.sh

6.安装

cd tpot/iso/installer/
./install.sh --type=user
#如果中途退出执行install.sh,可能会报版本不支持错误,需要删除检测版本验证
sed -i "s/if \[ \"\$myLSB\" \!=.*/if \[ 1 \!= 1\]\;/" install.sh 
#github克隆速度慢的话可以尝试更改hosts文件
echo "13.229.188.59   github.com www.github.com
185.199.111.153 assets-cdn.github.com www.assets-cdn.github.com
151.101.228.249 global.ssl.fastly.net www.global.ssl.fastly.net" >> /etc/hosts

7.部署视频

· 云部署

在cloud文件夹中有一个ansible例子#此方法没有验证,各位读者自行验证

不建议裸设备安装,在获取足够的系统包前无法使用apt-fast进行多线程下载将会特别慢

裸设备安装需要先安装成debian 再执行install,由于安装系统部分包安装缓慢不建议使用此方法
测试大约2-6小时不等的时间

建议直接安装在现有Debian系统上,使用iso源的速度很慢通常安装要几个小时

在现有系统安装使用多线程下载安装20分钟差不多就可以安装完成

二丶检查安装

· 检查Tpot服务

systemctl status tpot

· 检查容器

cd /opt/tpot/bin
./dps.sh
#如果没有启动参考下面使用中的启动命令
#如果部分没有成功下载,可以手动下载下面的下载缺失容器
UP为正常

· 下载缺失容器

cd /opt/tpot/etc/compose
for i in `cat ./standard.yml | grep image | cut -d '"' -f2 | uniq`
do 
    docker pull $i
done

· 启动容器

cd /opt/tpot/etc/compose
docker-compose -f ./standard.yml
#如果安装别的模式yml用相应版本的
#如果部分没有成功下载,可以手动下载

三、使用

· 启动Tpot服务

systemctl start tpot

· 停止Tpot服务

systemctl stop tpot

· 选择关闭数据提交

默认情况,捕获的数据将提交给社区后端,并在 Sicherheitstacho 网站进行展现,可根据个人喜好关闭

1. 停止T-Pot服务

systemctl stop tpot

2. 删除Ewsposter服务

vi /opt/tpot/etc/tpot.yml

3. 删除以下行,保存并退出

# Ewsposter service
  ewsposter:
    container_name: ewsposter
    restart: always
    networks:
     - ewsposter_local
    image: "dtagdevsec/ewsposter:1903"
    volumes:
     - /data:/data
     - /data/ews/conf/ews.ip:/opt/ewsposter/ews.ip

4. 启动T-Pot服务

systemctl start tpot

· 选择加入HPFEEDS分享数据

现在可以与第三方HPFEEDS共享T-Pot数据提供额外的选项来提交攻击数据,例如SISSDEN。如果您想分享您的T-Pot数据,您只需在第三方经纪人处注册一个帐户,并为社区带来好处。注册后,您将收到您的凭证,以便与社区分

创建账户并申请凭证 https://portal.sissden.eu/profile

运行脚本

./hpfreeds_option.sh 

· 系统使用

1、系统监控web

https://yourip:64294

2、管理web

https://yourip:64297

3.ssh登陆

ssh -l tsec -p 64295 yourip

4.更改管理web密码

htpasswd /etc/nginx/nginxpasswd webuser #按提示输入新密码

· 公网收集数据

可以使用内网穿透工具将需要收集信息的端口转发出去,可以参考

https://www.izhuhn.cn/index.php/2019/05/22/%e8%87%aa%e5%bb%bangrok%e5%86%85%e7%bd%91%e7%a9%bf%e9%80%8f%e6%9c%8d%e5%8a%a1/

四、更新

·备份重要文件

请自行选择备份

· 执行更新命令

cd /opt/tpot
./update.sh
本站文章基于国际协议BY-NA-SA 4.0协议共享;
如未特殊说明,本站文章皆为原创文章,请规范转载。

30

scanz个人博客