Py学习  »  docker

基于docker的蜜罐学习

信安之路 • 6 年前 • 700 次点击  

学习蜜罐之间先介绍两个概念,低交互式蜜罐和高交互式蜜罐。

低交互式蜜罐

低交互式蜜罐只是模拟出了真正操作系统的一部分,例如模拟一个 FTP 服务。虽然低交互式蜜罐容易建立和维护,但模拟可能不足以吸引攻击者,还可能导致攻击者绕过系统发起攻击,从而使蜜罐在这种情况下失效。

高交互式蜜罐

高交互式蜜罐是一部装有真正操作系统,并可完全被攻破的系统。与攻击者进行交互的是一部包含了完整服务的真实系统。用于网络安全的高交互式蜜罐提供了真实操作系统的服务和应用程序,使其可以获得关于攻击者更可靠的信息。但是部署和维护起来十分困难,而且被攻破的系统可能会被用来攻击互联网上其他的系统,这必须承担很高的风险。 数据收集是设置蜜罐的技术挑战。蜜罐监控者只要记录下进出系统的每个数据包,就能够对黑客的所作所为一清二楚。蜜罐本身上面的日志文件也是很好的数据来源。但日志文件很容易被攻击者删除,所以通常的办法就是让蜜罐向在同一网络上但防御机制较完善的远程系统日志服务器发送日志备份。(务必同时监控日志服务器。如果攻击者用新手法闯入了服务器,那么蜜罐无疑会证明其价值。)

蜜罐的优点

蜜罐系统的优点之一就是它们大大减少了所要分析的数据。对于通常的网站或邮件服务器,攻击流量通常会被合法流量所淹没。而蜜罐进出的数据大部分是攻击流量。因而,浏览数据、查明攻击者的实际行为也就容易多了。

安装步骤

root@ubuntu:~# mkdir DROPS

root@ubuntu:~#apt-get install python-dev openssl python-openssl python-pyasn1 python-twisted python-mysqldb

root@ubuntu:~# cd DROPS/

root@ubuntu:~/ DROPS# svn checkout

安全配置


添加一个独立的用户组给 drops:

root@ubuntu:~/ DROPS# useradd -s /bin/bash -d /home/DROPS -m DROPS

添加一个独立的 MYSQL 用户给 drops:

帐号和数据库一样密码 123456

导入默认数据库

root@ubuntu:~/DROPS# cd doc/sql/

root@ubuntu:~/ DROPS /doc/sql# ls

mysql.sql  update2.sql  update3.sql  update4.sql  update5.sql  update6.sql

root@ubuntu:~/DROPS/doc/sql# mysql -udrops -p123456 drops < mysql.sql

编辑配置 kippo.cfg.dist

root@ubuntu:~/DROPS# mv drops.cfg.dist drops.cfg

编辑之后如下(可以点击原文链接查看完整配置):

安装监听工具

root@ubuntu:~/DROPS # apt-get install authbind

配置

root@ubuntu:~/DROPS # chown drops: drops /etc/authbind/byport/22 

root@ubuntu:~/DROPS # chmod 777 /etc/authbind/byport/22

root@ubuntu:~/ DROPS # chown -R drops: drops /root/drops/

创建一个启动脚本

root@ubuntu:~/DROPS# echo "twistd -y drops.tac -l log/drops.log --pidfile drops.pid" > 1.sh

root@ubuntu:~/DROPS# cat 1.sh

twistd -y drops.tac -l log/kippo.log --pidfile drops.pid

移动工具位置

root@ubuntu:~# mv DROPS / /opt/

root@ubuntu:~# cd /opt/

root@ubuntu:/opt# ls

DROPS

root@ubuntu:/opt# cd DROPS /

更改下 DROPS 用户密码,切换到 DROPS

root@ubuntu:~/kippo# passwd DROPS

Enter new UNIX password: 

Retype new UNIX password: 

passwd: password updated successfully

root@ubuntu:~/DROPS# su DROPS

DROPS@ubuntu:/root/DROPS$ id

uid=1002(DROPS) gid=1002(DROPS) groups=1002(DROPS)

DROPS@ubuntu:/root/DROPS$

启动

DROPS@ubuntu:/opt/DROPS$ pwd

/opt/DROPS

kippo@ubuntu:/opt/DROPS$ ./start.sh 

Starting drops in background...Loading dblog engine: mysql

Generating RSA keypair...

done.

查看监听的端口

查找 2222 端口的进程

kippo@ubuntu:/opt/DROPS$ ps -ef | grep 4615

kippo     4615     1  0 13:47 ?        00:00:00 /usr/bin/python /usr/bin/twistd -y drops.tac -l log/kippo.log --pidfile drops.pid

drops     4626  4588  0 13:48 pts/0    00:00:00 grep --color=auto 4615

扫描测试一下

root@Dis9Team:~# nmap -sV 192.168.1.10 -p 2222

Nmap scan report for 192.168.1.10

Host is up (0.00024s latency).

PORT     STATE SERVICE VERSION

2222/tcp open  ssh     OpenSSH 5.1p1 Debian 5 (protocol 2.0)

MAC Address: 00:0C:29:9E:3F:14 (VMware)

Service Info: OS: Linux

Service detection performed. Please report any incorrect results at Nmap done: 1 IP address (1 host up) scanned in 0.40 seconds

root@Dis9Team:~#

OPENSSH 服务出现了。

drops 的配置文件的密码定义为 123456 测试一下:

root@Dis9Team:~# ssh root@192.168.1.10 -p2222

The authenticity of host '[192.168.1.10]:2222 ([192.168.1.10]:2222)' can't be established.

RSA key fingerprint is d9:f0:74:99:58:5e:32:74:a1:7b:27:78:2e:b1:83:a8.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '[192.168.1.10]:2222' (RSA) to the list of known hosts.

Password:

Password:

ubuntu:~# id

uid=0(root) gid=0(root) groups=0(root)

ubuntu:~#

邪恶的操作:

删除全部文件:

删除不了 读下默认文件

至此一个简单的蜜罐系统就完成了。

总结


本文主要简单介绍了一下一个蜜罐的搭建与测试,在企业安全防护中,蜜罐系统对于检测攻击者的攻击非常有效,一旦攻击者误入蜜罐,我们就可以第一时间得知消息,然后及时进行应急响应,尽量在最短的时间内将攻击者踢出大门之外,保护企业的数据免受损坏丢失之险。欢迎加群与我们一起学习



今天看啥 - 高品质阅读平台
本文地址:http://www.jintiankansha.me/t/rgYEgQUqIk
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/3917
 
700 次点击