chore: prepare 2.6.3 release

- Fix NixOS GUI authorization after package updates.

- Treat Ctrl+C initiated OpenConnect disconnect as a successful shutdown.

- Update snapshot flake hash automation for prebuilt Nix packages.

- Bump gp workspace version and changelog to 2.6.3.
This commit is contained in:
Kevin Yue committed 2026-06-23 20:06:04 +08:00
1 parent 10e94e0b81
commit 0b037e158c
8 files changed
+135 -32

No files matched your search

+8 -3
View File
@@ -6,6 +6,9 @@ on:
version:
description: "Release version. Defaults to Cargo.toml workspace version."
required: false
release_tag:
description: "GitHub release tag to fetch assets from. Defaults to v<version>; use snapshot for snapshot assets."
required: false
permissions:
contents: write
@@ -24,11 +27,12 @@ jobs:
- name: Update flake hashes
env:
RELEASE_VERSION: ${{ inputs.version }}
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
if [[ -n "$RELEASE_VERSION" ]]; then
scripts/update-flake-hashes.sh "$RELEASE_VERSION"
scripts/update-flake-hashes.sh "$RELEASE_VERSION" "$RELEASE_TAG"
else
scripts/update-flake-hashes.sh
scripts/update-flake-hashes.sh "" "$RELEASE_TAG"
fi
- name: Upload updated flake
@@ -112,4 +116,5 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ inputs.version }}
run: scripts/open-flake-hashes-pr.sh "$RELEASE_VERSION"
RELEASE_TAG: ${{ inputs.release_tag }}
run: scripts/open-flake-hashes-pr.sh "$RELEASE_VERSION" "$RELEASE_TAG"
Generated
+8 -8
View File
@@ -214,7 +214,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "auth"
version = "2.6.2"
version = "2.6.3"
dependencies = [
"anyhow",
"block2",
@@ -705,7 +705,7 @@ dependencies = [
[[package]]
name = "common"
version = "2.6.2"
version = "2.6.3"
[[package]]
name = "compile-time"
@@ -1732,7 +1732,7 @@ dependencies = [
[[package]]
name = "gpapi"
version = "2.6.2"
version = "2.6.3"
dependencies = [
"anyhow",
"base64 0.22.1",
@@ -1776,7 +1776,7 @@ dependencies = [
[[package]]
name = "gpauth"
version = "2.6.2"
version = "2.6.3"
dependencies = [
"anyhow",
"auth",
@@ -1796,7 +1796,7 @@ dependencies = [
[[package]]
name = "gpclient"
version = "2.6.2"
version = "2.6.3"
dependencies = [
"anyhow",
"askama",
@@ -1825,7 +1825,7 @@ dependencies = [
[[package]]
name = "gpgui-helper"
version = "2.6.2"
version = "2.6.3"
dependencies = [
"anyhow",
"clap",
@@ -1843,7 +1843,7 @@ dependencies = [
[[package]]
name = "gpservice"
version = "2.6.2"
version = "2.6.3"
dependencies = [
"anyhow",
"axum",
@@ -3191,7 +3191,7 @@ dependencies = [
[[package]]
name = "openconnect"
version = "2.6.2"
version = "2.6.3"
dependencies = [
"autotools",
"cc",
+1 -1
View File
@@ -11,7 +11,7 @@ members = [
[workspace.package]
rust-version = "1.89"
version = "2.6.2"
version = "2.6.3"
authors = ["Kevin Yue <[email protected]>"]
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
edition = "2024"
+33 -6
View File
@@ -28,6 +28,8 @@ use crate::{
use super::{ConnectHandler, args::cookie_cache_path};
const OPENCONNECT_INTERRUPTED_EXIT_CODE: i32 = -4;
struct GatewayLoginSession {
cookie: String,
extension_auth: SessionExtensionAuth,
@@ -372,10 +374,13 @@ impl ConnectHandler<'_> {
let session_ctx_on_connect = Arc::clone(&session_ctx);
let tunnel_established = Arc::new(AtomicBool::new(false));
let tunnel_established_on_connect = Arc::clone(&tunnel_established);
let disconnect_requested = Arc::new(AtomicBool::new(false));
let disconnect_requested_on_signal = Arc::clone(&disconnect_requested);
tokio::spawn(async move {
shutdown_signal().await;
info!("Received the interrupt signal, disconnecting...");
disconnect_requested_on_signal.store(true, Ordering::SeqCst);
vpn_clone.disconnect();
});
@@ -403,7 +408,8 @@ impl ConnectHandler<'_> {
fs::remove_file(GP_CLIENT_LOCK_FILE).map_err(|err| GatewayConnectError::after_tunnel(err.into()))?;
}
classify_openconnect_result(connect_result, tunnel_established)
let disconnect_requested = disconnect_requested.load(Ordering::SeqCst);
classify_openconnect_result(connect_result, tunnel_established, disconnect_requested)
}
fn determine_hip_script(&self) -> (bool, Option<String>) {
@@ -427,11 +433,19 @@ impl ConnectHandler<'_> {
}
}
fn classify_openconnect_result(exit_code: i32, tunnel_established: bool) -> Result<(), GatewayConnectError> {
fn classify_openconnect_result(
exit_code: i32,
tunnel_established: bool,
disconnect_requested: bool,
) -> Result<(), GatewayConnectError> {
if exit_code == 0 {
return Ok(());
}
if disconnect_requested && exit_code == OPENCONNECT_INTERRUPTED_EXIT_CODE {
return Ok(());
}
let error = anyhow::anyhow!("OpenConnect exited with status {}", exit_code);
if tunnel_established {
Err(GatewayConnectError::after_tunnel(error))
@@ -477,20 +491,33 @@ mod tests {
#[test]
fn openconnect_success_is_not_a_gateway_failure() {
assert!(classify_openconnect_result(0, false).is_ok());
assert!(classify_openconnect_result(0, true).is_ok());
assert!(classify_openconnect_result(0, false, false).is_ok());
assert!(classify_openconnect_result(0, true, false).is_ok());
}
#[test]
fn openconnect_failure_before_callback_is_retryable_gateway_failure() {
let err = classify_openconnect_result(1, false).expect_err("nonzero exit should fail");
let err = classify_openconnect_result(1, false, false).expect_err("nonzero exit should fail");
assert!(err.is_before_tunnel());
}
#[test]
fn openconnect_failure_after_callback_is_terminal_gateway_failure() {
let err = classify_openconnect_result(1, true).expect_err("nonzero exit should fail");
let err = classify_openconnect_result(1, true, false).expect_err("nonzero exit should fail");
assert!(!err.is_before_tunnel());
}
#[test]
fn interrupted_exit_after_requested_disconnect_is_success() {
assert!(classify_openconnect_result(OPENCONNECT_INTERRUPTED_EXIT_CODE, true, true).is_ok());
}
#[test]
fn interrupted_exit_without_requested_disconnect_is_failure() {
let err = classify_openconnect_result(OPENCONNECT_INTERRUPTED_EXIT_CODE, true, false)
.expect_err("unexpected interrupt should fail");
assert!(!err.is_before_tunnel());
}
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## 2.6.3
### Fixed
- Fixed NixOS GUI launch authorization after package updates.
- Fixed disconnect handling so a normal Ctrl+C logout no longer reports an error.
- Fixed snapshot flake hash update automation for prebuilt Nix packages.
## 2.6.2
### Fixed
+32 -8
View File
@@ -26,6 +26,7 @@
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = "globalprotect-openconnect";
version = cargoToml.workspace.package.version;
releaseTag = "snapshot";
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
@@ -35,29 +36,29 @@
};
src = pkgs.fetchzip {
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v${version}/globalprotect-openconnect-${version}.tar.gz";
hash = "sha256-R7wS207jTujDYm4x7ucFY/cLvYw88zIVkVqRrCiEp80=";
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect-${version}.tar.gz";
hash = "sha256-fBoOcUPaiylhJc3P3x0cdmvUQwYO2e1xIPvq4NZ6hLc=";
};
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
gpguiHashes = {
x86_64 = "sha256-nD7311XzLXWutGcAvDbX3R3pnNiy6A6+fcDcmbP3Bg4=";
aarch64 = "sha256-MDQ9DOwZdQvR2q8kU6r5Fjw+nhsKrLyWvyhecJ4YhO8=";
x86_64 = "sha256-orhK5844Cebc+IKtYBdc1OekkvJJv1suBzc0n3TNn8g=";
aarch64 = "sha256-Lvdefh/ddk1TlWmVTluHFNZQbVAJrSkuYyzzDHcyIm0=";
};
gpgui = pkgs.fetchzip {
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v${version}/gpgui_${cpu}.bin.tar.xz";
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/gpgui_${cpu}.bin.tar.xz";
hash = gpguiHashes.${cpu};
};
binaryHashes = {
x86_64 = "sha256-MTv72Dx767ef+D+0EJZ5onGHdZxzF3AK8TTcxVWD/zM=";
aarch64 = "sha256-bKSebUMtRkQPmfP0sCKXcW3fyV2lvkBro6S2tmN2228=";
x86_64 = "sha256-/lvi+xF3xR8urBMkBI0R6aVSs34msarzTpkebH17TeU=";
aarch64 = "sha256-hMV4xTMC1k3klX5BBRw2ThvjYDDYZkFEld+rDMfd3qU=";
};
binaryPackage = pkgs.fetchzip {
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v${version}/globalprotect-openconnect_${version}_${cpu}.bin.tar.xz";
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect_${version}_${cpu}.bin.tar.xz";
hash = binaryHashes.${cpu};
};
@@ -117,6 +118,22 @@
fi
'';
installNixosPolkitRule = ''
chmod u+w $out/share $out/share/polkit-1 2>/dev/null || true
install -d $out/share/polkit-1/rules.d
cat > $out/share/polkit-1/rules.d/49-gpgui.rules <<EOF
polkit.addRule(function(action, subject) {
if (
action.id == "org.freedesktop.policykit.exec" &&
action.lookup("program") == "$out/bin/gpservice" &&
subject.active
) {
return polkit.Result.YES;
}
});
EOF
'';
fromSource = naersk'.buildPackage {
inherit pname version src;
@@ -168,6 +185,7 @@
cp -r packaging/files/usr/libexec $out/libexec
${rewriteSourceInstallPaths}
${installNixosPolkitRule}
'';
};
@@ -197,6 +215,8 @@
cp -r artifacts/usr/lib $out/lib
fi
install -Dm755 ${gpgui}/gpgui $out/bin/gpgui
runHook postInstall
'';
};
@@ -218,6 +238,9 @@
"--bind-try"
"/run/wrappers"
"/run/wrappers"
"--ro-bind-try"
"/etc/gpgui"
"/etc/gpgui"
];
};
@@ -327,6 +350,7 @@
fi
${rewriteHostInstallPaths}
${installNixosPolkitRule}
runHook postInstall
'';
+28 -2
View File
@@ -3,6 +3,7 @@
set -euo pipefail
release_version="${1:-}"
release_tag="${2:-}"
if git diff --quiet -- flake.nix; then
echo "flake.nix hashes are already up to date"
@@ -14,16 +15,41 @@ if [[ -z "$release_version" ]]; then
fi
version="${release_version#v}"
branch="chore/update-flake-hashes-v${version}"
if [[ -z "$release_tag" ]]; then
release_tag="v$version"
fi
branch_suffix="v${version}"
title="chore: update flake hashes for v${version}"
body="Updates the Nix flake fetchzip hashes for v${version} release assets."
if [[ "$release_tag" != "v$version" ]]; then
branch_suffix="${branch_suffix}-${release_tag}"
title="chore: update flake hashes for v${version} from ${release_tag}"
body="Updates the Nix flake fetchzip hashes for v${version} using ${release_tag} release assets."
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ "$release_tag" == "snapshot" ]]; then
source_branch="${GITHUB_REF_NAME:-$(git branch --show-current)}"
source_branch_slug="$(printf '%s' "$source_branch" | sed -E 's#[/[:space:]]+#-#g; s#[^A-Za-z0-9._-]##g; s#^-+##; s#-+$##')"
branch="chore/flake-${source_branch_slug}"
git switch -C "$branch"
git add flake.nix
git commit -m "$title"
git push --force origin "$branch"
echo "Updated snapshot flake hashes on branch $branch from $source_branch; skipping PR creation"
exit 0
fi
branch="chore/update-flake-hashes-${branch_suffix}"
git switch -C "$branch"
git add flake.nix
git commit -m "$title"
git push --force-with-lease origin "$branch"
git push --force origin "$branch"
if gh pr view "$branch" --json number > /tmp/flake-pr.json 2> /dev/null; then
pr_number="$(jq -r '.number' /tmp/flake-pr.json)"
+17 -4
View File
@@ -9,10 +9,11 @@ PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
FLAKE_FILE="$PROJECT_DIR/flake.nix"
usage() {
echo "Usage: $0 [version]"
echo "Usage: $0 [version] [release-tag]"
echo
echo "Updates flake.nix fetchzip hashes from the published GitHub release assets."
echo "When version is omitted, the workspace package version from Cargo.toml is used."
echo "When release-tag is omitted, v<version> is used. Use snapshot to test snapshot assets."
}
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
@@ -35,12 +36,21 @@ if [[ -z "$version" ]]; then
version="$(grep '^version' "$PROJECT_DIR/Cargo.toml" | head -1 | sed 's/version *= *"\(.*\)"/\1/')"
fi
version="${version#v}"
release_tag="${2:-}"
if [[ -z "$release_tag" ]]; then
release_tag="v$version"
fi
if [[ -z "$version" ]]; then
echo "Could not determine release version" >&2
exit 1
fi
if [[ -z "$release_tag" ]]; then
echo "Could not determine release tag" >&2
exit 1
fi
prefetch_hash() {
local url="$1"
local attempt
@@ -67,7 +77,7 @@ prefetch_hash() {
release_url() {
local asset="$1"
echo "https://github.com/$REPO/releases/download/v$version/$asset"
echo "https://github.com/$REPO/releases/download/$release_tag/$asset"
}
source_hash="$(prefetch_hash "$(release_url "globalprotect-openconnect-$version.tar.gz")")"
@@ -81,8 +91,10 @@ GPGUI_X86_64_HASH="$gpgui_x86_64_hash" \
GPGUI_AARCH64_HASH="$gpgui_aarch64_hash" \
BINARY_X86_64_HASH="$binary_x86_64_hash" \
BINARY_AARCH64_HASH="$binary_aarch64_hash" \
RELEASE_TAG="$release_tag" \
perl -0pi -e '
s|(url = "https://github\.com/yuezk/GlobalProtect-openconnect/releases/download/v\$\{version\}/globalprotect-openconnect-\$\{version\}\.tar\.gz";\n\s*hash = ")[^"]+(";)|$1 . $ENV{"SOURCE_HASH"} . $2|e;
s|(releaseTag = ")[^"]+(";)|$1 . $ENV{"RELEASE_TAG"} . $2|e;
s|(url = "https://github\.com/yuezk/GlobalProtect-openconnect/releases/download/\$\{releaseTag\}/globalprotect-openconnect-\$\{version\}\.tar\.gz";\n\s*hash = ")[^"]+(";)|$1 . $ENV{"SOURCE_HASH"} . $2|e;
s|(gpguiHashes = \{\n\s*x86_64 = ")[^"]+(";)|$1 . $ENV{"GPGUI_X86_64_HASH"} . $2|e;
s|(gpguiHashes = \{\n\s*x86_64 = "[^"]+";\n\s*aarch64 = ")[^"]+(";)|$1 . $ENV{"GPGUI_AARCH64_HASH"} . $2|e;
s|(binaryHashes = \{\n\s*x86_64 = ")[^"]+(";)|$1 . $ENV{"BINARY_X86_64_HASH"} . $2|e;
@@ -94,5 +106,6 @@ grep -F "$gpgui_x86_64_hash" "$FLAKE_FILE" > /dev/null
grep -F "$gpgui_aarch64_hash" "$FLAKE_FILE" > /dev/null
grep -F "$binary_x86_64_hash" "$FLAKE_FILE" > /dev/null
grep -F "$binary_aarch64_hash" "$FLAKE_FILE" > /dev/null
grep -F "releaseTag = \"$release_tag\";" "$FLAKE_FILE" > /dev/null
echo "Updated flake.nix hashes for v$version"
echo "Updated flake.nix hashes for v$version assets from $release_tag"