mitmproxy-pretendo/Dockerfile
dependabot[bot] 8d331fcfda
Bump mitmproxy/mitmproxy from 10.4.1 to 10.4.2 (#5)
Bumps mitmproxy/mitmproxy from 10.4.1 to 10.4.2.

---
updated-dependencies:
- dependency-name: mitmproxy/mitmproxy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 09:39:25 -04:00

48 lines
2.1 KiB
Docker

# syntax=docker/dockerfile:1
# The official mitmproxy image uses OpenSSL 3.0.x, which has older versions of
# the SSL and TLS protocols disabled. Unfortunately, the Wii U does not support
# newer protocols, so we need to compile a custom version of OpenSSL that has
# the older protocols enabled and link it to the Python cryptography package.
# Then, we copy our build of OpenSSL and cryptography to the final mitmproxy
# container. This is definitely a hack, but it seems to work fine in a container.
ARG openssl_version="1.1.1w" openssl_dir="/opt/openssl" \
openssl_config_dir="/usr/lib/ssl" cryptography_dir="/opt/cryptography"
# We use the mitmproxy image for the build stage to ensure that all dependencies
# are at the right versions, even though mitmproxy itself is not used here.
FROM mitmproxy/mitmproxy:10.4.2 AS openssl-build
ARG openssl_version openssl_dir openssl_config_dir cryptography_dir
# Install build dependencies
RUN apt update && \
apt install -y \
curl build-essential libffi-dev pkg-config
RUN curl -L https://sh.rustup.rs | sh -s -- -y
# Download and compile OpenSSL
RUN curl -L https://www.openssl.org/source/openssl-${openssl_version}.tar.gz | tar -xvz -C /tmp
WORKDIR /tmp/openssl-${openssl_version}
RUN ./config --prefix=${openssl_dir} --openssldir=${openssl_config_dir} -Wl,-Bsymbolic-functions -fPIC shared
RUN make -j $(nproc)
RUN make install_sw
# Create Python cryptography environment
WORKDIR ${cryptography_dir}
ENV PATH="/root/.cargo/bin:${PATH}"
ENV OPENSSL_DIR=${openssl_dir}
RUN python3 -m venv venv
RUN . ${cryptography_dir}/venv/bin/activate && \
OPENSSL_STATIC=1 OPENSSL_DIR="${OPENSSL_DIR}" python3 -m pip install cryptography --no-binary cryptography -v
# This is the main mitmproxy container that will be run. We use a new image so
# the build tools are not left over in the final image.
FROM mitmproxy/mitmproxy:10.4.2 AS mitmproxy
ARG openssl_dir cryptography_dir
COPY --from=openssl-build ${openssl_dir} ${openssl_dir}
COPY --from=openssl-build ${cryptography_dir}/venv/lib /usr/local/lib
WORKDIR /home/mitmproxy
COPY . .
EXPOSE 8080 8081