A small, native-macOS client for GlobalProtect VPNs that authenticate with SAML
SSO (e.g. a Microsoft/Azure tenant). It avoids the official GlobalProtect app and
the GTK-based gpclient: login happens in a native WebKit window, and the
tunnel is brought up by openconnect.
Built and tested against vox.kent.ac.uk (University of Kent).
ssl-vpn/prelogin.esp→ returns the SAML sign-in URL.- A native WebKit window opens; you complete the Microsoft SSO login. The client
captures the
prelogin-cookiefrom the SAML ACS response headers. ssl-vpn/login.esp(with thejnlpReadyflag, which makes PAN-OS treat us as a real VPN client) exchanges that for the gateway authcookie.- The authcookie is handed to
openconnect --protocol=gp, which establishes the ESP tunnel.
git clone <this-repo> ~/.software/gpmac # or copy the folder
cd ~/.software/gpmac
./install.shinstall.sh installs Homebrew (if missing), openconnect, and uv, then builds
the Python virtualenv with the required pyobjc WebKit packages.
Run from a real terminal — it needs sudo (a TTY for the password prompt) for
openconnect, and a GUI session for the login window. It will not work from a
non-interactive/headless shell.
./gpmac vpn.example.edu # connect to your portal/gateway
./gpmac vpn.example.edu -v # verbose protocol/debug output
./gpmac vpn.example.edu --portal-config # also fetch portal policy (2nd login; rarely needed)The portal hostname is a required argument. To avoid typing it every time, set a default in your shell profile:
export GP_PORTAL=vpn.example.edu # then just run: ./gpmacPress Ctrl-C to disconnect; openconnect tears the tunnel down cleanly.
Put it on your PATH to run it as just gpmac from anywhere:
ln -s ~/.software/gpmac/gpmac "$(brew --prefix)/bin/gpmac"- macOS (uses the system WebKit framework)
- Homebrew ·
openconnect·uv - Python 3.10+ with
pyobjc-framework-Cocoaandpyobjc-framework-WebKit(installed automatically into the venv byinstall.sh)
route: ... Can't assign requested addressfor the tunnel's own IP — harmless; the real subnet routes still get added.Gateway says HIP report submission is needed— the gateway asks for a Host Information Profile report. If the portal doesn't enforce it (Kent doesn't), connectivity works fine. If some internal hosts are unreachable while others work, that's the time to look into a--csd-wrapperHIP script.- The portal phase (
--portal-config) requires a second SAML login and is not needed to bring up the tunnel, so it's off by default.