Compare commits

..
Author SHA1 Message Date
github-actions[bot] bc0ac5a576 test: prepare snapshot flake for release/next 2026-11-20 18:27:33 +00:00
Kevin Yue cd0c5d805b Provide the D-Bus typelib to the NixOS accessibility test
Atspi depends on DBus-1.0, which GObject Introspection installs outside the GLib and Atspi output paths.
2026-11-21 01:43:27 +08:00
Kevin Yue 0787a5a463 Include PyGObject in the NixOS desktop test environment
The test successfully opened Settings through GTK but pyatspi could not import gi. Include the Python binding and GLib typelibs, check imports before launch, and bound the accessibility wait.
2026-11-21 01:06:51 +08:00
Kevin Yue 5d4149dff0 Open Native Shell Settings through its GTK action in NixOS tests
The offline interface test timed out before exercising the switch because its synthetic X11 shortcut did not open Settings. Activate the registered Settings action in the desktop session and keep the UI checks for the switch and relaunch.
2026-11-21 00:13:08 +08:00
Kevin Yue 731fcd0a42 Remove redundant Native Shell launcher test
The Linux upgrade test exercises the real launcher with an outdated Native Shell and a compatible Tauri binary. Keep that coverage and remove the unit fixture that rewrites its executable between version probes.
2026-11-20 22:30:08 +08:00
Kevin Yue a926226546 Align webview authentication features across client builds 2026-11-20 22:15:34 +08:00
Kevin Yue d81b1dc3ec Prefer Native Shell on supported Linux installations 2026-11-20 22:00:51 +08:00
11 changed files with 187 additions and 366 deletions

No files matched your search

Generated
+13 -13
View File
@@ -292,7 +292,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]] [[package]]
name = "auth" name = "auth"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"block2", "block2",
@@ -554,7 +554,7 @@ dependencies = [
[[package]] [[package]]
name = "browser-launcher" name = "browser-launcher"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"log", "log",
@@ -919,7 +919,7 @@ dependencies = [
[[package]] [[package]]
name = "common" name = "common"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"tempfile", "tempfile",
] ]
@@ -2133,7 +2133,7 @@ dependencies = [
[[package]] [[package]]
name = "gp-xml" name = "gp-xml"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"url", "url",
"xmltree", "xmltree",
@@ -2141,7 +2141,7 @@ dependencies = [
[[package]] [[package]]
name = "gpapi" name = "gpapi"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.23.1", "base64 0.23.1",
@@ -2205,7 +2205,7 @@ dependencies = [
[[package]] [[package]]
name = "gpauth" name = "gpauth"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"auth", "auth",
@@ -2223,7 +2223,7 @@ dependencies = [
[[package]] [[package]]
name = "gpclient" name = "gpclient"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@@ -2254,7 +2254,7 @@ dependencies = [
[[package]] [[package]]
name = "gpgui-helper" name = "gpgui-helper"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@@ -2275,7 +2275,7 @@ dependencies = [
[[package]] [[package]]
name = "gphip" name = "gphip"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"askama", "askama",
@@ -2294,7 +2294,7 @@ dependencies = [
[[package]] [[package]]
name = "gpservice" name = "gpservice"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
@@ -2332,7 +2332,7 @@ dependencies = [
[[package]] [[package]]
name = "gptunnel" name = "gptunnel"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"gpapi", "gpapi",
"log", "log",
@@ -2344,7 +2344,7 @@ dependencies = [
[[package]] [[package]]
name = "gpvpnc" name = "gpvpnc"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"base64 0.23.1", "base64 0.23.1",
"ipnet", "ipnet",
@@ -3860,7 +3860,7 @@ dependencies = [
[[package]] [[package]]
name = "openconnect" name = "openconnect"
version = "3.7.1" version = "3.6.0"
dependencies = [ dependencies = [
"autotools", "autotools",
"cc", "cc",
+1 -1
View File
@@ -11,7 +11,7 @@ members = [
[workspace.package] [workspace.package]
rust-version = "1.91" rust-version = "1.91"
version = "3.7.1" version = "3.6.0"
authors = ["Kevin Yue <[email protected]>"] authors = ["Kevin Yue <[email protected]>"]
homepage = "https://github.com/yuezk/GlobalProtect-openconnect" homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
edition = "2024" edition = "2024"
+146 -131
View File
@@ -1,14 +1,8 @@
# GlobalProtect-openconnect # GlobalProtect-openconnect
**GP Connect** is a GlobalProtect VPN client built on OpenConnect. The desktop app runs on Windows, macOS, Linux, FreeBSD, and OpenBSD. The command-line client is `gpclient`. A GlobalProtect VPN client built on OpenConnect. GP Connect runs on Windows, macOS, Linux, FreeBSD, and OpenBSD.
<p align="center"> > **Disclaimer**: GP Connect is an independent third-party client for GlobalProtect VPN networks. It is not affiliated with or endorsed by Palo Alto Networks, Inc.
<a href="#features">Features</a> ·
<a href="#installation">Installation</a> ·
<a href="#usage">Usage</a> ·
<a href="#troubleshooting">Troubleshooting</a> ·
<a href="#building-from-source">Building from source</a>
</p>
<p align="center"> <p align="center">
<picture> <picture>
@@ -18,71 +12,111 @@
</picture> </picture>
</p> </p>
GP Connect is an independent project. It is not affiliated with or endorsed by Palo Alto Networks, Inc. > **Inspired by** [gp-saml-gui](https://github.com/dlenski/gp-saml-gui)
## Table of Contents
- [Features](#features)
- [Usage](#usage)
- [Command-Line Interface](#command-line-interface)
- [Graphical User Interface](#graphical-user-interface)
- [Installation](#installation)
- [Windows](#windows)
- [macOS](#macos)
- [Debian / Ubuntu](#debian--ubuntu)
- [Arch Linux / Manjaro](#arch-linux--manjaro)
- [Fedora / RHEL](#fedora--rhel)
- [openSUSE](#opensuse)
- [Alpine Linux](#alpine-linux)
- [FreeBSD](#freebsd)
- [OpenBSD](#openbsd)
- [Gentoo](#gentoo)
- [NixOS](#nixos)
- [Docker](#docker)
- [Other Distributions](#other-distributions)
- [Building from Source](#building-from-source)
- [Troubleshooting](#troubleshooting)
- [NetworkManager Integration](#networkmanager-integration)
- [Licensing](#licensing)
## Features ## Features
- Browser-based SSO and MFA, including security keys supported by the identity provider. Client certificates are also supported. - **Multi-Platform** – Windows (x64 and ARM64), macOS (Apple silicon), Linux, FreeBSD, and OpenBSD
- System VPN tunnel or local SOCKS5 and HTTP proxies for individual applications. - **Dual Interfaces** – Desktop GUI (**GP Connect**) and terminal CLI (`gpclient`, on macOS, Linux, and BSD)
- Multiple saved portals and direct gateway connections. - **Native Shell on Linux** – Ultra-low-memory native desktop GUI alongside the webview interface
- Built-in host information profile (HIP) reporting and support for custom HIP scripts. - **Flexible Routing** – Full System VPN tunnel or local SOCKS5 proxy mode
- System tray controls and automatic connection on launch. - **Modern Authentication** – SAML / SSO, MFA, FIDO2 (YubiKey), client certificates, and external browser login
- Native Shell, a lightweight desktop interface for supported Linux systems. - **Automated HIP Reports** – Built-in HIP report generation or custom scripts
- **Multi-Portal & Direct Gateway** – Manage multiple saved portals or connect directly to a gateway
- **Desktop Integration** – Theme-aware system tray icon, auto-connect on launch, and reconnect on wake
## Usage
### Command-Line Interface
On macOS, Linux, and BSD, the open-source `gpclient` CLI handles authentication, connection lifecycle, and HIP generation:
```bash
# Connect to a portal server
sudo gpclient connect <portal>
# Connect using browser authentication (SSO / SAML)
sudo gpclient connect <portal> --browser
# Connect directly to a gateway server
sudo gpclient connect <gateway> --as-gateway
# Connect with automatic HIP report generation
sudo gpclient connect <portal> --hip
# Headless / remote server authentication (prints auth URL to open in any browser)
sudo gpclient connect <portal> --browser manual
# Disconnect
sudo gpclient disconnect
```
Run `gpclient --help` or `gpclient <command> --help` to view all available commands and options.
### Graphical User Interface
- **Windows**: Open **GP Connect** from the Start menu.
- **macOS**: Open **GP Connect** from Applications.
- **Linux / BSD**: Launch GP Connect from your application menu or run:
```bash
gpclient launch-gui
```
> [!TIP]
> On Linux, GP Connect uses Native Shell when your system supports it. Your saved interface choice takes priority. Switch while disconnected in **Settings → General → Interface**.
>
> If the window stays blank, fully quit GP Connect and run `gpclient launch-gui --interface tauri`. To select Native Shell, use `--interface nsh`. The choice is saved when the interface starts.
## Installation ## Installation
| Platform | Installation instructions |
| --- | --- |
| Windows and macOS | [Windows](#windows) · [macOS](#macos) |
| Linux | [Alpine](#alpine-linux) · [Arch / Manjaro](#arch-linux--manjaro) · [Debian / Ubuntu](#debian--ubuntu) · [Fedora / RHEL](#fedora--rhel) · [Gentoo](#gentoo) · [NixOS](#nixos) · [openSUSE](#opensuse) · [Other distributions](#other-distributions) |
| BSD | [FreeBSD](#freebsd) · [OpenBSD](#openbsd) |
| Container | [Docker](#docker) |
### Windows ### Windows
Download the Windows installer for [x64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/GPConnect_3.7.0_windows-x64-setup.exe) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/GPConnect_3.7.0_windows-arm64-setup.exe). Run it and approve the administrator prompt. 1. Download the **x64** or **ARM64** installer for your PC from [GitHub Releases](https://github.com/yuezk/GlobalProtect-openconnect/releases/latest).
2. Run the installer and approve the administrator prompt.
3. Open **GP Connect** from the Start menu.
### macOS ### macOS
Requires Apple silicon and macOS 13+. Requires Apple silicon and macOS 13+. Includes both GP Connect and the `gpclient` CLI.
#### Homebrew #### Option 1: Homebrew (Recommended)
```bash ```bash
brew install --cask yuezk/gp-connect/gp-connect brew install --cask yuezk/gp-connect/gp-connect
``` ```
#### DMG installer #### Option 2: DMG Installer
Open the [Apple silicon DMG](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/GPConnect_3.7.0_arm64.dmg) and drag GP Connect into Applications. Download the `.dmg` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page and drag GP Connect into Applications.
### Alpine Linux
Download the APK for [x86_64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-r1-x86_64.apk) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-r1-aarch64.apk).
```bash
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
```
Enable the Alpine `community` repository for WebKitGTK.
### Arch Linux / Manjaro
Install the stable package from the Extra repository.
```bash
sudo pacman -S globalprotect-openconnect
```
For the development version from the main branch, use the AUR package.
```bash
yay -S globalprotect-openconnect-git
```
### Debian / Ubuntu ### Debian / Ubuntu
#### Ubuntu PPA #### Option 1: PPA (Recommended)
```bash ```bash
sudo add-apt-repository ppa:yuezk/globalprotect-openconnect sudo add-apt-repository ppa:yuezk/globalprotect-openconnect
@@ -90,14 +124,24 @@ sudo apt-get update
sudo apt-get install globalprotect-openconnect sudo apt-get install globalprotect-openconnect
``` ```
#### Debian or Ubuntu release package #### Option 2: DEB Package
Download the DEB for [amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0-1_amd64.deb) or [arm64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0-1_arm64.deb). Download the latest `.deb` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
```bash ```bash
sudo apt install ./globalprotect-openconnect_*.deb sudo apt install ./globalprotect-openconnect_*.deb
``` ```
### Arch Linux / Manjaro
```bash
# Official Extra repository
sudo pacman -S globalprotect-openconnect
# AUR (git main)
yay -S globalprotect-openconnect-git
```
### Fedora / RHEL ### Fedora / RHEL
Enable the COPR repository: Enable the COPR repository:
@@ -107,6 +151,36 @@ sudo dnf copr enable yuezk/globalprotect-openconnect
sudo dnf install globalprotect-openconnect sudo dnf install globalprotect-openconnect
``` ```
### openSUSE
Packages are available on the [openSUSE Build Service](https://build.opensuse.org/package/show/home:yuezk/globalprotect-openconnect). Follow the [OBS instructions](https://software.opensuse.org/download.html?project=home%3Ayuezk&package=globalprotect-openconnect) for your distribution.
### Alpine Linux
Download the latest `.apk` package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
```bash
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
```
*(Requires the `community` repository for WebKitGTK dependencies).*
### FreeBSD
Download the latest FreeBSD package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
```bash
sudo pkg install ./globalprotect-openconnect-*-freebsd-*.pkg
```
### OpenBSD
Download the latest OpenBSD package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
```bash
doas pkg_add -D unsigned ./globalprotect-openconnect-*-openbsd-*.tgz
```
### Gentoo ### Gentoo
Add the overlay: Add the overlay:
@@ -117,15 +191,13 @@ sudo eselect repository add yuezk git https://github.com/yuezk/gentoo-overlay.gi
sudo emerge --sync yuezk sudo emerge --sync yuezk
``` ```
On glibc systems, install the prebuilt package: Install the prebuilt package (glibc):
```bash ```bash
sudo emerge --ask net-vpn/globalprotect-openconnect-bin::yuezk sudo emerge --ask net-vpn/globalprotect-openconnect-bin::yuezk
``` ```
The source package is `net-vpn/globalprotect-openconnect::yuezk`. For a headless installation, see the [CLI-only overlay instructions](https://github.com/yuezk/gentoo-overlay#cli-only). For a source build, use `net-vpn/globalprotect-openconnect::yuezk`. If Portage requests keyword or USE flag changes, review and apply them, then rerun the install command.
If Portage requests keyword or USE flag changes, review and apply them, then rerun the install command.
### NixOS ### NixOS
@@ -154,96 +226,38 @@ Apply changes:
sudo nixos-rebuild switch sudo nixos-rebuild switch
``` ```
### openSUSE
Packages are available on the [openSUSE Build Service](https://build.opensuse.org/package/show/home:yuezk/globalprotect-openconnect). Follow the [OBS instructions](https://software.opensuse.org/download.html?project=home%3Ayuezk&package=globalprotect-openconnect) for your distribution.
### Other Distributions
Download the archive for [x86_64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0_x86_64.bin.tar.xz) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0_aarch64.bin.tar.xz).
```bash
tar -xJf globalprotect-openconnect_*.bin.tar.xz
cd globalprotect-openconnect_3.7.0
sudo make install
```
### FreeBSD
Download the [FreeBSD package for amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-freebsd-amd64.pkg).
```bash
sudo pkg install ./globalprotect-openconnect-*-freebsd-*.pkg
```
### OpenBSD
Download the [OpenBSD package for amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-openbsd-amd64.tgz).
```bash
doas pkg_add -D unsigned ./globalprotect-openconnect-*-openbsd-*.tgz
```
### Docker ### Docker
Run the CLI in the project’s Alpine container. Replace `vpn.example.com` with your portal address. Run the CLI client in an official Alpine container:
```bash ```bash
docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \ docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \
yuezk/globalprotect-openconnect:latest \ yuezk/globalprotect-openconnect:latest \
connect vpn.example.com --browser manual connect <portal> --browser manual
``` ```
On Linux, add `--network host` to apply VPN routes to the host network. *(Add `--network host` on Linux if VPN routes should apply to the host network).*
## Usage ### Other Distributions
### Desktop Download `globalprotect-openconnect_${version}_${arch}.bin.tar.xz` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
Open **GP Connect**, enter your GlobalProtect portal address, and sign in. On Linux and BSD, you can also launch the app with `gpclient launch-gui`. ```bash
tar -xJf globalprotect-openconnect_*.bin.tar.xz
### Command line cd globalprotect-openconnect_*
sudo make install
On Linux, BSD, or macOS with Homebrew, replace `vpn.example.com` with your portal address. Use `doas` instead of `sudo` on OpenBSD.
```sh
sudo gpclient connect vpn.example.com
``` ```
| Command | Action |
| --- | --- |
| `sudo gpclient disconnect` | Disconnect |
| `sudo gpclient connect vpn.example.com --browser` | Sign in with a browser |
| `sudo gpclient connect gateway.example.com --as-gateway` | Connect directly to a gateway |
| `sudo gpclient connect vpn.example.com --hip` | Connect with HIP reporting enabled |
See `gpclient connect --help` for all connection options.
### Connecting over SSH
For portals that allow external-browser sign-in, run this command on the remote host:
```sh
sudo gpclient connect vpn.example.com --browser manual
```
Open the printed URL in a browser that can reach the remote host. After signing in, paste the callback URL into the SSH terminal.
## Troubleshooting
- **Blank Linux window.** Quit GP Connect and run `gpclient launch-gui --interface tauri`. To switch back, quit and rerun with `--interface nsh`.
- **Reporting a problem.** Run `gpclient diagnostics` and include the relevant output in your issue. See the [diagnostics guide](docs/diagnostics.md) for details.
## Building from Source ## Building from Source
### Prerequisites (Linux) ### Prerequisites (Linux)
- [Rust](https://www.rust-lang.org/tools/install) 1.91 or later - [Rust](https://www.rust-lang.org/tools/install) 1.91 or later
- Build tools: `make`, `pkg-config`, `autoconf`, `automake`, `libtool`, `gettext` - Build tools: `make`, `pkg-config`, `autoconf`, `automake`, `libtool`, `gettext`
- Libraries: `gmp`, `gnutls`, `nettle`, `libxml2`, `zlib`, `lz4`, `p11-kit`, `libsecret`, and `webkit2gtk-4.1` for the embedded sign-in window and download helper. Native Shell also requires GTK 4.14 or later. - Libraries: `gmp`, `gnutls`, `nettle`, `libxml2`, `zlib`, `lz4`, `p11-kit`, `libsecret`, and `webkit2gtk-4.1` for the embedded sign-in window and download helper. Native Shell also requires GTK 4.14 or later. The generic glibc build requires glibc 2.39 or later
- Polkit (`pkexec`) for privileged tunnel setup - Polkit (`pkexec`) for privileged tunnel setup
For BSD build requirements, see [Building from Source on FreeBSD and OpenBSD](docs/bsd-source-build.md). *(For FreeBSD and OpenBSD instructions, see [Building from Source on FreeBSD and OpenBSD](docs/bsd-source-build.md)).*
### Build Steps ### Build Steps
@@ -260,6 +274,11 @@ sudo make install
- `BUILD_WEBVIEW_AUTH=0` – Disable embedded browser authentication in both `gpclient` and `gpauth`. External-browser and manual sign-in remain available. - `BUILD_WEBVIEW_AUTH=0` – Disable embedded browser authentication in both `gpclient` and `gpauth`. External-browser and manual sign-in remain available.
- `BUILD_GUI_HELPER=0` – Skip building the helper UI. - `BUILD_GUI_HELPER=0` – Skip building the helper UI.
## Troubleshooting
- **Headless / Remote Login**: When running without a desktop display or over SSH, use `--browser manual`. Open the printed URL in any browser and paste the callback URL back into the terminal.
- **Diagnostics**: If you encounter issues, run `gpclient diagnostics` or follow the [diagnostics guide](docs/diagnostics.md) when opening an issue.
## NetworkManager Integration ## NetworkManager Integration
- [WMP/GlobalProtect-SAML-NetworkManager](https://github.com/WMP/GlobalProtect-SAML-NetworkManager) – NetworkManager VPN plugin with SAML/SSO support for GNOME and KDE Plasma - [WMP/GlobalProtect-SAML-NetworkManager](https://github.com/WMP/GlobalProtect-SAML-NetworkManager) – NetworkManager VPN plugin with SAML/SSO support for GNOME and KDE Plasma
@@ -284,7 +303,3 @@ sudo make install
| [gpclient](./apps/gpclient) | Application | [GPL-3.0](./apps/gpclient/LICENSE) | | [gpclient](./apps/gpclient) | Application | [GPL-3.0](./apps/gpclient/LICENSE) |
| [gpauth](./apps/gpauth) | Application | [GPL-3.0](./apps/gpauth/LICENSE) | | [gpauth](./apps/gpauth) | Application | [GPL-3.0](./apps/gpauth/LICENSE) |
| [gpgui-helper](./apps/gpgui-helper) | Application | [GPL-3.0](./apps/gpgui-helper/LICENSE) | | [gpgui-helper](./apps/gpgui-helper) | Application | [GPL-3.0](./apps/gpgui-helper/LICENSE) |
## Acknowledgments
Inspired by [gp-saml-gui](https://github.com/dlenski/gp-saml-gui).
+1 -4
View File
@@ -325,10 +325,7 @@ async fn wait_for_brokered_idle(
_ = interval.tick() => {}, _ = interval.tick() => {},
} }
let idle = matches!( let idle = matches!(*vpn_state_rx.borrow(), VpnState::Disconnected | VpnState::Failed(_)) && registry.is_empty();
*vpn_state_rx.borrow(),
VpnState::Disconnected | VpnState::UnexpectedDisconnect { .. } | VpnState::Failed(_)
) && registry.is_empty();
if !idle { if !idle {
idle_since = None; idle_since = None;
continue; continue;
-7
View File
@@ -174,12 +174,6 @@ impl RequestDispatcher {
.stop_non_tunnel_attachment(authority.session_id, authority.generation, connection_id)?; .stop_non_tunnel_attachment(authority.session_id, authority.generation, connection_id)?;
Ok(PendingDispatch::Drain(drain)) Ok(PendingDispatch::Drain(drain))
} }
WsRequest::AbandonReconnect { attempt } => {
let authority = authority
.ok_or_else(|| ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Connection session is missing"))?;
self.lifecycle.abandon_reconnect(attempt, authority.session_id);
Err(ServiceResult::Accepted)
}
WsRequest::Disconnect(_) => Err(self.lifecycle.request_disconnect()), WsRequest::Disconnect(_) => Err(self.lifecycle.request_disconnect()),
request => Ok(PendingDispatch::Other(request)), request => Ok(PendingDispatch::Other(request)),
} }
@@ -265,7 +259,6 @@ impl RequestDispatcher {
ServiceResult::Accepted ServiceResult::Accepted
} }
WsRequest::Connect(_) WsRequest::Connect(_)
| WsRequest::AbandonReconnect { .. }
| WsRequest::StopNonTunnelAttachment { .. } | WsRequest::StopNonTunnelAttachment { .. }
| WsRequest::Disconnect(_) | WsRequest::Disconnect(_)
| WsRequest::StoreEditedHipReportChunk(_) | WsRequest::StoreEditedHipReportChunk(_)
+16 -180
View File
@@ -76,7 +76,6 @@ impl LifecycleHandle {
let cancellation = CancellationToken::new(); let cancellation = CancellationToken::new();
admissions.current = Some(Admission { admissions.current = Some(Admission {
attempt, attempt,
restart,
phase: AdmissionPhase::Preparing, phase: AdmissionPhase::Preparing,
stop_requested: false, stop_requested: false,
cancellation: cancellation.clone(), cancellation: cancellation.clone(),
@@ -90,19 +89,6 @@ impl LifecycleHandle {
}) })
} }
pub fn abandon_reconnect(&self, attempt: u64, owner: Uuid) {
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
// A replacement that already owns admission will publish its own outcome.
if admissions.restart == Some((attempt, owner)) {
admissions.restart = None;
self.state.send_replace(VpnState::UnexpectedDisconnect {
attempt,
owner,
reason: None,
});
}
}
#[cfg(test)] #[cfg(test)]
fn submit_test_connection( fn submit_test_connection(
&self, &self,
@@ -231,7 +217,7 @@ impl LifecycleHandle {
true true
} }
fn clear_attempt(&self, attempt: u64, state: Option<VpnState>) { fn clear_attempt(&self, attempt: u64) {
let completion = { let completion = {
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned"); let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
let Some(admission) = admissions.current.as_ref() else { let Some(admission) = admissions.current.as_ref() else {
@@ -240,20 +226,6 @@ impl LifecycleHandle {
if admission.attempt != attempt { if admission.attempt != attempt {
return; return;
} }
let state = match admission.restart {
Some((attempt, owner)) if !admission.stop_requested && !admissions.closed => {
let reason = match state {
Some(VpnState::Failed(reason)) => Some(reason),
_ => None,
};
Some(VpnState::UnexpectedDisconnect { attempt, owner, reason })
}
Some(_) if state.is_none() => Some(VpnState::Disconnected),
_ => state,
};
if let Some(state) = state {
self.state.send_replace(state);
}
let completion = Arc::clone(&admission.completion); let completion = Arc::clone(&admission.completion);
admissions.current = None; admissions.current = None;
completion completion
@@ -385,7 +357,7 @@ impl Drop for ConnectReservation {
fn drop(&mut self) { fn drop(&mut self) {
if !self.transferred { if !self.transferred {
self.cancellation.cancel(); self.cancellation.cancel();
self.lifecycle.clear_attempt(self.attempt, None); self.lifecycle.clear_attempt(self.attempt);
// A full queue already wakes the actor; a closed queue has no actor to wake. // A full queue already wakes the actor; a closed queue has no actor to wake.
let _ = self.lifecycle.events.try_send(LifecycleEvent::PreparationReleased); let _ = self.lifecycle.events.try_send(LifecycleEvent::PreparationReleased);
} }
@@ -403,7 +375,6 @@ struct Admissions {
#[derive(Clone)] #[derive(Clone)]
struct Admission { struct Admission {
attempt: u64, attempt: u64,
restart: Option<(u64, Uuid)>,
phase: AdmissionPhase, phase: AdmissionPhase,
stop_requested: bool, stop_requested: bool,
cancellation: CancellationToken, cancellation: CancellationToken,
@@ -473,7 +444,6 @@ struct ActiveAttempt {
task: tokio::task::JoinHandle<()>, task: tokio::task::JoinHandle<()>,
failure: Option<String>, failure: Option<String>,
reconnect_required: bool, reconnect_required: bool,
tunnel_established: bool,
} }
pub(crate) struct VpnTask { pub(crate) struct VpnTask {
@@ -668,7 +638,6 @@ impl VpnTask {
task, task,
failure: None, failure: None,
reconnect_required: false, reconnect_required: false,
tunnel_established: false,
}); });
if activated { if activated {
self.send_state(VpnState::Connecting(Box::new(info))); self.send_state(VpnState::Connecting(Box::new(info)));
@@ -751,20 +720,16 @@ impl VpnTask {
self.send_state(VpnState::Connected(Box::new(info.with_members(members, failures)))); self.send_state(VpnState::Connected(Box::new(info.with_members(members, failures))));
} }
fn publish_connected(&mut self, attempt: u64, info: ConnectInfo, session_info: SessionInfo) { fn publish_connected(&self, attempt: u64, info: ConnectInfo, session_info: SessionInfo) {
let connected = VpnState::Connected(Box::new(ConnectedInfo::new(info, Some(session_info)))); let connected = VpnState::Connected(Box::new(ConnectedInfo::new(info, Some(session_info))));
let mut admissions = self let admissions = self
.lifecycle .lifecycle
.admissions .admissions
.lock() .lock()
.expect("VPN lifecycle admissions mutex poisoned"); .expect("VPN lifecycle admissions mutex poisoned");
if let Some(admission) = admissions.current.as_mut().filter(|admission| { if admissions.current.as_ref().is_some_and(|admission| {
admission.attempt == attempt && admission.phase == AdmissionPhase::Active && !admission.stop_requested admission.attempt == attempt && admission.phase == AdmissionPhase::Active && !admission.stop_requested
}) { }) {
admission.restart = None;
if let Some(active) = self.active.as_mut().filter(|active| active.attempt == attempt) {
active.tunnel_established = true;
}
self.send_state(connected); self.send_state(connected);
} }
} }
@@ -812,25 +777,19 @@ impl VpnTask {
admission.completion.completed.store(true, Ordering::Release); admission.completion.completed.store(true, Ordering::Release);
admission.completion.notify.notify_waiters(); admission.completion.notify.notify_waiters();
} }
} else {
let unexpectedly_ended = active
.session_id
.filter(|_| active.tunnel_established && !active.cancellation.is_cancelled());
let state = if let Some(owner) = unexpectedly_ended {
VpnState::UnexpectedDisconnect {
attempt,
owner,
reason: active.failure,
}
} else if let Some(reason) = active.failure { } else if let Some(reason) = active.failure {
VpnState::Failed(reason) self.send_state(VpnState::Failed(reason));
self.lifecycle.clear_attempt(attempt);
} else { } else {
VpnState::Disconnected self.finish_attempt(attempt);
};
self.lifecycle.clear_attempt(attempt, Some(state));
} }
} }
fn finish_attempt(&self, attempt: u64) {
self.send_state(VpnState::Disconnected);
self.lifecycle.clear_attempt(attempt);
}
fn send_state(&self, state: VpnState) { fn send_state(&self, state: VpnState) {
let _ = self.vpn_state_tx.send(state); let _ = self.vpn_state_tx.send(state);
} }
@@ -1108,7 +1067,6 @@ mod tests {
task: tokio::spawn(async {}), task: tokio::spawn(async {}),
failure: None, failure: None,
reconnect_required: false, reconnect_required: false,
tunnel_established: false,
}); });
task.send_state(VpnState::Connecting(Box::new(info))); task.send_state(VpnState::Connecting(Box::new(info)));
let mut member = gpapi::session::GatewaySessionSummary { let mut member = gpapi::session::GatewaySessionSummary {
@@ -1129,126 +1087,6 @@ mod tests {
task.end_attempt(0).await; task.end_attempt(0).await;
} }
#[tokio::test]
async fn unexpected_disconnect_requires_an_established_tunnel() {
for established in [false, true] {
let (state, observed) = watch::channel(VpnState::Disconnected);
let (mut task, lifecycle) = VpnTask::new(state, false, registry());
let owner = Uuid::new_v4();
let info = ConnectInfo::new(
"portal.example.com".into(),
gpapi::gateway::Gateway::new("vpn".into(), "vpn.example.com".into()),
vec![],
);
let reservation = lifecycle.reserve_connect(None).unwrap();
let cancellation = reservation.cancellation();
assert_eq!(
reservation.commit(
PreparedConnection::lifecycle_fixture(test_connect_request(info.clone())),
None,
None,
Some(owner),
),
ServiceResult::Accepted
);
let _ = task.events.try_recv().unwrap();
assert!(lifecycle.activate_attempt(0));
task.active = Some(ActiveAttempt {
attempt: 0,
session_id: Some(owner),
info: info.clone(),
allow_extend_session: false,
cancellation,
task: tokio::spawn(async {}),
failure: None,
reconnect_required: false,
tunnel_established: false,
});
if established {
task.establish_attempt(0, VpnSessionInfo::default());
assert!(matches!(*observed.borrow(), VpnState::Connected(_)));
}
task.send_state(VpnState::Connecting(Box::new(info)));
task.end_attempt(0).await;
if established {
assert!(matches!(
*observed.borrow(),
VpnState::UnexpectedDisconnect { attempt: 0, owner: actual, .. } if actual == owner
));
} else {
assert!(matches!(*observed.borrow(), VpnState::Disconnected));
}
}
}
#[test]
fn abandoning_reconnect_cannot_end_an_admitted_replacement() {
let (state, mut observed) = watch::channel(VpnState::Disconnected);
let (_task, lifecycle) = VpnTask::new(state, false, registry());
let owner = Uuid::new_v4();
let restart = (7, owner);
lifecycle.admissions.lock().unwrap().restart = Some(restart);
lifecycle.abandon_reconnect(7, Uuid::new_v4());
assert!(!observed.has_changed().unwrap());
let replacement = lifecycle.reserve_connect(Some(restart)).unwrap();
lifecycle.abandon_reconnect(7, owner);
assert!(!observed.has_changed().unwrap());
drop(replacement);
assert!(matches!(
*observed.borrow_and_update(),
VpnState::UnexpectedDisconnect { attempt: 7, owner: actual, .. } if actual == owner
));
lifecycle.abandon_reconnect(7, owner);
assert!(!observed.has_changed().unwrap());
}
#[test]
fn abandoning_an_unclaimed_reconnect_reports_loss_and_rejects_late_admission() {
let (state, observed) = watch::channel(VpnState::Disconnected);
let (_task, lifecycle) = VpnTask::new(state, false, registry());
let owner = Uuid::new_v4();
lifecycle.admissions.lock().unwrap().restart = Some((7, owner));
lifecycle.abandon_reconnect(7, owner);
assert!(matches!(
*observed.borrow(),
VpnState::UnexpectedDisconnect { attempt: 7, owner: actual, .. } if actual == owner
));
assert!(lifecycle.reserve_connect(Some((7, owner))).is_err());
}
#[test]
fn established_replacement_settles_the_original_reconnect() {
let (state, observed) = watch::channel(VpnState::Disconnected);
let (mut task, lifecycle) = VpnTask::new(state, false, registry());
let owner = Uuid::new_v4();
let info = ConnectInfo::new(
"portal.example.com".into(),
gpapi::gateway::Gateway::new("vpn".into(), "vpn.example.com".into()),
vec![],
);
lifecycle.admissions.lock().unwrap().restart = Some((7, owner));
let replacement = lifecycle.reserve_connect(Some((7, owner))).unwrap();
assert_eq!(
replacement.commit(
PreparedConnection::lifecycle_fixture(test_connect_request(info.clone())),
None,
None,
Some(owner),
),
ServiceResult::Accepted
);
assert!(lifecycle.activate_attempt(0));
task.publish_connected(0, info, SessionInfo::default());
lifecycle.abandon_reconnect(7, owner);
assert!(matches!(*observed.borrow(), VpnState::Connected(_)));
lifecycle.clear_attempt(0, Some(VpnState::Disconnected));
assert!(matches!(*observed.borrow(), VpnState::Disconnected));
}
#[tokio::test] #[tokio::test]
async fn disconnect_completion_waits_for_the_owned_attempt_task() { async fn disconnect_completion_waits_for_the_owned_attempt_task() {
let (state, state_rx) = watch::channel(VpnState::Disconnected); let (state, state_rx) = watch::channel(VpnState::Disconnected);
@@ -1284,7 +1122,6 @@ mod tests {
task: worker, task: worker,
failure: None, failure: None,
reconnect_required: false, reconnect_required: false,
tunnel_established: true,
}); });
assert_eq!(lifecycle.request_disconnect(), ServiceResult::Accepted); assert_eq!(lifecycle.request_disconnect(), ServiceResult::Accepted);
let stop = task.events.recv().await.unwrap(); let stop = task.events.recv().await.unwrap();
@@ -1332,7 +1169,6 @@ mod tests {
task: tokio::spawn(async {}), task: tokio::spawn(async {}),
failure: None, failure: None,
reconnect_required: false, reconnect_required: false,
tunnel_established: false,
}); });
task.send_state(VpnState::Connecting(Box::new( task.send_state(VpnState::Connecting(Box::new(
task.active.as_ref().unwrap().info.clone(), task.active.as_ref().unwrap().info.clone(),
@@ -1384,7 +1220,7 @@ mod tests {
fn late_established_event_is_ignored_after_disconnect_is_accepted() { fn late_established_event_is_ignored_after_disconnect_is_accepted() {
let (vpn_state_tx, vpn_state_rx) = watch::channel(VpnState::Disconnected); let (vpn_state_tx, vpn_state_rx) = watch::channel(VpnState::Disconnected);
let state_rx = vpn_state_rx.clone(); let state_rx = vpn_state_rx.clone();
let (mut task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry()); let (task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
let info = ConnectInfo::new( let info = ConnectInfo::new(
"portal.example.com".to_string(), "portal.example.com".to_string(),
gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()), gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()),
@@ -1406,7 +1242,7 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn disconnect_waiter_completes_for_its_attempt_before_a_later_connect() { async fn disconnect_waiter_completes_for_its_attempt_before_a_later_connect() {
let (vpn_state_tx, _vpn_state_rx) = watch::channel(VpnState::Disconnected); let (vpn_state_tx, _vpn_state_rx) = watch::channel(VpnState::Disconnected);
let (_task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry()); let (task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
let request = || { let request = || {
test_connect_request(ConnectInfo::new( test_connect_request(ConnectInfo::new(
"portal.example.com".to_string(), "portal.example.com".to_string(),
@@ -1425,7 +1261,7 @@ mod tests {
tokio::task::yield_now().await; tokio::task::yield_now().await;
} }
lifecycle.clear_attempt(0, Some(VpnState::Disconnected)); task.finish_attempt(0);
assert!(matches!( assert!(matches!(
lifecycle.submit_test_connection(request(), None, None, None), lifecycle.submit_test_connection(request(), None, None, None),
ServiceResult::Accepted ServiceResult::Accepted
+1 -1
View File
@@ -733,7 +733,7 @@ mod tests {
async fn watch_vpn_state(mut vpn_state_rx: watch::Receiver<VpnState>, ctx: Arc<WsServerContext>) { async fn watch_vpn_state(mut vpn_state_rx: watch::Receiver<VpnState>, ctx: Arc<WsServerContext>) {
while vpn_state_rx.changed().await.is_ok() { while vpn_state_rx.changed().await.is_ok() {
let vpn_state = vpn_state_rx.borrow_and_update().clone(); let vpn_state = vpn_state_rx.borrow().clone();
ctx.send_event(WsEvent::VpnState(vpn_state)).await; ctx.send_event(WsEvent::VpnState(vpn_state)).await;
} }
} }
+1 -15
View File
@@ -1,23 +1,9 @@
# Changelog # Changelog
## 3.7.1 ## 3.7.0 (unreleased)
### Added
- Show a desktop notification on Windows, Linux, FreeBSD, and OpenBSD when the VPN disconnects unexpectedly and automatic reconnect fails.
### Fixed
- Make the Native Shell Close button visible in light mode and give it a consistent appearance across Linux themes.
- Allow turning off Compatibility Graphics in the Tauri interface.
## 3.7.0
- Linux now opens Native Shell by default on supported systems, including Alpine. Upgrades keep your saved interface choice. - Linux now opens Native Shell by default on supported systems, including Alpine. Upgrades keep your saved interface choice.
- To choose an interface after quitting GP Connect, run `gpclient launch-gui --interface tauri` or `gpclient launch-gui --interface nsh`. - To choose an interface after quitting GP Connect, run `gpclient launch-gui --interface tauri` or `gpclient launch-gui --interface nsh`.
- Linux packages include both Native Shell and Tauri so you can switch interfaces without a separate download.
- The README now documents source and prebuilt installation from the Gentoo overlay.
- Source builds with `BUILD_WEBVIEW_AUTH=0` disable embedded browser sign-in in both `gpclient` and `gpauth`.
## 3.6.0 ## 3.6.0
-1
View File
@@ -427,7 +427,6 @@ pub enum WsRequest {
SetWindowsPatchInterest { enabled: bool }, SetWindowsPatchInterest { enabled: bool },
RefreshWindowsPatches { after: Option<u64> }, RefreshWindowsPatches { after: Option<u64> },
Connect(Box<ConnectRequest>), Connect(Box<ConnectRequest>),
AbandonReconnect { attempt: u64 },
Disconnect(DisconnectRequest), Disconnect(DisconnectRequest),
StopNonTunnelAttachment { connection_id: uuid::Uuid }, StopNonTunnelAttachment { connection_id: uuid::Uuid },
StoreEditedHipReportChunk(StoreEditedHipReportChunkRequest), StoreEditedHipReportChunk(StoreEditedHipReportChunkRequest),
-5
View File
@@ -116,11 +116,6 @@ impl ConnectInfo {
pub enum VpnState { pub enum VpnState {
ReconnectRequired(Box<ReconnectRequest>), ReconnectRequired(Box<ReconnectRequest>),
Disconnected, Disconnected,
UnexpectedDisconnect {
attempt: u64,
owner: uuid::Uuid,
reason: Option<String>,
},
Failed(String), Failed(String),
Connecting(Box<ConnectInfo>), Connecting(Box<ConnectInfo>),
Connected(Box<ConnectedInfo>), Connected(Box<ConnectedInfo>),
+8 -8
View File
@@ -29,8 +29,8 @@
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = "globalprotect-openconnect"; pname = "globalprotect-openconnect";
version = cargoToml.workspace.package.version; version = cargoToml.workspace.package.version;
releaseTag = "v3.7.0"; releaseTag = "snapshot";
releaseVersion = "3.7.0"; releaseVersion = "3.6.0";
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
@@ -55,8 +55,8 @@
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name; cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
gpguiHashes = { gpguiHashes = {
x86_64 = "sha256-eIvocMn4j+CiA1FMuib1/BvMEw4kcO5h4zAhbSHXFf0="; x86_64 = "sha256-LZJcNoaOILCwdF2sNszY2efN/E2yn1rzcRphrrZGfMQ=";
aarch64 = "sha256-pBH7KccAAnxLcCD5+wJxEAwpdu+QRHHncrytwoBgzh4="; aarch64 = "sha256-HVzn7lJQfowPzAO5bcryZ+qdYYoP6Z0QCGSsK8McawA=";
}; };
gpguiArchive = pkgs.fetchurl { gpguiArchive = pkgs.fetchurl {
@@ -70,8 +70,8 @@
}; };
nshHashes = { nshHashes = {
x86_64 = "sha256-STlK1Wtx840a0TtIgxXJDINnVmfiedSNVcapGF154dY="; x86_64 = "sha256-/GyMeGZaUJwsP6A8I83hNcom4zQTOdEGEhP2ETJOp1w=";
aarch64 = "sha256-HekBfUrlRavNzA+1g6EvxN4iiGDevEv0stsVEyL6Ejk="; aarch64 = "sha256-eTz+X1HBeG1M0Vgf7PI1hTNDlFFoXBZ8Ag3EWMc5PUU=";
}; };
nshArchive = pkgs.fetchurl { nshArchive = pkgs.fetchurl {
@@ -94,8 +94,8 @@
''; '';
binaryHashes = { binaryHashes = {
x86_64 = "sha256-1YFxjH6+garb/bneZRqVHAOfPQGBEvWaruAk573bZhc="; x86_64 = "sha256-unxCRj+Fn2FxQfdpprAzsFwg8YveDb9iN1bSguQ67o4=";
aarch64 = "sha256-RnXdAcS2UWKwhWtlGSLs8fM4u2iRLx0w6SR42sOX9yk="; aarch64 = "sha256-EGnSCLCT02jVOiVYeLR+iaKYc7q0O96cF+8t55HIJ0s=";
}; };
binaryArchive = pkgs.fetchurl { binaryArchive = pkgs.fetchurl {