Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix(container): use tested Ubuntu 26.04 OBEX runtime and source gates

Hermes Agentbde544a122cf
diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml
index dcb27aa..2713c29 100644
--- a/.github/workflows/container.yml
+++ b/.github/workflows/container.yml
@@ -39,6 +39,18 @@ jobs:
--build-arg TETHER_VERSION="$(git describe --tags --always)" \
--target runtime -f packaging/container/Dockerfile -t tether-runtime:ci . \
2>&1 | tee "$RUNNER_TEMP/tether-runtime.log"
+ - name: Package gate and authenticated effective distro source evidence
+ shell: bash
+ run: |
+ docker run --rm --network none --entrypoint bash -v "$PWD:/src:ro" tether-runtime:ci \
+ /src/scripts/test-obex-package.sh 2>&1 | tee "$RUNNER_TEMP/tether-package.log"
+ version=$(docker run --rm --network none --entrypoint dpkg-query tether-runtime:ci -W -f='${Version}' bluez-obexd)
+ docker run --rm --platform '${{ matrix.platform }}' -v "$PWD:/src:ro" \
+ -e "EXPECTED_OBEX_VERSION=$version" ubuntu:26.04 bash -ec '
+ apt-get update
+ apt-get install -y --no-install-recommends python3
+ bash /src/scripts/test-obex-source-evidence.sh
+ ' 2>&1 | tee "$RUNNER_TEMP/tether-source.log"
- name: Smoke test without host hardware or services
shell: bash
run: |
diff --git a/packaging/container/Dockerfile b/packaging/container/Dockerfile
index 592e130..543a60f 100644
--- a/packaging/container/Dockerfile
+++ b/packaging/container/Dockerfile
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
-FROM ubuntu:24.04 AS build
+FROM ubuntu:26.04 AS build
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ cmake ninja-build git pkg-config ca-certificates \
libwayland-dev libavahi-client-dev libssl-dev libglib2.0-dev libsecret-1-dev \
@@ -27,12 +27,15 @@ ENV HOME=/test-home
USER 1000:1000
RUN ctest --output-on-failure -j 4
-FROM ubuntu:24.04 AS runtime
+FROM ubuntu:26.04 AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
bash coreutils tini dbus-daemon dbus-bin libglib2.0-bin bluez-obexd \
libwayland-client0 libavahi-client3 libssl3t64 libglib2.0-0t64 libsecret-1-0 libnotify4 \
&& rm -rf /var/lib/apt/lists/* \
- && mkdir -p /usr/local/libexec /data /downloads /run/tether-runtime \
+ && mkdir -p /usr/local/libexec /data /downloads /run/tether-runtime /run/systemd/users \
+ # Headless OBEX must use its built-in login-monitor failure fallback. Never
+ # import a host login session or fabricate an active user/seat in the image.
+ && chmod 700 /run/systemd \
&& obexd="$(dpkg -L bluez-obexd | grep '/obexd$')" \
&& test -x "$obexd" && "$obexd" --help | grep -q -- '--nodetach' \
&& ln -s "$obexd" /usr/local/libexec/tether-obexd \
diff --git a/scripts/test-obex-package.sh b/scripts/test-obex-package.sh
new file mode 100755
index 0000000..d7a11ab
--- /dev/null
+++ b/scripts/test-obex-package.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# Package boundary: reject distro OBEX releases predating the RX/TX MTU fix.
+set -euo pipefail
+version=$(dpkg-query -W -f='${Version}' bluez-obexd)
+printf 'bluez-obexd package version: %s\n' "$version"
+if ! dpkg --compare-versions "$version" ge 5.84; then
+ printf 'FAIL: bluez-obexd must be >= 5.84 (RX/TX MTU fix)\n' >&2
+ exit 42
+fi
+binary=$(dpkg -L bluez-obexd | grep '/obexd$')
+test -x "$binary"
+dpkg-query -S "$binary"
+"$binary" --help | grep -F -- '--nodetach'
+sha256sum "$binary"
+if [[ -L /usr/local/libexec/tether-obexd ]]; then
+ [[ $(readlink -f /usr/local/libexec/tether-obexd) == "$binary" ]]
+ test ! -e /usr/share/dbus-1/services/org.bluez.obex.service
+ [[ $(stat -c '%u:%a' /run/systemd) == '0:700' ]]
+ test ! -r /run/systemd
+ printf 'PASS: non-root headless runtime cannot inherit logind seats\n'
+fi
+printf 'PASS: packaged OBEX version and executable provenance\n'
diff --git a/scripts/test-obex-source-evidence.sh b/scripts/test-obex-source-evidence.sh
new file mode 100755
index 0000000..a6d32d8
--- /dev/null
+++ b/scripts/test-obex-source-evidence.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+# Run only inside a disposable Ubuntu container, never on the host.
+set -euo pipefail
+: "${EXPECTED_OBEX_VERSION:?Supply the tested runtime package version}"
+python3 - <<'PY'
+from pathlib import Path
+p = Path('/etc/apt/sources.list.d/ubuntu.sources')
+p.write_text(p.read_text().replace('Types: deb\n', 'Types: deb deb-src\n'))
+PY
+apt-get update
+apt-get install -y --no-install-recommends dpkg-dev ca-certificates
+mkdir -p /evidence
+cd /evidence
+apt-get source "bluez=$EXPECTED_OBEX_VERSION"
+source_dir=$(printf '%s\n' bluez-*/)
+[[ $(dpkg-parsechangelog -l "$source_dir/debian/changelog" -S Version) == "$EXPECTED_OBEX_VERSION" ]]
+[[ $EXPECTED_OBEX_VERSION == 5.85-* ]]
+printf 'Authenticated Ubuntu source version: %s\n' "$EXPECTED_OBEX_VERSION"
+printf 'Applied distro patches:\n'
+cat "$source_dir/debian/patches/series"
+python3 /src/scripts/test-obex-source.py "$source_dir/obexd/src/obex.c"
+# A real-source mutation must fail for the intended assertion, not setup errors.
+sed 's/g_obex_new(io, type, rx_mtu, tx_mtu)/g_obex_new(io, type, tx_mtu, rx_mtu)/' \
+ "$source_dir/obexd/src/obex.c" > reversed-obex.c
+set +e
+python3 /src/scripts/test-obex-source.py reversed-obex.c > mutation.log 2>&1
+status=$?
+set -e
+[[ $status == 1 ]]
+grep -F 'RX/TX MTU ordering regression' mutation.log
+printf 'PASS: source gate rejects reversed asymmetric RX/TX MTUs\n'
diff --git a/scripts/test-obex-source.py b/scripts/test-obex-source.py
new file mode 100755
index 0000000..cde02d6
--- /dev/null
+++ b/scripts/test-obex-source.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+"""Check the effective, distro-patched source's asymmetric MTU contract."""
+import hashlib
+import pathlib
+import re
+import sys
+
+source = pathlib.Path(sys.argv[1])
+text = source.read_text()
+# Public entry accepts TX first, RX second; GObex's constructor accepts RX first.
+assert re.search(r"int\s+obex_session_start\(GIOChannel\s*\*io,\s*uint16_t\s+tx_mtu,\s*uint16_t\s+rx_mtu,", text), "unexpected session MTU signature"
+start = text.index("int obex_session_start(")
+body = text[start:text.index("\n}\n", start)]
+assert re.search(r"g_obex_new\(io,\s*type,\s*rx_mtu,\s*tx_mtu\)", body), "RX/TX MTU ordering regression"
+assert not re.search(r"g_obex_new\(io,\s*type,\s*tx_mtu,\s*rx_mtu\)", body), "reversed MTUs"
+print(f"source SHA256: {hashlib.sha256(source.read_bytes()).hexdigest()} {source}")
+print("PASS: effective distro source retains g_obex_new(io, type, rx_mtu, tx_mtu)")