stf icon indicating copy to clipboard operation
stf copied to clipboard

provide for iOS remove debug socat command

Open vdelendik opened this issue 3 years ago • 5 comments

we are going to share usbmuxd from device container outside (still TBD if we use proxy service or direct sharing after login) so this command should be displayed in Remote debug field.

socat UNIX-LISTEN:/var/run/usbmuxd,fork,reuseaddr,mode=777 TCP:host:port

vdelendik avatar Jul 30 '22 09:07 vdelendik

interesting roject to share usbmuxd outside: https://github.com/corellium/usbfluxd in case if socat is not so stable

vdelendik avatar Jul 30 '22 11:07 vdelendik

confirmed that socat can connect and reuse iOS device remotely but in scope of the ticket we need secured proxy using dynamic ports to start during device usage and stop after to avoid all kind of unexpected control at runtime

vdelendik avatar Aug 01 '22 15:08 vdelendik

https://github.com/DeviceFarmer/stf_ios_support/commit/a764970091335e16848440a682581a1ab9c54ed9

vdelendik avatar Jan 16 '23 22:01 vdelendik

  1. we have port range for every iOS device: declare -x STF_PROVIDER_MIN_PORT="7434" declare -x STF_PROVIDER_MAX_PORT="7440"

  2. some of them already used so proxy should be started using any free port from this range. In reality for iOS 7434 is busy and next one is available

  3. that's how this data is updated for Android: https://github.com/zebrunner/stf/blob/84703f0764eca8011ede0a2ae5569225e861db27/lib/units/device/plugins/remotedebug.js#L15

  4. that's how proxying is organized via db client: https://github.com/zebrunner/stf/blob/84703f0764eca8011ede0a2ae5569225e861db27/lib/units/device/support/adb.js#L11

  5. as of now let's put into the field as a hostname value from --host cli arg and as a port value from env var STF_PROVIDER_MIN_PORT + 1

vdelendik avatar Feb 15 '23 14:02 vdelendik

To summarize:

  1. Everytime we open ios device in stf we have to start socat listen on the dynamic port in between range. It should refer onto the usbmuxd websocket
  2. Stf should use stf_provider_hostname and this port to show socat connect command to be able to “connect” to device remotely
  3. Socat command should be stopped on stop using asap to avoid usage of the device outside of the control

above approach ideally applies on Linux agent where every device fully isolated and has it’s own usbmuxd. TBD what we should do for the mac because it will share all devices for this agent server…

vdelendik avatar Aug 17 '23 00:08 vdelendik