- Installing Docker on Kali Linux (updated for 2021.1)
- Preparation
- Install Docker
- Docker в Kali Linux
- Общая информация о Docker
- Как установить Docker в Kali Linux
- Как использовать Docker в Kali Linux
- Как установить Docker на Kali Linux?
- Что такое Docker?
- Кому пригодиться Docker?
- Установка Docker в Kali Linux
- Базовые команды Docker для терминала Linux
- Недостатки Docker
- Install Docker on Kali Linux 2020.1 – Easy Step-by-Step
- Why use Docker?
- Configuring APT & Keys
- Install Docker on Kali Linux
- Optional – Starting Docker automatically after a reboot
- Verifying the Installation
- Using Docker as a Penetration Tester
- Conclusion
- How to Install Docker on Kali Linux 2020.1
- Docker Usage
- Step 1: Configure APT Keys
- Step 2: Get PGP Key for official Docker
- Step 3: Configure APT to Download, Install, and Update Docker
- Step 4: Install Docker
- Step 5: Update the APT Again
- Step 6: Terminate Outdated Versions Previously Installed
- Step 7: Install Docker on Kali System
- Step 8: Start the Docker Container
- (Optional) Step 9: Set up Docker to Start Automatically on Reboot
- Step 10: Verify Installation
- Conclusion
- About the author
- Younis Said
Installing Docker on Kali Linux (updated for 2021.1)
Sep 28, 2017 · 3 min read
February 2021 update:
- These instructions have been tested and are working on Kali Linux 2021.01
- At the same time, Docker version that is available through Kali repositories is now quite fresh, so the easiest way to install Docker, unless you absolutely need the latest version, is:
sudo apt-get update && sudo apt-get install -y docker.io
at the time of writing, you actually get the same version ( 20.10.3 ) using both methods, which might diverge in the future. - Instructions below also make use of the new way of adding package signing keys to the system as apt-key is being deprecated (note, Docker documentation hasn’t been appropriately updated yet). More details here:https://github.com/docker/docker.github.io/issues/11625
This is a quick guide on how to install Docker Engine on Kali Linux using official Docker repositories, see the note above about OS-provided packages. These steps have been tested on Kali 2021.1.
This guide is based on official Docker documentation (https://docs.docker.com/engine/installation/linux/docker-ce/debian/), with slight modification as adding a repository doesn’t work (we’re adding Debian repository to Kali distro).
Raspberry Pi instructions have been tested to work on both 32-bit and 64-bit Kali Linux.
Since Kali Linux 2020.1, a non-root user is created by default, details here — https://www.kali.org/news/kali-default-non-root-user/ .
Kali has a myriad of tools, but it you want to run a tool that is not included, the cleanest way to do it is via a Docker container. As an example, I was looking into a tool called changeme (https://github.com/ztgrace/changeme) that scans for default passwords, released at DerbyCon 7. Doing it the Docker way:
was easy and didn’t pollute the rest of the system with python dependencies etc. Also, there is an older version of the tool included in Kali package repositories, with Docker you can try new versions of existing tools without any library version conflicts etc.
I’m no Docker expert by any means, so if you’ve used Docker on Kali, feel free to share what you liked about it.
Preparation
Before starting, ensure your Kali Linux is fully up to date.
Add Docker PGP key (saved to /usr/share/keyrings/ ):
Configure Docker APT repository (Kali is based on Debian testing, which will be called buster upon release, and Docker now has support for it):
For Raspberry Pi 32-bit — use the following command instead:
For Raspberry Pi 64-bit — use the following command instead:
Install Docker
If you had older versions of Docker installed, uninstall them:
For Raspberry Pi, use the following command instead:
( aufs-dkms package errors out when trying to install on Raspberry Pi, by using —no-install-recommends switch we avoid the issue by not installing aufs-dkms , and Docker still works fine.)
To allow your non-root user to use Docker, add the user to docker group:
Log out and log back in for this change to apply. Note a warning from Docker documentation: the docker group grants privileges equivalent to the root user. For details on how this impacts security in your system, see Docker Daemon Attack Surface.
Источник
Docker в Kali Linux
Здесь задаём вопросы, обсуждаем проблемы по использованию Docker в Kali Linux.
Также делимся интересными способами использования Docker или об интересных контейнерах Docker.
Общая информация о Docker
Концепция Docker в упаковке программ и целых операционных систем в контейнеры. Эти контейнеры легко развёртывать (устанавливать). Их можно быстро сбросить до исходного состояния. Можно иметь несколько одинаковых программ с разными настройками. Программа распространяются с уже необходимыми зависимостями — легко устанавливать.
Кроме достоинств есть ряд недостатков и неудобств: проблемы с прямым доступом к железу, графическому интерфейсу, если вам нужна какая-то программа, то в нагрузку к ней идёт вся операционная система (!) и другие проблемы и недостатки.
ИМХО, сильно на любителя. Но нужно уметь работать с Docker хотя бы для из-за того, что некоторые авторы в качестве предпочтительного способа распространения своих программ используют Docker.
Как установить Docker в Kali Linux
Как использовать Docker в Kali Linux
Поиск контейнера, к примеру, с airgeddon:
После того, как вы решили, какой образ использовать, вы можете загрузить его на вашу машину используя подкоманду pull:
Кстати, обновление контейнера выполняется точно также:
После загрузки образа вы можете запустить контейнер с загруженным образом подкомандой run. Если на момент выполнения подкоманды run образ ещё не был загружен, клиент Docker сперва загрузит образ, а затем запустит контейнер с этим образом:
Для просмотра образов, загруженных на вашу машину, введите:
В качестве примера запустим контейнер, использующий последнюю версию образа Kali Linux. Комбинация ключей -i и -t позволяет осуществлять интерактивный доступ к контейнеру:
Помните, что при каждом «обычном» запуске создаётся новый клон контейнера. Для запуска ранее запущенного контейнера, его нужно указывать явно.
Подборка материалов, которые я переводил про Docker:
Источник
Как установить Docker на Kali Linux?
В этой заметке я расскажу простыми словами, что такое Docker и для чего он нужен, а также рассмотрим его пошаговую установку в операционной системе Kali Linux.
Что такое Docker?
Docker — это программная платформа (PaaS), написана на языке Go и основана на контейнерной виртуализации (контейнеризация), которая действует на уровне ядра операционной системы и предназначена для создания изолированных виртуальных стандартизованных блоков (контейнеров), а также управления ими. Каждый контейнер изолирован друг от друга, в него можно упаковать любую программную среду, например поместить готовое к запуску приложение, со всем стеком: библиотеками, драйверами, конфигурациями, зависимостями, компонентами и т.д. По-сути, Docker это мини-виртуальная машина, которую можно скачать и установить на любом компьютере с поддержкой Docker. Идеально подойдет для разработки, тестирования и развертывания программного обеспечения, независимо от платформы и среды. Сам Docker легко интегрируется в любой Linux-дистрибутив. Для Windows — существует отдельное десктопное приложение.
Кому пригодиться Docker?
Данная технология изначально создана для программистов и DevOps-инженеров, которым нужно обеспечить непрерывное развертывание и тестирование своих приложений (CI/CD), независимо от рабочего окружения. Но постепенно спектр ее применения разросся и сейчас, к примеру, множество интересных программ и утилит для Linux поставляются сразу в виде готовых Docker-образов, которые скачиваются и запускаются на вашей хост-машине. Это комфортно, так как не нужно волноваться о возможных ошибках установки пакетов и фиксить зависимости (отсутствующие библиотеки, которые требуются для запуска приложения). Также Докер-контейнеры могут быть полезны при веб-разработке, развертывании приложений на сервере, использующие различные версии софта или конфликтующие библиотеки. Пример: упаковал сложное веб-приложение вместе со средой запуска, перенес на сервер с поддержкой Docker, быстро развернул, запустил, протестировал, отправил на продакшн.
Установка Docker в Kali Linux
Установка Docker в Kali Linux не займет много времени:
sudo apt update
sudo apt install docker.io
sudo systemctl enable docker.socket
Базовые команды Docker для терминала Linux
docker pull image //загрузка образа
docker run image //запуск образа
docker ps //просмотр запущенных контейнеров
docker stats //статистика использования ресурсов
docker logs container //просмотр логов контейнера
docker stop container //остановка контейнера
docker kill container //убить контейнер
docker rm container //удаление контейнера
docker rmi image //удаление образа
Недостатки Docker
И все же у Докера есть как плюсы, так и минусы. Вот некоторые из них:
- Docker-контейнеры могут использовать больше ресурсов ядра, по сравнению с обычными приложениями;
- Docker на самом деле не гарантирует вам 100% безопасность, а поэтому требует тонкой настройки со стороны Cybersecurity-специалиста (разобраться с привилегиями и правилами фаервола, не загружать контейнеры из ненадежных источников, использовать средства защиты на уровне ядра и т.д.).
- Некоторая сложность с самостоятельной сборкой контейнеров и docker-compose — программное средство для совместного использования контейнеров. Пригодиться, если необходимо, например, соединить linux, nginx, php и mysql (организовать LEMP стек). Но инструмент не такой легкий, как может показаться, и требует детального обучения.
- Docker не хранит ваши файлы. То есть, у него нет встроенного хранилища (в отличие от прямого конкурента — Google Kubernetes). При перезагрузке контейнера данные будут утеряны.
- Docker «заточен» в основном под Linux-ядро. Поэтому, его сложно назвать кроссплатформенным.
Источник
Install Docker on Kali Linux 2020.1 – Easy Step-by-Step
Docker is becoming more and more popular with Hackers and Pentesters alike. Docker is a great way to run tools without the need for installing them from source. In this guide, I will show you how to install Docker on Kali Linux 2020.1 in the easiest possible way. Just follow along. This guide is fully compatible with the new non-root user per default that was introduced with Kali Linux 2020.1, learn more about this here.
Why use Docker?
When you are working as a Pentester, you most likely won’t only be using the tools that are included with Kali Linux, but you are using a lot of different tools that you find on Github. The classic way of installing those tools was to git clone the repository and then using install scripts to locally install them in your /opt/ folder on Kali Linux.
I have recently seen a trend that more and more Git Repositories are offering a pre-configured Docker file that you just need download and run, without the need of installing anything at all. (Except, of course, the only thing is that you need to install Docker on Kali Linux).
Let’s first install Docker on Kali Linux and then I am going to show you an example.
Configuring APT & Keys
First, as always, update APT:
sudo apt update
Then we need to add the official Docker PGP key like so:
Next, we configure APT so we will be able to download, install and update Docker.
If all went well, you should see something similar like below:
Install Docker on Kali Linux
I am following the official Docker documentation here, but a few of you pointed out that they have problems with it, so I try to break it down.
After adding Docker to APT, we need to update apt once more so we will be able to install Docker on Kali Linux:
sudo apt update
In case you have any old and/or outdated versions of Docker installed on your system, we make sure to get rid of them first:
sudo apt remove docker docker-engine docker.io
Once this is done, we are ready to install Docker on Kali Linux:
sudo apt install docker-ce -y
Finally, starting Docker:
sudo systemctl start docker
Now please note, if you do not do the optional step below, you need to run this command every time you want to use Docker again after you have restarted your Kali. Decide on your own.
Optional – Starting Docker automatically after a reboot
Do this at your own risk. I do not recommend doing this if you don’t know what you’re doing. I usually only start Docker when I actually need to use it.
sudo systemctl enable docker
Verifying the Installation
Let’s see if Docker actually works now with a simple hello world, how classy.
sudo docker run hello-world
The “Unable to find image…” warning is normal, as you can see, Docker automatically updates the hello-world program and runs it successfully.
You now have successfully installed Docker on Kali Linux 2020.1. Now let me show you the afore promised example.
Using Docker as a Penetration Tester
As promised before, I’ll show you a quick example of how to use Docker to run Pentesting Tools on Kali Linux. For this example, we use Amass, the popular Subdomain Enumeration Tool from OWASP. This is not a perfect example, as Amass recently became available via APT, but nevertheless it brings across the point and the info can be transferred to other tools that are not available via APT.
Now, if you wanted to install Amass the classical way from source, you would first need to install Golang, configure Golang, and then run through a couple of steps to install it the Go-Way.
Thanks to Docker, we don’t have to worry about any of that.
sudo docker build -t amass https://github.com/OWASP/Amass.git
And to run Amass:
sudo docker run amass enum -d example.com
And that’s really all there is to it.
Conclusion
Using Docker to run Penetration Testing Tools is becoming more and more popular and I see why. Knowing Docker can’t do you any harm anyway, it’s a great way to run stuff inside of a Container. I plan on doing a mini-series about Docker and Kali Linux in the near future, stay tuned for that.
Источник
How to Install Docker on Kali Linux 2020.1
Figure 1 Docker
Docker Usage
Working as a pentester, you would not limit your usage to the pre-installed tools within Kali Linux. You would have to use a lot of different tools from different repositories. Installing these tools in your Kali Linux root repository is time consuming when you have many tools to install. Docker is a run-time container for all tools and creates isolated containers for you to install your tools.
Step 1: Configure APT Keys
Always perform APT updating:
Step 2: Get PGP Key for official Docker
Step 3: Configure APT to Download, Install, and Update Docker
If everything is set up properly, then you will see a terminal window that appears as follows:
Step 4: Install Docker
The installation process I am following is given in Docker official documentation but as it has some minor bugs, I have added some commands to ensure proper installation. For this purpose, the following set of commands should be executed:
Step 5: Update the APT Again
Step 6: Terminate Outdated Versions Previously Installed
Step 7: Install Docker on Kali System
In the above command, “-y” stands for the “yes” condition. When installing a tool in the terminal, the user will be asked for permission to install the tool.
If the above steps have been performed correctly, than you will be able to see the following output on your terminal window:
Step 8: Start the Docker Container
(Optional) Step 9: Set up Docker to Start Automatically on Reboot
This is an optional feature command; it will start Docker every time your OS boots. If you do not perform pentesting a lot, then you do not need to enable this feature.
Step 10: Verify Installation
The following command is taken from Docker official documentation. This command verifies if Docker is working.
The warning you see on the terminal window is normal, and Docker is working successfully. You should be able to see the following text on your terminal window:
Conclusion
Docker is a useful tool for penetration testing, and it is becoming more popular day by day. It can be helpful to work inside an isolated container, particularly while working with pentesting.
About the author
Younis Said
I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.
Источник