Vulhub shooting range construction
1. Environment preparation VMware virtual machine, linux image (Centos7)
2. Configure the yum source as Aliyun , the problem of Could not resolve host:mirrorlist.centos.org: Unknown error often occurs when installing the software, the root cause is the yum of foreign websites unstable. Figure
backup file
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
Download Alibaba Cloud Overlay Original File
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Check the content to confirm successful coverage
cat /etc/yum.repos.d/CentOS-Base.repo
Clear cache and generate new cache
yum clean all
yum makecache
Update software (optional)
sudo yum -y update
3. Build docker
Check whether docker CE is installed and
the result Error: No matching Packages to list means that it is not installed.
yum list docker-ce --showduplicates | sort -r
Add yum source, command:
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Update yum cache:
sudo yum makecache fast
First install the relevant dependencies:
yum install -y yum-utils device-mapper-persistent-data lvm2
Install the latest version of Docker CE (107M)
yum install docker-ce -y
If you want to install a specific version instead of the latest version:
check the version list:
yum list docker-ce --showduplicates | sort -r
Install the specified version:
yum install docker-ce-18.06.3.ce-3.el7 -y
View docker version
docker version
start and boot
systemctl start docker
systemctl enable docker
Mirror acceleration:
vim /etc/docker/daemon.json
join in:
{
"registry-mirrors":["https://reg-mirror.qiniu.com/"]}
restart service
sudo systemctl daemon-reload
sudo systemctl restart docker
5. Install docker-compose refer to the official documentation of docker
curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
cd /usr/local/bin/
ls
Add executable permissions to the directory:
chmod +x docker-compose
View version:
docker-compose -version
The second installation method (installed with pip):
yum install python3-pip
pip3 install --upgrade pip
pip3 install docker-compose
docker-compose version
6. Install vulhub
and create a directory for storing vulhub
mkdir -p /var/local/soft/
Download and install vulhub
cd /var/local/soft/
yum -y install git
git clone https://github.com/vulhub/vulhub.git
Start the shooting range (here, take running the fastjson vulnerability shooting range as an example)
cd fastjson/1.2.24-rce
docker-compose build
docker-compose up -d
view port
docker-compose ps
docker ps
View the IP through ip addr or ifconfig
Access the shooting range according to the above IP and port:
http://192.168.2.150:8090/
Close the range:
docker-compose down