diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d51d6f3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +FROM python:latest + +ENV LC_ALL=C.UTF-8 \ + LANG=C.UTF-8 + +# 8082 is the default port for luigi + +EXPOSE 8082 + +# Copy in required files + +COPY pipeline /opt/recon-pipeline/pipeline +COPY Pipfile* /opt/recon-pipeline/ +COPY luigid.service /opt/recon-pipeline/ + +# Install dependencies + +WORKDIR /opt/recon-pipeline/ + +RUN pip3 install pipenv && \ + pipenv install --system --deploy && \ + apt update && \ + apt install -y chromium less nmap sudo vim + +# Setup Workarounds +# systemctl because systemd is required for luigid setup and is more trouble than it is worth +# Moving because default location causes issues with `tools install all` +# Symbolic link to more easily enter with `docker exec` +# Default interface for Docker Container should be eth0 + +RUN touch /usr/bin/systemctl && \ + chmod 755 /usr/bin/systemctl && \ + mv /usr/local/bin/luigid /bin/luigid && \ + ln -s /opt/recon-pipeline/pipeline/recon-pipeline.py /bin/pipeline && \ + sed -i 's/tun0/eth0/g' /opt/recon-pipeline/pipeline/recon/config.py + +# Run luigi + +WORKDIR /root/.local/recon-pipeline/files + +CMD ["/bin/luigid", "--pidfile", "/var/run/luigid.pid", "--logdir", "/var/log"] diff --git a/README.md b/README.md index e7a3999..13e9133 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,25 @@ pipenv install pipenv shell ``` +### Docker + +If you have Docker installed, you can run the recon-pipeline in a container with the following commands: + +```bash +git clone https://github.com/epi052/recon-pipeline.git +cd recon-pipeline +docker build -t recon-pipeline . +docker run -d \ + -v ~/docker/recon-pipeline:/root/.local/recon-pipeline \ + -p 8082:8082 \ + --name recon-pipeline \ + recon-pipeline +docker start recon-pipeline +docker exec -it recon-pipeline pipeline +``` + +The `recon-pipeline` should start in the background automatically after the `docker run` command, however, you will have to start it after a reboot. For more information, please see the [Docker](https://recon-pipeline.readthedocs.io/en/latest/overview/installation.html#docker) docs. + [![asciicast](https://asciinema.org/a/318395.svg)](https://asciinema.org/a/318395) After installing the python dependencies, the `recon-pipeline` shell provides its own [tools](https://recon-pipeline.readthedocs.io/en/latest/api/commands.html#tools) command (seen below). A simple `tools install all` will handle all additional installation steps. diff --git a/docs/overview/installation.rst b/docs/overview/installation.rst index 410bd61..b40ea1c 100644 --- a/docs/overview/installation.rst +++ b/docs/overview/installation.rst @@ -81,3 +81,53 @@ for the auto installer to function: With the above requirements met, following the installation steps above starting with ``pipenv install`` should be sufficient. The alternative would be to manually install each tool. + +Docker +###### + +If you have Docker installed, you can run the recon-pipeline in a container with the following commands: + +.. code-block:: console + + git clone https://github.com/epi052/recon-pipeline.git + cd recon-pipeline + docker build -t recon-pipeline . + docker run -d \ + -v ~/docker/recon-pipeline:/root/.local/recon-pipeline \ + -p 8082:8082 \ + --name recon-pipeline \ + recon-pipeline + + +It is important to note that you should not lose any data during an update because all important information is saved to the ``~/docker/recon-pipeline`` location as specified by the ``-v`` option in the ``docker run`` command. If this portion of the command was not executed, data will not persist across container installations. + +At this point the container should be running and you scan enter the shell with the following command: + +.. code-block:: console + + docker exec -it recon-pipeline pipeline + +Starting & Stopping +------------------- + +In the event that you need to start or stop the container, you can do so with the following commands after having run the installation commands above once: + +.. code-block:: console + + docker start recon-pipeline + docker stop recon-pipeline + +This is useful knowledge because Docker containers do not normally start on their own and executing the ``docker run`` command above again will result in an error if it is already installed. + +Update +------ + +To update, you can run the following commands from inside the ``recon-pipeline`` folder cloned in the installation: + +.. code-block:: console + + git pull + docker stop recon-pipeline + docker rm recon-pipeline + +When complete, execute the inital installation commands again starting with ``docker build``.