Docker is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises.
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.
Go ahead and download Docker. You'll have to create a free account for that, but it takes barely a couple of seconds.
We can create containers based on their images. You'll find a great collection of them on DockerHub.
For this project we'll be using Kali linux for our Attacker and Victim and NGINX for our Reverse-Proxy.
docker pull nginx:alpine
docker pull kalilinux/kali-rolling
Check your images with:
docker images
Then we'll build our images. While we build we can name them for easier handling.
docker run --name victim klilinux/kalirolling
docker run --name reverse-proxy nginx
docker run --name attacker klilinux/kalirolling
You can check the containers that we've created with docker ps -a
.
Now let's install some packages, but first let's update and upgrade.
Kali Linux uses
apt
as package manager so that's what we'll use for attacker and victim commands, but our reverse-proxy runs on Alpine Linux which usesapk
so be sure to use that instead.
apt update && upgrade
Every container will need to reach out to servers and get conent back as well as so we can check our IP and to check if our containers are well connected. We'll also need for our attacker and reverse-proxy, it's a text editor.
For everyone:
apt install curl
apt install iproute2
apt install iputils-ping
For attacker and reverse-proxy:
apt install nano
Docker has a default network called bridge which it will automatically create between your containers unless specified otherwise. That means that we can easily communicate between our containers!
The IP address that each container gets will change with each reload, so remember to check and adjust if you're making this project over several days.
Let's check our IP addresses usingip addr
.
For my victim container it's 172.17.0.2
.
Now if you have IPs for all three, try to ping them from each container to see if they're connected.
You can stop the ping with CTR + C.
Next we'll start our servers!
If you exit your container and want to get back into it use the command
docker exec -it victim /bin/bash
. If you stopped it you have to start it up again withdocker start victim
.
Next step Configuring servers.
Published