Compare commits

...
14 Commits
Author SHA1 Message Date
Kevin Yue e7384fb3f4 Release 3.7.0 2026-11-21 02:41:00 +08:00
Kevin Yue bacaf94cf2 Merge pull request #723 from yuezk/fix/gentoo-install-and-json
fix: use bundled JSON parser and document Gentoo installation
2026-11-20 13:26:05 +08:00
Kevin Yue 4ba50ca945 Document installation from the Gentoo overlay 2026-11-20 13:12:44 +08:00
Kevin Yue 0dc3ea7160 Use OpenConnect's bundled JSON parser 2026-11-20 13:12:44 +08:00
Kevin Yue a4aa4ef3e3 Merge pull request #720 from yuezk/chore/promote-v3.6.0
chore(release): promote 3.6.0 and validated Nix hashes
2026-11-20 00:54:29 +08:00
Kevin Yue ff537cec3a release: validate Nix packages for v3.6.0 2026-11-20 00:51:48 +08:00
Kevin Yue eb3cebf8a9 Release 3.6.0 2026-11-19 23:44:43 +08:00
Kevin Yue 92c19c55a3 fix(ci): verify the signed COPR RPM digest (#719) 2026-11-19 23:43:43 +08:00
Kevin Yue dc1376dbac Merge pull request #718 from yuezk/fix/nix-indicator-cleanup
fix(nix): remove stale tray dependencies and preserve release settings
2026-11-18 16:15:47 -08:00
Kevin Yue 15d85d1878 fix(nix): remove stale tray dependencies and preserve release settings 2026-11-19 08:13:22 +08:00
Kevin Yue 6edc93b579 Merge pull request #717 from yuezk/fix/release-publication-metadata
fix: verify current distribution metadata
2026-11-18 11:44:45 -08:00
Kevin Yue 1c34c52707 fix: verify current distribution metadata 2026-11-19 03:39:45 +08:00
Kevin Yue 287d0cc6af Merge pull request #715 from yuezk/chore/promote-v3.5.0
chore: promote GP Connect 3.5.0
2026-11-18 11:32:04 -08:00
Kevin Yue 5f4b2b602a release: validate Nix packages for v3.5.0 2026-11-19 03:15:45 +08:00
99 changed files with 3188 additions and 971 deletions

No files matched your search

+30 -20
View File
@@ -27,13 +27,14 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
platform:
- runner: ubuntu-24.04
arch: x86_64
- runner: ubuntu-24.04-arm
arch: aarch64
runs-on: ${{ matrix.runner }}
name: build (${{ matrix.arch }})
suffix: ['', '-musl']
runs-on: ${{ matrix.platform.runner }}
name: build (${{ matrix.platform.arch }}${{ matrix.suffix }})
timeout-minutes: 90
env:
CARGO_INCREMENTAL: '0'
@@ -62,6 +63,7 @@ jobs:
ref: ${{ inputs.gpgui_ref }}
path: source/gpgui
- name: Install Ubuntu 24.04 dependencies
if: matrix.suffix == ''
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake gettext libtool pkg-config \
@@ -69,8 +71,10 @@ jobs:
libgnutls28-dev liblz4-dev libwayland-dev libxkbcommon-dev libdbus-1-dev
pkg-config --exists gtk4 gnutls dbus-1 wayland-client xkbcommon
- name: Install the NSH compiler
if: matrix.suffix == ''
run: rustup toolchain install 1.97.0 --profile minimal
- name: Cache public crate downloads
if: matrix.suffix == ''
uses: actions/cache@v5
with:
path: |
@@ -79,33 +83,39 @@ jobs:
key: nsh-crates-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('source/gpgui/apps/desktop-nsh/Cargo.lock') }}
restore-keys: nsh-crates-${{ runner.os }}-${{ runner.arch }}-
- name: Build and package Native Shell
env:
LIBC_SUFFIX: ${{ matrix.suffix }}
run: |
trap 'code=$?; if [ "$code" -ne 0 ]; then echo "::error::Native Shell build failed; diagnostics suppressed."; fi' EXIT
(
set -euo pipefail
cd source/gpgui
cargo +1.97.0 build --manifest-path apps/desktop-nsh/Cargo.toml --locked \
--release --bin gpgui-nsh --target-dir target
target/release/gpgui-nsh --version
version="$(cargo +1.97.0 metadata --manifest-path apps/desktop-nsh/Cargo.toml --no-deps --format-version 1 \
| jq -r '.packages[] | select(.name == "gpgui-nsh") | .version')"
directory="gpgui-nsh_$version"
archive="gpgui-nsh_$(uname -m).bin.tar.xz"
mkdir -p ".build/package/$directory"
cp target/release/gpgui-nsh ".build/package/$directory/"
cp apps/desktop-nsh/ICU4X-LICENSE.txt ".build/package/$directory/ICU4X-LICENSE.txt"
if ldd target/release/gpgui-nsh | grep -q 'libicu'; then
echo "The release executable must not depend on ICU4C." >&2
exit 1
if [[ "$LIBC_SUFFIX" == "-musl" ]]; then
docker run --rm --user root -v "$PWD/source:/source" -w /source/gpgui \
-e GPGUI_BUILD_VERSION -e GPGUI_GIT_COMMIT -e GPGUI_UPDATE_CHANNEL \
-e GPGUI_LICENSE_SIGNING_KEYS -e CARGO_INCREMENTAL -e CARGO_BUILD_JOBS \
yuezk/gpdev:gpgui-alpine-builder-tauri2 bash -ec '
apk add --no-cache clang clang-dev gtk4.0-dev dbus-dev wayland-dev libxkbcommon-dev
rustup toolchain install 1.97.0 --profile minimal
../gp/scripts/build-linux-nsh.sh
'
else
cd source/gpgui
../gp/scripts/build-linux-nsh.sh
fi
tar -cJf ".build/package/$archive" -C .build/package "$directory"
sha256sum ".build/package/$archive" | cut -d ' ' -f 1 > ".build/package/$archive.sha256"
) >/dev/null 2>&1
echo "Native Shell build and version check passed."
- name: Verify musl archive on Alpine
if: matrix.suffix == '-musl'
run: |
docker run --rm -v "$PWD/source/gpgui/.build/package:/assets:ro" alpine:3.23 sh -ec '
apk add --no-cache gtk4.0 gnutls dbus-libs libgcc xz
tar -xJf "/assets/gpgui-nsh_$(uname -m)-musl.bin.tar.xz"
./gpgui-nsh_*/gpgui-nsh --version >/dev/null 2>&1
'
- name: Upload Native Shell
uses: actions/upload-artifact@v7
with:
name: artifact-gpgui-nsh-${{ matrix.arch }}
name: artifact-gpgui-nsh${{ matrix.suffix }}-${{ matrix.platform.arch }}
if-no-files-found: error
path: |
source/gpgui/.build/package/*.bin.tar.xz
+61 -7
View File
@@ -311,14 +311,19 @@ jobs:
if: ${{ !(startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.channel == 'stable')) }}
needs:
- tarball
- build-gpgui-glibc
- build-gpgui-musl
- build-gpgui-nsh
strategy:
fail-fast: false
matrix:
os:
- runner: ubuntu-latest
arch: amd64
uname: x86_64
- runner: ubuntu-24.04-arm
arch: ubuntu-24.04-arm
uname: aarch64
package: [deb, rpm, pkg, apk, binary, ubuntu-rolling]
runs-on: ${{ matrix.os.runner }}
name: build-gp (${{ matrix.package }}, ${{ matrix.os.arch }})
@@ -332,22 +337,41 @@ jobs:
with:
name: artifact-source
path: build-gp-${{ matrix.package }}
- name: Download Tauri for this package
uses: actions/download-artifact@v8
with:
name: artifact-gpgui${{ matrix.package == 'apk' && '-musl' || '' }}-${{ matrix.os.arch }}
path: gui-assets
- name: Download Native Shell for this package
uses: actions/download-artifact@v8
with:
name: artifact-gpgui-nsh${{ matrix.package == 'apk' && '-musl' || '' }}-${{ matrix.os.uname }}
path: gui-assets
- name: Build ${{ matrix.package }} package in Docker
# LIBXML2_STATIC is needed to avoid the dynamic linking issue on different distros
run: |
docker run --rm \
-e COREPACK_INTEGRITY_KEYS=0 \
-e LIBXML2_STATIC=1 \
-v $(pwd)/build-gp-${{ matrix.package }}:/workspace \
-e INCLUDE_GUI=1 \
-e GUI_ASSET_BASE=file:///gui-assets \
-v "$PWD/gui-assets:/gui-assets:ro" \
-v "$PWD/build-gp-${{ matrix.package }}:/workspace" \
yuezk/gpdev:${{ matrix.package }}-builder-tauri2
- name: Checkout package verification script
uses: actions/checkout@v6
with:
path: .ci
sparse-checkout: scripts
persist-credentials: false
- name: Install ${{ matrix.package }} package in Docker
run: |
docker run --rm \
-v "$PWD/.ci/scripts/verify-linux-package.sh:/verify-linux-package.sh:ro" \
-e COREPACK_INTEGRITY_KEYS=0 \
-e GPGUI_INSTALLED=0 \
-v $(pwd)/build-gp-${{ matrix.package }}:/workspace \
-v "$PWD/build-gp-${{ matrix.package }}:/workspace" \
yuezk/gpdev:${{ matrix.package }}-builder-tauri2 \
bash install.sh
bash -ec 'bash install.sh && bash /verify-linux-package.sh "$1"' _ "${{ matrix.package }}"
# Don't upload package for ubuntu-rolling because it's duplicate of deb package
- name: Upload ${{ matrix.package }} package
if: ${{ matrix.package != 'ubuntu-rolling' }}
@@ -498,16 +522,18 @@ jobs:
WINDOWS_UPDATE_PRIVATE_KEY: ${{ secrets.WINDOWS_UPDATE_PRIVATE_KEY }}
nix-source:
needs: [validate-inputs, build-gpgui-glibc]
needs: [validate-inputs, build-gpgui-glibc, build-gpgui-nsh]
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-latest
system: x86_64-linux
nsh_arch: x86_64
artifact_arch: amd64
- runner: ubuntu-24.04-arm
system: aarch64-linux
nsh_arch: aarch64
artifact_arch: ubuntu-24.04-arm
runs-on: ${{ matrix.platform.runner }}
name: nix-source (${{ matrix.platform.system }})
@@ -527,6 +553,11 @@ jobs:
with:
name: artifact-gpgui-${{ matrix.platform.artifact_arch }}
path: nix-artifacts/gui
- name: Download current Native Shell artifact
uses: actions/download-artifact@v8
with:
name: artifact-gpgui-nsh-${{ matrix.platform.nsh_arch }}
path: nix-artifacts/nsh
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Configure current source and GUI inputs
@@ -535,6 +566,9 @@ jobs:
gui_archive=$(find "$PWD/nix-artifacts/gui" -name '*.bin.tar.xz' -type f)
test -f "$gui_archive"
echo "GP_GUI_ARCHIVE=$gui_archive" >> "$GITHUB_ENV"
nsh_archive="$PWD/nix-artifacts/nsh/gpgui-nsh_${{ matrix.platform.nsh_arch }}.bin.tar.xz"
test -f "$nsh_archive"
echo "GP_NSH_ARCHIVE=$nsh_archive" >> "$GITHUB_ENV"
- name: Build source package
run: |
nix build --impure --file gp/nix/ci.nix source \
@@ -547,16 +581,18 @@ jobs:
--extra-experimental-features "nix-command flakes" --print-build-logs
nix-prebuilt:
needs: [validate-inputs, build-gp, build-gpgui-glibc]
needs: [validate-inputs, build-gp, build-gpgui-glibc, build-gpgui-nsh]
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-latest
system: x86_64-linux
nsh_arch: x86_64
artifact_arch: amd64
- runner: ubuntu-24.04-arm
system: aarch64-linux
nsh_arch: aarch64
artifact_arch: ubuntu-24.04-arm
nixpkgs: [locked, nixos-25.11, nixos-26.05, nixpkgs-unstable]
runs-on: ${{ matrix.platform.runner }}
@@ -582,6 +618,11 @@ jobs:
with:
name: artifact-gpgui-${{ matrix.platform.artifact_arch }}
path: nix-artifacts/gui
- name: Download current Native Shell artifact
uses: actions/download-artifact@v8
with:
name: artifact-gpgui-nsh-${{ matrix.platform.nsh_arch }}
path: nix-artifacts/nsh
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Configure current artifact inputs
@@ -593,6 +634,9 @@ jobs:
test -f "$gui_archive"
echo "GP_BINARY_ARCHIVE=$binary_archive" >> "$GITHUB_ENV"
echo "GP_GUI_ARCHIVE=$gui_archive" >> "$GITHUB_ENV"
nsh_archive="$PWD/nix-artifacts/nsh/gpgui-nsh_${{ matrix.platform.nsh_arch }}.bin.tar.xz"
test -f "$nsh_archive"
echo "GP_NSH_ARCHIVE=$nsh_archive" >> "$GITHUB_ENV"
- name: Build package through host NixOS module
run: |
nix build --impure --file gp/nix/ci.nix module \
@@ -603,10 +647,20 @@ jobs:
run: |
nix build --impure --file gp/nix/ci.nix prebuilt \
--extra-experimental-features "nix-command flakes" --print-build-logs
- name: Install and run downloaded Native Shell through the Nix installer
if: matrix.nixpkgs == 'locked'
run: |
gui_archive="$GP_NSH_ARCHIVE"
target="$RUNNER_TEMP/nix-gui-install/gpgui-nsh"
mkdir -p "$(dirname "$target")"
checksum=$(sha256sum "$gui_archive" | cut -d ' ' -f1)
result/libexec/gpclient/gp-gui-installer "$gui_archive" "$checksum" "$target"
test -L "$target"
test "$("$target" --version)" = "$(result/bin/gpgui-nsh --version)"
- name: Test prebuilt runtime in NixOS
if: matrix.nixpkgs == 'locked' && matrix.platform.system == 'x86_64-linux'
run: |
nix build --impure --file gp/nix/ci.nix runtime-prebuilt \
nix build --impure --file gp/nix/ci.nix runtime-prebuilt graphical-prebuilt \
--extra-experimental-features "nix-command flakes" --print-build-logs
build-macos:
-1
View File
@@ -112,7 +112,6 @@ jobs:
in
assert builtins.elem package
hostSystem.config.environment.systemPackages;
assert hostSystem.config.services.ayatana-indicators.enable;
package
'
+10 -3
View File
@@ -127,19 +127,26 @@ jobs:
# LIBXML2_STATIC is needed to avoid the dynamic linking issue on different distros
run: |
docker run --rm \
-v $(pwd)/build-${{ matrix.package }}:/workspace \
-v "$PWD/build-${{ matrix.package }}:/workspace" \
-e COREPACK_INTEGRITY_KEYS=0 \
-e LIBXML2_STATIC=1 \
-e INCLUDE_GUI=1 \
yuezk/gpdev:${{ matrix.package }}-builder-tauri2
- name: Checkout package verification script
uses: actions/checkout@v6
with:
path: .ci
sparse-checkout: scripts
persist-credentials: false
- name: Install ${{ matrix.package }} package in Docker
run: |
docker run --rm \
-v "$PWD/.ci/scripts/verify-linux-package.sh:/verify-linux-package.sh:ro" \
-e COREPACK_INTEGRITY_KEYS=0 \
-v $(pwd)/build-${{ matrix.package }}:/workspace \
-v "$PWD/build-${{ matrix.package }}:/workspace" \
yuezk/gpdev:${{ matrix.package }}-builder-tauri2 \
bash install.sh
bash -ec 'bash install.sh && bash /verify-linux-package.sh "$1"' _ "${{ matrix.package }}"
- name: Upload ${{ matrix.package }} package
uses: actions/upload-artifact@v7
@@ -62,6 +62,15 @@ jobs:
}, indent=2) + '\n')
PYRELEASE
- name: Verify all published Native Shell downloads before promotion
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.release.outputs.release_tag }}
run: |
gh release download "$RELEASE_TAG" --repo yuezk/GlobalProtect-openconnect \
--pattern 'gpgui-nsh_*.bin.tar.xz*' --dir "$RUNNER_TEMP/nsh-release"
scripts/verify-linux-nsh-assets.sh "$RUNNER_TEMP/nsh-release"
- name: Install Nix
uses: cachix/install-nix-action@v31
+2
View File
@@ -19,3 +19,5 @@ result
# Packages & test assets
*.ipa
__pycache__
Generated
+41 -60
View File
@@ -292,7 +292,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "auth"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"block2",
@@ -322,7 +322,7 @@ dependencies = [
"webview2-com",
"windows",
"windows-sys 0.61.2",
"winreg 0.55.0",
"winreg",
]
[[package]]
@@ -554,14 +554,14 @@ dependencies = [
[[package]]
name = "browser-launcher"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"log",
"open",
"webbrowser",
"which",
"winreg 0.55.0",
"winreg",
]
[[package]]
@@ -919,7 +919,7 @@ dependencies = [
[[package]]
name = "common"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"tempfile",
]
@@ -1559,7 +1559,7 @@ dependencies = [
"rustc_version",
"toml 1.1.8+spec-1.1.0",
"vswhom",
"winreg 0.56.0",
"winreg",
]
[[package]]
@@ -1629,7 +1629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -2133,7 +2133,7 @@ dependencies = [
[[package]]
name = "gp-xml"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"url",
"xmltree",
@@ -2141,7 +2141,7 @@ dependencies = [
[[package]]
name = "gpapi"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"base64 0.23.1",
@@ -2205,7 +2205,7 @@ dependencies = [
[[package]]
name = "gpauth"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"auth",
@@ -2223,7 +2223,7 @@ dependencies = [
[[package]]
name = "gpclient"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"clap",
@@ -2254,7 +2254,7 @@ dependencies = [
[[package]]
name = "gpgui-helper"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"clap",
@@ -2275,7 +2275,7 @@ dependencies = [
[[package]]
name = "gphip"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"askama",
@@ -2294,7 +2294,7 @@ dependencies = [
[[package]]
name = "gpservice"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"anyhow",
"axum",
@@ -2332,7 +2332,7 @@ dependencies = [
[[package]]
name = "gptunnel"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"gpapi",
"log",
@@ -2344,7 +2344,7 @@ dependencies = [
[[package]]
name = "gpvpnc"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"base64 0.23.1",
"ipnet",
@@ -2354,7 +2354,7 @@ dependencies = [
"tempfile",
"uuid",
"windows-sys 0.61.2",
"winreg 0.56.0",
"winreg",
]
[[package]]
@@ -3860,7 +3860,7 @@ dependencies = [
[[package]]
name = "openconnect"
version = "3.5.0"
version = "3.7.0"
dependencies = [
"autotools",
"cc",
@@ -4713,7 +4713,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -4778,7 +4778,7 @@ dependencies = [
"security-framework",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -5648,9 +5648,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]]
name = "tauri"
version = "2.12.5"
version = "2.12.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fb0244332cfb9cee7e2a568bf5da29a36ed8fdbd717f6f47a66b6b7b358c072"
checksum = "30fbfbb9dc9a2697b0e96d909ddc295fb18d2d82a58ed542ab8d9eba2edbe6da"
dependencies = [
"anyhow",
"bytes",
@@ -5699,9 +5699,9 @@ dependencies = [
[[package]]
name = "tauri-build"
version = "2.7.4"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adddb0e648752aaac5da9c3c3c6a68e1e87cab55e3b757b18a9441ef8c3ac614"
checksum = "73d80784e874fa117b9b00a6680cf2f9b8a51bbd14406bea980cf8f328b00646"
dependencies = [
"anyhow",
"cargo_toml",
@@ -5722,9 +5722,9 @@ dependencies = [
[[package]]
name = "tauri-codegen"
version = "2.7.4"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb37631cf71dab5e8ab55e1bdd701e18a52653d90b78e71d0e5598b1e0a61316"
checksum = "c5dc6caab4da5646f57648f39b794bae118f0dd4a4305eeb8c892966171f4852"
dependencies = [
"base64 0.23.1",
"brotli",
@@ -5737,7 +5737,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"sha2 0.10.9",
"sha2 0.11.1",
"syn 2.0.119",
"tauri-utils",
"thiserror 2.0.21",
@@ -5749,9 +5749,9 @@ dependencies = [
[[package]]
name = "tauri-macros"
version = "2.7.4"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0cc38db58854c10fb5f91a887ed8bf82d3239bb92b5d8db86eda09e96d9963d1"
checksum = "2831c5da8603a96b1efc0b650c2cb6decc69b6cda257d815fe70c7f5be53818e"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -5763,9 +5763,9 @@ dependencies = [
[[package]]
name = "tauri-runtime"
version = "2.12.2"
version = "2.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c55766d99cea69055904d1735b93c2049302b2e09effd462120deb5581d78e9"
checksum = "60c2b14bd5265b63993cdc34ad526fb836e0fd0cf64a4634a895db0784844d5e"
dependencies = [
"cookie",
"dpi",
@@ -5788,9 +5788,9 @@ dependencies = [
[[package]]
name = "tauri-runtime-wry"
version = "2.12.3"
version = "2.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f"
checksum = "b8c14a025255cc9816d401635035075b09b6cc9973b7b8fd7b8fcb8753f30f92"
dependencies = [
"gtk",
"http",
@@ -5813,9 +5813,9 @@ dependencies = [
[[package]]
name = "tauri-utils"
version = "2.10.2"
version = "2.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "362ab21cd4cc713f2a02b1a9b5688198b1541cfb6907c4281e9190e0f0ef4aa3"
checksum = "28d1d33d4453c5df0bf1672dbc7ada69d8ed74f56a4316d964a4aa73d4ecd3ad"
dependencies = [
"anyhow",
"brotli",
@@ -5870,7 +5870,7 @@ dependencies = [
"getrandom 0.4.3",
"once_cell",
"rustix",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -6413,9 +6413,9 @@ checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6"
[[package]]
name = "uuid"
version = "1.29.0"
version = "1.29.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514"
checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64"
dependencies = [
"getrandom 0.4.3",
"js-sys",
@@ -6795,7 +6795,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@@ -6961,15 +6961,6 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-sys"
version = "0.61.2"
@@ -7136,16 +7127,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "winreg"
version = "0.55.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97"
dependencies = [
"cfg-if",
"windows-sys 0.59.0",
]
[[package]]
name = "winreg"
version = "0.56.0"
@@ -7361,9 +7342,9 @@ dependencies = [
[[package]]
name = "zeroize"
version = "1.9.1"
version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa"
dependencies = [
"serde",
]
+1 -1
View File
@@ -11,7 +11,7 @@ members = [
[workspace.package]
rust-version = "1.91"
version = "3.5.0"
version = "3.7.0"
authors = ["Kevin Yue <[email protected]>"]
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
edition = "2024"
+27 -17
View File
@@ -21,6 +21,7 @@ SOURCE_COMMIT_VALUE := $(shell \
git rev-parse --short=9 HEAD 2>/dev/null || printf unknown; \
fi)
GUI_LIBC_SUFFIX ?= $(shell ldd --version 2>&1 | grep -qi musl && echo -musl || true)
GUI_ASSET_BASE ?= https://github.com/yuezk/GlobalProtect-openconnect/releases/download/$(RELEASE_TAG)
REVISION ?= 1
RPM_SOURCE ?= %{name}.tar.gz
@@ -33,16 +34,21 @@ PUBLISH ?= 0
# Indicates whether to build the GUI components
BUILD_GUI_HELPER ?= 1
# Indicates whether to build embedded webview auth support into gpauth
# Build embedded webview authentication support into gpclient and gpauth
BUILD_WEBVIEW_AUTH ?= 1
ifneq ($(BUILD_WEBVIEW_AUTH),1)
AUTH_FEATURE_ARGS = --no-default-features
endif
ifeq ($(shell uname -s),Linux)
PREFIX ?= /usr
GPGUI_BINARY ?= $(wildcard .build/gpgui/gpgui_*/gpgui)
GPGUI_BINARY ?= .build/gpgui/gpgui_$(VERSION)/gpgui
else ifeq ($(shell uname -s)-$(shell uname -m),Darwin-arm64)
PREFIX ?= /opt/homebrew
else
PREFIX ?= /usr/local
endif
NSH_BUNDLE_DIR = .build/gpgui/gpgui-nsh_$(VERSION)
BSD_FLAVOR ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
GPGUI_BINARY ?= ../gpgui/target/release/gpgui
@@ -109,9 +115,14 @@ download-gui:
if [ $(INCLUDE_GUI) -eq 1 ]; then \
echo "Downloading GlobalProtect GUI..."; \
mkdir -p .build/gpgui; \
curl -sSL https://github.com/yuezk/GlobalProtect-openconnect/releases/download/$(RELEASE_TAG)/gpgui_$(shell uname -m)$(GUI_LIBC_SUFFIX).bin.tar.xz \
-o .build/gpgui/gpgui_$(shell uname -m)$(GUI_LIBC_SUFFIX).bin.tar.xz; \
tar -xJf .build/gpgui/*.tar.xz -C .build/gpgui; \
set -e; cd .build/gpgui; \
for gui in gpgui gpgui-nsh; do \
archive="$${gui}_$(shell uname -m)$(GUI_LIBC_SUFFIX).bin.tar.xz"; \
curl -fsSL "$(GUI_ASSET_BASE)/$$archive" -o "$$archive"; \
digest=$$(curl -fsSL "$(GUI_ASSET_BASE)/$$archive.sha256"); \
printf '%s %s\n' "$$digest" "$$archive" | sha256sum -c -; \
tar -xJf "$$archive"; \
done; \
else \
echo "Skipping GlobalProtect GUI download (INCLUDE_GUI=0)"; \
fi
@@ -128,14 +139,7 @@ build-rs:
rm -vf rust-toolchain.toml; \
fi
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice
# Build gpauth with or without embedded webview auth support
if [ $(BUILD_WEBVIEW_AUTH) -eq 1 ]; then \
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpauth; \
else \
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpauth --no-default-features; \
fi
$(CARGO) build $(CARGO_BUILD_ARGS) $(AUTH_FEATURE_ARGS) -p gpclient -p gpservice -p gpauth
# Only build the GUI components if BUILD_GUI_HELPER is set to 1
if [ $(BUILD_GUI_HELPER) -eq 1 ]; then \
@@ -197,6 +201,12 @@ install-unix: install-gpclient-unix
done
install-linux: install-unix
ifeq ($(INCLUDE_GUI),1)
test -x "$(GPGUI_BINARY)"
install -m 755 "$(NSH_BUNDLE_DIR)/gpgui-nsh" "$(DESTDIR)$(PREFIX)/bin/gpgui-nsh"
install -d "$(DESTDIR)$(PREFIX)/share/licenses/$(PKG_NAME)"
install -m 644 "$(NSH_BUNDLE_DIR)/ICU4X-LICENSE.txt" "$(DESTDIR)$(PREFIX)/share/licenses/$(PKG_NAME)/"
endif
@echo "Installing Linux integration under $(PREFIX)..."
set -e; for file in share/applications/gpgui.desktop \
share/applications/gpgui-helper.desktop \
@@ -327,6 +337,8 @@ uninstall-unix:
rmdir "$(DESTDIR)$(PREFIX)/libexec/gpclient" 2>/dev/null || true
uninstall-linux: uninstall-unix
rm -f "$(DESTDIR)$(PREFIX)/bin/gpgui-nsh" "$(DESTDIR)$(PREFIX)/share/licenses/$(PKG_NAME)/ICU4X-LICENSE.txt"
rmdir "$(DESTDIR)$(PREFIX)/share/licenses/$(PKG_NAME)" 2>/dev/null || true
rm -f "$(DESTDIR)$(PREFIX)/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down" \
"$(DESTDIR)$(PREFIX)/lib/NetworkManager/dispatcher.d/gpclient-nm-hook"
rm -f "$(DESTDIR)/var/lib/gpclient/gpgui" \
@@ -362,7 +374,6 @@ init-debian: clean-debian tarball
# Remove the GUI dependencies if neither GUI component is included
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
sed -i "/libsecret-1-0/d" .build/deb/$(PKG)/debian/control; \
sed -i "/libayatana-appindicator3-1/d" .build/deb/$(PKG)/debian/control; \
sed -i "/gnome-keyring/d" .build/deb/$(PKG)/debian/control; \
fi
@@ -430,7 +441,7 @@ rpm: init-rpm tarball
rpmdev-setuptree
cp .build/tarball/${PKG}.tar.gz $(HOME)/rpmbuild/SOURCES/${PKG_NAME}.tar.gz
rpmbuild -ba .build/rpm/globalprotect-openconnect.spec
rpmbuild --define "include_gui $(INCLUDE_GUI)" -ba .build/rpm/globalprotect-openconnect.spec
# Copy RPM package from build directory
cp $(HOME)/rpmbuild/RPMS/$(shell uname -m)/$(PKG_NAME)*.rpm .build/rpm
@@ -475,7 +486,6 @@ init-apk: clean-apk tarball
# Remove the GUI dependencies if neither GUI component is included
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
sed -i "/^\tlibayatana-appindicator$$/d" .build/apk/APKBUILD; \
sed -i "/^\tlibsecret$$/d" .build/apk/APKBUILD; \
fi
@@ -501,7 +511,7 @@ binary: clean-binary tarball
mkdir -p .build/binary/$(PKG_NAME)_$(VERSION)/artifacts
make -C .build/binary/${PKG} build INCLUDE_GUI=$(INCLUDE_GUI)
make -C .build/binary/${PKG} install DESTDIR=$(PWD)/.build/binary/$(PKG_NAME)_$(VERSION)/artifacts
make -C .build/binary/${PKG} install INCLUDE_GUI=$(INCLUDE_GUI) DESTDIR=$(PWD)/.build/binary/$(PKG_NAME)_$(VERSION)/artifacts
cp packaging/binary/Makefile.in .build/binary/$(PKG_NAME)_$(VERSION)/Makefile
+22 -19
View File
@@ -1,6 +1,6 @@
# GlobalProtect-openconnect
A GlobalProtect VPN client built on OpenConnect. GP Connect runs on Windows, macOS, Linux, FreeBSD, and OpenBSD. Command-line tools (`gpclient`) are available on macOS, Linux, and BSD.
A GlobalProtect VPN client built on OpenConnect. GP Connect runs on Windows, macOS, Linux, FreeBSD, and OpenBSD.
> **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.
@@ -88,22 +88,17 @@ Run `gpclient --help` or `gpclient <command> --help` to view all available comma
```
> [!TIP]
> **On Linux, try Native Shell for lower memory usage.** Switch between Native Shell and Tauri in **Settings → General → Interface**.
> 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
### Windows
Download the matching EXE installer from [GitHub Releases](https://github.com/yuezk/GlobalProtect-openconnect/releases/latest):
- **x64**: Windows 10 version 2004 (build 19041) or later.
- **ARM64**: Windows 11.
Run the installer and confirm installation. It installs GP Connect and its background VPN service for all users; administrator access is required. Open GP Connect from the Start menu as your normal user.
The installer and application executables are signed by **Tangramly, LLC**. Embedded sign-in uses Microsoft Edge WebView2 Runtime. You can also use your system browser from Settings.
GP Connect checks for updates in the app. Uninstall it from Windows Settings; your app settings are kept. The Windows package contains the desktop app and service, without the `gpclient` command-line tool.
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
@@ -168,7 +163,7 @@ Download the latest `.apk` package from the [releases](https://github.com/yuezk/
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
```
*(Requires `community` repository enabled for WebKitGTK and AppIndicator dependencies).*
*(Requires the `community` repository for WebKitGTK dependencies).*
### FreeBSD
@@ -188,14 +183,22 @@ doas pkg_add -D unsigned ./globalprotect-openconnect-*-openbsd-*.tgz
### Gentoo
Available via the `guru` repository:
Add the overlay:
```bash
sudo eselect repository enable guru
sudo emerge --sync guru
sudo emerge --ask net-vpn/GlobalProtect-openconnect
sudo emerge --ask app-eselect/eselect-repository dev-vcs/git
sudo eselect repository add yuezk git https://github.com/yuezk/gentoo-overlay.git
sudo emerge --sync yuezk
```
Install the prebuilt package (glibc):
```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.
### NixOS
Add the flake to your `flake.nix`:
@@ -251,7 +254,7 @@ sudo make install
- [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` (or GTK 4 for Native Shell)
- 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
*(For FreeBSD and OpenBSD instructions, see [Building from Source on FreeBSD and OpenBSD](docs/bsd-source-build.md)).*
@@ -268,7 +271,7 @@ sudo make install
**Build Options:**
- `INCLUDE_GUI=1` – Download and install the matching desktop application bundle.
- `BUILD_WEBVIEW_AUTH=0` – Build `gpauth` without embedded browser authentication (uses external browser or manual mode).
- `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
+14
View File
@@ -270,7 +270,21 @@ fn init_logger(cli: &Cli) {
}
pub async fn run() {
#[cfg(not(windows))]
let cli = Cli::parse();
#[cfg(windows)]
let cli = match gpapi::process::auth_bootstrap::receive_arguments().await {
Ok(Some(args)) => Cli::parse_from(
std::env::args_os()
.take(1)
.chain(args.into_iter().map(std::ffi::OsString::from)),
),
Ok(None) => Cli::parse(),
Err(error) => {
eprintln!("Could not read Windows authentication launch arguments: {error}");
std::process::exit(1);
}
};
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
if let Some(CliCommand::AuthCallback { callback }) = &cli.command {
+10 -8
View File
@@ -18,25 +18,27 @@ clap.workspace = true
env_logger.workspace = true
inquire = "0.9"
log.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread"] }
tokio-util.workspace = true
serde.workspace = true
serde_json.workspace = true
compile-time.workspace = true
[target.'cfg(unix)'.dependencies]
directories.workspace = true
nix = { version = "0.31", features = ["fs", "signal", "process", "poll", "term"] }
ratatui = { version = "=0.30.2", default-features = false, features = ["crossterm", "unstable-rendered-line-info"] }
crossterm = { version = "0.29", features = ["use-dev-tty"] }
strip-ansi-escapes = "0.2"
tokio = { workspace = true, features = ["rt-multi-thread"] }
tokio-util.workspace = true
sysinfo.workspace = true
serde.workspace = true
serde_json.workspace = true
whoami.workspace = true
directories.workspace = true
compile-time.workspace = true
uzers.workspace = true
whoami.workspace = true
[features]
default = ["webview-auth"]
webview-auth = ["gpapi/webview-auth"]
[target.'cfg(target_os = "macos")'.dependencies]
[target.'cfg(any(target_os = "macos", windows))'.dependencies]
gpvpnc = { path = "../../crates/gpvpnc" }
[dev-dependencies]
+128 -41
View File
@@ -1,8 +1,10 @@
#[cfg(unix)]
use std::{
path::{Path, PathBuf},
str::FromStr,
};
#[cfg(unix)]
use anyhow::bail;
use clap::{Parser, Subcommand};
use gpapi::{
@@ -10,17 +12,22 @@ use gpapi::{
log_format::{LogFormat, write_json_record},
};
use log::info;
#[cfg(unix)]
use sysinfo::{Pid, System};
#[cfg(unix)]
use tokio::fs;
#[cfg(unix)]
use crate::{
GP_CLIENT_LOCK_FILE,
connect::{ConnectArgs, ConnectHandler},
diagnostics::DiagnosticsArgs,
disconnect::{DisconnectArgs, DisconnectHandler},
hip::{HipArgs, HipHandler},
launch_gui::{LaunchGuiArgs, LaunchGuiHandler},
};
use crate::{
connect::{ConnectArgs, ConnectHandler},
hip::{HipArgs, HipHandler},
};
const VERSION: &str = concat!(
env!("CARGO_PKG_VERSION"),
@@ -33,7 +40,10 @@ const VERSION: &str = concat!(
pub(crate) struct SharedArgs<'a> {
pub(crate) ignore_tls_errors: bool,
#[cfg(unix)]
pub(crate) lock_file: &'a Path,
#[cfg(windows)]
pub(crate) system_tunnel: std::cell::RefCell<Option<gpvpnc::windows::SystemTunnel>>,
pub(crate) verbose: &'a InfoLevelVerbosity,
pub(crate) log_format: LogFormat,
}
@@ -42,12 +52,15 @@ pub(crate) struct SharedArgs<'a> {
enum CliCommand {
#[command(about = "Connect to a portal server")]
Connect(Box<ConnectArgs>),
#[cfg(unix)]
#[command(about = "Disconnect from the server")]
Disconnect(DisconnectArgs),
#[cfg(unix)]
#[command(about = "Launch the GUI")]
LaunchGui(LaunchGuiArgs),
#[command(about = "Generate HIP report")]
Hip(HipArgs),
#[cfg(unix)]
#[command(about = "Collect system diagnostics for a bug report without connecting to a VPN")]
Diagnostics(DiagnosticsArgs),
#[command(hide = true)]
@@ -89,11 +102,12 @@ struct Cli {
#[command(subcommand)]
command: CliCommand,
#[cfg(not(target_os = "macos"))]
#[cfg(all(unix, not(target_os = "macos")))]
#[arg(long, hide = true)]
fix_openssl: bool,
#[arg(long, help = "Ignore the TLS errors")]
ignore_tls_errors: bool,
#[cfg(unix)]
#[arg(
long,
global = true,
@@ -102,6 +116,7 @@ struct Cli {
)]
lock_file: PathBuf,
#[cfg(unix)]
#[arg(long, hide = true, global = true)]
background_worker_fd: Option<i32>,
@@ -128,6 +143,7 @@ impl Args for Cli {
}
impl Cli {
#[cfg(unix)]
fn can_run_alongside_client(&self) -> bool {
match &self.command {
CliCommand::Connect(_) => false,
@@ -136,6 +152,7 @@ impl Cli {
}
}
#[cfg(unix)]
async fn is_running(&self) -> bool {
let Ok(c) = fs::read_to_string(&self.lock_file).await else {
return false;
@@ -156,50 +173,67 @@ impl Cli {
}
async fn run(&self) -> anyhow::Result<()> {
#[cfg(not(target_os = "macos"))]
#[cfg(all(unix, not(target_os = "macos")))]
if self.fix_openssl
&& !(matches!(&self.command, CliCommand::Connect(args) if args.background) && self.background_worker_fd.is_none())
{
log::warn!("--fix-openssl is deprecated and has no effect. It will be removed in a future release.");
}
if let CliCommand::Connect(args) = &self.command {
if args.dashboard {
crate::dashboard::validate(self.log_format)?;
#[cfg(unix)]
let background_worker = {
if let CliCommand::Connect(args) = &self.command {
if args.dashboard {
crate::dashboard::validate(self.log_format)?;
}
}
if self.background_worker_fd.is_some() && !matches!(&self.command, CliCommand::Connect(args) if args.background) {
bail!("Background worker requires connect --background");
}
if let CliCommand::Diagnostics(args) = &self.command {
return args.run(VERSION).await;
}
}
if self.background_worker_fd.is_some() && !matches!(&self.command, CliCommand::Connect(args) if args.background) {
bail!("Background worker requires connect --background");
}
if let CliCommand::Diagnostics(args) = &self.command {
return args.run(VERSION).await;
}
// check if an instance is running
if !self.can_run_alongside_client() && self.is_running().await {
bail!("Another instance of the client is already running");
}
// check if an instance is running
if !self.can_run_alongside_client() && self.is_running().await {
bail!("Another instance of the client is already running");
}
let background_worker = if let CliCommand::Connect(args) = &self.command {
if args.background {
let log_file = args
.log_file
.as_deref()
.unwrap_or_else(|| Path::new("/var/log/gpclient.log"));
match self.background_worker_fd {
Some(fd) => Some(crate::background::BackgroundWorker::new(fd, log_file)?),
None => return crate::background::start(log_file, self.log_format).await,
if let CliCommand::Connect(args) = &self.command {
if args.background {
let log_file = args
.log_file
.as_deref()
.unwrap_or_else(|| Path::new("/var/log/gpclient.log"));
match self.background_worker_fd {
Some(fd) => Some(crate::background::BackgroundWorker::new(fd, log_file)?),
None => return crate::background::start(log_file, self.log_format).await,
}
} else {
None
}
} else {
None
}
} else {
None
};
#[cfg(windows)]
let system_tunnel = match &self.command {
CliCommand::Connect(args) if !args.cookie_only => {
anyhow::ensure!(
gpapi::windows::is_elevated()?,
"Run gpclient connect from an administrator terminal"
);
Some(gpvpnc::windows::SystemTunnel::acquire()?)
}
_ => None,
};
let shared_args = SharedArgs {
ignore_tls_errors: self.ignore_tls_errors,
#[cfg(unix)]
lock_file: &self.lock_file,
#[cfg(windows)]
system_tunnel: system_tunnel.into(),
verbose: &self.verbose,
log_format: self.log_format,
};
@@ -210,14 +244,17 @@ impl Cli {
match &self.command {
CliCommand::Connect(args) => {
ConnectHandler::new(args, &shared_args)
.with_background(background_worker)
.handle()
.await
let handler = ConnectHandler::new(args, &shared_args);
#[cfg(unix)]
let handler = handler.with_background(background_worker);
handler.handle().await
}
#[cfg(unix)]
CliCommand::Disconnect(args) => DisconnectHandler::new(args, shared_args.lock_file).handle().await,
#[cfg(unix)]
CliCommand::LaunchGui(args) => LaunchGuiHandler::new(args).handle().await,
CliCommand::Hip(args) => HipHandler::new(args).handle().await,
#[cfg(unix)]
CliCommand::Diagnostics(_) => unreachable!("diagnostics is dispatched before VPN setup"),
CliCommand::DetectInternalHost { address, hostname } => {
let internal = gpapi::session::desktop::network::native::detect_in_helper(*address, hostname)?;
@@ -250,17 +287,20 @@ fn build_logger(cli: &Cli) -> env_logger::Builder {
builder
}
pub(crate) async fn run() {
let cli = Cli::parse();
fn initialize_logger(cli: &Cli) {
#[cfg(unix)]
if matches!(&cli.command, CliCommand::Connect(args) if args.dashboard) {
let logger = build_logger(&cli).build();
let logger = build_logger(cli).build();
log::set_max_level(logger.filter());
log::set_boxed_logger(Box::new(crate::dashboard::NoticeLogger::new(logger))).expect("failed to initialize logger");
} else {
build_logger(&cli).init();
return;
}
build_logger(cli).init();
}
pub(crate) async fn run() {
let cli = Cli::parse();
initialize_logger(&cli);
info!("gpclient started: {}", VERSION);
if let Err(err) = cli.run().await {
@@ -269,7 +309,7 @@ pub(crate) async fn run() {
}
}
#[cfg(test)]
#[cfg(all(test, unix))]
mod tests {
use std::{
io::Write,
@@ -360,7 +400,7 @@ mod tests {
fn diagnostics_accepts_output_options_and_runs_alongside_the_client() {
let cli = Cli::try_parse_from([
"gpclient",
#[cfg(not(target_os = "macos"))]
#[cfg(all(unix, not(target_os = "macos")))]
"--fix-openssl",
"diagnostics",
"--json",
@@ -446,6 +486,25 @@ mod tests {
assert!(cli.can_run_alongside_client());
}
#[test]
#[cfg(target_os = "linux")]
fn launch_gui_interface_accepts_minimized_launch_but_not_an_auth_callback() {
for variant in ["tauri", "nsh"] {
assert!(Cli::try_parse_from(["gpclient", "launch-gui", "--interface", variant, "--minimized"]).is_ok());
assert!(
Cli::try_parse_from([
"gpclient",
"launch-gui",
"--interface",
variant,
"globalprotectcallback:token"
])
.is_err()
);
}
assert!(Cli::try_parse_from(["gpclient", "launch-gui", "--interface", "unknown"]).is_err());
}
#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
fn launch_gui_rejects_callback_with_minimized() {
@@ -593,3 +652,31 @@ mod tests {
);
}
}
#[cfg(all(test, windows))]
mod windows_tests {
use super::*;
#[test]
fn terminal_auth_and_generated_hip_are_available() {
assert!(Cli::try_parse_from(["gpclient", "connect", "vpn.example.com", "--cookie-only", "--hip"]).is_ok());
}
#[test]
fn unix_only_workflows_are_unavailable() {
for flag in [
"--background",
"--dashboard",
"--lock-file",
"--script",
"--hip-user",
"--script-tun",
] {
assert!(
Cli::try_parse_from(["gpclient", "connect", "vpn.example.com", flag]).is_err(),
"{flag}"
);
}
assert!(Cli::try_parse_from(["gpclient", "disconnect"]).is_err());
}
}
+18 -3
View File
@@ -13,6 +13,7 @@ pub(crate) struct ConnectArgs {
#[arg(help = "The portal server to connect to")]
pub(super) server: String,
#[cfg(unix)]
#[arg(
long,
conflicts_with = "cookie_only",
@@ -20,6 +21,7 @@ pub(crate) struct ConnectArgs {
)]
pub(crate) background: bool,
#[cfg(unix)]
#[arg(
long,
conflicts_with_all = ["background", "cookie_only"],
@@ -27,6 +29,7 @@ pub(crate) struct ConnectArgs {
)]
pub(crate) dashboard: bool,
#[cfg(unix)]
#[arg(
long,
requires = "background",
@@ -61,18 +64,21 @@ pub(crate) struct ConnectArgs {
)]
pub(super) cookie_cache: Option<String>,
#[cfg(unix)]
#[arg(long, short, help = "The VPNC script to use", required_if_eq("script_tun", "true"))]
pub(super) script: Option<String>,
#[arg(long, short, help = "The IFNAME for tunnel interface")]
pub(super) interface: Option<String>,
#[cfg(unix)]
#[arg(long, short = 'S', help = "Pass traffic to '--script' program, not tun")]
pub(super) script_tun: bool,
#[arg(long, help = "Connect the server as a gateway, instead of a portal")]
pub(super) as_gateway: bool,
#[cfg(unix)]
#[arg(
long,
help = "Enable HIP (Host Information Profile), optionally specify a custom executable",
@@ -81,6 +87,11 @@ pub(crate) struct ConnectArgs {
)]
pub(super) hip: Option<String>,
#[cfg(windows)]
#[arg(long, help = "Generate a HIP (Host Information Profile) report")]
pub(super) hip: bool,
#[cfg(unix)]
#[arg(
long,
help = "Run a custom HIP executable as this user; otherwise inherit the process user"
@@ -100,9 +111,11 @@ pub(crate) struct ConnectArgs {
#[arg(short = 'p', long, help = "The key passphrase of the private key")]
pub(super) key_password: Option<String>,
#[cfg(unix)]
#[arg(long, hide = true)]
pub(super) csd_user: Option<String>,
#[cfg(unix)]
#[arg(long, hide = true)]
pub(super) csd_wrapper: Option<String>,
@@ -188,7 +201,7 @@ pub(crate) struct ConnectArgs {
VPN tunnel. Outputs two lines: COOKIE='<value>' and HOST='<gateway>'. Combine with \
--cookie-cache to avoid re-authenticating when the portal session is still valid."
)]
pub(super) cookie_only: bool,
pub(crate) cookie_only: bool,
}
pub(super) fn build_os_profile(args: &ConnectArgs) -> OsProfile {
@@ -207,17 +220,19 @@ pub(super) fn build_os_profile_with_host_id(args: &ConnectArgs, host_id: Option<
}
pub(super) fn cookie_cache_path(args: &ConnectArgs) -> Option<PathBuf> {
args.cookie_cache.as_deref().map(|path| {
args.cookie_cache.as_deref().and_then(|path| {
let custom = (!path.is_empty()).then_some(path);
cookie_store::cookie_path(custom)
})
}
pub(super) fn warn_deprecated_connect_args(args: &ConnectArgs) {
#[cfg(unix)]
if args.csd_user.is_some() {
warn!("Deprecated option --csd-user will be removed; use --hip-user instead");
}
#[cfg(unix)]
if args.csd_wrapper.is_some() {
warn!("Deprecated option --csd-wrapper will be removed; use --hip instead");
}
@@ -231,7 +246,7 @@ pub(super) fn warn_deprecated_connect_args(args: &ConnectArgs) {
}
}
#[cfg(test)]
#[cfg(all(test, unix))]
mod tests {
use super::*;
+2
View File
@@ -178,6 +178,8 @@ impl ConnectHandler<'_> {
}
}
#[cfg(windows)]
let auth_launcher = auth_launcher.with_windows_cli_launch();
let cred = auth_launcher.cancellation(&self.cancellation).launch().await?;
self.check_cancelled()?;
Ok(cred)
+65 -66
View File
@@ -1,12 +1,12 @@
use std::{
fs,
path::Path,
sync::{
Arc, Mutex,
atomic::{AtomicBool, Ordering},
},
use std::sync::{
Arc, Mutex,
atomic::{AtomicBool, Ordering},
};
#[cfg(unix)]
use std::{fs, path::Path};
#[cfg(unix)]
use gpapi::process::users::get_user_by_name;
use gpapi::{
clap::report,
cookie_store,
@@ -15,19 +15,22 @@ use gpapi::{
gp_params::GpParams,
os_profile::OsProfile,
portal::{PortalConfig, prelogin},
process::users::get_user_by_name,
session::{GatewayAuthentication, SessionMode},
};
use inquire::Text;
use log::{Level, info, warn};
use openconnect::{HipScript, HipSource, VpnBuilder};
#[cfg(unix)]
use openconnect::HipScript;
use openconnect::{HipSource, VpnBuilder};
use tokio::{runtime::Handle, task::JoinHandle};
use crate::session::{
SessionContextInput, build_session_context, session_info_from_vpn, spawn_session_runtime_with_info,
};
use super::{ConnectHandler, args::cookie_cache_path, vpn_script};
#[cfg(unix)]
use super::tunnel_output::TunnelOutput;
use super::{ConnectHandler, args::cookie_cache_path};
const OPENCONNECT_INTERRUPTED_EXIT_CODE: i32 = -4;
@@ -452,7 +455,10 @@ impl ConnectHandler<'_> {
disable_ipv6: self.args.disable_ipv6,
extension_auth: Some(extension_auth),
});
let vpn_builder = vpn_script::builder(gateway, cookie, self.args)
let vpn_builder = self
.vpn_builder(gateway, cookie)
.map_err(GatewayConnectError::before_establishment)?;
let vpn_builder = vpn_builder
.interface(self.args.interface.clone())
.certificate(certificate)
.sslkey(sslkey)
@@ -487,21 +493,8 @@ impl ConnectHandler<'_> {
let disconnect_requested_on_signal = Arc::clone(&disconnect_requested);
let cancellation = self.cancellation.clone();
let mut background_stdio = self
.background
.as_ref()
.map(|background| background.redirect_stdio())
.transpose()
.map_err(GatewayConnectError::before_establishment)?;
let mut dashboard = if self.args.dashboard {
Some(
crate::dashboard::Dashboard::prepare(gateway.to_owned(), self.cancellation.clone())
.map_err(GatewayConnectError::before_establishment)?,
)
} else {
None
};
#[cfg(unix)]
let mut output = TunnelOutput::prepare(self, gateway).map_err(GatewayConnectError::before_establishment)?;
let monitor = gptunnel::TunnelMonitor::attach(vpn.clone());
let disconnect_task = tokio::spawn(async move {
@@ -511,7 +504,9 @@ impl ConnectHandler<'_> {
vpn_clone.disconnect();
});
#[cfg(unix)]
let lock_file_on_connect = self.shared_args.lock_file.to_path_buf();
#[cfg(unix)]
let pid_written = self.pid_written.clone();
let log_format = self.shared_args.log_format;
let session_cancellation = self.cancellation.clone();
@@ -523,6 +518,7 @@ impl ConnectHandler<'_> {
return;
}
tunnel_established_on_connect.store(true, Ordering::SeqCst);
#[cfg(unix)]
pid_written.store(write_pid_file(&lock_file_on_connect), Ordering::SeqCst);
let _ = established_tx.send(());
@@ -536,7 +532,6 @@ impl ConnectHandler<'_> {
session_task_on_connect.lock().unwrap().replace(task);
})
});
let mut output_error = None;
let connect_result = tokio::select! {
result = &mut worker => result,
established = established_rx => {
@@ -550,23 +545,8 @@ impl ConnectHandler<'_> {
self.logout_gateway(&server).await;
}
}, || {
if let Some(dashboard) = &mut dashboard {
if let Err(error) = dashboard.start_tunnel(monitor.clone()) {
self.cancellation.cancel();
output_error = Some(error);
}
}
if let (Some(background), Some(stdio)) = (&self.background, &mut background_stdio) {
let detach = if self.pid_written.load(Ordering::SeqCst) {
background.detach(stdio)
} else {
Err(anyhow::anyhow!("Cannot detach without a writable PID lock file"))
};
if let Err(error) = detach {
self.cancellation.cancel();
output_error = Some(error);
}
}
#[cfg(unix)]
output.ready(monitor.clone());
}).await
} else {
(&mut worker).await
@@ -574,11 +554,8 @@ impl ConnectHandler<'_> {
}
};
monitor.stop().await;
if let Some(dashboard) = &mut dashboard {
if let Err(error) = dashboard.finish() {
output_error = Some(error);
}
}
#[cfg(unix)]
let output_result = output.finish();
let tunnel_established = tunnel_established.load(Ordering::SeqCst);
disconnect_task.abort();
let _ = disconnect_task.await;
@@ -589,15 +566,15 @@ impl ConnectHandler<'_> {
let _ = task.await;
}
if let Some(error) = output_error {
return Err(GatewayConnectError::after_establishment(error));
}
#[cfg(unix)]
output_result.map_err(GatewayConnectError::after_establishment)?;
let disconnect_requested = disconnect_requested.load(Ordering::SeqCst);
let connect_result = connect_result.map_err(|error| GatewayConnectError::after_establishment(error.into()))?;
classify_openconnect_result(connect_result, tunnel_established, disconnect_requested)
}
#[cfg(unix)]
pub(super) fn hip_source(&self, profile: OsProfile) -> anyhow::Result<HipSource> {
let user = self.determine_hip_user();
let script = self.args.hip.as_ref().or(self.args.csd_wrapper.as_ref());
@@ -605,19 +582,7 @@ impl ConnectHandler<'_> {
Some(path) if !path.is_empty() => Ok(HipSource::Script(HipScript::new(path.clone(), get_uid(&user)?)?)),
Some(_) => {
anyhow::ensure!(user.is_none(), "--hip-user requires an explicit HIP script");
Ok(HipSource::Generator(Arc::new(move |request, control| {
let input = gphip::ReportInput {
profile: profile.clone(),
context: gphip::ReportContext::Connected {
cookie: request.cookie.clone(),
client_ip: request.client_ip.clone(),
client_ipv6: request.client_ipv6.clone(),
md5: request.md5.clone(),
},
};
gphip::generate_report_with_control(&input, &|| control.check())
.map_err(|error| error.downcast::<std::io::Error>().unwrap_or_else(std::io::Error::other))
})))
Ok(generated_hip(profile))
}
None => {
anyhow::ensure!(user.is_none(), "--hip-user requires an explicit HIP script");
@@ -626,6 +591,16 @@ impl ConnectHandler<'_> {
}
}
#[cfg(windows)]
pub(super) fn hip_source(&self, profile: OsProfile) -> anyhow::Result<HipSource> {
Ok(if self.args.hip {
generated_hip(profile)
} else {
HipSource::Disabled
})
}
#[cfg(unix)]
fn determine_hip_user(&self) -> Option<String> {
if let Some(hip_user) = &self.args.hip_user {
return Some(hip_user.clone());
@@ -635,6 +610,22 @@ impl ConnectHandler<'_> {
}
}
fn generated_hip(profile: OsProfile) -> HipSource {
HipSource::Generator(Arc::new(move |request, control| {
let input = gphip::ReportInput {
profile: profile.clone(),
context: gphip::ReportContext::Connected {
cookie: request.cookie.clone(),
client_ip: request.client_ip.clone(),
client_ipv6: request.client_ipv6.clone(),
md5: request.md5.clone(),
},
};
gphip::generate_report_with_control(&input, &|| control.check())
.map_err(|error| error.downcast::<std::io::Error>().unwrap_or_else(std::io::Error::other))
}))
}
async fn wait_for_tunnel_exit(
worker: &mut JoinHandle<i32>,
cleanup: impl std::future::Future<Output = ()>,
@@ -678,10 +669,17 @@ fn classify_openconnect_result(
}
}
#[cfg(unix)]
fn direct_gateway_command(gateway: &str) -> String {
format!("gpauth --gateway {gateway} | sudo gpclient connect {gateway} --as-gateway --cookie-on-stdin")
}
#[cfg(windows)]
fn direct_gateway_command(gateway: &str) -> String {
format!("gpclient.exe connect {gateway} --as-gateway")
}
#[cfg(unix)]
pub(super) fn write_pid_file(lock_file: &Path) -> bool {
let pid = std::process::id();
@@ -694,6 +692,7 @@ pub(super) fn write_pid_file(lock_file: &Path) -> bool {
}
}
#[cfg(unix)]
fn get_uid(user: &Option<String>) -> anyhow::Result<Option<u32>> {
user
.as_ref()
@@ -710,7 +709,7 @@ fn apply_os_profile(builder: VpnBuilder, profile: &OsProfile) -> VpnBuilder {
.user_agent(Some(profile.user_agent().to_string()))
}
#[cfg(test)]
#[cfg(all(test, unix))]
mod tests {
use super::*;
+52 -55
View File
@@ -14,7 +14,7 @@ use gpapi::{
};
use log::{info, warn};
use super::ConnectHandler;
use super::{ConnectHandler, internal_output::InternalOutput};
impl ConnectHandler<'_> {
pub(super) async fn connect_internal_gateways(
@@ -26,6 +26,7 @@ impl ConnectHandler<'_> {
first_session: super::gateway::GatewayLoginSession,
remaining: &[&Gateway],
) -> anyhow::Result<()> {
#[cfg(unix)]
ensure!(
self.background.is_none(),
"--background requires a VPN tunnel; internal non-tunnel sessions must run in the foreground"
@@ -70,11 +71,18 @@ impl ConnectHandler<'_> {
}
self.check_cancelled()?;
let modes = authenticated.iter().map(|(_, session)| session.authentication.mode());
self.enter_non_tunnel_mode(modes)?;
self.run_internal_session(config, &authenticated).await
}
fn enter_non_tunnel_mode(&self, modes: impl Iterator<Item = SessionMode>) -> anyhow::Result<()> {
ensure!(
internal_session_mode(modes)? == SessionMode::NonTunnel,
"Expected non-tunnel authentication"
);
self.run_internal_session(config, &authenticated).await
#[cfg(windows)]
drop(self.shared_args.system_tunnel.take());
Ok(())
}
async fn run_internal_session(
@@ -112,18 +120,7 @@ impl ConnectHandler<'_> {
let source = Arc::new(source);
let validate_network = network.clone();
let validate_detection = detection.clone();
let members = crate::dashboard::InternalMembers::default();
let dashboard_members = members.clone();
let (established_tx, established_rx) = tokio::sync::oneshot::channel();
let established_tx = std::sync::Mutex::new(Some(established_tx));
let mut dashboard = if self.args.dashboard {
Some(crate::dashboard::Dashboard::prepare(
authenticated[0].0.server().to_owned(),
cancellation.clone(),
)?)
} else {
None
};
let (output, observe_status) = InternalOutput::prepare(self, authenticated[0].0.server())?;
let callbacks = SessionCallbacks {
produce_report: Arc::new(move |request, control| {
control.check()?;
@@ -165,16 +162,10 @@ impl ConnectHandler<'_> {
"Internal network — authenticated: {} (IPv4: {:?}, IPv6: {:?})",
member.gateway, member.client_ip, member.client_ipv6
);
if let Some(established) = established_tx.lock().unwrap().take() {
let _ = established.send(());
}
}
state => info!("Internal gateway {}: {state:?}", member.gateway),
}
members.lock().unwrap().insert(
member.gateway.server().to_owned(),
format!("{}: {:?}", member.gateway, member.maintenance),
);
observe_status(&member);
}),
validate_network: Arc::new(move |cancellation| {
let network = validate_network.clone();
@@ -204,43 +195,20 @@ impl ConnectHandler<'_> {
// The PID spans maintenance and cleanup, including initialization before the
// first successful HIP exchange. The outer handler owns final session logout.
#[cfg(unix)]
self.pid_written.store(
super::gateway::write_pid_file(self.shared_args.lock_file),
std::sync::atomic::Ordering::SeqCst,
);
let mut sessions = self.sessions.take();
let mut dashboard_error = None;
let result = {
let maintenance = maintain_non_tunnel_sessions(&mut sessions, policy, callbacks, cancellation, async move {
network_signal.await.unwrap_or(SessionEndReason::NetworkChanged)
});
tokio::pin!(maintenance);
tokio::select! {
result = &mut maintenance => result,
established = established_rx => {
if established.is_ok() {
if let Some(dashboard) = &mut dashboard {
if let Err(error) = dashboard.start_internal(dashboard_members) {
self.cancellation.cancel();
dashboard_error = Some(error);
}
}
}
maintenance.await
}
}
};
if let Some(dashboard) = &mut dashboard {
if let Err(error) = dashboard.finish() {
dashboard_error = Some(error);
}
}
let maintenance = maintain_non_tunnel_sessions(&mut sessions, policy, callbacks, cancellation, async move {
network_signal.await.unwrap_or(SessionEndReason::NetworkChanged)
});
let (result, output_result) = output.run(maintenance).await;
self.sessions.replace(sessions);
monitor_cancel.cancel();
monitor.await.context("Internal network monitor failed")?;
if let Some(error) = dashboard_error {
return Err(error);
}
output_result?;
match result? {
SessionExit::Disconnected => Ok(()),
SessionExit::Failed(reason) => bail!("Internal session ended: {reason:?}. Connect again to authenticate."),
@@ -254,8 +222,7 @@ impl ConnectHandler<'_> {
}
}
fn internal_session_mode(modes: impl Iterator<Item = SessionMode>) -> anyhow::Result<SessionMode> {
let mut modes = modes;
fn internal_session_mode(mut modes: impl Iterator<Item = SessionMode>) -> anyhow::Result<SessionMode> {
let mode = modes.next().context("No internal gateway authenticated successfully")?;
ensure!(
modes.all(|candidate| candidate == mode),
@@ -276,9 +243,39 @@ mod tests {
internal_session_mode([SessionMode::NonTunnel, SessionMode::NonTunnel].into_iter()).unwrap(),
SessionMode::NonTunnel
);
assert_eq!(
internal_session_mode([SessionMode::Tunnel].into_iter()).unwrap(),
SessionMode::Tunnel
}
#[cfg(windows)]
#[test]
#[ignore = "requires the installed Windows machine tunnel directory and administrator privileges"]
fn internal_maintenance_releases_the_machine_tunnel() {
use crate::{cli::SharedArgs, connect::ConnectArgs};
use clap::Parser;
use gpvpnc::windows::SystemTunnel;
#[derive(Parser)]
struct TestArgs {
#[command(flatten)]
connect: ConnectArgs,
}
let args = TestArgs::parse_from(["test", "portal.example.com"]);
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
let shared = SharedArgs {
ignore_tls_errors: false,
system_tunnel: Some(SystemTunnel::acquire().unwrap()).into(),
verbose: &verbose,
log_format: gpapi::log_format::LogFormat::Text,
};
let handler = ConnectHandler::new(&args.connect, &shared);
assert!(
handler
.enter_non_tunnel_mode([SessionMode::Tunnel].into_iter())
.is_err()
);
assert!(SystemTunnel::try_acquire().unwrap().is_none());
handler
.enter_non_tunnel_mode([SessionMode::NonTunnel].into_iter())
.unwrap();
assert!(SystemTunnel::try_acquire().unwrap().is_some());
}
}
@@ -0,0 +1,73 @@
use std::{future::Future, sync::Mutex};
use gpapi::session::{GatewaySessionSummary, MaintenanceState};
use tokio::sync::oneshot;
use tokio_util::sync::CancellationToken;
use crate::dashboard::{Dashboard, InternalMembers};
use super::ConnectHandler;
pub(super) struct InternalOutput(Option<DashboardState>);
struct DashboardState {
dashboard: Dashboard,
members: InternalMembers,
established: oneshot::Receiver<()>,
cancellation: CancellationToken,
}
impl InternalOutput {
pub(super) fn prepare(
handler: &ConnectHandler<'_>,
gateway: &str,
) -> anyhow::Result<(Self, impl Fn(&GatewaySessionSummary) + Send + Sync + 'static + use<>)> {
let (sender, established) = oneshot::channel();
let established_sender = Mutex::new(Some(sender));
let members = InternalMembers::default();
let dashboard_members = members.clone();
let output = if handler.args.dashboard {
Some(DashboardState {
dashboard: Dashboard::prepare(gateway.to_owned(), handler.cancellation.clone())?,
members,
established,
cancellation: handler.cancellation.clone(),
})
} else {
None
};
let observe = move |member: &GatewaySessionSummary| {
if member.maintenance == MaintenanceState::Healthy
&& let Some(ready) = established_sender.lock().unwrap().take()
{
let _ = ready.send(());
}
dashboard_members.lock().unwrap().insert(
member.gateway.server().to_owned(),
format!("{}: {:?}", member.gateway, member.maintenance),
);
};
Ok((Self(output), observe))
}
pub(super) async fn run<T>(self, maintenance: impl Future<Output = T>) -> (T, anyhow::Result<()>) {
let Some(mut output) = self.0 else {
return (maintenance.await, Ok(()));
};
let mut start = Ok(());
tokio::pin!(maintenance);
let result = tokio::select! {
result = &mut maintenance => result,
established = &mut output.established => {
if established.is_ok() {
start = output.dashboard.start_internal(output.members);
if start.is_err() {
output.cancellation.cancel();
}
}
maintenance.await
}
};
(result, output.dashboard.finish().and(start))
}
}
@@ -0,0 +1,20 @@
use std::future::Future;
use gpapi::session::GatewaySessionSummary;
use super::ConnectHandler;
pub(super) struct InternalOutput;
impl InternalOutput {
pub(super) fn prepare(
_: &ConnectHandler<'_>,
_: &str,
) -> anyhow::Result<(Self, impl Fn(&GatewaySessionSummary) + Send + Sync + 'static + use<>)> {
Ok((Self, |_: &GatewaySessionSummary| {}))
}
pub(super) async fn run<T>(self, maintenance: impl Future<Output = T>) -> (T, anyhow::Result<()>) {
(maintenance.await, Ok(()))
}
}
+16 -1
View File
@@ -1,12 +1,21 @@
mod args;
mod credential;
#[cfg(test)]
#[cfg(all(test, unix))]
mod flow_tests;
mod gateway;
mod internal;
#[cfg(unix)]
#[path = "internal_output/unix.rs"]
mod internal_output;
#[cfg(windows)]
#[path = "internal_output/windows.rs"]
mod internal_output;
#[cfg(unix)]
mod tunnel_output;
mod vpn_script;
use std::cell::RefCell;
#[cfg(unix)]
use std::sync::{
Arc,
atomic::{AtomicBool, Ordering},
@@ -46,7 +55,9 @@ pub(crate) struct ConnectHandler<'a> {
auth_attempt_fixture: RefCell<credential::AuthAttemptFixture>,
auth_recovery: RefCell<gpapi::process::rendering_recovery::RecoveryState>,
sessions: RefCell<GatewaySessions>,
#[cfg(unix)]
pid_written: Arc<AtomicBool>,
#[cfg(unix)]
background: Option<crate::background::BackgroundWorker>,
}
@@ -72,11 +83,14 @@ impl<'a> ConnectHandler<'a> {
auth_attempt_fixture: Default::default(),
auth_recovery: RefCell::default(),
sessions: RefCell::default(),
#[cfg(unix)]
pid_written: Arc::default(),
#[cfg(unix)]
background: None,
}
}
#[cfg(unix)]
pub(crate) fn with_background(mut self, background: Option<crate::background::BackgroundWorker>) -> Self {
self.background = background;
self
@@ -134,6 +148,7 @@ impl<'a> ConnectHandler<'a> {
} else {
sessions.logout().await;
}
#[cfg(unix)]
if self.pid_written.load(Ordering::SeqCst) {
if let Err(error) = std::fs::remove_file(self.shared_args.lock_file) {
warn!("Failed to remove PID file: {error}");
@@ -0,0 +1,74 @@
use std::sync::{
Arc,
atomic::{AtomicBool, Ordering},
};
use gptunnel::TunnelMonitor;
use tokio_util::sync::CancellationToken;
use crate::{
background::{BackgroundStdio, BackgroundWorker},
dashboard::Dashboard,
};
use super::ConnectHandler;
pub(super) struct TunnelOutput<'a> {
background: Option<(&'a BackgroundWorker, BackgroundStdio)>,
dashboard: Option<Dashboard>,
pid_written: &'a AtomicBool,
cancellation: &'a CancellationToken,
error: Option<anyhow::Error>,
}
impl<'a> TunnelOutput<'a> {
pub(super) fn prepare(handler: &'a ConnectHandler<'_>, gateway: &str) -> anyhow::Result<Self> {
let background = handler
.background
.as_ref()
.map(|worker| worker.redirect_stdio().map(|stdio| (worker, stdio)))
.transpose()?;
let dashboard = handler
.args
.dashboard
.then(|| Dashboard::prepare(gateway.to_owned(), handler.cancellation.clone()))
.transpose()?;
Ok(Self {
background,
dashboard,
pid_written: &handler.pid_written,
cancellation: &handler.cancellation,
error: None,
})
}
pub(super) fn ready(&mut self, monitor: Arc<TunnelMonitor>) {
if let Some(dashboard) = &mut self.dashboard
&& let Err(error) = dashboard.start_tunnel(monitor)
{
self.cancellation.cancel();
self.error = Some(error);
}
if let Some((worker, stdio)) = &mut self.background {
let detach = if self.pid_written.load(Ordering::SeqCst) {
worker.detach(stdio)
} else {
Err(anyhow::anyhow!("Cannot detach without a writable PID lock file"))
};
if let Err(error) = detach {
self.cancellation.cancel();
self.error = Some(error);
}
}
}
pub(super) fn finish(&mut self) -> anyhow::Result<()> {
if let Some(dashboard) = &mut self.dashboard {
dashboard.finish()?;
}
match self.error.take() {
Some(error) => Err(error),
None => Ok(()),
}
}
}
@@ -1,9 +1,13 @@
use openconnect::{Vpn, VpnBuilder};
use crate::connect::ConnectArgs;
use crate::connect::ConnectHandler;
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> VpnBuilder {
Vpn::builder(server, cookie)
.script(args.script.clone())
.script_tun(args.script_tun)
impl ConnectHandler<'_> {
pub(in crate::connect) fn vpn_builder(&self, server: &str, cookie: &str) -> anyhow::Result<VpnBuilder> {
Ok(
Vpn::builder(server, cookie)
.script(self.args.script.clone())
.script_tun(self.args.script_tun),
)
}
}
+11 -4
View File
@@ -2,11 +2,18 @@ use std::ffi::OsStr;
use openconnect::{Vpn, VpnBuilder};
use crate::connect::ConnectArgs;
use crate::connect::{ConnectArgs, ConnectHandler};
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> VpnBuilder {
let configured_script = std::env::var_os("GP_VPNC_SCRIPT");
configure_builder(server, cookie, args, configured_script.as_deref())
impl ConnectHandler<'_> {
pub(in crate::connect) fn vpn_builder(&self, server: &str, cookie: &str) -> anyhow::Result<VpnBuilder> {
let configured_script = std::env::var_os("GP_VPNC_SCRIPT");
Ok(configure_builder(
server,
cookie,
self.args,
configured_script.as_deref(),
))
}
}
fn configure_builder(server: &str, cookie: &str, args: &ConnectArgs, configured_script: Option<&OsStr>) -> VpnBuilder {
+4 -2
View File
@@ -1,8 +1,10 @@
#[cfg(target_os = "macos")]
#[path = "macos.rs"]
mod platform;
#[cfg(not(target_os = "macos"))]
#[cfg(all(unix, not(target_os = "macos")))]
#[path = "default.rs"]
mod platform;
pub(super) use platform::builder;
#[cfg(windows)]
#[path = "windows.rs"]
mod platform;
@@ -0,0 +1,23 @@
use std::sync::Mutex;
use openconnect::{Vpn, VpnBuilder};
use crate::connect::ConnectHandler;
impl ConnectHandler<'_> {
pub(in crate::connect) fn vpn_builder(&self, server: &str, cookie: &str) -> anyhow::Result<VpnBuilder> {
let owner = self.shared_args.system_tunnel.borrow();
let tunnel = owner
.as_ref()
.ok_or_else(|| anyhow::anyhow!("System tunnel ownership is unavailable"))?;
let network = Mutex::new(tunnel.configurator()?);
Ok(
Vpn::builder(server, cookie).network_configuration_handler(move |configuration| {
network
.lock()
.map_err(|_| std::io::Error::other("Windows network state is unavailable"))?
.configure(&configuration.reason, &configuration.environment)
}),
)
}
}
+13 -6
View File
@@ -24,6 +24,14 @@ pub(crate) struct LaunchGuiArgs {
help = "The external-browser authentication callback URL"
)]
callback: Option<String>,
#[cfg(target_os = "linux")]
#[arg(
long,
value_enum,
conflicts_with = "callback",
help = "Launch this interface and remember it for future launches"
)]
interface: Option<gpapi::gui::GuiVariant>,
#[arg(long, help = "Launch the GUI minimized")]
minimized: bool,
}
@@ -61,7 +69,10 @@ impl<'a> LaunchGuiHandler<'a> {
return forward_auth_callback(callback);
}
if DesktopLauncher::activate_existing().await.is_ok() {
let launcher = DesktopLauncher::new(env!("CARGO_PKG_VERSION")).minimized(self.args.minimized);
#[cfg(target_os = "linux")]
let launcher = launcher.interface(self.args.interface);
if launcher.activate_or_reject_existing().await? {
info!("The GUI is already running");
return Ok(());
}
@@ -71,11 +82,7 @@ impl<'a> LaunchGuiHandler<'a> {
info!("Log file: {}", log_file_path);
let exit_status = DesktopLauncher::new(env!("CARGO_PKG_VERSION"))
.minimized(self.args.minimized)
.log_file(&log_file_path)
.launch()
.await?;
let exit_status = launcher.log_file(&log_file_path).launch().await?;
info!("Service exited with status: {}", exit_status);
+6
View File
@@ -1,13 +1,19 @@
#[cfg(unix)]
mod background;
mod cli;
mod connect;
#[cfg(unix)]
mod dashboard;
#[cfg(unix)]
mod diagnostics;
#[cfg(unix)]
mod disconnect;
mod hip;
#[cfg(unix)]
mod launch_gui;
mod session;
#[cfg(unix)]
pub(crate) const GP_CLIENT_LOCK_FILE: &str = "/var/run/gpclient.lock";
#[tokio::main]
+54 -4
View File
@@ -75,8 +75,7 @@ async fn run_session_runtime(session_ctx: SessionContext, mut session_info: Sess
tokio::time::sleep(schedule.delay).await;
crate::dashboard::session_notice(Level::Warn, &schedule.message);
report(log_format, Level::Warn, &format!("\nWARNING: {}", schedule.message));
report_session_notice(log_format, Level::Warn, &schedule.message);
if !schedule.should_auto_extend {
info!("Session extension is not allowed by the gateway");
@@ -91,8 +90,7 @@ async fn run_session_runtime(session_ctx: SessionContext, mut session_info: Sess
return;
};
crate::dashboard::session_notice(Level::Info, "Session extended.");
report(log_format, Level::Info, "Session extended.");
report_session_notice(log_format, Level::Info, "Session extended.");
session_info = next_session_info;
}
Err(err) => {
@@ -108,6 +106,16 @@ async fn run_session_runtime(session_ctx: SessionContext, mut session_info: Sess
}
}
fn report_session_notice(log_format: LogFormat, level: Level, message: &str) {
#[cfg(unix)]
crate::dashboard::session_notice(level, message);
if level == Level::Warn {
report(log_format, level, &format!("\nWARNING: {message}"));
} else {
report(log_format, level, message);
}
}
fn build_session_warning_schedule(session_info: &SessionInfo) -> Option<SessionWarningSchedule> {
let warning = session_info.lifetime_warning.as_ref()?;
let warning_secs = if let Some(user_expires) = session_info.user_expires {
@@ -149,6 +157,48 @@ mod tests {
}
}
#[cfg(windows)]
#[test]
fn expiry_warning_is_reported_once() {
const CHILD: &str = "GP_TEST_SESSION_WARNING_CHILD";
const WARNING: &str = "Session expires soon";
if std::env::var_os(CHILD).is_some() {
env_logger::builder()
.filter_level(log::LevelFilter::Info)
.format(gpapi::log_format::write_json_record)
.init();
let context = SessionContext::new(
"vpn.example.test".to_owned(),
"vpn.example.test".to_owned(),
SessionRequestArgs::new("synthetic".to_owned()),
);
let session = sample_session_info(Some(unix_timestamp() + 30), false);
tokio::runtime::Builder::new_current_thread()
.enable_time()
.build()
.unwrap()
.block_on(run_session_runtime(context, session, LogFormat::Json));
return;
}
let output = std::process::Command::new(std::env::current_exe().unwrap())
.args([
"--exact",
"session::tests::expiry_warning_is_reported_once",
"--nocapture",
])
.env(CHILD, "1")
.output()
.unwrap();
assert!(output.status.success());
let stderr = String::from_utf8(output.stderr).unwrap();
assert_eq!(
stderr.lines().filter(|line| line.contains(WARNING)).count(),
1,
"{stderr}"
);
}
#[test]
fn builds_warning_schedule_for_auto_extend() {
let session_info = sample_session_info(Some(unix_timestamp() + 1830), true);
+1 -1
View File
@@ -1,4 +1,4 @@
#![cfg(not(target_os = "macos"))]
#![cfg(all(unix, not(target_os = "macos")))]
use std::process::Command;
+2
View File
@@ -1,3 +1,5 @@
#![cfg(unix)]
use std::{os::unix::fs::PermissionsExt, process::Stdio, time::Duration};
use tokio::process::Command;
@@ -6,4 +6,4 @@ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports)
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{He=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ve(n):``}function We(e,t){switch(e.tag){case 26:case 27:case 5:return Ve(e.type);case 16:return Ve(`Lazy`);case 13:return e.child!==t&&t!==null?Ve(`Suspense Fallback`):Ve(`Suspense`);case 19:return Ve(`SuspenseList`);case 0:case 15:return Ue(e.type,!1);case 11:return Ue(e.type.render,!1);case 1:return Ue(e.type,!0);case 31:return Ve(`Activity`);case 30:return Ve(`ViewTransition`);default:return``}}function Ge(e){try{var t=``,n=null;do t+=We(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
Error generating stack: `+e.message+`
`+e.stack}}var Ke=Object.prototype.hasOwnProperty,qe=t.unstable_scheduleCallback,Je=t.unstable_cancelCallback,Ye=t.unstable_shouldYield,Xe=t.unstable_requestPaint,Ze=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,$e=t.unstable_ImmediatePriority,et=t.unstable_UserBlockingPriority,tt=t.unstable_NormalPriority,nt=t.unstable_LowPriority,rt=t.unstable_IdlePriority,it=t.log,at=t.unstable_setDisableYieldValue,ot=null,st=null;function ct(e){if(typeof it==`function`&&at(e),st&&typeof st.setStrictMode==`function`)try{st.setStrictMode(ot,e)}catch{}}var lt=Math.clz32?Math.clz32:ft,ut=Math.log,dt=Math.LN2;function ft(e){return e>>>=0,e===0?32:31-(ut(e)/dt|0)|0}var pt=256,mt=262144,ht=4194304;function gt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _t(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=gt(n))):i=gt(o):i=gt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=gt(n))):i=gt(o)):i=gt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function vt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function yt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-lt(n),i=1<<r;t|=e[r],n&=~i}return t}function bt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xt(){var e=ht;return ht<<=1,!(ht&62914560)&&(ht=4194304),e}function St(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-lt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-lt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Et(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-lt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Dt(e,t){var n=t&-t;return n=n&42?1:Ot(n),(n&(e.suspendedLanes|t))===0?n:0}function Ot(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function kt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function At(){var e=E.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function jt(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var Mt=Math.random().toString(36).slice(2),Nt=`__reactFiber$`+Mt,Pt=`__reactProps$`+Mt,Ft=`__reactContainer$`+Mt,It=`__reactEvents$`+Mt,Lt=`__reactListeners$`+Mt,Rt=`__reactHandles$`+Mt,zt=`__reactResources$`+Mt,Bt=`__reactMarker$`+Mt,Vt=`__reactLoad$`+Mt;function Ht(e){delete e[Nt],delete e[Pt],delete e[Lt],delete e[Rt]}function Ut(e){var t;if(t=e[Nt])return t;for(var n=e.parentNode;n;){if(t=n[Ft]||n[Nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[Nt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Wt(e){if(e=e[Nt]||e[Ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Kt(e){var t=e[zt];return t||=e[zt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function qt(e){e[Bt]=!0}function Jt(e){e[Vt]=void 0}var Yt=new Set,Xt={};function Zt(e,t){Qt(e,t),Qt(e+`Capture`,t)}function Qt(e,t){for(Xt[e]=t,e=0;e<t.le Line truncated
`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&xn(e,``+r);else return;break;case`className`:on(e,`class`,r);break;case`tabIndex`:on(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:on(e,n,r);break;case`style`:wn(e,r,a);return;case`data`:if(t!==`object`){on(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,i.name,i,null),$(e,t,`formEncType`,i.formEncType,i,null),$(e,t,`formMethod`,i.formMethod,i,null),$(e,t,`formTarget`,i.formTarget,i,null)):($(e,t,`encType`,i.encType,i,null),$(e,t,`method`,i.method,i,null),$(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=kn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=On(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),an(e,`popover`,r);break;case`xlinkActuate`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:an(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=En.get(n)||n,an(e,n,r);else return}O=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:wn(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)xn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=kn);return;case`suppressContent Line truncated
`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&xn(e,``+r);else return;break;case`className`:on(e,`class`,r);break;case`tabIndex`:on(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:on(e,n,r);break;case`style`:wn(e,r,a);return;case`data`:if(t!==`object`){on(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,i.name,i,null),$(e,t,`formEncType`,i.formEncType,i,null),$(e,t,`formMethod`,i.formMethod,i,null),$(e,t,`formTarget`,i.formTarget,i,null)):($(e,t,`encType`,i.encType,i,null),$(e,t,`method`,i.method,i,null),$(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=On(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=kn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=On(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),an(e,`popover`,r);break;case`xlinkActuate`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:sn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:sn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:an(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=En.get(n)||n,an(e,n,r);else return}O=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:wn(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)xn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=kn);return;case`suppressContent Line truncated
+1 -1
View File
@@ -15,7 +15,7 @@
<link rel="icon" type="image/svg+xml" href="/assets/icon-small-DFuJkDph.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GPGUI Downloader</title>
<script type="module" crossorigin src="/assets/main-BJvLW_Ih.js"></script>
<script type="module" crossorigin src="/assets/main-mZlQiCQA.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-CVTp2z3I.css">
</head>
<body>
+7 -7
View File
@@ -10,25 +10,25 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^2.12.4",
"@tauri-apps/api": "^2.12.5",
"react": "^19.3.1",
"react-dom": "^19.3.1"
},
"devDependencies": {
"@tauri-apps/cli": "^2.12.4",
"@tauri-apps/cli": "^2.12.6",
"@types/node": "^26.6.6",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@typescript-eslint/eslint-plugin": "^8.72.1",
"@typescript-eslint/parser": "^8.72.1",
"@vitejs/plugin-react": "^6.1.2",
"@typescript-eslint/eslint-plugin": "^8.73.0",
"@typescript-eslint/parser": "^8.73.0",
"@vitejs/plugin-react": "^6.3.0",
"eslint": "^9.39.5",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
"prettier": "3.9.10",
"prettier": "3.10.1",
"typescript": "^6.0.3",
"vite": "^8.3.5"
"vite": "^8.3.8"
},
"packageManager": "[email protected]"
}
+280 -200
View File
@@ -9,8 +9,8 @@ importers:
.:
dependencies:
'@tauri-apps/api':
specifier: ^2.12.4
version: 2.12.4
specifier: ^2.12.5
version: 2.12.5
react:
specifier: ^19.3.1
version: 19.3.1
@@ -19,8 +19,8 @@ importers:
version: 19.3.1([email protected])
devDependencies:
'@tauri-apps/cli':
specifier: ^2.12.4
version: 2.12.4
specifier: ^2.12.6
version: 2.12.6
'@types/node':
specifier: ^26.6.6
version: 26.6.6
@@ -31,14 +31,14 @@ importers:
specifier: ^19.3.0
version: 19.3.0(@types/[email protected])
'@typescript-eslint/eslint-plugin':
specifier: ^8.72.1
version: 8.72.1(@typescript-eslint/[email protected]2.1([email protected])([email protected]))([email protected])([email protected])
specifier: ^8.73.0
version: 8.73.0(@typescript-eslint/[email protected]3.0([email protected])([email protected]))([email protected])([email protected])
'@typescript-eslint/parser':
specifier: ^8.72.1
version: 8.72.1([email protected])([email protected])
specifier: ^8.73.0
version: 8.73.0([email protected])([email protected])
'@vitejs/plugin-react':
specifier: ^6.1.2
version: 6.1.2([email protected].5(@types/[email protected])([email protected]))
specifier: ^6.3.0
version: 6.3.0([email protected].8(@types/[email protected])([email protected]))
eslint:
specifier: ^9.39.5
version: 9.39.5
@@ -52,14 +52,14 @@ importers:
specifier: ^7.1.1
version: 7.1.1([email protected])
prettier:
specifier: 3.9.10
version: 3.9.10
specifier: 3.10.1
version: 3.10.1
typescript:
specifier: ^6.0.3
version: 6.0.3
vite:
specifier: ^8.3.5
version: 8.3.5(@types/[email protected])([email protected])
specifier: ^8.3.8
version: 8.3.8(@types/[email protected])([email protected])
packages:
@@ -130,6 +130,15 @@ packages:
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
engines: {node: '>=6.9.0'}
'@emnapi/[email protected]':
resolution: {integrity: sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==}
'@emnapi/[email protected]':
resolution: {integrity: sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==}
'@emnapi/[email protected]':
resolution: {integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==}
'@esbuild/[email protected]':
resolution: {integrity: sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==}
engines: {node: '>=18'}
@@ -344,6 +353,9 @@ packages:
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
engines: {node: '>=18.18'}
'@isaacs/[email protected]':
resolution: {integrity: sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==}
'@jridgewell/[email protected]':
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
@@ -360,95 +372,107 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@napi-rs/[email protected]':
resolution: {integrity: sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==}
engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
peerDependencies:
'@emnapi/core': ^1.7.1 || 2.0.0-beta.2
'@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2
'@oxc-project/[email protected]':
resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==}
'@rolldown/[email protected]6':
resolution: {integrity: sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [android]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [android]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [darwin]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [darwin]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [freebsd]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm]
os: [linux]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [linux]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [ppc64]
os: [linux]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [s390x]
os: [linux]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [linux]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [openharmony]
'@rolldown/binding-win32-arm64-msvc@1.2.16':
resolution: {integrity: sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==}
'@rolldown/binding-wasm32-wasi@1.2.19':
resolution: {integrity: sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==}
engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
cpu: [wasm32]
'@rolldown/[email protected]':
resolution: {integrity: sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [arm64]
os: [win32]
'@rolldown/[email protected]6':
resolution: {integrity: sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==}
'@rolldown/[email protected]9':
resolution: {integrity: sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==}
engines: {node: ^20.19.0 || >=22.12.0}
cpu: [x64]
os: [win32]
@@ -456,80 +480,83 @@ packages:
'@rolldown/[email protected]':
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-pVmfis+4zT8H0Qhp3xPZx9Ju7kpzvA6rr/PSJPyuwfvucTQ8sVt61NYU9KMkK703UFlYadFmjKA4HhybOtN0gg==}
'@tauri-apps/[email protected].5':
resolution: {integrity: sha512-G9QIMt5fzED+aS4QhVK3w1HWLKpLIwH/MnpCr9z1ugGEHnS2ORmqrLkc0uALOjRK4qXJy+4Yiw8LDl/KicC1Hg==}
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-OxqKSckIkoJ6vX2AjifIJpTasFC0Hbdoo7gEiCmAjauABO3U8m2MRsLWe+QTiBwDx1mIrvgA+rvI7tvDnbnHVg==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-Uokwk1hFfJoG54+kD8iU0St33jAIkNvojnjEfBZ6UbL5rnM10AiFwUS/2DHTJ9R4/Kba4U44v7djfMuWFTQgeg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-fz76/77wMMJOaaUN6n3CybRG0P/MTEjjqYk81mGPyhi9m6Ue5T+LWBnJP/AkPooNatBPI2vtulGqomyMJ44lCQ==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-WhahqzcyHCpCzh4Taf0ZbBm6nGkvuOSh5ffrgOO7EdYaYe+RBQK8LOlFu+bbjul5v9cdLDi3kco+0+7IlZtTVA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-K0w8Bof6Lt8QKLAYhRy0yy36ZH5iA/35VuSOvnxyjvCUZ+A3JKsUTlALviH/sVgAlisaPzzmeJSH8XOn4Q2HBA==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-GB6weN+iFHxiFZ9SOKW6fINis7gnxohoOldR7sryBe7uaavkFGaMCa0yQs5njeXPWvzlE9WTQ13z8oDjmqK+Ww==}
engines: {node: '>= 10'}
cpu: [arm]
os: [linux]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-j5rOnjmRUwWrm1oosf0zBYl4D+fqydgUROFCk0hvKZxvbTT8SOERes0QB7rBV/XWNy+kM6pCKzb3oSm2sRglzg==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-mdHoUFYKfztUtPKE0C2hhGkEo7j6swXjg+5yRRKSD7A2gLkRPQFIXWD/DAYhiJdeAkyA8MCP6nvvKvg/4YryWQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-aOue3Fy6Jb7+oWcfAVUsVHfeTybSCt2CZoU06aO4jv4d2Ks/KnaTPwMAK3CLEduGOvBLY1lbBBrIyomqLLH5Sg==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-2BxB+9a3JRN0eJ0t0qGe8IKJfgBLOZDE8a499OXH+yg4J9bMpSK1oHXBxnHuSHFWhby4QnQ/t+sBf7tRC0UZeA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-Fx6GShY/RvST+t6LMlTHAwd66+1tEaAAGrnU7cysVfaiRP1BKng5Vl6rVmO6rSLOA1Sp1dRzNYM4f0OWQGb7qA==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-sb58RsNHex9QVqHdN1cf9MMlamUWAtk1NzuxTZalUnBUHfblIbe71hfmdI6whDZ84MufgOdeg/bzvhrbZS1r0w==}
engines: {node: '>= 10'}
cpu: [riscv64]
os: [linux]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-tNzZSa79Z1nRpHxEpQ38lsAFpKlFlYvoXzjTV+lRRn/zSf3wrdUC3wnLcq2XEadchPu4ttK0zivhYzr+XGD19Q==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-ZAb4/CHRma3ErjL2RGfHjITTUBIs4zySf0hIli9BddOtEdSx0ze0hEgxl+HfBVc5OEW/QmbiZ2E2+CkkHc8Pcg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-jmZ1pr0xEqUhuEusWtt9Yt+GF6lCnGHUmIL+KIknpbjK/XQ2qkhDBhaxK/JMHM2A8dAacVXCxXJk2EXpwhQUfA==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-ueSzM2Du6r4i1d/lby9kEvrhPnXw5zM/VYvcW1ldEWSpkUyVohsBXkmD+U7vMskEW5tXeCUenki7nYVxyGBGpQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-fGo8pgEHZxdSYgZ/J98m1usJ7NHKmKbq7k6uT0x1rpOq6Bg2YVzzpaAblWk710f5LHYBJIL5QIFS5IrD+4gmTg==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-6bmOt2BQSe0Bba+5CJcTKSML7VOYDxyiAKyBrjo86VxMdC1usIQmklu3Xc83s3QoK1rOMwwbANlPF6i5R2mvIg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-ezl8sQIcjYsye3TUnTH5VcWmWzccZASlQm7hlZt0dYyj1XD0qpVW47u2xYVrIKui0F8uQv/7QGZixdWiClBsbg==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-9q9ZFNuFreBczwyJuhhlrEOBzGClwWUYirQ2GBl66Y6EaNl17IdLH8TRqoY9wYB1LnctNBi+Fa/WMGtFA4BtFQ==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-DJhDeCqjLDNMWYFy7ZS8cfeAHX2RK0RbQMLiA3bMVVkXRDJ4NBYiHriGqsUhsr9iG41aTb+dJGkFPmPw1gWwVw==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-ion7Chbj21ROxMRpjQ7G8rz5sIOaI7IoBQum1oq5sl1V5zGWyc/oYnCrQhVqO2TxK/lBDWxt648BzLi02SY3Xg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
'@tauri-apps/[email protected].4':
resolution: {integrity: sha512-JI9bHfudSRJikGOrjbXEm6RjzzvmKuLc+JixB1NE8hNzQkNlCCIC3pTES3uypkR9lxHrsbxzcnSwhI2IxBQphw==}
'@tauri-apps/[email protected].6':
resolution: {integrity: sha512-/cOeQgqq8PBDPODOjjT0YHs4qxKCHcQMWMiBm4rLM3JNr9mZE+PHNKOK4zAkhIUtYMNL/0fweW48VNvzD1AbqA==}
engines: {node: '>= 10'}
hasBin: true
'@tybys/[email protected]':
resolution: {integrity: sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA==}
'@types/[email protected]':
resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}
@@ -547,72 +574,76 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
'@typescript-eslint/parser': ^8.72.1
'@typescript-eslint/parser': ^8.73.0
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-ZGwZP4OCfyA0AQTpEAMWz+rtX01DRhQWW5hB0ucKDEIX5U7jdmPSaMx94rQfaPAQzIYz2BimOgKOJtjfpRFQ9g==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-iY2wlmyrXJmx4yxUGP3aYCFF3cA/6ShddOKmLU2dx7LnEykbAM8WThlxZEfd1NddqceF6eJmZUayxx9oKIYNlg==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
'@typescript/native': npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev
typescript: '>=4.8.4 <6.1.0'
peerDependenciesMeta:
'@typescript/native':
optional: true
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-5v5liypurJBFHCBNqh/RjsymAD+VWcE0djuGY/BUqp5fC3Qn+luWDEksjuTtWjPn6i5zQlUtkZCRG/CYG0yCkA==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
typescript: '>=4.8.4 <6.1.0'
'@typescript-eslint/[email protected]2.1':
resolution: {integrity: sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==}
'@typescript-eslint/[email protected]3.0':
resolution: {integrity: sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@vitejs/plugin-react@6.1.2':
resolution: {integrity: sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==}
'@vitejs/plugin-react@6.3.0':
resolution: {integrity: sha512-H9E955aVvD2F4zNHCw4eIZbIfF6xKldlh7MNu+hSU7xwQzh65lI/N+CJWqmfhi0PEjDXIt/H7T7J/4wU63KJiw==}
engines: {node: ^20.19.0 || >=22.12.0}
peerDependencies:
'@rolldown/plugin-babel': ^0.1.7 || ^0.2.0
'@rolldown/plugin-babel': ^0.1.7 || ^0.2.0 || ^0.3.0
babel-plugin-react-compiler: ^1.0.0
oxc-transform-react: ^0.152.0
oxc-transform-react: '>=0.152.0 <0.157.0'
vite: ^8.0.0
peerDependenciesMeta:
'@rolldown/plugin-babel':
@@ -1282,9 +1313,9 @@ packages:
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
engines: {node: '>= 0.4'}
minimatch@10.2.6:
resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
engines: {node: 18 || 20 || >=22}
minimatch@11.0.9:
resolution: {integrity: sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==}
engines: {node: 20 || >=22}
[email protected]:
resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==}
@@ -1386,8 +1417,8 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
prettier@3.9.10:
resolution: {integrity: sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==}
prettier@3.10.1:
resolution: {integrity: sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==}
engines: {node: '>=14'}
hasBin: true
@@ -1427,8 +1458,8 @@ packages:
engines: {node: '>= 0.4'}
hasBin: true
[email protected]6:
resolution: {integrity: sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==}
[email protected]9:
resolution: {integrity: sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
@@ -1541,6 +1572,9 @@ packages:
peerDependencies:
typescript: '>=4.8.4'
[email protected]:
resolution: {integrity: sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==}
[email protected]:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
@@ -1582,8 +1616,8 @@ packages:
[email protected]:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
[email protected].5:
resolution: {integrity: sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==}
[email protected].8:
resolution: {integrity: sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==}
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
peerDependencies:
@@ -1768,6 +1802,22 @@ snapshots:
'@babel/helper-string-parser': 7.29.7
'@babel/helper-validator-identifier': 7.29.7
'@emnapi/[email protected]':
dependencies:
'@emnapi/wasi-threads': 2.2.0
tslib: 2.9.1
optional: true
'@emnapi/[email protected]':
dependencies:
tslib: 2.9.1
optional: true
'@emnapi/[email protected]':
dependencies:
tslib: 2.9.1
optional: true
'@esbuild/[email protected]':
optional: true
@@ -1908,6 +1958,8 @@ snapshots:
'@humanwhocodes/[email protected]': {}
'@isaacs/[email protected]': {}
'@jridgewell/[email protected]':
dependencies:
'@jridgewell/sourcemap-codec': 1.6.0
@@ -1927,103 +1979,122 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.6.0
'@napi-rs/[email protected](@emnapi/[email protected])(@emnapi/[email protected])':
dependencies:
'@emnapi/core': 2.0.0-beta.2
'@emnapi/runtime': 2.0.0-beta.2
'@tybys/wasm-util': 0.10.5
optional: true
'@oxc-project/[email protected]': {}
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/[email protected]6':
'@rolldown/[email protected]9':
optional: true
'@rolldown/binding-win32-arm64-msvc@1.2.16':
'@rolldown/binding-wasm32-wasi@1.2.19':
dependencies:
'@emnapi/core': 2.0.0-beta.2
'@emnapi/runtime': 2.0.0-beta.2
'@napi-rs/wasm-runtime': 1.2.6(@emnapi/[email protected])(@emnapi/[email protected])
optional: true
'@rolldown/binding-win32-x[email protected]6':
'@rolldown/binding-win32-arm[email protected]9':
optional: true
'@rolldown/[email protected]':
optional: true
'@rolldown/[email protected]': {}
'@tauri-apps/[email protected].4': {}
'@tauri-apps/[email protected].5': {}
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optional: true
'@tauri-apps/[email protected].4':
'@tauri-apps/[email protected].6':
optionalDependencies:
'@tauri-apps/cli-darwin-arm64': 2.12.4
'@tauri-apps/cli-darwin-x64': 2.12.4
'@tauri-apps/cli-linux-arm-gnueabihf': 2.12.4
'@tauri-apps/cli-linux-arm64-gnu': 2.12.4
'@tauri-apps/cli-linux-arm64-musl': 2.12.4
'@tauri-apps/cli-linux-riscv64-gnu': 2.12.4
'@tauri-apps/cli-linux-x64-gnu': 2.12.4
'@tauri-apps/cli-linux-x64-musl': 2.12.4
'@tauri-apps/cli-win32-arm64-msvc': 2.12.4
'@tauri-apps/cli-win32-ia32-msvc': 2.12.4
'@tauri-apps/cli-win32-x64-msvc': 2.12.4
'@tauri-apps/cli-darwin-arm64': 2.12.6
'@tauri-apps/cli-darwin-x64': 2.12.6
'@tauri-apps/cli-linux-arm-gnueabihf': 2.12.6
'@tauri-apps/cli-linux-arm64-gnu': 2.12.6
'@tauri-apps/cli-linux-arm64-musl': 2.12.6
'@tauri-apps/cli-linux-riscv64-gnu': 2.12.6
'@tauri-apps/cli-linux-x64-gnu': 2.12.6
'@tauri-apps/cli-linux-x64-musl': 2.12.6
'@tauri-apps/cli-win32-arm64-msvc': 2.12.6
'@tauri-apps/cli-win32-ia32-msvc': 2.12.6
'@tauri-apps/cli-win32-x64-msvc': 2.12.6
'@tybys/[email protected]':
dependencies:
tslib: 2.9.1
optional: true
'@types/[email protected]': {}
@@ -2041,74 +2112,77 @@ snapshots:
dependencies:
csstype: 3.2.3
'@typescript-eslint/[email protected]2.1(@typescript-eslint/[email protected]2.1([email protected])([email protected]))([email protected])([email protected])':
'@typescript-eslint/[email protected]3.0(@typescript-eslint/[email protected]3.0([email protected])([email protected]))([email protected])([email protected])':
dependencies:
'@eslint-community/regexpp': 4.12.2
'@typescript-eslint/parser': 8.72.1([email protected])([email protected])
'@typescript-eslint/scope-manager': 8.72.1
'@typescript-eslint/type-utils': 8.72.1([email protected])([email protected])
'@typescript-eslint/utils': 8.72.1([email protected])([email protected])
'@typescript-eslint/visitor-keys': 8.72.1
'@typescript-eslint/parser': 8.73.0([email protected])([email protected])
'@typescript-eslint/scope-manager': 8.73.0
'@typescript-eslint/type-utils': 8.73.0([email protected])([email protected])
'@typescript-eslint/utils': 8.73.0([email protected])([email protected])
'@typescript-eslint/visitor-keys': 8.73.0
eslint: 9.39.5
ignore: 7.0.14
natural-compare: 1.4.0
ts-api-utils: 2.5.0([email protected])
typescript: 6.0.3
transitivePeerDependencies:
- '@typescript/native'
- supports-color
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
'@typescript-eslint/[email protected]3.0([email protected])([email protected])':
dependencies:
'@typescript-eslint/scope-manager': 8.72.1
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
'@typescript-eslint/visitor-keys': 8.72.1
'@typescript-eslint/scope-manager': 8.73.0
'@typescript-eslint/types': 8.73.0
'@typescript-eslint/typescript-estree': 8.73.0([email protected])
'@typescript-eslint/visitor-keys': 8.73.0
debug: 4.4.3
eslint: 9.39.5
typescript: 6.0.3
transitivePeerDependencies:
- '@typescript/native'
- supports-color
'@typescript-eslint/[email protected]2.1([email protected])':
'@typescript-eslint/[email protected]3.0([email protected])':
dependencies:
'@typescript-eslint/tsconfig-utils': 8.72.1([email protected])
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/tsconfig-utils': 8.73.0([email protected])
'@typescript-eslint/types': 8.73.0
debug: 4.4.3
typescript: 6.0.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]2.1':
'@typescript-eslint/[email protected]3.0':
dependencies:
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/visitor-keys': 8.72.1
'@typescript-eslint/types': 8.73.0
'@typescript-eslint/visitor-keys': 8.73.0
'@typescript-eslint/[email protected]2.1([email protected])':
'@typescript-eslint/[email protected]3.0([email protected])':
dependencies:
typescript: 6.0.3
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
'@typescript-eslint/[email protected]3.0([email protected])([email protected])':
dependencies:
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
'@typescript-eslint/utils': 8.72.1([email protected])([email protected])
'@typescript-eslint/types': 8.73.0
'@typescript-eslint/typescript-estree': 8.73.0([email protected])
'@typescript-eslint/utils': 8.73.0([email protected])([email protected])
debug: 4.4.3
eslint: 9.39.5
ts-api-utils: 2.5.0([email protected])
typescript: 6.0.3
transitivePeerDependencies:
- '@typescript/native'
- supports-color
'@typescript-eslint/[email protected]2.1': {}
'@typescript-eslint/[email protected]3.0': {}
'@typescript-eslint/[email protected]2.1([email protected])':
'@typescript-eslint/[email protected]3.0([email protected])':
dependencies:
'@typescript-eslint/project-service': 8.72.1([email protected])
'@typescript-eslint/tsconfig-utils': 8.72.1([email protected])
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/visitor-keys': 8.72.1
'@typescript-eslint/project-service': 8.73.0([email protected])
'@typescript-eslint/tsconfig-utils': 8.73.0([email protected])
'@typescript-eslint/types': 8.73.0
'@typescript-eslint/visitor-keys': 8.73.0
debug: 4.4.3
minimatch: 10.2.6
minimatch: 11.0.9
semver: 7.8.5
tinyglobby: 0.2.17
ts-api-utils: 2.5.0([email protected])
@@ -2116,26 +2190,27 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
'@typescript-eslint/[email protected]3.0([email protected])([email protected])':
dependencies:
'@eslint-community/eslint-utils': 4.10.1([email protected])
'@typescript-eslint/scope-manager': 8.72.1
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
'@typescript-eslint/scope-manager': 8.73.0
'@typescript-eslint/types': 8.73.0
'@typescript-eslint/typescript-estree': 8.73.0([email protected])
eslint: 9.39.5
typescript: 6.0.3
transitivePeerDependencies:
- '@typescript/native'
- supports-color
'@typescript-eslint/[email protected]2.1':
'@typescript-eslint/[email protected]3.0':
dependencies:
'@typescript-eslint/types': 8.72.1
'@typescript-eslint/types': 8.73.0
eslint-visitor-keys: 5.0.1
'@vitejs/plugin-react@6.1.2([email protected].5(@types/[email protected])([email protected]))':
'@vitejs/plugin-react@6.3.0([email protected].8(@types/[email protected])([email protected]))':
dependencies:
'@rolldown/pluginutils': 1.0.1
vite: 8.3.5(@types/[email protected])([email protected])
vite: 8.3.8(@types/[email protected])([email protected])
[email protected]([email protected]):
dependencies:
@@ -2941,8 +3016,9 @@ snapshots:
[email protected]: {}
minimatch@10.2.6:
minimatch@11.0.9:
dependencies:
'@isaacs/nonrecursive-glob-match': 1.1.0
brace-expansion: 5.0.12
[email protected]:
@@ -3048,7 +3124,7 @@ snapshots:
[email protected]: {}
prettier@3.9.10: {}
prettier@3.10.1: {}
[email protected]:
dependencies:
@@ -3098,26 +3174,27 @@ snapshots:
path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0
[email protected]6:
[email protected]9:
dependencies:
'@oxc-project/types': 0.156.0
'@rolldown/pluginutils': 1.0.1
optionalDependencies:
'@rolldown/binding-android-arm-eabi': 1.2.16
'@rolldown/binding-android-arm64': 1.2.16
'@rolldown/binding-darwin-arm64': 1.2.16
'@rolldown/binding-darwin-x64': 1.2.16
'@rolldown/binding-freebsd-x64': 1.2.16
'@rolldown/binding-linux-arm-gnueabihf': 1.2.16
'@rolldown/binding-linux-arm64-gnu': 1.2.16
'@rolldown/binding-linux-arm64-musl': 1.2.16
'@rolldown/binding-linux-ppc64-gnu': 1.2.16
'@rolldown/binding-linux-s390x-gnu': 1.2.16
'@rolldown/binding-linux-x64-gnu': 1.2.16
'@rolldown/binding-linux-x64-musl': 1.2.16
'@rolldown/binding-openharmony-arm64': 1.2.16
'@rolldown/binding-win32-arm64-msvc': 1.2.16
'@rolldown/binding-win32-x64-msvc': 1.2.16
'@rolldown/binding-android-arm-eabi': 1.2.19
'@rolldown/binding-android-arm64': 1.2.19
'@rolldown/binding-darwin-arm64': 1.2.19
'@rolldown/binding-darwin-x64': 1.2.19
'@rolldown/binding-freebsd-x64': 1.2.19
'@rolldown/binding-linux-arm-gnueabihf': 1.2.19
'@rolldown/binding-linux-arm64-gnu': 1.2.19
'@rolldown/binding-linux-arm64-musl': 1.2.19
'@rolldown/binding-linux-ppc64-gnu': 1.2.19
'@rolldown/binding-linux-s390x-gnu': 1.2.19
'@rolldown/binding-linux-x64-gnu': 1.2.19
'@rolldown/binding-linux-x64-musl': 1.2.19
'@rolldown/binding-openharmony-arm64': 1.2.19
'@rolldown/binding-wasm32-wasi': 1.2.19
'@rolldown/binding-win32-arm64-msvc': 1.2.19
'@rolldown/binding-win32-x64-msvc': 1.2.19
[email protected]:
dependencies:
@@ -3269,6 +3346,9 @@ snapshots:
dependencies:
typescript: 6.0.3
[email protected]:
optional: true
[email protected]:
dependencies:
prelude-ls: 1.2.1
@@ -3326,12 +3406,12 @@ snapshots:
dependencies:
punycode: 2.3.1
[email protected].5(@types/[email protected])([email protected]):
[email protected].8(@types/[email protected])([email protected]):
dependencies:
lightningcss: 1.33.0
picomatch: 4.0.7
postcss: 8.5.32
rolldown: 1.2.16
rolldown: 1.2.19
tinyglobby: 0.2.17
optionalDependencies:
'@types/node': 26.6.6
+6 -11
View File
@@ -4,7 +4,7 @@ use std::{io::Read, sync::Arc};
use anyhow::{Context, bail};
use gpapi::{
clap::InfoLevelVerbosity,
gui::GuiTheme,
gui::{GuiTheme, GuiVariant, NATIVE_SHELL_SUPPORTED},
service::transport::{MAX_CREDENTIAL_FRAME, SessionCredential},
utils::env_utils,
};
@@ -30,8 +30,8 @@ struct Cli {
#[arg(long, default_value = env!("CARGO_PKG_VERSION"), help = "The version of the GUI")]
gui_version: String,
#[arg(long, default_value = "tauri", value_parser = ["tauri", "nsh"])]
gui_variant: String,
#[arg(long, value_enum, default_value_t = GuiVariant::Tauri)]
gui_variant: GuiVariant,
#[arg(long, value_enum, default_value = "system", help = "Window appearance")]
theme: GuiTheme,
@@ -44,20 +44,15 @@ impl Cli {
fn run(&self) -> anyhow::Result<()> {
let credential = self.read_credential()?;
let credential_lease = monitor_credential_lease().context("Failed to monitor service credential lifetime")?;
let variant = if self.gui_variant == "nsh" {
gpapi::gui::GuiVariant::Nsh
} else {
gpapi::gui::GuiVariant::Tauri
};
anyhow::ensure!(
variant != gpapi::gui::GuiVariant::Nsh || cfg!(target_os = "linux"),
"Native Shell is available only on Linux"
self.gui_variant != GuiVariant::Nsh || NATIVE_SHELL_SUPPORTED,
"Native Shell is unavailable for this platform"
);
let app = App::new(
Arc::new(credential),
credential_lease,
&self.gui_version,
variant,
self.gui_variant,
self.theme,
);
+18 -22
View File
@@ -42,22 +42,17 @@ const GUI_LIBC_SUFFIX: &str = "-musl";
const GUI_LIBC_SUFFIX: &str = "";
fn gui_asset_name(variant: gpapi::gui::GuiVariant) -> Option<String> {
gui_asset_name_for(variant, std::env::consts::OS, std::env::consts::ARCH, GUI_LIBC_SUFFIX)
}
fn gui_asset_name_for(variant: gpapi::gui::GuiVariant, os: &str, arch: &str, libc_suffix: &str) -> Option<String> {
if os == "linux" && matches!(arch, "x86_64" | "aarch64") {
return Some(format!("{}_{arch}{libc_suffix}.bin.tar.xz", variant.binary_name()));
}
if variant == gpapi::gui::GuiVariant::Nsh {
return nsh_asset_name_for(std::env::consts::OS, std::env::consts::ARCH);
return None;
}
gui_asset_name_for(std::env::consts::OS, std::env::consts::ARCH, GUI_LIBC_SUFFIX)
}
fn nsh_asset_name_for(os: &str, arch: &str) -> Option<String> {
match (os, arch) {
("linux", "x86_64" | "aarch64") => Some(format!("gpgui-nsh_{arch}.bin.tar.xz")),
_ => None,
}
}
fn gui_asset_name_for(os: &str, arch: &str, libc_suffix: &str) -> Option<String> {
let name = match (os, arch) {
("linux", "x86_64" | "aarch64") => format!("gpgui_{arch}{libc_suffix}.bin.tar.xz"),
("freebsd", "x86_64") => "gpgui_freebsd_amd64.bin.tar.xz".to_owned(),
("freebsd", "aarch64") => "gpgui_freebsd_arm64.bin.tar.xz".to_owned(),
("openbsd", "x86_64") => "gpgui_openbsd_amd64.bin.tar.xz".to_owned(),
@@ -506,6 +501,7 @@ impl GuiUpdater {
#[cfg(test)]
mod tests {
use gpapi::gui::GuiVariant;
use gpapi::service::{
transport::{ClientPrelude, NoiseResponder},
vpn_env::{HostInfo, VpnEnv},
@@ -519,36 +515,36 @@ mod tests {
#[test]
fn selects_platform_specific_gui_assets() {
assert_eq!(
gui_asset_name_for("linux", "x86_64", ""),
gui_asset_name_for(GuiVariant::Tauri, "linux", "x86_64", ""),
Some("gpgui_x86_64.bin.tar.xz".to_owned())
);
assert_eq!(
gui_asset_name_for("linux", "aarch64", "-musl"),
gui_asset_name_for(GuiVariant::Tauri, "linux", "aarch64", "-musl"),
Some("gpgui_aarch64-musl.bin.tar.xz".to_owned())
);
assert_eq!(
gui_asset_name_for("freebsd", "x86_64", ""),
gui_asset_name_for(GuiVariant::Tauri, "freebsd", "x86_64", ""),
Some("gpgui_freebsd_amd64.bin.tar.xz".to_owned())
);
assert_eq!(
gui_asset_name_for("openbsd", "aarch64", ""),
gui_asset_name_for(GuiVariant::Tauri, "openbsd", "aarch64", ""),
Some("gpgui_openbsd_arm64.bin.tar.xz".to_owned())
);
assert_eq!(gui_asset_name_for("macos", "aarch64", ""), None);
assert_eq!(gui_asset_name_for(GuiVariant::Tauri, "macos", "aarch64", ""), None);
}
#[test]
fn nsh_assets_are_linux_only_and_use_the_nsh_binary_archive() {
assert_eq!(
nsh_asset_name_for("linux", "x86_64"),
gui_asset_name_for(GuiVariant::Nsh, "linux", "x86_64", ""),
Some("gpgui-nsh_x86_64.bin.tar.xz".into())
);
assert_eq!(
nsh_asset_name_for("linux", "aarch64"),
Some("gpgui-nsh_aarch64.bin.tar.xz".into())
gui_asset_name_for(GuiVariant::Nsh, "linux", "aarch64", "-musl"),
Some("gpgui-nsh_aarch64-musl.bin.tar.xz".into())
);
for os in ["freebsd", "openbsd", "macos"] {
assert_eq!(nsh_asset_name_for(os, "x86_64"), None);
assert_eq!(gui_asset_name_for(GuiVariant::Nsh, os, "x86_64", ""), None);
}
}
+2 -2
View File
@@ -23,8 +23,6 @@ serde_json.workspace = true
env_logger.workspace = true
log.workspace = true
compile-time.workspace = true
xz2 = "0.1"
tar = "0.4"
thiserror.workspace = true
uuid = { workspace = true, features = ["v4"] }
zeroize.workspace = true
@@ -33,6 +31,8 @@ getrandom = "0.4"
[target.'cfg(unix)'.dependencies]
nix = { version = "0.31", features = ["fs", "socket", "user"] }
tar = "0.4"
xz2 = "0.1"
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
mac_address = "1.2.1"
+4 -4
View File
@@ -1,10 +1,10 @@
use gpapi::service::request::ConnectArgs;
use gpvpnc::windows::SystemTunnel;
use openconnect::{Vpn, VpnBuilder};
use std::sync::Mutex;
const RECOVERY_KEY: &str = r"SOFTWARE\GP Connect\NetworkRecovery";
pub(crate) fn recover_network() -> std::io::Result<()> {
gpvpnc::windows::recover(RECOVERY_KEY)
let _tunnel = SystemTunnel::try_acquire()?;
Ok(())
}
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow::Result<VpnBuilder> {
@@ -12,7 +12,7 @@ pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow:
args.vpnc_script().is_none(),
"Windows does not support custom VPN scripts"
);
let network = Mutex::new(gpvpnc::windows::NetworkConfigurator::new(RECOVERY_KEY)?);
let network = Mutex::new(SystemTunnel::acquire()?.configurator()?);
Ok(
Vpn::builder(server, cookie).network_configuration_handler(move |configuration| {
network
+15
View File
@@ -1,5 +1,20 @@
# Changelog
## 3.7.0
- 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`.
- 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
- Added command-line VPN connections on Windows x64 and ARM64.
- Added support for Windows 10 1809 and Windows Server 2019 with Desktop Experience.
- Improved light and dark theme contrast and fixed the tray icon on older Windows versions.
- Simplified log access and feedback in Diagnostics.
## 3.5.0
### Added
+1 -1
View File
@@ -108,5 +108,5 @@ tauri = { workspace = true, optional = true, features = ["unstable"] }
webview2-com = { version = "0.39", optional = true }
windows = { version = "0.62", optional = true, features = ["Win32_Foundation", "Win32_Graphics_Gdi", "Win32_System_Com", "Win32_UI_Controls", "Win32_UI_HiDpi", "Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] }
dunce = "1"
winreg = "0.55"
winreg = "0.56"
common = { path = "../common" }
+1 -1
View File
@@ -17,7 +17,7 @@ default = []
launcher = ["dep:open", "dep:webbrowser", "dep:which", "dep:winreg"]
[target.'cfg(windows)'.dependencies]
winreg = { version = "0.55", optional = true }
winreg = { version = "0.56", optional = true }
[target.'cfg(unix)'.dependencies]
open = { version = "5", optional = true }
+1 -4
View File
@@ -101,10 +101,7 @@ uzers = { workspace = true, optional = true }
[target.'cfg(windows)'.dependencies]
file-rotate = { version = "0.8.0", optional = true }
windows-sys = { version = "0.61", features = ["Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock", "Win32_Foundation", "Win32_Security", "Win32_Security_Authorization", "Win32_Storage_FileSystem", "Win32_System_Pipes", "Win32_System_Threading", "Win32_System_Services", "Win32_Globalization", "Win32_System_Environment", "Win32_System_JobObjects", "Win32_System_IO", "Win32_System_Registry", "Win32_System_SystemInformation"] }
[target.'cfg(windows)'.dev-dependencies]
windows-sys = { version = "0.61", features = ["Win32_UI_Shell"] }
windows-sys = { version = "0.61", features = ["Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock", "Win32_Foundation", "Win32_Security", "Win32_Security_Authorization", "Win32_Security_Cryptography", "Win32_Storage_FileSystem", "Win32_System_Pipes", "Win32_System_Threading", "Win32_System_Services", "Win32_Globalization", "Win32_System_Environment", "Win32_System_JobObjects", "Win32_System_IO", "Win32_System_Registry", "Win32_System_SystemInformation", "Win32_System_Console", "Win32_System_RemoteDesktop", "Win32_System_SystemServices", "Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] }
[[test]]
name = "certificate_compatibility"
+37 -65
View File
@@ -8,6 +8,13 @@ use serde::{Deserialize, Serialize};
use crate::credential::AuthCookieCredential;
#[cfg(unix)]
#[path = "cookie_store/unix.rs"]
mod platform;
#[cfg(windows)]
#[path = "cookie_store/windows.rs"]
mod platform;
const STORE_VERSION: u32 = 1;
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -45,16 +52,15 @@ impl StoredCookie {
}
}
pub fn cookie_path(custom: Option<&str>) -> PathBuf {
if let Some(p) = custom {
return PathBuf::from(p);
pub fn cookie_path(custom: Option<&str>) -> Option<PathBuf> {
match custom {
Some(path) => Some(PathBuf::from(path)),
None => platform::default_path(),
}
let home = std::env::var("HOME").unwrap_or_else(|_| "/root".to_string());
PathBuf::from(home).join(".config/gpclient/cookie.json")
}
pub fn load(path: &Path, server: &str, host_id: &str) -> Option<StoredCookie> {
let bytes = fs::read(path).ok()?;
let bytes = zeroize::Zeroizing::new(platform::decode(fs::read(path).ok()?).ok()?);
let stored: StoredCookie = serde_json::from_slice(&bytes).ok()?;
if stored.version != STORE_VERSION || stored.server != server || stored.host_id != host_id {
return None;
@@ -67,12 +73,12 @@ pub fn save(path: &Path, stored: &StoredCookie) -> anyhow::Result<()> {
.parent()
.ok_or_else(|| anyhow::anyhow!("cookie path has no parent directory"))?;
fs::create_dir_all(parent)?;
set_private_dir_permissions(parent)?;
platform::prepare_directory(parent)?;
let mut tmp = tempfile::NamedTempFile::new_in(parent)?;
tmp.write_all(&serde_json::to_vec(stored)?)?;
tmp.write_all(&platform::encode(serde_json::to_vec(stored)?)?)?;
tmp.flush()?;
set_private_file_permissions(tmp.path())?;
platform::prepare_file(tmp.path())?;
tmp.persist(path)?;
Ok(())
}
@@ -81,60 +87,6 @@ pub fn clear(path: &Path) {
let _ = fs::remove_file(path);
}
use permissions::{set_private_dir_permissions, set_private_file_permissions};
mod permissions {
use std::path::Path;
#[cfg(unix)]
mod unix {
use std::{fs, os::unix::fs::PermissionsExt, path::Path};
pub(super) fn set_private_dir(path: &Path) -> anyhow::Result<()> {
fs::set_permissions(path, fs::Permissions::from_mode(0o700))?;
Ok(())
}
pub(super) fn set_private_file(path: &Path) -> anyhow::Result<()> {
fs::set_permissions(path, fs::Permissions::from_mode(0o600))?;
Ok(())
}
#[cfg(test)]
pub(super) fn file_mode(path: &Path) -> Option<u32> {
Some(fs::metadata(path).ok()?.permissions().mode() & 0o777)
}
}
pub(super) fn set_private_dir_permissions(path: &Path) -> anyhow::Result<()> {
#[cfg(unix)]
unix::set_private_dir(path)?;
#[cfg(not(unix))]
let _ = path;
Ok(())
}
pub(super) fn set_private_file_permissions(path: &Path) -> anyhow::Result<()> {
#[cfg(unix)]
unix::set_private_file(path)?;
#[cfg(not(unix))]
let _ = path;
Ok(())
}
#[cfg(test)]
pub(super) fn file_mode(path: &Path) -> Option<u32> {
#[cfg(unix)]
return unix::file_mode(path);
#[cfg(not(unix))]
{
let _ = path;
None
}
}
}
#[cfg(test)]
mod tests {
use super::*;
@@ -149,6 +101,24 @@ mod tests {
)
}
#[cfg(windows)]
#[test]
fn windows_cookie_cache_uses_profile_storage_and_protects_credentials() {
let default_path = cookie_path(None).unwrap();
assert!(default_path.starts_with(PathBuf::from(std::env::var_os("LOCALAPPDATA").unwrap())));
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("cookie.json");
save(&path, &sample()).unwrap();
let bytes = fs::read(&path).unwrap();
assert!(
!bytes
.windows(b"prelogon-auth".len())
.any(|part| part == b"prelogon-auth")
);
assert!(load(&path, "vpn.example.com", "host-1").is_some());
}
#[test]
fn roundtrip_and_mode_0600() {
let dir = tempfile::tempdir().unwrap();
@@ -156,8 +126,10 @@ mod tests {
let s = sample();
save(&path, &s).unwrap();
if let Some(mode) = permissions::file_mode(&path) {
assert_eq!(mode, 0o600, "cookie file must be mode 0600, got {:o}", mode);
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600);
}
let loaded = load(&path, "vpn.example.com", "host-1").unwrap();
+24
View File
@@ -0,0 +1,24 @@
use std::{
fs, io,
os::unix::fs::PermissionsExt,
path::{Path, PathBuf},
};
pub(super) fn default_path() -> Option<PathBuf> {
let home = std::env::var("HOME").unwrap_or_else(|_| "/root".to_string());
Some(PathBuf::from(home).join(".config/gpclient/cookie.json"))
}
pub(super) fn encode(bytes: Vec<u8>) -> io::Result<Vec<u8>> {
Ok(bytes)
}
pub(super) use encode as decode;
pub(super) fn prepare_directory(path: &Path) -> io::Result<()> {
fs::set_permissions(path, fs::Permissions::from_mode(0o700))
}
pub(super) fn prepare_file(path: &Path) -> io::Result<()> {
fs::set_permissions(path, fs::Permissions::from_mode(0o600))
}
+87
View File
@@ -0,0 +1,87 @@
use std::{
ffi::OsString,
io,
os::windows::ffi::OsStringExt,
path::{Path, PathBuf},
ptr, slice,
};
use windows_sys::Win32::{
Foundation::LocalFree,
Security::Cryptography::{CRYPT_INTEGER_BLOB, CRYPTPROTECT_UI_FORBIDDEN, CryptProtectData, CryptUnprotectData},
UI::Shell::{CSIDL_LOCAL_APPDATA, SHGetFolderPathW},
};
use zeroize::Zeroize;
pub(super) fn default_path() -> Option<PathBuf> {
let mut path = [0; 260];
let result = unsafe {
SHGetFolderPathW(
ptr::null_mut(),
CSIDL_LOCAL_APPDATA as i32,
ptr::null_mut(),
0,
path.as_mut_ptr(),
)
};
let length = path.iter().position(|&unit| unit == 0).filter(|&length| length > 0)?;
(result >= 0).then(|| PathBuf::from(OsString::from_wide(&path[..length])).join(r"GP Connect\gpclient\cookie.bin"))
}
pub(super) fn encode(mut bytes: Vec<u8>) -> io::Result<Vec<u8>> {
let result = transform(&mut bytes, true);
bytes.zeroize();
result
}
pub(super) fn decode(mut bytes: Vec<u8>) -> io::Result<Vec<u8>> {
transform(&mut bytes, false)
}
// DPAPI encrypts for the current Windows user, including at custom paths.
fn transform(bytes: &mut [u8], protect: bool) -> io::Result<Vec<u8>> {
let input = CRYPT_INTEGER_BLOB {
cbData: u32::try_from(bytes.len()).map_err(io::Error::other)?,
pbData: bytes.as_mut_ptr(),
};
let mut output = CRYPT_INTEGER_BLOB::default();
let success = unsafe {
if protect {
CryptProtectData(
&input,
ptr::null(),
ptr::null(),
ptr::null(),
ptr::null(),
CRYPTPROTECT_UI_FORBIDDEN,
&mut output,
)
} else {
CryptUnprotectData(
&input,
ptr::null_mut(),
ptr::null(),
ptr::null(),
ptr::null(),
CRYPTPROTECT_UI_FORBIDDEN,
&mut output,
)
}
};
if success == 0 {
return Err(io::Error::last_os_error());
}
if output.pbData.is_null() {
return Err(io::Error::other("Windows returned no cookie cache data"));
}
let buffer = unsafe { slice::from_raw_parts_mut(output.pbData, output.cbData as usize) };
let result = buffer.to_vec();
buffer.zeroize();
unsafe { LocalFree(output.pbData.cast()) };
Ok(result)
}
pub(super) fn prepare_directory(_: &Path) -> io::Result<()> {
Ok(())
}
pub(super) use prepare_directory as prepare_file;
+17 -14
View File
@@ -4,6 +4,7 @@ use specta::Type;
use std::path::PathBuf;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Type)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
#[serde(rename_all = "kebab-case")]
pub enum GuiVariant {
#[default]
@@ -77,21 +78,23 @@ fn preference_path(name: &str) -> anyhow::Result<PathBuf> {
Ok(dirs.config_dir().join(name))
}
pub fn preferred() -> anyhow::Result<GuiVariant> {
#[cfg(target_os = "linux")]
{
match std::fs::read_to_string(preference_path("gui")?) {
Ok(value) => match value.trim() {
"gpgui" => Ok(GuiVariant::Tauri),
"gpgui-nsh" => Ok(GuiVariant::Nsh),
_ => anyhow::bail!("Invalid GUI preference"),
},
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(GuiVariant::Tauri),
Err(error) => Err(error.into()),
}
pub const NATIVE_SHELL_SUPPORTED: bool = cfg!(all(
target_os = "linux",
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_env = "gnu", target_env = "musl")
));
#[cfg(target_os = "linux")]
pub(crate) fn saved_preference() -> anyhow::Result<Option<GuiVariant>> {
match std::fs::read_to_string(preference_path("gui")?) {
Ok(value) => match value.trim() {
"gpgui" => Ok(Some(GuiVariant::Tauri)),
"gpgui-nsh" => Ok(Some(GuiVariant::Nsh)),
_ => anyhow::bail!("Invalid GUI preference"),
},
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(None),
Err(error) => Err(error.into()),
}
#[cfg(not(target_os = "linux"))]
Ok(GuiVariant::Tauri)
}
#[cfg(target_os = "linux")]
+20
View File
@@ -32,6 +32,8 @@ pub struct SamlAuthLauncher<'a> {
cancellation: CancellationToken,
server: &'a str,
auth_executable: Option<&'a str>,
#[cfg(windows)]
windows_cli: bool,
gateway: bool,
saml_request: Option<&'a str>,
os: Option<&'a str>,
@@ -65,6 +67,8 @@ impl<'a> SamlAuthLauncher<'a> {
cancellation: CancellationToken::new(),
server,
auth_executable: None,
#[cfg(windows)]
windows_cli: false,
gateway: false,
saml_request: None,
os: None,
@@ -93,6 +97,12 @@ impl<'a> SamlAuthLauncher<'a> {
}
}
#[cfg(windows)]
pub fn with_windows_cli_launch(mut self) -> Self {
self.windows_cli = true;
self
}
pub fn desktop_compatibility_graphics(mut self) -> Self {
self.desktop_compatibility_graphics = true;
self
@@ -297,6 +307,12 @@ impl<'a> SamlAuthLauncher<'a> {
.auth_executable
.map(PathBuf::from)
.unwrap_or_else(binary_paths::gpauth);
#[cfg(windows)]
let program = if self.windows_cli {
crate::windows::application_directory()?.join("gpauth.exe")
} else {
program
};
let auth_cmd = self.build_command(&program);
let mut command = auth_cmd.into_non_root()?.into_std();
@@ -317,6 +333,8 @@ impl<'a> SamlAuthLauncher<'a> {
let detect_gbm_failure = can_use_shared_memory && !use_shared_memory;
let stdin = auth_stdin(self.browser);
let cancellation = self.cancellation.clone();
#[cfg(windows)]
let windows_cli = self.windows_cli;
let output = tokio::task::spawn_blocking(move || {
#[cfg(feature = "logger")]
let stderr = crate::logger::diagnostic_writer();
@@ -351,6 +369,8 @@ impl<'a> SamlAuthLauncher<'a> {
},
&mut stderr,
stdin,
#[cfg(windows)]
windows_cli,
);
std::io::Write::flush(&mut stderr)?;
if gbm_failed.get() && !cancellation.is_cancelled() {
+5 -4
View File
@@ -5,7 +5,7 @@ use super::{
is_crash_exit,
},
};
use crate::service::transport::SessionCredential;
use crate::{gui::GuiVariant, service::transport::SessionCredential};
use anyhow::Context;
use std::{
cell::Cell,
@@ -23,10 +23,11 @@ pub(super) async fn launch_desktop_child(
envs: Option<&HashMap<String, String>>,
credential: &SessionCredential,
cancellation: &CancellationToken,
detect_gbm_failure: bool,
interface: Option<GuiVariant>,
) -> anyhow::Result<ExitStatus> {
let retry_eligible = eligible_with_inheritance(&command, envs.is_none());
let detect_gbm_failure = detect_gbm_failure && allows_shared_memory_override(&command, envs.is_none());
let retry_eligible = interface != Some(GuiVariant::Nsh) && eligible_with_inheritance(&command, envs.is_none());
let detect_gbm_failure =
interface == Some(GuiVariant::Tauri) && allows_shared_memory_override(&command, envs.is_none());
let log_file = match envs {
Some(envs) => envs.get("GP_LOG_FILE").map(PathBuf::from),
None => std::env::var_os("GP_LOG_FILE").map(PathBuf::from),
+50 -13
View File
@@ -24,26 +24,48 @@ use crate::service::transport::{MAX_CREDENTIAL_FRAME, SessionCredential};
/// Owns the desktop GUI and its privileged service without leaving the desktop session.
pub struct DesktopLauncher<'a> {
version: &'a str,
#[cfg(target_os = "linux")]
interface: Option<crate::gui::GuiVariant>,
minimized: bool,
log_file: Option<String>,
}
impl<'a> DesktopLauncher<'a> {
/// Bring an already-running GUI to the foreground through its service.
pub async fn activate_existing() -> anyhow::Result<()> {
let endpoint = crate::utils::endpoint::http_endpoint().await?;
crate::utils::request::client_builder()
.build()?
.post(format!("{endpoint}/active-gui"))
.send()
.await?
.error_for_status()?;
Ok(())
/// Plain launches raise the existing window. Explicit selections require a cold launch.
pub async fn activate_or_reject_existing(&self) -> anyhow::Result<bool> {
let Ok(endpoint) = crate::utils::endpoint::http_endpoint().await else {
return Ok(false);
};
let client = crate::utils::request::client_builder().no_proxy().build()?;
#[cfg(target_os = "linux")]
if self.interface.is_some() {
let response = client.get(format!("{endpoint}/health")).send().await;
ensure!(
!response.is_ok_and(|r| r.status().is_success()),
"GP Connect is already running. Quit GP Connect and run this command again."
);
return Ok(false);
}
Ok(
client
.post(format!("{endpoint}/active-gui"))
.send()
.await
.is_ok_and(|r| r.status().is_success()),
)
}
#[cfg(target_os = "linux")]
pub fn interface(mut self, interface: Option<crate::gui::GuiVariant>) -> Self {
self.interface = interface;
self
}
pub fn new(version: &'a str) -> Self {
Self {
version,
#[cfg(target_os = "linux")]
interface: None,
minimized: false,
log_file: None,
}
@@ -87,6 +109,8 @@ impl<'a> DesktopLauncher<'a> {
let result = {
let operation = async {
let mut minimized = self.minimized;
#[cfg(target_os = "linux")]
let mut explicit_interface = self.interface;
let mut expecting_renewal = false;
loop {
let credential = tokio::select! {
@@ -119,15 +143,27 @@ impl<'a> DesktopLauncher<'a> {
if let Some(path) = &self.log_file {
envs.insert("GP_LOG_FILE".into(), path.clone());
}
let launcher = GuiLauncher::new(self.version, Arc::new(credential), crate::gui::preferred()?)
.envs(envs)
.minimized(minimized);
#[cfg(not(target_os = "linux"))]
let mut unexpected = [0];
// Program resolution may launch the WebKit download helper. Keep it under
// the same cancellation, service ownership and recovery budget as gpgui.
let outcome = {
let attempt = async {
#[cfg(target_os = "linux")]
let variant = {
let requested = match explicit_interface {
Some(variant) => Some(variant),
None => crate::gui::saved_preference()?,
};
super::nsh_runtime::select(requested, &mut input, &mut output)
.await
.context(super::nsh_runtime::TAURI_RECOVERY)?
};
#[cfg(not(target_os = "linux"))]
let variant = crate::gui::GuiVariant::Tauri;
let launcher = GuiLauncher::new(self.version, Arc::new(credential), variant)
.envs(envs)
.minimized(minimized);
let program = launcher
.resolve_program(&cancellation, crate::gui::GuiTheme::System)
.await?;
@@ -137,6 +173,7 @@ impl<'a> DesktopLauncher<'a> {
&program,
&cancellation,
&switch_listener.listener,
&mut explicit_interface,
&mut input,
&mut output,
)
@@ -79,7 +79,7 @@ impl<'a> GuiHelperLauncher<'a> {
self.envs,
self.credential,
cancellation,
false,
None,
)
.await?;
Ok(())
+203 -137
View File
@@ -5,6 +5,8 @@ use std::{
sync::Arc,
};
#[cfg(target_os = "linux")]
use anyhow::Context;
use anyhow::bail;
use log::info;
use tokio::process::Command;
@@ -113,12 +115,12 @@ impl<'a> GuiLauncher<'a> {
}
info!("Launching {}", program.display());
super::desktop_child::launch_desktop_child(
"gpgui",
self.variant.binary_name(),
cmd.into_std(),
self.envs.as_ref(),
&self.credential,
cancellation,
self.variant == crate::gui::GuiVariant::Tauri,
Some(self.variant),
)
.await
}
@@ -172,6 +174,7 @@ impl<'a> GuiLauncher<'a> {
program: &Path,
cancellation: &CancellationToken,
listener: &tokio::net::UnixListener,
explicit_interface: &mut Option<crate::gui::GuiVariant>,
service_input: &mut (impl tokio::io::AsyncWrite + Unpin),
service_output: &mut (impl tokio::io::AsyncRead + Unpin),
) -> anyhow::Result<ExitStatus> {
@@ -179,119 +182,111 @@ impl<'a> GuiLauncher<'a> {
use crate::gui::GuiSwitchOutcome;
use crate::service::transport::{DESKTOP_SWITCH_BEGIN, DESKTOP_SWITCH_CANCEL, DESKTOP_SWITCH_COMMIT};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
let mut current = Some(self.start_owned(program.to_owned(), cancellation.child_token()));
let mut cold_nsh = self.variant == crate::gui::GuiVariant::Nsh;
let first = if explicit_interface.is_some() {
let started = self.start_and_save(program, cancellation).await;
let child = if cold_nsh {
started.context(super::nsh_runtime::TAURI_RECOVERY)?
} else {
started?
};
*explicit_interface = None;
child
} else {
self.start_owned(program, cancellation.child_token(), None)
};
let mut current = Some(first);
let mut retired = Vec::new();
let mut unexpected = [0];
let result = async { loop {
tokio::select! {
biased;
outcome = &mut current.as_mut().unwrap().task => {
current.take();
break outcome?;
}
accepted = listener.accept() => {
let (mut socket, _) = accepted?;
let mut pending = false;
let replacement = async {
let command = gui_switch::receive(&mut socket).await?;
let selection = command.selection;
let variant = selection.variant;
let candidate = Self::new(self.version, self.credential.clone(), variant).envs(self.envs.clone());
let program = candidate.find_compatible_program(cancellation).await?;
if program.is_none() && variant == crate::gui::GuiVariant::Nsh {
use crate::service::transport::DESKTOP_GUI_INSTALLER;
service_input.write_all(&[DESKTOP_GUI_INSTALLER]).await?;
let supplies_runtime = match service_output.read_u8().await? {
0 => false,
1 => true,
_ => anyhow::bail!("Invalid GUI installer capability response"),
};
if !supplies_runtime {
super::nsh_runtime::check()?;
let result = async {
loop {
tokio::select! {
biased;
outcome = &mut current.as_mut().unwrap().task => {
current.take();
break if cold_nsh {
outcome?.context(super::nsh_runtime::TAURI_RECOVERY)
} else {
outcome?
};
}
accepted = listener.accept() => {
let (mut socket, _) = accepted?;
let mut pending = false;
let replacement = async {
let command = gui_switch::receive(&mut socket).await?;
let selection = command.selection;
let variant = selection.variant;
super::nsh_runtime::select(Some(variant), service_input, service_output).await?;
let candidate = Self::new(self.version, self.credential.clone(), variant).envs(self.envs.clone());
let program = candidate.find_compatible_program(cancellation).await?;
if program.is_none() && !selection.allow_download {
gui_switch::reply(&mut socket, Ok(GuiSwitchOutcome::DownloadRequired)).await?;
return Ok(None);
}
}
if program.is_none() && !selection.allow_download {
gui_switch::reply(&mut socket, Ok(GuiSwitchOutcome::DownloadRequired)).await?;
return Ok(None);
}
use super::rendering_recovery::{GbmBufferFailure, RecoveryState};
let mut recovery = RecoveryState::default();
let mut program = program;
let (mut child, start_result) = loop {
service_input.write_all(&[DESKTOP_SWITCH_BEGIN]).await?;
pending = true;
let credential = super::desktop_launcher::read_credential(service_output).await?
.ok_or_else(|| anyhow::anyhow!("Service closed before issuing the switch credential"))?;
anyhow::ensure!(credential.product_version() == self.version, "Service product version mismatch");
let ready = gui_switch::SwitchListener::new()?;
let mut envs = self.envs.clone().unwrap_or_else(|| std::env::vars().collect());
envs.insert(gui_switch::READY_ENV.into(), ready.path().to_string_lossy().into_owned());
let launcher = Self::new(self.version, Arc::new(credential), variant)
.envs(envs)
.minimized(false);
let executable = match &program {
Some(program) => program.clone(),
None => launcher.resolve_program(cancellation, command.theme).await?,
};
let mut child = launcher.start_owned(executable.clone(), cancellation.child_token());
let start_result = tokio::select! {
result = tokio::time::timeout(std::time::Duration::from_secs(30), ready.ready()) => {
result.map_err(|_| anyhow::anyhow!("The selected GUI did not finish starting" )).and_then(|result| result)
},
outcome = &mut child.task => {
match outcome? {
Ok(status) => return Err(anyhow::anyhow!("The selected GUI exited during startup: {status}")),
Err(error) if error.is::<GbmBufferFailure>() && recovery.recover(&error) => {
log::warn!("{error}; restarting the selected GUI with compatibility graphics");
service_input.write_all(&[DESKTOP_SWITCH_CANCEL]).await?;
pending = false;
program = Some(executable);
continue;
}
Err(error) => return Err(recovery.terminal(error)),
use super::rendering_recovery::{GbmBufferFailure, RecoveryState};
let mut recovery = RecoveryState::default();
let mut program = program;
let child = loop {
service_input.write_all(&[DESKTOP_SWITCH_BEGIN]).await?;
pending = true;
let credential = super::desktop_launcher::read_credential(service_output).await?
.ok_or_else(|| anyhow::anyhow!("Service closed before issuing the switch credential"))?;
anyhow::ensure!(credential.product_version() == self.version, "Service product version mismatch");
let launcher = Self::new(self.version, Arc::new(credential), variant).envs(self.envs.clone());
let executable = match &program {
Some(program) => program.clone(),
None => launcher.resolve_program(cancellation, command.theme).await?,
};
match launcher.start_and_save(&executable, cancellation).await {
Ok(child) => break child,
Err(error) if error.is::<GbmBufferFailure>() && recovery.recover(&error) => {
log::warn!("{error}; restarting the selected GUI with compatibility graphics");
service_input.write_all(&[DESKTOP_SWITCH_CANCEL]).await?;
pending = false;
program = Some(executable);
}
Err(error) => return Err(recovery.terminal(error)),
}
};
break (child, start_result);
};
if let Err(error) = start_result.and_then(|()| crate::gui::save_preference(variant)) {
child.cancel.cancel();
let _ = child.task.await;
return Err(error);
}
if let Err(error) = gui_switch::reply(&mut socket, Ok(GuiSwitchOutcome::Switched)).await {
child.cancel.cancel();
let _ = child.task.await;
return Err(error);
}
if let Err(error) = service_input.write_all(&[DESKTOP_SWITCH_COMMIT]).await {
child.cancel.cancel();
let _ = child.task.await;
return Err(error.into());
}
pending = false;
Ok(Some(child))
}.await;
match replacement {
Ok(Some(child)) => retired.push(current.replace(child).unwrap()),
Ok(None) => {},
Err(error) => {
if pending {
service_input.write_all(&[DESKTOP_SWITCH_CANCEL]).await?;
if let Err(error) = gui_switch::reply(&mut socket, Ok(GuiSwitchOutcome::Switched)).await {
child.cancel.cancel();
let _ = child.task.await;
return Err(error);
}
if let Err(error) = service_input.write_all(&[DESKTOP_SWITCH_COMMIT]).await {
child.cancel.cancel();
let _ = child.task.await;
return Err(error.into());
}
pending = false;
Ok(Some(child))
}.await;
match replacement {
Ok(Some(child)) => {
cold_nsh = false;
retired.push(current.replace(child).unwrap());
}
Ok(None) => {},
Err(error) => {
if pending {
service_input.write_all(&[DESKTOP_SWITCH_CANCEL]).await?;
}
let _ = gui_switch::reply(&mut socket, Err(format!("{error:#}"))).await;
}
let _ = gui_switch::reply(&mut socket, Err(format!("{error:#}"))).await;
}
}
}
result = service_output.read(&mut unexpected) => {
break match result {
Ok(0) => Err(anyhow::anyhow!("The privileged service closed its credential channel")),
Ok(_) => Err(anyhow::anyhow!("Unexpected service credential data while the GUI is running")),
Err(error) => Err(error.into()),
};
result = service_output.read(&mut unexpected) => {
break match result {
Ok(0) => Err(anyhow::anyhow!("The privileged service closed its credential channel")),
Ok(_) => Err(anyhow::anyhow!("Unexpected service credential data while the GUI is running")),
Err(error) => Err(error.into()),
};
}
}
}
}}.await;
}
.await;
// Every GUI remains owned by this supervisor until it is reaped. The retiring
// GUI exits after the successful switch reply; cancellation also joins it.
if let Some(child) = current {
@@ -307,11 +302,38 @@ impl<'a> GuiLauncher<'a> {
}
#[cfg(target_os = "linux")]
fn start_owned(&self, program: PathBuf, cancel: CancellationToken) -> RunningGui {
/// Cold CLI selection and a Settings switch commit the preference after native readiness.
async fn start_and_save(&self, program: &Path, cancellation: &CancellationToken) -> anyhow::Result<RunningGui> {
let ready = super::gui_switch::SwitchListener::new()?;
let mut child = self.start_owned(program, cancellation.child_token(), Some(&ready.path()));
let started = tokio::select! {
biased;
_ = cancellation.cancelled() => Err(anyhow::anyhow!("GUI startup cancelled")),
status = &mut child.task => bail!("The selected GUI exited during startup: {}", status??),
result = tokio::time::timeout(std::time::Duration::from_secs(30), ready.ready()) => {
result.context("The selected GUI did not finish starting").and_then(|result| result)
}
};
if let Err(error) = started.and_then(|()| crate::gui::save_preference(self.variant)) {
child.cancel.cancel();
let _ = child.task.await;
return Err(error);
}
Ok(child)
}
#[cfg(target_os = "linux")]
fn start_owned(&self, program: &Path, cancel: CancellationToken, ready: Option<&Path>) -> RunningGui {
let program = program.to_owned();
let version = self.version.to_owned();
let variant = self.variant;
let credential = self.credential.clone();
let envs = self.envs.clone();
let mut envs = self.envs.clone();
if let Some(path) = ready {
envs
.get_or_insert_with(|| std::env::vars().collect())
.insert(super::gui_switch::READY_ENV.into(), path.to_string_lossy().into_owned());
}
let minimized = self.minimized;
let task_cancel = cancel.clone();
let task = tokio::spawn(async move {
@@ -501,30 +523,6 @@ mod tests {
);
}
#[tokio::test]
async fn nsh_version_mismatch_cannot_select_a_compatible_tauri_binary() {
let dir = TempDir::new().unwrap();
let _tauri = executable(&dir, "gpgui", "gpgui test-version", 0);
let nsh = executable(&dir, "gpgui-nsh", "gpgui-nsh old-version", 0);
let mut selected = launcher(VERSION, vec![nsh.clone()]);
selected.variant = crate::gui::GuiVariant::Nsh;
assert!(
selected
.find_compatible_program(&CancellationToken::new())
.await
.unwrap()
.is_none()
);
executable(&dir, "gpgui-nsh", "gpgui-nsh test-version", 0);
assert_eq!(
selected
.find_compatible_program(&CancellationToken::new())
.await
.unwrap(),
Some(nsh)
);
}
#[test]
#[cfg(target_os = "linux")]
fn supervisor_switch_success_and_failure_preserve_child_ownership() {
@@ -535,6 +533,11 @@ mod tests {
"incompatible",
"runtime-too-old",
"runtime-too-old-confirmed",
"cold-default",
"cold-explicit",
"cold-explicit-failure",
"cold-explicit-clean-exit",
"cold-default-failure",
] {
let directory = TempDir::new().unwrap();
let executable = std::env::current_exe().unwrap();
@@ -542,7 +545,7 @@ mod tests {
let gtk = super::super::nsh_runtime::tests::gtk_fixture(directory.path(), 12);
fs::rename(gtk, directory.path().join("libgtk-4.so.1")).unwrap();
for name in ["gpgui", "gpgui-nsh"] {
if (scenario == "missing" || scenario.starts_with("runtime-too-old")) && name == "gpgui-nsh" {
if (scenario == "missing" || scenario == "runtime-too-old") && name == "gpgui-nsh" {
continue;
}
let version = if scenario == "incompatible" && name == "gpgui-nsh" {
@@ -631,7 +634,7 @@ mod tests {
async fn upgrade_fixture() {
crate::gui::save_preference(crate::gui::GuiVariant::Nsh).unwrap();
let credential = Arc::new(SessionCredential::generate(Uuid::new_v4(), VERSION).unwrap());
let selected = GuiLauncher::new(VERSION, credential, crate::gui::preferred().unwrap());
let selected = GuiLauncher::new(VERSION, credential, crate::gui::saved_preference().unwrap().unwrap());
let program = selected
.resolve_program(&CancellationToken::new(), crate::gui::GuiTheme::System)
.await
@@ -670,8 +673,14 @@ mod tests {
input.read_exact(&mut frame).unwrap();
let directory = PathBuf::from(std::env::var_os("GP_SWITCH_DIRECTORY").unwrap());
let variant = std::env::var("GP_SWITCH_GUI_VARIANT").unwrap();
if variant == "gpgui-nsh" && std::env::var("GP_SWITCH_SCENARIO").unwrap() == "failure" {
panic!("fixture: native host failed to initialize");
if variant == "gpgui-nsh" {
let scenario = std::env::var("GP_SWITCH_SCENARIO").unwrap();
if scenario.ends_with("failure") {
panic!("fixture: native host failed to initialize");
}
if scenario.ends_with("clean-exit") {
return;
}
}
super::super::gui_switch::notify_ready().unwrap();
fs::write(directory.join(format!("{variant}-started")), "").unwrap();
@@ -719,13 +728,64 @@ mod tests {
}
});
let envs = std::env::vars().collect::<HashMap<_, _>>();
let launcher = launcher(VERSION, vec![]).envs(envs);
let mut launcher = launcher(VERSION, vec![]).envs(envs);
let cancel = CancellationToken::new();
if runtime_too_old {
assert_eq!(
super::super::nsh_runtime::select(None, &mut service_input, &mut service_output)
.await
.unwrap(),
crate::gui::GuiVariant::Tauri
);
}
if scenario.starts_with("cold-") {
use crate::gui::{GuiVariant, saved_preference};
let mut explicit = scenario.contains("explicit").then_some(GuiVariant::Nsh);
if explicit.is_some() {
crate::gui::save_preference(GuiVariant::Tauri).unwrap();
}
launcher.variant = super::super::nsh_runtime::select(explicit, &mut service_input, &mut service_output)
.await
.unwrap();
assert_eq!(launcher.variant, GuiVariant::Nsh);
let program = directory.join(launcher.variant.binary_name());
let run = launcher.launch_with_switches(
&program,
&cancel,
&listener.listener,
&mut explicit,
&mut service_input,
&mut service_output,
);
if scenario.ends_with("failure") || scenario.ends_with("clean-exit") {
assert!(run.await.unwrap_err().to_string().contains("--interface tauri"));
let original = explicit.map(|_| GuiVariant::Tauri);
assert_eq!(saved_preference().unwrap(), original);
} else {
let expected = scenario.contains("explicit").then_some(GuiVariant::Nsh);
let stop = async {
while !directory.join("gpgui-nsh-started").exists() || saved_preference().unwrap() != expected {
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
}
fs::write(directory.join("stop-gpgui-nsh"), "").unwrap();
};
let (status, ()) = tokio::time::timeout(std::time::Duration::from_secs(10), async { tokio::join!(run, stop) })
.await
.unwrap();
assert!(status.unwrap().success());
assert!(explicit.is_none());
assert_eq!(saved_preference().unwrap(), expected);
}
service.abort();
return;
}
let program = directory.join("gpgui");
let mut explicit = None;
let run = launcher.launch_with_switches(
&program,
&cancel,
&listener.listener,
&mut explicit,
&mut service_input,
&mut service_output,
);
@@ -756,6 +816,12 @@ mod tests {
);
} else {
anyhow::ensure!(result.is_ok() == success, "Unexpected switch result: {result:?}");
if let Err(error) = &result {
anyhow::ensure!(
!error.to_string().contains("--interface tauri"),
"Unexpected CLI recovery hint"
);
}
if success {
anyhow::ensure!(
result? == crate::gui::GuiSwitchOutcome::Switched,
@@ -779,7 +845,7 @@ mod tests {
);
if success {
anyhow::ensure!(
crate::gui::preferred()? == crate::gui::GuiVariant::Nsh,
crate::gui::saved_preference()? == Some(crate::gui::GuiVariant::Nsh),
"Successful switch did not save preference"
);
fs::write(directory.join("stop-gpgui"), "")?;
@@ -788,7 +854,7 @@ mod tests {
}
} else {
anyhow::ensure!(
crate::gui::preferred()? == crate::gui::GuiVariant::Tauri,
crate::gui::saved_preference()?.is_none(),
"Failed switch changed preference"
);
}
+12
View File
@@ -39,3 +39,15 @@ pub mod rendering_recovery;
#[cfg(windows)]
#[path = "windows/user_process.rs"]
pub mod user_process;
#[cfg(windows)]
#[path = "windows/desktop_auth.rs"]
mod desktop_auth;
#[cfg(windows)]
#[path = "windows/auth_bootstrap.rs"]
pub mod auth_bootstrap;
#[cfg(windows)]
#[path = "windows/console_input.rs"]
mod console_input;
+72 -1
View File
@@ -1,4 +1,4 @@
//! Checks the generic Linux NSH runtime before offering a download.
//! Selects the Linux GUI using its installed or package-managed runtime.
//! Runs in the desktop supervisor, which does not load either GUI's GTK runtime.
use std::{ffi::OsStr, os::raw::c_uint};
@@ -11,14 +11,70 @@ use libloading::{
// Match nsh-platform-linux's gtk4/v4_14 feature when changing the NSH build.
const MIN_GTK_MINOR: u32 = 14;
#[cfg(target_os = "linux")]
pub(super) const TAURI_RECOVERY: &str = "To use Tauri, run: gpclient launch-gui --interface tauri";
#[cfg(target_os = "linux")]
pub(super) async fn select(
requested: Option<crate::gui::GuiVariant>,
service_input: &mut (impl tokio::io::AsyncWrite + Unpin),
service_output: &mut (impl tokio::io::AsyncRead + Unpin),
) -> anyhow::Result<crate::gui::GuiVariant> {
use crate::{gui::GuiVariant, service::transport::DESKTOP_GUI_INSTALLER};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
if requested == Some(GuiVariant::Tauri) {
return Ok(GuiVariant::Tauri);
}
let runtime = if crate::gui::NATIVE_SHELL_SUPPORTED {
service_input.write_all(&[DESKTOP_GUI_INSTALLER]).await?;
match service_output.read_u8().await? {
0 => check(),
// The package installer provides and wraps NSH's dependencies (e.g. NixOS).
1 => Ok(()),
_ => anyhow::bail!("Invalid GUI installer capability response"),
}
} else {
Err(anyhow::anyhow!("Native Shell is unavailable for this platform."))
};
match runtime {
Ok(()) => Ok(GuiVariant::Nsh),
Err(err) if requested.is_some() => Err(err),
Err(err) => {
log::info!("Selecting Tauri: {err:#}");
Ok(GuiVariant::Tauri)
}
}
}
#[cfg(target_os = "linux")]
pub(super) fn check() -> anyhow::Result<()> {
check_gtk(OsStr::new("libgtk-4.so.1"))?;
#[cfg(target_env = "gnu")]
{
// glibc returns a static, NUL-terminated runtime version string.
let version = unsafe { std::ffi::CStr::from_ptr(nix::libc::gnu_get_libc_version()) };
check_glibc_version(version.to_str()?)?;
}
load_library(OsStr::new("libgnutls.so.30"), "GnuTLS 3")?;
load_library(OsStr::new("libdbus-1.so.3"), "D-Bus")?;
Ok(())
}
#[cfg(any(all(target_os = "linux", target_env = "gnu"), test))]
fn check_glibc_version(version: &str) -> anyhow::Result<()> {
let mut parts = version.split('.');
let major = parts.next().and_then(|part| part.parse::<u32>().ok());
let minor = parts.next().and_then(|part| part.parse::<u32>().ok());
ensure!(
major.zip(minor).is_some_and(|version| version >= (2, 39)),
"Native Shell requires glibc 2.39 or later. This system reports glibc {version}."
);
Ok(())
}
fn load_library(path: &OsStr, name: &str) -> anyhow::Result<Library> {
// Resolve symbols now as well as transitive dependencies, without initializing GTK.
let library = unsafe { libloading::os::unix::Library::open(Some(path), RTLD_LOCAL | RTLD_NOW) };
@@ -55,6 +111,21 @@ pub(super) mod tests {
use super::*;
use std::{fs, process::Command};
#[test]
fn requires_glibc_2_39_or_later() {
for version in ["2.9", "2.38", "unknown"] {
assert!(
check_glibc_version(version)
.unwrap_err()
.to_string()
.contains("glibc 2.39")
);
}
for version in ["2.39", "2.39.1", "2.40", "3.0"] {
check_glibc_version(version).unwrap();
}
}
pub(in crate::process) fn gtk_fixture(directory: &std::path::Path, minor: u32) -> std::path::PathBuf {
let source = directory.join(format!("gtk-{minor}.c"));
let library = directory.join(format!("gtk-{minor}.so"));
@@ -0,0 +1,175 @@
//! One-shot launch arguments for the installed Windows CLI authenticator.
use std::{env, ffi::OsStr, io, os::windows::io::AsRawHandle, process::Command, time::Duration};
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::windows::named_pipe::{ClientOptions, NamedPipeServer},
time,
};
use windows_sys::Win32::System::Pipes::{GetNamedPipeClientProcessId, GetNamedPipeServerProcessId};
use super::auth_launcher::AUTH_PARENT_PROCESS_ID_ENV;
use crate::collection::CollectionControl;
const FLAG: &str = "--windows-cli-bootstrap";
const MAX_BYTES: usize = 256 * 1024;
const TIMEOUT: Duration = Duration::from_secs(15);
const RECEIVED: u8 = 1;
pub(super) struct AuthBootstrap {
name: String,
pipe: NamedPipeServer,
request: Vec<u8>,
}
impl AuthBootstrap {
pub(super) fn prepare(command: &Command) -> io::Result<Self> {
let args: Vec<_> = command
.get_args()
.map(|arg| {
arg
.to_str()
.ok_or_else(|| invalid("Invalid Windows authentication argument"))
})
.collect::<io::Result<_>>()?;
let request = serde_json::to_vec(&args)?;
check_length(request.len())?;
let name = format!(r"\\.\pipe\GPConnect.Auth.{}", uuid::Uuid::new_v4());
let pipe = crate::windows::create_user_pipe(&name, true)?;
Ok(Self { name, pipe, request })
}
pub(super) fn arguments(&self) -> [&OsStr; 2] {
[OsStr::new(FLAG), OsStr::new(&self.name)]
}
/// Build the short command used when the CLI and authenticator share a token.
pub(super) fn command(&self, original: &Command) -> Command {
let mut command = Command::new(original.get_program());
command.args(self.arguments());
for (name, value) in original.get_envs() {
match value {
Some(value) => command.env(name, value),
None => command.env_remove(name),
};
}
if let Some(directory) = original.get_current_dir() {
command.current_dir(directory);
}
command
}
pub(super) fn send_to_child(self, pid: u32, control: &dyn CollectionControl) -> io::Result<()> {
tokio::runtime::Handle::current().block_on(self.send(pid, control))
}
async fn send(mut self, expected_pid: u32, control: &dyn CollectionControl) -> io::Result<()> {
let send = async {
self.pipe.connect().await?;
let mut pid = 0;
if unsafe { GetNamedPipeClientProcessId(self.pipe.as_raw_handle(), &mut pid) } == 0 {
return Err(io::Error::last_os_error());
}
if pid != expected_pid {
return Err(io::Error::new(
io::ErrorKind::PermissionDenied,
"Unexpected authentication pipe client",
));
}
self.pipe.write_u32(self.request.len() as u32).await?;
self.pipe.write_all(&self.request).await?;
if self.pipe.read_u8().await? != RECEIVED {
return Err(invalid("Windows authentication arguments were not accepted"));
}
Ok(())
};
let check = async {
loop {
control.check()?;
time::sleep(Duration::from_millis(25)).await;
}
};
time::timeout(TIMEOUT, async {
tokio::select! {
result = send => result,
result = check => result,
}
})
.await?
}
}
/// Recognize the internal bootstrap before handing actual arguments to the normal parser.
pub async fn receive_arguments() -> io::Result<Option<Vec<String>>> {
let mut args = env::args_os().skip(1);
if args.next().as_deref() != Some(OsStr::new(FLAG)) {
return Ok(None);
}
let name = args
.next()
.ok_or_else(|| invalid("Missing Windows authentication pipe"))?;
if args.next().is_some() {
return Err(invalid("Unexpected Windows authentication bootstrap argument"));
}
let expected_pid: u32 = env::var(AUTH_PARENT_PROCESS_ID_ENV)
.ok()
.and_then(|value| value.parse().ok())
.filter(|pid| *pid != 0)
.ok_or_else(|| invalid("Missing Windows authentication parent process"))?;
receive(&name, expected_pid).await.map(Some)
}
async fn receive(name: &OsStr, expected_pid: u32) -> io::Result<Vec<String>> {
time::timeout(TIMEOUT, async {
let mut pipe = ClientOptions::new().open(name)?;
let mut pid = 0;
if unsafe { GetNamedPipeServerProcessId(pipe.as_raw_handle(), &mut pid) } == 0 {
return Err(io::Error::last_os_error());
}
if pid != expected_pid {
return Err(io::Error::new(
io::ErrorKind::PermissionDenied,
"Unexpected authentication pipe server",
));
}
let length = pipe.read_u32().await? as usize;
check_length(length)?;
let mut request = vec![0; length];
pipe.read_exact(&mut request).await?;
let args = serde_json::from_slice(&request)?;
pipe.write_u8(RECEIVED).await?;
Ok(args)
})
.await?
}
fn check_length(length: usize) -> io::Result<()> {
if length == 0 || length > MAX_BYTES {
return Err(invalid("Windows authentication launch arguments exceed their limit"));
}
Ok(())
}
fn invalid(message: &str) -> io::Error {
io::Error::new(io::ErrorKind::InvalidData, message)
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn large_saml_request_round_trips_outside_the_os_command_line() {
let request = format!("<html>{}</html>", "🎵".repeat(20_000));
let mut command = Command::new("gpauth.exe");
command.args(["portal.example.test", "--saml-request", &request]);
let bootstrap = AuthBootstrap::prepare(&command).unwrap();
assert!(request.encode_utf16().count() > 32_767);
let launch = bootstrap.command(&command);
assert_eq!(launch.get_args().collect::<Vec<_>>(), bootstrap.arguments());
let name = bootstrap.name.clone();
let pid = std::process::id();
let (sent, received) = tokio::join!(bootstrap.send(pid, &|| Ok(())), receive(OsStr::new(&name), pid));
sent.unwrap();
assert_eq!(received.unwrap(), ["portal.example.test", "--saml-request", &request]);
}
}
@@ -1,9 +1,15 @@
//! Controlled Windows child execution. Pipe polling keeps cancellation responsive.
use super::{
auth_bootstrap::AuthBootstrap,
console_input::{self, ConsoleInput},
desktop_auth::DesktopChild,
};
use crate::collection::CollectionControl;
use std::{
fs::File,
io::{self, Read, Write},
os::windows::io::AsRawHandle,
process::{Child, Command, Output, Stdio},
os::windows::io::{AsRawHandle, OwnedHandle},
process::{Child, Command, ExitStatus, Output, Stdio},
thread,
time::Duration,
};
@@ -30,45 +36,35 @@ pub(crate) fn run_controlled(command: Command, control: &dyn CollectionControl,
&mut |_| {},
&mut io::sink(),
ChildInput::Null,
false,
)
.map(|observed| observed.output)
}
pub(crate) fn run_observed(
mut command: Command,
command: Command,
control: &dyn CollectionControl,
output_limit: Option<usize>,
observer: &mut dyn FnMut(&[u8]),
stderr_sink: &mut dyn Write,
stdin: ChildInput<'_>,
windows_cli_auth: bool,
) -> io::Result<ObservedOutput> {
control.check()?;
// Windows desktop processes must not open a console for each helper.
use std::os::windows::process::CommandExt;
if !matches!(stdin, ChildInput::Terminal) {
command.creation_flags(0x08000000); // CREATE_NO_WINDOW
}
command.stdout(if output_limit.is_some() {
Stdio::piped()
} else {
Stdio::inherit()
});
command.stderr(Stdio::piped());
command.stdin(match stdin {
ChildInput::Terminal => Stdio::inherit(),
ChildInput::Null => Stdio::null(),
ChildInput::Frame(_) => Stdio::piped(),
});
let mut child = ControlledChild(command.spawn()?);
let input = if let ChildInput::Frame(frame) = stdin {
let mut pipe = child.0.stdin.take().expect("piped stdin");
let bootstrap = windows_cli_auth.then(|| AuthBootstrap::prepare(&command)).transpose()?;
let (mut child, mut stdout, mut stderr, input) = match bootstrap {
Some(bootstrap) if crate::windows::is_elevated()? => {
let (child, stdout, stderr, input) = DesktopChild::spawn(&command, bootstrap, &stdin, control)?;
(ControlledChild::Desktop(child), Some(stdout), stderr, input)
}
bootstrap => spawn_command(command, &stdin, output_limit, bootstrap, control)?,
};
let input = if let (ChildInput::Frame(frame), Some(mut pipe)) = (stdin, input) {
let frame = frame.to_vec();
Some(thread::spawn(move || pipe.write_all(&frame)))
} else {
None
};
let mut stdout = child.0.stdout.take();
let mut stderr = child.0.stderr.take().expect("piped stderr");
let mut output = Vec::new();
let mut buffer = [0u8; 8192];
loop {
@@ -86,7 +82,7 @@ pub(crate) fn run_observed(
let length = read_available(&mut stderr, &mut buffer)?;
observer(&buffer[..length]);
stderr_sink.write_all(&buffer[..length])?;
if let Some(status) = child.0.try_wait()? {
if let Some(status) = child.try_wait()? {
// Drain the remaining buffered output after the process exits.
if let Some(pipe) = &mut stdout {
loop {
@@ -126,6 +122,60 @@ pub(crate) fn run_observed(
}
}
fn spawn_command(
command: Command,
stdin: &ChildInput<'_>,
output_limit: Option<usize>,
bootstrap: Option<AuthBootstrap>,
control: &dyn CollectionControl,
) -> io::Result<(ControlledChild, Option<File>, File, Option<File>)> {
let mut command = match &bootstrap {
Some(bootstrap) => bootstrap.command(&command),
None => command,
};
// Windows desktop processes must not open a console for each helper.
use std::os::windows::process::CommandExt;
if !matches!(stdin, ChildInput::Terminal) {
command.creation_flags(0x08000000); // CREATE_NO_WINDOW
}
command.stdout(if output_limit.is_some() {
Stdio::piped()
} else {
Stdio::inherit()
});
command.stderr(Stdio::piped());
let terminal = if bootstrap.is_some() && matches!(stdin, ChildInput::Terminal) {
let input = console_input::terminal_input()?;
console_input::is_console(&input).then_some(input)
} else {
None
};
command.stdin(match stdin {
ChildInput::Terminal if terminal.is_none() => Stdio::inherit(),
ChildInput::Terminal => Stdio::piped(),
ChildInput::Null => Stdio::null(),
ChildInput::Frame(_) => Stdio::piped(),
});
let mut child = StandardChild {
child: command.spawn()?,
console_input: None,
};
if let Some(bootstrap) = bootstrap {
bootstrap.send_to_child(child.child.id(), control)?;
}
let stdout = child
.child
.stdout
.take()
.map(|pipe| File::from(OwnedHandle::from(pipe)));
let stderr = File::from(OwnedHandle::from(child.child.stderr.take().expect("piped stderr")));
let mut input = child.child.stdin.take().map(|pipe| File::from(OwnedHandle::from(pipe)));
if let Some(terminal) = terminal {
child.console_input = Some(ConsoleInput::start(terminal, input.take().expect("piped stdin"))?);
}
Ok((ControlledChild::Standard(child), stdout, stderr, input))
}
fn read_available(pipe: &mut (impl Read + AsRawHandle), buffer: &mut [u8]) -> io::Result<usize> {
let mut available = 0;
let success = unsafe {
@@ -152,11 +202,34 @@ fn read_available(pipe: &mut (impl Read + AsRawHandle), buffer: &mut [u8]) -> io
pipe.read(&mut buffer[..length])
}
struct ControlledChild(Child);
impl Drop for ControlledChild {
enum ControlledChild {
Standard(StandardChild),
Desktop(DesktopChild),
}
impl ControlledChild {
fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
match self {
Self::Standard(child) => {
if let Some(input) = &mut child.console_input {
input.check()?;
}
child.child.try_wait()
}
Self::Desktop(child) => child.try_wait(),
}
}
}
struct StandardChild {
child: Child,
console_input: Option<ConsoleInput>,
}
impl Drop for StandardChild {
fn drop(&mut self) {
let _ = self.0.kill();
let _ = self.0.wait();
let _ = self.child.kill();
let _ = self.child.wait();
}
}
@@ -0,0 +1,142 @@
//! Relay a pasted browser callback from the elevated CLI's own console.
use std::{
fs::File,
io::{self, Write},
os::windows::io::{AsRawHandle, BorrowedHandle, FromRawHandle, OwnedHandle},
ptr,
sync::{
Arc,
atomic::{AtomicBool, Ordering},
},
thread::{self, JoinHandle},
time::Duration,
};
use windows_sys::Win32::{
Foundation::{DUPLICATE_SAME_ACCESS, DuplicateHandle, ERROR_OPERATION_ABORTED, INVALID_HANDLE_VALUE},
System::{
Console::{GetConsoleMode, GetStdHandle, ReadConsoleW, STD_INPUT_HANDLE},
IO::CancelSynchronousIo,
Threading::GetCurrentProcess,
},
};
const MAX_CALLBACK_CHARS: usize = 64 * 1024;
pub(super) fn is_console(input: &OwnedHandle) -> bool {
let mut mode = 0;
unsafe { GetConsoleMode(input.as_raw_handle(), &mut mode) != 0 }
}
pub(super) struct ConsoleInput {
stop: Arc<AtomicBool>,
worker: Option<JoinHandle<io::Result<()>>>,
}
impl ConsoleInput {
pub(super) fn start(input: OwnedHandle, output: File) -> io::Result<Self> {
let stop = Arc::new(AtomicBool::new(false));
let worker_stop = stop.clone();
let worker = thread::Builder::new().spawn(move || {
let line = read_line(input, &worker_stop)?;
if !worker_stop.load(Ordering::Relaxed) {
let mut output = output;
output.write_all(line.as_bytes())?;
}
Ok(())
})?;
Ok(Self {
stop,
worker: Some(worker),
})
}
pub(super) fn check(&mut self) -> io::Result<()> {
if self.worker.as_ref().is_some_and(JoinHandle::is_finished) {
let worker = self.worker.take().expect("completed console reader");
worker
.join()
.map_err(|_| io::Error::other("Console reader stopped unexpectedly"))??;
}
Ok(())
}
}
impl Drop for ConsoleInput {
fn drop(&mut self) {
if let Some(worker) = self.worker.take() {
self.stop.store(true, Ordering::Relaxed);
// Retry in case the worker was between checking stop and entering I/O.
// Join before returning so a failed sign-in cannot consume a later prompt.
while !worker.is_finished() {
unsafe { CancelSynchronousIo(worker.as_raw_handle()) };
thread::sleep(Duration::from_millis(5));
}
let _ = worker.join();
}
}
}
fn read_line(input: OwnedHandle, stop: &AtomicBool) -> io::Result<String> {
let mut text = Vec::new();
let mut buffer = [0u16; 4096];
while !stop.load(Ordering::Relaxed) {
let mut count = 0;
if unsafe {
ReadConsoleW(
input.as_raw_handle(),
buffer.as_mut_ptr().cast(),
buffer.len() as u32,
&mut count,
ptr::null(),
)
} == 0
{
let error = io::Error::last_os_error();
if error.raw_os_error() == Some(ERROR_OPERATION_ABORTED as i32) {
return Err(io::Error::new(io::ErrorKind::Interrupted, error));
}
return Err(error);
}
if count == 0 {
break;
}
let chunk = &buffer[..count as usize];
let newline = chunk.iter().position(|&ch| ch == b'\n' as u16);
text.extend_from_slice(&chunk[..newline.map_or(chunk.len(), |index| index + 1)]);
if text.len() > MAX_CALLBACK_CHARS {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
"Browser callback is too long",
));
}
if newline.is_some() {
break;
}
}
String::from_utf16(&text).map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))
}
pub(super) fn terminal_input() -> io::Result<OwnedHandle> {
let input = unsafe { GetStdHandle(STD_INPUT_HANDLE) };
if input.is_null() || input == INVALID_HANDLE_VALUE {
return Err(io::Error::other("Manual browser sign-in requires terminal input"));
}
let input = unsafe { BorrowedHandle::borrow_raw(input) };
let process = unsafe { GetCurrentProcess() };
let mut duplicate = ptr::null_mut();
if unsafe {
DuplicateHandle(
process,
input.as_raw_handle(),
process,
&mut duplicate,
0,
1,
DUPLICATE_SAME_ACCESS,
)
} == 0
{
return Err(io::Error::last_os_error());
}
Ok(unsafe { OwnedHandle::from_raw_handle(duplicate) })
}
@@ -0,0 +1,238 @@
//! Run the CLI's installed authenticator with the interactive user's standard token.
use std::{
env,
fs::File,
io,
os::windows::{
io::{AsHandle, AsRawHandle, FromRawHandle, OwnedHandle},
process::ExitStatusExt,
},
path::Path,
process::{Command, ExitStatus},
ptr,
};
use windows_sys::Win32::{
Foundation::{HANDLE, HANDLE_FLAG_INHERIT, SetHandleInformation, WAIT_OBJECT_0, WAIT_TIMEOUT},
Security::{
DuplicateTokenEx, SECURITY_ATTRIBUTES, SecurityImpersonation, TOKEN_DUPLICATE, TOKEN_QUERY, TokenElevation,
TokenPrimary, TokenSessionId,
},
System::{Pipes::CreatePipe, SystemServices::MAXIMUM_ALLOWED, Threading::*},
UI::WindowsAndMessaging::{GetShellWindow, GetWindowThreadProcessId},
};
use super::{
auth_bootstrap::AuthBootstrap,
command_runner::ChildInput,
console_input::{self, ConsoleInput},
user_process::{command_line, user_environment, wide},
};
use crate::{
collection::CollectionControl,
windows::{current_user_sid, token_u32, token_user_sid},
};
pub(super) struct DesktopChild {
process: OwnedHandle,
console_input: Option<ConsoleInput>,
}
impl DesktopChild {
pub(super) fn spawn(
command: &Command,
bootstrap: AuthBootstrap,
input: &ChildInput<'_>,
control: &dyn CollectionControl,
) -> io::Result<(Self, File, File, Option<File>)> {
let desktop = desktop_token()?;
let program = Path::new(command.get_program());
if !program.is_absolute() {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"The authenticator path must be absolute",
));
}
let mut executable = wide(program.as_os_str())?;
let mut arguments = command_line(&executable, bootstrap.arguments())?;
executable.push(0);
let mut environment = user_environment(
desktop.as_handle(),
command
.get_envs()
.filter_map(|(name, value)| value.map(|value| (name, value))),
)?;
let working_directory = match command.get_current_dir() {
Some(directory) => directory.to_path_buf(),
None => env::current_dir()?,
};
let mut directory = wide(working_directory.as_os_str())?;
directory.push(0);
let (stdout, child_out) = pipe(false)?;
let (stderr, child_err) = pipe(false)?;
let mut console = None;
let (child_in, input_pipe) = match input {
ChildInput::Terminal => {
let terminal = console_input::terminal_input()?;
if console_input::is_console(&terminal) {
let (writer, reader) = pipe(true)?;
console = Some((terminal, File::from(writer)));
(reader, None)
} else {
(terminal, None)
}
}
ChildInput::Null => {
let (writer, reader) = pipe(true)?;
drop(writer);
(reader, None)
}
ChildInput::Frame(_) => {
let (writer, reader) = pipe(true)?;
(reader, Some(File::from(writer)))
}
};
let startup = STARTUPINFOW {
cb: std::mem::size_of::<STARTUPINFOW>() as u32,
dwFlags: STARTF_USESTDHANDLES,
hStdInput: child_in.as_raw_handle(),
hStdOutput: child_out.as_raw_handle(),
hStdError: child_err.as_raw_handle(),
..Default::default()
};
let mut process = PROCESS_INFORMATION::default();
let mut flags = CREATE_UNICODE_ENVIRONMENT;
if !matches!(input, ChildInput::Terminal) {
flags |= CREATE_NO_WINDOW;
}
if unsafe {
CreateProcessWithTokenW(
desktop.as_raw_handle(),
0,
executable.as_ptr(),
arguments.as_mut_ptr(),
flags,
environment.as_mut_ptr().cast(),
directory.as_ptr(),
&startup,
&mut process,
)
} == 0
{
return Err(io::Error::last_os_error());
}
let mut child = Self {
process: unsafe { OwnedHandle::from_raw_handle(process.hProcess) },
console_input: None,
};
drop(unsafe { OwnedHandle::from_raw_handle(process.hThread) });
bootstrap.send_to_child(process.dwProcessId, control)?;
child.console_input = console
.map(|(terminal, writer)| ConsoleInput::start(terminal, writer))
.transpose()?;
Ok((child, File::from(stdout), File::from(stderr), input_pipe))
}
pub(super) fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
if let Some(input) = &mut self.console_input {
input.check()?;
}
match unsafe { WaitForSingleObject(self.process.as_raw_handle(), 0) } {
WAIT_OBJECT_0 => {
let mut code = 0;
if unsafe { GetExitCodeProcess(self.process.as_raw_handle(), &mut code) } == 0 {
return Err(io::Error::last_os_error());
}
Ok(Some(ExitStatus::from_raw(code)))
}
WAIT_TIMEOUT => Ok(None),
_ => Err(io::Error::last_os_error()),
}
}
}
impl Drop for DesktopChild {
fn drop(&mut self) {
unsafe {
if WaitForSingleObject(self.process.as_raw_handle(), 0) == WAIT_TIMEOUT
&& TerminateProcess(self.process.as_raw_handle(), 1) != 0
{
WaitForSingleObject(self.process.as_raw_handle(), INFINITE);
}
}
}
}
fn desktop_token() -> io::Result<OwnedHandle> {
let mut pid = 0;
let window = unsafe { GetShellWindow() };
if window.is_null() || unsafe { GetWindowThreadProcessId(window, &mut pid) } == 0 {
return Err(io::Error::other("Sign-in requires an interactive Windows desktop"));
}
let process = owned(unsafe { OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid) })?;
let mut token = ptr::null_mut();
if unsafe { OpenProcessToken(process.as_raw_handle(), TOKEN_QUERY | TOKEN_DUPLICATE, &mut token) } == 0 {
return Err(io::Error::last_os_error());
}
let source = unsafe { OwnedHandle::from_raw_handle(token) };
if unsafe { token_user_sid(token) }? != current_user_sid()?
|| token_u32(source.as_handle(), TokenElevation)? != 0
|| token_u32(source.as_handle(), TokenSessionId)? != session_id()?
{
return Err(io::Error::other(
"Sign-in requires the terminal user's standard Windows desktop",
));
}
let mut primary = ptr::null_mut();
if unsafe {
// A linked token queried without SeTcbPrivilege may only be usable for identification.
// The shell already has the primary standard token in the interactive session.
DuplicateTokenEx(
token,
MAXIMUM_ALLOWED,
ptr::null(),
SecurityImpersonation,
TokenPrimary,
&mut primary,
)
} == 0
{
return Err(io::Error::last_os_error());
}
owned(primary)
}
fn session_id() -> io::Result<u32> {
let mut session = 0;
if unsafe { windows_sys::Win32::System::RemoteDesktop::ProcessIdToSessionId(std::process::id(), &mut session) } == 0 {
return Err(io::Error::last_os_error());
}
Ok(session)
}
fn owned(handle: HANDLE) -> io::Result<OwnedHandle> {
if handle.is_null() || handle == windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE {
return Err(io::Error::last_os_error());
}
Ok(unsafe { OwnedHandle::from_raw_handle(handle) })
}
/// Returns the parent's non-inheritable end, then the child's end.
fn pipe(parent_writes: bool) -> io::Result<(OwnedHandle, OwnedHandle)> {
let attributes = SECURITY_ATTRIBUTES {
nLength: std::mem::size_of::<SECURITY_ATTRIBUTES>() as u32,
bInheritHandle: 1,
lpSecurityDescriptor: ptr::null_mut(),
};
let mut read = ptr::null_mut();
let mut write = ptr::null_mut();
if unsafe { CreatePipe(&mut read, &mut write, &attributes, 0) } == 0 {
return Err(io::Error::last_os_error());
}
let read = unsafe { OwnedHandle::from_raw_handle(read) };
let write = unsafe { OwnedHandle::from_raw_handle(write) };
let (parent, child) = if parent_writes { (write, read) } else { (read, write) };
if unsafe { SetHandleInformation(parent.as_raw_handle(), HANDLE_FLAG_INHERIT, 0) } == 0 {
return Err(io::Error::last_os_error());
}
Ok((parent, child))
}
@@ -36,7 +36,7 @@ impl Drop for Environment {
fn invalid(message: &str) -> io::Error {
io::Error::new(io::ErrorKind::InvalidInput, message)
}
fn wide(value: &OsStr) -> io::Result<Vec<u16>> {
pub(super) fn wide(value: &OsStr) -> io::Result<Vec<u16>> {
let value: Vec<_> = value.encode_wide().collect();
if value.contains(&0) {
return Err(invalid("Windows process strings cannot contain NUL"));
@@ -63,12 +63,15 @@ fn quote(argument: &[u16], output: &mut Vec<u16>) {
output.extend(std::iter::repeat_n(b'\\' as u16, backslashes * 2));
output.push(b'"' as u16);
}
fn command_line(program: &[u16], arguments: &[String]) -> io::Result<Vec<u16>> {
pub(super) fn command_line<'a>(
program: &[u16],
arguments: impl IntoIterator<Item = &'a OsStr>,
) -> io::Result<Vec<u16>> {
let mut output = Vec::new();
quote(program, &mut output);
for argument in arguments {
output.push(b' ' as u16);
quote(&wide(OsStr::new(argument))?, &mut output);
quote(&wide(argument)?, &mut output);
}
output.push(0);
if output.len() > 32767 {
@@ -90,7 +93,10 @@ fn compare(left: &[u16], right: &[u16]) -> std::cmp::Ordering {
unsafe { CompareStringOrdinal(left.as_ptr(), left.len() as i32, right.as_ptr(), right.len() as i32, 1) }
.cmp(&CSTR_EQUAL)
}
fn user_environment(token: BorrowedHandle<'_>, variables: &[(&str, &str)]) -> io::Result<Vec<u16>> {
pub(super) fn user_environment<'a>(
token: BorrowedHandle<'_>,
variables: impl IntoIterator<Item = (&'a OsStr, &'a OsStr)>,
) -> io::Result<Vec<u16>> {
let mut pointer = ptr::null_mut();
if unsafe { CreateEnvironmentBlock(&mut pointer, token.as_raw_handle(), 0) } == 0 {
return Err(io::Error::last_os_error());
@@ -109,11 +115,11 @@ fn user_environment(token: BorrowedHandle<'_>, variables: &[(&str, &str)]) -> io
}
}
for (name, value) in variables {
if name.is_empty() || name.contains('=') {
let name = wide(name)?;
if name.is_empty() || name.contains(&(b'=' as u16)) {
return Err(invalid("Invalid worker environment name"));
}
let name = wide(OsStr::new(name))?;
let value = wide(OsStr::new(value))?;
let value = wide(value)?;
entries.retain(|entry| compare(key(entry), &name) != std::cmp::Ordering::Equal);
let mut entry = name;
entry.push(b'=' as u16);
@@ -145,9 +151,14 @@ impl UserProcess {
return Err(invalid("Windows worker executable must be absolute"));
}
let mut executable = wide(program.as_os_str())?;
let mut command = command_line(&executable, arguments)?;
let mut command = command_line(&executable, arguments.iter().map(OsStr::new))?;
executable.push(0);
let mut environment = user_environment(token, variables)?;
let mut environment = user_environment(
token,
variables
.iter()
.map(|(name, value)| (OsStr::new(name), OsStr::new(value))),
)?;
let directory = program.parent().ok_or_else(|| invalid("Worker directory is missing"))?;
let mut directory = wide(directory.as_os_str())?;
directory.push(0);
@@ -286,7 +297,7 @@ mod tests {
"&|<>",
]
.map(String::from);
let command = command_line(&program, &arguments).unwrap();
let command = command_line(&program, arguments.iter().map(OsStr::new)).unwrap();
let mut count = 0;
unsafe {
let parsed = CommandLineToArgvW(command.as_ptr(), &mut count);
@@ -8,6 +8,32 @@ use super::*;
const MAX_ADDRESSES: usize = 64;
#[cfg(not(windows))]
fn native_helper() -> anyhow::Result<PathBuf> {
Ok(common::binary_paths::gpclient())
}
#[cfg(windows)]
fn native_helper() -> anyhow::Result<PathBuf> {
windows_native_helper(&crate::windows::application_directory()?)
}
#[cfg(windows)]
fn windows_native_helper(directory: &std::path::Path) -> anyhow::Result<PathBuf> {
let installed = directory.join(r"cli\gpclient.exe");
if installed.is_file() {
return Ok(installed);
}
// Every Windows package includes build metadata. A missing bundled helper
// in that layout is a package error, even when a development override exists.
ensure!(
!directory.join("build-info.json").try_exists()?,
"The GP Connect package is missing its resolver helper: {}",
installed.display()
);
Ok(common::binary_paths::gpclient())
}
#[doc(hidden)]
pub fn detect_in_helper(address: std::net::IpAddr, hostname: &str) -> anyhow::Result<bool> {
super::detection::validate_target(address, hostname)?;
@@ -27,7 +53,7 @@ pub(in crate::session) async fn detect(
"--hostname".into(),
hostname.into(),
];
let output = run_helper(common::binary_paths::gpclient(), args, cancellation.clone()).await?;
let output = run_helper(native_helper()?, args, cancellation.clone()).await?;
serde_json::from_slice(&output).context("Invalid internal detection helper response")
}
@@ -68,14 +94,7 @@ pub(super) async fn resolve(
if disable_ipv6 {
args.push("--disable-ipv6".into());
}
run_resolver(
common::binary_paths::gpclient(),
args,
port,
disable_ipv6,
cancellation.clone(),
)
.await
run_resolver(native_helper()?, args, port, disable_ipv6, cancellation.clone()).await
}
async fn run_resolver(
@@ -147,6 +166,26 @@ fn validate_addresses(addresses: &[SocketAddr], port: u16, disable_ipv6: bool) -
mod tests {
use super::*;
#[cfg(windows)]
#[test]
fn packaged_resolver_requires_the_bundled_cli() {
let package = tempfile::tempdir().unwrap();
let directory = package.path();
assert_eq!(
windows_native_helper(directory).unwrap(),
common::binary_paths::gpclient()
);
std::fs::write(directory.join("build-info.json"), "{}").unwrap();
let helper = directory.join(r"cli\gpclient.exe");
let error = windows_native_helper(directory).unwrap_err().to_string();
assert!(error.contains(&helper.display().to_string()), "{error}");
std::fs::create_dir(directory.join("cli")).unwrap();
std::fs::write(&helper, "").unwrap();
assert_eq!(windows_native_helper(directory).unwrap(), helper);
}
#[tokio::test]
async fn actual_helper_output_is_validated_before_admission() {
let addresses = run_resolver(
+54 -2
View File
@@ -1,6 +1,10 @@
//! Windows user identity and private local IPC.
use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, OwnedHandle};
use std::{io, ptr};
use std::{
env, io,
path::{Path, PathBuf},
ptr,
};
mod pipes;
pub use pipes::{PacketPipe, connect_service_admission, connect_service_worker, create_service_admission_pipe};
use tokio::net::windows::named_pipe::NamedPipeServer;
@@ -22,6 +26,54 @@ pub fn current_user_sid() -> io::Result<String> {
}
}
/// Locate bundled Windows helpers relative to the installed executable.
pub fn application_directory() -> std::io::Result<PathBuf> {
let executable = env::current_exe()?;
let directory = executable
.parent()
.ok_or_else(|| std::io::Error::other("Application directory is unavailable"))?;
if directory
.file_name()
.is_some_and(|name| name.eq_ignore_ascii_case("cli"))
&& executable
.file_name()
.is_some_and(|name| name.eq_ignore_ascii_case("gpclient.exe"))
{
return directory
.parent()
.map(Path::to_path_buf)
.ok_or_else(|| std::io::Error::other("GP Connect installation directory is unavailable"));
}
Ok(directory.to_path_buf())
}
pub fn is_elevated() -> io::Result<bool> {
let mut token = ptr::null_mut();
if unsafe { OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &mut token) } == 0 {
return Err(io::Error::last_os_error());
}
let token = unsafe { OwnedHandle::from_raw_handle(token) };
Ok(token_u32(token.as_handle(), windows_sys::Win32::Security::TokenElevation)? != 0)
}
pub(crate) fn token_u32(token: BorrowedHandle<'_>, field: i32) -> io::Result<u32> {
let mut value = 0u32;
let mut length = 0;
if unsafe {
GetTokenInformation(
token.as_raw_handle(),
field,
(&mut value as *mut u32).cast(),
4,
&mut length,
)
} == 0
{
return Err(io::Error::last_os_error());
}
Ok(value)
}
/// An authenticated pipe client's primary token, retained for its user-session worker.
/// Windows user identity is a SID and token; it is never represented as a Unix UID.
pub struct PipeClientIdentity {
@@ -111,7 +163,7 @@ pub fn process_user_sid(pid: u32) -> io::Result<String> {
}
}
unsafe fn token_user_sid(token: windows_sys::Win32::Foundation::HANDLE) -> io::Result<String> {
pub(crate) unsafe fn token_user_sid(token: windows_sys::Win32::Foundation::HANDLE) -> io::Result<String> {
unsafe {
let mut length = 0;
GetTokenInformation(token, TokenUser, ptr::null_mut(), 0, &mut length);
+1 -5
View File
@@ -4,11 +4,7 @@ use gpapi::{collection::CollectionControl, process::collection::CollectorCommand
use std::io;
pub(super) fn collect(commands: &CollectorCommands<'_>, control: &dyn CollectionControl) -> io::Result<WindowsReport> {
let executable = std::env::current_exe()?;
let helper = executable
.parent()
.ok_or_else(|| io::Error::other("Application directory is unavailable"))?
.join("gp-posture.exe");
let helper = gpapi::windows::application_directory()?.join("gp-posture.exe");
let output = commands
.run_executable(&helper, &[])?
.ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "Windows posture helper is not installed"))?;
+37 -6
View File
@@ -284,7 +284,7 @@ impl Observation {
/// One native tunnel's negotiated state and optional sampler. The connection
/// owner must join `Vpn::connect` before calling `stop`.
pub struct TunnelMonitor {
vpn: Arc<Vpn>,
vpn: Mutex<Option<Arc<Vpn>>>,
observation: Mutex<Observation>,
updates: watch::Sender<TunnelUpdate>,
wake: Arc<Notify>,
@@ -302,14 +302,14 @@ impl TunnelMonitor {
let observation = Observation::new();
let (updates, _) = watch::channel(observation.project(Instant::now()));
let monitor = Arc::new(Self {
vpn,
vpn: Mutex::new(Some(vpn.clone())),
observation: Mutex::new(observation),
updates,
wake: Arc::new(Notify::new()),
worker: Mutex::new(None),
});
let observer = Arc::downgrade(&monitor);
monitor.vpn.set_tunnel_observer(move |event| {
vpn.set_tunnel_observer(move |event| {
on_event(&event);
if let Some(monitor) = observer.upgrade() {
monitor.observe(event);
@@ -347,7 +347,9 @@ impl TunnelMonitor {
observation.finish(Instant::now());
self.publish(&observation);
drop(observation);
self.vpn.clear_tunnel_observer();
if let Some(vpn) = self.vpn.lock().unwrap().take() {
vpn.clear_tunnel_observer();
}
self.wake.notify_one();
}
@@ -405,7 +407,11 @@ impl TunnelMonitor {
}
return true;
}
match self.vpn.request_statistics() {
let vpn = self.vpn.lock().unwrap();
let Some(vpn) = vpn.as_ref() else {
return false;
};
match vpn.request_statistics() {
Ok(true) => {
observation.pending = Some(RequestStamp {
generation: observation.generation,
@@ -431,7 +437,9 @@ impl TunnelMonitor {
impl Drop for TunnelMonitor {
fn drop(&mut self) {
self.vpn.clear_tunnel_observer();
if let Some(vpn) = self.vpn.get_mut().unwrap().take() {
vpn.clear_tunnel_observer();
}
if let Some(worker) = self.worker.get_mut().unwrap().take() {
worker.abort();
}
@@ -468,6 +476,29 @@ fn millis(duration: Duration) -> u64 {
mod tests {
use super::*;
#[tokio::test]
async fn finished_monitor_keeps_telemetry_without_owning_native_resources() {
let owner = Arc::new(());
let lease = Arc::downgrade(&owner);
let vpn = Arc::new(
Vpn::builder("vpn.example.com", "cookie")
.network_configuration_handler(move |_| {
let _owner = &owner;
Ok(())
})
.build()
.unwrap(),
);
let monitor = TunnelMonitor::attach(vpn.clone());
monitor.stop().await;
drop(vpn);
assert!(
lease.upgrade().is_none(),
"finished telemetry retained the network owner"
);
let _ = monitor.subscribe();
}
fn connected(now: Instant) -> Observation {
let mut observation = Observation::new();
observation.apply(Event::Established, now);
+1 -1
View File
@@ -15,7 +15,7 @@ serde_json.workspace = true
serde.workspace = true
winreg = "0.56"
uuid = { workspace = true, features = ["v4"] }
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock", "Win32_System_Threading"] }
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock", "Win32_System_Threading", "Win32_UI_Shell"] }
[dev-dependencies]
ipnet = "2"
+29 -8
View File
@@ -1,5 +1,5 @@
//! Adapter DNS settings and Windows name-resolution policy scoped to this connection.
use super::configuration::Configuration;
use super::{SystemTunnel, configuration::Configuration};
use base64::Engine;
use serde_json::json;
use std::{
@@ -23,6 +23,7 @@ pub(super) struct Installed {
guid: GUID,
snapshot: Option<Snapshot>,
tag: Option<String>,
tunnel: Option<SystemTunnel>,
}
fn check(status: u32) -> io::Result<()> {
if status == 0 {
@@ -77,7 +78,7 @@ impl Snapshot {
}
}
impl Installed {
pub fn apply(configuration: &Configuration) -> io::Result<Self> {
pub fn apply(configuration: &Configuration, recovery_key: &str, tunnel: Option<&SystemTunnel>) -> io::Result<Self> {
let mut luid = NET_LUID_LH::default();
let mut guid = GUID::default();
check(unsafe { ConvertInterfaceIndexToLuid(configuration.interface, &mut luid) })?;
@@ -86,6 +87,7 @@ impl Installed {
guid,
snapshot: Some(Snapshot::capture(guid)?),
tag: None,
tunnel: tunnel.cloned(),
};
Snapshot {
domain: configuration.domains.first().cloned().unwrap_or_default(),
@@ -105,9 +107,13 @@ impl Installed {
.map(|domain| format!(".{}", domain.trim_matches('.')))
.collect()
};
let tag = format!("GPConnect:{}", uuid::Uuid::new_v4());
let tag = match tunnel {
Some(_) => format!("GPConnect:{}", uuid::Uuid::new_v4()),
None => journal_tag(recovery_key),
};
installed.tag = Some(tag.clone());
policy(
tunnel,
json!({"operation":"add", "tag":tag, "namespaces":namespaces, "servers":configuration.servers.iter().map(ToString::to_string).collect::<Vec<_>>()}),
)?;
}
@@ -116,7 +122,7 @@ impl Installed {
pub fn restore(&mut self) -> io::Result<()> {
let mut failure = None;
if let Some(tag) = self.tag.take() {
if let Err(error) = policy(json!({"operation":"remove", "tag":tag})) {
if let Err(error) = policy(self.tunnel.as_ref(), json!({"operation":"remove", "tag":tag})) {
log::warn!("Could not remove VPN DNS policy: {error}");
failure = Some(error);
}
@@ -140,21 +146,36 @@ impl Drop for Installed {
/// A crashed service cannot run Drop. Remove only GP Connect's tagged policies
/// before accepting a new connection; adapter rows disappear with Wintun itself.
pub(super) fn clear_stale_policies() -> io::Result<()> {
policy(json!({"operation":"clear-stale"}))
pub(super) fn clear_stale_policies(tunnel: &SystemTunnel) -> io::Result<()> {
policy(Some(tunnel), json!({"operation":"clear-stale"}))
}
fn policy(request: serde_json::Value) -> io::Result<()> {
// Keep isolated journals outside the GPConnect:* namespace used by system recovery.
fn journal_tag(recovery_key: &str) -> String {
format!("GPConnectJournal:{recovery_key}")
}
pub(super) fn remove_journal_policy(recovery_key: &str) -> io::Result<()> {
policy(None, json!({"operation":"remove", "tag":journal_tag(recovery_key)}))
}
fn policy(tunnel: Option<&SystemTunnel>, request: serde_json::Value) -> io::Result<()> {
const SCRIPT: &str = include_str!("dns-policy.ps1");
let encoded = base64::engine::general_purpose::STANDARD
.encode(SCRIPT.encode_utf16().flat_map(u16::to_le_bytes).collect::<Vec<_>>());
let root =
std::env::var_os("SystemRoot").ok_or_else(|| io::Error::other("Windows system directory is unavailable"))?;
let executable = std::path::PathBuf::from(root).join("System32/WindowsPowerShell/v1.0/powershell.exe");
// The script produces no standard output. Use that handle to give the worker
// a copy of the lease so it keeps ownership if the tunnel process dies.
let stdout = match tunnel {
Some(tunnel) => Stdio::from(tunnel.duplicate_lock()?),
None => Stdio::null(),
};
let mut child = Command::new(executable)
.args(["-NoProfile", "-NonInteractive", "-EncodedCommand", &encoded])
.creation_flags(CREATE_NO_WINDOW)
.stdin(Stdio::piped())
.stdout(Stdio::null())
.stdout(stdout)
.stderr(Stdio::piped())
.spawn()?;
let input = child
+17 -4
View File
@@ -3,24 +3,32 @@ mod configuration;
mod dns;
mod ip_helper;
mod recovery;
mod system_tunnel;
use configuration::Configuration;
use std::io;
pub use system_tunnel::SystemTunnel;
pub struct NetworkConfigurator {
connection: Option<Connection>,
recovery_key: String,
system_tunnel: Option<SystemTunnel>,
}
struct Connection {
dns: dns::Installed,
network: ip_helper::Installed,
}
impl NetworkConfigurator {
/// The owner supplies an HKLM key under its administrator-controlled namespace.
/// Use a separate HKLM journal and DNS tag for an isolated network configuration.
pub fn new(recovery_key: &str) -> io::Result<Self> {
Self::with_owner(recovery_key, None)
}
fn with_owner(recovery_key: &str, system_tunnel: Option<SystemTunnel>) -> io::Result<Self> {
recovery::Journal::begin(recovery_key)?;
Ok(Self {
connection: None,
recovery_key: recovery_key.into(),
system_tunnel,
})
}
pub fn configure(&mut self, reason: &str, environment: &[(String, Option<String>)]) -> io::Result<()> {
@@ -30,7 +38,7 @@ impl NetworkConfigurator {
let configuration = Configuration::parse(environment)?;
self.disconnect()?;
let network = ip_helper::Installed::apply(&configuration, &self.recovery_key)?;
let dns = dns::Installed::apply(&configuration)?;
let dns = dns::Installed::apply(&configuration, &self.recovery_key, self.system_tunnel.as_ref())?;
self.connection = Some(Connection { dns, network });
Ok(())
}
@@ -52,13 +60,18 @@ impl NetworkConfigurator {
}
}
/// Restore process-owned physical routes and DNS policy before service admission.
/// Recover an isolated journal and only the DNS rules recorded under its name.
pub fn recover(recovery_key: &str) -> io::Result<()> {
recover_routes(recovery_key)?;
dns::remove_journal_policy(recovery_key)
}
fn recover_routes(recovery_key: &str) -> io::Result<()> {
if let Some(journal) = recovery::Journal::open(recovery_key)? {
for (name, route) in journal.routes()? {
ip_helper::recover_route(&route)?;
journal.forget(&name)?;
}
}
dns::clear_stale_policies()
Ok(())
}
@@ -0,0 +1,85 @@
use super::NetworkConfigurator;
use std::{
ffi::OsString,
fs::{File, OpenOptions},
io,
os::windows::{ffi::OsStringExt, fs::OpenOptionsExt},
path::PathBuf,
ptr,
sync::Arc,
};
use windows_sys::Win32::{
Foundation::ERROR_SHARING_VIOLATION,
UI::Shell::{CSIDL_COMMON_APPDATA, SHGetFolderPathW},
};
const RECOVERY_KEY: &str = r"SOFTWARE\GP Connect\NetworkRecovery";
/// Exclusive ownership of the installed Windows system tunnel, including recovery.
#[derive(Clone)]
pub struct SystemTunnel {
lock: Arc<File>,
}
impl SystemTunnel {
pub fn try_acquire() -> io::Result<Option<Self>> {
let path = machine_data()?.join(r"GP Connect\Private\system-tunnel.lock");
let file = match OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(false)
.share_mode(0)
.open(path)
{
Ok(file) => file,
Err(error) if error.raw_os_error() == Some(ERROR_SHARING_VIOLATION as i32) => return Ok(None),
Err(error) => return Err(error),
};
let tunnel = Self { lock: Arc::new(file) };
super::recover_routes(RECOVERY_KEY)?;
super::dns::clear_stale_policies(&tunnel)?;
Ok(Some(tunnel))
}
pub fn acquire() -> io::Result<Self> {
Self::try_acquire()?.ok_or_else(|| {
io::Error::new(
io::ErrorKind::WouldBlock,
"Another GP Connect system tunnel or installer is active. Disconnect the tunnel or wait for setup to finish.",
)
})
}
pub fn configurator(&self) -> io::Result<NetworkConfigurator> {
NetworkConfigurator::with_owner(RECOVERY_KEY, Some(self.clone()))
}
pub(super) fn duplicate_lock(&self) -> io::Result<File> {
self.lock.try_clone()
}
}
fn machine_data() -> io::Result<PathBuf> {
let mut path = [0; 260];
let result = unsafe {
SHGetFolderPathW(
ptr::null_mut(),
CSIDL_COMMON_APPDATA as i32,
ptr::null_mut(),
0,
path.as_mut_ptr(),
)
};
if result < 0 {
return Err(io::Error::other(format!(
"Windows ProgramData lookup failed ({result:#x})"
)));
}
let length = path
.iter()
.position(|&c| c == 0)
.filter(|&n| n > 0)
.ok_or_else(|| io::Error::other("Windows ProgramData path is unavailable"))?;
Ok(PathBuf::from(OsString::from_wide(&path[..length])))
}
+48 -8
View File
@@ -235,12 +235,18 @@ fn assert_dns_policy(active: bool) {
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$expected = [int]$env:GP_TEST_EXPECTED_DNS_POLICIES
$configured = @(Get-DnsClientNrptRule | Where-Object { $_.Namespace -contains '.gp-connect-test.invalid' })
$effective = @(Get-DnsClientNrptPolicy | Where-Object { $_.Namespace -contains '.gp-connect-test.invalid' })
if ($configured.Count -ne $expected -or $effective.Count -ne $expected) { throw 'Unexpected configured or effective VPN DNS policy' }
if ($expected) {
$servers = @($configured[0].NameServers)
if ($servers -notcontains '198.18.0.53' -or $servers -notcontains 'fd42:1235::53') { throw 'VPN DNS server families are missing' }
$configured = @(Get-DnsClientNrptRule)
$effective = @(Get-DnsClientNrptPolicy)
foreach ($namespace in '.gp-connect-test.invalid', '.second-gp-connect-test.invalid') {
$rules = @($configured | Where-Object { $_.Namespace -contains $namespace })
$policies = @($effective | Where-Object { $_.Namespace -contains $namespace })
if ($rules.Count -ne $expected -or $policies.Count -ne $expected) {
throw "Unexpected configured or effective VPN DNS policy for $namespace"
}
if ($expected) {
$servers = @($rules[0].NameServers)
if ($servers -notcontains '198.18.0.53' -or $servers -notcontains 'fd42:1235::53') { throw "VPN DNS server families are missing for $namespace" }
}
}
"#;
let powershell =
@@ -253,6 +259,22 @@ if ($expected) {
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
}
fn global_search_list() -> Vec<u8> {
let powershell =
PathBuf::from(std::env::var_os("SystemRoot").unwrap()).join("System32/WindowsPowerShell/v1.0/powershell.exe");
let output = std::process::Command::new(powershell)
.args([
"-NoProfile",
"-NonInteractive",
"-Command",
"$ErrorActionPreference = 'Stop'; (Get-DnsClientGlobalSetting).SuffixSearchList | ConvertTo-Json -Compress",
])
.output()
.unwrap();
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
output.stdout
}
#[test]
#[ignore = "requires administrator privileges and GP_TEST_WINTUN_DLL"]
fn installs_and_restores_native_network_configuration() -> Result<(), Box<dyn std::error::Error>> {
@@ -274,10 +296,17 @@ fn installs_and_restores_native_network_configuration() -> Result<(), Box<dyn st
let recovery_key = format!(r"SOFTWARE\GP Connect\Tests\Network{}", uuid::Uuid::new_v4().simple());
assert_dns_policy(false);
let before = state(index);
let original_search_list = global_search_list();
{
let mut network = NetworkConfigurator::new(&recovery_key)?;
network.configure("connect", &environment)?;
let during = state(index);
assert!(during.iter().any(|row| row == "dns-domain gp-connect-test.invalid"));
assert!(
during
.iter()
.any(|row| row == "dns-search gp-connect-test.invalid,second-gp-connect-test.invalid")
);
assert!(during.iter().any(|row| row == "address 192.0.2.2/24"));
assert!(during.iter().any(|row| row == "address fd42:1234::2/64"));
assert!(
@@ -298,10 +327,14 @@ fn installs_and_restores_native_network_configuration() -> Result<(), Box<dyn st
assert_ne!(best_route("198.51.100.1").InterfaceIndex, index);
println!("PASS: IPv4/IPv6 addresses, split routes, resolver routes and MTU installed");
assert_dns_policy(true);
gpvpnc::windows::recover(&format!(r"{recovery_key}-other"))?;
assert_dns_policy(true);
assert_eq!(global_search_list(), original_search_list);
network.configure("disconnect", &[])?;
}
assert_eq!(before, state(index), "Network state was not restored");
assert_dns_policy(false);
assert_eq!(global_search_list(), original_search_list);
println!("PASS: disconnect restored addresses, routes and interface settings");
{
let mut network = NetworkConfigurator::new(&recovery_key)?;
@@ -324,6 +357,7 @@ fn installs_and_restores_native_network_configuration() -> Result<(), Box<dyn st
println!("PASS: partial setup failure rolled back its physical gateway route");
drop(adapter);
assert_crash_recovery(&recovery_key)?;
assert_eq!(global_search_list(), original_search_list);
winreg::RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE).delete_subkey(&recovery_key)?;
Ok(())
}
@@ -347,8 +381,14 @@ fn environment(index: u32) -> Vec<(String, Option<String>)> {
("CISCO_IPV6_SPLIT_INC_0_ADDR", "2001:db8:1234::".into()),
("CISCO_IPV6_SPLIT_INC_0_MASKLEN", "64".into()),
("INTERNAL_IP4_DNS", "198.18.0.53 fd42:1235::53".into()),
("CISCO_DEF_DOMAIN", "gp-connect-test.invalid".into()),
("CISCO_SPLIT_DNS", "gp-connect-test.invalid".into()),
(
"CISCO_DEF_DOMAIN",
"gp-connect-test.invalid,second-gp-connect-test.invalid".into(),
),
(
"CISCO_SPLIT_DNS",
"gp-connect-test.invalid,second-gp-connect-test.invalid".into(),
),
];
pairs
.into_iter()
+1
View File
@@ -115,6 +115,7 @@ fn build_openconnect(deps_dir: &PathBuf, out_dir: &PathBuf) -> PathBuf {
.without("libpcsclite", None)
.without("libpskc", None)
.without("gssapi", None)
.with("builtin-json", None)
.with("gnutls", None)
.without("openssl", None)
.with("gnutls-tss2", Some("no"))
+1 -1
View File
@@ -19,7 +19,7 @@ Install build and runtime dependencies:
```sh
sudo pkg install git rust libiconv gettext-tools autoconf automake libtool patch \
gmake pkgconf libxml2 gnutls p11-kit nettle gmp liblz4 gnome-keyring \
libayatana-appindicator polkit webkit2-gtk_41 xdg-utils
polkit webkit2-gtk_41 xdg-utils
```
Build and install:
Generated
+3 -3
View File
@@ -63,11 +63,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1794408178,
"narHash": "sha256-OUDRQTMmN/6cQ/ebDsazUmLj84RxSLaHznKv5As9E1k=",
"lastModified": 1794840529,
"narHash": "sha256-ySrWnmZB5UsZTYGHHnBjllT05O5iFjElCRS+mabtfP0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9397dcb09c9598a33509fbc0cce699bd4e6c84d5",
"rev": "e21fec321d73511849707a7585e4ea155ee4bf40",
"type": "github"
},
"original": {
+43 -9
View File
@@ -29,8 +29,8 @@
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = "globalprotect-openconnect";
version = cargoToml.workspace.package.version;
releaseTag = "v3.4.0";
releaseVersion = "3.4.0";
releaseTag = "v3.6.0";
releaseVersion = "3.6.0";
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
@@ -55,8 +55,8 @@
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
gpguiHashes = {
x86_64 = "sha256-2qZQICnK5fa18suhnqeYnDI1z+SGqXJa1ZXI2NhfQP0=";
aarch64 = "sha256-iOM3+Qte/6C4Gs/e9jVvx5DtBFq7DG2PNDCsGwPMeY0=";
x86_64 = "sha256-cWFOqjDpzGSWLZgiDVeEYJMGAMrdfiB15Q6geKSVEEg=";
aarch64 = "sha256-e66fokdJk6/vr1B/6hX37Lt+7OPnXZP+D2N5ht/yM4o=";
};
gpguiArchive = pkgs.fetchurl {
@@ -69,9 +69,33 @@
archive = gpguiArchive;
};
nshHashes = {
x86_64 = "sha256-HWQ7Lh0NA6lEjLIPjmvqsB1DhzUPMeZ6NPpyUTfLbng=";
aarch64 = "sha256-GT6arWaFyZNDCMrK676+JlPJnCAJ0DhDugcCMQlPmIM=";
};
nshArchive = pkgs.fetchurl {
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/gpgui-nsh_${cpu}.bin.tar.xz";
hash = nshHashes.${cpu};
};
installNativeShell = archive: version:
let nsh = import ./nix/gui-package.nix {
inherit pkgs version;
src = archive;
binaryName = "gpgui-nsh";
};
in ''
# A direct invocation hands off to gpclient in the enclosing package.
makeWrapper ${nsh}/bin/gpgui-nsh "$out/bin/gpgui-nsh" \
--set-default GP_CLIENT_BINARY "$out/bin/gpclient"
install -Dm644 ${nsh}/share/licenses/gpgui-nsh/ICU4X-LICENSE.txt \
"$out/share/licenses/globalprotect-openconnect/ICU4X-LICENSE.txt"
'';
binaryHashes = {
x86_64 = "sha256-hBnfMAS3qEby9Dyc3ysH8tdGQwarXqo9xtY1gbN8gJI=";
aarch64 = "sha256-lW1yQQD1G633tdBGBhVEAEQvMtnntK3mMU9M69x9ID0=";
x86_64 = "sha256-gK8VWHw1VbXE7wHU1wGYw4fQ0khk24JWUwAQk+47WF8=";
aarch64 = "sha256-nqSuIW1fz742+2rF0QpnN8hswFm5lezC9JEOMs/8OHM=";
};
binaryArchive = pkgs.fetchurl {
@@ -99,7 +123,13 @@
config = {};
overlays = [];
};
inherit archive checksum binaryName;
inherit binaryName;
src = builtins.path {
path = builtins.toPath archive;
name = "''${binaryName}.tar.xz";
recursive = false;
sha256 = checksum;
};
version = "${version}";
}
'';
@@ -191,7 +221,7 @@
EOF
'';
fromSource = lib.makeOverridable ({ gui ? gpgui }: naersk'.buildPackage {
fromSource = lib.makeOverridable ({ gui ? gpgui, nativeShellArchive ? nshArchive }: naersk'.buildPackage {
inherit pname version;
SNAPSHOT = lib.boolToString (releaseTag == "snapshot");
src = assert lib.assertMsg
@@ -238,6 +268,7 @@
runtimeDependencies = lib.optionals pkgs.stdenv.isLinux linuxRuntimeDependencies;
preFixup = nativeRuntimeWrapping;
postFixup = lib.optionalString pkgs.stdenv.isLinux (installNativeShell nativeShellArchive version);
postInstall = ''
make install PREFIX="$out" ${lib.optionalString pkgs.stdenv.isLinux ''GPGUI_BINARY="${gui}/gpgui"''}
@@ -253,6 +284,7 @@
prebuilt = lib.makeOverridable ({
binaries ? binaryPackage,
nativeShellArchive ? nshArchive,
gui ? gpgui,
version ? releaseVersion,
}: pkgs.stdenv.mkDerivation {
@@ -269,6 +301,7 @@
buildInputs = linuxBuildInputs;
runtimeDependencies = linuxRuntimeDependencies;
preFixup = nativeRuntimeWrapping;
postFixup = installNativeShell nativeShellArchive version;
installPhase = ''
runHook preInstall
@@ -282,6 +315,8 @@
cp -r artifacts/usr/lib $out/lib
fi
# The Native Shell archive gets its own GTK4 wrapper in postFixup.
rm -f "$out/bin/gpgui-nsh"
install -Dm755 ${gui}/gpgui $out/bin/gpgui
${rewriteVpncScriptToolPaths}
@@ -324,7 +359,6 @@
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
services.ayatana-indicators.enable = lib.mkDefault true;
security.polkit = {
enable = true;
} // lib.optionalAttrs (options.security.polkit ? enablePkexecWrapper) {
+11 -3
View File
@@ -18,9 +18,13 @@ let
'';
binaries = unpack "gp-ci-binaries" "GP_BINARY_ARCHIVE";
gui = unpack "gp-ci-gui" "GP_GUI_ARCHIVE";
sourcePackage = gp.packages.${system}.fromSource.override { inherit gui; };
nativeShellArchive = builtins.path {
path = builtins.toPath (builtins.getEnv "GP_NSH_ARCHIVE");
name = "gpgui-nsh.tar.xz";
};
sourcePackage = gp.packages.${system}.fromSource.override { inherit gui nativeShellArchive; };
prebuiltInputs = {
inherit binaries gui;
inherit binaries gui nativeShellArchive;
version = sourcePackage.version;
};
prebuiltPackage = gp.packages.${system}.prebuilt.override prebuiltInputs;
@@ -43,7 +47,6 @@ in {
prebuilt = assert prebuiltPackage.version == sourcePackage.version; prebuiltPackage;
module = assert modulePackage.version == sourcePackage.version;
assert builtins.elem modulePackage hostSystem.config.environment.systemPackages;
assert hostSystem.config.services.ayatana-indicators.enable;
assert hostSystem.config.security.polkit.enable;
assert hostSystem.config.security.wrappers.pkexec.enable;
assert hostSystem.config.security.wrappers.pkexec.setuid;
@@ -53,6 +56,11 @@ in {
package = sourcePackage;
module = gp.nixosModules.default;
};
graphical-prebuilt = import ./tests/desktop-interfaces.nix {
inherit pkgs;
package = prebuiltPackage;
module = gp.nixosModules.default;
};
runtime-prebuilt = import ./tests/native-runtime.nix {
inherit pkgs;
package = prebuiltPackage;
+5 -9
View File
@@ -1,23 +1,19 @@
{ pkgs, archive, checksum, binaryName, version }:
{ pkgs, src, binaryName, version }:
let
nativeShell = binaryName == "gpgui-nsh";
in
assert builtins.elem binaryName [ "gpgui" "gpgui-nsh" ];
assert pkgs.lib.assertMsg (!nativeShell || pkgs.lib.versionAtLeast pkgs.gtk4.version "4.14")
"Native Shell requires GTK 4.14 or later.";
pkgs.stdenv.mkDerivation {
pname = binaryName;
inherit version;
src = builtins.path {
path = builtins.toPath archive;
name = "${binaryName}.tar.xz";
recursive = false;
sha256 = checksum;
};
inherit src version;
dontBuild = true;
nativeBuildInputs = [ pkgs.autoPatchelfHook ] ++ (
if nativeShell then [ pkgs.wrapGAppsHook4 ] else [ pkgs.wrapGAppsHook3 ]
);
buildInputs = with pkgs;
[ gnutls ] ++ (if nativeShell then [ gtk4 ] else [
[ gnutls ] ++ (if nativeShell then [ gtk4 dbus ] else [
gtk3 webkitgtk_4_1 libsoup_3 glib-networking libsecret
]);
runtimeDependencies = [ pkgs.libglvnd ] ++ pkgs.lib.optionals (!nativeShell) [
+92
View File
@@ -0,0 +1,92 @@
{ pkgs, package, module }:
let
testPython = pkgs.python3.withPackages (ps: [ ps.pyatspi ps.pygobject3 ]);
typelibs = pkgs.lib.makeSearchPath "lib/girepository-1.0" [
pkgs.at-spi2-core
pkgs.glib.out
pkgs.gobject-introspection
];
chooseTauri = pkgs.writeScript "choose-tauri" ''
#!${testPython}/bin/python3
import pyatspi
import subprocess
desktop = pyatspi.Registry.getDesktop(0)
target = pyatspi.findDescendant(desktop, lambda node: node.name == "Interface: Tauri")
if target is None:
raise SystemExit("The Tauri control is not visible yet")
# GTK4 exposes bounds relative to the window, even on X11.
rect = target.queryComponent().getExtents(pyatspi.WINDOW_COORDS)
if rect.width <= 0 or rect.height <= 0:
raise SystemExit("The Tauri control has no visible bounds")
window = subprocess.check_output(["xdotool", "search", "--onlyvisible", "--name",
"^GP Connect Settings$"], text=True).splitlines()[-1]
subprocess.run(["xdotool", "mousemove", "--window", window, str(rect.x + rect.width // 2),
str(rect.y + rect.height // 2), "click", "1"], check=True)
'';
in
pkgs.testers.runNixOSTest {
name = "gp-offline-desktop-interfaces";
nodes.machine = {
imports = [ module (pkgs.path + "/nixos/tests/common/x11.nix") ];
programs.globalprotect-openconnect = { enable = true; inherit package; };
test-support.displayManager.auto.user = "alice";
users.users.alice = { isNormalUser = true; uid = 1000; };
services.gnome.at-spi2-core.enable = true;
environment.systemPackages = [ pkgs.xdotool ];
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if (subject.user == "alice" && action.id == "com.yuezk.gpgui.service") {
return polkit.Result.YES;
}
});
'';
virtualisation.memorySize = 4096;
};
testScript = ''
from datetime import timedelta
import shlex
machine.start()
machine.wait_for_unit("display-manager.service")
def as_alice(command):
environment = "export DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1000 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus GTK_A11Y=atspi; "
return "su - alice -c " + shlex.quote(environment + command)
accessibility_env = "GI_TYPELIB_PATH=${typelibs} "
machine.succeed(as_alice(accessibility_env + "${testPython}/bin/python3 -c 'import pyatspi'"))
machine.wait_until_succeeds(as_alice("xdotool getdisplaygeometry"))
# Leave loopback available for the local privileged service.
machine.succeed("for dev in /sys/class/net/*; do dev=$(basename \"$dev\"); [ \"$dev\" = lo ] || ip link set \"$dev\" down; done")
def launch():
machine.succeed(as_alice("gpclient launch-gui > ~/gp-launch.log 2>&1 & echo $! > ~/gp-launch.pid"))
def wait_for_gui(name):
# Identify the process which owns the mapped main window, including Nix's executable wrapper.
machine.wait_until_succeeds(as_alice(
"pid=$(xdotool search --onlyvisible --name '^GP Connect$' | tail -n 1 | xargs xdotool getwindowpid) && "
"readlink /proc/$pid/exe | grep -E '/[.]?" + name + "(-wrapped)?$'"
))
launch()
wait_for_gui("gpgui-nsh")
machine.succeed(as_alice("test ! -e ~/.config/gpclient/gui"))
machine.succeed(as_alice("${pkgs.glib.bin}/bin/gapplication action com.yuezk.gpgui settings"))
machine.wait_until_succeeds(
as_alice("xdotool search --onlyvisible --name '^GP Connect Settings$'"),
timeout=timedelta(seconds=60),
)
machine.screenshot("native-shell-settings")
machine.wait_until_succeeds(as_alice(accessibility_env + "${chooseTauri}"), timeout=timedelta(seconds=60))
wait_for_gui("gpgui")
machine.succeed(as_alice("grep -Fx gpgui ~/.config/gpclient/gui"))
machine.succeed(as_alice("kill -TERM $(cat ~/gp-launch.pid)"))
machine.wait_until_succeeds("test ! -e /var/run/gpservice.lock")
launch()
wait_for_gui("gpgui")
machine.screenshot("tauri-relaunch")
'';
}
+1
View File
@@ -61,6 +61,7 @@ pkgs.testers.runNixOSTest {
return machine.succeed("su - alice -c " + shlex.quote(command))
# Exercise real host pkexec, private credential pipes and launcher cancellation.
as_alice("mkdir -p ~/.config/gpclient && echo gpgui > ~/.config/gpclient/gui")
command = "GP_GUI_BINARY=${guiProbe} " + package + "/bin/gpclient --lock-file /tmp/gp-client.lock launch-gui"
as_alice(command + " > /tmp/gp-client-output 2>&1 & echo $! > /tmp/gp-client-pid")
try:
+3
View File
@@ -45,6 +45,8 @@ source="$pkgname-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"
install="$pkgname.post-deinstall"
options="!check"
# GTK4 is loaded only by the optional Native Shell. Keep dependency tracing for the rest of the package.
somask="libgtk-4.so.1 libgraphene-1.0.so.0"
build() {
cd "$builddir"
@@ -64,6 +66,7 @@ package() {
make install \
DESTDIR="$pkgdir" \
INCLUDE_GUI="${INCLUDE_GUI:-0}" \
BUILD_GUI_HELPER="${BUILD_GUI_HELPER:-1}"
}
@@ -22,7 +22,6 @@ pkgbase = globalprotect-openconnect-git
makedepends = librsvg
makedepends = cargo
depends = webkit2gtk-4.1
depends = libappindicator-gtk3
depends = libsecret
depends = libxml2
depends = zlib
+4 -1
View File
@@ -8,7 +8,9 @@ install:
install -Dm755 artifacts/usr/bin/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
if [ -f artifacts/usr/bin/gpgui ]; then \
install -Dm755 artifacts/usr/bin/gpgui $(DESTDIR)/usr/bin/gpgui; \
install -Dm755 artifacts/usr/bin/gpgui $(DESTDIR)/usr/bin/gpgui && \
install -Dm755 artifacts/usr/bin/gpgui-nsh $(DESTDIR)/usr/bin/gpgui-nsh && \
install -Dm644 artifacts/usr/share/licenses/globalprotect-openconnect/ICU4X-LICENSE.txt $(DESTDIR)/usr/share/licenses/globalprotect-openconnect/ICU4X-LICENSE.txt; \
fi
install -Dm755 artifacts/usr/libexec/gpclient/vpnc-script $(DESTDIR)/usr/libexec/gpclient/vpnc-script
@@ -37,6 +39,7 @@ uninstall:
rm -f $(DESTDIR)/usr/bin/gpauth
rm -f $(DESTDIR)/usr/bin/gpgui-helper
rm -f $(DESTDIR)/usr/bin/gpgui
rm -f $(DESTDIR)/usr/bin/gpgui-nsh $(DESTDIR)/usr/share/licenses/globalprotect-openconnect/ICU4X-LICENSE.txt
rm -f $(DESTDIR)/usr/libexec/gpclient/vpnc-script
rm -f $(DESTDIR)/usr/libexec/gpclient/gp-vpnc-script-installer
+3 -2
View File
@@ -34,5 +34,6 @@ Depends:
libsecret-1-0,
gnome-keyring,
xdg-utils,
Description: A GUI client for GlobalProtect VPN
A GUI client for GlobalProtect VPN, based on OpenConnect, supports the SSO authentication method.
Description: Graphical client for GlobalProtect VPN
GP Connect uses OpenConnect to connect to GlobalProtect VPN servers.
It supports single sign-on (SSO).
+4
View File
@@ -11,3 +11,7 @@ export PATH := /usr/lib/rust-@RUST_VERSION@/bin:/usr/local/cargo/bin:$(PATH)
which cargo
which rustc
dh $@ --no-parallel
# Native Shell checks its optional runtime on launch.
override_dh_shlibdeps:
dh_shlibdeps -X/bin/gpgui-nsh
@@ -35,6 +35,7 @@ Requires: xdg-utils
Conflicts: globalprotect-openconnect-snapshot
%global debug_package %{nil}
%global __requires_exclude_from ^%{_bindir}/gpgui-nsh$
%description
A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authentication method.
@@ -57,14 +58,17 @@ fi
%build
# The injected RUSTFLAGS could fail the build
unset RUSTFLAGS
make build
make build INCLUDE_GUI=%{?include_gui}%{!?include_gui:0}
%install
%make_install
%make_install INCLUDE_GUI=%{?include_gui}%{!?include_gui:0}
%files
%defattr(-,root,root)
%{_bindir}/*
%if 0%{?include_gui}
%license %{_datadir}/licenses/%{name}/ICU4X-LICENSE.txt
%endif
%{_libexecdir}/gpclient/vpnc-script
%{_libexecdir}/gpclient/gp-hip-script-installer
%{_libexecdir}/gpclient/gp-vpnc-script-installer
+16 -2
View File
@@ -9,7 +9,10 @@
`TARGET_ARCH` is `x64` or `arm64` and must match every executable and DLL in
the payload. Each installer accepts only its native Windows architecture. ARM64
requires Windows 11; x64 requires Windows 10 build 19041 or newer.
requires Windows 11. x64 requires Windows 10 version 1809 (build 17763) or
later, or Windows Server 2019 or later with Desktop Experience.
On Windows N, install the [Media Feature Pack for your Windows version](https://support.microsoft.com/en-us/windows/experience/platform-variants/media-feature-pack-list-for-windows-n-editions)
before running setup.
The native library build accepts `scripts/build-openconnect-windows.ps1 -TunnelType 'GP Connect'`
(the default). This passes OpenConnect's `--with-wintun-tunnel-type` build option;
@@ -20,7 +23,8 @@ selected type. The gateway-based connection name is unchanged.
match the payload's `build-info.json`. `DISPLAY_VERSION` is the full release
identity, including the snapshot build when applicable. The payload must contain matching
`gpgui.exe`, `gpauth.exe`, `gpservice.exe`, their DLL dependency closure, the
vendor-signed `wintun.dll`, `licenses`, and `build-info.json`. The NSIS compiler
vendor-signed `wintun.dll`, `licenses`, and `build-info.json`. The `cli` folder
contains `gpclient.exe` and its application-local DLLs. The NSIS compiler
adds the generated uninstaller; it is not a separately built executable.
The installer, extraction progress and uninstaller use the shared Windows icon
@@ -97,3 +101,13 @@ cannot host a Windows service. The latter must fail service startup, restore A's
files and uninstall metadata, and leave A's service running. Also check held
runtime files, active GUI/auth windows, Wintun-signature failure, and concurrent
installer attempts. Do not run failure fixtures against a live company VPN.
The installer includes `GP Connect\cli\gpclient.exe`. From an administrator
PowerShell, connect to your portal and press Ctrl+C to disconnect.
```powershell
& "$env:ProgramFiles\GP Connect\cli\gpclient.exe" connect vpn.example.com
```
Embedded SAML sign-in from an elevated terminal requires an interactive Windows
desktop under the same account with UAC enabled and the WebView2 Runtime.
+63 -13
View File
@@ -14,10 +14,13 @@ if ($PSVersionTable.PSEdition -eq 'Desktop') {
}
if (![Environment]::Is64BitProcess) { throw 'Run the GP Connect installer with 64-bit PowerShell.' }
$destination = Join-Path ([Environment]::GetFolderPath('ProgramFiles')) 'GP Connect'
$state = Join-Path $env:ProgramData 'GP Connect'
$programData = [Environment]::GetFolderPath('CommonApplicationData')
$state = Join-Path $programData 'GP Connect'
$private = Join-Path $state 'Private'
$tunnelLock = $null
$serviceName = 'GPConnect'
$serviceBinary = Join-Path $destination 'gpservice.exe'
$shortcutPath = Join-Path $env:ProgramData 'Microsoft\Windows\Start Menu\Programs\GP Connect.lnk'
$shortcutPath = Join-Path $programData 'Microsoft\Windows\Start Menu\Programs\GP Connect.lnk'
$uninstallKey = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPConnect'
$recoveryKey = 'HKLM:\SOFTWARE\GP Connect\NetworkRecovery'
$publicAcl = 'O:BAG:BAD:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;FRFX;;;BU)'
@@ -52,8 +55,13 @@ function Set-DirectoryAcl([string]$Path, [string]$Descriptor) {
function Wait-ForApplications {
$deadline = [DateTime]::UtcNow.AddSeconds(30)
do {
$running = @(Get-CimInstance Win32_Process -Filter "Name='gpgui.exe' OR Name='gpauth.exe'" |
Where-Object { $_.ExecutablePath -in @((Join-Path $destination 'gpgui.exe'), (Join-Path $destination 'gpauth.exe')) })
$clientPath = Join-Path $destination 'cli\gpclient.exe'
$guiPaths = @((Join-Path $destination 'gpgui.exe'), (Join-Path $destination 'gpauth.exe'))
$running = @(Get-CimInstance Win32_Process -Filter "Name='gpgui.exe' OR Name='gpauth.exe' OR Name='gpclient.exe'")
if ($running.ExecutablePath -contains $clientPath) {
throw 'Close gpclient.exe before installing or removing GP Connect.'
}
$running = @($running | Where-Object { $_.ExecutablePath -in $guiPaths })
if (!$running.Count) { return }
if ([DateTime]::UtcNow -ge $deadline) {
throw 'Quit GP Connect and finish or cancel sign-in in all Windows sessions, then try again.'
@@ -91,7 +99,8 @@ function Wait-ForRuntimeRelease {
$deadline = [DateTime]::UtcNow.AddSeconds(30)
do {
$locked = $false
foreach ($file in Get-ChildItem -LiteralPath $destination -File | Where-Object { $_.Extension -in @('.exe', '.dll') }) {
$directories = @($destination, (Join-Path $destination 'cli')) | Where-Object { Test-Path -LiteralPath $_ -PathType Container }
foreach ($file in Get-ChildItem -LiteralPath $directories -File | Where-Object { $_.Extension -in @('.exe', '.dll') }) {
try {
$stream = [IO.File]::Open($file.FullName, [IO.FileMode]::Open, [IO.FileAccess]::Read, [IO.FileShare]::None)
$stream.Dispose()
@@ -103,12 +112,24 @@ function Wait-ForRuntimeRelease {
} while ($true)
}
function Open-TunnelLock {
Set-DirectoryAcl $private $privateAcl
$path = Join-Path $private 'system-tunnel.lock'
try { return [IO.File]::Open($path, [IO.FileMode]::OpenOrCreate, [IO.FileAccess]::ReadWrite, [IO.FileShare]::None) }
catch [IO.IOException] {
if (($_.Exception.GetBaseException().HResult -band 0xffff) -eq 32) {
throw 'A GP Connect system tunnel is active. Disconnect it before running setup.'
}
throw
}
}
function Assert-NetworkClean {
$records = @()
if (Test-Path $recoveryKey) { $records = @((Get-Item $recoveryKey).GetValueNames() | Where-Object { $_ -like 'Route-*' }) }
$policies = @(Get-DnsClientNrptRule | Where-Object { $_.Comment -like 'GPConnect:*' })
if ($records.Count -or $policies.Count) {
throw 'VPN network cleanup is incomplete. Restart GP Connect before trying again.'
throw 'VPN network cleanup is incomplete. Start or restart the GPConnect service before trying again.'
}
}
@@ -119,7 +140,7 @@ function Invoke-ServiceCommand([string[]]$Arguments) {
function Set-MachineState {
Set-DirectoryAcl $state $publicAcl
Set-DirectoryAcl (Join-Path $state 'Private') $privateAcl
Set-DirectoryAcl $private $privateAcl
foreach ($name in @('gpservice.lock', 'gpservice.log')) {
$path = Join-Path $state $name
if (Test-Path -LiteralPath $path) {
@@ -281,7 +302,7 @@ try {
if ($source -eq $destination -or $source.StartsWith($destination + '\', [StringComparison]::OrdinalIgnoreCase)) {
throw 'Install from an extracted package outside the application folder.'
}
foreach ($name in @('gpservice.exe', 'gpauth.exe', 'gpgui.exe', 'gp-posture.exe', 'libopenconnect-5.dll', 'wintun.dll', 'build-info.json')) {
foreach ($name in @('gpservice.exe', 'gpauth.exe', 'gpgui.exe', 'gp-posture.exe', 'libopenconnect-5.dll', 'wintun.dll', 'build-info.json', 'cli\gpclient.exe', 'cli\libopenconnect-5.dll', 'cli\wintun.dll')) {
if (!(Test-Path -LiteralPath (Join-Path $source $name) -PathType Leaf)) { throw "Missing Windows package file: $name" }
}
$info = Get-Content -LiteralPath (Join-Path $source 'build-info.json') -Raw | ConvertFrom-Json
@@ -294,14 +315,30 @@ try {
if ($info.product -ne 'GP Connect' -or $info.architecture -notin @('x64','arm64') -or $info.architecture -ne $architecture -or !$Version -or $info.version -ne $Version) {
throw 'The package version or architecture does not match this installer.'
}
if (![Environment]::Is64BitProcess -or [Environment]::OSVersion.Version.Build -lt 19041) {
throw 'GP Connect requires Windows 10 build 19041 or newer.'
}
if ($architecture -eq 'arm64' -and [Environment]::OSVersion.Version.Build -lt 22000) {
$build = [Environment]::OSVersion.Version.Build
if ($architecture -eq 'arm64' -and $build -lt 22000) {
throw 'GP Connect for ARM64 requires Windows 11.'
}
if ($architecture -eq 'x64' -and $build -lt 17763) {
throw 'GP Connect for x64 requires Windows 10 version 1809 or later.'
}
if ((Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name InstallationType) -eq 'Server Core') {
throw 'GP Connect requires Windows Server with Desktop Experience.'
}
foreach ($library in @('mfplat.dll', 'mfreadwrite.dll')) {
if (!(Test-Path -LiteralPath (Join-Path ([Environment]::SystemDirectory) $library) -PathType Leaf)) {
throw 'GP Connect requires Media Foundation. On Windows N, install the Media Feature Pack, then run setup again.'
}
}
$cliDirectory = Join-Path $source 'cli'
Assert-RegularDirectory $cliDirectory
foreach ($item in Get-ChildItem -LiteralPath $cliDirectory -Force) {
if ($item.PSIsContainer -or ($item.Name -ne 'gpclient.exe' -and $item.Extension -ne '.dll')) {
throw "Unexpected Windows CLI runtime file: $($item.Name)"
}
}
$payload = @(Get-ChildItem -LiteralPath $source -Force | Where-Object {
($_.PSIsContainer -and $_.Name -eq 'licenses') -or
($_.PSIsContainer -and $_.Name -in @('licenses', 'cli')) -or
(!$_.PSIsContainer -and ($_.Extension -eq '.dll' -or
$_.Name -in @('gpservice.exe', 'gpauth.exe', 'gpgui.exe', 'gp-posture.exe', 'uninstall.exe', 'build-info.json')))
})
@@ -356,6 +393,12 @@ try {
if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch 'WireGuard LLC') {
throw 'The package requires the vendor-signed Wintun driver DLL.'
}
foreach ($dll in Get-ChildItem (Join-Path $stage 'cli') -File -Filter '*.dll') {
$shared = Join-Path $stage $dll.Name
if ((Test-Path -LiteralPath $shared) -and (Get-FileHash $shared).Hash -ne (Get-FileHash $dll.FullName).Hash) {
throw "The Windows CLI runtime file differs from the application copy: $($dll.Name)"
}
}
if ((Test-Path -LiteralPath $destination) -and !$existing) { throw 'The service is not registered. Repair the existing installation before updating.' }
if ($existing -and !(Test-Path -LiteralPath $destination)) { throw 'The registered installation is missing. Restore its files before updating.' }
if (Test-Path $uninstallKey) {
@@ -368,6 +411,9 @@ try {
if ($existing) {
$serviceStopped = $true
Stop-InstalledService
}
$tunnelLock = Open-TunnelLock
if ($existing) {
Assert-NetworkClean
Wait-ForRuntimeRelease
}
@@ -382,6 +428,7 @@ try {
} else { Set-Service -Name $serviceName -StartupType Automatic }
Invoke-ServiceCommand @('failure', $serviceName, 'reset=', '86400', 'actions=', 'restart/3000/restart/10000/none/0')
Set-InstallationMetadata $Version
$tunnelLock.Dispose(); $tunnelLock = $null
Start-InstalledService
$committed = $true
if ($oldMoved) { Remove-Item -LiteralPath $backup -Recurse -Force; $oldMoved = $false }
@@ -395,6 +442,7 @@ try {
Wait-ForApplications
$serviceStopped = $true
Stop-InstalledService
$tunnelLock = Open-TunnelLock
Assert-NetworkClean
Wait-ForRuntimeRelease
# Move first: a locked runtime aborts while its registration and files are intact.
@@ -418,6 +466,7 @@ try {
if ($oldMoved) { Move-Item -LiteralPath $backup -Destination $destination; $oldMoved = $false }
if ($createdService) { Invoke-ServiceCommand @('delete', $serviceName) }
if ($newMoved) { Restore-InstallationMetadata }
if ($tunnelLock) { $tunnelLock.Dispose(); $tunnelLock = $null }
if ($existing -and $serviceStopped -and $wasRunning) { Start-InstalledService }
} catch {
Write-Host "Could not restore GP Connect: $($_.Exception.Message)"
@@ -428,6 +477,7 @@ try {
Write-Host "Details: $(Join-Path $state 'installer.log')"
throw $failure
} finally {
if ($tunnelLock) { $tunnelLock.Dispose() }
if ($stage -and (Test-Path -LiteralPath $stage)) {
try { Remove-Item -LiteralPath $stage -Recurse -Force } catch { Write-Warning "Could not remove temporary files: $stage" }
}
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Run in the gpgui checkout with its matching gp sibling on a native Linux builder.
set -euo pipefail
manifest=apps/desktop-nsh/Cargo.toml
toolchain=1.97.0
host=$(rustc "+$toolchain" -vV | sed -n 's/^host: //p')
case "$host" in
x86_64-unknown-linux-gnu|aarch64-unknown-linux-gnu) suffix= ;;
x86_64-unknown-linux-musl|aarch64-unknown-linux-musl)
suffix=-musl
export RUSTFLAGS="-C target-feature=-crt-static"
;;
*) echo "Unsupported Linux NSH build target: $host" >&2; exit 1 ;;
esac
pkg-config --exists 'gtk4 >= 4.14' gnutls dbus-1 wayland-client xkbcommon
cargo "+$toolchain" build --manifest-path "$manifest" --locked --release --bin gpgui-nsh \
--target "$host" --target-dir target
binary="target/$host/release/gpgui-nsh"
"$binary" --version
needed=$(readelf -d "$binary")
if grep -q 'NEEDED.*libicu' <<<"$needed"; then
echo 'The release executable must not depend on ICU4C.' >&2
exit 1
fi
if [[ $suffix == -musl ]]; then
readelf -lW "$binary" | grep 'Requesting program interpreter: /lib/ld-musl-' >/dev/null
fi
version=$(cargo "+$toolchain" metadata --manifest-path "$manifest" --no-deps --format-version 1 \
| jq -er '.packages[] | select(.name == "gpgui-nsh") | .version')
directory="gpgui-nsh_$version"
archive="gpgui-nsh_$(uname -m)$suffix.bin.tar.xz"
mkdir -p ".build/package/$directory"
cp "$binary" apps/desktop-nsh/ICU4X-LICENSE.txt ".build/package/$directory/"
cd .build/package
tar -cJf "$archive" "$directory"
sha256sum "$archive" | cut -d ' ' -f 1 > "$archive.sha256"
+3 -6
View File
@@ -47,10 +47,6 @@ upload_files() {
done
}
release_assets() {
"$SCRIPT_DIR/release-assets.sh" "$TAG"
}
release_assets_json() {
retry_gh gh -R "$REPO" release view "$TAG" --json assets
}
@@ -134,7 +130,6 @@ upload_file() {
# Keep its tag fixed; only release assets advance with subsequent builds.
# Preserve its macOS update assets when the current run does not replace them.
release_snapshot() {
mapfile -t files < <(release_assets)
local existing_assets
local is_current
local asset
@@ -201,11 +196,13 @@ release_tag() {
--notes-file "$release_notes_file"
fi
mapfile -t files < <(release_assets)
GITHUB_REPOSITORY="$REPO" "$SCRIPT_DIR/upload-release-assets.sh" "$TAG" "${files[@]}"
gh -R "$REPO" release edit "$TAG" --prerelease=false
}
asset_list=$("$SCRIPT_DIR/release-assets.sh" "$TAG")
mapfile -t files <<<"$asset_list"
if [[ $TAG == *"snapshot" ]]; then
release_snapshot
else
+24 -1
View File
@@ -37,7 +37,30 @@ PY
branch="chore/promote-$tag"
git switch -c "$branch" origin/main
git merge --ff --no-edit "$release_sha"
cp "$artifact_dir/flake.nix" "$artifact_dir/flake.lock" .
# The artifact may come from older main sources; preserve the released package logic.
python3 - "$artifact_dir/flake.nix" <<'PY'
import re, sys
from pathlib import Path
artifact = Path(sys.argv[1]).read_text()
path = Path('flake.nix')
promoted = path.read_text()
fields = [(name, rf'(\b{name}\s*=\s*")([^"]+)(")')
for name in ('releaseTag', 'releaseVersion')]
for block in ('gpguiHashes', 'nshHashes', 'binaryHashes'):
for arch in ('x86_64', 'aarch64'):
fields.append((f'{block}.{arch}', rf'(\b{block}\s*=\s*\{{[^}}]*?\b{arch}\s*=\s*")([^"]+)(")'))
for name, pattern in fields:
values = re.findall(pattern, artifact)
if len(values) != 1:
raise SystemExit(f'Expected exactly one {name} in the flake artifact')
value = values[0][1]
promoted, count = re.subn(pattern, lambda match: match[1] + value + match[3], promoted)
if count != 1:
raise SystemExit(f'Expected exactly one {name} in the release flake')
path.write_text(promoted)
PY
cp "$artifact_dir/flake.lock" .
python3 "$script_dir/validate-release-version.py" --version "${tag#v}"
# Check against Cargo too: overriding the expectation above is only for artifacts.
python3 "$script_dir/validate-release-version.py"
+5
View File
@@ -20,6 +20,11 @@ elif [ "$SELECTION" != "all" ]; then
SELECTION=tag
fi
# The follow-up distro-package workflow uses "all" for its own package artifacts.
if [[ "$SELECTION" != "all" ]]; then
"$SCRIPT_DIR/verify-linux-nsh-assets.sh" "$ARTIFACT_DIR" --actions
fi
case "$SELECTION" in
snapshot|all)
printf '%s\n' "$ARTIFACT_DIR"/artifact-*/*
+16 -3
View File
@@ -22,7 +22,7 @@ $info = Get-Content (Join-Path $destination 'build-info.json') -Raw | ConvertFro
if ($info.architecture -ne $Architecture -or [string]$info.build_version -ne $Build) { throw 'The installed package identity does not match.' }
if ($env:WINDOWS_SIGNING_PUBLISHER) {
$signed = @($Installer)
foreach ($name in @('gpgui.exe', 'gpauth.exe', 'gpservice.exe', 'gp-posture.exe', 'libopenconnect-5.dll', 'uninstall.exe')) {
foreach ($name in @('gpgui.exe', 'gpauth.exe', 'gpservice.exe', 'gp-posture.exe', 'libopenconnect-5.dll', 'uninstall.exe', 'cli\gpclient.exe', 'cli\libopenconnect-5.dll')) {
$signed += Join-Path $destination $name
}
& (Join-Path $PSScriptRoot 'test-windows-signature.ps1') -Files $signed -Publisher $env:WINDOWS_SIGNING_PUBLISHER
@@ -41,6 +41,18 @@ foreach ($name in @('gpgui.exe', 'gpauth.exe')) {
$process = Start-Process (Join-Path $destination $name) -ArgumentList '--version' -PassThru -Wait
if ($process.ExitCode -ne 0) { throw "The installed $name cannot start." }
}
$cli = Join-Path $destination 'cli\gpclient.exe'
Push-Location $env:TEMP
try {
$version = & $cli --version
if ($LASTEXITCODE -ne 0 -or $version -notmatch "^gpclient $([regex]::Escape($info.version))\s") {
throw 'The installed CLI failed its version check.'
}
$help = & $cli connect --help | Out-String
if ($LASTEXITCODE -ne 0 -or $help -notmatch '--cookie-only' -or $help -match '--background') {
throw 'The installed Windows CLI failed its connect help check.'
}
} finally { Pop-Location }
$helper = Join-Path $destination 'gp-posture.exe'
$output = Join-Path $env:TEMP 'gp-posture-install-test.json'
$process = Start-Process $helper -PassThru -Wait -RedirectStandardOutput $output
@@ -52,7 +64,8 @@ $state = Join-Path $env:LOCALAPPDATA 'GP Connect\config\protected-state'
New-Item -ItemType Directory -Force $state | Out-Null
$marker = Join-Path $state 'ci-install-retention'
[IO.File]::WriteAllText($marker, 'retain user settings')
$process = Start-Process (Join-Path $destination 'uninstall.exe') -ArgumentList '/S' -PassThru -Wait
# Start-Process otherwise uses the executable's directory, which the uninstaller must move.
$process = Start-Process (Join-Path $destination 'uninstall.exe') -WorkingDirectory (Split-Path $destination) -ArgumentList '/S' -PassThru -Wait
if ($process.ExitCode -ne 0) { throw 'The uninstaller failed.' }
if ((Get-Service GPConnect -ErrorAction SilentlyContinue) -or (Test-Path $destination) -or (Test-Path ($destination + '.previous'))) {
throw 'The uninstaller left service registration or runtime files.'
@@ -62,4 +75,4 @@ if ((Test-Path $shortcut) -or (Test-Path 'HKLM:\SOFTWARE\Microsoft\Windows\Curre
}
if ([IO.File]::ReadAllText($marker) -ne 'retain user settings') { throw 'The uninstaller changed user state.' }
Remove-Item $marker
Write-Host "Installed $Architecture runtime and service, launched both applications, and uninstalled successfully."
Write-Host "Installed $Architecture runtime and service, launched the desktop, authenticator and CLI, and uninstalled successfully."
+12 -2
View File
@@ -5,10 +5,11 @@ cd "$root"
temp=$(mktemp -d)
trap 'rm -rf "$temp"' EXIT HUP INT TERM
mkdir -p "$temp/release"
for binary in gpclient gpauth gpservice gpgui gpgui-helper gp-vpnc-script-installer gp-hip-script-installer; do
for binary in gpclient gpauth gpservice gpgui gpgui-nsh gpgui-helper gp-vpnc-script-installer gp-hip-script-installer; do
printf '#!/bin/sh\nexit 0\n' > "$temp/release/$binary"
chmod 755 "$temp/release/$binary"
done
echo 'ICU4X license fixture' > "$temp/release/ICU4X-LICENSE.txt"
mkdir -p "$temp/client-release"
cp "$temp/release/gpclient" "$temp/client-release/"
make install-gpclient-unix PREFIX='/custom/gp install' DESTDIR="$temp/client-stage" \
@@ -19,7 +20,7 @@ test -x "$installed/libexec/gpclient/vpnc-script"
test "$(find "$installed" -type f | wc -l | tr -d ' ')" = 2
for platform in linux bsd; do
stage="$temp/$platform-stage"
make "install-$platform" PREFIX=/custom/gp DESTDIR="$stage" \
make "install-$platform" PREFIX=/custom/gp DESTDIR="$stage" INCLUDE_GUI=1 NSH_BUNDLE_DIR="$temp/release" \
CARGO_RELEASE_DIR="$temp/release" GPGUI_BINARY="$temp/release/gpgui" > "$temp/$platform.log"
installed="$stage/custom/gp"
test -x "$installed/bin/gpclient"
@@ -35,8 +36,11 @@ for platform in linux bsd; do
! grep -F "$stage" "$installed/share/applications/gpgui.desktop"
if [ "$platform" = bsd ]; then
test ! -d "$installed/lib/NetworkManager"
test ! -e "$installed/bin/gpgui-nsh"
else
test -x "$installed/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down"
test -x "$installed/bin/gpgui-nsh"
cmp "$temp/release/ICU4X-LICENSE.txt" "$installed/share/licenses/globalprotect-openconnect/ICU4X-LICENSE.txt"
fi
runtime="$stage/var/lib/gpclient"
if [ "$platform" = bsd ]; then
@@ -60,6 +64,12 @@ for platform in linux bsd; do
test -f "$installed/libexec/gpclient/unrelated"
test -f "$runtime/scripts/unrelated"
done
if make install-linux INCLUDE_GUI=1 PREFIX=/usr DESTDIR="$temp/missing-nsh" \
GPGUI_BINARY="$temp/release/gpgui" NSH_BUNDLE_DIR="$temp/absent" \
CARGO_RELEASE_DIR="$temp/release" > "$temp/missing-nsh.log" 2>&1; then
echo 'FAIL: bundled package installation succeeded without Native Shell' >&2
exit 1
fi
mv "$temp/release/gpclient" "$temp/release/gpclient.saved"
if make install-linux PREFIX=/custom/gp DESTDIR="$temp/missing-client-stage" \
CARGO_RELEASE_DIR="$temp/release" > "$temp/missing-client.log" 2>&1; then
@@ -45,3 +45,4 @@ check_authorization() {
check_authorization "$package_path/bin/gpclient" launch-gui --minimized
check_authorization "$package_path/bin/gpclient" --lock-file "$test_workspace/client.lock" launch-gui
check_authorization "$package_path/bin/gpgui" --minimized
check_authorization "$package_path/bin/gpgui-nsh" --minimized
+52 -1
View File
@@ -1,3 +1,4 @@
import hashlib
import importlib.util
import json
import os
@@ -80,7 +81,7 @@ class ReleaseVersionTests(unittest.TestCase):
write_version(root, '3.2.0')
package = root / 'result'
(package / 'bin').mkdir(parents=True)
for name in ('gpclient', 'gpservice', 'gpauth', 'gpgui'):
for name in ('gpclient', 'gpservice', 'gpauth', 'gpgui', 'gpgui-nsh'):
tool = package / 'bin' / name
tool.write_text(f'#!/bin/sh\necho "{name} 3.2.0 (PRIVATE_IDENTITY)"\n')
tool.chmod(0o755)
@@ -90,6 +91,44 @@ class ReleaseVersionTests(unittest.TestCase):
versions.validate(root, package=package)
class LinuxNshAssetsTests(unittest.TestCase):
def test_releases_require_both_architectures_and_libcs_with_matching_checksums(self):
with tempfile.TemporaryDirectory() as temp:
root = Path(temp)
assets = []
for arch in ('x86_64', 'aarch64'):
for suffix in ('', '-musl'):
directory = root / f'artifact-gpgui-nsh{suffix}-{arch}'
directory.mkdir()
archive = directory / f'gpgui-nsh_{arch}{suffix}.bin.tar.xz'
archive.write_bytes(archive.name.encode())
sidecar = archive.with_name(archive.name + '.sha256')
sidecar.write_text(hashlib.sha256(archive.read_bytes()).hexdigest() + '\n')
assets.extend((archive, sidecar))
for channel in ('snapshot', 'v3.7.0'):
command = [ROOT / 'scripts/release-assets.sh', channel, root]
valid = subprocess.run(command, capture_output=True, text=True, check=True)
self.assertEqual(set(valid.stdout.splitlines()), {str(asset) for asset in assets})
for asset in assets:
data = asset.read_bytes()
asset.unlink()
self.assertNotEqual(subprocess.run(command, capture_output=True).returncode, 0, asset.name)
asset.write_bytes(data)
archive = assets[0]
data = archive.read_bytes()
archive.write_bytes(b'corrupt')
self.assertNotEqual(subprocess.run(command, capture_output=True).returncode, 0)
archive.write_bytes(data)
for asset in assets:
asset.rename(root / asset.name)
verify_published = [ROOT / 'scripts/verify-linux-nsh-assets.sh', root]
subprocess.run(verify_published, capture_output=True, check=True)
(root / assets[-1].name).unlink()
self.assertNotEqual(subprocess.run(verify_published, capture_output=True).returncode, 0)
class BuildIdentityTests(unittest.TestCase):
def test_retry_uses_original_sources_after_both_branches_advance(self):
with tempfile.TemporaryDirectory() as temp:
@@ -144,9 +183,16 @@ class PromotionTests(unittest.TestCase):
repo, origin, artifact = root / 'repo', root / 'origin.git', root / 'artifact'
initialize(repo)
write_version(repo)
hashes = 'gpguiHashes = { x86_64 = "old-gui-x64"; aarch64 = "old-gui-arm64"; };\n' \
'nshHashes = { x86_64 = "old-nsh-x64"; aarch64 = "old-nsh-arm64"; };\n' \
'binaryHashes = { x86_64 = "old-cli-x64"; aarch64 = "old-cli-arm64"; };\n'
with (repo / 'flake.nix').open('a') as flake:
flake.write('packageSetting = "original";\n' + hashes)
old = commit(repo, '3.1')
git(repo, 'switch', '-c', 'release/next')
write_version(repo, '3.2.0', '3.1.0')
with (repo / 'flake.nix').open('a') as flake:
flake.write('packageSetting = "released";\n' + hashes)
(repo / 'feature').write_text('released product feature')
release = commit(repo, '3.2 source')
git(repo, 'tag', 'v3.2.0')
@@ -158,6 +204,8 @@ class PromotionTests(unittest.TestCase):
git(repo, 'push', 'origin', 'main', 'v3.2.0')
artifact.mkdir()
write_version(artifact, '3.2.0')
with (artifact / 'flake.nix').open('a') as flake:
flake.write('packageSetting = "original";\n' + hashes.replace('old-', 'new-'))
(artifact / 'release-candidate.json').write_text(json.dumps({'version': '3.2.0', 'releaseTag': 'v3.2.0'}))
result = subprocess.run(['bash', str(ROOT / 'scripts/prepare-release-promotion.sh'),
'v3.2.0', str(artifact)], cwd=repo, capture_output=True, text=True)
@@ -168,6 +216,9 @@ class PromotionTests(unittest.TestCase):
self.assertEqual(git(repo, 'show', f'{old}:Cargo.toml'), '[workspace.package]\nversion = "3.1.0"')
self.assertTrue((repo / 'infrastructure').exists())
self.assertTrue((repo / 'feature').exists())
promoted = (repo / 'flake.nix').read_text()
self.assertIn('packageSetting = "released";', promoted)
self.assertIn(hashes.replace('old-', 'new-'), promoted)
self.assertEqual(git(repo, 'rev-list', '--parents', '-1', 'HEAD^').split()[1:], [main, release])
self.assertEqual(git(repo, 'diff', '--name-only', 'HEAD^', 'HEAD'), 'flake.nix')
self.assertEqual(git(repo, 'status', '--porcelain'), '')
+26 -8
View File
@@ -39,14 +39,6 @@ class RepositoryTests(unittest.TestCase):
with self.assertRaises(publication.Pending):
publication.rpm_packages("https://repo")
def test_copr_same_version_from_another_build_does_not_pass(self):
primary = ET.fromstring('''<metadata xmlns="http://linux.duke.edu/metadata/common"><package>
<name>globalprotect-openconnect</name><arch>x86_64</arch><version ver="3.0.1" rel="1.fc44"/>
<location href="011106217-globalprotect-openconnect/package.rpm"/></package></metadata>''')
with patch.object(publication, "rpm_packages", return_value=primary):
params = ("https://repo", "globalprotect-openconnect", "3.0.1", "x86_64", lambda release: True)
self.assertTrue(publication.rpm_present(*params, build_id=11106217))
self.assertFalse(publication.rpm_present(*params, build_id=11106218))
class LaunchpadTests(unittest.TestCase):
@@ -138,6 +130,32 @@ class OBSTests(unittest.TestCase):
class CoprTests(unittest.TestCase):
def test_public_repository_must_match_the_selected_builds_signed_rpm(self):
checker = publication.Copr(arguments(build_id=42))
build = {"ownername": "yuezk", "projectname": "globalprotect-openconnect",
"state": "succeeded", "source_package": {"name": "globalprotect-openconnect", "version": "3.0.1-1"},
"chroots": ["fedora-44-x86_64"], "repo_url": "https://repo"}
status = {"state": "succeeded", "result_url": "https://results/42/"}
digest = "a" * 64
artifacts = {"count": 1, "results": [{"release": "1.fc44", "sha256": digest}]}
for release, published_digest, matches in [
("1.fc44", digest, True),
("1.fc44", "b" * 64, False),
("1.fc45", digest, False)]:
with self.subTest(release=release, published_digest=published_digest):
primary = ET.fromstring(f'''<metadata xmlns="http://linux.duke.edu/metadata/common"><package>
<name>globalprotect-openconnect</name><arch>x86_64</arch><version ver="3.0.1" rel="{release}"/>
<checksum type="sha256">{published_digest}</checksum>
<location href="Packages/g/globalprotect-openconnect-3.0.1-1.fc44.x86_64.rpm"/></package></metadata>''')
with patch.object(publication, "api", side_effect=[build, status, artifacts]) as api, \
patch.object(publication, "rpm_packages", return_value=primary):
if matches:
self.assertIn("1 targets built and published", checker.check())
else:
with self.assertRaisesRegex(publication.Pending, "Waiting for Copr build 42"):
checker.check()
self.assertEqual(api.call_args.kwargs["pulp_label_select"], "build_id=42,chroot=fedora-44-x86_64")
def test_unselected_chroot_cannot_be_hidden_by_verification(self):
checker = publication.Copr(arguments(build_id=42, chroots=["fedora-44-x86_64"]))
build = {"ownername": "yuezk", "projectname": "globalprotect-openconnect",
+1 -1
View File
@@ -66,7 +66,7 @@ class WindowsFeedTests(unittest.TestCase):
self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}os"), f"windows-{payload.architecture}")
self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}installerArguments"), "/UPDATE")
self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}version"), "3.4.0")
minimum = "10.0.22000" if payload.architecture == "arm64" else "10.0.19041"
minimum = "10.0.22000" if payload.architecture == "arm64" else "10.0.17763"
self.assertEqual(item.findtext(f"{{{feed.SPARKLE}}}minimumSystemVersion"), minimum)
self.assertEqual(json.loads((args.output / "latest.json").read_text())["stable"]["platforms"], ["windows"])
+8
View File
@@ -81,11 +81,15 @@ release_url() {
gpgui_x86_64_hash="$(prefetch_hash "$(release_url "gpgui_x86_64.bin.tar.xz")")"
gpgui_aarch64_hash="$(prefetch_hash "$(release_url "gpgui_aarch64.bin.tar.xz")")"
nsh_x86_64_hash="$(prefetch_hash "$(release_url "gpgui-nsh_x86_64.bin.tar.xz")")"
nsh_aarch64_hash="$(prefetch_hash "$(release_url "gpgui-nsh_aarch64.bin.tar.xz")")"
binary_x86_64_hash="$(prefetch_hash "$(release_url "globalprotect-openconnect_${version}_x86_64.bin.tar.xz")")"
binary_aarch64_hash="$(prefetch_hash "$(release_url "globalprotect-openconnect_${version}_aarch64.bin.tar.xz")")"
GPGUI_X86_64_HASH="$gpgui_x86_64_hash" \
GPGUI_AARCH64_HASH="$gpgui_aarch64_hash" \
NSH_X86_64_HASH="$nsh_x86_64_hash" \
NSH_AARCH64_HASH="$nsh_aarch64_hash" \
BINARY_X86_64_HASH="$binary_x86_64_hash" \
BINARY_AARCH64_HASH="$binary_aarch64_hash" \
RELEASE_TAG="$release_tag" \
@@ -95,12 +99,16 @@ perl -0pi -e '
s|(releaseVersion = ")[^"]+(";)|$1 . $ENV{"RELEASE_VERSION"} . $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|(nshHashes = \{\n\s*x86_64 = ")[^"]+(";)|$1 . $ENV{"NSH_X86_64_HASH"} . $2|e;
s|(nshHashes = \{\n\s*x86_64 = "[^"]+";\n\s*aarch64 = ")[^"]+(";)|$1 . $ENV{"NSH_AARCH64_HASH"} . $2|e;
s|(binaryHashes = \{\n\s*x86_64 = ")[^"]+(";)|$1 . $ENV{"BINARY_X86_64_HASH"} . $2|e;
s|(binaryHashes = \{\n\s*x86_64 = "[^"]+";\n\s*aarch64 = ")[^"]+(";)|$1 . $ENV{"BINARY_AARCH64_HASH"} . $2|e;
' "$FLAKE_FILE"
grep -F "$gpgui_x86_64_hash" "$FLAKE_FILE" > /dev/null
grep -F "$gpgui_aarch64_hash" "$FLAKE_FILE" > /dev/null
grep -F "$nsh_x86_64_hash" "$FLAKE_FILE" > /dev/null
grep -F "$nsh_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
+1 -1
View File
@@ -40,7 +40,7 @@ def validate(root, version=None, release_tag=None, package=None, base_ref=None):
if tuple(map(int, expected.split("."))) < tuple(map(int, base.split("."))):
raise ValueError("candidate release is older than the main base")
if package:
for name in ("gpclient", "gpservice", "gpauth", "gpgui"):
for name in ("gpclient", "gpservice", "gpauth", "gpgui", "gpgui-nsh"):
result = subprocess.run([str(package / "bin" / name), "--version"],
capture_output=True, text=True, check=True)
# Keep private source identity and other command output out of logs.
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
root="${1:?Expected a release download directory or Actions artifact directory}"
for arch in x86_64 aarch64; do
for suffix in '' '-musl'; do
directory="$root"
if [[ ${2:-} == --actions ]]; then
directory="$root/artifact-gpgui-nsh${suffix}-$arch"
fi
archive="$directory/gpgui-nsh_${arch}${suffix}.bin.tar.xz"
digest=$(cat "$archive.sha256")
if [[ ! $digest =~ ^[[:xdigit:]]{64}$ ]]; then
echo "Invalid SHA-256 sidecar: $archive.sha256" >&2
exit 1
fi
printf '%s %s\n' "$digest" "$archive" | sha256sum -c - >&2
done
done
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Run inside the distro builder after install.sh installs the newly built package.
set -euo pipefail
package=globalprotect-openconnect
notice=/usr/share/licenses/$package/ICU4X-LICENSE.txt
for path in /usr/bin/gpgui /usr/bin/gpgui-nsh; do
test -x "$path"
done
test -s "$notice"
case "${1:?Expected a package format}" in
binary) exit 0 ;;
deb|ubuntu-rolling)
files=$(dpkg-query -L "$package")
requires=$(dpkg-query -W -f='${Pre-Depends} ${Depends}\n' "$package")
;;
rpm)
files=$(rpm -ql "$package")
requires=$(rpm -q --requires "$package")
;;
apk)
files=$(apk info -L "$package")
requires=$(apk info -R "$package")
;;
pkg)
files=$(pacman -Qlq "$package")
requires=$(bsdtar -xOf /workspace/artifacts/*.pkg.tar.zst .PKGINFO | sed -n 's/^depend = //p')
;;
*) echo "Unknown package format: $1" >&2; exit 1 ;;
esac
# apk emits paths relative to /. Other package managers use absolute paths.
for path in /usr/bin/gpgui /usr/bin/gpgui-nsh "$notice"; do
if ! grep -Fxq -e "$path" -e "${path#/}" <<<"$files"; then
echo "$package does not own $path" >&2
exit 1
fi
done
if grep -Eq '(^|[[:space:],:(|])(lib)?gtk-?4([^[:alnum:]_]|$)' <<<"$requires"; then
echo "Package metadata makes GTK4 mandatory: $requires" >&2
exit 1
fi
+21 -6
View File
@@ -84,17 +84,18 @@ def rpm_packages(base_url):
return ET.fromstring(unpack(content, location))
def rpm_present(base_url, package, version, arch, release_matches, build_id=None):
def rpm_present(base_url, package, version, arch, release_matches, *, sha256=None):
namespace = {"rpm": "http://linux.duke.edu/metadata/common"}
for entry in rpm_packages(base_url).findall("rpm:package", namespace):
info = entry.find("rpm:version", namespace)
location = entry.find("rpm:location", namespace).get("href")
if (entry.findtext("rpm:name", namespaces=namespace) != package or
entry.findtext("rpm:arch", namespaces=namespace) != arch or
info.get("ver") != version or not release_matches(info.get("rel", ""))):
continue
if build_id is not None and not re.search(rf"(?:^|/)0*{build_id}-", location):
continue
if sha256 is not None:
digest = entry.find("rpm:checksum[@type='sha256']", namespace)
if digest is None or digest.text != sha256:
continue
return True
return False
@@ -254,9 +255,23 @@ class Copr:
raise Pending(f"Copr {chroot}: {status['state']}; {link}")
base = build["repo_url"].rstrip("/") + "/" + chroot
arch = chroot.rsplit("-", 1)[1]
# Pulp labels the signed RPM with the producing build and chroot.
artifacts = api("https://packages.redhat.com/api/pulp/public-copr/api/v3/content/rpm/packages/",
pulp_label_select=f"build_id={args.build_id},chroot={chroot}",
name=args.package, version=args.version, arch=arch, fields="release,sha256")
if not artifacts["count"]:
raise Pending(f"Waiting for the signed RPM from Copr build {args.build_id} for {chroot}")
if artifacts["count"] != 1:
raise Failed(f"Ambiguous RPMs from Copr build {args.build_id} for {chroot}")
artifact = artifacts["results"][0]
release = artifact["release"]
if release != args.revision and not release.startswith(args.revision + "."):
raise Failed(f"Copr build {args.build_id} has an unexpected RPM revision for {chroot}")
digest = artifact["sha256"]
if not digest or not re.fullmatch(r"[0-9a-f]{64}", digest):
raise Failed(f"Missing signed RPM checksum for Copr build {args.build_id} for {chroot}")
if not rpm_present(base, args.package, args.version, arch,
lambda release: release == args.revision or release.startswith(args.revision + "."),
build_id=args.build_id):
lambda value: value == release, sha256=digest):
raise Pending(f"Waiting for Copr build {args.build_id} in {base}")
return f"Copr build {args.build_id}: {len(build['chroots'])} targets built and published; {link}"
+1 -1
View File
@@ -96,7 +96,7 @@ def generate(args: argparse.Namespace) -> None:
item = ET.SubElement(channel, "item")
ET.SubElement(item, "title").text = f"GP Connect {display_version}"
ET.SubElement(item, "description").text = "\n".join(release["highlights"])
minimum = "10.0.22000" if payload.architecture == "arm64" else "10.0.19041"
minimum = "10.0.22000" if payload.architecture == "arm64" else "10.0.17763"
ET.SubElement(item, f"{{{SPARKLE}}}minimumSystemVersion").text = minimum
ET.SubElement(item, "enclosure", {
"url": payload.installer_url, "length": str(length), "type": "application/octet-stream",