Compare commits

...
4 Commits
Author SHA1 Message Date
Kevin Yue 541a269d4c Release 3.7.1 2026-11-21 22:33:08 +08:00
Kevin Yue dd70148936 Merge pull request #725 from yuezk/chore/promote-v3.7.0
release: promote GP Connect 3.7.0 and the Nix flake
2026-11-21 12:37:00 +08:00
Kevin Yue 3ee6d16b11 Refresh the installation guide for GP Connect 3.7.0 2026-11-21 12:34:42 +08:00
Kevin Yue 9dc99289b3 release: validate Nix packages for v3.7.0 2026-11-21 12:34:18 +08:00
12 changed files with 366 additions and 190 deletions

No files matched your search

Generated
+13 -13
View File
@@ -292,7 +292,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "auth"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"block2",
@@ -554,7 +554,7 @@ dependencies = [
[[package]]
name = "browser-launcher"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"log",
@@ -919,7 +919,7 @@ dependencies = [
[[package]]
name = "common"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"tempfile",
]
@@ -2133,7 +2133,7 @@ dependencies = [
[[package]]
name = "gp-xml"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"url",
"xmltree",
@@ -2141,7 +2141,7 @@ dependencies = [
[[package]]
name = "gpapi"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"base64 0.23.1",
@@ -2205,7 +2205,7 @@ dependencies = [
[[package]]
name = "gpauth"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"auth",
@@ -2223,7 +2223,7 @@ dependencies = [
[[package]]
name = "gpclient"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"clap",
@@ -2254,7 +2254,7 @@ dependencies = [
[[package]]
name = "gpgui-helper"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"clap",
@@ -2275,7 +2275,7 @@ dependencies = [
[[package]]
name = "gphip"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"askama",
@@ -2294,7 +2294,7 @@ dependencies = [
[[package]]
name = "gpservice"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"anyhow",
"axum",
@@ -2332,7 +2332,7 @@ dependencies = [
[[package]]
name = "gptunnel"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"gpapi",
"log",
@@ -2344,7 +2344,7 @@ dependencies = [
[[package]]
name = "gpvpnc"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"base64 0.23.1",
"ipnet",
@@ -3860,7 +3860,7 @@ dependencies = [
[[package]]
name = "openconnect"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"autotools",
"cc",
+1 -1
View File
@@ -11,7 +11,7 @@ members = [
[workspace.package]
rust-version = "1.91"
version = "3.7.0"
version = "3.7.1"
authors = ["Kevin Yue <[email protected]>"]
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
edition = "2024"
+131 -146
View File
@@ -1,8 +1,14 @@
# GlobalProtect-openconnect
A GlobalProtect VPN client built on OpenConnect. GP Connect runs on Windows, macOS, Linux, FreeBSD, and OpenBSD.
**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`.
> **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.
<p align="center">
<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">
<picture>
@@ -12,111 +18,71 @@ A GlobalProtect VPN client built on OpenConnect. GP Connect runs on Windows, mac
</picture>
</p>
> **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)
GP Connect is an independent project. It is not affiliated with or endorsed by Palo Alto Networks, Inc.
## Features
- **Multi-Platform** – Windows (x64 and ARM64), macOS (Apple silicon), Linux, FreeBSD, and OpenBSD
- **Dual Interfaces** – Desktop GUI (**GP Connect**) and terminal CLI (`gpclient`, on macOS, Linux, and BSD)
- **Native Shell on Linux** – Ultra-low-memory native desktop GUI alongside the webview interface
- **Flexible Routing** – Full System VPN tunnel or local SOCKS5 proxy mode
- **Modern Authentication** – SAML / SSO, MFA, FIDO2 (YubiKey), client certificates, and external browser login
- **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.
- Browser-based SSO and MFA, including security keys supported by the identity provider. Client certificates are also supported.
- System VPN tunnel or local SOCKS5 and HTTP proxies for individual applications.
- Multiple saved portals and direct gateway connections.
- Built-in host information profile (HIP) reporting and support for custom HIP scripts.
- System tray controls and automatic connection on launch.
- Native Shell, a lightweight desktop interface for supported Linux systems.
## 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
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.
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.
### macOS
Requires Apple silicon and macOS 13+. Includes both GP Connect and the `gpclient` CLI.
Requires Apple silicon and macOS 13+.
#### Option 1: Homebrew (Recommended)
#### Homebrew
```bash
brew install --cask yuezk/gp-connect/gp-connect
```
#### Option 2: DMG Installer
#### DMG installer
Download the `.dmg` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page and drag GP Connect into Applications.
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.
### 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
#### Option 1: PPA (Recommended)
#### Ubuntu PPA
```bash
sudo add-apt-repository ppa:yuezk/globalprotect-openconnect
@@ -124,24 +90,14 @@ sudo apt-get update
sudo apt-get install globalprotect-openconnect
```
#### Option 2: DEB Package
#### Debian or Ubuntu release package
Download the latest `.deb` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
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).
```bash
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
Enable the COPR repository:
@@ -151,36 +107,6 @@ sudo dnf copr enable yuezk/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
Add the overlay:
@@ -191,13 +117,15 @@ sudo eselect repository add yuezk git https://github.com/yuezk/gentoo-overlay.gi
sudo emerge --sync yuezk
```
Install the prebuilt package (glibc):
On glibc systems, install the prebuilt package:
```bash
sudo emerge --ask net-vpn/globalprotect-openconnect-bin::yuezk
```
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.
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).
If Portage requests keyword or USE flag changes, review and apply them, then rerun the install command.
### NixOS
@@ -226,38 +154,96 @@ Apply changes:
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
Run the CLI client in an official Alpine container:
Run the CLI in the project’s Alpine container. Replace `vpn.example.com` with your portal address.
```bash
docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \
yuezk/globalprotect-openconnect:latest \
connect <portal> --browser manual
connect vpn.example.com --browser manual
```
*(Add `--network host` on Linux if VPN routes should apply to the host network).*
On Linux, add `--network host` to apply VPN routes to the host network.
### Other Distributions
## Usage
Download `globalprotect-openconnect_${version}_${arch}.bin.tar.xz` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
### Desktop
```bash
tar -xJf globalprotect-openconnect_*.bin.tar.xz
cd globalprotect-openconnect_*
sudo make install
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`.
### Command line
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
### Prerequisites (Linux)
- [Rust](https://www.rust-lang.org/tools/install) 1.91 or later
- 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. The generic glibc build requires glibc 2.39 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.
- Polkit (`pkexec`) for privileged tunnel setup
*(For FreeBSD and OpenBSD instructions, see [Building from Source on FreeBSD and OpenBSD](docs/bsd-source-build.md)).*
For BSD build requirements, see [Building from Source on FreeBSD and OpenBSD](docs/bsd-source-build.md).
### Build Steps
@@ -274,11 +260,6 @@ 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_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
- [WMP/GlobalProtect-SAML-NetworkManager](https://github.com/WMP/GlobalProtect-SAML-NetworkManager) – NetworkManager VPN plugin with SAML/SSO support for GNOME and KDE Plasma
@@ -303,3 +284,7 @@ sudo make install
| [gpclient](./apps/gpclient) | Application | [GPL-3.0](./apps/gpclient/LICENSE) |
| [gpauth](./apps/gpauth) | Application | [GPL-3.0](./apps/gpauth/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).
+4 -1
View File
@@ -325,7 +325,10 @@ async fn wait_for_brokered_idle(
_ = interval.tick() => {},
}
let idle = matches!(*vpn_state_rx.borrow(), VpnState::Disconnected | VpnState::Failed(_)) && registry.is_empty();
let idle = matches!(
*vpn_state_rx.borrow(),
VpnState::Disconnected | VpnState::UnexpectedDisconnect { .. } | VpnState::Failed(_)
) && registry.is_empty();
if !idle {
idle_since = None;
continue;
+7
View File
@@ -174,6 +174,12 @@ impl RequestDispatcher {
.stop_non_tunnel_attachment(authority.session_id, authority.generation, connection_id)?;
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()),
request => Ok(PendingDispatch::Other(request)),
}
@@ -259,6 +265,7 @@ impl RequestDispatcher {
ServiceResult::Accepted
}
WsRequest::Connect(_)
| WsRequest::AbandonReconnect { .. }
| WsRequest::StopNonTunnelAttachment { .. }
| WsRequest::Disconnect(_)
| WsRequest::StoreEditedHipReportChunk(_)
+181 -17
View File
@@ -76,6 +76,7 @@ impl LifecycleHandle {
let cancellation = CancellationToken::new();
admissions.current = Some(Admission {
attempt,
restart,
phase: AdmissionPhase::Preparing,
stop_requested: false,
cancellation: cancellation.clone(),
@@ -89,6 +90,19 @@ 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)]
fn submit_test_connection(
&self,
@@ -217,7 +231,7 @@ impl LifecycleHandle {
true
}
fn clear_attempt(&self, attempt: u64) {
fn clear_attempt(&self, attempt: u64, state: Option<VpnState>) {
let completion = {
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
let Some(admission) = admissions.current.as_ref() else {
@@ -226,6 +240,20 @@ impl LifecycleHandle {
if admission.attempt != attempt {
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);
admissions.current = None;
completion
@@ -357,7 +385,7 @@ impl Drop for ConnectReservation {
fn drop(&mut self) {
if !self.transferred {
self.cancellation.cancel();
self.lifecycle.clear_attempt(self.attempt);
self.lifecycle.clear_attempt(self.attempt, None);
// A full queue already wakes the actor; a closed queue has no actor to wake.
let _ = self.lifecycle.events.try_send(LifecycleEvent::PreparationReleased);
}
@@ -375,6 +403,7 @@ struct Admissions {
#[derive(Clone)]
struct Admission {
attempt: u64,
restart: Option<(u64, Uuid)>,
phase: AdmissionPhase,
stop_requested: bool,
cancellation: CancellationToken,
@@ -444,6 +473,7 @@ struct ActiveAttempt {
task: tokio::task::JoinHandle<()>,
failure: Option<String>,
reconnect_required: bool,
tunnel_established: bool,
}
pub(crate) struct VpnTask {
@@ -638,6 +668,7 @@ impl VpnTask {
task,
failure: None,
reconnect_required: false,
tunnel_established: false,
});
if activated {
self.send_state(VpnState::Connecting(Box::new(info)));
@@ -720,16 +751,20 @@ impl VpnTask {
self.send_state(VpnState::Connected(Box::new(info.with_members(members, failures))));
}
fn publish_connected(&self, attempt: u64, info: ConnectInfo, session_info: SessionInfo) {
fn publish_connected(&mut self, attempt: u64, info: ConnectInfo, session_info: SessionInfo) {
let connected = VpnState::Connected(Box::new(ConnectedInfo::new(info, Some(session_info))));
let admissions = self
let mut admissions = self
.lifecycle
.admissions
.lock()
.expect("VPN lifecycle admissions mutex poisoned");
if admissions.current.as_ref().is_some_and(|admission| {
if let Some(admission) = admissions.current.as_mut().filter(|admission| {
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);
}
}
@@ -777,19 +812,25 @@ impl VpnTask {
admission.completion.completed.store(true, Ordering::Release);
admission.completion.notify.notify_waiters();
}
} else if let Some(reason) = active.failure {
self.send_state(VpnState::Failed(reason));
self.lifecycle.clear_attempt(attempt);
} else {
self.finish_attempt(attempt);
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 {
VpnState::Failed(reason)
} else {
VpnState::Disconnected
};
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) {
let _ = self.vpn_state_tx.send(state);
}
@@ -1067,6 +1108,7 @@ mod tests {
task: tokio::spawn(async {}),
failure: None,
reconnect_required: false,
tunnel_established: false,
});
task.send_state(VpnState::Connecting(Box::new(info)));
let mut member = gpapi::session::GatewaySessionSummary {
@@ -1087,6 +1129,126 @@ mod tests {
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]
async fn disconnect_completion_waits_for_the_owned_attempt_task() {
let (state, state_rx) = watch::channel(VpnState::Disconnected);
@@ -1122,6 +1284,7 @@ mod tests {
task: worker,
failure: None,
reconnect_required: false,
tunnel_established: true,
});
assert_eq!(lifecycle.request_disconnect(), ServiceResult::Accepted);
let stop = task.events.recv().await.unwrap();
@@ -1169,6 +1332,7 @@ mod tests {
task: tokio::spawn(async {}),
failure: None,
reconnect_required: false,
tunnel_established: false,
});
task.send_state(VpnState::Connecting(Box::new(
task.active.as_ref().unwrap().info.clone(),
@@ -1220,7 +1384,7 @@ mod tests {
fn late_established_event_is_ignored_after_disconnect_is_accepted() {
let (vpn_state_tx, vpn_state_rx) = watch::channel(VpnState::Disconnected);
let state_rx = vpn_state_rx.clone();
let (task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
let (mut task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
let info = ConnectInfo::new(
"portal.example.com".to_string(),
gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()),
@@ -1242,7 +1406,7 @@ mod tests {
#[tokio::test]
async fn disconnect_waiter_completes_for_its_attempt_before_a_later_connect() {
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 = || {
test_connect_request(ConnectInfo::new(
"portal.example.com".to_string(),
@@ -1261,7 +1425,7 @@ mod tests {
tokio::task::yield_now().await;
}
task.finish_attempt(0);
lifecycle.clear_attempt(0, Some(VpnState::Disconnected));
assert!(matches!(
lifecycle.submit_test_connection(request(), None, None, None),
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>) {
while vpn_state_rx.changed().await.is_ok() {
let vpn_state = vpn_state_rx.borrow().clone();
let vpn_state = vpn_state_rx.borrow_and_update().clone();
ctx.send_event(WsEvent::VpnState(vpn_state)).await;
}
}
+11
View File
@@ -1,5 +1,16 @@
# Changelog
## 3.7.1
### 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.
+1
View File
@@ -427,6 +427,7 @@ pub enum WsRequest {
SetWindowsPatchInterest { enabled: bool },
RefreshWindowsPatches { after: Option<u64> },
Connect(Box<ConnectRequest>),
AbandonReconnect { attempt: u64 },
Disconnect(DisconnectRequest),
StopNonTunnelAttachment { connection_id: uuid::Uuid },
StoreEditedHipReportChunk(StoreEditedHipReportChunkRequest),
+5
View File
@@ -116,6 +116,11 @@ impl ConnectInfo {
pub enum VpnState {
ReconnectRequired(Box<ReconnectRequest>),
Disconnected,
UnexpectedDisconnect {
attempt: u64,
owner: uuid::Uuid,
reason: Option<String>,
},
Failed(String),
Connecting(Box<ConnectInfo>),
Connected(Box<ConnectedInfo>),
Generated
+3 -3
View File
@@ -63,11 +63,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1794840529,
"narHash": "sha256-ySrWnmZB5UsZTYGHHnBjllT05O5iFjElCRS+mabtfP0=",
"lastModified": 1795095985,
"narHash": "sha256-DOTZsOOoEtOY0ysY9L6JzyDHZm4lGBr6P1bt1mFXcRw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e21fec321d73511849707a7585e4ea155ee4bf40",
"rev": "19cfded70b91ca0981373973c5b1efffdd4d6647",
"type": "github"
},
"original": {
+8 -8
View File
@@ -29,8 +29,8 @@
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = "globalprotect-openconnect";
version = cargoToml.workspace.package.version;
releaseTag = "v3.6.0";
releaseVersion = "3.6.0";
releaseTag = "v3.7.0";
releaseVersion = "3.7.0";
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
@@ -55,8 +55,8 @@
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
gpguiHashes = {
x86_64 = "sha256-cWFOqjDpzGSWLZgiDVeEYJMGAMrdfiB15Q6geKSVEEg=";
aarch64 = "sha256-e66fokdJk6/vr1B/6hX37Lt+7OPnXZP+D2N5ht/yM4o=";
x86_64 = "sha256-eIvocMn4j+CiA1FMuib1/BvMEw4kcO5h4zAhbSHXFf0=";
aarch64 = "sha256-pBH7KccAAnxLcCD5+wJxEAwpdu+QRHHncrytwoBgzh4=";
};
gpguiArchive = pkgs.fetchurl {
@@ -70,8 +70,8 @@
};
nshHashes = {
x86_64 = "sha256-HWQ7Lh0NA6lEjLIPjmvqsB1DhzUPMeZ6NPpyUTfLbng=";
aarch64 = "sha256-GT6arWaFyZNDCMrK676+JlPJnCAJ0DhDugcCMQlPmIM=";
x86_64 = "sha256-STlK1Wtx840a0TtIgxXJDINnVmfiedSNVcapGF154dY=";
aarch64 = "sha256-HekBfUrlRavNzA+1g6EvxN4iiGDevEv0stsVEyL6Ejk=";
};
nshArchive = pkgs.fetchurl {
@@ -94,8 +94,8 @@
'';
binaryHashes = {
x86_64 = "sha256-gK8VWHw1VbXE7wHU1wGYw4fQ0khk24JWUwAQk+47WF8=";
aarch64 = "sha256-nqSuIW1fz742+2rF0QpnN8hswFm5lezC9JEOMs/8OHM=";
x86_64 = "sha256-1YFxjH6+garb/bneZRqVHAOfPQGBEvWaruAk573bZhc=";
aarch64 = "sha256-RnXdAcS2UWKwhWtlGSLs8fM4u2iRLx0w6SR42sOX9yk=";
};
binaryArchive = pkgs.fetchurl {