mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -05:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03b74f41e0 | ||
|
|
580b81e7bb |
No files matched your search
Generated
+13
-10
@@ -214,7 +214,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "auth"
|
name = "auth"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"block2",
|
"block2",
|
||||||
@@ -423,7 +423,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "browser-launcher"
|
name = "browser-launcher"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"log",
|
"log",
|
||||||
@@ -719,7 +719,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
|
dependencies = [
|
||||||
|
"tempfile",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "compile-time"
|
name = "compile-time"
|
||||||
@@ -1828,7 +1831,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpapi"
|
name = "gpapi"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
@@ -1879,7 +1882,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpauth"
|
name = "gpauth"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"auth",
|
"auth",
|
||||||
@@ -1898,7 +1901,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpclient"
|
name = "gpclient"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1924,7 +1927,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpgui-helper"
|
name = "gpgui-helper"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -1945,7 +1948,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gphip"
|
name = "gphip"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"askama",
|
"askama",
|
||||||
@@ -1962,7 +1965,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpservice"
|
name = "gpservice"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -3383,7 +3386,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openconnect"
|
name = "openconnect"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autotools",
|
"autotools",
|
||||||
"cc",
|
"cc",
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ members = [
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
rust-version = "1.91"
|
rust-version = "1.91"
|
||||||
version = "3.0.0"
|
version = "3.0.1"
|
||||||
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"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# GlobalProtect-openconnect
|
# GlobalProtect-openconnect
|
||||||
|
|
||||||
A GlobalProtect VPN client built on OpenConnect with support for SSO authentication. It provides command-line tools for Linux, FreeBSD, and OpenBSD, and the GP Connect desktop application for macOS, Linux, FreeBSD, and OpenBSD.
|
A GlobalProtect VPN client built on OpenConnect with support for SSO authentication. It provides command-line tools and the GP Connect desktop application for macOS, Linux, FreeBSD, and OpenBSD.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="300" src="https://github.com/user-attachments/assets/2fb6116c-dc57-43f2-af75-9c3d97ab7122">
|
<img width="300" src="https://github.com/user-attachments/assets/2fb6116c-dc57-43f2-af75-9c3d97ab7122">
|
||||||
@@ -134,7 +134,23 @@ gpclient launch-gui
|
|||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
Download the GP Connect `.dmg` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, open it, and drag GP Connect into Applications. The macOS build requires Apple silicon and macOS 13 or later.
|
GP Connect requires Apple silicon and macOS 13 or later. The macOS app includes both the desktop application and the free `gpclient` CLI. The CLI does not require a GUI license.
|
||||||
|
|
||||||
|
#### Option 1: Install with Homebrew
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install --cask yuezk/gp-connect/gp-connect
|
||||||
|
```
|
||||||
|
|
||||||
|
Open GP Connect from Applications, or connect from the terminal:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo gpclient connect <portal> --browser
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Option 2: Install from DMG
|
||||||
|
|
||||||
|
Download the GP Connect `.dmg` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, open it, and drag GP Connect into Applications.
|
||||||
|
|
||||||
### Debian / Ubuntu
|
### Debian / Ubuntu
|
||||||
|
|
||||||
|
|||||||
@@ -451,6 +451,15 @@ impl ConnectHandler<'_> {
|
|||||||
.local_hostname(self.args.local_hostname.clone())
|
.local_hostname(self.args.local_hostname.clone())
|
||||||
.dpd_interval(self.args.dpd_interval.unwrap_or(0))
|
.dpd_interval(self.args.dpd_interval.unwrap_or(0))
|
||||||
.no_xmlpost(self.args.no_xmlpost);
|
.no_xmlpost(self.args.no_xmlpost);
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let vpn_builder = if self.args.script.is_none()
|
||||||
|
&& std::env::var_os("GP_VPNC_SCRIPT").is_none_or(|value| value.is_empty())
|
||||||
|
&& let Some(script) = common::binary_paths::bundled_vpnc_script()
|
||||||
|
{
|
||||||
|
vpn_builder.script_path(script.to_string_lossy().into_owned())
|
||||||
|
} else {
|
||||||
|
vpn_builder
|
||||||
|
};
|
||||||
let vpn = apply_os_profile(vpn_builder, &os_profile)
|
let vpn = apply_os_profile(vpn_builder, &os_profile)
|
||||||
.build()
|
.build()
|
||||||
.map_err(|err| GatewayConnectError::before_establishment(err.into()))?;
|
.map_err(|err| GatewayConnectError::before_establishment(err.into()))?;
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.0.1
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed the bundled macOS CLI when launched through Homebrew.
|
||||||
|
- Fixed browser sign-in failures leaving the CLI waiting without an error.
|
||||||
|
- Fixed first-time startup on Linux and BSD when no system keyring is available.
|
||||||
|
- Improved tray menu behavior on Linux and BSD.
|
||||||
|
- Added clearer results when manually checking for updates.
|
||||||
|
- Improved desktop dialogs, settings, keyboard focus, and Linux window controls.
|
||||||
|
|
||||||
## 3.0.0
|
## 3.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{Context, bail};
|
use anyhow::{Context, bail};
|
||||||
use gpapi::auth::SamlAuthData;
|
use gpapi::{auth::SamlAuthData, error::AuthDataParseError};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{AsyncReadExt, AsyncWriteExt},
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
net::{UnixListener, UnixStream},
|
net::{UnixListener, UnixStream},
|
||||||
@@ -27,6 +27,7 @@ const PROTOCOL_VERSION: u8 = 1;
|
|||||||
const MAX_CALLBACK_SIZE: usize = 1024 * 1024;
|
const MAX_CALLBACK_SIZE: usize = 1024 * 1024;
|
||||||
const IO_TIMEOUT: Duration = Duration::from_secs(5);
|
const IO_TIMEOUT: Duration = Duration::from_secs(5);
|
||||||
|
|
||||||
|
// Acceptance acknowledges delivery, including an authentication failure.
|
||||||
const STATUS_ACCEPTED: u8 = 0;
|
const STATUS_ACCEPTED: u8 = 0;
|
||||||
const STATUS_INVALID_CALLBACK: u8 = 1;
|
const STATUS_INVALID_CALLBACK: u8 = 1;
|
||||||
const STATUS_UNSUPPORTED_VERSION: u8 = 2;
|
const STATUS_UNSUPPORTED_VERSION: u8 = 2;
|
||||||
@@ -70,6 +71,10 @@ impl AuthCallbackReceiver {
|
|||||||
let _ = write_response(&mut stream, STATUS_ACCEPTED).await;
|
let _ = write_response(&mut stream, STATUS_ACCEPTED).await;
|
||||||
return Ok(auth_data);
|
return Ok(auth_data);
|
||||||
}
|
}
|
||||||
|
Err(error @ AuthDataParseError::AuthenticationFailed(_)) => {
|
||||||
|
let _ = write_response(&mut stream, STATUS_ACCEPTED).await;
|
||||||
|
return Err(error.into());
|
||||||
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
let _ = write_response(&mut stream, STATUS_INVALID_CALLBACK).await;
|
let _ = write_response(&mut stream, STATUS_INVALID_CALLBACK).await;
|
||||||
}
|
}
|
||||||
@@ -419,6 +424,24 @@ mod tests {
|
|||||||
assert!(!socket_path.exists());
|
assert!(!socket_path.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn reports_authentication_failure_to_waiting_receiver() {
|
||||||
|
let directory = tempdir().unwrap();
|
||||||
|
let socket_path = directory.path().join("callback.sock");
|
||||||
|
let receiver = AuthCallbackReceiver::bind_at(socket_path.clone()).unwrap();
|
||||||
|
let failure = gpapi::utils::base64::encode(b"<html><saml-auth-status>0</saml-auth-status></html>");
|
||||||
|
let callback = format!("globalprotectcallback:{failure}");
|
||||||
|
let sender = tokio::spawn(async move { forward_auth_callback_to(&callback, &socket_path).await });
|
||||||
|
|
||||||
|
let error = timeout(Duration::from_millis(500), receiver.receive())
|
||||||
|
.await
|
||||||
|
.expect("Failure callback must finish the waiting authentication")
|
||||||
|
.unwrap_err();
|
||||||
|
|
||||||
|
assert!(error.to_string().contains("Authentication failed"));
|
||||||
|
sender.await.unwrap().expect("Failure callback was delivered");
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn rejects_bad_requests_and_keeps_waiting() {
|
async fn rejects_bad_requests_and_keeps_waiting() {
|
||||||
let directory = tempdir().unwrap();
|
let directory = tempdir().unwrap();
|
||||||
@@ -430,6 +453,10 @@ mod tests {
|
|||||||
send_raw_callback(&socket_path, PROTOCOL_VERSION, "https://example.com").await,
|
send_raw_callback(&socket_path, PROTOCOL_VERSION, "https://example.com").await,
|
||||||
STATUS_INVALID_CALLBACK
|
STATUS_INVALID_CALLBACK
|
||||||
);
|
);
|
||||||
|
assert_eq!(
|
||||||
|
send_raw_callback(&socket_path, PROTOCOL_VERSION, "globalprotectcallback:not-base64").await,
|
||||||
|
STATUS_INVALID_CALLBACK
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
send_raw_callback(&socket_path, PROTOCOL_VERSION + 1, VALID_CALLBACK).await,
|
send_raw_callback(&socket_path, PROTOCOL_VERSION + 1, VALID_CALLBACK).await,
|
||||||
STATUS_UNSUPPORTED_VERSION
|
STATUS_UNSUPPORTED_VERSION
|
||||||
|
|||||||
@@ -150,8 +150,8 @@ impl AuthMessenger {
|
|||||||
|
|
||||||
match auth_result {
|
match auth_result {
|
||||||
Ok(data) => self.send_auth_data(data, AuthDataLocation::Body),
|
Ok(data) => self.send_auth_data(data, AuthDataLocation::Body),
|
||||||
Err(AuthDataParseError::Invalid(err)) => self.send_auth_error(AuthError::invalid_from_body(err)),
|
|
||||||
Err(AuthDataParseError::NotFound) => self.send_auth_error(AuthError::not_found_in_body()),
|
Err(AuthDataParseError::NotFound) => self.send_auth_error(AuthError::not_found_in_body()),
|
||||||
|
Err(err) => self.send_auth_error(AuthError::invalid_from_body(err.into())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,3 +6,6 @@ authors.workspace = true
|
|||||||
homepage.workspace = true
|
homepage.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
tempfile.workspace = true
|
||||||
@@ -3,6 +3,9 @@ use std::{
|
|||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
mod macos;
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
not(debug_assertions),
|
not(debug_assertions),
|
||||||
any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")
|
any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")
|
||||||
@@ -80,13 +83,18 @@ fn resolve(env_key: &str, binary_name: &str, default_path: &str) -> PathBuf {
|
|||||||
|
|
||||||
fn sibling_binary(binary_name: &str) -> Option<PathBuf> {
|
fn sibling_binary(binary_name: &str) -> Option<PathBuf> {
|
||||||
let current_exe = env::current_exe().ok()?;
|
let current_exe = env::current_exe().ok()?;
|
||||||
let bin_dir = current_exe.parent()?;
|
sibling_binary_for_executable(¤t_exe, binary_name)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sibling_binary_for_executable(executable: &Path, binary_name: &str) -> Option<PathBuf> {
|
||||||
|
let executable = executable.canonicalize().ok()?;
|
||||||
|
let bin_dir = executable.parent()?;
|
||||||
let binary = bin_dir.join(binary_name);
|
let binary = bin_dir.join(binary_name);
|
||||||
if is_file(&binary) {
|
if is_file(&binary) {
|
||||||
return Some(binary);
|
return Some(binary);
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
if let Some(binary) = bundled_helper_path(¤t_exe, binary_name)
|
if let Some(binary) = macos::helper_path(&executable, binary_name)
|
||||||
&& is_file(&binary)
|
&& is_file(&binary)
|
||||||
{
|
{
|
||||||
return Some(binary);
|
return Some(binary);
|
||||||
@@ -95,14 +103,14 @@ fn sibling_binary(binary_name: &str) -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
fn bundled_helper_path(executable: &Path, binary_name: &str) -> Option<PathBuf> {
|
pub fn bundled_vpnc_script() -> Option<PathBuf> {
|
||||||
let bin_dir = executable.parent()?;
|
bundled_vpnc_script_for_executable(&env::current_exe().ok()?)
|
||||||
let contents = bin_dir.parent()?;
|
}
|
||||||
let bundle = contents.parent()?;
|
|
||||||
if bin_dir.file_name()? != "MacOS" || contents.file_name()? != "Contents" || bundle.extension()? != "app" {
|
#[cfg(target_os = "macos")]
|
||||||
return None;
|
fn bundled_vpnc_script_for_executable(executable: &Path) -> Option<PathBuf> {
|
||||||
}
|
let executable = executable.canonicalize().ok()?;
|
||||||
Some(contents.join("Helpers").join(binary_name))
|
macos::vpnc_script_path(&executable)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_file(path: &Path) -> bool {
|
fn is_file(path: &Path) -> bool {
|
||||||
@@ -117,14 +125,44 @@ mod tests {
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
fn desktop_resolves_helpers_in_the_actual_app_bundle_layout() {
|
fn desktop_resolves_helpers_in_the_actual_app_bundle_layout() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
bundled_helper_path(
|
macos::helper_path(
|
||||||
Path::new("/Applications/GP Connect.app/Contents/MacOS/gpgui"),
|
Path::new("/Applications/GP Connect.app/Contents/MacOS/gpgui"),
|
||||||
"gpclient"
|
"gpclient"
|
||||||
),
|
),
|
||||||
Some(PathBuf::from("/Applications/GP Connect.app/Contents/Helpers/gpclient"))
|
Some(PathBuf::from("/Applications/GP Connect.app/Contents/Helpers/gpclient"))
|
||||||
);
|
);
|
||||||
assert!(bundled_helper_path(Path::new("/usr/local/bin/gpgui"), "gpclient").is_none());
|
assert!(macos::helper_path(Path::new("/usr/local/bin/gpgui"), "gpclient").is_none());
|
||||||
assert!(bundled_helper_path(Path::new("/tmp/Contents/MacOS/gpgui"), "gpclient").is_none());
|
assert!(macos::helper_path(Path::new("/tmp/Contents/MacOS/gpgui"), "gpclient").is_none());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(unix)]
|
||||||
|
fn symlinked_executable_resolves_its_bundle_paths() {
|
||||||
|
let directory = tempfile::tempdir().unwrap();
|
||||||
|
let helpers = directory.path().join("GP Connect.app/Contents/Helpers");
|
||||||
|
let bin = directory.path().join("bin");
|
||||||
|
std::fs::create_dir_all(&helpers).unwrap();
|
||||||
|
std::fs::create_dir_all(&bin).unwrap();
|
||||||
|
std::fs::write(helpers.join("gpclient"), "").unwrap();
|
||||||
|
std::fs::write(helpers.join("gpauth"), "").unwrap();
|
||||||
|
std::os::unix::fs::symlink(helpers.join("gpclient"), bin.join("gpclient")).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
sibling_binary_for_executable(&bin.join("gpclient"), "gpauth"),
|
||||||
|
Some(helpers.canonicalize().unwrap().join("gpauth"))
|
||||||
|
);
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
assert_eq!(
|
||||||
|
bundled_vpnc_script_for_executable(&bin.join("gpclient")),
|
||||||
|
Some(
|
||||||
|
helpers
|
||||||
|
.canonicalize()
|
||||||
|
.unwrap()
|
||||||
|
.parent()
|
||||||
|
.unwrap()
|
||||||
|
.join("Resources/Scripts/vpnc-script")
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
fn contents_dir(executable: &Path) -> Option<&Path> {
|
||||||
|
let bin_dir = executable.parent()?;
|
||||||
|
let contents = bin_dir.parent()?;
|
||||||
|
let bundle = contents.parent()?;
|
||||||
|
let directory_name = bin_dir.file_name()?;
|
||||||
|
if (directory_name != "MacOS" && directory_name != "Helpers")
|
||||||
|
|| contents.file_name()? != "Contents"
|
||||||
|
|| bundle.extension()? != "app"
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some(contents)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn helper_path(executable: &Path, binary_name: &str) -> Option<PathBuf> {
|
||||||
|
Some(contents_dir(executable)?.join("Helpers").join(binary_name))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn vpnc_script_path(executable: &Path) -> Option<PathBuf> {
|
||||||
|
Some(contents_dir(executable)?.join("Resources/Scripts/vpnc-script"))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bundle_entry_points_use_their_own_vpnc_script() {
|
||||||
|
for executable in [
|
||||||
|
"/Applications/GP Connect.app/Contents/Helpers/gpclient",
|
||||||
|
"/Applications/GP Connect.app/Contents/MacOS/gpgui",
|
||||||
|
] {
|
||||||
|
assert_eq!(
|
||||||
|
vpnc_script_path(Path::new(executable)),
|
||||||
|
Some(PathBuf::from(
|
||||||
|
"/Applications/GP Connect.app/Contents/Resources/Scripts/vpnc-script"
|
||||||
|
))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert!(vpnc_script_path(Path::new("/opt/homebrew/bin/gpclient")).is_none());
|
||||||
|
assert!(vpnc_script_path(Path::new("/tmp/Contents/Helpers/gpclient")).is_none());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -130,10 +130,7 @@ impl SamlAuthData {
|
|||||||
|
|
||||||
Ok(auth_data)
|
Ok(auth_data)
|
||||||
}
|
}
|
||||||
Some(status) => Err(AuthDataParseError::Invalid(anyhow::anyhow!(
|
Some(status) => Err(AuthDataParseError::AuthenticationFailed(status)),
|
||||||
"SAML auth status: {}",
|
|
||||||
status
|
|
||||||
))),
|
|
||||||
None => Err(AuthDataParseError::NotFound),
|
None => Err(AuthDataParseError::NotFound),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,17 @@ impl PortalError {
|
|||||||
pub enum AuthDataParseError {
|
pub enum AuthDataParseError {
|
||||||
#[error("No auth data found")]
|
#[error("No auth data found")]
|
||||||
NotFound,
|
NotFound,
|
||||||
|
#[error("Authentication failed (SAML status: {0})")]
|
||||||
|
AuthenticationFailed(String),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Invalid(#[from] anyhow::Error),
|
Invalid(#[from] anyhow::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AuthDataParseError {
|
impl AuthDataParseError {
|
||||||
pub fn is_invalid(&self) -> bool {
|
pub fn is_invalid(&self) -> bool {
|
||||||
matches!(self, AuthDataParseError::Invalid(_))
|
matches!(
|
||||||
|
self,
|
||||||
|
AuthDataParseError::Invalid(_) | AuthDataParseError::AuthenticationFailed(_)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,12 +203,20 @@ mod tests {
|
|||||||
let log_file = dir.path().join("desktop.log");
|
let log_file = dir.path().join("desktop.log");
|
||||||
fs::write(&log_file, "[gpservice] started\n").unwrap();
|
fs::write(&log_file, "[gpservice] started\n").unwrap();
|
||||||
let program = dir.path().join("gui");
|
let program = dir.path().join("gui");
|
||||||
fs::write(&program, "#!/bin/sh\nprintf '[gpgui] initialized\\n' >&2\n").unwrap();
|
|
||||||
fs::set_permissions(&program, fs::Permissions::from_mode(0o755)).unwrap();
|
|
||||||
let launcher = launcher(VERSION, vec![]).envs(HashMap::from([(
|
let launcher = launcher(VERSION, vec![]).envs(HashMap::from([(
|
||||||
"GP_LOG_FILE".to_owned(),
|
"GP_LOG_FILE".to_owned(),
|
||||||
log_file.to_str().unwrap().to_owned(),
|
log_file.to_str().unwrap().to_owned(),
|
||||||
)]));
|
)]));
|
||||||
|
let frame_len = launcher.credential.encode_frame().unwrap().len();
|
||||||
|
// Consume the credential frame like the real GUI before exiting.
|
||||||
|
fs::write(
|
||||||
|
&program,
|
||||||
|
format!(
|
||||||
|
"#!/bin/sh\ndd bs=1 count={frame_len} of=/dev/null 2>/dev/null || exit 1\nprintf '[gpgui] initialized\\n' >&2\n"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
fs::set_permissions(&program, fs::Permissions::from_mode(0o755)).unwrap();
|
||||||
|
|
||||||
assert!(launcher.launch_program(&program).await.unwrap().success());
|
assert!(launcher.launch_program(&program).await.unwrap().success());
|
||||||
assert!(launcher.launch_program(&program).await.unwrap().success());
|
assert!(launcher.launch_program(&program).await.unwrap().success());
|
||||||
|
|||||||
Generated
+3
-3
@@ -63,11 +63,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1791366222,
|
"lastModified": 1791487292,
|
||||||
"narHash": "sha256-o0N4g6uSOIppU7CGToNvGlMf5vC+B6O6ukFHKY/TKOY=",
|
"narHash": "sha256-tqM7xDEsaeK1p6VvRygeZ9LkQRpUUkbRT02BHv6hnTM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "39ad350a0602fa0a58a544344e3e9187526ea45c",
|
"rev": "8edc0c72e3a38faf5434e40d1f19431125fe4b30",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -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.0.0";
|
releaseTag = "v3.0.1";
|
||||||
releaseVersion = "3.0.0";
|
releaseVersion = "3.0.1";
|
||||||
|
|
||||||
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-MdY+50LtG/AmJEcJdXbXFcvyl0R4jQMOmJfQ6rlAd6c=";
|
x86_64 = "sha256-lc05BKc0lu0qoZWmOPakjxXmenv1XoiQCOMIh5KE8A8=";
|
||||||
aarch64 = "sha256-a8/YtYQct6/UUjbNVDN/54fHxdnRFhKahprBLyVz0xk=";
|
aarch64 = "sha256-bnmGQ82GJbS0z8yelMeOxzwSNV92iVk8hGEUUd4jkFA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
gpguiArchive = pkgs.fetchurl {
|
gpguiArchive = pkgs.fetchurl {
|
||||||
@@ -70,8 +70,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
binaryHashes = {
|
binaryHashes = {
|
||||||
x86_64 = "sha256-/PsNsK2IY/qnsVQVF3o8EFnBRP9LpjxZm7e09d8/Xig=";
|
x86_64 = "sha256-/nKUzhlIdlgK2Xpv2nCQ/tuwUCTYuoSSft7sCc/M7U0=";
|
||||||
aarch64 = "sha256-W51Ek28cA0mnE3G4d7DqhDAtvqmq17QQ+i155dxarUw=";
|
aarch64 = "sha256-pDJvHT8p6fMFtSyJypr/3wL/OPHK/TSL7HMt63nP5oQ=";
|
||||||
};
|
};
|
||||||
|
|
||||||
binaryArchive = pkgs.fetchurl {
|
binaryArchive = pkgs.fetchurl {
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ upload_file() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Update the existing snapshot release in place to avoid notification spam.
|
# Update the existing snapshot release in place to avoid notification spam.
|
||||||
|
# Keep its tag fixed; only release assets advance with subsequent builds.
|
||||||
# Preserve its macOS update assets when the current run does not replace them.
|
# Preserve its macOS update assets when the current run does not replace them.
|
||||||
release_snapshot() {
|
release_snapshot() {
|
||||||
mapfile -t files < <(release_assets)
|
mapfile -t files < <(release_assets)
|
||||||
@@ -138,13 +139,11 @@ release_snapshot() {
|
|||||||
local is_current
|
local is_current
|
||||||
local asset
|
local asset
|
||||||
local file
|
local file
|
||||||
local snapshot_commit
|
|
||||||
|
|
||||||
snapshot_commit="$(git -C "$SCRIPT_DIR/.." rev-parse HEAD)"
|
|
||||||
if ! gh -R "$REPO" release view "$TAG" >/dev/null 2>&1; then
|
if ! gh -R "$REPO" release view "$TAG" >/dev/null 2>&1; then
|
||||||
gh -R "$REPO" release create "$TAG" \
|
gh -R "$REPO" release create "$TAG" \
|
||||||
--prerelease \
|
--prerelease=false \
|
||||||
--target "$snapshot_commit" \
|
--latest=false \
|
||||||
|
--target "$(git -C "$SCRIPT_DIR/.." rev-parse HEAD)" \
|
||||||
--title "Snapshot" \
|
--title "Snapshot" \
|
||||||
--notes "Rolling snapshot release from trusted CI builds."
|
--notes "Rolling snapshot release from trusted CI builds."
|
||||||
fi
|
fi
|
||||||
@@ -184,9 +183,7 @@ release_snapshot() {
|
|||||||
fi
|
fi
|
||||||
done <<<"$existing_assets"
|
done <<<"$existing_assets"
|
||||||
|
|
||||||
gh api --method PATCH "repos/$REPO/git/refs/tags/$TAG" \
|
gh -R "$REPO" release edit "$TAG" --prerelease=false --latest=false --title "Snapshot"
|
||||||
-f sha="$snapshot_commit" -F force=true >/dev/null
|
|
||||||
gh -R "$REPO" release edit "$TAG" --prerelease --title "Snapshot"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
release_tag() {
|
release_tag() {
|
||||||
@@ -199,12 +196,14 @@ release_tag() {
|
|||||||
# Upload source tarballs, GUI components, and BSD packages. Other Linux
|
# Upload source tarballs, GUI components, and BSD packages. Other Linux
|
||||||
# packages are built in `release.yml` from the standalone source tarball.
|
# packages are built in `release.yml` from the standalone source tarball.
|
||||||
gh -R "$REPO" release create "$TAG" \
|
gh -R "$REPO" release create "$TAG" \
|
||||||
|
--prerelease=false \
|
||||||
--title "$TAG" \
|
--title "$TAG" \
|
||||||
--notes-file "$release_notes_file"
|
--notes-file "$release_notes_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mapfile -t files < <(release_assets)
|
mapfile -t files < <(release_assets)
|
||||||
GITHUB_REPOSITORY="$REPO" "$SCRIPT_DIR/upload-release-assets.sh" "$TAG" "${files[@]}"
|
GITHUB_REPOSITORY="$REPO" "$SCRIPT_DIR/upload-release-assets.sh" "$TAG" "${files[@]}"
|
||||||
|
gh -R "$REPO" release edit "$TAG" --prerelease=false
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $TAG == *"snapshot" ]]; then
|
if [[ $TAG == *"snapshot" ]]; then
|
||||||
|
|||||||
Reference in new issue
Block a user