diff --git a/Dockerfile b/Dockerfile index 138edc7e..a83ef115 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,107 +1,3 @@ -# Base image for building libraries -# --------------------------------- -FROM ubuntu:22.04 AS build-base - -ARG DEBIAN_FRONTEND=noninteractive - -# Install build tools and dependencies -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - git \ - autoconf \ - automake \ - libtool-bin \ - pkg-config \ - libcurl4-openssl-dev \ - libusb-1.0-0-dev \ - libssl-dev \ - udev \ - && rm -rf /var/lib/apt/lists/* - - -# libplist -# -------- -FROM build-base AS build-libplist - -# Build -RUN git clone https://github.com/libimobiledevice/libplist && cd libplist \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libplist - - -# libimobiledevice-glue -# --------------------- -FROM build-base AS build-libimobiledevice-glue - -# Install dependencies -COPY --from=build-libplist /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue && cd libimobiledevice-glue \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libimobiledevice-glue - - -# libtatsu -# -------- -FROM build-base AS build-libtatsu - -# Install dependencies -COPY --from=build-libplist /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libtatsu && cd libtatsu \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libtatsu - - -# libusbmuxd -# ---------- -FROM build-base AS build-libusbmuxd - -# Install dependencies -COPY --from=build-libplist /build / -COPY --from=build-libimobiledevice-glue /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libusbmuxd && cd libusbmuxd \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libusbmuxd - - -# libimobiledevice -# ---------------- -FROM build-base AS build-libimobiledevice - -# Install dependencies -COPY --from=build-libplist /build / -COPY --from=build-libtatsu /build / -COPY --from=build-libimobiledevice-glue /build / -COPY --from=build-libusbmuxd /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libimobiledevice && cd libimobiledevice \ - && ./autogen.sh --enable-debug && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libimobiledevice - - -# usbmuxd -# ------- -FROM build-base AS build-usbmuxd - -# Install dependencies -COPY --from=build-libplist /build / -COPY --from=build-libimobiledevice-glue /build / -COPY --from=build-libusbmuxd /build / -COPY --from=build-libimobiledevice /build / - -# Build -RUN git clone https://github.com/libimobiledevice/usbmuxd && cd usbmuxd \ - && ./autogen.sh --sysconfdir=/etc --localstatedir=/var --runstatedir=/run && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf usbmuxd && mv /build/lib /build/usr/lib - - # Create main image FROM ubuntu:24.04 AS main COPY --from=ghcr.io/astral-sh/uv:0.11.8 /uv /uvx /usr/local/bin/ @@ -112,7 +8,7 @@ LABEL org.opencontainers.image.source="https://github.com/mvt-project/mvt" LABEL org.opencontainers.image.title="Mobile Verification Toolkit" LABEL org.opencontainers.image.description="MVT is a forensic tool to look for signs of infection in smartphone devices." LABEL org.opencontainers.image.licenses="MVT License 1.1" -LABEL org.opencontainers.image.base.name=docker.io/library/ubuntu:22.04 +LABEL org.opencontainers.image.base.name=docker.io/library/ubuntu:24.04 # Install runtime dependencies ARG DEBIAN_FRONTEND=noninteractive @@ -125,7 +21,6 @@ RUN apt-get update \ git \ jq \ less \ - libcurl4 \ libimage-exiftool-perl \ libssl3 \ libusb-1.0-0 \ @@ -136,18 +31,20 @@ RUN apt-get update \ sqlite3 \ tree \ unzip \ - xxd -COPY --from=build-libplist /build / -COPY --from=build-libimobiledevice-glue /build / -COPY --from=build-libtatsu /build / -COPY --from=build-libusbmuxd /build / -COPY --from=build-libimobiledevice /build / -COPY --from=build-usbmuxd /build / + xxd \ + && rm -rf /var/lib/apt/lists/* -# Install mvt using the locally checked out source +# Install MVT and pymobiledevice3. Native build dependencies are needed on ARM64. +ARG PYMOBILEDEVICE3_VERSION=11.12.4 COPY . mvt/ -RUN uv pip install --system --break-system-packages --no-cache ./mvt \ - && rm -rf mvt +RUN apt-get update \ + && apt-get install -y --no-install-recommends build-essential python3-dev libssl-dev \ + && uv pip install --system --break-system-packages --no-cache ./mvt "pymobiledevice3==${PYMOBILEDEVICE3_VERSION}" \ + && apt-get purge -y --auto-remove build-essential python3-dev libssl-dev \ + && rm -rf mvt /var/lib/apt/lists/* \ + && pymobiledevice3 --help > /dev/null \ + && pymobiledevice3 backup2 --help > /dev/null \ + && mvt-ios --help > /dev/null # Installing ABE ADD --checksum=sha256:a20e07f8b2ea47620aff0267f230c3f1f495f097081fd709eec51cf2a2e11632 \ diff --git a/Dockerfile.ios b/Dockerfile.ios index fccbe45b..90ef4e4c 100644 --- a/Dockerfile.ios +++ b/Dockerfile.ios @@ -1,110 +1,6 @@ -# Base image for building libraries -# --------------------------------- -FROM ubuntu:22.04 AS build-base - -ARG DEBIAN_FRONTEND=noninteractive - -# Install build tools and dependencies -RUN apt-get update \ - && apt-get install -y \ - build-essential \ - git \ - autoconf \ - automake \ - libtool-bin \ - pkg-config \ - libcurl4-openssl-dev \ - libusb-1.0-0-dev \ - libssl-dev \ - udev \ - && rm -rf /var/lib/apt/lists/* - - -# libplist -# -------- -FROM build-base AS build-libplist - -# Build -RUN git clone https://github.com/libimobiledevice/libplist && cd libplist \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libplist - - -# libimobiledevice-glue -# --------------------- -FROM build-base AS build-libimobiledevice-glue - -# Install dependencies -COPY --from=build-libplist /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libimobiledevice-glue && cd libimobiledevice-glue \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libimobiledevice-glue - - -# libtatsu -# -------- -FROM build-base AS build-libtatsu - -# Install dependencies -COPY --from=build-libplist /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libtatsu && cd libtatsu \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libtatsu - - -# libusbmuxd -# ---------- -FROM build-base AS build-libusbmuxd - -# Install dependencies -COPY --from=build-libplist /build / -COPY --from=build-libimobiledevice-glue /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libusbmuxd && cd libusbmuxd \ - && ./autogen.sh && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libusbmuxd - - -# libimobiledevice -# ---------------- -FROM build-base AS build-libimobiledevice - -# Install dependencies -COPY --from=build-libplist /build / -COPY --from=build-libtatsu /build / -COPY --from=build-libimobiledevice-glue /build / -COPY --from=build-libusbmuxd /build / - -# Build -RUN git clone https://github.com/libimobiledevice/libimobiledevice && cd libimobiledevice \ - && ./autogen.sh --enable-debug && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf libimobiledevice - - -# usbmuxd -# ------- -FROM build-base AS build-usbmuxd - -# Install dependencies -COPY --from=build-libplist /build / -COPY --from=build-libimobiledevice-glue /build / -COPY --from=build-libusbmuxd /build / -COPY --from=build-libimobiledevice /build / - -# Build -RUN git clone https://github.com/libimobiledevice/usbmuxd && cd usbmuxd \ - && ./autogen.sh --sysconfdir=/etc --localstatedir=/var --runstatedir=/run && make -j "$(nproc)" && make install DESTDIR=/build \ - && cd .. && rm -rf usbmuxd && mv /build/lib /build/usr/lib - - # Main image # ---------- -FROM python:3.10.14-alpine3.20 AS main +FROM ubuntu:24.04 AS main COPY --from=ghcr.io/astral-sh/uv:0.11.8 /uv /uvx /usr/local/bin/ LABEL org.opencontainers.image.url="https://mvt.re" @@ -113,26 +9,30 @@ LABEL org.opencontainers.image.source="https://github.com/mvt-project/mvt" LABEL org.opencontainers.image.title="Mobile Verification Toolkit (iOS)" LABEL org.opencontainers.image.description="MVT is a forensic tool to look for signs of infection in smartphone devices." LABEL org.opencontainers.image.licenses="MVT License 1.1" -LABEL org.opencontainers.image.base.name=docker.io/library/python:3.10.14-alpine3.20 +LABEL org.opencontainers.image.base.name=docker.io/library/ubuntu:24.04 # Install runtime dependencies -RUN apk add --no-cache \ - gcompat \ - libcurl \ +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + git \ libssl3 \ - libusb \ - sqlite -COPY --from=build-libplist /build / -COPY --from=build-libimobiledevice-glue /build / -COPY --from=build-libtatsu /build / -COPY --from=build-libusbmuxd /build / -COPY --from=build-libimobiledevice /build / -COPY --from=build-usbmuxd /build / + libusb-1.0-0 \ + python3 \ + sqlite3 \ + && rm -rf /var/lib/apt/lists/* -# Install mvt using the locally checked out source -COPY ./ mvt -RUN apk add --no-cache --virtual .build-deps git gcc musl-dev \ - && uv pip install --system --no-cache ./mvt \ - && apk del .build-deps git gcc musl-dev && rm -rf ./mvt +# Install MVT and pymobiledevice3. Native build dependencies are needed on ARM64. +ARG PYMOBILEDEVICE3_VERSION=11.12.4 +COPY . mvt/ +RUN apt-get update \ + && apt-get install -y --no-install-recommends build-essential python3-dev libssl-dev \ + && uv pip install --system --break-system-packages --no-cache ./mvt "pymobiledevice3==${PYMOBILEDEVICE3_VERSION}" \ + && apt-get purge -y --auto-remove build-essential python3-dev libssl-dev \ + && rm -rf mvt /var/lib/apt/lists/* \ + && pymobiledevice3 --help > /dev/null \ + && pymobiledevice3 backup2 --help > /dev/null \ + && mvt-ios --help > /dev/null ENTRYPOINT [ "/usr/local/bin/mvt-ios" ] diff --git a/docs/docker.md b/docs/docker.md index 9082b92b..10d9cd09 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,6 +1,6 @@ Using Docker simplifies running MVT with its dependencies readily installed. Note that this requires a Linux host, as Docker for Windows and Mac [doesn't support passing through USB devices](https://docs.docker.com/desktop/faqs/#can-i-pass-through-a-usb-device-to-a-container). -For iOS acquisition, we recommend [installing pymobiledevice3](ios/install.md) on the host and [creating a backup](ios/backup/pymobiledevice3.md) before analyzing it with MVT. The Docker images currently include libimobiledevice, not pymobiledevice3. +The main and iOS Docker images include pymobiledevice3 for [creating iOS backups](ios/backup/pymobiledevice3.md). You do not need to install it separately on the host. Older image tags may still include libimobiledevice instead; build from the updated source if pymobiledevice3 is unavailable. Install Docker following the [official documentation](https://docs.docker.com/get-docker/). @@ -39,12 +39,31 @@ If a prompt is spawned successfully, you can close it with `exit`. On the Linux host, install and start [usbmuxd](https://github.com/libimobiledevice/usbmuxd), then connect and unlock the iOS device. The daemon exposes the device through the `/var/run/usbmuxd` socket. -Bind that socket into the container to let MVT communicate with the device: +Bind that socket into the container to let pymobiledevice3 communicate with the device. Also mount a local directory so acquired backups persist after the container exits: ```bash -docker run -it \ +mkdir -p "$PWD/cases" +docker run --rm -it \ --mount type=bind,source=/var/run/usbmuxd,target=/var/run/usbmuxd \ + --mount type=bind,source="$PWD/cases",target=/home/cases \ ghcr.io/mvt-project/mvt ``` +Inside the container, verify connectivity: + +```bash +pymobiledevice3 lockdown info +``` + +Accept the trust prompt on the unlocked device if requested. Then follow the [backup instructions](ios/backup/pymobiledevice3.md), using a destination under `/home/cases`, such as `/home/cases/backup`. + +The iOS-only image defaults to running `mvt-ios`. To use pymobiledevice3 instead, override its entrypoint: + +```bash +docker run --rm -it \ + --mount type=bind,source=/var/run/usbmuxd,target=/var/run/usbmuxd \ + --entrypoint pymobiledevice3 \ + ghcr.io/mvt-project/mvt:latest-ios lockdown info +``` + If you built the image from source, replace `ghcr.io/mvt-project/mvt` with `mvt`.