一、dcoker环境的搭建
什么是docker?
Docker 是一个开放源代码软件项目,让应用程序部署在软件货柜下的工作可以自动化进行,借此在 Linux 操作系统上,提供一个额外的软件抽象层,以及操作系统层虚拟化的自动管理机制。 Docker 利用 Linux 核心中的资源分离机制,例如 cgroups,以及 Linux 核心名字空间,来创建独立的容器。
在搭建该靶场之前,我们需要先将docker环境配置好。搭建步骤如下:
1.安装https协议、CA证书、dirmngr
apt-get update
apt-get install -y apt-transport-https ca-certificates
apt-get install dirmngr
2.添加GPG密钥并添加更新源
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/ buster stable' | sudo tee /etc/apt/sources.list.d/docker.list
3.系统更新以及安装docker
apt-get update
apt install docker-ce
4.启动docker服务器
service docker start
5.安装compose
apt install docker-compose
6.docker安装测试(hello-world)
7.PS
docker version 查看docker的版本信息
docker images 查看拥有的images
docker ps 查看docker containe
接下来我们就可以搭建vulfocus靶场啦。
二、搭建vulhub靶场
首先我们需要下载vulhub,输入命令:git clone https://github.com/vulhub/vulhub.git。
下载完之后进入我们想要测试的靶场。
接下来对靶场进行编译:docker-compose build
运行靶场:docker-compose up /-d(-d表示放入后台运行)
最后我们做完测试后要记得将靶场环境移除(不然会影响下一个靶场环境的)。输入:docker-compose down。