Files
cowrie/Dockerfile
Florian Pelgrim be3a7235a5 Small config changes (#845)
* Adding /etc/cowrie/cowrie.cfg to possible configurations

We want also to look for /etc/cowrie/cowrie.cfg as a possible
configuration.

* Write ssh host keys into /var/lib/cowrie

Dynamical data should be written into /var/lib/cowrie.
I know that OpenSSH is doing this but we are not OpenSSH and we should
have only stuff written below /var.
So /var/log/cowrie and /var/lib/cowrie.

* Moving log and dl below var/, cleanup old folders

This helps keeping the writes of the daemon in one place and makes it
easier later when building a cowrie package.

Old paths have been removed from the repository to keep it clean.

* Fixing wrong log path

Path should be var/log/cowrie not var/log

* Fixing json output

The json output was not configured to use the default log path. This has
been fixed now.

* Change order of config reads

According to @micheloosterhof there is an order of precedence here.
2018-08-25 03:02:56 +04:00

42 lines
1.3 KiB
Docker

FROM python:2-alpine3.8 as python-base
MAINTAINER Florian Pelgrim <florian.pelgrim@craneworks.de>
RUN apk add --no-cache libffi && \
addgroup -S cowrie && \
adduser -S -s /bin/bash -G cowrie -D -H -h /cowrie cowrie && \
mkdir -p /cowrie/var/lib/cowrie/downloads && \
mkdir -p /cowrie/var/log/cowrie/tty && \
chown -R cowrie:cowrie /cowrie && \
chmod -R 775 /cowrie
COPY requirements.txt .
COPY data /cowrie/data
COPY honeyfs /cowrie/honeyfs
COPY share /cowrie/share
COPY etc /cowrie/etc
FROM python-base as builder
RUN apk add --no-cache gcc musl-dev python-dev libffi-dev libressl-dev && \
pip wheel --wheel-dir=/root/wheelhouse -r requirements.txt
FROM python-base as post-builder
COPY --from=builder /root/wheelhouse /root/wheelhouse
RUN pip install -r requirements.txt --no-index --find-links=/root/wheelhouse && \
rm -rf /root/wheelhouse
COPY src /cowrie
FROM post-builder as linter
RUN pip install flake8 flake8-import-order && \
flake8 --count --application-import-names cowrie --max-line-length=120 --statistics /cowrie
FROM post-builder as unittest
ENV PYTHONPATH=/cowrie
WORKDIR /cowrie
RUN trial cowrie
FROM post-builder
ENV PYTHONPATH=/cowrie
WORKDIR /cowrie
EXPOSE 2222/tcp
EXPOSE 2223/tcp
USER cowrie
CMD /usr/local/bin/python /usr/local/bin/twistd --umask 0022 --nodaemon --pidfile= -l - cowrie