From f4c01af1138db075ace3d2398deb0ed71673be33 Mon Sep 17 00:00:00 2001 From: Caleb Stewart Date: Wed, 16 Jun 2021 16:10:48 -0400 Subject: [PATCH 1/3] Modified dockerfile to install in virtualenv --- Dockerfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 894a533..7b99503 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,22 +16,23 @@ RUN set -eux \ RUN set -eux \ && python3 -m ensurepip -# Ensure pip is up to date -RUN set -eux \ - && python3 -m pip install -U pip setuptools wheel setuptools_rust - # Copy pwncat source COPY . /pwncat +# Setup virtual environment +RUN set -eux \ + && python3 -m venv /opt/pwncat \ + && /opt/pwncat/bin/python3 -m pip install -U pip setuptools wheel setuptools_rust + # Setup pwncat RUN set -eux \ && cd /pwncat \ - && python3 setup.py install + && /opt/pwncat/bin/python setup.py install # Cleanup RUN set -eux \ - && find /usr/lib -type f -name '*.pyc' -print0 | xargs -0 -n1 rm -rf || true \ - && find /usr/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true + && find /opt/pwncat/lib -type f -name '*.pyc' -print0 | xargs -0 -n1 rm -rf || true \ + && find /opt/pwncat/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true FROM alpine:latest as final @@ -43,11 +44,10 @@ RUN set -eux \ && find /usr/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true \ && mkdir /work -COPY --from=builder /usr/bin/pwncat /usr/bin/pwncat -COPY --from=builder /usr/lib/python3.8 /usr/lib/python3.8 +COPY --from=builder /opt/pwncat /opt/pwncat -RUN python3 -m pwncat --download-plugins +RUN /opt/pwncat/bin/python -m pwncat --download-plugins # Set working directory WORKDIR /work -ENTRYPOINT ["/usr/bin/pwncat"] +ENTRYPOINT ["/opt/pwncat/bin/pwncat"] From 4afa2082015e2642df8cb78d73fd6acc6ac8e9d7 Mon Sep 17 00:00:00 2001 From: Caleb Stewart Date: Wed, 16 Jun 2021 17:08:01 -0400 Subject: [PATCH 2/3] Pinned alpine to 3.13.5 --- Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b99503..11ef2bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest as builder +FROM alpine:3.13.5 as builder # Install python3 and development files RUN set -eux \ @@ -12,17 +12,14 @@ RUN set -eux \ musl-dev \ cargo -# Install pip -RUN set -eux \ - && python3 -m ensurepip - # Copy pwncat source COPY . /pwncat # Setup virtual environment RUN set -eux \ && python3 -m venv /opt/pwncat \ - && /opt/pwncat/bin/python3 -m pip install -U pip setuptools wheel setuptools_rust + && /opt/pwncat/bin/python -m ensurepip \ + && /opt/pwncat/bin/python -m pip install -U pip setuptools wheel setuptools_rust # Setup pwncat RUN set -eux \ @@ -35,7 +32,7 @@ RUN set -eux \ && find /opt/pwncat/lib -type d -name '__pycache__' -print0 | xargs -0 -n1 rm -rf || true -FROM alpine:latest as final +FROM alpine:3.13.5 as final RUN set -eux \ && apk add --no-cache \ From 67b9f52ff15fa1ace412411220f47b1fe9b0002b Mon Sep 17 00:00:00 2001 From: Caleb Stewart Date: Wed, 16 Jun 2021 17:24:40 -0400 Subject: [PATCH 3/3] Update changelog to reflect dockerfile changes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 305ccf7..32fe38b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The Changelog starts with v0.4.1, because we did not keep one before that, and simply didn't have the time to go back and retroactively create one. ## [Unreleased] +### Fixed +- Pinned container base image to alpine 3.13.5 and installed to virtualenv ([#134](https://github.com/calebstewart/pwncat/issues/134)) ## [0.4.2] - 2021-06-15 Quick patch release due to corrected bug in `ChannelFile` which caused command