Skip to content

Enforce PIA split tunnel config via settings.json watchdog #61

@smartwatermelon

Description

@smartwatermelon

Problem

PIA frequently "forgets" its split tunnel configuration (unchecks the checkbox in the GUI). When this happens with the Stage 1 inversion architecture, all traffic goes through VPN — including Plex, which becomes unusable through a multi-hop overseas VPN connection.

The Stage 1 inversion makes this safe (no IP leak), but it causes a functional outage for Plex until someone notices and re-checks the box.

Discovery

PIA stores its full config in plain JSON at:

/Library/Preferences/com.privateinternetaccess.vpn/settings.json

Root-owned, world-readable. Key fields:

{
  "splitTunnelEnabled": true,
  "splitTunnelRules": [
    {"mode": "exclude", "path": "/Applications/Plex Media Server.app"},
    {"mode": "exclude", "path": "/Applications/Backblaze.app"},
    {"mode": "exclude", "path": "/Applications/No-IP DUC.app"},
    {"mode": "exclude", "path": "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app"}
  ],
  "bypassSubnets": [{"mode": "exclude", "subnet": "10.0.15.0/24"}],
  "killswitch": "on"
}

Notably, the file showed splitTunnelEnabled: true even when the GUI checkbox appeared unchecked — PIA's GUI state and config file may desync.

Proposed Solution

A watchdog script (LaunchAgent or addition to vpn-monitor.sh) that:

  1. Periodically reads settings.json
  2. If splitTunnelEnabled is false or bypass rules are missing, rewrites the correct values
  3. Restarts the PIA daemon to pick up the change

Open Questions

  • How to restart PIA from CLI? (piactl? kill the daemon? launchctl?)
  • Does PIA re-read settings.json on its own, or does it need a restart?
  • Does PIA overwrite settings.json on quit (stomping our changes)?
  • Should this be a standalone script or integrated into vpn-monitor.sh?
  • What's the right polling interval? (less frequent than VPN monitor — maybe 60s)

Files

File Contents
/Library/Preferences/com.privateinternetaccess.vpn/settings.json Full PIA config (split tunnel, kill switch, protocol, etc.)
/Library/Preferences/com.privateinternetaccess.vpn/data.json PIA state data (~190KB)
/Library/Preferences/com.privateinternetaccess.vpn/account.json Account info (root-only readable)
~/Library/Preferences/com.privateinternetaccess.vpn/clientsettings.json Per-user client settings

Context

  • Part of the VPN protection system (see docs/vpn-transmission.md)
  • Stage 1 (PIA inversion) makes forgetting safe but causes Plex outage
  • Stage 2 (vpn-monitor) handles VPN drops but not PIA config resets
  • This would be a "Stage 1.5" — enforcing the PIA config that Stage 1 depends on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions