Skip to content

watchOS: reach the Watch over a Wi-Fi RSD tunnel, forward service TLS contexts - #1

Open
JohnTenno wants to merge 1 commit into
oacevedo:feat/experimental-watchosfrom
JohnTenno:watchos-wifi-rsd
Open

JohnTenno wants to merge 1 commit into
oacevedo:feat/experimental-watchosfrom
JohnTenno:watchos-wifi-rsd

Conversation

@JohnTenno

Copy link
Copy Markdown

This builds on xtool-org#350 and adds a cable-free path to the Watch deployment helper, plus a compatibility fix for current pymobiledevice3. It targets your branch so it can land as part of xtool-org#350 if you want it.

What it does

  • watch_device.py --rsd HOST PORT reaches the paired iPhone through a RemoteXPC Wi-Fi tunnel (pymobiledevice3 remote start-tunnel -t wifi -p tcp) instead of USB usbmux. Without --rsd the USB path is unchanged.
  • Forwarded Watch services are opened over TCP inside the tunnel. The Watch pair record still supplies its SystemBUID, so a Watch that already trusts the host is reused as is.
  • create_service_connection accepts and forwards ssl_context / strip_ssl. pymobiledevice3 11.4x passes the TLS context there when a service enables SSL; without it, StreamingZipConduitService fails with TypeError: ... unexpected keyword argument 'ssl_context'.
  • Pins pymobiledevice3 11.45.1: TCP tunnels need it on Python 3.13+, and 11.45.1 fixes RemotePairing with srptools 2.0.

Why a tunnel

com.apple.companion_proxy is not usable over Wi-Fi lockdown (--mobdev2): the connection is dropped every time. Its RSD shim (com.apple.companion_proxy.shim.remote) does work inside a RemoteXPC tunnel, and the forwarded Watch lockdown port is reachable over TCP on the tunnel address.

The iPhone needs a RemotePairing record first. On iOS 27.2 the device-initiated flow (remote pair-host) never listed the Linux host under Settings > Developer, but creating the record over USB once works without any prompt:

pymobiledevice3 lockdown remotepairing --pair          # iPhone on USB, once
sudo pymobiledevice3 remote start-tunnel -t wifi -p tcp --udid <iPhone UDID> --script-mode
python3 watch_device.py --rsd <host> <port> --install App.app

Testing

Hardware, from Ubuntu 24.04 (Python 3.13, pymobiledevice3 11.45.1), iPhone unplugged:

  • Apple Watch Series 7, watchOS 26.6, arm64_32, paired with an iPhone on iOS 27.2, free Apple Account.
  • Watch trust via the USB path of Add experimental standalone watchOS builds, signing, and deployment probe xtool-org/xtool#350, then over Wi-Fi: device info, xtool dev sign-watch, and a developer install of a signed .app, verified in the Watch app registry. A full sign + install round trip takes about 20 s.
  • This branch's helper installed the app on the Watch over Wi-Fi.

Unit tests: python -m unittest test_watch_device passes (6 tests), including two new ones: the RSD path opens forwarded ports over TCP and never touches usbmux, and the service TLS context reaches the forwarded connection.

Known limits

  • The tunnel only comes up while the iPhone is unlocked. With the iPhone locked, start-tunnel reports "No tunnel services discovered".
  • Like the USB path, it requires exactly one Watch in the companion registry.
  • The tunnel needs root (TUN interface) and Python 3.13+.

…ntexts

- watch_device.py --rsd HOST PORT reaches the paired iPhone through a
  RemoteXPC tunnel (pymobiledevice3 remote start-tunnel -t wifi -p tcp)
  instead of USB. companion_proxy is not exposed over Wi-Fi lockdown, but
  its RSD shim works inside the tunnel, so no cable is needed once the
  iPhone has a RemotePairing record (lockdown remotepairing --pair, once
  over USB).
- Forwarded Watch services are opened over TCP inside the tunnel. The
  Watch pair record keeps supplying its SystemBUID, so an existing Watch
  trust is reused.
- create_service_connection accepts and forwards ssl_context/strip_ssl,
  which pymobiledevice3 11.4x passes when a service enables TLS; without
  it, StreamingZipConduitService fails with a TypeError.
- Pin pymobiledevice3 11.45.1 (TCP tunnels need Python 3.13+, and 11.45.1
  fixes RemotePairing with srptools 2.0).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant