flextunnelguides

The iOS app

flextunnel's iOS app reaches private resources — hosts on a server's network by hostname, including names that only resolve there, the server's own localhost, or hosts by IP — without a VPN. It has two ways to use the tunnel: Browse the web, an in-app browser that sends each site through the server that routes it, and Forward ports, local ports that other apps on the device, such as SSH and RDP clients, connect to.

What you need

  • A running flextunnel server and its endpoint ID: a CLI server, or the desktop app's server role.
  • The public half of this app's auth key on that server's authorized keys. You make the key in the app (see Auth keys).
  • An iPhone or iPad on iOS 26 or later.
  • To install it: a Mac with Xcode, and an Apple developer team that can sign apps for your device (see Install).

Install

Each release on the releases page carries flextunnel-unsigned.ipa and SHA256SUMS.txt. You sign the IPA for your own Apple developer team before installing it. It contains two bundles, the app Flextunnel.app and its widget extension FlextunnelWidgets.appex, and each needs its own App ID and profile.

Before you start

  • macOS with Xcode installed.
  • A valid Apple Development certificate, with its private key, in the Keychain.
  • Separate iOS development profiles for the app's and the widget's bundle IDs. Both must include the signing certificate and your device.
  • Developer Mode turned on on the device, to install with devicectl.

Run every block below in the same Terminal session, so the variables carry over.

Sign and install the IPA

  1. Download and verify. Download flextunnel-unsigned.ipa and SHA256SUMS.txt from the same release, set the download folder, and check the IPA:

    Terminal
    DOWNLOAD_DIR="/absolute/path/to/downloads"
    
    (
      cd "$DOWNLOAD_DIR" || exit 1
      awk '$2 == "flextunnel-unsigned.ipa" { print }' SHA256SUMS.txt \
        | shasum -a 256 -c -
    )

    Go on only if it prints flextunnel-unsigned.ipa: OK.

  2. Choose bundle IDs. Register two explicit App IDs of your own, the widget's nested under the app's:

    Terminal
    APP_BUNDLE_ID="com.yourname.flextunnel"
    WIDGET_BUNDLE_ID="$APP_BUNDLE_ID.widgets"
  3. Pick the profiles and the identity. Create a development profile for each App ID. List your signing identities and copy the 40-character hash of the Apple Development one:

    Terminal
    security find-identity -v -p codesigning
    Terminal
    APP_PROFILE="/absolute/path/to/app.mobileprovision"
    WIDGET_PROFILE="/absolute/path/to/widget.mobileprovision"
    SIGNING_IDENTITY="0123456789ABCDEF0123456789ABCDEF01234567"

    Both profiles must list the device's hardware UDID, shown by xcrun devicectl device info details --device DEVICE_ID.

  4. Unpack the IPA and decode both profiles.

    Terminal
    SIGN_ROOT="$(mktemp -d /tmp/flextunnel-sign.XXXXXX)"
    UNSIGNED_IPA="$DOWNLOAD_DIR/flextunnel-unsigned.ipa"
    SIGNED_IPA="$DOWNLOAD_DIR/flextunnel-signed.ipa"
    APP_PATH="$SIGN_ROOT/Payload/Flextunnel.app"
    WIDGET_PATH="$APP_PATH/PlugIns/FlextunnelWidgets.appex"
    APP_PROFILE_PLIST="$SIGN_ROOT/app-profile.plist"
    WIDGET_PROFILE_PLIST="$SIGN_ROOT/widget-profile.plist"
    APP_ENTITLEMENTS="$SIGN_ROOT/app-entitlements.plist"
    WIDGET_ENTITLEMENTS="$SIGN_ROOT/widget-entitlements.plist"
    
    unzip -q "$UNSIGNED_IPA" -d "$SIGN_ROOT"
    test -d "$APP_PATH"
    test -d "$WIDGET_PATH"
    
    if codesign --display "$APP_PATH" >/dev/null 2>&1 \
      || codesign --display "$WIDGET_PATH" >/dev/null 2>&1; then
      echo "error: downloaded IPA is unexpectedly signed" >&2
      exit 1
    fi
    
    security cms -D -i "$APP_PROFILE" > "$APP_PROFILE_PLIST"
    security cms -D -i "$WIDGET_PROFILE" > "$WIDGET_PROFILE_PLIST"
  5. Check the profiles belong to the same team and match the bundle IDs exactly:

    Terminal
    APP_TEAM_ID="$(plutil -extract TeamIdentifier.0 raw -o - \
      "$APP_PROFILE_PLIST")"
    WIDGET_TEAM_ID="$(plutil -extract TeamIdentifier.0 raw -o - \
      "$WIDGET_PROFILE_PLIST")"
    APP_ID_PREFIX="$(plutil -extract ApplicationIdentifierPrefix.0 raw -o - \
      "$APP_PROFILE_PLIST")"
    WIDGET_ID_PREFIX="$(plutil -extract ApplicationIdentifierPrefix.0 raw -o - \
      "$WIDGET_PROFILE_PLIST")"
    PROFILE_APP_ID="$(plutil -extract Entitlements.application-identifier raw \
      -o - "$APP_PROFILE_PLIST")"
    PROFILE_WIDGET_ID="$(plutil -extract Entitlements.application-identifier raw \
      -o - "$WIDGET_PROFILE_PLIST")"
    
    [[ "$APP_TEAM_ID" == "$WIDGET_TEAM_ID" ]]
    [[ "$PROFILE_APP_ID" == "$APP_ID_PREFIX.$APP_BUNDLE_ID" ]]
    [[ "$PROFILE_WIDGET_ID" == \
      "$WIDGET_ID_PREFIX.$WIDGET_BUNDLE_ID" ]]
    
    plutil -extract ExpirationDate raw -o - "$APP_PROFILE_PLIST"
    plutil -extract ExpirationDate raw -o - "$WIDGET_PROFILE_PLIST"
    plutil -extract ProvisionedDevices xml1 -o - "$APP_PROFILE_PLIST"
    plutil -extract ProvisionedDevices xml1 -o - "$WIDGET_PROFILE_PLIST"
    
    plutil -extract Entitlements xml1 \
      -o "$APP_ENTITLEMENTS" "$APP_PROFILE_PLIST"
    plutil -extract Entitlements xml1 \
      -o "$WIDGET_ENTITLEMENTS" "$WIDGET_PROFILE_PLIST"
  6. Apply the bundle IDs, and check that the background location setting is still in place:

    Terminal
    plutil -replace CFBundleIdentifier -string "$APP_BUNDLE_ID" \
      "$APP_PATH/Info.plist"
    plutil -replace CFBundleIdentifier -string "$WIDGET_BUNDLE_ID" \
      "$WIDGET_PATH/Info.plist"
    
    [[ "$(plutil -extract UIBackgroundModes.0 raw -o - \
      "$APP_PATH/Info.plist")" == "location" ]]
    test -n "$(plutil -extract NSLocationWhenInUseUsageDescription raw -o - \
      "$APP_PATH/Info.plist")"
  7. Embed the profiles and sign, the widget first. Each bundle gets its own profile and that profile's entitlements:

    Terminal
    ditto --norsrc --noextattr --noqtn --noacl \
      "$WIDGET_PROFILE" "$WIDGET_PATH/embedded.mobileprovision"
    ditto --norsrc --noextattr --noqtn --noacl \
      "$APP_PROFILE" "$APP_PATH/embedded.mobileprovision"
    
    codesign --force \
      --sign "$SIGNING_IDENTITY" \
      --entitlements "$WIDGET_ENTITLEMENTS" \
      --generate-entitlement-der \
      --timestamp=none \
      "$WIDGET_PATH"
    
    codesign --force \
      --sign "$SIGNING_IDENTITY" \
      --entitlements "$APP_ENTITLEMENTS" \
      --generate-entitlement-der \
      --timestamp=none \
      "$APP_PATH"

    Don't use codesign --deep to sign: it can't pick the right profile for each bundle.

  8. Verify and repackage.

    Terminal
    codesign --verify --strict --verbose=4 "$WIDGET_PATH"
    codesign --verify --deep --strict --verbose=4 "$APP_PATH"
    
    codesign --display --verbose=4 --entitlements :- "$WIDGET_PATH"
    codesign --display --verbose=4 --entitlements :- "$APP_PATH"
    
    [[ "$(plutil -extract CFBundleIdentifier raw -o - \
      "$WIDGET_PATH/Info.plist")" == "$WIDGET_BUNDLE_ID" ]]
    [[ "$(plutil -extract CFBundleIdentifier raw -o - \
      "$APP_PATH/Info.plist")" == "$APP_BUNDLE_ID" ]]
    [[ "$(plutil -extract UIBackgroundModes.0 raw -o - \
      "$APP_PATH/Info.plist")" == "location" ]]
    
    ditto -c -k --keepParent \
      --norsrc --noextattr --noqtn --noacl \
      "$SIGN_ROOT/Payload" "$SIGNED_IPA"
    
    unzip -tq "$SIGNED_IPA"
    shasum -a 256 "$SIGNED_IPA"
  9. Install on the device.

    Terminal
    xcrun devicectl list devices
    
    DEVICE_ID="00000000-0000-0000-0000-000000000000"
    xcrun devicectl device install app \
      --device "$DEVICE_ID" \
      "$APP_PATH"

If the install fails, check that both profiles match their bundle IDs, contain the signing certificate and the device's UDID, belong to the same team, and haven't expired.

Auth keys

One auth key identifies this device to every destination. It is set under This device on the setup screen.

  1. Next to Auth key, tap Manage…. The Auth Keys screen opens.
  2. Tap +, then Generate New Key… and give it a name (for example this phone); or Enter Existing Key… to paste an ed25519-sec:… secret key made elsewhere.
  3. The checked key is the one the app uses; tap another key to switch. Your first key is checked for you.
  4. Back on the setup screen, the key's public key (ed25519-pub:…) is shown under Auth key. Copy it with the copy button and put it on each server's authorized keys.

Each key's ⋯ menu can export, rename or delete it. Deleting a key doesn't revoke it: take it off the server's authorized keys too.

Add destinations

A destination is one server, under a name you pick. One session reaches any number of them. On the setup screen, tap Add Destination:

FieldWhat goes in it
Name (under Server)One word of letters, digits and hyphens, for example nas. <name>.localhost.flextunnel.internal with a port is that port on the server itself.
Server node idThe server's endpoint ID (SERVER_ENDPOINT_ID).
Domains (under Also send through it)Optional, one rule per line: an exact name, *.suffix for its subdomains (for example *.corp.example), or * for every name.
IP rangesOptional, one per line, such as 10.0.0.0/8. IP ranges match IP-address targets only, never names.

Tap Save. Anything on no destination's list connects directly from the device. When rules overlap, the most specific one wins.

The setup screen: each destination with its server node id and a summary of what it routes.

Fetch from Server

To start from the server's own lists, tap Fetch from Server in the editor. It needs the node id and a key the server already authorizes, and replaces both rule fields; review them, then save. The server still enforces its own lists, so a route only chooses the server.

Fetch from Server filled the IP ranges with the server's own list; the destination still needs a name before Save.

Relays

Under This device, Relay URLs (comma-separated) and Relay auth token (custom relays only) are optional and apply to every destination; leave them blank for the default relays. Turn off Relays serve QUIC address discovery for relays behind a Cloudflare Tunnel or another HTTP-only front, where it can add a few seconds to each connection.

This device with a custom relay URL and Relays serve QUIC address discovery turned off.

Browse private sites

  1. Under Use it to, pick Browse the web.
  2. Tap Start Browsing. The browser opens. A destination's server is connected when something is first sent to it.
  3. Type an address in Search or enter address: a routed host by its usual name, such as wiki.corp.example, or http://nas.localhost.flextunnel.internal:8080 for port 8080 on the server itself.
A page on a private host, loaded through its destination in the in-app browser.

The site information button in the address bar shows where the page goes, such as Through nas or Direct (no destination routes it).

Tunnel status

The tunnel status button in the toolbar opens the Tunnel sheet: each destination's state and routes, Restart Session, and Disconnect, which returns to the setup screen.

The Tunnel sheet: each destination with what it reaches, its connection path and its server's status page.

Status pages

  • http://flextunnel.internal/ — the client's own page: its destinations and their state. Reading it connects nothing.
  • http://flextunnel.internal/servers/<name>/ — that destination server's page: its routed set and host aliases. Opening it connects the destination.
The client status page at flextunnel.internal: this client's listeners and its routing table.
A destination server's status page, opened from the Tunnel sheet.

Both pages were taken with flextunnel 0.0.115, as they show.

When a page fails

The error page says how the host was routed. A page that failed because its destination wasn't reachable reloads by itself once that destination connects.

A routed site whose server isn't connected: Try Again, or open Tunnel Status to see why.

How the browser routes

The browser sends its requests through a SOCKS5 proxy inside the app, which picks the destination for each one, or connects it directly. With hostname routes only, WebKit sends just the routed hosts to the proxy and every other host bypasses it. With an IP range or * among the routes, every page goes through the proxy, which still sends hosts on no route out directly.

Loopback IPs always bypass WebKit's proxy, so reach a server's loopback by its destination's <name>.localhost.flextunnel.internal, not by 127.0.0.1. The routes are fixed for a session: disconnect to change them.

Names only the server resolves

A hostname that only resolves on the server's network has to be on a destination's routes in the app and in that server's own routed set (routed_domains on a CLI server). Adding it in the app does not add it on the server.

Forward ports for other apps

In this mode the app runs the tunnel without a browser. Any other app on the device — an SSH client, an RDP viewer, a database app — can reach the localhost ports this app provides while it is running.

  1. Under Use it to, pick Forward ports. Decide on Keep alive in background now: it can't be changed during a session.
  2. Tap Start Port Forwarding. The Port Forwarding screen opens; starting connects nothing.
  3. Tap +. Under Local, enter a Local port (for example 2222); under Remote target, the Host or IP and its Port (for example nas.localhost.flextunnel.internal and 22). Tap Save.
  4. Switch the forward on, then point the other app at localhost:2222.

The remote host picks the destination by the same routes as the browser, and is resolved and dialed on the server. Each row says which destination carries it — via nas — or no route; a forward with no route can't be switched on.

Port Forwarding: one forward listening via its destination and in use, and one marked no route because no destination routes its host.

Forwards are saved across launches, but every fresh session starts with them all off. Nothing is exposed on the LAN.

What forwards suit

A forward is a raw TCP pipe: good for SSH, RDP, VNC and databases, poor for public websites behind a CDN, which may reject the 127.0.0.1 Host header. Use the in-app browser for websites.

In the background

The tunnel runs inside the app, so when iOS suspends the app, its tunnel and local ports stop serving other apps. Without the keep-alive, iOS gives the app about 30 seconds after you leave it; when you return, the session relaunches by itself and other apps must reconnect.

Keep alive in background

In Forward ports mode the setup screen has Keep alive in background, off by default. Turned on, it runs a coarse location session — nothing is stored or sent — that keeps iOS from suspending the app, so forwards stay reachable while you use other apps. Browser sessions never use it.

  • Turning it on asks for When In Use location access. Expect the location indicator and some extra battery use.
  • Time limit (5 minutes by default) counts inactivity: an open forward connection, moving, or the app being in front keeps it going. At the limit iOS suspends the app.

Forwarding sessions also show a Live Activity on the Lock Screen with the tunnel's state; it gives the app no background time.

Troubleshooting

What you seeWhat to do
A destination shows RefusedPut the key's public half on the server's authorized keys.
The sheet reads UnreachableCheck the destination's server is running and its node id is current, or tap Restart Session.
A destination never connects, though its server runs and its node id is currentThe app and the server may speak different protocols. Compare the version line at the bottom of the app's screens, such as core X.Y.Z · protocol N, with the server's flextunnel --version, and upgrade the end whose protocol is older.
A forward shows a red port N is in useAnother app holds that local port. Pick another port.
The other app connects, then drops at onceThe server rejected the target (it isn't in its routed set) or can't reach it. Its status page lists what it routes: Tunnel statusServer Status Page in a browser session.
Forwards are dead after returning to the appWait for the session to relaunch, then reconnect the other app, or turn on Keep alive in background.
A private site loads in the in-app browser but not in SafariSafari never uses the in-app proxy. Use the in-app browser, or a port forward.