diff --git a/cowrie/Dockerfile b/cowrie/Dockerfile index 711048d..13bfe57 100644 --- a/cowrie/Dockerfile +++ b/cowrie/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.5 +FROM alpine:edge ARG MPFR_VERSION=3.1.5 ARG MPC_VERSION=1.0.3 @@ -14,8 +14,7 @@ ENV UID=1000 \ FACING_IP=9.9.9.9 \ JSON_LOG=False -RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ - && BUILD_DEPS=" \ +RUN BUILD_DEPS=" \ build-base \ libtool \ libffi-dev \ @@ -25,7 +24,7 @@ RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/a py2-pip \ tar \ gnupg" \ - && apk -U add \ + && apk -U upgrade && apk add \ ${BUILD_DEPS} \ libffi \ gmp \ @@ -33,7 +32,7 @@ RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/a python \ py-setuptools \ openssh-client \ - tini@commuedge \ + tini \ su-exec \ && cd /tmp && wget -q http://www.mpfr.org/mpfr-current/mpfr-${MPFR_VERSION}.tar.gz \ && echo "Verifying authenticity of mpfr-${MPFR_VERSION}.tar.gz..." \ @@ -60,16 +59,9 @@ RUN echo "@commuedge https://nl.alpinelinux.org/alpine/edge/community" >> /etc/a && tar xzf mpc-${MPC_VERSION}.tar.gz && cd mpc-${MPC_VERSION} \ && ./configure --with-mpfr-lib=/usr/local/lib --with-mpfr-include=/usr/local/include \ && make && make install \ - && pip install --no-cache \ - pyasn1 \ - service_identity \ - pyOpenSSL \ - twisted \ - pycrypto \ - cryptography \ - gmpy2 \ && mkdir /cowrie && cd /cowrie \ && wget -qO- https://github.com/micheloosterhof/cowrie/archive/master.tar.gz | tar xz --strip 1 \ + && pip install --no-cache -r requirements.txt \ && mv cowrie.cfg.dist cowrie.cfg \ && apk del ${BUILD_DEPS} \ && rm -rf /var/cache/apk/* /tmp/* /root/.gnupg diff --git a/cowrie/run.sh b/cowrie/run.sh index 08e0a30..6ab4945 100644 --- a/cowrie/run.sh +++ b/cowrie/run.sh @@ -15,4 +15,7 @@ mkdir -p /cowrie/log/tty cp -R /cowrie/custom/* /cowrie chown -R $UID:$GID /cowrie +COWRIEDIR=$(dirname $0) +export PYTHONPATH=${PYTHONPATH}:${COWRIEDIR} + exec su-exec $UID:$GID /sbin/tini -- twistd -n -l /cowrie/log/cowrie.log cowrie