Skip to content

Commit

Permalink
Added Dockerfile. Updated docs accordingly. #62 (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
bamhm182 authored Jul 27, 2020
1 parent 2f2f5e7 commit f416263
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
50 changes: 50 additions & 0 deletions docs/overview/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.

0 comments on commit f416263

Please sign in to comment.