mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
Compare commits
48
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb3cebf8a9 | ||
|
|
92c19c55a3 | ||
|
|
dc1376dbac | ||
|
|
15d85d1878 | ||
|
|
6edc93b579 | ||
|
|
1c34c52707 | ||
|
|
287d0cc6af | ||
|
|
5f4b2b602a | ||
|
|
43c20d0976 | ||
|
|
6ffb1e8709 | ||
|
|
1bdaf4e8be | ||
|
|
127961cab7 | ||
|
|
754b220a9d | ||
|
|
1072a35817 | ||
|
|
a43785792a | ||
|
|
76310f1494 | ||
|
|
029f292a6d | ||
|
|
dedd06366e | ||
|
|
5031d4dcfb | ||
|
|
1ac01081e0 | ||
|
|
594ab0ea32 | ||
|
|
e2e762dd35 | ||
|
|
9432f0c3e5 | ||
|
|
fdbe3bcbba | ||
|
|
2c9d227f02 | ||
|
|
f3cd4ca6fb | ||
|
|
79570610db | ||
|
|
a5e8c7abe5 | ||
|
|
e122ad8380 | ||
|
|
28643d2de6 | ||
|
|
f5b1b279c7 | ||
|
|
9528818793 | ||
|
|
53a778a1a4 | ||
|
|
d1815a02a1 | ||
|
|
1547d0c1e9 | ||
|
|
6e99d8d81f | ||
|
|
408536807c | ||
|
|
e03a758acb | ||
|
|
16e08c09af | ||
|
|
a949b175d4 | ||
|
|
1202ca6c81 | ||
|
|
0408bcb67f | ||
|
|
a9474d4059 | ||
|
|
5380a5f3c3 | ||
|
|
82c9ba2dcd | ||
|
|
fd08cdbe66 | ||
|
|
d12d677208 | ||
|
|
d15ebdfe3a |
No files matched your search
@@ -0,0 +1,2 @@
|
||||
# Keep source and build scripts consistent on every platform.
|
||||
* text=auto eol=lf
|
||||
@@ -12,6 +12,9 @@ on:
|
||||
channel:
|
||||
required: true
|
||||
type: string
|
||||
build:
|
||||
required: true
|
||||
type: string
|
||||
builder:
|
||||
required: true
|
||||
type: string
|
||||
@@ -85,7 +88,7 @@ jobs:
|
||||
- name: Build gpgui in Docker
|
||||
env:
|
||||
GPGUI_BUILDER: ${{ inputs.builder }}
|
||||
GPGUI_BUILD_VERSION: ${{ github.run_number }}.${{ github.run_attempt }}
|
||||
GPGUI_BUILD_VERSION: ${{ inputs.build }}
|
||||
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
|
||||
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
||||
run: |
|
||||
|
||||
@@ -12,6 +12,9 @@ on:
|
||||
channel:
|
||||
required: true
|
||||
type: string
|
||||
build:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
GH_PAT:
|
||||
required: true
|
||||
@@ -35,7 +38,7 @@ jobs:
|
||||
env:
|
||||
CARGO_INCREMENTAL: '0'
|
||||
CARGO_BUILD_JOBS: '2'
|
||||
GPGUI_BUILD_VERSION: ${{ github.run_number }}.${{ github.run_attempt }}
|
||||
GPGUI_BUILD_VERSION: ${{ inputs.build }}
|
||||
GPGUI_GIT_COMMIT: ${{ inputs.gpgui_ref }}
|
||||
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
|
||||
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
name: Build Windows package
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
gp_ref:
|
||||
type: string
|
||||
required: true
|
||||
gpgui_ref:
|
||||
type: string
|
||||
required: true
|
||||
channel:
|
||||
type: choice
|
||||
options: [snapshot, stable]
|
||||
default: snapshot
|
||||
build:
|
||||
type: string
|
||||
required: true
|
||||
architecture:
|
||||
type: choice
|
||||
options: [x64, arm64]
|
||||
required: true
|
||||
workflow_call:
|
||||
inputs:
|
||||
gp_ref:
|
||||
type: string
|
||||
required: true
|
||||
gpgui_ref:
|
||||
type: string
|
||||
required: true
|
||||
channel:
|
||||
type: string
|
||||
required: true
|
||||
build:
|
||||
type: string
|
||||
required: true
|
||||
architecture:
|
||||
type: string
|
||||
required: true
|
||||
secrets:
|
||||
GH_PAT:
|
||||
required: true
|
||||
WINDOWS_UPDATE_PRIVATE_KEY:
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ inputs.architecture == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
|
||||
environment: windows-signing
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
timeout-minutes: 120
|
||||
env:
|
||||
BUILD_ARCHITECTURE: ${{ inputs.architecture }}
|
||||
CARGO_INCREMENTAL: '0'
|
||||
CARGO_TARGET_DIR: ${{ github.workspace }}/target-windows
|
||||
CARGO_BUILD_JOBS: '2'
|
||||
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
|
||||
GPGUI_BUILD_VERSION: ${{ inputs.channel == 'snapshot' && inputs.build || '' }}
|
||||
GPGUI_WINDOWS_UPDATE_PUBLIC_KEY: ${{ vars.WINDOWS_UPDATE_PUBLIC_KEY }}
|
||||
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
||||
AZURE_SIGNING_ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT }}
|
||||
AZURE_SIGNING_ACCOUNT: ${{ vars.AZURE_SIGNING_ACCOUNT }}
|
||||
AZURE_SIGNING_PROFILE: ${{ vars.AZURE_SIGNING_PROFILE }}
|
||||
WINDOWS_SIGNING_PUBLISHER: ${{ vars.WINDOWS_SIGNING_PUBLISHER }}
|
||||
steps:
|
||||
- name: Select native build tools
|
||||
id: native
|
||||
shell: pwsh
|
||||
run: |
|
||||
if ($env:BUILD_ARCHITECTURE -eq 'arm64') {
|
||||
'msystem=CLANGARM64' >> $env:GITHUB_OUTPUT
|
||||
'subsystem=clangarm64' >> $env:GITHUB_OUTPUT
|
||||
'packages=mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-pkgconf mingw-w64-clang-aarch64-gnutls mingw-w64-clang-aarch64-libxml2 mingw-w64-clang-aarch64-lz4' >> $env:GITHUB_OUTPUT
|
||||
} elseif ($env:BUILD_ARCHITECTURE -eq 'x64') {
|
||||
'msystem=UCRT64' >> $env:GITHUB_OUTPUT
|
||||
'subsystem=ucrt64' >> $env:GITHUB_OUTPUT
|
||||
'packages=mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-pkgconf mingw-w64-ucrt-x86_64-gnutls mingw-w64-ucrt-x86_64-libxml2 mingw-w64-ucrt-x86_64-lz4' >> $env:GITHUB_OUTPUT
|
||||
} else { throw 'Unsupported Windows architecture.' }
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
path: .ci
|
||||
persist-credentials: false
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.gp_ref }}
|
||||
path: source/gp
|
||||
submodules: recursive
|
||||
persist-credentials: false
|
||||
- uses: ./.ci/.github/actions/checkout-private
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
ref: ${{ inputs.gpgui_ref }}
|
||||
path: source/gpgui
|
||||
- uses: dtolnay/[email protected]
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.13'
|
||||
- uses: msys2/setup-msys2@v2
|
||||
id: msys2
|
||||
with:
|
||||
msystem: ${{ steps.native.outputs.msystem }}
|
||||
update: true
|
||||
install: >-
|
||||
base-devel autoconf automake libtool gettext git
|
||||
${{ steps.native.outputs.packages }}
|
||||
- name: Prepare pinned installer and driver inputs
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if (!$env:GPGUI_WINDOWS_UPDATE_PUBLIC_KEY -or !$env:GPGUI_LICENSE_SIGNING_KEYS) { throw 'Configure the Windows update and licensing public keys.' }
|
||||
$tools = Join-Path $env:RUNNER_TEMP 'windows-tools'
|
||||
New-Item -ItemType Directory -Force $tools | Out-Null
|
||||
choco install nsis --version=3.12.0 --yes --no-progress
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Installing NSIS 3.12 failed.' }
|
||||
$wintun = Join-Path $tools 'wintun.zip'
|
||||
Invoke-WebRequest 'https://www.wintun.net/builds/wintun-0.14.1.zip' -OutFile $wintun
|
||||
if ((Get-FileHash $wintun).Hash -ne '07C256185D6EE3652E09FA55C0B673E2624B565E02C4B9091C79CA7D2F24EF51') { throw 'Wintun checksum mismatch.' }
|
||||
Expand-Archive $wintun $tools
|
||||
Remove-Item $wintun
|
||||
"WINDOWS_BUILD_TOOLS=$tools" >> $env:GITHUB_ENV
|
||||
- name: Build OpenConnect and test native packet transport
|
||||
shell: pwsh
|
||||
env:
|
||||
MSYS_ROOT: ${{ steps.msys2.outputs.msys2-location }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$prefix = Join-Path $env:RUNNER_TEMP 'native-windows'
|
||||
& ./source/gp/scripts/build-openconnect-windows.ps1 -MsysRoot $env:MSYS_ROOT -MsysSubsystem ${{ steps.native.outputs.subsystem }} -Prefix $prefix
|
||||
& ./source/gp/scripts/test-openconnect-windows.ps1 -MsysRoot $env:MSYS_ROOT -MsysSubsystem ${{ steps.native.outputs.subsystem }} -Prefix $prefix
|
||||
"OPENCONNECT_WINDOWS_PREFIX=$prefix" >> $env:GITHUB_ENV
|
||||
- name: Build the matching Windows runtime
|
||||
shell: pwsh
|
||||
env:
|
||||
MSYS_ROOT: ${{ steps.msys2.outputs.msys2-location }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$log = Join-Path $env:RUNNER_TEMP 'windows-package.log'
|
||||
# Compiler diagnostics may contain private GUI source. Keep them on the runner.
|
||||
try {
|
||||
& ./source/gpgui/scripts/build-windows.ps1 -Profile Release -BuildOnly `
|
||||
-NativePrefix $env:OPENCONNECT_WINDOWS_PREFIX -MsysRoot $env:MSYS_ROOT -MsysSubsystem ${{ steps.native.outputs.subsystem }} `
|
||||
-WintunDirectory (Join-Path $env:WINDOWS_BUILD_TOOLS 'wintun') `
|
||||
-MakeNsis (Join-Path ${env:ProgramFiles(x86)} 'NSIS/makensis.exe') `
|
||||
-OutputDirectory "$env:GITHUB_WORKSPACE/artifacts" *> $log
|
||||
} catch {
|
||||
python ./.ci/scripts/private-ci-diagnostics.py compile $log
|
||||
throw 'Windows compilation failed; private diagnostics remain on the runner.'
|
||||
}
|
||||
Write-Host 'Windows compilation passed.'
|
||||
- name: Install Microsoft Artifact Signing tooling
|
||||
shell: pwsh
|
||||
run: Install-Module ArtifactSigning -RequiredVersion 0.1.20 -Repository PSGallery -Force -Scope CurrentUser
|
||||
- name: Log in to Azure with GitHub OIDC
|
||||
uses: azure/login@v3
|
||||
with:
|
||||
client-id: ${{ vars.AZURE_SIGNING_CLIENT_ID }}
|
||||
tenant-id: ${{ vars.AZURE_TENANT_ID }}
|
||||
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
|
||||
- name: Sign and package the Windows runtime
|
||||
shell: pwsh
|
||||
env:
|
||||
MSYS_ROOT: ${{ steps.msys2.outputs.msys2-location }}
|
||||
run: |
|
||||
& ./source/gpgui/scripts/build-windows.ps1 -Profile Release -SkipBuild -Sign `
|
||||
-NativePrefix $env:OPENCONNECT_WINDOWS_PREFIX -MsysRoot $env:MSYS_ROOT -MsysSubsystem ${{ steps.native.outputs.subsystem }} `
|
||||
-WintunDirectory (Join-Path $env:WINDOWS_BUILD_TOOLS 'wintun') `
|
||||
-MakeNsis (Join-Path ${env:ProgramFiles(x86)} 'NSIS/makensis.exe') `
|
||||
-OutputDirectory "$env:GITHUB_WORKSPACE/artifacts"
|
||||
- name: Sign and verify update payload
|
||||
id: sign
|
||||
shell: pwsh
|
||||
env:
|
||||
UPDATE_PRIVATE_KEY: ${{ secrets.WINDOWS_UPDATE_PRIVATE_KEY }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$key = Join-Path $env:RUNNER_TEMP 'windows-update.key'
|
||||
try {
|
||||
[IO.File]::WriteAllText($key, $env:UPDATE_PRIVATE_KEY.Trim())
|
||||
. ./source/gpgui/scripts/windows-updates/Get-WinSparkle.ps1
|
||||
$tools = Get-WinSparkleTools "$env:GITHUB_WORKSPACE/artifacts/tools" -Architecture $env:BUILD_ARCHITECTURE
|
||||
$installer = @(Get-ChildItem artifacts -Filter '*-setup.exe')
|
||||
if ($installer.Count -ne 1) { throw 'Expected exactly one Windows installer.' }
|
||||
$signature = (& $tools.Tool sign -f $key $installer[0].FullName | Out-String).Trim()
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Windows update signing failed.' }
|
||||
& $tools.Tool verify -p $env:GPGUI_WINDOWS_UPDATE_PUBLIC_KEY -s $signature $installer[0].FullName
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Windows update signature verification failed.' }
|
||||
$signature | Set-Content ($installer[0].FullName + '.sig') -Encoding ascii
|
||||
} finally {
|
||||
Remove-Item $key -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item artifacts/tools -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
- name: Test native installer and uninstaller
|
||||
shell: pwsh
|
||||
run: |
|
||||
$installer = @(Get-ChildItem artifacts -Filter '*-setup.exe')
|
||||
if ($installer.Count -ne 1) { throw 'Expected exactly one Windows installer.' }
|
||||
& ./source/gp/scripts/test-windows-installer.ps1 -Installer $installer[0].FullName -Architecture $env:BUILD_ARCHITECTURE -Build $env:GPGUI_BUILD_VERSION
|
||||
- uses: actions/upload-artifact@v7
|
||||
if: ${{ !cancelled() && steps.sign.outcome == 'success' }}
|
||||
with:
|
||||
name: artifact-gpgui-windows-${{ inputs.architecture }}
|
||||
path: |
|
||||
artifacts/*.exe
|
||||
artifacts/*.exe.sig
|
||||
artifacts/*.exe.sha256
|
||||
overwrite: true
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
+101
-11
@@ -42,6 +42,11 @@ on:
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
build_windows:
|
||||
description: 'Build Windows x64 and ARM64 NSH installers'
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
push:
|
||||
paths-ignore:
|
||||
- LICENSE
|
||||
@@ -64,8 +69,10 @@ jobs:
|
||||
actions: read
|
||||
contents: read
|
||||
outputs:
|
||||
gp_sha: ${{ steps.sources.outputs.gp_sha }}
|
||||
gpgui_sha: ${{ steps.sources.outputs.gpgui_sha }}
|
||||
gp_sha: ${{ steps.identity.outputs.gp_sha }}
|
||||
gpgui_sha: ${{ steps.identity.outputs.gpgui_sha }}
|
||||
version: ${{ steps.identity.outputs.version }}
|
||||
build_version: ${{ steps.identity.outputs.build_version }}
|
||||
steps:
|
||||
- name: Validate stable refs
|
||||
env:
|
||||
@@ -114,11 +121,12 @@ jobs:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }}
|
||||
path: selected/gpgui
|
||||
- name: Record selected sources
|
||||
id: sources
|
||||
- name: Record selected sources and versions
|
||||
id: identity
|
||||
run: |
|
||||
python3 scripts/record-build-sources.py selected-sources/sources.json \
|
||||
--gp selected/gp --gpgui selected/gpgui
|
||||
--gp selected/gp --gpgui selected/gpgui \
|
||||
--build-version "${{ github.run_number }}.${{ github.run_attempt }}"
|
||||
- name: Retain selected sources for retries
|
||||
if: steps.restored.outputs.cached != 'true'
|
||||
uses: actions/upload-artifact@v7
|
||||
@@ -155,7 +163,7 @@ jobs:
|
||||
# Tauri generates schemas in the source tree. Keep the host checkout read-only.
|
||||
cp -R /workspace /tmp/gp-test-workspace
|
||||
cd /tmp/gp-test-workspace
|
||||
cargo test --workspace --locked
|
||||
cargo test --workspace --locked --features gpapi/openssl-tests
|
||||
|
||||
# Exercise only the paths that require an actual root process.
|
||||
sudo -E env PATH="$PATH" PKEXEC_UID="$(id -u)" cargo test --locked -p gpapi \
|
||||
@@ -437,6 +445,7 @@ jobs:
|
||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||
builder: gpgui-builder-tauri2
|
||||
verify_desktop_assets: true
|
||||
secrets:
|
||||
@@ -450,6 +459,7 @@ jobs:
|
||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||
builder: gpgui-alpine-builder-tauri2
|
||||
artifact_suffix: -musl
|
||||
secrets:
|
||||
@@ -462,9 +472,31 @@ jobs:
|
||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||
secrets:
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
|
||||
build-windows:
|
||||
needs: validate-inputs
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_windows) || (startsWith(github.ref, 'refs/tags/') && vars.BUILD_WINDOWS_ON_TAG == 'true') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
architecture: [x64, arm64]
|
||||
uses: ./.github/workflows/build-windows.yaml
|
||||
with:
|
||||
architecture: ${{ matrix.architecture }}
|
||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||
secrets:
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
WINDOWS_UPDATE_PRIVATE_KEY: ${{ secrets.WINDOWS_UPDATE_PRIVATE_KEY }}
|
||||
|
||||
nix-source:
|
||||
needs: [validate-inputs, build-gpgui-glibc]
|
||||
strategy:
|
||||
@@ -659,7 +691,7 @@ jobs:
|
||||
FEED_URL: ${{ vars.SPARKLE_FEED_URL }}
|
||||
CHANNEL: ${{ (github.event_name == 'workflow_dispatch' && inputs.channel || 'stable') }}
|
||||
RELEASE_TAG: ${{ (github.event_name == 'workflow_dispatch' && (inputs.channel == 'stable' && inputs.gp_branch || 'snapshot') || github.ref_name) }}
|
||||
BUILD_VERSION: ${{ format('{0}.{1}', github.run_number, github.run_attempt) }}
|
||||
BUILD_VERSION: ${{ needs.validate-inputs.outputs.build_version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@@ -827,7 +859,7 @@ jobs:
|
||||
CHANNEL: ${{ (github.event_name == 'workflow_dispatch' && inputs.channel || 'stable') }}
|
||||
RELEASE_TAG: ${{ (github.event_name == 'workflow_dispatch' && (inputs.channel == 'stable' && inputs.gp_branch || 'snapshot') || github.ref_name) }}
|
||||
REQUEST_ID: ${{ format('{0}.{1}.macos', github.run_id, github.run_attempt) }}
|
||||
BUILD_VERSION: ${{ format('{0}.{1}', github.run_number, github.run_attempt) }}
|
||||
BUILD_VERSION: ${{ needs.validate-inputs.outputs.build_version }}
|
||||
WORKFLOW_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -1026,7 +1058,6 @@ jobs:
|
||||
nettle \
|
||||
gmp \
|
||||
gnome-keyring \
|
||||
libayatana-appindicator \
|
||||
polkit \
|
||||
webkit2-gtk_41
|
||||
pkgconf --exists libxml-2.0 liblz4 gnutls p11-kit-1 hogweed nettle gmp
|
||||
@@ -1035,7 +1066,7 @@ jobs:
|
||||
exec 3>&1
|
||||
(
|
||||
set -eu
|
||||
export GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }}
|
||||
export GPGUI_BUILD_VERSION=${{ needs.validate-inputs.outputs.build_version }}
|
||||
export GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
||||
|
||||
@@ -1119,7 +1150,7 @@ jobs:
|
||||
set -eu
|
||||
export AUTOCONF_VERSION=2.72
|
||||
export AUTOMAKE_VERSION=1.17
|
||||
export GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }}
|
||||
export GPGUI_BUILD_VERSION=${{ needs.validate-inputs.outputs.build_version }}
|
||||
export GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
||||
|
||||
@@ -1191,6 +1222,7 @@ jobs:
|
||||
- build-gpgui-glibc
|
||||
- build-gpgui-musl
|
||||
- build-gpgui-nsh
|
||||
- build-windows
|
||||
- setup-bsd-matrix
|
||||
- build-gpgui-frontend
|
||||
- build-bsd
|
||||
@@ -1201,6 +1233,7 @@ jobs:
|
||||
NEEDS_JSON: ${{ toJson(needs) }}
|
||||
BSD_MATRIX_ENABLED: ${{ needs.setup-bsd-matrix.outputs.enabled }}
|
||||
IS_STABLE: ${{ (startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && inputs.channel == 'stable')) }}
|
||||
BUILD_WINDOWS: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_windows) || (startsWith(github.ref, 'refs/tags/') && vars.BUILD_WINDOWS_ON_TAG == 'true') }}
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
@@ -1220,6 +1253,8 @@ jobs:
|
||||
continue
|
||||
elif name in {"build-gpgui-frontend", "build-bsd"} and result == "skipped" and not bsd_matrix_enabled:
|
||||
continue
|
||||
elif name == "build-windows" and result == "skipped" and os.environ["BUILD_WINDOWS"] != "true":
|
||||
continue
|
||||
elif result == "skipped":
|
||||
failed.append(f"{name}: {result}")
|
||||
|
||||
@@ -1286,6 +1321,61 @@ jobs:
|
||||
run: |
|
||||
cd gh-release/gp/scripts && ./gh-release.sh "$RELEASE_TAG"
|
||||
|
||||
publish-macos-assets:
|
||||
needs: [build-macos, gh-release]
|
||||
if: >-
|
||||
${{ !cancelled() &&
|
||||
needs.build-macos.result == 'success' && needs.gh-release.result == 'success' }}
|
||||
permissions:
|
||||
actions: read
|
||||
contents: write
|
||||
uses: ./.github/workflows/publish-macos-assets.yaml
|
||||
with:
|
||||
build_run_id: ${{ github.run_id }}
|
||||
release_tag: ${{ github.event_name == 'workflow_dispatch' && (inputs.channel == 'stable' && inputs.gp_branch || 'snapshot') || github.ref_name }}
|
||||
expected_gui: ${{ github.event_name == 'workflow_dispatch' && inputs.macos_gui || 'nsh' }}
|
||||
secrets: inherit
|
||||
|
||||
publish-windows-snapshot-feed:
|
||||
needs: [validate-inputs, gh-release, publish-macos-assets]
|
||||
if: >-
|
||||
${{ !cancelled() && github.event_name == 'workflow_dispatch' &&
|
||||
inputs.channel == 'snapshot' && !inputs.build_only && inputs.build_windows &&
|
||||
needs.gh-release.result == 'success' &&
|
||||
(!inputs.build_macos || needs.publish-macos-assets.result == 'success') }}
|
||||
permissions:
|
||||
contents: read
|
||||
uses: ./.github/workflows/publish-windows-update-feed.yaml
|
||||
with:
|
||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||
release_tag: snapshot
|
||||
version: ${{ needs.validate-inputs.outputs.version }}
|
||||
channel: snapshot
|
||||
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||
highlights: Development snapshot.
|
||||
secrets: inherit
|
||||
|
||||
publish-macos-unix-snapshot-feeds:
|
||||
needs: [validate-inputs, gh-release, publish-macos-assets, publish-windows-snapshot-feed]
|
||||
if: >-
|
||||
${{ !cancelled() && github.event_name == 'workflow_dispatch' &&
|
||||
inputs.channel == 'snapshot' && !inputs.build_only && inputs.build_macos &&
|
||||
needs.gh-release.result == 'success' && needs.publish-macos-assets.result == 'success' &&
|
||||
(!inputs.build_windows || needs.publish-windows-snapshot-feed.result == 'success') }}
|
||||
permissions:
|
||||
contents: write
|
||||
uses: ./.github/workflows/publish-update-feeds.yaml
|
||||
with:
|
||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||
channel: snapshot
|
||||
release_tag: snapshot
|
||||
archive_name: ${{ format('GPConnect_{0}-snapshot.{1}_arm64.zip', needs.validate-inputs.outputs.version, needs.validate-inputs.outputs.build_version) }}
|
||||
expected_gui: ${{ inputs.macos_gui }}
|
||||
unix_platforms: ${{ (inputs.build_bsd || inputs.build_bsd_arm64) && 'linux,freebsd,openbsd' || 'linux' }}
|
||||
highlights: Development snapshot.
|
||||
secrets: inherit
|
||||
|
||||
publish-docker-image:
|
||||
needs:
|
||||
- validate-inputs
|
||||
|
||||
@@ -112,7 +112,6 @@ jobs:
|
||||
in
|
||||
assert builtins.elem package
|
||||
hostSystem.config.environment.systemPackages;
|
||||
assert hostSystem.config.services.ayatana-indicators.enable;
|
||||
package
|
||||
'
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ jobs:
|
||||
gettext \
|
||||
gmp \
|
||||
gnutls \
|
||||
libappindicator-gtk3 \
|
||||
libp11-kit \
|
||||
libsecret \
|
||||
libtool \
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
name: Publish macOS assets
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build_run_id:
|
||||
required: true
|
||||
type: string
|
||||
release_tag:
|
||||
required: true
|
||||
type: string
|
||||
expected_gui:
|
||||
required: false
|
||||
default: nsh
|
||||
type: string
|
||||
secrets:
|
||||
GH_PAT:
|
||||
required: false
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_run_id:
|
||||
|
||||
@@ -34,6 +34,10 @@ on:
|
||||
highlights:
|
||||
required: false
|
||||
type: string
|
||||
unix_snapshot_build:
|
||||
description: Verified Unix snapshot build when it differs from the macOS retry
|
||||
required: false
|
||||
type: string
|
||||
unix_platforms:
|
||||
required: false
|
||||
default: linux,freebsd,openbsd
|
||||
@@ -75,6 +79,10 @@ on:
|
||||
description: Stable release highlights, one per line
|
||||
required: false
|
||||
type: string
|
||||
unix_snapshot_build:
|
||||
description: Verified Unix snapshot build; omit when it matches the macOS build
|
||||
required: false
|
||||
type: string
|
||||
unix_platforms:
|
||||
description: Comma-separated Unix platforms with published assets (linux,freebsd,openbsd)
|
||||
required: true
|
||||
@@ -87,7 +95,8 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ${{ vars.MACOS_RUNNER || 'macos-15' }}
|
||||
# Feed verification runs host tools, so it can use Intel runner capacity.
|
||||
runs-on: macos-26-intel
|
||||
environment: macos-release
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -103,6 +112,7 @@ jobs:
|
||||
SPARKLE_VERSION: 2.9.2
|
||||
UPDATE_HIGHLIGHTS: ${{ inputs.highlights }}
|
||||
UNIX_PLATFORMS: ${{ inputs.unix_platforms }}
|
||||
UNIX_SNAPSHOT_BUILD: ${{ inputs.unix_snapshot_build }}
|
||||
SPARKLE_ARCHIVE_SHA256: b83e37436774556ed055e0244b297ef2c790e0737393bf65bf495fcbba6eed65
|
||||
steps:
|
||||
- name: Validate inputs
|
||||
@@ -125,6 +135,12 @@ jobs:
|
||||
echo "unix_platforms must list published Unix targets separated by commas" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n "$UNIX_SNAPSHOT_BUILD" ]]; then
|
||||
if [[ "$CHANNEL" != "snapshot" || ! "$UNIX_SNAPSHOT_BUILD" =~ ^(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*)){0,2}$ ]]; then
|
||||
echo "unix_snapshot_build requires a snapshot channel and one to three numeric components" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [[ "$CHANNEL" == "snapshot" && "$RELEASE_TAG" != "snapshot" ]]; then
|
||||
echo "The snapshot channel must publish to the snapshot release" >&2
|
||||
exit 1
|
||||
@@ -343,6 +359,7 @@ jobs:
|
||||
echo "short_version=$short_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Prepare Unix update manifest
|
||||
id: unix_manifest
|
||||
env:
|
||||
RELEASED_AT: ${{ steps.release.outputs.released_at }}
|
||||
run: |
|
||||
@@ -383,7 +400,8 @@ jobs:
|
||||
else
|
||||
printf 'Development snapshot after %s.\n' \
|
||||
"${{ steps.bundle.outputs.short_version }}" > "$highlights"
|
||||
generate_args+=(--build "${{ steps.bundle.outputs.version }}")
|
||||
unix_build="${UNIX_SNAPSHOT_BUILD:-${{ steps.bundle.outputs.version }}}"
|
||||
generate_args+=(--build "$unix_build")
|
||||
released_at="$(date -u +%F)"
|
||||
fi
|
||||
|
||||
@@ -392,6 +410,9 @@ jobs:
|
||||
--released-at "$released_at" \
|
||||
--highlights-file "$highlights" \
|
||||
--output "$manifest"
|
||||
if [[ "$CHANNEL" == "snapshot" ]]; then
|
||||
echo "build=$unix_build" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Fetch current appcast
|
||||
id: current-appcast
|
||||
@@ -527,6 +548,13 @@ jobs:
|
||||
--channel "$CHANNEL" \
|
||||
--archive-url "https://github.com/$REPOSITORY/releases/download/$RELEASE_TAG/$ARCHIVE_NAME"
|
||||
|
||||
- name: Preserve other platform feeds
|
||||
run: |
|
||||
python3 scripts/preserve-update-feeds.py \
|
||||
--base-url "${FEED_URL%/appcast.xml}" \
|
||||
--directory gpgui/apps/update-feed-worker/public \
|
||||
--exclude appcast.xml --exclude latest.json
|
||||
|
||||
- name: Deploy update feed worker
|
||||
env:
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
@@ -580,7 +608,7 @@ jobs:
|
||||
--version "${{ steps.bundle.outputs.short_version }}"
|
||||
)
|
||||
if [[ "$CHANNEL" == "snapshot" ]]; then
|
||||
expected+=(--build "${{ steps.bundle.outputs.version }}")
|
||||
expected+=(--build "${{ steps.unix_manifest.outputs.build }}")
|
||||
fi
|
||||
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
||||
if curl --fail --location --silent --show-error \
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
name: Publish Windows update feed
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
gpgui_ref:
|
||||
required: true
|
||||
type: string
|
||||
release_tag:
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
channel:
|
||||
required: true
|
||||
type: string
|
||||
build:
|
||||
required: true
|
||||
type: string
|
||||
highlights:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
GH_PAT:
|
||||
required: true
|
||||
CLOUDFLARE_ACCOUNT_ID:
|
||||
required: false
|
||||
CLOUDFLARE_API_TOKEN:
|
||||
required: false
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
gpgui_ref:
|
||||
description: gpgui ref containing the update Worker and pinned WinSparkle tools
|
||||
required: true
|
||||
default: main
|
||||
type: string
|
||||
release_tag:
|
||||
description: GitHub release containing both tested native installers and signatures
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: Base product version (x.y.z)
|
||||
required: true
|
||||
type: string
|
||||
channel:
|
||||
description: Update channel
|
||||
required: true
|
||||
type: choice
|
||||
options: [stable, snapshot]
|
||||
build:
|
||||
description: Numeric snapshot build; empty for stable
|
||||
type: string
|
||||
highlights:
|
||||
description: Release highlights, one per line
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: update-feeds
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: windows-latest
|
||||
environment: macos-release
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
REPOSITORY: yuezk/GlobalProtect-openconnect
|
||||
RELEASE_TAG: ${{ inputs.release_tag }}
|
||||
PRODUCT_VERSION: ${{ inputs.version }}
|
||||
UPDATE_CHANNEL: ${{ inputs.channel }}
|
||||
BUILD_VERSION: ${{ inputs.build }}
|
||||
UPDATE_HIGHLIGHTS: ${{ inputs.highlights }}
|
||||
WINDOWS_UPDATE_PUBLIC_KEY: ${{ vars.WINDOWS_UPDATE_PUBLIC_KEY }}
|
||||
WINDOWS_SIGNING_PUBLISHER: ${{ vars.WINDOWS_SIGNING_PUBLISHER }}
|
||||
UPDATES_WORKER_NAME: ${{ vars.UPDATES_WORKER_NAME || 'gp-updates' }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Checkout update Worker and build helpers
|
||||
uses: ./.github/actions/checkout-private
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
ref: ${{ inputs.gpgui_ref }}
|
||||
path: gpgui
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.13'
|
||||
- uses: pnpm/action-setup@v5
|
||||
with:
|
||||
version: 9.15.1
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 22
|
||||
- name: Verify both tested native installers
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($env:PRODUCT_VERSION -notmatch '^\d+\.\d+\.\d+$') { throw 'Invalid product version.' }
|
||||
if ($env:UPDATE_CHANNEL -eq 'stable') {
|
||||
if ($env:RELEASE_TAG -ne "v$env:PRODUCT_VERSION" -or $env:BUILD_VERSION) { throw 'Stable release identity does not match.' }
|
||||
} elseif ($env:RELEASE_TAG -ne 'snapshot' -or $env:BUILD_VERSION -notmatch '^\d+(\.\d+){0,2}$') { throw 'Snapshot release identity does not match.' }
|
||||
$displayVersion = $env:PRODUCT_VERSION
|
||||
if ($env:UPDATE_CHANNEL -eq 'snapshot') { $displayVersion += "-snapshot.$env:BUILD_VERSION" }
|
||||
if (!$env:WINDOWS_UPDATE_PUBLIC_KEY) { throw 'Configure the Windows public update key before promotion.' }
|
||||
$downloads = Join-Path $env:RUNNER_TEMP 'windows-update'
|
||||
New-Item -ItemType Directory -Force $downloads | Out-Null
|
||||
. ./gpgui/scripts/windows-updates/Get-WinSparkle.ps1
|
||||
$tools = Get-WinSparkleTools (Join-Path $env:RUNNER_TEMP 'signing-tools')
|
||||
foreach ($architecture in @('x64','arm64')) {
|
||||
$name = "GPConnect_${displayVersion}_windows-$architecture-setup.exe"
|
||||
foreach ($asset in @($name, "$name.sig", "$name.sha256")) {
|
||||
gh release download $env:RELEASE_TAG --repo $env:REPOSITORY --pattern $asset --dir $downloads
|
||||
if ($LASTEXITCODE -ne 0) { throw "Missing release asset: $asset" }
|
||||
}
|
||||
$installer = Join-Path $downloads $name
|
||||
$sum = (Get-Content "$installer.sha256" -Raw).Trim()
|
||||
if ($sum -notmatch '^([a-fA-F0-9]{64}) (.+)$' -or $Matches[2] -ne $name) { throw 'Invalid installer checksum file.' }
|
||||
if ((Get-FileHash $installer).Hash -ne $Matches[1]) { throw 'Installer checksum mismatch.' }
|
||||
if ($env:WINDOWS_SIGNING_PUBLISHER) {
|
||||
$authenticode = Get-AuthenticodeSignature $installer
|
||||
if ($authenticode.Status -ne 'Valid' -or $authenticode.SignerCertificate.GetNameInfo([Security.Cryptography.X509Certificates.X509NameType]::SimpleName, $false) -ne $env:WINDOWS_SIGNING_PUBLISHER) { throw 'Installer publisher signature is invalid.' }
|
||||
}
|
||||
if ([Diagnostics.FileVersionInfo]::GetVersionInfo($installer).ProductVersion -ne $displayVersion) { throw 'Installer product version/build mismatch.' }
|
||||
$signature = (Get-Content "$installer.sig" -Raw).Trim()
|
||||
& $tools.Tool verify -p $env:WINDOWS_UPDATE_PUBLIC_KEY -s $signature $installer
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Installer update signature is invalid.' }
|
||||
}
|
||||
"WINDOWS_DISPLAY_VERSION=$displayVersion" >> $env:GITHUB_ENV
|
||||
- name: Preserve other feeds and generate Windows metadata
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$public = 'gpgui/apps/update-feed-worker/public'
|
||||
python scripts/preserve-update-feeds.py --base-url https://updates.gpgui.com --directory $public
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Could not preserve published feeds.' }
|
||||
$notes = Join-Path $env:RUNNER_TEMP 'windows-highlights.txt'
|
||||
$env:UPDATE_HIGHLIGHTS | Set-Content $notes -Encoding utf8NoBOM
|
||||
$output = Join-Path $public 'windows'
|
||||
$previous = Join-Path $output 'latest.json'
|
||||
$arguments = @('scripts/windows-update-feed.py', '--version', $env:PRODUCT_VERSION,
|
||||
'--channel', $env:UPDATE_CHANNEL, '--released-at', [DateTime]::UtcNow.ToString('yyyy-MM-dd'),
|
||||
'--highlights-file', $notes, '--output', $output)
|
||||
foreach ($architecture in @('x64','arm64')) {
|
||||
$name = "GPConnect_$($env:WINDOWS_DISPLAY_VERSION)_windows-$architecture-setup.exe"
|
||||
$installer = Join-Path (Join-Path $env:RUNNER_TEMP 'windows-update') $name
|
||||
$arguments += @('--payload', $architecture, $installer,
|
||||
"https://github.com/$env:REPOSITORY/releases/download/$env:RELEASE_TAG/$name", "$installer.sig")
|
||||
}
|
||||
if (Test-Path $previous) { $arguments += @('--input', $previous) }
|
||||
if ($env:BUILD_VERSION) { $arguments += @('--build', $env:BUILD_VERSION) }
|
||||
python @arguments
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Invalid Windows metadata.' }
|
||||
- name: Deploy complete feed set
|
||||
shell: pwsh
|
||||
env:
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
pnpm --dir gpgui/apps/update-feed-worker install --frozen-lockfile --ignore-scripts
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Worker dependency installation failed.' }
|
||||
pnpm --dir gpgui/apps/update-feed-worker exec wrangler deploy --config wrangler.jsonc --name $env:UPDATES_WORKER_NAME
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Feed deployment failed.' }
|
||||
- name: Verify published Windows metadata
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$windows = 'gpgui/apps/update-feed-worker/public/windows'
|
||||
$feeds = @('latest.json', 'stable/appcast.xml', 'snapshot/appcast.xml') | Where-Object { Test-Path (Join-Path $windows $_) }
|
||||
foreach ($relative in $feeds) {
|
||||
$expected = [IO.File]::ReadAllBytes((Join-Path 'gpgui/apps/update-feed-worker/public/windows' $relative))
|
||||
$downloaded = Join-Path $env:RUNNER_TEMP ('published-' + ($relative -replace '/', '-'))
|
||||
$matched = $false
|
||||
foreach ($attempt in 1..10) {
|
||||
try {
|
||||
Invoke-WebRequest "https://updates.gpgui.com/windows/$relative" -UserAgent 'GPConnectReleasePublisher/1.0' -OutFile $downloaded
|
||||
$actual = [IO.File]::ReadAllBytes($downloaded)
|
||||
$matched = [Convert]::ToBase64String($expected) -eq [Convert]::ToBase64String($actual)
|
||||
} catch {
|
||||
Write-Host "Waiting for published feed: $relative ($attempt/10)"
|
||||
}
|
||||
if ($matched) { break }
|
||||
if ($attempt -lt 10) { Start-Sleep -Seconds 3 }
|
||||
}
|
||||
if (!$matched) { throw "Published feed does not match: $relative" }
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
name: Verify public Windows release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_tag:
|
||||
description: Published snapshot or stable release tag
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: Base product version
|
||||
required: true
|
||||
type: string
|
||||
build:
|
||||
description: Numeric snapshot build; empty for stable
|
||||
type: string
|
||||
gpgui_ref:
|
||||
description: Matching GUI source ref containing the pinned update tools
|
||||
required: true
|
||||
default: release/next
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
architecture: [x64, arm64]
|
||||
runs-on: ${{ matrix.architecture == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
RELEASE_TAG: ${{ inputs.release_tag }}
|
||||
PRODUCT_VERSION: ${{ inputs.version }}
|
||||
BUILD_VERSION: ${{ inputs.build }}
|
||||
ARCHITECTURE: ${{ matrix.architecture }}
|
||||
WINDOWS_UPDATE_PUBLIC_KEY: ${{ vars.WINDOWS_UPDATE_PUBLIC_KEY }}
|
||||
WINDOWS_SIGNING_PUBLISHER: ${{ vars.WINDOWS_SIGNING_PUBLISHER }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.release_tag == 'snapshot' && 'release/next' || inputs.release_tag }}
|
||||
persist-credentials: false
|
||||
- uses: ./.github/actions/checkout-private
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
ref: ${{ inputs.gpgui_ref }}
|
||||
path: gpgui
|
||||
- name: Download, verify, install and uninstall the public installer
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($env:PRODUCT_VERSION -notmatch '^\d+\.\d+\.\d+$') { throw 'Invalid product version.' }
|
||||
if (!$env:WINDOWS_UPDATE_PUBLIC_KEY -or !$env:WINDOWS_SIGNING_PUBLISHER) { throw 'Configure the update key and signing publisher.' }
|
||||
$displayVersion = $env:PRODUCT_VERSION
|
||||
if ($env:RELEASE_TAG -eq 'snapshot') {
|
||||
if ($env:BUILD_VERSION -notmatch '^\d+(\.\d+){0,2}$') { throw 'Invalid snapshot build.' }
|
||||
$displayVersion += "-snapshot.$env:BUILD_VERSION"
|
||||
} elseif ($env:RELEASE_TAG -ne "v$env:PRODUCT_VERSION" -or $env:BUILD_VERSION) { throw 'Stable release identity does not match.' }
|
||||
$name = "GPConnect_${displayVersion}_windows-$env:ARCHITECTURE-setup.exe"
|
||||
$downloads = Join-Path $env:RUNNER_TEMP 'public-windows-release'
|
||||
New-Item -ItemType Directory $downloads | Out-Null
|
||||
foreach ($asset in @($name, "$name.sha256", "$name.sig")) {
|
||||
gh release download $env:RELEASE_TAG --repo $env:GITHUB_REPOSITORY --pattern $asset --dir $downloads
|
||||
if ($LASTEXITCODE -ne 0) { throw "Could not download $asset" }
|
||||
}
|
||||
$installer = Join-Path $downloads $name
|
||||
$sum = (Get-Content "$installer.sha256" -Raw).Trim()
|
||||
if ($sum -notmatch '^([a-fA-F0-9]{64}) (.+)$' -or $Matches[2] -ne $name) { throw 'Invalid checksum file.' }
|
||||
$hash = (Get-FileHash $installer).Hash
|
||||
if ($hash -ne $Matches[1]) { throw 'Installer checksum mismatch.' }
|
||||
if ([Diagnostics.FileVersionInfo]::GetVersionInfo($installer).ProductVersion -ne $displayVersion) { throw 'Installer version mismatch.' }
|
||||
& ./scripts/test-windows-signature.ps1 -Files $installer -Publisher $env:WINDOWS_SIGNING_PUBLISHER
|
||||
. ./gpgui/scripts/windows-updates/Get-WinSparkle.ps1
|
||||
$tools = Get-WinSparkleTools (Join-Path $env:RUNNER_TEMP 'winsparkle-tools') -Architecture $env:ARCHITECTURE
|
||||
$signature = (Get-Content "$installer.sig" -Raw).Trim()
|
||||
& $tools.Tool verify -p $env:WINDOWS_UPDATE_PUBLIC_KEY -s $signature $installer
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Installer update signature is invalid.' }
|
||||
& ./scripts/test-windows-installer.ps1 -Installer $installer -Architecture $env:ARCHITECTURE -Build $env:BUILD_VERSION
|
||||
@{ release = $env:RELEASE_TAG; version = $displayVersion; architecture = $env:ARCHITECTURE;
|
||||
sha256 = $hash.ToLowerInvariant(); publisher = $env:WINDOWS_SIGNING_PUBLISHER;
|
||||
authenticode = 'Valid'; timestamped = $true; update_signature = 'Valid';
|
||||
installed_signatures = 'Valid'; install_uninstall = 'Passed'
|
||||
} | ConvertTo-Json | Set-Content verification.json -Encoding utf8
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: windows-release-verification-${{ matrix.architecture }}
|
||||
path: verification.json
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
@@ -16,3 +16,8 @@ gen
|
||||
|
||||
# Nix files
|
||||
result
|
||||
|
||||
# Packages & test assets
|
||||
*.ipa
|
||||
|
||||
__pycache__
|
||||
Generated
+103
-57
@@ -292,11 +292,13 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "auth"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"block2",
|
||||
"browser-launcher",
|
||||
"common",
|
||||
"dunce",
|
||||
"gpapi",
|
||||
"gtk",
|
||||
"html-escape",
|
||||
@@ -307,6 +309,7 @@ dependencies = [
|
||||
"objc2-security",
|
||||
"objc2-web-kit",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tempfile",
|
||||
"tiny_http",
|
||||
@@ -316,6 +319,10 @@ dependencies = [
|
||||
"uuid",
|
||||
"uzers",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"windows",
|
||||
"windows-sys 0.61.2",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -547,13 +554,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "browser-launcher"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"log",
|
||||
"open",
|
||||
"webbrowser",
|
||||
"which",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -911,7 +919,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "common"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
@@ -1621,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]]
|
||||
@@ -1655,6 +1663,16 @@ dependencies = [
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "file-rotate"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e8e2fa049328a1f3295991407a88585805d126dfaadf74b9fe8c194c730aafc"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"flate2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filedescriptor"
|
||||
version = "0.8.3"
|
||||
@@ -2113,9 +2131,17 @@ dependencies = [
|
||||
"system-deps",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gp-xml"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"url",
|
||||
"xmltree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpapi"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.23.1",
|
||||
@@ -2124,11 +2150,14 @@ dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
"clap-verbosity-flag",
|
||||
"cms",
|
||||
"common",
|
||||
"directories",
|
||||
"dns-lookup",
|
||||
"env_logger",
|
||||
"file-rotate",
|
||||
"getrandom 0.4.3",
|
||||
"gp-xml",
|
||||
"gtk",
|
||||
"humantime",
|
||||
"libloading 0.9.0",
|
||||
@@ -2142,6 +2171,7 @@ dependencies = [
|
||||
"oslog",
|
||||
"p12-keystore",
|
||||
"pem",
|
||||
"pkcs12",
|
||||
"pkcs8",
|
||||
"pkg-config",
|
||||
"proptest",
|
||||
@@ -2149,7 +2179,7 @@ dependencies = [
|
||||
"reqwest",
|
||||
"rustls",
|
||||
"rustls-pemfile",
|
||||
"sec1",
|
||||
"rustls-platform-verifier",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
@@ -2167,6 +2197,7 @@ dependencies = [
|
||||
"uuid",
|
||||
"uzers",
|
||||
"whoami",
|
||||
"windows-sys 0.61.2",
|
||||
"x509-cert",
|
||||
"xmltree",
|
||||
"zeroize",
|
||||
@@ -2174,7 +2205,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpauth"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"auth",
|
||||
@@ -2182,7 +2213,6 @@ dependencies = [
|
||||
"common",
|
||||
"compile-time",
|
||||
"gpapi",
|
||||
"home",
|
||||
"log",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -2193,7 +2223,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpclient"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
@@ -2224,7 +2254,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpgui-helper"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
@@ -2245,24 +2275,26 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gphip"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"askama",
|
||||
"chrono",
|
||||
"gpapi",
|
||||
"log",
|
||||
"netdev",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"uuid",
|
||||
"uzers",
|
||||
"windows",
|
||||
"xmltree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gpservice"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
@@ -2271,6 +2303,7 @@ dependencies = [
|
||||
"common",
|
||||
"compile-time",
|
||||
"env_logger",
|
||||
"file-rotate",
|
||||
"futures",
|
||||
"getrandom 0.4.3",
|
||||
"gpapi",
|
||||
@@ -2291,13 +2324,15 @@ dependencies = [
|
||||
"tokio-tungstenite 0.30.0",
|
||||
"tokio-util",
|
||||
"uuid",
|
||||
"windows-service",
|
||||
"windows-sys 0.61.2",
|
||||
"xz2",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gptunnel"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"gpapi",
|
||||
"log",
|
||||
@@ -2309,9 +2344,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gpvpnc"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"ipnet",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"uuid",
|
||||
"windows-sys 0.61.2",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2429,15 +2472,6 @@ dependencies = [
|
||||
"digest 0.11.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "html-escape"
|
||||
version = "0.3.0"
|
||||
@@ -2813,6 +2847,9 @@ name = "ipnet"
|
||||
version = "2.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-docker"
|
||||
@@ -3823,16 +3860,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openconnect"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
dependencies = [
|
||||
"autotools",
|
||||
"cc",
|
||||
"fs_extra",
|
||||
"gp-xml",
|
||||
"is_executable",
|
||||
"libc",
|
||||
"log",
|
||||
"pkg-config",
|
||||
"tempfile",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4674,7 +4713,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4739,7 +4778,7 @@ dependencies = [
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4880,16 +4919,6 @@ dependencies = [
|
||||
"sha2 0.11.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sec1"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d"
|
||||
dependencies = [
|
||||
"der",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "3.7.0"
|
||||
@@ -5619,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",
|
||||
@@ -5670,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",
|
||||
@@ -5693,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",
|
||||
@@ -5708,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",
|
||||
@@ -5720,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",
|
||||
@@ -5734,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",
|
||||
@@ -5759,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",
|
||||
@@ -5784,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",
|
||||
@@ -5841,7 +5870,7 @@ dependencies = [
|
||||
"getrandom 0.4.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6384,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",
|
||||
@@ -6738,6 +6767,12 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@@ -6760,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]]
|
||||
@@ -6888,6 +6923,17 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-service"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "857224b3b211c6f3616921f081ee54721ee3ad2ace2fac6a6337e032f7b4dcf2"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"widestring",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.5.1"
|
||||
@@ -7296,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
-2
@@ -11,7 +11,7 @@ members = [
|
||||
|
||||
[workspace.package]
|
||||
rust-version = "1.91"
|
||||
version = "3.2.0"
|
||||
version = "3.6.0"
|
||||
authors = ["Kevin Yue <[email protected]>"]
|
||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||
edition = "2024"
|
||||
@@ -24,7 +24,6 @@ base64 = { version = "0.23", default-features = false, features = ["std"] }
|
||||
chrono = "0.4"
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
clap-verbosity-flag = "3"
|
||||
ctrlc = "3.4"
|
||||
directories = "6.0"
|
||||
dns-lookup = "4.0.2"
|
||||
env_logger = "0.11"
|
||||
|
||||
@@ -362,7 +362,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
|
||||
|
||||
@@ -475,7 +474,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
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# GlobalProtect-openconnect
|
||||
|
||||
A GlobalProtect VPN client built on OpenConnect with support for SSO authentication. It provides command-line tools and the GP Connect desktop application for macOS, Linux, FreeBSD, and OpenBSD.
|
||||
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.
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
@@ -19,150 +21,100 @@ A GlobalProtect VPN client built on OpenConnect with support for SSO authenticat
|
||||
- [Command-Line Interface](#command-line-interface)
|
||||
- [Graphical User Interface](#graphical-user-interface)
|
||||
- [Installation](#installation)
|
||||
- [Windows](#windows)
|
||||
- [macOS](#macos)
|
||||
- [Debian / Ubuntu](#debian--ubuntu)
|
||||
- [Arch Linux / Manjaro](#arch-linux--manjaro)
|
||||
- [Fedora 38+ / Rawhide](#fedora-38--rawhide)
|
||||
- [openSUSE Leap 15.6+ / Tumbleweed](#opensuse-leap-156--tumbleweed)
|
||||
- [Other RPM-based Distributions](#other-rpm-based-distributions)
|
||||
- [Fedora / RHEL](#fedora--rhel)
|
||||
- [openSUSE](#opensuse)
|
||||
- [Alpine Linux](#alpine-linux)
|
||||
- [FreeBSD](#freebsd)
|
||||
- [OpenBSD](#openbsd)
|
||||
- [Gentoo](#gentoo)
|
||||
- [NixOS](#nixos)
|
||||
- [Official Docker Image](#official-docker-image)
|
||||
- [Docker](#docker)
|
||||
- [Other Distributions](#other-distributions)
|
||||
- [Building from Source](#building-from-source)
|
||||
- [Frequently Asked Questions](#frequently-asked-questions)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [NetworkManager Integration](#networkmanager-integration)
|
||||
- [Licensing](#licensing)
|
||||
|
||||
## Features
|
||||
|
||||
- **Desktop Platform Support** – macOS, Linux, FreeBSD, and OpenBSD
|
||||
- **Dual Interface** – Available as both CLI and GUI applications
|
||||
- **Flexible Authentication** – Supports SSO, non-SSO, FIDO2 (e.g., YubiKey), and client certificate authentication
|
||||
- **Browser Integration** – Authenticate using your default browser or any specified browser
|
||||
- **Multi-Portal Support** – Connect to multiple portals and gateways
|
||||
- **Direct Gateway Connection** – Bypass portal selection when needed
|
||||
- **Auto-Connect** – Automatically connect on system startup
|
||||
- **System Tray Integration** – Convenient system tray icon (requires [gnome-shell-extension-appindicator](https://extensions.gnome.org/extension/615/appindicator-support/) on GNOME)
|
||||
- **Multi-Platform** – Windows (x64 and ARM64), macOS (Apple silicon), Linux, FreeBSD, and OpenBSD
|
||||
- **Dual Interfaces** – Desktop GUI (**GP Connect**) and terminal CLI (`gpclient`, on macOS, Linux, and BSD)
|
||||
- **Native Shell on Linux** – Ultra-low-memory native desktop GUI alongside the webview interface
|
||||
- **Flexible Routing** – Full System VPN tunnel or local SOCKS5 proxy mode
|
||||
- **Modern Authentication** – SAML / SSO, MFA, FIDO2 (YubiKey), client certificates, and external browser login
|
||||
- **Automated HIP Reports** – Built-in HIP report generation or custom scripts
|
||||
- **Multi-Portal & Direct Gateway** – Manage multiple saved portals or connect directly to a gateway
|
||||
- **Desktop Integration** – Theme-aware system tray icon, auto-connect on launch, and reconnect on wake
|
||||
|
||||
## Usage
|
||||
|
||||
### Command-Line Interface
|
||||
|
||||
The CLI is free and open source. Use it to authenticate, connect to portals or gateways, and generate HIP reports from the terminal.
|
||||
|
||||
#### Basic Commands
|
||||
On macOS, Linux, and BSD, the open-source `gpclient` CLI handles authentication, connection lifecycle, and HIP generation:
|
||||
|
||||
```bash
|
||||
Usage: gpclient [OPTIONS] <COMMAND>
|
||||
# Connect to a portal server
|
||||
sudo gpclient connect <portal>
|
||||
|
||||
Commands:
|
||||
connect Connect to a portal server
|
||||
disconnect Disconnect from the server
|
||||
launch-gui Launch the GUI
|
||||
hip Generate HIP report
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
--ignore-tls-errors Ignore the TLS errors
|
||||
--lock-file <LOCK_FILE> Path to the gpclient PID lock file
|
||||
--log-format <LOG_FORMAT> Log output format. JSON is intended for non-interactive consumers; interactive prompts remain text. [default: text] [possible values: text, json]
|
||||
-v, --verbose... Enable verbose output, -v for debug, -vv for trace
|
||||
-q, --quiet... Decrease logging verbosity, -q for warnings, -qq for errors
|
||||
-h, --help Print help (see more with '--help')
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
|
||||
> **Tip:** Use `gpclient help <command>` for detailed information on a specific command.
|
||||
|
||||
#### HIP reports
|
||||
|
||||
HIP is disabled in the CLI unless enabled explicitly. Use `--hip` to generate reports inside `gpclient`, including later reports requested by the gateway:
|
||||
|
||||
```bash
|
||||
sudo gpclient connect <portal> --hip
|
||||
```
|
||||
|
||||
Use `--hip=/absolute/path/to/script` for a custom executable. It runs as the `gpclient` process user unless `--hip-user` specifies another user. No installed HIP script is discovered automatically. `--hip-user` applies only to custom executables.
|
||||
|
||||
`gpclient hip` generates a report on demand for inspection; see `gpclient hip --help` for report inputs. The GUI's HIP tab supports generated reports, edited XML, and HIP Off on all desktop platforms. Linux, FreeBSD, and OpenBSD also support desktop-user scripts and explicitly approved root scripts.
|
||||
|
||||
#### External Browser Authentication
|
||||
|
||||
Use `gpclient` directly for browser-based authentication. It opens the browser as your normal desktop user while keeping VPN tunnel setup privileged:
|
||||
|
||||
```bash
|
||||
# Connect using browser authentication (SSO / SAML)
|
||||
sudo gpclient connect <portal> --browser
|
||||
|
||||
# Connect directly to a gateway server
|
||||
sudo gpclient connect <gateway> --as-gateway
|
||||
|
||||
# Connect with automatic HIP report generation
|
||||
sudo gpclient connect <portal> --hip
|
||||
|
||||
# Headless / remote server authentication (prints auth URL to open in any browser)
|
||||
sudo gpclient connect <portal> --browser manual
|
||||
|
||||
# Disconnect
|
||||
sudo gpclient disconnect
|
||||
```
|
||||
|
||||
For standalone CLI installations, use `--browser manual` (`--browser remote` before v3.0.6): open the printed URL and paste the resulting `globalprotectcallback:…` data into the terminal.
|
||||
|
||||
To reuse a saved portal cookie for later connections, add `--cookie-cache`:
|
||||
|
||||
```bash
|
||||
sudo gpclient connect <portal> --browser --cookie-cache
|
||||
```
|
||||
|
||||
Add `--gateway <gateway>` to select a particular gateway. Cookie caching is handled by `gpclient`. Its default cache file is `$HOME/.config/gpclient/cookie.json`, which normally belongs to root when running with `sudo`. To choose a predictable location, specify the path explicitly:
|
||||
|
||||
```bash
|
||||
sudo gpclient connect <portal> --browser --cookie-cache=/absolute/path/to/cookie.json
|
||||
```
|
||||
|
||||
**Browser Options:**
|
||||
|
||||
- Use `--browser` to automatically select an available browser
|
||||
- Use `--browser <browser>` to specify a browser (e.g., `firefox`, `chrome`)
|
||||
- Use `--browser manual` for standalone CLI installations or headless servers
|
||||
Run `gpclient --help` or `gpclient <command> --help` to view all available commands and options.
|
||||
|
||||
### Graphical User Interface
|
||||
|
||||
GP Connect provides a desktop interface for managing VPN connections. On macOS, open GP Connect from Applications. On Linux, FreeBSD, and OpenBSD, launch it from your application menu or via the terminal:
|
||||
|
||||
```bash
|
||||
gpclient launch-gui
|
||||
```
|
||||
- **Windows**: Open **GP Connect** from the Start menu.
|
||||
- **macOS**: Open **GP Connect** from Applications.
|
||||
- **Linux / BSD**: Launch GP Connect from your application menu or run:
|
||||
```bash
|
||||
gpclient launch-gui
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> **On Linux, try Native Shell for lower memory usage.** Switch to it in **Settings → General → Interface**.
|
||||
|
||||
> [!Note]
|
||||
>
|
||||
> The GUI version is partially open source. The background service ([gpservice](./apps/gpservice/)) is open source, while the GUI wrapper is proprietary.
|
||||
> **On Linux, try Native Shell for lower memory usage.** Switch between Native Shell and Tauri in **Settings → General → Interface**.
|
||||
|
||||
## Installation
|
||||
|
||||
> [!Note]
|
||||
>
|
||||
> For older Linux distributions, use [v2.3.13](https://github.com/yuezk/GlobalProtect-openconnect/releases/tag/v2.3.13) instead of the latest release. It provides release assets for common distro families, including Debian/Ubuntu (`.deb`), Arch Linux / Manjaro (`.pkg.tar.zst`), RPM-based distros such as Fedora / RHEL / Rocky / AlmaLinux / CentOS (`.rpm`), and generic Linux tarballs (`.bin.tar.xz`).
|
||||
### Windows
|
||||
|
||||
1. Download the **x64** or **ARM64** installer for your PC from [GitHub Releases](https://github.com/yuezk/GlobalProtect-openconnect/releases/latest).
|
||||
2. Run the installer and approve the administrator prompt.
|
||||
3. Open **GP Connect** from the Start menu.
|
||||
|
||||
### macOS
|
||||
|
||||
GP Connect requires Apple silicon and macOS 13 or later. The macOS app includes both the desktop application and the free `gpclient` CLI. The CLI does not require a GUI license.
|
||||
Requires Apple silicon and macOS 13+. Includes both GP Connect and the `gpclient` CLI.
|
||||
|
||||
#### Option 1: Install with Homebrew
|
||||
#### Option 1: Homebrew (Recommended)
|
||||
|
||||
```bash
|
||||
brew install --cask yuezk/gp-connect/gp-connect
|
||||
```
|
||||
|
||||
Open GP Connect from Applications, or connect from the terminal:
|
||||
#### Option 2: DMG Installer
|
||||
|
||||
```bash
|
||||
sudo gpclient connect <portal> --browser
|
||||
```
|
||||
|
||||
#### Option 2: Install from DMG
|
||||
|
||||
Download the GP Connect `.dmg` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, open it, and drag GP Connect into Applications.
|
||||
Download the `.dmg` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page and drag GP Connect into Applications.
|
||||
|
||||
### Debian / Ubuntu
|
||||
|
||||
#### Option 1: Install from PPA (Recommended)
|
||||
#### Option 1: PPA (Recommended)
|
||||
|
||||
```bash
|
||||
sudo add-apt-repository ppa:yuezk/globalprotect-openconnect
|
||||
@@ -170,392 +122,152 @@ sudo apt-get update
|
||||
sudo apt-get install globalprotect-openconnect
|
||||
```
|
||||
|
||||
> [!Note]
|
||||
>
|
||||
> **For Linux Mint users:** If you encounter a GPG key error, import the key manually:
|
||||
> ```bash
|
||||
> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7937C393082992E5D6E4A60453FC26B43838D761
|
||||
> ```
|
||||
#### Option 2: DEB Package
|
||||
|
||||
#### Option 2: Install from DEB Package
|
||||
|
||||
Download the latest `.deb` package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, then install:
|
||||
Download the latest `.deb` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
|
||||
|
||||
```bash
|
||||
sudo apt install --fix-broken ./globalprotect-openconnect_*.deb
|
||||
sudo apt install ./globalprotect-openconnect_*.deb
|
||||
```
|
||||
|
||||
### Arch Linux / Manjaro
|
||||
|
||||
#### Option 1: Install from AUR
|
||||
|
||||
Package: [globalprotect-openconnect-git](https://aur.archlinux.org/packages/globalprotect-openconnect-git/)
|
||||
|
||||
You can install it using an AUR helper like [`yay`](https://github.com/Jguer/yay):
|
||||
|
||||
```bash
|
||||
# Official Extra repository
|
||||
sudo pacman -S globalprotect-openconnect
|
||||
|
||||
# AUR (git main)
|
||||
yay -S globalprotect-openconnect-git
|
||||
```
|
||||
|
||||
#### Option 2: Install from the Official Extra Repository
|
||||
### Fedora / RHEL
|
||||
|
||||
The package is also available in the official Arch Linux Extra repository.
|
||||
|
||||
Package: [globalprotect-openconnect](https://archlinux.org/packages/extra/x86_64/globalprotect-openconnect/)
|
||||
|
||||
> [!Note]
|
||||
>
|
||||
> Since the official package does not include the system tray support dependency, you need to install `libappindicator` manually:
|
||||
|
||||
```bash
|
||||
sudo pacman -S libappindicator globalprotect-openconnect
|
||||
```
|
||||
|
||||
#### Option 3: Install from Package
|
||||
|
||||
Download the latest package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, then install:
|
||||
|
||||
```bash
|
||||
sudo pacman -U globalprotect-openconnect-*.pkg.tar.zst
|
||||
```
|
||||
|
||||
### Fedora 38+ / Rawhide
|
||||
|
||||
#### Install from COPR
|
||||
|
||||
The package is available on [COPR](https://copr.fedorainfracloud.org/coprs/yuezk/globalprotect-openconnect/) for RPM-based distributions:
|
||||
Enable the COPR repository:
|
||||
|
||||
```bash
|
||||
sudo dnf copr enable yuezk/globalprotect-openconnect
|
||||
sudo dnf install globalprotect-openconnect
|
||||
```
|
||||
|
||||
### openSUSE Leap 15.6+ / Tumbleweed
|
||||
### openSUSE
|
||||
|
||||
#### Install from OBS (openSUSE Build Service)
|
||||
|
||||
Packages are available on the [openSUSE Build Service](https://build.opensuse.org/package/show/home:yuezk/globalprotect-openconnect). Follow the [installation instructions](https://software.opensuse.org//download.html?project=home%3Ayuezk&package=globalprotect-openconnect) for your distribution.
|
||||
|
||||
### Other RPM-based Distributions
|
||||
|
||||
#### Install from RPM Package
|
||||
|
||||
Download the latest RPM package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
|
||||
|
||||
```bash
|
||||
sudo rpm -i globalprotect-openconnect-*.rpm
|
||||
```
|
||||
Packages are available on the [openSUSE Build Service](https://build.opensuse.org/package/show/home:yuezk/globalprotect-openconnect). Follow the [OBS instructions](https://software.opensuse.org/download.html?project=home%3Ayuezk&package=globalprotect-openconnect) for your distribution.
|
||||
|
||||
### Alpine Linux
|
||||
|
||||
Download the latest `.apk` package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, then install:
|
||||
Download the latest `.apk` package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
|
||||
|
||||
```bash
|
||||
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
|
||||
```
|
||||
|
||||
The package uses Alpine's native musl build. Make sure the `community` repository is enabled so GUI dependencies such as `webkit2gtk-4.1`, `libsecret`, and `libayatana-appindicator` can be resolved. GUI-launched connections use polkit, and VPN tunnel creation requires `/dev/net/tun`.
|
||||
*(Requires the `community` repository for WebKitGTK dependencies).*
|
||||
|
||||
### FreeBSD
|
||||
|
||||
Download the latest FreeBSD package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, then install:
|
||||
Download the latest FreeBSD package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
|
||||
|
||||
```bash
|
||||
sudo pkg install ./globalprotect-openconnect-*-freebsd-*.pkg
|
||||
```
|
||||
|
||||
To build from source, see [Building from Source on FreeBSD and OpenBSD](./docs/bsd-source-build.md).
|
||||
|
||||
### OpenBSD
|
||||
|
||||
Download the latest OpenBSD package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page, then install:
|
||||
Download the latest OpenBSD package from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
|
||||
|
||||
```bash
|
||||
doas pkg_add -D unsigned ./globalprotect-openconnect-*-openbsd-*.tgz
|
||||
```
|
||||
|
||||
To build from source, see [Building from Source on FreeBSD and OpenBSD](./docs/bsd-source-build.md).
|
||||
|
||||
### Gentoo
|
||||
|
||||
Available via the `guru` and `lamdness` overlays:
|
||||
Available via the `guru` repository:
|
||||
|
||||
```bash
|
||||
sudo eselect repository enable guru
|
||||
sudo emerge --sync guru
|
||||
sudo emerge --ask --verbose net-vpn/GlobalProtect-openconnect
|
||||
sudo emerge --ask net-vpn/GlobalProtect-openconnect
|
||||
```
|
||||
|
||||
### NixOS
|
||||
|
||||
This repository includes a flake for NixOS integration.
|
||||
|
||||
#### Installation Steps
|
||||
|
||||
Add the flake input and NixOS module to your `flake.nix`:
|
||||
|
||||
The module builds the package with your NixOS configuration's `pkgs`, so the
|
||||
GlobalProtect GUI and the system use the same Nixpkgs dependency versions.
|
||||
It also enables Polkit and its setuid `pkexec` wrapper for privileged operations.
|
||||
Add the flake to your `flake.nix`:
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
# ... other inputs
|
||||
globalprotect-openconnect.url = "github:yuezk/GlobalProtect-openconnect";
|
||||
};
|
||||
inputs.globalprotect-openconnect.url = "github:yuezk/GlobalProtect-openconnect";
|
||||
|
||||
outputs = { self, nixpkgs, globalprotect-openconnect, ... }:
|
||||
let
|
||||
system = "x86_64-linux"; # or "aarch64-linux" for ARM64
|
||||
hostname = "<your-host>";
|
||||
in {
|
||||
nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
./configuration.nix
|
||||
globalprotect-openconnect.nixosModules.default
|
||||
{
|
||||
programs.globalprotect-openconnect.enable = true;
|
||||
|
||||
environment.systemPackages = [
|
||||
nixpkgs.legacyPackages.${system}.gnomeExtensions.appindicator
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
outputs = { self, nixpkgs, globalprotect-openconnect, ... }: {
|
||||
nixosConfigurations.<hostname> = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
globalprotect-openconnect.nixosModules.default
|
||||
{
|
||||
programs.globalprotect-openconnect.enable = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Apply:
|
||||
Apply changes:
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch
|
||||
loginctl terminate-user "$USER"
|
||||
```
|
||||
|
||||
After logging back in to GNOME, enable AppIndicator support if needed:
|
||||
### Docker
|
||||
|
||||
```bash
|
||||
gnome-extensions enable [email protected]
|
||||
```
|
||||
|
||||
NixOS does not run an imperative package-uninstall hook when a package is
|
||||
removed from the system configuration. Remove an installed replacement VPN
|
||||
script from the app settings before removing the package.
|
||||
|
||||
The `prebuilt` package and NixOS module use the published release pinned in `flake.nix`. Both `prebuilt` and `fromSource` run natively on the host with packaged dependencies and installer paths. The `fromSource` package builds the current flake checkout, including its Git submodules:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
nix build "git+file://$PWD?submodules=1#fromSource"
|
||||
```
|
||||
|
||||
Local source builds require initialized Git submodules and a flake URL with `submodules=1`, as shown above. For a remote source flake, use a Git URL with submodules enabled, such as `git+https://github.com/yuezk/GlobalProtect-openconnect?submodules=1#fromSource`. The `prebuilt` package and NixOS module do not require Git submodules. Build output (`target`, `.build`, and `node_modules`) is excluded from the source input. Updating release asset hashes changes the prebuilt package, independently of source builds.
|
||||
|
||||
Source builds also support downloading either desktop interface on NixOS. The
|
||||
downloader packages the verified Tauri or Native Shell archive with Nix, including
|
||||
its runtime libraries. Each installed interface has a garbage-collection root
|
||||
under `/var/lib/gpclient/nix-gui`, so its dependencies remain available after
|
||||
system upgrades. No Rust compilation or NixOS rebuild is needed for GUI downloads.
|
||||
Prebuilt packages gain this support when their release includes the updated
|
||||
service; adding the flake installer alone does not change older service binaries.
|
||||
|
||||
### Official Docker Image
|
||||
|
||||
The [official Docker image](https://hub.docker.com/r/yuezk/globalprotect-openconnect) provides the CLI tools on Alpine Linux:
|
||||
|
||||
```bash
|
||||
docker pull yuezk/globalprotect-openconnect:<version>
|
||||
```
|
||||
|
||||
Release images are tagged as `vX.Y.Z`, `X.Y.Z`, and `latest`.
|
||||
|
||||
Run it with access to the TUN device:
|
||||
Run the CLI client in an official Alpine container:
|
||||
|
||||
```bash
|
||||
docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \
|
||||
yuezk/globalprotect-openconnect:<version> \
|
||||
connect <portal>
|
||||
```
|
||||
|
||||
For browser authentication in a headless environment, use manual browser authentication:
|
||||
|
||||
```bash
|
||||
docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun \
|
||||
yuezk/globalprotect-openconnect:<version> \
|
||||
yuezk/globalprotect-openconnect:latest \
|
||||
connect <portal> --browser manual
|
||||
```
|
||||
|
||||
On a host with multiple network interfaces, use `--browser-listen` to select the IP address reachable from the browser machine:
|
||||
|
||||
```bash
|
||||
gpclient connect <portal> --browser manual --browser-listen 192.168.107.15
|
||||
```
|
||||
|
||||
On a Linux host, add host networking if the VPN routes should affect the host network namespace:
|
||||
|
||||
```bash
|
||||
docker run --rm -it --network host --cap-add=NET_ADMIN --device=/dev/net/tun \
|
||||
yuezk/globalprotect-openconnect:<version> \
|
||||
connect <portal> --browser manual
|
||||
```
|
||||
|
||||
Without `--network host`, the VPN connection stays inside the container's network namespace. Docker Desktop on macOS and Windows does not make the host use the VPN through `--network host`; run `gpclient` on the host or use a container gateway setup for host traffic.
|
||||
|
||||
The image includes `gpclient` and `gpauth` only. It does not include embedded webview authentication, `gpgui-helper`, or `gpgui`.
|
||||
*(Add `--network host` on Linux if VPN routes should apply to the host network).*
|
||||
|
||||
### Other Distributions
|
||||
|
||||
#### Manual Installation
|
||||
Download `globalprotect-openconnect_${version}_${arch}.bin.tar.xz` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
|
||||
|
||||
1. **Install dependencies:**
|
||||
- WebKitGTK 4.1 (for example, `libwebkit2gtk-4.1-0` on Debian/Ubuntu)
|
||||
- `libsecret`
|
||||
- `libayatana-appindicator` or `libappindicator-gtk3`
|
||||
- polkit (`pkexec`) for GUI-launched VPN connections
|
||||
|
||||
2. **Download and extract:**
|
||||
Download `globalprotect-openconnect_${version}_${arch}.bin.tar.xz` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page:
|
||||
```bash
|
||||
tar -xJf globalprotect-openconnect_${version}_${arch}.bin.tar.xz
|
||||
cd globalprotect-openconnect_${version}
|
||||
```
|
||||
|
||||
3. **Install:**
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
```bash
|
||||
tar -xJf globalprotect-openconnect_*.bin.tar.xz
|
||||
cd globalprotect-openconnect_*
|
||||
sudo make install
|
||||
```
|
||||
|
||||
## Building from Source
|
||||
|
||||
The instructions below build the open-source components on Linux. For FreeBSD and OpenBSD, see [Building from Source on FreeBSD and OpenBSD](./docs/bsd-source-build.md).
|
||||
### Prerequisites (Linux)
|
||||
|
||||
### Method 1: Using DevContainer
|
||||
- [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)
|
||||
- Polkit (`pkexec`) for privileged tunnel setup
|
||||
|
||||
This project includes a DevContainer configuration for Linux development. The repository's `rust-toolchain.toml` selects the Rust toolchain; rustup may need to download it on the first build.
|
||||
*(For FreeBSD and OpenBSD instructions, see [Building from Source on FreeBSD and OpenBSD](docs/bsd-source-build.md)).*
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- [Docker](https://docs.docker.com/get-docker/)
|
||||
- [Visual Studio Code](https://code.visualstudio.com/) (optional, for IDE support)
|
||||
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) (if using VS Code)
|
||||
|
||||
#### Build Steps
|
||||
|
||||
1. **Clone the repository:**
|
||||
```bash
|
||||
git clone https://github.com/yuezk/GlobalProtect-openconnect.git
|
||||
cd GlobalProtect-openconnect
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
2. **Build the DevContainer image:**
|
||||
```bash
|
||||
docker build -t gpoc-devcontainer .devcontainer/
|
||||
```
|
||||
|
||||
3. **Build the project:**
|
||||
|
||||
To build the open-source components, including the GUI helper, run:
|
||||
```bash
|
||||
docker run --privileged --cap-add=NET_ADMIN --device=/dev/net/tun \
|
||||
--tty -v "$(pwd)":/workspace -w /workspace gpoc-devcontainer \
|
||||
bash -c "export PATH=/usr/local/cargo/bin:\$PATH && make build"
|
||||
```
|
||||
To build without the GUI helper run the same command as above, but with `BUILD_GUI_HELPER=0` passed as an argument to `make`.
|
||||
|
||||
4. **Locate build artifacts:**
|
||||
|
||||
The compiled binaries will be available in `target/release/`:
|
||||
- `gpclient` – CLI client
|
||||
- `gpservice` – Background service
|
||||
- `gpauth` – Authentication helper
|
||||
- `gpgui-helper` – GUI helper
|
||||
- `gp-hip-script-installer` – Privileged HIP script installer
|
||||
- `gp-vpnc-script-installer` – Privileged VPN script installer
|
||||
|
||||
The proprietary GP Connect desktop application is distributed separately. Use `INCLUDE_GUI=1` with `make build` to download its matching published Linux build for installation.
|
||||
|
||||
#### Alternative: Using VS Code
|
||||
|
||||
1. Open the project in VS Code
|
||||
2. When prompted, click "Reopen in Container" (or run **Dev Containers: Reopen in Container**)
|
||||
3. Once the container is ready, open a terminal and run:
|
||||
```bash
|
||||
make build
|
||||
```
|
||||
|
||||
### Method 2: Local Development Build
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- [Rust 1.91 or later](https://www.rust-lang.org/tools/install)
|
||||
- [Tauri dependencies](https://tauri.app/start/prerequisites/)
|
||||
- OpenConnect source-build dependencies: `autoconf`, `automake`, `autopoint`/`gettext`, `libtool`, `patch`, `pkg-config`, `libxml2`, `zlib`, `lz4`, `gnutls`, `p11-kit`, `nettle`, and `gmp` development packages
|
||||
- `pkexec` and `gnome-keyring` (or `pam_kwallet` on KDE)
|
||||
- Node.js and pnpm if rebuilding the GUI helper frontend
|
||||
|
||||
#### Build Steps
|
||||
|
||||
1. **Download source code:**
|
||||
|
||||
Download `globalprotect-openconnect-${version}.tar.gz` from the [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page.
|
||||
|
||||
2. **Extract and build:**
|
||||
```bash
|
||||
tar -xzf globalprotect-openconnect-${version}.tar.gz
|
||||
cd globalprotect-openconnect-${version}
|
||||
make build
|
||||
```
|
||||
|
||||
3. **Install:**
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
To stage the files for packaging instead of installing them into the system, use `make install DESTDIR=/absolute/path/to/staging`.
|
||||
|
||||
### Testing Your Build
|
||||
|
||||
Verify the CLI client is working correctly:
|
||||
### Build Steps
|
||||
|
||||
```bash
|
||||
./target/release/gpclient --help
|
||||
git clone --recursive https://github.com/yuezk/GlobalProtect-openconnect.git
|
||||
cd GlobalProtect-openconnect
|
||||
make build
|
||||
sudo make install
|
||||
```
|
||||
|
||||
### Build Options
|
||||
**Build Options:**
|
||||
|
||||
- `BUILD_GUI_HELPER=0` – Skip building and installing the GUI helper
|
||||
- `BUILD_WEBVIEW_AUTH=0` – Build `gpauth` without embedded browser authentication; use an external browser or manual authentication
|
||||
- `INCLUDE_GUI=1` – Download the matching published Linux desktop application for installation
|
||||
- `OFFLINE=1` – Build in offline mode using vendored dependencies
|
||||
- `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_GUI_HELPER=0` – Skip building the helper UI.
|
||||
|
||||
## Frequently Asked Questions
|
||||
## Troubleshooting
|
||||
|
||||
When reporting a problem, follow the [diagnostics collection instructions](docs/diagnostics.md). A standalone script is available for versions without the diagnostics command; you do not need to upgrade first.
|
||||
|
||||
### Q: How do I resolve the "Secure Storage not ready" error?
|
||||
|
||||
Unlock your desktop keyring and ensure the application can access it. On Linux and BSD, check that a keyring service such as GNOME Keyring is installed and running in your desktop session. On macOS, check Keychain access.
|
||||
|
||||
Linux and BSD can use file storage when secure storage is unavailable during initial setup. An existing configuration that uses the keyring still needs access to that keyring.
|
||||
|
||||
See related issues: [#321](https://github.com/yuezk/GlobalProtect-openconnect/issues/321), [#316](https://github.com/yuezk/GlobalProtect-openconnect/issues/316)
|
||||
|
||||
### Q: How do I fix the "cannot open display" error when using CLI?
|
||||
|
||||
Run the client from a terminal in your normal desktop session and use an external browser:
|
||||
|
||||
```bash
|
||||
sudo gpclient connect <portal> --browser
|
||||
```
|
||||
|
||||
See related issue: [#316](https://github.com/yuezk/GlobalProtect-openconnect/issues/316)
|
||||
|
||||
On a headless server, use `--browser manual` and complete authentication from another machine.
|
||||
- **Headless / Remote Login**: When running without a desktop display or over SSH, use `--browser manual`. Open the printed URL in any browser and paste the callback URL back into the terminal.
|
||||
- **Diagnostics**: If you encounter issues, run `gpclient diagnostics` or follow the [diagnostics guide](docs/diagnostics.md) when opening an issue.
|
||||
|
||||
## NetworkManager Integration
|
||||
|
||||
@@ -564,14 +276,10 @@ On a headless server, use `--browser manual` and complete authentication from an
|
||||
|
||||
## Licensing
|
||||
|
||||
### Trial and Pricing
|
||||
- **CLI (`gpclient`)**: Free and open source (GPL-3.0).
|
||||
- **GUI (GP Connect)**: Commercial desktop application with a free trial.
|
||||
|
||||
The **CLI version** is completely free and open source.
|
||||
The **GUI version** is a paid application with a **7-day trial**. Start the trial in the app by verifying your email address with a one-time code. Installing the app alone does not start the trial.
|
||||
|
||||
### Open Source Licenses
|
||||
|
||||
This project consists of multiple components, each with its own license:
|
||||
### Open Source Components
|
||||
|
||||
| Component | Type | License |
|
||||
|-----------|------|---------|
|
||||
|
||||
@@ -23,8 +23,6 @@ serde_json.workspace = true
|
||||
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
||||
compile-time.workspace = true
|
||||
|
||||
home = "0.5.12"
|
||||
|
||||
# webview auth dependencies
|
||||
tauri = { workspace = true, optional = true }
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ fn main() {
|
||||
resolve_commit(&repo_root, &source_commit)
|
||||
);
|
||||
|
||||
#[cfg(all(windows, feature = "webview-auth"))]
|
||||
println!("cargo:rerun-if-changed=icons/windows/icon.ico");
|
||||
|
||||
#[cfg(feature = "webview-auth")]
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
+20
-6
@@ -1,8 +1,8 @@
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use auth::forward_auth_callback;
|
||||
use auth::{BrowserAuthenticator, auth_prelogin};
|
||||
use clap::Parser;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use clap::Subcommand;
|
||||
#[cfg(feature = "webview-auth")]
|
||||
use gpapi::auth::AuthWindowTheme;
|
||||
@@ -49,7 +49,7 @@ See 'gpauth -h' for more information.
|
||||
"
|
||||
)]
|
||||
struct Cli {
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[command(subcommand)]
|
||||
command: Option<CliCommand>,
|
||||
|
||||
@@ -134,7 +134,7 @@ struct Cli {
|
||||
verbose: InfoLevelVerbosity,
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[derive(Subcommand)]
|
||||
enum CliCommand {
|
||||
#[command(hide = true)]
|
||||
@@ -270,9 +270,23 @@ 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(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
if let Some(CliCommand::AuthCallback { callback }) = &cli.command {
|
||||
if let Err(err) = forward_auth_callback(callback).await {
|
||||
eprintln!("Failed to forward authentication callback: {err}");
|
||||
@@ -382,7 +396,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
fn callback_arguments_parse_separately() {
|
||||
let cli = Cli::try_parse_from([
|
||||
"gpauth",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"bundle": {
|
||||
"icon": ["icons/windows/icon.ico"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#![cfg(windows)]
|
||||
|
||||
use auth::AuthCallbackReceiver;
|
||||
use std::{process::Stdio, time::Duration};
|
||||
|
||||
#[tokio::test]
|
||||
async fn callback_command_forwards_between_processes() {
|
||||
let receiver = AuthCallbackReceiver::bind().unwrap();
|
||||
let child = tokio::process::Command::new(env!("CARGO_BIN_EXE_gpauth"))
|
||||
.args([
|
||||
"auth-callback",
|
||||
"globalprotectcallback:cas-as=1&un=windows-fixture&token=callback-command-test",
|
||||
])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.kill_on_drop(true)
|
||||
.spawn()
|
||||
.unwrap();
|
||||
let (data, output) = tokio::time::timeout(Duration::from_secs(10), async {
|
||||
tokio::join!(receiver.receive(), child.wait_with_output())
|
||||
})
|
||||
.await
|
||||
.expect("callback executable did not complete");
|
||||
let output = output.unwrap();
|
||||
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
|
||||
let data = data.unwrap();
|
||||
assert_eq!(data.username(), "windows-fixture");
|
||||
assert_eq!(data.token(), Some("callback-command-test"));
|
||||
}
|
||||
@@ -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]
|
||||
|
||||
+109
-41
@@ -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",
|
||||
@@ -593,3 +633,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());
|
||||
}
|
||||
}
|
||||
@@ -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::*;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -36,6 +36,27 @@ fn login_response() -> String {
|
||||
)
|
||||
}
|
||||
|
||||
async fn read_request(stream: &mut tokio::net::TcpStream) -> String {
|
||||
let mut request = Vec::new();
|
||||
loop {
|
||||
let mut buf = [0; 4096];
|
||||
let count = stream.read(&mut buf).await.unwrap();
|
||||
assert_ne!(count, 0, "Request ended before its body");
|
||||
request.extend_from_slice(&buf[..count]);
|
||||
if let Some(end) = request.windows(4).position(|bytes| bytes == b"\r\n\r\n") {
|
||||
let headers = String::from_utf8_lossy(&request[..end]).to_ascii_lowercase();
|
||||
let length = headers
|
||||
.lines()
|
||||
.find_map(|line| line.strip_prefix("content-length:"))
|
||||
.map(|value| value.trim().parse::<usize>().unwrap())
|
||||
.unwrap_or(0);
|
||||
if request.len() >= end + 4 + length {
|
||||
return String::from_utf8(request).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn gateway(responses: Vec<(&'static str, String)>) -> (String, tokio::task::JoinHandle<Vec<String>>) {
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
let origin = format!("http://{}", listener.local_addr().unwrap());
|
||||
@@ -44,25 +65,7 @@ async fn gateway(responses: Vec<(&'static str, String)>) -> (String, tokio::task
|
||||
let mut requests = Vec::new();
|
||||
for (status, body) in responses {
|
||||
let (mut stream, _) = listener.accept().await.unwrap();
|
||||
let mut request = Vec::new();
|
||||
loop {
|
||||
let mut buf = [0; 4096];
|
||||
let count = stream.read(&mut buf).await.unwrap();
|
||||
assert_ne!(count, 0, "Request ended before its body");
|
||||
request.extend_from_slice(&buf[..count]);
|
||||
if let Some(end) = request.windows(4).position(|bytes| bytes == b"\r\n\r\n") {
|
||||
let headers = String::from_utf8_lossy(&request[..end]).to_ascii_lowercase();
|
||||
let length = headers
|
||||
.lines()
|
||||
.find_map(|line| line.strip_prefix("content-length:"))
|
||||
.map(|value| value.trim().parse::<usize>().unwrap())
|
||||
.unwrap_or(0);
|
||||
if request.len() >= end + 4 + length {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
requests.push(String::from_utf8(request).unwrap());
|
||||
requests.push(read_request(&mut stream).await);
|
||||
stream
|
||||
.write_all(
|
||||
format!(
|
||||
@@ -126,6 +129,154 @@ async fn cached_tunnel_authentication_does_not_require_portal_discovery() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unreachable_gateway_keeps_cached_cookie() {
|
||||
// Nothing listens here: the cached gateway login gets no answer at all.
|
||||
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
let gateway = format!("http://{}", listener.local_addr().unwrap());
|
||||
drop(listener);
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let cache = directory.path().join("cookie.json");
|
||||
let args = TestArgs::parse_from([
|
||||
"test",
|
||||
"http://unavailable-portal.invalid",
|
||||
"--cookie-only",
|
||||
"--cookie-cache",
|
||||
cache.to_str().unwrap(),
|
||||
])
|
||||
.connect;
|
||||
let lock = directory.path().join("client.pid");
|
||||
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
|
||||
let shared = SharedArgs {
|
||||
ignore_tls_errors: true,
|
||||
lock_file: &lock,
|
||||
verbose: &verbose,
|
||||
log_format: LogFormat::Text,
|
||||
};
|
||||
let handler = ConnectHandler::new(&args, &shared);
|
||||
cookie_store::save(
|
||||
&cache,
|
||||
&StoredCookie::new(
|
||||
args.server.clone(),
|
||||
"alice".into(),
|
||||
handler.os_profile.borrow().host_identity().host_id().into(),
|
||||
gateway,
|
||||
AuthCookieCredential::new("alice", "portal-cookie", ""),
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(handler.handle_impl().await.is_err());
|
||||
assert!(
|
||||
cache.exists(),
|
||||
"a login that got no answer must not delete the cookie cache"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_closing_without_response_keeps_cached_cookie() {
|
||||
closed_connection_keeps_cached_cookie(false, false).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn portal_closing_without_response_keeps_cached_cookie() {
|
||||
closed_connection_keeps_cached_cookie(true, false).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn partial_responses_keep_cached_cookie() {
|
||||
closed_connection_keeps_cached_cookie(false, true).await;
|
||||
closed_connection_keeps_cached_cookie(true, true).await;
|
||||
}
|
||||
|
||||
async fn closed_connection_keeps_cached_cookie(portal_discovery: bool, partial_body: bool) {
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
let origin = format!("http://{}", listener.local_addr().unwrap());
|
||||
let worker = tokio::spawn(async move {
|
||||
tokio::time::timeout(Duration::from_secs(5), async move {
|
||||
if portal_discovery {
|
||||
let (mut stream, _) = listener.accept().await.unwrap();
|
||||
assert!(read_request(&mut stream).await.contains("/global-protect/prelogin.esp"));
|
||||
let body = "<prelogin-response><status>Success</status></prelogin-response>";
|
||||
stream
|
||||
.write_all(
|
||||
format!(
|
||||
"HTTP/1.1 200 OK\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{body}",
|
||||
body.len()
|
||||
)
|
||||
.as_bytes(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
let (mut stream, _) = listener.accept().await.unwrap();
|
||||
let request = read_request(&mut stream).await;
|
||||
if partial_body {
|
||||
stream
|
||||
.write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 100\r\n\r\n<response>")
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
request
|
||||
})
|
||||
.await
|
||||
.expect("Connection-closing fixture timed out")
|
||||
});
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let cache = directory.path().join("cookie.json");
|
||||
let args = TestArgs::parse_from([
|
||||
"test",
|
||||
&origin,
|
||||
"--cookie-only",
|
||||
"--cookie-cache",
|
||||
cache.to_str().unwrap(),
|
||||
])
|
||||
.connect;
|
||||
let lock = directory.path().join("client.pid");
|
||||
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
|
||||
let shared = SharedArgs {
|
||||
ignore_tls_errors: true,
|
||||
lock_file: &lock,
|
||||
verbose: &verbose,
|
||||
log_format: LogFormat::Text,
|
||||
};
|
||||
let handler = ConnectHandler::new(&args, &shared);
|
||||
cookie_store::save(
|
||||
&cache,
|
||||
&StoredCookie::new(
|
||||
args.server.clone(),
|
||||
"alice".into(),
|
||||
handler.os_profile.borrow().host_identity().host_id().into(),
|
||||
origin.clone(),
|
||||
AuthCookieCredential::new("alice", "portal-cookie", ""),
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
let result = if portal_discovery {
|
||||
handler.connect_portal_with_prelogin(&origin).await
|
||||
} else {
|
||||
handler.handle_impl().await
|
||||
};
|
||||
let error = result.unwrap_err();
|
||||
let Some(gpapi::error::PortalError::NetworkError(network)) = error.downcast_ref() else {
|
||||
panic!("Expected a network error, got {error:?}");
|
||||
};
|
||||
if partial_body {
|
||||
assert!(network.is_body() || network.is_decode());
|
||||
} else {
|
||||
assert!(network.is_request());
|
||||
}
|
||||
assert!(!network.is_connect());
|
||||
assert!(!network.is_timeout());
|
||||
assert!(cache.exists(), "an unanswered request must not delete the cookie cache");
|
||||
let request = worker.await.unwrap();
|
||||
assert!(request.contains("portal-cookie"));
|
||||
if portal_discovery {
|
||||
assert!(request.starts_with("POST /global-protect/getconfig.esp "));
|
||||
} else {
|
||||
assert!(request.starts_with("POST /ssl-vpn/login.esp "));
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn internal_tunnel_keeps_gateway_authentication_after_portal_cookie_rejection() {
|
||||
let (origin, worker) = gateway(vec![
|
||||
@@ -511,3 +662,62 @@ printf '%s\n' '{"success":{"username":"alice","preloginCookie":"new-cookie"}}'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unsupported_and_malformed_identities_fail_before_password_prompt_or_network_connection() {
|
||||
use gpapi::utils::request::RequestIdentityError;
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
let malformed = directory.path().join("invalid.p12");
|
||||
std::fs::write(&malformed, b"not a certificate archive").unwrap();
|
||||
let fixtures =
|
||||
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../crates/gpapi/tests/files/client-identity");
|
||||
|
||||
for (certificate, key, expected) in [
|
||||
(
|
||||
fixtures.join("rsa-pss-cert.pem"),
|
||||
Some(fixtures.join("rsa-pss.pem")),
|
||||
"algorithm",
|
||||
),
|
||||
(fixtures.join("legacy-RC2-128.p12"), None, "encryption"),
|
||||
(malformed, None, "malformed"),
|
||||
] {
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||
let server = format!("https://{}", listener.local_addr().unwrap());
|
||||
let mut argv = vec![
|
||||
"test".to_owned(),
|
||||
server,
|
||||
"--as-gateway".to_owned(),
|
||||
"--certificate".to_owned(),
|
||||
certificate.to_string_lossy().into_owned(),
|
||||
];
|
||||
if let Some(key) = key {
|
||||
argv.extend(["--sslkey".to_owned(), key.to_string_lossy().into_owned()]);
|
||||
}
|
||||
let args = TestArgs::parse_from(argv).connect;
|
||||
let lock = directory.path().join("client.pid");
|
||||
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
|
||||
let shared = SharedArgs {
|
||||
ignore_tls_errors: false,
|
||||
lock_file: &lock,
|
||||
verbose: &verbose,
|
||||
log_format: LogFormat::Text,
|
||||
};
|
||||
let handler = ConnectHandler::new(&args, &shared);
|
||||
let error = tokio::time::timeout(Duration::from_secs(2), handler.handle_attempt())
|
||||
.await
|
||||
.expect("identity failure must not wait for a password or server")
|
||||
.unwrap_err();
|
||||
match (expected, error.downcast_ref::<RequestIdentityError>()) {
|
||||
("algorithm", Some(RequestIdentityError::UnsupportedKeyAlgorithm("RSA-PSS"))) => {}
|
||||
("encryption", Some(RequestIdentityError::UnsupportedEncryption)) => {}
|
||||
("malformed", Some(RequestIdentityError::InvalidPkcs12(_) | RequestIdentityError::InvalidCertificate)) => {}
|
||||
_ => panic!("{expected}: unexpected failure {error:#}"),
|
||||
}
|
||||
assert!(
|
||||
tokio::time::timeout(Duration::from_millis(20), listener.accept())
|
||||
.await
|
||||
.is_err(),
|
||||
"{expected}: local identity failure must precede network access"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -101,6 +104,11 @@ impl ConnectHandler<'_> {
|
||||
{
|
||||
return Some(Err(error));
|
||||
}
|
||||
// A failed request does not establish that the cookie was rejected.
|
||||
if is_network_error(&error) {
|
||||
warn!("Cached gateway authentication request failed: {error}");
|
||||
return Some(Err(error));
|
||||
}
|
||||
cookie_store::clear(&path);
|
||||
warn!("Cached gateway authentication failed: {error}");
|
||||
return None;
|
||||
@@ -447,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)
|
||||
@@ -482,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 {
|
||||
@@ -506,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();
|
||||
@@ -518,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(());
|
||||
|
||||
@@ -531,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 => {
|
||||
@@ -545,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
|
||||
@@ -569,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;
|
||||
@@ -584,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());
|
||||
@@ -600,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");
|
||||
@@ -621,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());
|
||||
@@ -630,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 = ()>,
|
||||
@@ -673,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();
|
||||
|
||||
@@ -689,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()
|
||||
@@ -705,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::*;
|
||||
|
||||
@@ -785,9 +789,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn explicit_hip_user_resolves_to_the_selected_account() {
|
||||
let current = uzers::get_user_by_uid(uzers::get_effective_uid()).unwrap();
|
||||
let name = current.name().to_string_lossy().into_owned();
|
||||
assert_eq!(get_uid(&Some(name)).unwrap(), Some(current.uid()));
|
||||
// Build sandboxes may use a UID without an entry in the user database.
|
||||
assert_eq!(get_uid(&Some("root".to_string())).unwrap(), Some(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -831,3 +834,11 @@ mod tests {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A failed request says nothing about whether a cached cookie is still valid.
|
||||
pub(super) fn is_network_error(error: &anyhow::Error) -> bool {
|
||||
matches!(
|
||||
error.downcast_ref::<gpapi::error::PortalError>(),
|
||||
Some(gpapi::error::PortalError::NetworkError(_))
|
||||
)
|
||||
}
|
||||
@@ -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,31 +120,23 @@ 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()?;
|
||||
if matches!(source.as_ref(), openconnect::HipSource::Disabled) {
|
||||
return gphip::generate_identity_report(&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(),
|
||||
return gphip::generate_identity_report(
|
||||
&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(),
|
||||
},
|
||||
},
|
||||
})
|
||||
control,
|
||||
)
|
||||
.map_err(std::io::Error::other);
|
||||
}
|
||||
source.collect(
|
||||
@@ -162,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();
|
||||
@@ -201,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."),
|
||||
@@ -251,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),
|
||||
@@ -273,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(()))
|
||||
}
|
||||
}
|
||||
@@ -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}");
|
||||
@@ -186,6 +201,8 @@ impl<'a> ConnectHandler<'a> {
|
||||
match identity_error {
|
||||
RequestIdentityError::UnsupportedEncryption
|
||||
| RequestIdentityError::UnsupportedKeyFormat
|
||||
| RequestIdentityError::UnsupportedKeyAlgorithm(_)
|
||||
| RequestIdentityError::KeyMismatch
|
||||
| RequestIdentityError::InvalidKey
|
||||
| RequestIdentityError::InvalidCertificate
|
||||
| RequestIdentityError::IncompletePkcs12
|
||||
@@ -206,8 +223,12 @@ impl<'a> ConnectHandler<'a> {
|
||||
return Ok(());
|
||||
}
|
||||
RequestIdentityError::NoPassphrase(cert_type) | RequestIdentityError::DecryptError(cert_type) => {
|
||||
let message = format!("Enter the {} passphrase:", cert_type);
|
||||
let password = Password::new(&message)
|
||||
let message = if *cert_type == "PKCS#12" {
|
||||
"Enter the certificate file password:"
|
||||
} else {
|
||||
"Enter the private key password:"
|
||||
};
|
||||
let password = Password::new(message)
|
||||
.without_confirmation()
|
||||
.with_display_mode(PasswordDisplayMode::Masked)
|
||||
.prompt()?;
|
||||
@@ -286,6 +307,11 @@ impl<'a> ConnectHandler<'a> {
|
||||
Ok(config) => Some((cred, config)),
|
||||
Err(error) => {
|
||||
self.check_cancelled()?;
|
||||
// A failed request does not establish that the cookie was rejected.
|
||||
if gateway::is_network_error(&error) {
|
||||
warn!("Cached portal authentication request failed: {error}");
|
||||
return Err(error);
|
||||
}
|
||||
warn!("Cached portal authentication failed: {error}");
|
||||
self.clear_cookie_cache();
|
||||
None
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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]
|
||||
|
||||
@@ -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,4 +1,4 @@
|
||||
#![cfg(not(target_os = "macos"))]
|
||||
#![cfg(all(unix, not(target_os = "macos")))]
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![cfg(unix)]
|
||||
|
||||
use std::{os::unix::fs::PermissionsExt, process::Stdio, time::Duration};
|
||||
|
||||
use tokio::process::Command;
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
Vendored
+1
-1
@@ -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>
|
||||
|
||||
@@ -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]"
|
||||
}
|
||||
Generated
+280
-200
@@ -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
|
||||
|
||||
@@ -23,21 +23,31 @@ 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
|
||||
tempfile.workspace = true
|
||||
getrandom = "0.4"
|
||||
mac_address = "1.2.1"
|
||||
|
||||
[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"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
mac_address = "1.2.1"
|
||||
|
||||
[dev-dependencies]
|
||||
openssl.workspace = true
|
||||
tokio-tungstenite.workspace = true
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
[target.'cfg(any(target_os = "macos", windows))'.dependencies]
|
||||
gpvpnc = { path = "../../crates/gpvpnc" }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
file-rotate = "0.8.0"
|
||||
windows-service = "0.8.1"
|
||||
windows-sys = { version = "0.61", features = ["Win32_System_Pipes"] }
|
||||
@@ -6,7 +6,7 @@ use std::time::Duration;
|
||||
|
||||
use anyhow::{Context, bail};
|
||||
use clap::Parser;
|
||||
use common::constants::GP_SERVICE_LOCK_FILE;
|
||||
use common::paths::service_lock_file;
|
||||
use gpapi::clap::InfoLevelVerbosity;
|
||||
use gpapi::logger;
|
||||
#[cfg(debug_assertions)]
|
||||
@@ -25,14 +25,7 @@ use crate::{
|
||||
request_dispatcher::RequestDispatcher, session_registry::SessionRegistry, vpn_task::VpnTask, ws_server::WsServer,
|
||||
};
|
||||
|
||||
const VERSION: &str = concat!(
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
" (",
|
||||
env!("GPSERVICE_GIT_COMMIT"),
|
||||
" ",
|
||||
compile_time::date_str!(),
|
||||
")"
|
||||
);
|
||||
use crate::VERSION;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
struct RedactingMacosLogger {
|
||||
@@ -271,7 +264,7 @@ impl Cli {
|
||||
return Ok(dev_service_lock_file_path(socket));
|
||||
}
|
||||
|
||||
Ok(PathBuf::from(GP_SERVICE_LOCK_FILE))
|
||||
Ok(service_lock_file())
|
||||
}
|
||||
|
||||
fn init_logger(&self) -> Arc<Redaction> {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
use clap::Parser;
|
||||
use gpapi::clap::InfoLevelVerbosity;
|
||||
#[derive(Parser)]
|
||||
#[command(version = crate::VERSION)]
|
||||
struct Cli {
|
||||
#[command(flatten)]
|
||||
verbose: InfoLevelVerbosity,
|
||||
}
|
||||
pub fn run() -> anyhow::Result<()> {
|
||||
let cli = Cli::parse();
|
||||
crate::windows_service::dispatch(cli.verbose.log_level_filter().to_level().unwrap_or(log::Level::Info))
|
||||
}
|
||||
@@ -75,7 +75,7 @@ impl DesktopClient {
|
||||
loop {
|
||||
match self.read_control().await? {
|
||||
Some(DESKTOP_GUI_INSTALLER) => {
|
||||
self.write_all(&[u8::from(crate::request_dispatcher::gui_installer().is_some())]).await?;
|
||||
self.write_all(&[u8::from(crate::gui_installation::installer().is_some())]).await?;
|
||||
}
|
||||
Some(DESKTOP_SWITCH_BEGIN) => {
|
||||
ensure!(pending.is_none(), "A GUI switch is already pending");
|
||||
@@ -299,10 +299,7 @@ mod tests {
|
||||
let mut reader = reader;
|
||||
let mut capability = [0];
|
||||
reader.read_exact(&mut capability).unwrap();
|
||||
assert_eq!(
|
||||
capability[0],
|
||||
u8::from(crate::request_dispatcher::gui_installer().is_some())
|
||||
);
|
||||
assert_eq!(capability[0], u8::from(crate::gui_installation::installer().is_some()));
|
||||
reader
|
||||
})
|
||||
.await
|
||||
|
||||
@@ -366,7 +366,7 @@ mod tests {
|
||||
r#"{"version":1,"anchor":{"hardware_id":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","source":1}}"#
|
||||
);
|
||||
|
||||
for source in [0, 4] {
|
||||
for source in [0, u8::MAX] {
|
||||
let json = serde_json::json!({
|
||||
"version": 1,
|
||||
"anchor": {
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
use gpapi::utils::checksum::verify_checksum;
|
||||
use std::{
|
||||
fs::{self, File, OpenOptions, Permissions},
|
||||
io::{BufReader, Read, Write},
|
||||
os::unix::fs::{OpenOptionsExt, PermissionsExt},
|
||||
path::Path,
|
||||
};
|
||||
use tar::Archive;
|
||||
use tempfile::NamedTempFile;
|
||||
use xz2::read::XzDecoder;
|
||||
const MAX_GUI_ARCHIVE_SIZE: u64 = 256 * 1024 * 1024;
|
||||
const MAX_GUI_ARCHIVE_CONTENT_SIZE: u64 = 512 * 1024 * 1024;
|
||||
const MAX_GUI_BINARY_SIZE: u64 = 256 * 1024 * 1024;
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum InstallError {
|
||||
Checksum(anyhow::Error),
|
||||
Install(anyhow::Error),
|
||||
}
|
||||
|
||||
pub(crate) fn installer() -> Option<std::path::PathBuf> {
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|executable| {
|
||||
executable
|
||||
.parent()?
|
||||
.parent()
|
||||
.map(|prefix| prefix.join("libexec/gpclient/gp-gui-installer"))
|
||||
})
|
||||
.filter(|path| path.is_file())
|
||||
}
|
||||
|
||||
pub(crate) fn install(src: &Path, checksum: &str, target: &Path) -> Result<(), InstallError> {
|
||||
let installer = installer();
|
||||
install_gui_with_installer(src, checksum, target, installer.as_deref())
|
||||
}
|
||||
|
||||
fn install_gui_with_installer(
|
||||
src: &Path,
|
||||
checksum: &str,
|
||||
target: &Path,
|
||||
installer: Option<&Path>,
|
||||
) -> Result<(), InstallError> {
|
||||
let Some(dir) = target.parent() else {
|
||||
return Err(InstallError::Install(anyhow::anyhow!(
|
||||
"Failed to get parent directory of GUI binary"
|
||||
)));
|
||||
};
|
||||
fs::create_dir_all(dir).map_err(|err| InstallError::Install(err.into()))?;
|
||||
|
||||
let staged_archive = stage_gui_archive(src, dir)?;
|
||||
let archive_path = staged_archive.path().to_string_lossy();
|
||||
verify_checksum(&archive_path, checksum).map_err(InstallError::Checksum)?;
|
||||
|
||||
// A package may need to prepare downloaded executables for its runtime.
|
||||
// Resolve this helper beside the running service, never from the request or PATH.
|
||||
if let Some(installer) = installer {
|
||||
let status = std::process::Command::new(installer)
|
||||
.arg(staged_archive.path())
|
||||
.arg(checksum)
|
||||
.arg(target)
|
||||
.stdin(std::process::Stdio::null())
|
||||
.stdout(std::process::Stdio::null())
|
||||
.status()
|
||||
.map_err(|err| InstallError::Install(err.into()))?;
|
||||
return if status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(InstallError::Install(anyhow::anyhow!(
|
||||
"GUI package installation failed: {status}"
|
||||
)))
|
||||
};
|
||||
}
|
||||
|
||||
let tar = XzDecoder::new(BufReader::new(
|
||||
staged_archive
|
||||
.reopen()
|
||||
.map_err(|err| InstallError::Install(err.into()))?,
|
||||
))
|
||||
.take(MAX_GUI_ARCHIVE_CONTENT_SIZE);
|
||||
let mut archive = Archive::new(tar);
|
||||
let binary_name = target.file_name().and_then(|name| name.to_str()).unwrap_or("gpgui");
|
||||
let file = extract_gui_binary(&mut archive, dir, binary_name)?;
|
||||
file
|
||||
.as_file()
|
||||
.set_permissions(Permissions::from_mode(0o755))
|
||||
.map_err(|err| InstallError::Install(err.into()))?;
|
||||
file
|
||||
.as_file()
|
||||
.sync_all()
|
||||
.map_err(|err| InstallError::Install(err.into()))?;
|
||||
file.persist(&target).map_err(|err| InstallError::Install(err.into()))?;
|
||||
File::open(dir)
|
||||
.and_then(|directory| directory.sync_all())
|
||||
.map_err(|err| InstallError::Install(err.into()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stage_gui_archive(src: &Path, dir: &Path) -> Result<NamedTempFile, InstallError> {
|
||||
let mut source = OpenOptions::new()
|
||||
.read(true)
|
||||
.custom_flags(nix::libc::O_NONBLOCK | nix::libc::O_NOFOLLOW)
|
||||
.open(src)
|
||||
.map_err(|err| InstallError::Install(err.into()))?;
|
||||
let metadata = source.metadata().map_err(|err| InstallError::Install(err.into()))?;
|
||||
let source_size = metadata.len();
|
||||
if !metadata.file_type().is_file() || source_size == 0 || source_size > MAX_GUI_ARCHIVE_SIZE {
|
||||
return Err(InstallError::Install(anyhow::anyhow!(
|
||||
"GUI update archive must be a non-empty regular file no larger than {MAX_GUI_ARCHIVE_SIZE} bytes"
|
||||
)));
|
||||
}
|
||||
|
||||
let mut staged = NamedTempFile::new_in(dir).map_err(|err| InstallError::Install(err.into()))?;
|
||||
let copied = std::io::copy(&mut (&mut source).take(MAX_GUI_ARCHIVE_SIZE + 1), &mut staged)
|
||||
.map_err(|err| InstallError::Install(err.into()))?;
|
||||
if copied != source_size {
|
||||
return Err(InstallError::Install(anyhow::anyhow!(
|
||||
"GUI update archive changed while it was being read"
|
||||
)));
|
||||
}
|
||||
staged.flush().map_err(|err| InstallError::Install(err.into()))?;
|
||||
staged
|
||||
.as_file()
|
||||
.sync_all()
|
||||
.map_err(|err| InstallError::Install(err.into()))?;
|
||||
Ok(staged)
|
||||
}
|
||||
|
||||
fn extract_gui_binary<R: Read>(
|
||||
archive: &mut Archive<R>,
|
||||
dir: &Path,
|
||||
binary_name: &str,
|
||||
) -> Result<NamedTempFile, InstallError> {
|
||||
for entry in archive.entries().map_err(|err| InstallError::Install(err.into()))? {
|
||||
let mut entry = entry.map_err(|err| InstallError::Install(err.into()))?;
|
||||
let is_gui = entry
|
||||
.path()
|
||||
.map_err(|err| InstallError::Install(err.into()))?
|
||||
.file_name()
|
||||
.is_some_and(|name| name == binary_name);
|
||||
if is_gui && entry.header().entry_type().is_file() {
|
||||
let declared_size = entry.size();
|
||||
if declared_size == 0 || declared_size > MAX_GUI_BINARY_SIZE {
|
||||
return Err(InstallError::Install(anyhow::anyhow!(
|
||||
"GUI binary must be non-empty and no larger than {MAX_GUI_BINARY_SIZE} bytes"
|
||||
)));
|
||||
}
|
||||
let mut file = NamedTempFile::new_in(dir).map_err(|err| InstallError::Install(err.into()))?;
|
||||
let copied = std::io::copy(&mut entry, &mut file).map_err(|err| InstallError::Install(err.into()))?;
|
||||
if copied != declared_size {
|
||||
return Err(InstallError::Install(anyhow::anyhow!(
|
||||
"GUI binary size does not match its archive header"
|
||||
)));
|
||||
}
|
||||
file.flush().map_err(|err| InstallError::Install(err.into()))?;
|
||||
return Ok(file);
|
||||
}
|
||||
}
|
||||
Err(InstallError::Install(anyhow::anyhow!(
|
||||
"GUI update archive does not contain a non-empty regular {binary_name} file"
|
||||
)))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{io::Cursor, os::unix::fs::PermissionsExt};
|
||||
|
||||
use tar::{Builder, EntryType, Header};
|
||||
use xz2::write::XzEncoder;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn archive_with_entry(entry_type: EntryType, contents: &[u8]) -> Vec<u8> {
|
||||
let mut data = Vec::new();
|
||||
{
|
||||
let mut builder = Builder::new(&mut data);
|
||||
let mut header = Header::new_gnu();
|
||||
header.set_entry_type(entry_type);
|
||||
header.set_size(contents.len() as u64);
|
||||
header.set_mode(0o755);
|
||||
header.set_cksum();
|
||||
builder.append_data(&mut header, "gpgui", contents).unwrap();
|
||||
builder.finish().unwrap();
|
||||
}
|
||||
data
|
||||
}
|
||||
|
||||
fn compressed_gui_archive(contents: &[u8]) -> NamedTempFile {
|
||||
let tar = archive_with_entry(EntryType::Regular, contents);
|
||||
let mut encoder = XzEncoder::new(Vec::new(), 6);
|
||||
encoder.write_all(&tar).unwrap();
|
||||
let compressed = encoder.finish().unwrap();
|
||||
let mut archive = NamedTempFile::new().unwrap();
|
||||
archive.write_all(&compressed).unwrap();
|
||||
archive.flush().unwrap();
|
||||
archive
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_non_file_and_empty_gui_entries() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
for (entry_type, contents) in [(EntryType::Directory, &[][..]), (EntryType::Regular, &[][..])] {
|
||||
let data = archive_with_entry(entry_type, contents);
|
||||
let mut archive = Archive::new(Cursor::new(data));
|
||||
assert!(extract_gui_binary(&mut archive, output.path(), "gpgui").is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extracts_non_empty_regular_gui_entry() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let data = archive_with_entry(EntryType::Regular, b"gui binary");
|
||||
let mut archive = Archive::new(Cursor::new(data));
|
||||
let extracted = extract_gui_binary(&mut archive, output.path(), "gpgui").unwrap();
|
||||
let contents = std::fs::read(extracted.path()).unwrap();
|
||||
assert_eq!(contents, b"gui binary");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_invalid_archive_sources() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
assert!(stage_gui_archive(output.path(), output.path()).is_err());
|
||||
|
||||
let oversized = output.path().join("oversized.tar.xz");
|
||||
File::create(&oversized)
|
||||
.unwrap()
|
||||
.set_len(MAX_GUI_ARCHIVE_SIZE + 1)
|
||||
.unwrap();
|
||||
assert!(stage_gui_archive(&oversized, output.path()).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_oversized_gui_entry() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let mut header = Header::new_gnu();
|
||||
header.set_entry_type(EntryType::Regular);
|
||||
header.set_size(MAX_GUI_BINARY_SIZE + 1);
|
||||
header.set_mode(0o755);
|
||||
header.set_path("gpgui").unwrap();
|
||||
header.set_cksum();
|
||||
let mut data = header.as_bytes().to_vec();
|
||||
data.resize(512 * 3, 0);
|
||||
|
||||
let mut archive = Archive::new(Cursor::new(data));
|
||||
assert!(extract_gui_binary(&mut archive, output.path(), "gpgui").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installs_gui_at_the_supplied_target() {
|
||||
let archive = compressed_gui_archive(b"gui binary");
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpclient/gpgui");
|
||||
|
||||
install(archive.path(), &checksum, &target).unwrap();
|
||||
|
||||
assert_eq!(std::fs::read(&target).unwrap(), b"gui binary");
|
||||
assert_eq!(std::fs::metadata(&target).unwrap().permissions().mode() & 0o777, 0o755);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installs_nsh_beside_tauri_without_replacing_it() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let tauri = output.path().join("gpgui");
|
||||
std::fs::write(&tauri, b"tauri").unwrap();
|
||||
let mut encoder = XzEncoder::new(Vec::new(), 1);
|
||||
{
|
||||
let mut archive = Builder::new(&mut encoder);
|
||||
let mut header = Header::new_gnu();
|
||||
header.set_size(3);
|
||||
header.set_mode(0o755);
|
||||
header.set_cksum();
|
||||
archive
|
||||
.append_data(&mut header, "gpgui-nsh_3.2.0/gpgui-nsh", &b"nsh"[..])
|
||||
.unwrap();
|
||||
archive.finish().unwrap();
|
||||
}
|
||||
let mut archive = NamedTempFile::new().unwrap();
|
||||
archive.write_all(&encoder.finish().unwrap()).unwrap();
|
||||
archive.flush().unwrap();
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let nsh = output.path().join("gpgui-nsh");
|
||||
install(archive.path(), &checksum, &nsh).unwrap();
|
||||
assert_eq!(std::fs::read(nsh).unwrap(), b"nsh");
|
||||
assert_eq!(std::fs::read(tauri).unwrap(), b"tauri");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn checksum_failure_preserves_the_existing_gui() {
|
||||
let archive = compressed_gui_archive(b"replacement");
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpclient/gpgui");
|
||||
std::fs::create_dir_all(target.parent().unwrap()).unwrap();
|
||||
std::fs::write(&target, b"existing").unwrap();
|
||||
|
||||
assert!(install(archive.path(), "invalid", &target).is_err());
|
||||
assert_eq!(std::fs::read(target).unwrap(), b"existing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn package_installer_receives_a_verified_staged_archive() {
|
||||
let archive = compressed_gui_archive(b"gui binary");
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpgui-nsh");
|
||||
let installer = output.path().join("installer");
|
||||
std::fs::write(
|
||||
&installer,
|
||||
"#!/bin/sh\nset -eu\ntest -f \"$1\"\nprintf '%s' \"$2\" > \"$3\"\n",
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
|
||||
|
||||
assert!(install_gui_with_installer(archive.path(), "invalid", &target, Some(&installer)).is_err());
|
||||
assert!(!target.exists());
|
||||
install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).unwrap();
|
||||
assert_eq!(std::fs::read_to_string(target).unwrap(), checksum);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn package_installation_failure_preserves_the_existing_gui() {
|
||||
let archive = compressed_gui_archive(b"replacement");
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpgui");
|
||||
std::fs::write(&target, b"existing").unwrap();
|
||||
let installer = output.path().join("installer");
|
||||
std::fs::write(&installer, "#!/bin/sh\nexit 1\n").unwrap();
|
||||
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
|
||||
|
||||
assert!(install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).is_err());
|
||||
assert_eq!(std::fs::read(target).unwrap(), b"existing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires GP_TEST_GUI_BINARY pointing to a built gpgui"]
|
||||
fn installs_single_gui_binary_for_fresh_and_upgrade_downloads() {
|
||||
let binary = std::fs::read(std::env::var("GP_TEST_GUI_BINARY").expect("GP_TEST_GUI_BINARY")).unwrap();
|
||||
let archive = compressed_gui_archive(&binary);
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let output = std::env::var_os("GP_TEST_GUI_INSTALL_DIR")
|
||||
.map(std::path::PathBuf::from)
|
||||
.unwrap_or_else(|| temporary.path().to_owned());
|
||||
std::fs::create_dir_all(&output).unwrap();
|
||||
std::fs::set_permissions(&output, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
let target = output.join("gpclient/gpgui");
|
||||
for upgrade in [false, true] {
|
||||
if upgrade {
|
||||
std::fs::write(&target, b"old GUI").unwrap();
|
||||
}
|
||||
install(archive.path(), &checksum, &target).unwrap();
|
||||
assert_eq!(std::fs::read_dir(target.parent().unwrap()).unwrap().count(), 1);
|
||||
assert_eq!(std::fs::read(&target).unwrap(), binary);
|
||||
let result = std::process::Command::new(&target).arg("--version").output().unwrap();
|
||||
assert!(result.status.success(), "{}", String::from_utf8_lossy(&result.stderr));
|
||||
assert!(String::from_utf8_lossy(&result.stdout).contains(env!("CARGO_PKG_VERSION")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ impl HipPreviews {
|
||||
})
|
||||
.await;
|
||||
let result = match generated {
|
||||
Ok(Ok(xml)) => preview_result(®istry, session_id, xml),
|
||||
Ok(Ok(report)) => preview_result(®istry, session_id, report),
|
||||
Ok(Err(error)) => {
|
||||
log::warn!("HIP preview failed: {error:#}");
|
||||
ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview failed")
|
||||
@@ -132,17 +132,20 @@ impl HipPreviews {
|
||||
}
|
||||
}
|
||||
|
||||
fn preview_result(registry: &SessionRegistry, session_id: Uuid, xml: String) -> ServiceResult {
|
||||
let result = registry.store_hip_preview(session_id, xml).and_then(|preview_id| {
|
||||
registry
|
||||
.hip_preview_chunk(session_id, preview_id, 0)
|
||||
.map(|(xml, complete)| ServiceResult::HipPreviewChunk {
|
||||
preview_id: preview_id.to_string(),
|
||||
offset: 0,
|
||||
xml,
|
||||
complete,
|
||||
})
|
||||
});
|
||||
fn preview_result(registry: &SessionRegistry, session_id: Uuid, report: gpapi::hip::HipReport) -> ServiceResult {
|
||||
let result = registry
|
||||
.store_hip_preview(session_id, report.xml)
|
||||
.and_then(|preview_id| {
|
||||
registry
|
||||
.hip_preview_chunk(session_id, preview_id, 0)
|
||||
.map(|(xml, complete)| ServiceResult::HipPreviewChunk {
|
||||
preview_id: preview_id.to_string(),
|
||||
offset: 0,
|
||||
xml,
|
||||
complete,
|
||||
windows_updates: report.windows_updates,
|
||||
})
|
||||
});
|
||||
result.unwrap_or_else(|_| ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview is unavailable"))
|
||||
}
|
||||
|
||||
@@ -152,7 +155,7 @@ fn generate(
|
||||
desktop_uid: Option<u32>,
|
||||
identity: HostIdentity,
|
||||
cancellation: CancellationToken,
|
||||
) -> anyhow::Result<String> {
|
||||
) -> anyhow::Result<gpapi::hip::HipReport> {
|
||||
ensure!(request.client_version.len() <= 64, "Invalid HIP client version");
|
||||
ensure!(
|
||||
request.host_id.as_ref().is_none_or(|id| id.len() <= 256),
|
||||
@@ -188,7 +191,15 @@ fn generate(
|
||||
};
|
||||
let xml = match &request.source {
|
||||
HipSource::Disabled => bail!("HIP is disabled"),
|
||||
HipSource::Generated => crate::hip_source::generate(&profile, None, &input, &check, true)?,
|
||||
HipSource::Generated => {
|
||||
return gphip::generate_report_details(
|
||||
&gphip::ReportInput {
|
||||
profile,
|
||||
context: gphip::ReportContext::Preview,
|
||||
},
|
||||
&check,
|
||||
);
|
||||
}
|
||||
HipSource::Edited { .. } => {
|
||||
let xml = edited_report.context("Edited HIP report is unavailable")?;
|
||||
crate::hip_source::generate(&profile, Some(&xml), &input, &check, true)?
|
||||
@@ -204,7 +215,10 @@ fn generate(
|
||||
}
|
||||
};
|
||||
check()?;
|
||||
Ok(xml)
|
||||
Ok(gpapi::hip::HipReport {
|
||||
xml,
|
||||
windows_updates: None,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::{fs, io, os::unix::fs::PermissionsExt, path::PathBuf, sync::Arc};
|
||||
use std::{io, sync::Arc};
|
||||
|
||||
use anyhow::{Context, ensure};
|
||||
use gpapi::{
|
||||
@@ -6,7 +6,17 @@ use gpapi::{
|
||||
os_profile::{ClientOs, HostIdentity, OsProfile, OsProfileBuilder},
|
||||
};
|
||||
use gphip::{ReportContext, ReportInput};
|
||||
use openconnect::{HipRequest, HipScript, HipScriptEnvironment};
|
||||
use openconnect::HipRequest;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use openconnect::HipScript;
|
||||
#[cfg(unix)]
|
||||
#[path = "hip_source/unix.rs"]
|
||||
mod scripts;
|
||||
#[cfg(windows)]
|
||||
#[path = "hip_source/windows.rs"]
|
||||
mod scripts;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use scripts::script_environment;
|
||||
|
||||
pub(crate) struct HipExecution {
|
||||
pub source: openconnect::HipSource,
|
||||
@@ -36,7 +46,7 @@ impl HipApproval {
|
||||
pub(crate) fn resolve(
|
||||
source: &HipSource,
|
||||
desktop_uid: Option<u32>,
|
||||
brokered_macos: bool,
|
||||
restricted_desktop: bool,
|
||||
edited_report: Option<Arc<str>>,
|
||||
profile: Option<OsProfile>,
|
||||
) -> anyhow::Result<HipExecution> {
|
||||
@@ -63,22 +73,11 @@ pub(crate) fn resolve(
|
||||
}
|
||||
HipSource::UserScript { path } => {
|
||||
approval = None;
|
||||
ensure_custom_available(brokered_macos)?;
|
||||
let uid = desktop_uid.context("HIP custom scripts require a verified desktop user")?;
|
||||
ensure!(uid != 0, "HIP custom scripts require a non-root desktop user");
|
||||
let path = PathBuf::from(path);
|
||||
ensure!(path.is_absolute(), "HIP custom script path must be absolute");
|
||||
let metadata = fs::symlink_metadata(&path).context("Failed to inspect the HIP script")?;
|
||||
ensure!(
|
||||
metadata.is_file() && !metadata.file_type().is_symlink() && metadata.permissions().mode() & 0o111 != 0,
|
||||
"HIP custom script must be an executable regular file"
|
||||
);
|
||||
let script =
|
||||
HipScript::new(path.to_string_lossy().into_owned(), Some(uid))?.with_environment(script_environment(uid)?)?;
|
||||
openconnect::HipSource::Script(script)
|
||||
ensure_custom_available(restricted_desktop)?;
|
||||
scripts::user_script(path, desktop_uid)?
|
||||
}
|
||||
HipSource::ApprovedRootScript { approval_id } => {
|
||||
ensure_custom_available(brokered_macos)?;
|
||||
ensure_custom_available(restricted_desktop)?;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
{
|
||||
let owner_uid = desktop_uid.context("Root HIP scripts require a verified desktop user")?;
|
||||
@@ -113,10 +112,10 @@ pub(crate) fn resolve(
|
||||
})
|
||||
}
|
||||
|
||||
fn ensure_custom_available(brokered_macos: bool) -> anyhow::Result<()> {
|
||||
fn ensure_custom_available(restricted_desktop: bool) -> anyhow::Result<()> {
|
||||
ensure!(
|
||||
!cfg!(target_os = "macos") && !brokered_macos,
|
||||
"Custom HIP scripts are unavailable on macOS"
|
||||
!cfg!(target_os = "macos") && !restricted_desktop,
|
||||
"Custom HIP scripts are unavailable on this platform"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
@@ -149,27 +148,6 @@ pub(crate) fn generate(
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn script_environment(uid: u32) -> anyhow::Result<HipScriptEnvironment> {
|
||||
let user =
|
||||
nix::unistd::User::from_uid(nix::unistd::Uid::from_raw(uid))?.context("HIP execution user is unavailable")?;
|
||||
let home = user.dir.to_string_lossy().into_owned();
|
||||
Ok(HipScriptEnvironment {
|
||||
variables: vec![
|
||||
(
|
||||
"PATH".into(),
|
||||
gpapi::process::collection::command_path(uid == 0)?
|
||||
.into_string()
|
||||
.map_err(|_| anyhow::anyhow!("HIP command path is not valid UTF-8"))?,
|
||||
),
|
||||
("LC_ALL".into(), "C".into()),
|
||||
("HOME".into(), home.clone()),
|
||||
("USER".into(), user.name.clone()),
|
||||
("LOGNAME".into(), user.name),
|
||||
],
|
||||
cwd: home,
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn profile(
|
||||
identity: &HostIdentity,
|
||||
os: ClientOs,
|
||||
@@ -180,19 +158,22 @@ pub(crate) fn profile(
|
||||
control: &dyn gpapi::collection::CollectionControl,
|
||||
) -> io::Result<OsProfile> {
|
||||
let identity = gpapi::os_profile::desktop::identity_from_parts(
|
||||
hostname.unwrap_or_else(|| identity.computer().into()),
|
||||
host_id.unwrap_or_else(|| identity.host_id().into()),
|
||||
hostname.as_deref().unwrap_or(identity.computer()).into(),
|
||||
host_id.as_deref().unwrap_or(identity.host_id()).into(),
|
||||
identity.serialno().into(),
|
||||
identity.mac_addr().into(),
|
||||
);
|
||||
let mut builder = OsProfileBuilder::new(os).host_identity(identity);
|
||||
if let Some(hostname) = hostname {
|
||||
builder = builder.computer_name_override(hostname);
|
||||
}
|
||||
if let Some(version) = version {
|
||||
builder = builder.client_version(version);
|
||||
}
|
||||
if let Some(os_version) = os_version {
|
||||
builder = builder.os_version(os_version);
|
||||
}
|
||||
gpapi::os_profile::desktop::collect_profile_with_control(builder, None, control)
|
||||
gpapi::os_profile::desktop::collect_profile_with_control(builder, host_id.as_deref(), control)
|
||||
}
|
||||
|
||||
fn generation_error(error: anyhow::Error) -> io::Error {
|
||||
@@ -257,6 +238,29 @@ mod tests {
|
||||
assert_eq!(profile.host_identity().serialno(), "serial");
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn native_windows_profile_retains_negotiated_host_id() {
|
||||
let identity = gpapi::os_profile::HostIdentity::from_parts(
|
||||
"device".into(),
|
||||
"hardware-seed".into(),
|
||||
"serial".into(),
|
||||
"00:11:22:33:44:55".into(),
|
||||
);
|
||||
let profile = profile(
|
||||
&identity,
|
||||
ClientOs::Windows,
|
||||
None,
|
||||
None,
|
||||
Some("negotiated-host".into()),
|
||||
None,
|
||||
&gpapi::collection::CollectionBudget::new(std::time::Duration::from_secs(60)),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(profile.host_id(), "negotiated-host");
|
||||
assert_eq!(profile.host_identity().host_id(), "negotiated-host");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn callback_errors_preserve_cancellation() {
|
||||
let error = generation_error(io::Error::new(io::ErrorKind::Interrupted, "cancelled").into());
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
use anyhow::{Context, ensure};
|
||||
use openconnect::{HipScript, HipScriptEnvironment};
|
||||
use std::{fs, os::unix::fs::PermissionsExt, path::PathBuf};
|
||||
pub(super) fn user_script(path: &str, desktop_uid: Option<u32>) -> anyhow::Result<openconnect::HipSource> {
|
||||
let uid = desktop_uid.context("HIP custom scripts require a verified desktop user")?;
|
||||
ensure!(uid != 0, "HIP custom scripts require a non-root desktop user");
|
||||
let path = PathBuf::from(path);
|
||||
ensure!(path.is_absolute(), "HIP custom script path must be absolute");
|
||||
let metadata = fs::symlink_metadata(&path).context("Failed to inspect the HIP script")?;
|
||||
ensure!(
|
||||
metadata.is_file() && !metadata.file_type().is_symlink() && metadata.permissions().mode() & 0o111 != 0,
|
||||
"HIP custom script must be an executable regular file"
|
||||
);
|
||||
let script =
|
||||
HipScript::new(path.to_string_lossy().into_owned(), Some(uid))?.with_environment(script_environment(uid)?)?;
|
||||
Ok(openconnect::HipSource::Script(script))
|
||||
}
|
||||
pub(crate) fn script_environment(uid: u32) -> anyhow::Result<HipScriptEnvironment> {
|
||||
let user =
|
||||
nix::unistd::User::from_uid(nix::unistd::Uid::from_raw(uid))?.context("HIP execution user is unavailable")?;
|
||||
let home = user.dir.to_string_lossy().into_owned();
|
||||
Ok(HipScriptEnvironment {
|
||||
variables: vec![
|
||||
(
|
||||
"PATH".into(),
|
||||
gpapi::process::collection::command_path(uid == 0)?
|
||||
.into_string()
|
||||
.map_err(|_| anyhow::anyhow!("HIP command path is not valid UTF-8"))?,
|
||||
),
|
||||
("LC_ALL".into(), "C".into()),
|
||||
("HOME".into(), home.clone()),
|
||||
("USER".into(), user.name.clone()),
|
||||
("LOGNAME".into(), user.name),
|
||||
],
|
||||
cwd: home,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
pub(super) fn user_script(_path: &str, _desktop_uid: Option<u32>) -> anyhow::Result<openconnect::HipSource> {
|
||||
anyhow::bail!("Custom HIP scripts are unavailable on Windows")
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
#[cfg_attr(windows, path = "cli/windows.rs")]
|
||||
mod cli;
|
||||
#[cfg(all(unix, any(target_os = "macos", debug_assertions)))]
|
||||
mod credential_lease;
|
||||
#[cfg(unix)]
|
||||
mod desktop_client;
|
||||
#[cfg(debug_assertions)]
|
||||
#[cfg(all(debug_assertions, unix))]
|
||||
mod dev_bootstrap;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", all(test, unix)))]
|
||||
mod device_anchor;
|
||||
#[cfg(unix)]
|
||||
mod gui_installation;
|
||||
mod handlers;
|
||||
mod hip_preview;
|
||||
mod hip_source;
|
||||
@@ -13,14 +17,41 @@ mod hip_source;
|
||||
mod macos_broker;
|
||||
mod request_dispatcher;
|
||||
mod routes;
|
||||
#[cfg(unix)]
|
||||
mod runtime_user;
|
||||
mod session_registry;
|
||||
mod vpn_script;
|
||||
mod vpn_task;
|
||||
#[cfg(windows)]
|
||||
mod windows_patches;
|
||||
mod ws_connection;
|
||||
mod ws_server;
|
||||
|
||||
#[cfg(windows)]
|
||||
mod windows_service;
|
||||
|
||||
const VERSION: &str = concat!(
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
" (",
|
||||
env!("GPSERVICE_GIT_COMMIT"),
|
||||
" ",
|
||||
compile_time::date_str!(),
|
||||
")"
|
||||
);
|
||||
|
||||
#[cfg(unix)]
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
cli::run().await;
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn main() -> std::process::ExitCode {
|
||||
match cli::run() {
|
||||
Ok(()) => std::process::ExitCode::SUCCESS,
|
||||
Err(error) => {
|
||||
eprintln!("{error:#}");
|
||||
std::process::ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,15 @@
|
||||
use std::{
|
||||
fs::{self, File, OpenOptions, Permissions},
|
||||
io::{BufReader, Read, Write},
|
||||
os::unix::fs::{OpenOptionsExt, PermissionsExt},
|
||||
path::Path,
|
||||
sync::{Arc, atomic::AtomicBool},
|
||||
};
|
||||
use std::sync::{Arc, atomic::AtomicBool};
|
||||
|
||||
use gpapi::{
|
||||
service::{
|
||||
request::{UpdateGuiRequest, UpdateLogLevelRequest, WsRequest},
|
||||
transport::{ServiceErrorCode, ServiceResult},
|
||||
},
|
||||
utils::{checksum::verify_checksum, redact::Redaction},
|
||||
utils::redact::Redaction,
|
||||
};
|
||||
use log::{info, warn};
|
||||
use tar::Archive;
|
||||
use tempfile::NamedTempFile;
|
||||
#[cfg(unix)]
|
||||
use tokio::sync::Mutex;
|
||||
use xz2::read::XzDecoder;
|
||||
|
||||
const MAX_GUI_ARCHIVE_SIZE: u64 = 256 * 1024 * 1024;
|
||||
const MAX_GUI_ARCHIVE_CONTENT_SIZE: u64 = 512 * 1024 * 1024;
|
||||
const MAX_GUI_BINARY_SIZE: u64 = 256 * 1024 * 1024;
|
||||
|
||||
pub(crate) struct SessionAuthority {
|
||||
pub registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
@@ -75,12 +63,17 @@ pub struct RequestDispatcher {
|
||||
lifecycle: crate::vpn_task::LifecycleHandle,
|
||||
gui_restart_requested: Arc<AtomicBool>,
|
||||
redaction: Arc<Redaction>,
|
||||
#[cfg(unix)]
|
||||
install_lock: Mutex<()>,
|
||||
gui_management_enabled: bool,
|
||||
externally_brokered: bool,
|
||||
restricted_desktop: bool,
|
||||
}
|
||||
|
||||
impl RequestDispatcher {
|
||||
#[cfg(windows)]
|
||||
pub(crate) fn patch_checks(&self) -> Arc<crate::windows_patches::PatchChecks> {
|
||||
self.lifecycle.patch_checks.clone()
|
||||
}
|
||||
pub fn subscribe_tunnel(&self) -> tokio::sync::watch::Receiver<crate::vpn_task::TunnelBinding> {
|
||||
self.lifecycle.subscribe_tunnel()
|
||||
}
|
||||
@@ -89,15 +82,16 @@ impl RequestDispatcher {
|
||||
gui_restart_requested: Arc<AtomicBool>,
|
||||
redaction: Arc<Redaction>,
|
||||
gui_management_enabled: bool,
|
||||
externally_brokered: bool,
|
||||
restricted_desktop: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
lifecycle,
|
||||
gui_restart_requested,
|
||||
redaction,
|
||||
#[cfg(unix)]
|
||||
install_lock: Mutex::new(()),
|
||||
gui_management_enabled,
|
||||
externally_brokered,
|
||||
restricted_desktop,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +196,7 @@ impl RequestDispatcher {
|
||||
edited_report,
|
||||
} => {
|
||||
let prepared =
|
||||
crate::vpn_task::prepare_connection(*request, self.externally_brokered, preparation.cancellation()).await;
|
||||
crate::vpn_task::prepare_connection(*request, self.restricted_desktop, preparation.cancellation()).await;
|
||||
return match prepared {
|
||||
Ok(connection) => preparation.commit(connection, desktop_uid, edited_report),
|
||||
Err(error) => {
|
||||
@@ -272,31 +266,34 @@ impl RequestDispatcher {
|
||||
| WsRequest::GetHipApprovalStatus { .. }
|
||||
| WsRequest::ReadHipPreviewChunk(_)
|
||||
| WsRequest::GetLastSubmittedHipReport
|
||||
| WsRequest::SetTunnelStatisticsEnabled { .. } => {
|
||||
| WsRequest::SetTunnelStatisticsEnabled { .. }
|
||||
| WsRequest::SetWindowsPatchInterest { .. }
|
||||
| WsRequest::RefreshWindowsPatches { .. } => {
|
||||
unreachable!("session-bound request was already dispatched")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_connect_request(&self, request: &gpapi::service::request::ConnectRequest) -> Result<(), &'static str> {
|
||||
if !self.externally_brokered {
|
||||
if !self.restricted_desktop {
|
||||
return Ok(());
|
||||
}
|
||||
if request.args().vpnc_script().is_some() {
|
||||
return Err("macOS does not support custom VPN scripts");
|
||||
return Err("Custom VPN scripts are unavailable on this platform");
|
||||
}
|
||||
if matches!(
|
||||
request.args().hip_source(),
|
||||
gpapi::hip::HipSource::UserScript { .. } | gpapi::hip::HipSource::ApprovedRootScript { .. }
|
||||
) {
|
||||
return Err("macOS does not support custom HIP scripts");
|
||||
return Err("Custom HIP scripts are unavailable on this platform");
|
||||
}
|
||||
if request.args().certificate().is_some() || request.args().sslkey().is_some() {
|
||||
return Err("macOS client identity must be provided as protected data, not root-readable paths");
|
||||
return Err("Client identity must be provided as certificate data");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
async fn update_gui(&self, request: UpdateGuiRequest) -> ServiceResult {
|
||||
if request.variant == gpapi::gui::GuiVariant::Nsh && !cfg!(target_os = "linux") {
|
||||
return ServiceResult::rejected(
|
||||
@@ -308,14 +305,17 @@ impl RequestDispatcher {
|
||||
let path = request.path;
|
||||
let checksum = request.checksum;
|
||||
let target = request.variant.update_target();
|
||||
let installed = tokio::task::spawn_blocking(move || install_gui_at(Path::new(&path), &checksum, &target)).await;
|
||||
let installed = tokio::task::spawn_blocking(move || {
|
||||
crate::gui_installation::install(std::path::Path::new(&path), &checksum, &target)
|
||||
})
|
||||
.await;
|
||||
match installed {
|
||||
Ok(Ok(())) => ServiceResult::Accepted,
|
||||
Ok(Err(GuiInstallError::Checksum(err))) => {
|
||||
Ok(Err(crate::gui_installation::InstallError::Checksum(err))) => {
|
||||
warn!("Failed to verify GUI update checksum: {err}");
|
||||
ServiceResult::rejected(ServiceErrorCode::ChecksumFailed, "GUI update checksum failed")
|
||||
}
|
||||
Ok(Err(GuiInstallError::Install(err))) => {
|
||||
Ok(Err(crate::gui_installation::InstallError::Install(err))) => {
|
||||
warn!("Failed to install GUI update: {err}");
|
||||
ServiceResult::rejected(ServiceErrorCode::InstallFailed, "GUI update installation failed")
|
||||
}
|
||||
@@ -325,335 +325,20 @@ impl RequestDispatcher {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum GuiInstallError {
|
||||
Checksum(anyhow::Error),
|
||||
Install(anyhow::Error),
|
||||
}
|
||||
|
||||
pub(crate) fn gui_installer() -> Option<std::path::PathBuf> {
|
||||
std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|executable| {
|
||||
executable
|
||||
.parent()?
|
||||
.parent()
|
||||
.map(|prefix| prefix.join("libexec/gpclient/gp-gui-installer"))
|
||||
})
|
||||
.filter(|path| path.is_file())
|
||||
}
|
||||
|
||||
fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiInstallError> {
|
||||
let installer = gui_installer();
|
||||
install_gui_with_installer(src, checksum, target, installer.as_deref())
|
||||
}
|
||||
|
||||
fn install_gui_with_installer(
|
||||
src: &Path,
|
||||
checksum: &str,
|
||||
target: &Path,
|
||||
installer: Option<&Path>,
|
||||
) -> Result<(), GuiInstallError> {
|
||||
let Some(dir) = target.parent() else {
|
||||
return Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"Failed to get parent directory of GUI binary"
|
||||
)));
|
||||
};
|
||||
fs::create_dir_all(dir).map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
|
||||
let staged_archive = stage_gui_archive(src, dir)?;
|
||||
let archive_path = staged_archive.path().to_string_lossy();
|
||||
verify_checksum(&archive_path, checksum).map_err(GuiInstallError::Checksum)?;
|
||||
|
||||
// A package may need to prepare downloaded executables for its runtime.
|
||||
// Resolve this helper beside the running service, never from the request or PATH.
|
||||
if let Some(installer) = installer {
|
||||
let status = std::process::Command::new(installer)
|
||||
.arg(staged_archive.path())
|
||||
.arg(checksum)
|
||||
.arg(target)
|
||||
.stdin(std::process::Stdio::null())
|
||||
.stdout(std::process::Stdio::null())
|
||||
.status()
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
return if status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"GUI package installation failed: {status}"
|
||||
)))
|
||||
};
|
||||
#[cfg(windows)]
|
||||
async fn update_gui(&self, _request: UpdateGuiRequest) -> ServiceResult {
|
||||
ServiceResult::rejected(
|
||||
ServiceErrorCode::InvalidRequest,
|
||||
"Use the Windows installer to update GP Connect",
|
||||
)
|
||||
}
|
||||
|
||||
let tar = XzDecoder::new(BufReader::new(
|
||||
staged_archive
|
||||
.reopen()
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?,
|
||||
))
|
||||
.take(MAX_GUI_ARCHIVE_CONTENT_SIZE);
|
||||
let mut archive = Archive::new(tar);
|
||||
let binary_name = target.file_name().and_then(|name| name.to_str()).unwrap_or("gpgui");
|
||||
let file = extract_gui_binary(&mut archive, dir, binary_name)?;
|
||||
file
|
||||
.as_file()
|
||||
.set_permissions(Permissions::from_mode(0o755))
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
file
|
||||
.as_file()
|
||||
.sync_all()
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
file
|
||||
.persist(&target)
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
File::open(dir)
|
||||
.and_then(|directory| directory.sync_all())
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn stage_gui_archive(src: &Path, dir: &Path) -> Result<NamedTempFile, GuiInstallError> {
|
||||
let mut source = OpenOptions::new()
|
||||
.read(true)
|
||||
.custom_flags(nix::libc::O_NONBLOCK | nix::libc::O_NOFOLLOW)
|
||||
.open(src)
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
let metadata = source.metadata().map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
let source_size = metadata.len();
|
||||
if !metadata.file_type().is_file() || source_size == 0 || source_size > MAX_GUI_ARCHIVE_SIZE {
|
||||
return Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"GUI update archive must be a non-empty regular file no larger than {MAX_GUI_ARCHIVE_SIZE} bytes"
|
||||
)));
|
||||
}
|
||||
|
||||
let mut staged = NamedTempFile::new_in(dir).map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
let copied = std::io::copy(&mut (&mut source).take(MAX_GUI_ARCHIVE_SIZE + 1), &mut staged)
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
if copied != source_size {
|
||||
return Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"GUI update archive changed while it was being read"
|
||||
)));
|
||||
}
|
||||
staged.flush().map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
staged
|
||||
.as_file()
|
||||
.sync_all()
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
Ok(staged)
|
||||
}
|
||||
|
||||
fn extract_gui_binary<R: Read>(
|
||||
archive: &mut Archive<R>,
|
||||
dir: &Path,
|
||||
binary_name: &str,
|
||||
) -> Result<NamedTempFile, GuiInstallError> {
|
||||
for entry in archive.entries().map_err(|err| GuiInstallError::Install(err.into()))? {
|
||||
let mut entry = entry.map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
let is_gui = entry
|
||||
.path()
|
||||
.map_err(|err| GuiInstallError::Install(err.into()))?
|
||||
.file_name()
|
||||
.is_some_and(|name| name == binary_name);
|
||||
if is_gui && entry.header().entry_type().is_file() {
|
||||
let declared_size = entry.size();
|
||||
if declared_size == 0 || declared_size > MAX_GUI_BINARY_SIZE {
|
||||
return Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"GUI binary must be non-empty and no larger than {MAX_GUI_BINARY_SIZE} bytes"
|
||||
)));
|
||||
}
|
||||
let mut file = NamedTempFile::new_in(dir).map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
let copied = std::io::copy(&mut entry, &mut file).map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
if copied != declared_size {
|
||||
return Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"GUI binary size does not match its archive header"
|
||||
)));
|
||||
}
|
||||
file.flush().map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
return Ok(file);
|
||||
}
|
||||
}
|
||||
Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"GUI update archive does not contain a non-empty regular {binary_name} file"
|
||||
)))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::vpn_task::test_connect_request as test_request;
|
||||
use std::{io::Cursor, os::unix::fs::PermissionsExt};
|
||||
|
||||
use gpapi::{
|
||||
gateway::Gateway,
|
||||
service::transport::{ServiceErrorCode, ServiceResult},
|
||||
};
|
||||
use tar::{Builder, EntryType, Header};
|
||||
use xz2::write::XzEncoder;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn archive_with_entry(entry_type: EntryType, contents: &[u8]) -> Vec<u8> {
|
||||
let mut data = Vec::new();
|
||||
{
|
||||
let mut builder = Builder::new(&mut data);
|
||||
let mut header = Header::new_gnu();
|
||||
header.set_entry_type(entry_type);
|
||||
header.set_size(contents.len() as u64);
|
||||
header.set_mode(0o755);
|
||||
header.set_cksum();
|
||||
builder.append_data(&mut header, "gpgui", contents).unwrap();
|
||||
builder.finish().unwrap();
|
||||
}
|
||||
data
|
||||
}
|
||||
|
||||
fn compressed_gui_archive(contents: &[u8]) -> NamedTempFile {
|
||||
let tar = archive_with_entry(EntryType::Regular, contents);
|
||||
let mut encoder = XzEncoder::new(Vec::new(), 6);
|
||||
encoder.write_all(&tar).unwrap();
|
||||
let compressed = encoder.finish().unwrap();
|
||||
let mut archive = NamedTempFile::new().unwrap();
|
||||
archive.write_all(&compressed).unwrap();
|
||||
archive.flush().unwrap();
|
||||
archive
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_non_file_and_empty_gui_entries() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
for (entry_type, contents) in [(EntryType::Directory, &[][..]), (EntryType::Regular, &[][..])] {
|
||||
let data = archive_with_entry(entry_type, contents);
|
||||
let mut archive = Archive::new(Cursor::new(data));
|
||||
assert!(extract_gui_binary(&mut archive, output.path(), "gpgui").is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extracts_non_empty_regular_gui_entry() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let data = archive_with_entry(EntryType::Regular, b"gui binary");
|
||||
let mut archive = Archive::new(Cursor::new(data));
|
||||
let extracted = extract_gui_binary(&mut archive, output.path(), "gpgui").unwrap();
|
||||
let contents = std::fs::read(extracted.path()).unwrap();
|
||||
assert_eq!(contents, b"gui binary");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_invalid_archive_sources() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
assert!(stage_gui_archive(output.path(), output.path()).is_err());
|
||||
|
||||
let oversized = output.path().join("oversized.tar.xz");
|
||||
File::create(&oversized)
|
||||
.unwrap()
|
||||
.set_len(MAX_GUI_ARCHIVE_SIZE + 1)
|
||||
.unwrap();
|
||||
assert!(stage_gui_archive(&oversized, output.path()).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_oversized_gui_entry() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let mut header = Header::new_gnu();
|
||||
header.set_entry_type(EntryType::Regular);
|
||||
header.set_size(MAX_GUI_BINARY_SIZE + 1);
|
||||
header.set_mode(0o755);
|
||||
header.set_path("gpgui").unwrap();
|
||||
header.set_cksum();
|
||||
let mut data = header.as_bytes().to_vec();
|
||||
data.resize(512 * 3, 0);
|
||||
|
||||
let mut archive = Archive::new(Cursor::new(data));
|
||||
assert!(extract_gui_binary(&mut archive, output.path(), "gpgui").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installs_gui_at_the_supplied_target() {
|
||||
let archive = compressed_gui_archive(b"gui binary");
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpclient/gpgui");
|
||||
|
||||
install_gui_at(archive.path(), &checksum, &target).unwrap();
|
||||
|
||||
assert_eq!(std::fs::read(&target).unwrap(), b"gui binary");
|
||||
assert_eq!(std::fs::metadata(&target).unwrap().permissions().mode() & 0o777, 0o755);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installs_nsh_beside_tauri_without_replacing_it() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let tauri = output.path().join("gpgui");
|
||||
std::fs::write(&tauri, b"tauri").unwrap();
|
||||
let mut encoder = XzEncoder::new(Vec::new(), 1);
|
||||
{
|
||||
let mut archive = Builder::new(&mut encoder);
|
||||
let mut header = Header::new_gnu();
|
||||
header.set_size(3);
|
||||
header.set_mode(0o755);
|
||||
header.set_cksum();
|
||||
archive
|
||||
.append_data(&mut header, "gpgui-nsh_3.2.0/gpgui-nsh", &b"nsh"[..])
|
||||
.unwrap();
|
||||
archive.finish().unwrap();
|
||||
}
|
||||
let mut archive = NamedTempFile::new().unwrap();
|
||||
archive.write_all(&encoder.finish().unwrap()).unwrap();
|
||||
archive.flush().unwrap();
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let nsh = output.path().join("gpgui-nsh");
|
||||
install_gui_at(archive.path(), &checksum, &nsh).unwrap();
|
||||
assert_eq!(std::fs::read(nsh).unwrap(), b"nsh");
|
||||
assert_eq!(std::fs::read(tauri).unwrap(), b"tauri");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn checksum_failure_preserves_the_existing_gui() {
|
||||
let archive = compressed_gui_archive(b"replacement");
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpclient/gpgui");
|
||||
std::fs::create_dir_all(target.parent().unwrap()).unwrap();
|
||||
std::fs::write(&target, b"existing").unwrap();
|
||||
|
||||
assert!(install_gui_at(archive.path(), "invalid", &target).is_err());
|
||||
assert_eq!(std::fs::read(target).unwrap(), b"existing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn package_installer_receives_a_verified_staged_archive() {
|
||||
let archive = compressed_gui_archive(b"gui binary");
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpgui-nsh");
|
||||
let installer = output.path().join("installer");
|
||||
std::fs::write(
|
||||
&installer,
|
||||
"#!/bin/sh\nset -eu\ntest -f \"$1\"\nprintf '%s' \"$2\" > \"$3\"\n",
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
|
||||
|
||||
assert!(install_gui_with_installer(archive.path(), "invalid", &target, Some(&installer)).is_err());
|
||||
assert!(!target.exists());
|
||||
install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).unwrap();
|
||||
assert_eq!(std::fs::read_to_string(target).unwrap(), checksum);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn package_installation_failure_preserves_the_existing_gui() {
|
||||
let archive = compressed_gui_archive(b"replacement");
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpgui");
|
||||
std::fs::write(&target, b"existing").unwrap();
|
||||
let installer = output.path().join("installer");
|
||||
std::fs::write(&installer, "#!/bin/sh\nexit 1\n").unwrap();
|
||||
std::fs::set_permissions(&installer, Permissions::from_mode(0o755)).unwrap();
|
||||
|
||||
assert!(install_gui_with_installer(archive.path(), &checksum, &target, Some(&installer)).is_err());
|
||||
assert_eq!(std::fs::read(target).unwrap(), b"existing");
|
||||
}
|
||||
|
||||
use crate::vpn_task::test_connect_request as test_request;
|
||||
use gpapi::gateway::Gateway;
|
||||
#[tokio::test]
|
||||
async fn brokered_mode_rejects_gui_management_and_root_readable_identity_paths() {
|
||||
let dispatcher = RequestDispatcher::new(
|
||||
@@ -700,7 +385,7 @@ mod tests {
|
||||
let custom = test_request(info.clone()).with_vpnc_script(Some(script.to_string()));
|
||||
assert_eq!(
|
||||
dispatcher.validate_connect_request(&custom),
|
||||
Err("macOS does not support custom VPN scripts")
|
||||
Err("Custom VPN scripts are unavailable on this platform")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -709,32 +394,7 @@ mod tests {
|
||||
});
|
||||
assert_eq!(
|
||||
dispatcher.validate_connect_request(&custom),
|
||||
Err("macOS does not support custom HIP scripts")
|
||||
Err("Custom HIP scripts are unavailable on this platform")
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
#[ignore = "requires GP_TEST_GUI_BINARY pointing to a built gpgui"]
|
||||
fn installs_single_gui_binary_for_fresh_and_upgrade_downloads() {
|
||||
let binary = std::fs::read(std::env::var("GP_TEST_GUI_BINARY").expect("GP_TEST_GUI_BINARY")).unwrap();
|
||||
let archive = compressed_gui_archive(&binary);
|
||||
let checksum = gpapi::utils::checksum::file_sha256(archive.path()).unwrap();
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let output = std::env::var_os("GP_TEST_GUI_INSTALL_DIR")
|
||||
.map(std::path::PathBuf::from)
|
||||
.unwrap_or_else(|| temporary.path().to_owned());
|
||||
std::fs::create_dir_all(&output).unwrap();
|
||||
std::fs::set_permissions(&output, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
let target = output.join("gpclient/gpgui");
|
||||
for upgrade in [false, true] {
|
||||
if upgrade {
|
||||
std::fs::write(&target, b"old GUI").unwrap();
|
||||
}
|
||||
install_gui_at(archive.path(), &checksum, &target).unwrap();
|
||||
assert_eq!(std::fs::read_dir(target.parent().unwrap()).unwrap().count(), 1);
|
||||
assert_eq!(std::fs::read(&target).unwrap(), binary);
|
||||
let result = std::process::Command::new(&target).arg("--version").output().unwrap();
|
||||
assert!(result.status.success(), "{}", String::from_utf8_lossy(&result.stderr));
|
||||
assert!(String::from_utf8_lossy(&result.stdout).contains(env!("CARGO_PKG_VERSION")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,8 @@ enum SessionStatus {
|
||||
}
|
||||
|
||||
struct SessionRecord {
|
||||
#[cfg(windows)]
|
||||
windows_identity: Option<Arc<gpapi::windows::PipeClientIdentity>>,
|
||||
non_tunnel: Option<AttachmentAttempt>,
|
||||
closed_attachment: Option<Uuid>,
|
||||
secret: Zeroizing<[u8; 32]>,
|
||||
@@ -255,6 +257,8 @@ impl SessionRegistry {
|
||||
sessions.insert(
|
||||
credential.session_id(),
|
||||
SessionRecord {
|
||||
#[cfg(windows)]
|
||||
windows_identity: None,
|
||||
non_tunnel: None,
|
||||
closed_attachment: None,
|
||||
secret: Zeroizing::new(*credential.secret()),
|
||||
@@ -273,6 +277,38 @@ impl SessionRegistry {
|
||||
Ok(credential)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub(crate) fn issue_windows(
|
||||
&self,
|
||||
product_version: &str,
|
||||
identity: Arc<gpapi::windows::PipeClientIdentity>,
|
||||
) -> Result<Arc<SessionCredential>, SessionError> {
|
||||
let credential = self.issue(product_version, None)?;
|
||||
// The credential is not published until its Windows owner is retained.
|
||||
self
|
||||
.sessions
|
||||
.lock()
|
||||
.map_err(|_| SessionError::Unavailable)?
|
||||
.get_mut(&credential.session_id())
|
||||
.ok_or(SessionError::Unauthorized)?
|
||||
.windows_identity = Some(identity);
|
||||
Ok(credential)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub(crate) fn windows_identity(
|
||||
&self,
|
||||
session_id: Uuid,
|
||||
) -> Result<Arc<gpapi::windows::PipeClientIdentity>, SessionError> {
|
||||
self
|
||||
.sessions
|
||||
.lock()
|
||||
.map_err(|_| SessionError::Unavailable)?
|
||||
.get(&session_id)
|
||||
.and_then(|record| record.windows_identity.clone())
|
||||
.ok_or(SessionError::Unauthorized)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
let Ok(mut sessions) = self.sessions.lock() else {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[path = "privileged_unix.rs"]
|
||||
mod platform;
|
||||
#[cfg(windows)]
|
||||
#[path = "windows.rs"]
|
||||
mod platform;
|
||||
#[cfg(target_os = "macos")]
|
||||
#[path = "macos.rs"]
|
||||
mod platform;
|
||||
@@ -8,7 +11,8 @@ mod platform;
|
||||
target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "macos"
|
||||
target_os = "macos",
|
||||
windows
|
||||
)))]
|
||||
#[path = "default.rs"]
|
||||
mod platform;
|
||||
@@ -16,3 +20,5 @@ mod platform;
|
||||
mod selection;
|
||||
|
||||
pub(crate) use platform::builder;
|
||||
#[cfg(windows)]
|
||||
pub(crate) use platform::recover_network;
|
||||
@@ -0,0 +1,24 @@
|
||||
use gpapi::service::request::ConnectArgs;
|
||||
use gpvpnc::windows::SystemTunnel;
|
||||
use openconnect::{Vpn, VpnBuilder};
|
||||
use std::sync::Mutex;
|
||||
pub(crate) fn recover_network() -> std::io::Result<()> {
|
||||
let _tunnel = SystemTunnel::try_acquire()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow::Result<VpnBuilder> {
|
||||
anyhow::ensure!(
|
||||
args.vpnc_script().is_none(),
|
||||
"Windows does not support custom VPN scripts"
|
||||
);
|
||||
let network = Mutex::new(SystemTunnel::acquire()?.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)
|
||||
}),
|
||||
)
|
||||
}
|
||||
@@ -31,6 +31,8 @@ mod script_tun;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct LifecycleHandle {
|
||||
#[cfg(windows)]
|
||||
pub(crate) patch_checks: Arc<crate::windows_patches::PatchChecks>,
|
||||
events: mpsc::Sender<LifecycleEvent>,
|
||||
admissions: Arc<Mutex<Admissions>>,
|
||||
tunnel: watch::Sender<TunnelBinding>,
|
||||
@@ -126,6 +128,7 @@ impl LifecycleHandle {
|
||||
ServiceResult::Accepted
|
||||
}
|
||||
|
||||
#[cfg(any(unix, test))]
|
||||
pub async fn disconnect_and_wait(&self) -> bool {
|
||||
let completion = {
|
||||
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
|
||||
@@ -447,7 +450,7 @@ pub(crate) struct VpnTask {
|
||||
events: mpsc::Receiver<LifecycleEvent>,
|
||||
lifecycle: LifecycleHandle,
|
||||
vpn_state_tx: watch::Sender<VpnState>,
|
||||
brokered_macos: bool,
|
||||
restricted_desktop: bool,
|
||||
registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
active: Option<ActiveAttempt>,
|
||||
cancel_token: CancellationToken,
|
||||
@@ -456,11 +459,13 @@ pub(crate) struct VpnTask {
|
||||
impl VpnTask {
|
||||
pub fn new(
|
||||
vpn_state_tx: watch::Sender<VpnState>,
|
||||
brokered_macos: bool,
|
||||
restricted_desktop: bool,
|
||||
registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
) -> (Self, LifecycleHandle) {
|
||||
let (events_tx, events) = mpsc::channel(4);
|
||||
let lifecycle = LifecycleHandle {
|
||||
#[cfg(windows)]
|
||||
patch_checks: crate::windows_patches::PatchChecks::new(),
|
||||
events: events_tx,
|
||||
admissions: Arc::new(Mutex::new(Admissions::default())),
|
||||
tunnel: watch::channel(TunnelBinding::default()).0,
|
||||
@@ -470,7 +475,7 @@ impl VpnTask {
|
||||
events,
|
||||
lifecycle: lifecycle.clone(),
|
||||
vpn_state_tx,
|
||||
brokered_macos,
|
||||
restricted_desktop,
|
||||
registry,
|
||||
active: None,
|
||||
cancel_token: CancellationToken::new(),
|
||||
@@ -617,7 +622,7 @@ impl VpnTask {
|
||||
desktop_uid,
|
||||
edited_report,
|
||||
session_id,
|
||||
brokered_macos: self.brokered_macos,
|
||||
restricted_desktop: self.restricted_desktop,
|
||||
registry: self.registry.clone(),
|
||||
lifecycle: self.lifecycle.clone(),
|
||||
},
|
||||
|
||||
@@ -66,10 +66,13 @@ pub(super) async fn run(
|
||||
md5: request.md5.clone(),
|
||||
};
|
||||
if !posture_enabled {
|
||||
return gphip::generate_identity_report(&gphip::ReportInput {
|
||||
profile: profile.clone(),
|
||||
context,
|
||||
})
|
||||
return gphip::generate_identity_report(
|
||||
&gphip::ReportInput {
|
||||
profile: profile.clone(),
|
||||
context,
|
||||
},
|
||||
control,
|
||||
)
|
||||
.map_err(std::io::Error::other);
|
||||
}
|
||||
source.collect(
|
||||
|
||||
@@ -30,7 +30,7 @@ pub(super) struct ConnectionResources {
|
||||
/// the complete ledger and its retained identity resources to the service.
|
||||
pub(crate) async fn prepare_connection(
|
||||
request: ConnectRequest,
|
||||
brokered_macos: bool,
|
||||
restricted_desktop: bool,
|
||||
cancellation: CancellationToken,
|
||||
) -> anyhow::Result<PreparedConnection> {
|
||||
let mode = request.args().packet_delivery().clone();
|
||||
@@ -77,11 +77,16 @@ pub(crate) async fn prepare_connection(
|
||||
};
|
||||
check()?;
|
||||
let args = setup_request.args();
|
||||
let identity = super::prepare_identity(args, brokered_macos || non_tunnel)?;
|
||||
let directory = brokered_macos.then(|| std::path::Path::new("/var/run/com.yuezk.gpgui"));
|
||||
let identity = super::prepare_identity(args, restricted_desktop || non_tunnel)?;
|
||||
#[cfg(target_os = "macos")]
|
||||
let directory = restricted_desktop.then(|| std::path::PathBuf::from("/var/run/com.yuezk.gpgui"));
|
||||
#[cfg(windows)]
|
||||
let directory = Some(common::paths::service_private_dir());
|
||||
#[cfg(all(unix, not(target_os = "macos")))]
|
||||
let directory: Option<std::path::PathBuf> = None;
|
||||
let identity_files = identity
|
||||
.as_ref()
|
||||
.map(|identity| identity.write_files(directory))
|
||||
.map(|identity| identity.write_files(directory.as_deref()))
|
||||
.transpose()?;
|
||||
let host = args.host_identity().context("Authenticated host identity is missing")?;
|
||||
let profile = crate::hip_source::profile(
|
||||
@@ -181,8 +186,8 @@ mod tests {
|
||||
use gpapi::{gateway::Gateway, service::vpn_state::ConnectInfo};
|
||||
|
||||
#[tokio::test]
|
||||
async fn brokered_macos_and_non_tunnel_identity_reject_path_handoff() {
|
||||
for (brokered_macos, non_tunnel) in [(true, false), (false, true), (true, true)] {
|
||||
async fn restricted_desktop_and_non_tunnel_identity_reject_path_handoff() {
|
||||
for (restricted_desktop, non_tunnel) in [(true, false), (false, true), (true, true)] {
|
||||
let gateway = Gateway::new("fixture".into(), "gateway.example.com".into());
|
||||
let request = super::super::test_connect_request(ConnectInfo::new("portal.example.com".into(), gateway, vec![]))
|
||||
.with_certificate(Some("/identity.pem".into()));
|
||||
@@ -192,7 +197,7 @@ mod tests {
|
||||
wire["plan"]["members"][0]["authentication"]["connection_type"] = serde_json::json!("internal");
|
||||
}
|
||||
let request = serde_json::from_value(wire).unwrap();
|
||||
let error = prepare_connection(request, brokered_macos, CancellationToken::new())
|
||||
let error = prepare_connection(request, restricted_desktop, CancellationToken::new())
|
||||
.await
|
||||
.err()
|
||||
.unwrap();
|
||||
|
||||
@@ -20,7 +20,7 @@ pub(super) struct AttemptInput {
|
||||
pub desktop_uid: Option<u32>,
|
||||
pub edited_report: Option<Arc<str>>,
|
||||
pub session_id: Option<Uuid>,
|
||||
pub brokered_macos: bool,
|
||||
pub restricted_desktop: bool,
|
||||
pub registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
pub lifecycle: LifecycleHandle,
|
||||
}
|
||||
@@ -31,6 +31,7 @@ struct TunnelInput {
|
||||
source: Arc<openconnect::HipSource>,
|
||||
session_id: Option<Uuid>,
|
||||
registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
#[cfg(unix)]
|
||||
desktop_uid: Option<u32>,
|
||||
}
|
||||
|
||||
@@ -49,13 +50,30 @@ pub(super) fn spawn(
|
||||
) -> JoinHandle<()> {
|
||||
tokio::spawn(async move {
|
||||
let attempt = input.attempt;
|
||||
#[cfg(windows)]
|
||||
let _patch_interest = {
|
||||
let args = input.connection.request.args();
|
||||
let profile = &input.connection.resources.profile;
|
||||
(matches!(args.hip_source(), gpapi::hip::HipSource::Generated)
|
||||
&& profile.is_native()
|
||||
&& profile.client_os() == gpapi::os_profile::ClientOs::Windows
|
||||
&& (input.connection.request.plan().policy().collect_hip_data()
|
||||
|| input
|
||||
.connection
|
||||
.request
|
||||
.plan()
|
||||
.members()
|
||||
.iter()
|
||||
.any(|member| member.authentication.mode() == SessionMode::Tunnel)))
|
||||
.then(|| input.lifecycle.patch_checks.consumer())
|
||||
};
|
||||
let mut failure = None;
|
||||
let mut approval = None;
|
||||
if !cancellation.is_cancelled() {
|
||||
let request = input.connection.request.clone();
|
||||
let resources = input.connection.resources.clone();
|
||||
let desktop_uid = input.desktop_uid;
|
||||
let brokered = input.brokered_macos;
|
||||
let brokered = input.restricted_desktop;
|
||||
let edited = input.edited_report.clone();
|
||||
let setup_cancel = cancellation.clone();
|
||||
let execution = tokio::task::spawn_blocking(move || {
|
||||
@@ -105,6 +123,7 @@ pub(super) fn spawn(
|
||||
source,
|
||||
session_id: input.session_id,
|
||||
registry: input.registry.clone(),
|
||||
#[cfg(unix)]
|
||||
desktop_uid: input.desktop_uid,
|
||||
};
|
||||
input.connection.request.release_script_tun_bootstrap();
|
||||
@@ -253,12 +272,14 @@ fn prepare_tunnel(input: TunnelInput, cancellation: &CancellationToken) -> anyho
|
||||
),
|
||||
gpapi::script_tun::PacketDelivery::ScriptTun(request) => {
|
||||
ensure!(input.session_id.is_some(), "Script-tun requires a desktop session");
|
||||
let (builder, script_tun) = super::script_tun::builder(
|
||||
member.gateway.server(),
|
||||
member.authentication.cookie(),
|
||||
request,
|
||||
input.desktop_uid.context("Desktop identity is unavailable")?,
|
||||
)?;
|
||||
#[cfg(unix)]
|
||||
let owner = input.desktop_uid.context("Desktop identity is unavailable")?;
|
||||
#[cfg(windows)]
|
||||
let owner = input
|
||||
.registry
|
||||
.windows_identity(input.session_id.context("Desktop session is unavailable")?)?;
|
||||
let (builder, script_tun) =
|
||||
super::script_tun::builder(member.gateway.server(), member.authentication.cookie(), request, owner)?;
|
||||
(builder, Some(script_tun))
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,40 +1,19 @@
|
||||
//! Supervision of an unprivileged script-tun consumer; payload semantics belong to the caller.
|
||||
use super::{LifecycleEvent, LifecycleHandle};
|
||||
use anyhow::{Context, bail, ensure};
|
||||
use gpapi::script_tun::{Bootstrap, Identity, Message, ScriptTunRequest, receive, send as send_message};
|
||||
use openconnect::{Vpn, VpnBuilder, tunnel::Event};
|
||||
use gpapi::script_tun::{Bootstrap, Identity, Message, receive, send as send_message};
|
||||
use openconnect::{Vpn, tunnel::Event};
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use tokio::{net::UnixStream, sync::mpsc, time::Instant};
|
||||
use tokio::{sync::mpsc, time::Instant};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
pub(super) struct PreparedScriptTun {
|
||||
pub control: std::os::unix::net::UnixStream,
|
||||
pub bootstrap: Bootstrap,
|
||||
}
|
||||
|
||||
pub(super) fn builder(
|
||||
server: &str,
|
||||
cookie: &str,
|
||||
request: &ScriptTunRequest,
|
||||
uid: u32,
|
||||
) -> anyhow::Result<(VpnBuilder, PreparedScriptTun)> {
|
||||
request.validate()?;
|
||||
ensure!(uid != 0, "Script-tun worker requires a desktop user");
|
||||
let (control, child) = std::os::unix::net::UnixStream::pair()?;
|
||||
let builder = Vpn::builder(server, cookie).script_tun_program(
|
||||
request.program.to_str().context("Program is not UTF-8")?,
|
||||
&request.args,
|
||||
uid,
|
||||
child.into(),
|
||||
)?;
|
||||
Ok((
|
||||
builder,
|
||||
PreparedScriptTun {
|
||||
control,
|
||||
bootstrap: request.bootstrap.clone(),
|
||||
},
|
||||
))
|
||||
}
|
||||
#[cfg(unix)]
|
||||
#[path = "script_tun/unix.rs"]
|
||||
mod platform;
|
||||
#[cfg(windows)]
|
||||
#[path = "script_tun/windows.rs"]
|
||||
mod platform;
|
||||
pub(super) use platform::{PreparedScriptTun, builder};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) struct NetworkChanged;
|
||||
@@ -53,7 +32,7 @@ enum Native {
|
||||
pub(super) async fn run(
|
||||
identity: Identity,
|
||||
vpn: Arc<Vpn>,
|
||||
prepared: PreparedScriptTun,
|
||||
mut prepared: PreparedScriptTun,
|
||||
approval: &crate::hip_source::HipApproval,
|
||||
lifecycle: &LifecycleHandle,
|
||||
cancellation: CancellationToken,
|
||||
@@ -62,6 +41,8 @@ pub(super) async fn run(
|
||||
registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
sessions: &mut gpapi::session::desktop::GatewaySessions,
|
||||
) -> anyhow::Result<()> {
|
||||
let channel = prepared.connect().await?;
|
||||
let mut control = ConsumerControl::new(channel);
|
||||
let attempt = identity.attempt;
|
||||
let (native_tx, native) = mpsc::channel(64);
|
||||
let observed = native_tx.clone();
|
||||
@@ -77,7 +58,7 @@ pub(super) async fn run(
|
||||
monitor: monitor.clone(),
|
||||
})
|
||||
.await;
|
||||
if event_result.is_err() {
|
||||
if event_result.is_err() || cancellation.is_cancelled() {
|
||||
monitor.stop().await;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -91,31 +72,50 @@ pub(super) async fn run(
|
||||
tokio::pin!(worker);
|
||||
let mut worker_done = false;
|
||||
let stop = cancellation.child_token();
|
||||
let supervisor = supervise(identity, prepared, native, stop.clone(), events);
|
||||
tokio::pin!(supervisor);
|
||||
let mut supervisor_done = false;
|
||||
let mut approval_poll = tokio::time::interval(Duration::from_millis(250));
|
||||
let result = loop {
|
||||
tokio::select! {
|
||||
biased;
|
||||
result = &mut supervisor => { supervisor_done = true; break result; }
|
||||
result = &mut worker => { worker_done = true; break Err(anyhow::anyhow!("VPN worker ended: {:?}", result)); }
|
||||
_ = approval_poll.tick() => {
|
||||
if !approval.approval_is_valid() || !registry.has_session(session_id) {
|
||||
super::runtime::stop_for_revoked_approval(lifecycle, &cancellation);
|
||||
let result = {
|
||||
let supervisor = supervise(
|
||||
identity,
|
||||
&mut control,
|
||||
std::mem::take(&mut prepared.bootstrap),
|
||||
native,
|
||||
stop.clone(),
|
||||
events,
|
||||
);
|
||||
tokio::pin!(supervisor);
|
||||
let mut supervisor_done = false;
|
||||
let mut approval_poll = tokio::time::interval(Duration::from_millis(250));
|
||||
let result = loop {
|
||||
tokio::select! {
|
||||
biased;
|
||||
result = &mut supervisor => { supervisor_done = true; break result; }
|
||||
result = &mut worker => { worker_done = true; break Err(anyhow::anyhow!("VPN worker ended: {:?}", result)); }
|
||||
_ = approval_poll.tick() => {
|
||||
if !approval.approval_is_valid() || !registry.has_session(session_id) {
|
||||
super::runtime::stop_for_revoked_approval(lifecycle, &cancellation);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
stop.cancel();
|
||||
// Keep the consumer's control and packet endpoints alive until OpenConnect
|
||||
// consumes cancellation and logs out. Early EOF would interrupt that logout.
|
||||
vpn.disconnect();
|
||||
if !worker_done {
|
||||
let _ = worker.await;
|
||||
}
|
||||
if !supervisor_done {
|
||||
let _ = supervisor.await;
|
||||
}
|
||||
result
|
||||
};
|
||||
stop.cancel();
|
||||
if !supervisor_done {
|
||||
let _ = supervisor.await;
|
||||
}
|
||||
vpn.disconnect();
|
||||
if !worker_done {
|
||||
let _ = worker.await;
|
||||
}
|
||||
control.stop().await;
|
||||
let cleanup = prepared.stop_worker();
|
||||
monitor.stop().await;
|
||||
if result.is_ok() {
|
||||
cleanup?;
|
||||
} else if let Err(error) = cleanup {
|
||||
log::warn!("Could not stop packet worker: {error:#}");
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
@@ -128,93 +128,113 @@ enum WorkerState {
|
||||
Suspending,
|
||||
}
|
||||
|
||||
// The same control loop runs against native observations in production and a
|
||||
// generic socket consumer in tests; VPN ownership stays in run().
|
||||
// Own the channel independently of its supervision future so run() can drain
|
||||
// the native VPN before telling the consumer to stop or closing its endpoints.
|
||||
struct ConsumerControl {
|
||||
output: tokio::io::WriteHalf<platform::ControlStream>,
|
||||
messages: mpsc::Receiver<std::io::Result<Message>>,
|
||||
reader: tokio::task::JoinHandle<()>,
|
||||
}
|
||||
impl ConsumerControl {
|
||||
fn new(channel: platform::ControlStream) -> Self {
|
||||
let (mut input, output) = tokio::io::split(channel);
|
||||
let (messages_tx, messages) = mpsc::channel(8);
|
||||
let reader = tokio::spawn(async move {
|
||||
loop {
|
||||
let message = receive(&mut input).await;
|
||||
let failed = message.is_err();
|
||||
if messages_tx.send(message).await.is_err() || failed {
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
Self {
|
||||
output,
|
||||
messages,
|
||||
reader,
|
||||
}
|
||||
}
|
||||
async fn stop(&mut self) {
|
||||
let _ = tokio::time::timeout(Duration::from_millis(250), send(&mut self.output, &Message::Stop)).await;
|
||||
self.reader.abort();
|
||||
let _ = (&mut self.reader).await;
|
||||
}
|
||||
}
|
||||
impl Drop for ConsumerControl {
|
||||
fn drop(&mut self) {
|
||||
self.reader.abort();
|
||||
}
|
||||
}
|
||||
|
||||
// Production and generic-consumer tests exercise this same state machine.
|
||||
async fn supervise(
|
||||
identity: Identity,
|
||||
mut prepared: PreparedScriptTun,
|
||||
control: &mut ConsumerControl,
|
||||
mut bootstrap: Bootstrap,
|
||||
mut native: mpsc::Receiver<Native>,
|
||||
cancellation: CancellationToken,
|
||||
events: mpsc::Sender<LifecycleEvent>,
|
||||
) -> anyhow::Result<()> {
|
||||
let attempt = identity.attempt;
|
||||
prepared.control.set_nonblocking(true)?;
|
||||
let control = UnixStream::from_std(prepared.control)?;
|
||||
let (mut input, mut output) = control.into_split();
|
||||
let (messages_tx, mut messages) = mpsc::channel(8);
|
||||
let reader = tokio::spawn(async move {
|
||||
loop {
|
||||
let message = receive(&mut input).await;
|
||||
let failed = message.is_err();
|
||||
if messages_tx.send(message).await.is_err() || failed {
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
let ConsumerControl { output, messages, .. } = control;
|
||||
let mut network = None;
|
||||
let mut session = None;
|
||||
let mut worker = WorkerState::Preparing;
|
||||
let mut online = false;
|
||||
let mut was_connected = false;
|
||||
let mut deadline: Option<Instant> = None;
|
||||
let result = async {
|
||||
loop {
|
||||
tokio::select! {
|
||||
biased;
|
||||
_ = cancellation.cancelled() => break,
|
||||
_ = async { if let Some(at) = deadline { tokio::time::sleep_until(at).await } else { std::future::pending().await } } => bail!("Script-tun worker activation timed out"),
|
||||
message = messages.recv() => match message.context("Script-tun control reader stopped")?? {
|
||||
Message::Ready if worker == WorkerState::Preparing && network.is_some() => {
|
||||
worker = WorkerState::Ready;
|
||||
}
|
||||
Message::Activated if worker == WorkerState::Activating => {
|
||||
ensure!(online, "Script-tun activation completed while VPN was offline");
|
||||
ensure!(!cancellation.is_cancelled(), "Script-tun startup cancelled");
|
||||
events.send(LifecycleEvent::Established { attempt, session: session.clone().context("Native session is missing")? }).await?;
|
||||
worker = WorkerState::Active; was_connected = true; deadline = None;
|
||||
}
|
||||
Message::Suspended if worker == WorkerState::Suspending => { worker = WorkerState::Ready; deadline = None; }
|
||||
Message::Error { message } => bail!("Script-tun worker: {message}"),
|
||||
_ => bail!("Unexpected script-tun consumer message"),
|
||||
},
|
||||
event = native.recv() => match event.context("Native event stream ended")? {
|
||||
Native::Established(value) => { session = Some(value); online = true; deadline.get_or_insert(Instant::now() + Duration::from_secs(10)); }
|
||||
Native::Event(Event::Configuration(config)) => {
|
||||
let observed = config.context("VPN configuration is absent").and_then(observed_network);
|
||||
if was_connected && (observed.is_err() || network.as_ref().is_some_and(|old| observed.as_ref().is_ok_and(|new| old != new))) { return Err(NetworkChanged.into()); }
|
||||
let observed = observed?;
|
||||
if let Some(old) = &network { ensure!(old == &observed, "VPN configuration changed during startup"); }
|
||||
else {
|
||||
send(&mut output, &Message::Configure { identity, bootstrap: std::mem::take(&mut prepared.bootstrap), network: observed.clone() }).await?;
|
||||
network = Some(observed);
|
||||
deadline = Some(Instant::now() + Duration::from_secs(10));
|
||||
}
|
||||
}
|
||||
Native::Event(Event::Reconnecting) => {
|
||||
ensure!(worker != WorkerState::Activating, "VPN connection interrupted during script-tun activation; reconnect the VPN");
|
||||
online = false;
|
||||
events.send(LifecycleEvent::ScriptTunSuspended { attempt }).await?;
|
||||
if matches!(worker, WorkerState::Ready | WorkerState::Active) {
|
||||
send(&mut output, &Message::Suspend).await?; worker = WorkerState::Suspending;
|
||||
deadline = Some(Instant::now() + Duration::from_secs(10));
|
||||
}
|
||||
}
|
||||
Native::Event(Event::Reconnected) => online = true,
|
||||
Native::Event(_) => {},
|
||||
loop {
|
||||
tokio::select! {
|
||||
biased;
|
||||
_ = cancellation.cancelled() => break,
|
||||
_ = async { if let Some(at) = deadline { tokio::time::sleep_until(at).await } else { std::future::pending().await } } => bail!("Script-tun worker activation timed out"),
|
||||
message = messages.recv() => match message.context("Script-tun control reader stopped")?? {
|
||||
Message::Ready if worker == WorkerState::Preparing && network.is_some() => {
|
||||
worker = WorkerState::Ready;
|
||||
}
|
||||
}
|
||||
if online && session.is_some() && worker == WorkerState::Ready && !cancellation.is_cancelled() {
|
||||
send(&mut output, &Message::Activate).await?; worker = WorkerState::Activating;
|
||||
deadline = Some(Instant::now() + Duration::from_secs(10));
|
||||
Message::Activated if worker == WorkerState::Activating => {
|
||||
ensure!(online, "Script-tun activation completed while VPN was offline");
|
||||
ensure!(!cancellation.is_cancelled(), "Script-tun startup cancelled");
|
||||
events.send(LifecycleEvent::Established { attempt, session: session.clone().context("Native session is missing")? }).await?;
|
||||
worker = WorkerState::Active; was_connected = true; deadline = None;
|
||||
}
|
||||
Message::Suspended if worker == WorkerState::Suspending => { worker = WorkerState::Ready; deadline = None; }
|
||||
Message::Error { message } => bail!("Script-tun worker: {message}"),
|
||||
_ => bail!("Unexpected script-tun consumer message"),
|
||||
},
|
||||
event = native.recv() => match event.context("Native event stream ended")? {
|
||||
Native::Established(value) => { session = Some(value); online = true; deadline.get_or_insert(Instant::now() + Duration::from_secs(10)); }
|
||||
Native::Event(Event::Configuration(config)) => {
|
||||
let observed = config.context("VPN configuration is absent").and_then(observed_network);
|
||||
if was_connected && (observed.is_err() || network.as_ref().is_some_and(|old| observed.as_ref().is_ok_and(|new| old != new))) { return Err(NetworkChanged.into()); }
|
||||
let observed = observed?;
|
||||
if let Some(old) = &network { ensure!(old == &observed, "VPN configuration changed during startup"); }
|
||||
else {
|
||||
send(output, &Message::Configure { identity, bootstrap: std::mem::take(&mut bootstrap), network: observed.clone() }).await?;
|
||||
network = Some(observed);
|
||||
deadline = Some(Instant::now() + Duration::from_secs(10));
|
||||
}
|
||||
}
|
||||
Native::Event(Event::Reconnecting) => {
|
||||
ensure!(worker != WorkerState::Activating, "VPN connection interrupted during script-tun activation; reconnect the VPN");
|
||||
online = false;
|
||||
events.send(LifecycleEvent::ScriptTunSuspended { attempt }).await?;
|
||||
if matches!(worker, WorkerState::Ready | WorkerState::Active) {
|
||||
send(output, &Message::Suspend).await?; worker = WorkerState::Suspending;
|
||||
deadline = Some(Instant::now() + Duration::from_secs(10));
|
||||
}
|
||||
}
|
||||
Native::Event(Event::Reconnected) => online = true,
|
||||
Native::Event(_) => {},
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}.await;
|
||||
let _ = tokio::time::timeout(Duration::from_millis(250), send(&mut output, &Message::Stop)).await;
|
||||
drop(output);
|
||||
reader.abort();
|
||||
let _ = reader.await;
|
||||
result
|
||||
if online && session.is_some() && worker == WorkerState::Ready && !cancellation.is_cancelled() {
|
||||
send(output, &Message::Activate).await?;
|
||||
worker = WorkerState::Activating;
|
||||
deadline = Some(Instant::now() + Duration::from_secs(10));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn observed_network(
|
||||
@@ -243,5 +263,5 @@ async fn send(writer: &mut (impl tokio::io::AsyncWrite + Unpin), message: &Messa
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(all(test, unix))]
|
||||
mod tests;
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::*;
|
||||
use gpapi::script_tun::{Bootstrap, ScriptTunRequest};
|
||||
use openconnect::{VpnSessionInfo, tunnel::Configuration};
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tokio::net::UnixStream;
|
||||
|
||||
// A generic consumer, with no proxy settings or private worker protocol.
|
||||
struct Consumer {
|
||||
@@ -23,16 +25,26 @@ impl Consumer {
|
||||
launch_id: uuid::Uuid::new_v4(),
|
||||
};
|
||||
let cancel = CancellationToken::new();
|
||||
let task = tokio::spawn(supervise(
|
||||
identity,
|
||||
PreparedScriptTun {
|
||||
control,
|
||||
let stopped = cancel.clone();
|
||||
let task = tokio::spawn(async move {
|
||||
let mut prepared = PreparedScriptTun {
|
||||
control: Some(control),
|
||||
bootstrap: Bootstrap::new(b"consumer bootstrap").unwrap(),
|
||||
},
|
||||
observations,
|
||||
cancel.clone(),
|
||||
events,
|
||||
));
|
||||
};
|
||||
let channel = prepared.connect().await?;
|
||||
let mut control = ConsumerControl::new(channel);
|
||||
let result = supervise(
|
||||
identity,
|
||||
&mut control,
|
||||
prepared.bootstrap,
|
||||
observations,
|
||||
stopped,
|
||||
events,
|
||||
)
|
||||
.await;
|
||||
control.stop().await;
|
||||
result
|
||||
});
|
||||
Self {
|
||||
control: UnixStream::from_std(child).unwrap(),
|
||||
native,
|
||||
@@ -291,3 +303,36 @@ async fn reconnect_during_activation_returns_clear_error_without_connected() {
|
||||
);
|
||||
assert!(consumer.events.try_recv().is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn supervision_completion_keeps_consumer_alive_until_owner_stops_it() {
|
||||
let (channel, mut peer) = UnixStream::pair().unwrap();
|
||||
let mut control = ConsumerControl::new(channel);
|
||||
let (_native, observations) = mpsc::channel(1);
|
||||
let (events, _notifications) = mpsc::channel(1);
|
||||
let cancellation = CancellationToken::new();
|
||||
cancellation.cancel();
|
||||
supervise(
|
||||
Identity {
|
||||
service_instance: uuid::Uuid::new_v4(),
|
||||
attempt: 1,
|
||||
launch_id: uuid::Uuid::new_v4(),
|
||||
},
|
||||
&mut control,
|
||||
Bootstrap::default(),
|
||||
observations,
|
||||
cancellation,
|
||||
events,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(
|
||||
tokio::time::timeout(Duration::from_millis(30), receive(&mut peer))
|
||||
.await
|
||||
.is_err()
|
||||
);
|
||||
control.stop().await;
|
||||
assert!(matches!(receive(&mut peer).await.unwrap(), Message::Stop));
|
||||
drop(control);
|
||||
assert!(receive(&mut peer).await.is_err());
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
use anyhow::{Context, ensure};
|
||||
use gpapi::script_tun::{Bootstrap, ScriptTunRequest};
|
||||
use openconnect::{Vpn, VpnBuilder};
|
||||
pub(super) type ControlStream = tokio::net::UnixStream;
|
||||
pub(crate) struct PreparedScriptTun {
|
||||
pub(super) control: Option<std::os::unix::net::UnixStream>,
|
||||
pub bootstrap: Bootstrap,
|
||||
}
|
||||
|
||||
pub(crate) fn builder(
|
||||
server: &str,
|
||||
cookie: &str,
|
||||
request: &ScriptTunRequest,
|
||||
uid: u32,
|
||||
) -> anyhow::Result<(VpnBuilder, PreparedScriptTun)> {
|
||||
request.validate()?;
|
||||
ensure!(uid != 0, "Script-tun worker requires a desktop user");
|
||||
let (control, child) = std::os::unix::net::UnixStream::pair()?;
|
||||
let builder = Vpn::builder(server, cookie).script_tun_program(
|
||||
request.program.to_str().context("Program is not UTF-8")?,
|
||||
&request.args,
|
||||
uid,
|
||||
child.into(),
|
||||
)?;
|
||||
Ok((
|
||||
builder,
|
||||
PreparedScriptTun {
|
||||
control: Some(control),
|
||||
bootstrap: request.bootstrap.clone(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
impl PreparedScriptTun {
|
||||
pub(super) async fn connect(&mut self) -> anyhow::Result<ControlStream> {
|
||||
let control = self.control.take().context("Worker control pipe is unavailable")?;
|
||||
control.set_nonblocking(true)?;
|
||||
Ok(tokio::net::UnixStream::from_std(control)?)
|
||||
}
|
||||
// The native OpenConnect Unix launcher owns/reaps its child on disconnect.
|
||||
pub(super) fn stop_worker(&mut self) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
use anyhow::{Context, ensure};
|
||||
use gpapi::{
|
||||
process::user_process::UserProcess,
|
||||
script_tun::{Bootstrap, ScriptTunRequest},
|
||||
windows::PipeClientIdentity,
|
||||
};
|
||||
use openconnect::{Vpn, VpnBuilder};
|
||||
use std::{os::windows::io::AsRawHandle, sync::Arc, time::Duration};
|
||||
use tokio::net::windows::named_pipe::NamedPipeServer;
|
||||
use windows_sys::Win32::System::Pipes::GetNamedPipeClientProcessId;
|
||||
pub(super) type ControlStream = NamedPipeServer;
|
||||
|
||||
pub(crate) struct PreparedScriptTun {
|
||||
control: Option<NamedPipeServer>,
|
||||
worker: UserProcess,
|
||||
pub(super) bootstrap: Bootstrap,
|
||||
}
|
||||
pub(crate) fn builder(
|
||||
server: &str,
|
||||
cookie: &str,
|
||||
request: &ScriptTunRequest,
|
||||
owner: Arc<PipeClientIdentity>,
|
||||
) -> anyhow::Result<(VpnBuilder, PreparedScriptTun)> {
|
||||
request.validate()?;
|
||||
let attempt = uuid::Uuid::new_v4();
|
||||
let control_name = format!(r"\\.\pipe\GPConnect.ScriptTun.{attempt}.Control");
|
||||
let packet_name = format!(r"\\.\pipe\GPConnect.ScriptTun.{attempt}.Packets");
|
||||
let control = owner.create_control_pipe(&control_name)?;
|
||||
let mut packets = owner.create_packet_pipe(&packet_name)?;
|
||||
let worker = UserProcess::launch(
|
||||
owner.primary_token(),
|
||||
&request.program,
|
||||
&request.args,
|
||||
&[
|
||||
("OPENCONNECT_SCRIPT_TUN_CONTROL_PIPE", &control_name),
|
||||
("VPN_PIPE", &packet_name),
|
||||
],
|
||||
)
|
||||
.context("Could not launch the user-session packet worker")?;
|
||||
packets.connect(worker.id(), Duration::from_secs(10))?;
|
||||
// PacketPipe creates only raw overlapped Win32 I/O and never registers IOCP.
|
||||
let builder = unsafe { Vpn::builder(server, cookie).script_tun_pipe(packets.into_handle()) };
|
||||
Ok((
|
||||
builder,
|
||||
PreparedScriptTun {
|
||||
control: Some(control),
|
||||
worker,
|
||||
bootstrap: request.bootstrap.clone(),
|
||||
},
|
||||
))
|
||||
}
|
||||
impl PreparedScriptTun {
|
||||
pub(super) async fn connect(&mut self) -> anyhow::Result<ControlStream> {
|
||||
ensure!(!self.worker.has_exited()?, "The packet worker exited during startup");
|
||||
let control = self.control.take().context("Worker control pipe is unavailable")?;
|
||||
tokio::time::timeout(Duration::from_secs(10), control.connect())
|
||||
.await
|
||||
.context("Packet control connection timed out")??;
|
||||
let mut pid = 0;
|
||||
if unsafe { GetNamedPipeClientProcessId(control.as_raw_handle(), &mut pid) } == 0 {
|
||||
return Err(std::io::Error::last_os_error().into());
|
||||
}
|
||||
ensure!(pid == self.worker.id(), "Unexpected packet control client");
|
||||
Ok(control)
|
||||
}
|
||||
pub(super) fn stop_worker(&mut self) -> anyhow::Result<()> {
|
||||
Ok(self.worker.stop()?)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
//! One service-owned local patch search, independent of report generation.
|
||||
use gpapi::{
|
||||
collection::{CollectionBudget, CollectionControl},
|
||||
process::collection::CollectorCommands,
|
||||
};
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
sync::{Arc, Mutex},
|
||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use uuid::Uuid;
|
||||
|
||||
const INTERVAL: Duration = Duration::from_secs(15 * 60);
|
||||
const SEARCH_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
|
||||
enum Command {
|
||||
Interest(Uuid, bool),
|
||||
CheckIfDue,
|
||||
Refresh(Option<u64>, oneshot::Sender<bool>),
|
||||
}
|
||||
|
||||
pub(crate) struct PatchChecks {
|
||||
tx: mpsc::UnboundedSender<Command>,
|
||||
rx: Mutex<Option<mpsc::UnboundedReceiver<Command>>>,
|
||||
}
|
||||
|
||||
pub(crate) struct Consumer {
|
||||
checks: Arc<PatchChecks>,
|
||||
id: Uuid,
|
||||
}
|
||||
impl Drop for Consumer {
|
||||
fn drop(&mut self) {
|
||||
self.checks.set_interest(self.id, false);
|
||||
}
|
||||
}
|
||||
|
||||
impl PatchChecks {
|
||||
pub(crate) fn new() -> Arc<Self> {
|
||||
let (tx, rx) = mpsc::unbounded_channel();
|
||||
Arc::new(Self {
|
||||
tx,
|
||||
rx: Mutex::new(Some(rx)),
|
||||
})
|
||||
}
|
||||
pub(crate) fn set_interest(&self, id: Uuid, enabled: bool) {
|
||||
let _ = self.tx.send(Command::Interest(id, enabled));
|
||||
}
|
||||
pub(crate) fn check_if_due(&self) {
|
||||
let _ = self.tx.send(Command::CheckIfDue);
|
||||
}
|
||||
pub(crate) fn consumer(self: &Arc<Self>) -> Consumer {
|
||||
let id = Uuid::new_v4();
|
||||
self.set_interest(id, true);
|
||||
Consumer {
|
||||
checks: self.clone(),
|
||||
id,
|
||||
}
|
||||
}
|
||||
pub(crate) async fn refresh(&self, after: Option<u64>) -> bool {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
if self.tx.send(Command::Refresh(after, tx)).is_err() {
|
||||
return false;
|
||||
}
|
||||
rx.await.unwrap_or(false)
|
||||
}
|
||||
pub(crate) async fn run(&self, stop: CancellationToken) {
|
||||
let Some(mut commands) = self.rx.lock().unwrap().take() else {
|
||||
return;
|
||||
};
|
||||
let mut consumers = HashSet::new();
|
||||
let mut waiters = Vec::<oneshot::Sender<bool>>::new();
|
||||
let mut worker = None;
|
||||
// Reading status never searches Windows Update. Missing/unreadable data is due immediately.
|
||||
let status = tokio::task::spawn_blocking({
|
||||
let stop = stop.clone();
|
||||
move || helper("--patch-status", None, stop)
|
||||
})
|
||||
.await;
|
||||
let mut next = match status {
|
||||
Ok(Ok(Some(checked))) => checked.saturating_add(INTERVAL.as_secs()),
|
||||
_ => 0,
|
||||
};
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = stop.cancelled() => break,
|
||||
command = commands.recv() => {
|
||||
match command {
|
||||
Some(Command::Interest(id, enabled)) => {
|
||||
if enabled { consumers.insert(id); } else { consumers.remove(&id); }
|
||||
}
|
||||
Some(Command::CheckIfDue) => {
|
||||
if worker.is_none() && now() >= next { worker = Some(start(None, stop.clone())); }
|
||||
}
|
||||
Some(Command::Refresh(after, reply)) => {
|
||||
waiters.push(reply);
|
||||
if worker.is_none() { worker = Some(start(after, stop.clone())); }
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
result = async { match &mut worker { Some(task) => task.await, None => std::future::pending().await } } => {
|
||||
worker = None;
|
||||
let success = matches!(&result, Ok(Ok(Some(_))));
|
||||
if !success { log::warn!("Local Windows patch check failed: {result:?}"); }
|
||||
for reply in waiters.drain(..) { let _ = reply.send(success); }
|
||||
next = match result {
|
||||
Ok(Ok(Some(checked))) => checked.saturating_add(INTERVAL.as_secs()),
|
||||
_ => now().saturating_add(INTERVAL.as_secs()),
|
||||
};
|
||||
}
|
||||
_ = tokio::time::sleep(Duration::from_secs(next.saturating_sub(now()).min(30))),
|
||||
if worker.is_none() && !consumers.is_empty() => {
|
||||
if now() >= next { worker = Some(start(None, stop.clone())); }
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(task) = worker {
|
||||
let _ = task.await;
|
||||
}
|
||||
for reply in waiters {
|
||||
let _ = reply.send(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn now() -> u64 {
|
||||
SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_secs()
|
||||
}
|
||||
fn start(after: Option<u64>, stop: CancellationToken) -> tokio::task::JoinHandle<anyhow::Result<Option<u64>>> {
|
||||
tokio::task::spawn_blocking(move || helper("--refresh-patches", after, stop))
|
||||
}
|
||||
fn helper(command: &str, after: Option<u64>, stop: CancellationToken) -> anyhow::Result<Option<u64>> {
|
||||
let budget = CollectionBudget::new(SEARCH_TIMEOUT);
|
||||
let check = || {
|
||||
if stop.is_cancelled() {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Interrupted,
|
||||
"Patch check cancelled",
|
||||
));
|
||||
}
|
||||
budget.check()
|
||||
};
|
||||
let path = std::env::current_exe()?.with_file_name("gp-posture.exe");
|
||||
let after = after.map(|after| after.to_string());
|
||||
let mut args = vec![command];
|
||||
if let Some(after) = &after {
|
||||
args.push(after);
|
||||
}
|
||||
let output = CollectorCommands::new(&check)
|
||||
.run_executable(&path, &args)?
|
||||
.ok_or_else(|| anyhow::anyhow!("Windows posture helper is unavailable"))?;
|
||||
anyhow::ensure!(output.status.success(), "Windows posture helper failed");
|
||||
Ok(serde_json::from_slice(&output.stdout)?)
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//! A credential lease binds the existing desktop session to its Windows token.
|
||||
use crate::session_registry::SessionRegistry;
|
||||
use anyhow::{Context, ensure};
|
||||
use gpapi::{
|
||||
service::transport::WINDOWS_ADMISSION_REQUEST,
|
||||
windows::{PipeClientIdentity, create_service_admission_pipe},
|
||||
};
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use tokio::{
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
net::windows::named_pipe::NamedPipeServer,
|
||||
task::JoinSet,
|
||||
};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
pub(super) struct Admission {
|
||||
listener: NamedPipeServer,
|
||||
registry: Arc<SessionRegistry>,
|
||||
}
|
||||
struct Lease {
|
||||
registry: Arc<SessionRegistry>,
|
||||
session: uuid::Uuid,
|
||||
}
|
||||
impl Drop for Lease {
|
||||
fn drop(&mut self) {
|
||||
self.registry.revoke(self.session);
|
||||
}
|
||||
}
|
||||
impl Admission {
|
||||
pub fn new(registry: Arc<SessionRegistry>) -> anyhow::Result<Self> {
|
||||
Ok(Self {
|
||||
listener: create_service_admission_pipe(true)?,
|
||||
registry,
|
||||
})
|
||||
}
|
||||
pub async fn run(mut self, cancel: CancellationToken) -> anyhow::Result<()> {
|
||||
let mut clients = JoinSet::new();
|
||||
let result = loop {
|
||||
tokio::select! {
|
||||
_ = cancel.cancelled() => break Ok(()),
|
||||
result = self.listener.connect() => {
|
||||
if let Err(error) = result { break Err(error.into()); }
|
||||
let next = match create_service_admission_pipe(false) { Ok(next) => next, Err(error) => break Err(error.into()) };
|
||||
let pipe = std::mem::replace(&mut self.listener, next);
|
||||
let registry = self.registry.clone();
|
||||
let cancel = cancel.clone();
|
||||
clients.spawn(async move {
|
||||
if let Err(error) = serve(pipe, registry, cancel).await { log::warn!("Desktop credential lease ended: {error:#}"); }
|
||||
});
|
||||
}
|
||||
_ = clients.join_next(), if !clients.is_empty() => {},
|
||||
}
|
||||
};
|
||||
// Drop each lease before the shared registry and service runtime disappear.
|
||||
clients.abort_all();
|
||||
while clients.join_next().await.is_some() {}
|
||||
result
|
||||
}
|
||||
}
|
||||
async fn serve(
|
||||
mut pipe: NamedPipeServer,
|
||||
registry: Arc<SessionRegistry>,
|
||||
cancel: CancellationToken,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut request = [0; WINDOWS_ADMISSION_REQUEST.len()];
|
||||
tokio::select! {
|
||||
_ = cancel.cancelled() => return Ok(()),
|
||||
result = tokio::time::timeout(Duration::from_secs(10), pipe.read_exact(&mut request)) => { result.context("Desktop admission timed out")??; }
|
||||
}
|
||||
ensure!(
|
||||
request == WINDOWS_ADMISSION_REQUEST,
|
||||
"Invalid desktop admission request"
|
||||
);
|
||||
// This synchronous call impersonates, duplicates and reverts before any await.
|
||||
let identity = Arc::new(PipeClientIdentity::from_pipe(&pipe)?);
|
||||
let credential = registry.issue_windows(env!("CARGO_PKG_VERSION"), identity)?;
|
||||
let _lease = Lease {
|
||||
registry,
|
||||
session: credential.session_id(),
|
||||
};
|
||||
let frame = credential.encode_frame()?;
|
||||
tokio::select! {
|
||||
_ = cancel.cancelled() => return Ok(()),
|
||||
result = tokio::time::timeout(Duration::from_secs(10), pipe.write_all(&frame)) => { result.context("Desktop credential delivery timed out")??; }
|
||||
}
|
||||
let mut byte = [0];
|
||||
tokio::select! {
|
||||
_ = cancel.cancelled() => {},
|
||||
result = pipe.read(&mut byte) => { ensure!(result? == 0, "Unexpected desktop lease message"); }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
use std::{fs::OpenOptions, io, path::Path};
|
||||
|
||||
use file_rotate::{ContentLimit, FileRotate, compression::Compression, suffix::AppendCount};
|
||||
|
||||
const ROTATE_BYTES: usize = 5 * 1024 * 1024;
|
||||
const ARCHIVE_COUNT: usize = 3;
|
||||
|
||||
pub(super) fn writer(path: &Path) -> io::Result<FileRotate<AppendCount>> {
|
||||
// Keep startup failure explicit: FileRotate's constructor suppresses open errors.
|
||||
OpenOptions::new().create(true).read(true).append(true).open(path)?;
|
||||
Ok(FileRotate::new(
|
||||
path,
|
||||
AppendCount::new(ARCHIVE_COUNT),
|
||||
ContentLimit::BytesSurpassed(ROTATE_BYTES),
|
||||
Compression::None,
|
||||
None,
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::{fs, io::Write};
|
||||
|
||||
#[test]
|
||||
fn keeps_the_latest_three_archives_and_complete_current_entry() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("gpservice.log");
|
||||
fs::write(dir.path().join("unrelated.log"), "keep").unwrap();
|
||||
let mut log = writer(&path).unwrap();
|
||||
for marker in b'0'..=b'5' {
|
||||
log.write_all(&vec![marker; ROTATE_BYTES + 1]).unwrap();
|
||||
}
|
||||
log.flush().unwrap();
|
||||
drop(log);
|
||||
|
||||
assert_eq!(fs::read(&path).unwrap(), vec![b'5'; ROTATE_BYTES + 1]);
|
||||
for (suffix, marker) in [(1, b'4'), (2, b'3'), (3, b'2')] {
|
||||
let archive = dir.path().join(format!("gpservice.log.{suffix}"));
|
||||
assert_eq!(fs::read(archive).unwrap(), vec![marker; ROTATE_BYTES + 1]);
|
||||
}
|
||||
assert_eq!(fs::read_dir(dir.path()).unwrap().count(), 5);
|
||||
assert_eq!(fs::read_to_string(dir.path().join("unrelated.log")).unwrap(), "keep");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn restart_appends_and_accounts_for_existing_file_size() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("gpservice.log");
|
||||
fs::write(&path, "before restart\n").unwrap();
|
||||
{
|
||||
let mut log = writer(&path).unwrap();
|
||||
log.write_all(b"after restart\n").unwrap();
|
||||
}
|
||||
assert_eq!(fs::read_to_string(&path).unwrap(), "before restart\nafter restart\n");
|
||||
|
||||
let entry = vec![b'x'; ROTATE_BYTES + 1];
|
||||
fs::write(&path, &entry).unwrap();
|
||||
{
|
||||
let mut log = writer(&path).unwrap();
|
||||
log.write_all(b"new entry\n").unwrap();
|
||||
}
|
||||
assert_eq!(fs::read(&path).unwrap(), b"new entry\n");
|
||||
assert_eq!(fs::read(dir.path().join("gpservice.log.1")).unwrap(), entry);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_log_path_remains_a_startup_error() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
assert!(writer(dir.path()).is_err());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
//! Service Control Manager hosting; the GUI remains in the user's desktop session.
|
||||
mod admission;
|
||||
mod logging;
|
||||
use crate::{
|
||||
request_dispatcher::RequestDispatcher, session_registry::SessionRegistry, vpn_task::VpnTask, ws_server::WsServer,
|
||||
};
|
||||
use anyhow::{Context, ensure};
|
||||
use gpapi::{
|
||||
service::vpn_state::VpnState,
|
||||
utils::{lock_file::LockFile, redact::Redaction},
|
||||
};
|
||||
use std::{
|
||||
ffi::OsString,
|
||||
io::Write,
|
||||
sync::{Arc, OnceLock, atomic::AtomicBool},
|
||||
time::Duration,
|
||||
};
|
||||
use tokio::sync::{mpsc, watch};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use windows_service::{
|
||||
define_windows_service,
|
||||
service::{ServiceControl, ServiceControlAccept, ServiceExitCode, ServiceState, ServiceStatus, ServiceType},
|
||||
service_control_handler::{self, ServiceControlHandlerResult, ServiceStatusHandle},
|
||||
service_dispatcher,
|
||||
};
|
||||
const NAME: &str = common::paths::SERVICE_NAME;
|
||||
static LOG_LEVEL: OnceLock<log::Level> = OnceLock::new();
|
||||
define_windows_service!(ffi_service_main, service_main);
|
||||
|
||||
pub(crate) fn dispatch(level: log::Level) -> anyhow::Result<()> {
|
||||
let _ = LOG_LEVEL.set(level);
|
||||
service_dispatcher::start(NAME, ffi_service_main).context("Start GP Connect through the Windows service manager")?;
|
||||
Ok(())
|
||||
}
|
||||
fn status(handle: &ServiceStatusHandle, state: ServiceState, failure: bool) -> windows_service::Result<()> {
|
||||
let running = state == ServiceState::Running;
|
||||
let pending = matches!(state, ServiceState::StartPending | ServiceState::StopPending);
|
||||
handle.set_service_status(ServiceStatus {
|
||||
service_type: ServiceType::OWN_PROCESS,
|
||||
current_state: state,
|
||||
controls_accepted: if running {
|
||||
ServiceControlAccept::STOP | ServiceControlAccept::SHUTDOWN
|
||||
} else {
|
||||
ServiceControlAccept::empty()
|
||||
},
|
||||
exit_code: if failure {
|
||||
ServiceExitCode::ServiceSpecific(1)
|
||||
} else {
|
||||
ServiceExitCode::Win32(0)
|
||||
},
|
||||
checkpoint: u32::from(pending),
|
||||
wait_hint: if pending {
|
||||
Duration::from_secs(30)
|
||||
} else {
|
||||
Duration::ZERO
|
||||
},
|
||||
process_id: None,
|
||||
})
|
||||
}
|
||||
fn service_main(_arguments: Vec<OsString>) {
|
||||
let stop = CancellationToken::new();
|
||||
let requested = stop.clone();
|
||||
let handle = match service_control_handler::register(NAME, move |control| match control {
|
||||
ServiceControl::Stop | ServiceControl::Shutdown => {
|
||||
requested.cancel();
|
||||
ServiceControlHandlerResult::NoError
|
||||
}
|
||||
ServiceControl::Interrogate => ServiceControlHandlerResult::NoError,
|
||||
_ => ServiceControlHandlerResult::NotImplemented,
|
||||
}) {
|
||||
Ok(handle) => handle,
|
||||
Err(_) => return,
|
||||
};
|
||||
let result = (|| -> anyhow::Result<()> {
|
||||
status(&handle, ServiceState::StartPending, false)?;
|
||||
ensure!(
|
||||
gpapi::windows::current_user_sid()? == "S-1-5-18",
|
||||
"GP Connect must run as LocalSystem"
|
||||
);
|
||||
let redaction = initialize_logger()?;
|
||||
log::info!("gpservice started: {}", crate::VERSION);
|
||||
crate::vpn_script::recover_network()?;
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread().enable_all().build()?;
|
||||
runtime.block_on(run(&handle, stop, redaction))
|
||||
})();
|
||||
if let Err(error) = &result {
|
||||
log::error!("Windows service stopped: {error:#}");
|
||||
}
|
||||
let _ = status(&handle, ServiceState::Stopped, result.is_err());
|
||||
}
|
||||
fn initialize_logger() -> anyhow::Result<Arc<Redaction>> {
|
||||
let state = common::paths::service_lock_file();
|
||||
let directory = state.parent().context("Service state directory is unavailable")?;
|
||||
// The installer provisions these directories and their machine-wide ACLs.
|
||||
// Starting the daemon must not create a user-writable fallback location.
|
||||
ensure!(
|
||||
directory.is_dir() && common::paths::service_private_dir().is_dir(),
|
||||
"Install the GP Connect Windows service before starting it"
|
||||
);
|
||||
let writer = logging::writer(&directory.join("gpservice.log"))?;
|
||||
let redaction = Arc::new(Redaction::new());
|
||||
let filter = redaction.clone();
|
||||
let logger = env_logger::builder()
|
||||
.filter_level(log::LevelFilter::Trace)
|
||||
.target(env_logger::Target::Pipe(Box::new(writer)))
|
||||
.format(move |buffer, record| {
|
||||
writeln!(
|
||||
buffer,
|
||||
"[{} {:<5} {}] {}",
|
||||
buffer.timestamp(),
|
||||
record.level(),
|
||||
record.module_path().unwrap_or_default(),
|
||||
filter.redact_str(&record.args().to_string())
|
||||
)
|
||||
})
|
||||
.build();
|
||||
gpapi::logger::init_with_logger(*LOG_LEVEL.get().unwrap_or(&log::Level::Info), logger);
|
||||
Ok(redaction)
|
||||
}
|
||||
async fn run(handle: &ServiceStatusHandle, stop: CancellationToken, redaction: Arc<Redaction>) -> anyhow::Result<()> {
|
||||
let lock = Arc::new(LockFile::new(common::paths::service_lock_file(), std::process::id()));
|
||||
let registry = Arc::new(SessionRegistry::new(uuid::Uuid::new_v4()));
|
||||
let admission = admission::Admission::new(registry.clone())?;
|
||||
let (state, observed) = watch::channel(VpnState::Disconnected);
|
||||
let (mut vpn, lifecycle) = VpnTask::new(state, true, registry.clone());
|
||||
let dispatcher = Arc::new(RequestDispatcher::new(
|
||||
lifecycle,
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
redaction,
|
||||
false,
|
||||
true,
|
||||
));
|
||||
let websocket = WsServer::new(env!("CARGO_PKG_VERSION"), registry, dispatcher, observed, lock.clone());
|
||||
let service_cancel = websocket.cancel_token();
|
||||
let vpn_cancel = vpn.cancel_token();
|
||||
let (shutdown_tx, mut shutdown_rx) = mpsc::channel(4);
|
||||
let (ready_tx, ready_rx) = tokio::sync::oneshot::channel();
|
||||
let vpn_stop = service_cancel.clone();
|
||||
let vpn_handle = tokio::spawn(async move { vpn.start(vpn_stop).await });
|
||||
let websocket_shutdown = shutdown_tx.clone();
|
||||
let websocket_handle = tokio::spawn(async move { websocket.start(websocket_shutdown, ready_tx).await });
|
||||
ready_rx.await.context("Desktop protocol listener failed to start")?;
|
||||
let lease_cancel = service_cancel.clone();
|
||||
let admission_handle = tokio::spawn(async move {
|
||||
if let Err(error) = admission.run(lease_cancel).await {
|
||||
log::error!("Desktop admission stopped: {error:#}");
|
||||
let _ = shutdown_tx.send(()).await;
|
||||
}
|
||||
});
|
||||
status(handle, ServiceState::Running, false)?;
|
||||
tokio::select! { _ = stop.cancelled() => {}, _ = shutdown_rx.recv() => {} }
|
||||
let _ = status(handle, ServiceState::StopPending, false);
|
||||
vpn_cancel.cancel();
|
||||
service_cancel.cancel();
|
||||
let _ = tokio::join!(vpn_handle, websocket_handle, admission_handle);
|
||||
lock.unlock()?;
|
||||
log::info!("gpservice stopped");
|
||||
Ok(())
|
||||
}
|
||||
@@ -410,6 +410,48 @@ async fn handle_client_message(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let WsRequest::SetWindowsPatchInterest { enabled } = &request {
|
||||
#[cfg(windows)]
|
||||
ctx.patch_checks.set_interest(control.connection_id(), *enabled);
|
||||
#[cfg(not(windows))]
|
||||
let _ = enabled;
|
||||
control
|
||||
.send(ConnectionCommand::Reply {
|
||||
id,
|
||||
result: ServiceResult::Accepted,
|
||||
})
|
||||
.map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
if let WsRequest::RefreshWindowsPatches { after } = &request {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let checks = ctx.patch_checks.clone();
|
||||
let control = control.clone();
|
||||
let after = Some(after.unwrap_or(0));
|
||||
tokio::spawn(async move {
|
||||
let success = checks.refresh(after).await;
|
||||
let result = if success {
|
||||
ServiceResult::Accepted
|
||||
} else {
|
||||
ServiceResult::rejected(ServiceErrorCode::Internal, "Couldn’t check local updates.")
|
||||
};
|
||||
let _ = control.send(ConnectionCommand::Reply { id, result });
|
||||
});
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
let _ = after;
|
||||
control
|
||||
.send(ConnectionCommand::Reply {
|
||||
id,
|
||||
result: ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Windows patch checks are unavailable"),
|
||||
})
|
||||
.map_err(|_| ())?;
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let WsRequest::StoreEditedHipReportChunk(report) = request {
|
||||
let upload_id = report.upload_id.as_deref().and_then(|id| Uuid::parse_str(id).ok());
|
||||
let result = if report.upload_id.is_some() && upload_id.is_none() {
|
||||
@@ -451,6 +493,7 @@ async fn handle_client_message(
|
||||
offset: chunk.offset,
|
||||
xml,
|
||||
complete,
|
||||
windows_updates: None,
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "HIP preview is unavailable"));
|
||||
@@ -467,6 +510,7 @@ async fn handle_client_message(
|
||||
offset: 0,
|
||||
xml,
|
||||
complete,
|
||||
windows_updates: None,
|
||||
},
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::Internal, "Submitted HIP report is unavailable"),
|
||||
},
|
||||
@@ -501,6 +545,10 @@ async fn handle_client_message(
|
||||
}
|
||||
|
||||
if let WsRequest::PreviewHipReport(preview) = request {
|
||||
#[cfg(windows)]
|
||||
if preview.client_os == gpapi::os_profile::ClientOs::Windows && matches!(preview.source, HipSource::Generated) {
|
||||
ctx.patch_checks.check_if_due();
|
||||
}
|
||||
let edited_report = if let HipSource::Edited { report_id } = &preview.source {
|
||||
let report_id = match Uuid::parse_str(report_id) {
|
||||
Ok(id) => id,
|
||||
|
||||
@@ -63,6 +63,8 @@ pub(crate) struct WsServerContext {
|
||||
state: Mutex<ServiceState>,
|
||||
handshake_slots: Arc<Semaphore>,
|
||||
pub(crate) hip_previews: crate::hip_preview::HipPreviews,
|
||||
#[cfg(windows)]
|
||||
pub(crate) patch_checks: Arc<crate::windows_patches::PatchChecks>,
|
||||
}
|
||||
|
||||
impl WsServerContext {
|
||||
@@ -75,6 +77,8 @@ impl WsServerContext {
|
||||
Self {
|
||||
product_version,
|
||||
registry,
|
||||
#[cfg(windows)]
|
||||
patch_checks: dispatcher.patch_checks(),
|
||||
dispatcher,
|
||||
state: Mutex::new(ServiceState {
|
||||
revision: 0,
|
||||
@@ -183,6 +187,8 @@ impl WsServerContext {
|
||||
|
||||
pub async fn remove_connection(&self, connection_id: Uuid, session_id: Uuid, generation: u64) {
|
||||
self.registry.disconnect_if_current(session_id, generation);
|
||||
#[cfg(windows)]
|
||||
self.patch_checks.set_interest(connection_id, false);
|
||||
let mut state = self.state.lock().await;
|
||||
state.connections.remove(&connection_id);
|
||||
state.refresh_demand();
|
||||
@@ -344,6 +350,7 @@ impl WsServer {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
pub fn context(&self) -> Arc<WsServerContext> {
|
||||
Arc::clone(&self.ctx)
|
||||
}
|
||||
@@ -363,6 +370,12 @@ impl WsServer {
|
||||
};
|
||||
let _ = ready_tx.send(());
|
||||
|
||||
#[cfg(windows)]
|
||||
let patch_task = {
|
||||
let checks = self.ctx.patch_checks.clone();
|
||||
let stop = self.cancel_token.clone();
|
||||
tokio::spawn(async move { checks.run(stop).await })
|
||||
};
|
||||
tokio::select! {
|
||||
_ = watch_vpn_state(self.vpn_state_rx.clone(), Arc::clone(&self.ctx)) => {
|
||||
info!("VPN state watch task completed");
|
||||
@@ -377,6 +390,9 @@ impl WsServer {
|
||||
info!("WS server cancelled");
|
||||
}
|
||||
}
|
||||
self.cancel_token.cancel();
|
||||
#[cfg(windows)]
|
||||
let _ = patch_task.await;
|
||||
self.ctx.hip_previews.shutdown().await;
|
||||
let _ = shutdown_tx.send(()).await;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,97 @@
|
||||
# Changelog
|
||||
|
||||
## 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
|
||||
|
||||
- Added Windows x64 and ARM64 support, with signed installers, built-in browser sign-in, desktop notifications, and in-app updates.
|
||||
- Added a Windows system tray flyout, native HIP reports, and background Windows Update checks.
|
||||
- Added a Compatibility Graphics option on Linux for display problems.
|
||||
|
||||
### Improved
|
||||
|
||||
- Refined Windows settings, controls, icons, and window behavior.
|
||||
- Made HIP Preview faster on Windows and polished connection details across platforms.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Windows keyboard activation, menu dismissal, dropdown feedback, and scrollbars.
|
||||
- Restored focus to GP Connect after browser sign-in on Windows.
|
||||
- Improved recovery from temporary sign-in and license verification failures.
|
||||
- Corrected native HIP host information on Windows, macOS, Linux, and BSD.
|
||||
- Kept sensitive authentication and tunnel data out of debug logs.
|
||||
- Removed unnecessary Linux and FreeBSD package dependencies.
|
||||
|
||||
## 3.4.0
|
||||
|
||||
### Added
|
||||
|
||||
- Added gateway selection and switching directly from the system tray or macOS menu bar.
|
||||
|
||||
### Improved
|
||||
|
||||
- Added a Retry Activation action to recover from temporary license activation failures without re-entering the key.
|
||||
- Made sign-in prompts and connection errors visible when connecting or switching gateways from the tray.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed a Native Shell crash after license activation.
|
||||
- Fixed the macOS Tauri interface opening unexpectedly after signing in from the tray while the main window was hidden.
|
||||
- Fixed the Native Shell update button text becoming unreadable when pressed.
|
||||
- Fixed Linux Nix builds using unavailable WebKitGTK dependencies.
|
||||
|
||||
## 3.3.1
|
||||
|
||||
### Improved
|
||||
|
||||
- Made client certificate errors clearer and added more detail to gateway sign-in logs.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Restored support for client certificates with private extensions and legacy RC4-encrypted PKCS#12 files.
|
||||
- Fixed certificate chain selection for PKCS#12 files containing multiple possible issuers.
|
||||
- Fixed certificate validation and recovery guidance in both desktop interfaces.
|
||||
- Fixed Native Shell Settings windows failing to activate from the macOS menu or reopening on the wrong page.
|
||||
- Fixed keyboard navigation and Escape handling in the macOS Native Shell interface.
|
||||
- Fixed AUR package builds and dependency metadata.
|
||||
|
||||
## 3.3.0
|
||||
|
||||
### Added
|
||||
|
||||
- Added Native Shell, a new desktop interface for macOS and Linux. macOS builds now use it by default.
|
||||
- Added an Interface setting on Linux to switch between Tauri and Native Shell.
|
||||
- Added tray icon appearance options for light and dark desktop panels on Linux, FreeBSD, and OpenBSD.
|
||||
- Added in-app feature highlights, with a setting to turn them off.
|
||||
|
||||
### Improved
|
||||
|
||||
- Made System VPN and Local Proxy modes selectable directly from the main window.
|
||||
- Refined connection details, saved-server selection, keyboard navigation, and dialog appearance.
|
||||
- Removed the need for OpenSSL compatibility configuration and external OpenSSL conversion tools.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed macOS VPN DNS configuration and cleanup, including split-tunnel connections.
|
||||
- Fixed background CLI reconnections failing after the initial connection.
|
||||
- Fixed server addresses losing custom ports when pasted as URLs.
|
||||
- Fixed gateway login address handling for servers with explicit ports.
|
||||
- Fixed browser sign-in registration when desktop-specific settings override the callback handler on Linux, FreeBSD, or OpenBSD.
|
||||
- Fixed Okta FastPass failing to open Okta Verify from the embedded sign-in window on Linux, FreeBSD, and OpenBSD.
|
||||
- Fixed supplied server certificate pins not being enforced during tunnel setup.
|
||||
- Fixed delayed clicks activating a different control after a Native Shell view changed.
|
||||
|
||||
### Command-line notes
|
||||
|
||||
- Deprecated `--fix-openssl` on Linux, FreeBSD, and OpenBSD. Existing commands still accept it, but it has no effect.
|
||||
|
||||
## 3.2.0
|
||||
|
||||
### Added
|
||||
|
||||
+17
-1
@@ -20,7 +20,6 @@ browser-launcher = { path = "../browser-launcher", default-features = false, fea
|
||||
tiny_http = { version = "0.12", optional = true }
|
||||
tempfile = { workspace = true, optional = true }
|
||||
uuid = { version = "1", optional = true, features = ["v4"] }
|
||||
uzers = { workspace = true, optional = true }
|
||||
|
||||
# Webview auth dependencies
|
||||
tauri = { workspace = true, optional = true }
|
||||
@@ -28,6 +27,7 @@ regex = { workspace = true, optional = true }
|
||||
tokio-util = { workspace = true, optional = true }
|
||||
html-escape = { version = "0.3", optional = true }
|
||||
url = { workspace = true, optional = true }
|
||||
serde_json = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
|
||||
webkit2gtk = { version = "2", optional = true }
|
||||
@@ -60,6 +60,9 @@ webview-auth = [
|
||||
"dep:tokio-util",
|
||||
"dep:html-escape",
|
||||
"dep:url",
|
||||
"dep:serde_json",
|
||||
"dep:webview2-com",
|
||||
"dep:windows",
|
||||
"dep:gtk",
|
||||
"dep:webkit2gtk",
|
||||
"dep:block2",
|
||||
@@ -94,3 +97,16 @@ release-devtools = ["webview-auth", "tauri/devtools"]
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile.workspace = true
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
uzers = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_System_Pipes", "Win32_UI_WindowsAndMessaging"] }
|
||||
# Child webviews let the Windows host own layout beside native controls.
|
||||
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.56"
|
||||
common = { path = "../common" }
|
||||
@@ -3,7 +3,6 @@ use std::{
|
||||
io::ErrorKind,
|
||||
os::unix::fs::{DirBuilderExt, FileTypeExt, MetadataExt, OpenOptionsExt, PermissionsExt},
|
||||
path::{Path, PathBuf},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::{Context, bail};
|
||||
@@ -14,16 +13,9 @@ use tokio::{
|
||||
time::timeout,
|
||||
};
|
||||
|
||||
const CALLBACK_SCHEME: &str = "globalprotectcallback";
|
||||
const PROTOCOL_MAGIC: &[u8; 4] = b"GPAC";
|
||||
const PROTOCOL_VERSION: u8 = 1;
|
||||
const MAX_CALLBACK_SIZE: usize = 1024 * 1024;
|
||||
const IO_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
|
||||
// Acceptance acknowledges delivery, including an authentication failure.
|
||||
const STATUS_ACCEPTED: u8 = 0;
|
||||
const STATUS_INVALID_CALLBACK: u8 = 1;
|
||||
const STATUS_UNSUPPORTED_VERSION: u8 = 2;
|
||||
mod protocol;
|
||||
pub use protocol::validate_auth_callback;
|
||||
use protocol::*;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos;
|
||||
@@ -232,62 +224,9 @@ fn remove_stale_socket(socket_path: &Path) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn validate_auth_callback(callback: &str) -> anyhow::Result<()> {
|
||||
if callback.len() > MAX_CALLBACK_SIZE {
|
||||
bail!("Authentication callback exceeds the maximum supported size");
|
||||
}
|
||||
|
||||
let Some((scheme, data)) = callback.split_once(':') else {
|
||||
bail!("Authentication callback URL is invalid");
|
||||
};
|
||||
if scheme != CALLBACK_SCHEME || data.is_empty() {
|
||||
bail!("Authentication callback URL is invalid");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
enum CallbackReadError {
|
||||
UnsupportedVersion,
|
||||
Invalid,
|
||||
Io,
|
||||
}
|
||||
|
||||
async fn read_callback(stream: &mut UnixStream) -> Result<String, CallbackReadError> {
|
||||
let mut magic = [0_u8; 4];
|
||||
stream.read_exact(&mut magic).await.map_err(|_| CallbackReadError::Io)?;
|
||||
if &magic != PROTOCOL_MAGIC {
|
||||
return Err(CallbackReadError::Invalid);
|
||||
}
|
||||
|
||||
let version = stream.read_u8().await.map_err(|_| CallbackReadError::Io)?;
|
||||
if version != PROTOCOL_VERSION {
|
||||
return Err(CallbackReadError::UnsupportedVersion);
|
||||
}
|
||||
|
||||
let length = stream.read_u32().await.map_err(|_| CallbackReadError::Io)? as usize;
|
||||
if length == 0 || length > MAX_CALLBACK_SIZE {
|
||||
return Err(CallbackReadError::Invalid);
|
||||
}
|
||||
|
||||
let mut payload = vec![0; length];
|
||||
stream
|
||||
.read_exact(&mut payload)
|
||||
.await
|
||||
.map_err(|_| CallbackReadError::Io)?;
|
||||
let callback = String::from_utf8(payload).map_err(|_| CallbackReadError::Invalid)?;
|
||||
validate_auth_callback(&callback).map_err(|_| CallbackReadError::Invalid)?;
|
||||
Ok(callback)
|
||||
}
|
||||
|
||||
async fn write_response(stream: &mut UnixStream, status: u8) -> anyhow::Result<()> {
|
||||
stream.write_u8(PROTOCOL_VERSION).await?;
|
||||
stream.write_u8(status).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::time::Duration;
|
||||
use tempfile::tempdir;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//! Bounded authentication callback wire format, shared by local transports.
|
||||
use anyhow::bail;
|
||||
use std::time::Duration;
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
pub(super) const CALLBACK_SCHEME: &str = "globalprotectcallback";
|
||||
pub(super) const PROTOCOL_MAGIC: &[u8; 4] = b"GPAC";
|
||||
pub(super) const PROTOCOL_VERSION: u8 = 1;
|
||||
pub(super) const MAX_CALLBACK_SIZE: usize = 1024 * 1024;
|
||||
pub(super) const IO_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
|
||||
// Acceptance acknowledges delivery, including an authentication failure.
|
||||
pub(super) const STATUS_ACCEPTED: u8 = 0;
|
||||
pub(super) const STATUS_INVALID_CALLBACK: u8 = 1;
|
||||
pub(super) const STATUS_UNSUPPORTED_VERSION: u8 = 2;
|
||||
|
||||
pub fn validate_auth_callback(callback: &str) -> anyhow::Result<()> {
|
||||
if callback.len() > MAX_CALLBACK_SIZE {
|
||||
bail!("Authentication callback exceeds the maximum supported size");
|
||||
}
|
||||
|
||||
let Some((scheme, data)) = callback.split_once(':') else {
|
||||
bail!("Authentication callback URL is invalid");
|
||||
};
|
||||
if scheme != CALLBACK_SCHEME || data.is_empty() {
|
||||
bail!("Authentication callback URL is invalid");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) enum CallbackReadError {
|
||||
UnsupportedVersion,
|
||||
Invalid,
|
||||
Io,
|
||||
}
|
||||
|
||||
pub(super) async fn read_callback(
|
||||
stream: &mut (impl tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin),
|
||||
) -> Result<String, CallbackReadError> {
|
||||
let mut magic = [0_u8; 4];
|
||||
stream.read_exact(&mut magic).await.map_err(|_| CallbackReadError::Io)?;
|
||||
if &magic != PROTOCOL_MAGIC {
|
||||
return Err(CallbackReadError::Invalid);
|
||||
}
|
||||
|
||||
let version = stream.read_u8().await.map_err(|_| CallbackReadError::Io)?;
|
||||
if version != PROTOCOL_VERSION {
|
||||
return Err(CallbackReadError::UnsupportedVersion);
|
||||
}
|
||||
|
||||
let length = stream.read_u32().await.map_err(|_| CallbackReadError::Io)? as usize;
|
||||
if length == 0 || length > MAX_CALLBACK_SIZE {
|
||||
return Err(CallbackReadError::Invalid);
|
||||
}
|
||||
|
||||
let mut payload = vec![0; length];
|
||||
stream
|
||||
.read_exact(&mut payload)
|
||||
.await
|
||||
.map_err(|_| CallbackReadError::Io)?;
|
||||
let callback = String::from_utf8(payload).map_err(|_| CallbackReadError::Invalid)?;
|
||||
validate_auth_callback(&callback).map_err(|_| CallbackReadError::Invalid)?;
|
||||
Ok(callback)
|
||||
}
|
||||
|
||||
pub(super) async fn write_response(
|
||||
stream: &mut (impl tokio::io::AsyncRead + tokio::io::AsyncWrite + Unpin),
|
||||
status: u8,
|
||||
) -> anyhow::Result<()> {
|
||||
stream.write_u8(PROTOCOL_VERSION).await?;
|
||||
stream.write_u8(status).await?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
//! Per-user Windows named pipe for browser authentication callbacks.
|
||||
use anyhow::{Context, bail};
|
||||
use gpapi::{auth::SamlAuthData, error::AuthDataParseError};
|
||||
use std::{io, os::windows::io::AsRawHandle};
|
||||
use tokio::{
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
net::windows::named_pipe::{ClientOptions, NamedPipeClient, NamedPipeServer},
|
||||
time::timeout,
|
||||
};
|
||||
#[path = "protocol.rs"]
|
||||
mod protocol;
|
||||
pub use protocol::validate_auth_callback;
|
||||
use protocol::*;
|
||||
use windows_sys::Win32::{
|
||||
System::Pipes::GetNamedPipeServerProcessId, UI::WindowsAndMessaging::AllowSetForegroundWindow,
|
||||
};
|
||||
|
||||
pub struct AuthCallbackReceiver {
|
||||
listener: NamedPipeServer,
|
||||
}
|
||||
impl AuthCallbackReceiver {
|
||||
pub fn bind() -> anyhow::Result<Self> {
|
||||
Ok(Self {
|
||||
listener: gpapi::windows::create_user_pipe(&pipe_name()?, true)
|
||||
.context("Another browser authentication is already waiting")?,
|
||||
})
|
||||
}
|
||||
pub async fn receive(mut self) -> anyhow::Result<SamlAuthData> {
|
||||
loop {
|
||||
self.listener.connect().await?;
|
||||
let mut stream = &mut self.listener;
|
||||
let callback = timeout(IO_TIMEOUT, read_callback(&mut stream)).await;
|
||||
let result = match callback {
|
||||
Ok(Ok(callback)) => match SamlAuthData::from_gpcallback(&callback) {
|
||||
Ok(data) => {
|
||||
let _ = write_response(&mut stream, STATUS_ACCEPTED).await;
|
||||
Some(Ok(data))
|
||||
}
|
||||
Err(error @ AuthDataParseError::AuthenticationFailed(_)) => {
|
||||
let _ = write_response(&mut stream, STATUS_ACCEPTED).await;
|
||||
Some(Err(error.into()))
|
||||
}
|
||||
Err(_) => {
|
||||
let _ = write_response(&mut stream, STATUS_INVALID_CALLBACK).await;
|
||||
None
|
||||
}
|
||||
},
|
||||
Ok(Err(CallbackReadError::UnsupportedVersion)) => {
|
||||
let _ = write_response(&mut stream, STATUS_UNSUPPORTED_VERSION).await;
|
||||
None
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
// DisconnectNamedPipe discards unread response bytes. Wait for the client
|
||||
// to confirm it consumed the response before disconnecting this instance.
|
||||
let _ = timeout(IO_TIMEOUT, stream.read_u8()).await;
|
||||
self.listener.disconnect()?;
|
||||
if let Some(result) = result {
|
||||
if let Err(error) = delegate_foreground_to_parent() {
|
||||
log::debug!("Could not delegate authentication foreground permission to the parent: {error}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fn pipe_name() -> anyhow::Result<String> {
|
||||
Ok(format!(
|
||||
r"\\.\pipe\GPConnect.Auth.{}",
|
||||
gpapi::windows::current_user_sid()?
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
|
||||
validate_auth_callback(callback)?;
|
||||
timeout(IO_TIMEOUT, async {
|
||||
let mut stream = ClientOptions::new()
|
||||
.open(pipe_name()?)
|
||||
.context("No external-browser authentication is waiting for a callback")?;
|
||||
stream.write_all(PROTOCOL_MAGIC).await?;
|
||||
stream.write_u8(PROTOCOL_VERSION).await?;
|
||||
stream.write_u32(callback.len() as u32).await?;
|
||||
stream.write_all(callback.as_bytes()).await?;
|
||||
let version = stream.read_u8().await?;
|
||||
let status = stream.read_u8().await?;
|
||||
// The receiver waits for our acknowledgement before returning to its caller.
|
||||
if version == PROTOCOL_VERSION && status == STATUS_ACCEPTED {
|
||||
if let Err(error) = delegate_foreground_to_receiver(&stream) {
|
||||
log::debug!("Could not delegate browser foreground permission to the authenticator: {error}");
|
||||
}
|
||||
}
|
||||
stream.write_u8(status).await?;
|
||||
anyhow::ensure!(
|
||||
version == PROTOCOL_VERSION,
|
||||
"Authentication callback protocol version mismatch"
|
||||
);
|
||||
match status {
|
||||
STATUS_ACCEPTED => Ok(()),
|
||||
STATUS_INVALID_CALLBACK => bail!("Authentication callback was rejected"),
|
||||
_ => bail!("Authentication callback protocol is unsupported"),
|
||||
}
|
||||
})
|
||||
.await
|
||||
.context("Timed out forwarding the authentication callback")?
|
||||
}
|
||||
|
||||
fn delegate_foreground_to_receiver(stream: &NamedPipeClient) -> io::Result<()> {
|
||||
let mut process_id = 0;
|
||||
unsafe {
|
||||
if GetNamedPipeServerProcessId(stream.as_raw_handle(), &mut process_id) == 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
}
|
||||
allow_foreground(process_id)
|
||||
}
|
||||
|
||||
fn delegate_foreground_to_parent() -> anyhow::Result<()> {
|
||||
let Some(process_id) = std::env::var_os(gpapi::process::auth_launcher::AUTH_PARENT_PROCESS_ID_ENV) else {
|
||||
return Ok(());
|
||||
};
|
||||
let process_id = process_id.to_string_lossy().parse::<u32>()?;
|
||||
allow_foreground(process_id)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn allow_foreground(process_id: u32) -> io::Result<()> {
|
||||
if unsafe { AllowSetForegroundWindow(process_id) } == 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
|
||||
use winreg::{RegKey, enums::HKEY_CURRENT_USER};
|
||||
let executable = common::binary_paths::gpauth();
|
||||
anyhow::ensure!(executable.is_file(), "The authentication helper is missing");
|
||||
let root = RegKey::predef(HKEY_CURRENT_USER);
|
||||
let (scheme, _) = root.create_subkey(r"Software\Classes\globalprotectcallback")?;
|
||||
scheme.set_value("", &"URL:GlobalProtect authentication callback")?;
|
||||
scheme.set_value("URL Protocol", &"")?;
|
||||
let (application, _) = scheme.create_subkey("Application")?;
|
||||
application.set_value("ApplicationName", &"GP Connect Login")?;
|
||||
let (command, _) = scheme.create_subkey(r"shell\open\command")?;
|
||||
// URL association activation requires a shell path, not Rust's verbatim
|
||||
// canonical path (\\?\C:\...), even though CreateProcess accepts both.
|
||||
let executable = dunce::simplified(&executable);
|
||||
command.set_value("", &format!("\"{}\" auth-callback \"%1\"", executable.display()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[tokio::test]
|
||||
async fn forwards_browser_callback_over_private_windows_pipe() {
|
||||
let receiver = AuthCallbackReceiver::bind().unwrap();
|
||||
// The first-instance flag preserves one pending browser authentication per user.
|
||||
assert!(AuthCallbackReceiver::bind().is_err());
|
||||
let sender = tokio::spawn(async {
|
||||
forward_auth_callback("globalprotectcallback:cas-as=1&[email protected]&token=test-token").await
|
||||
});
|
||||
let data = timeout(std::time::Duration::from_secs(5), receiver.receive())
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
sender.await.unwrap().unwrap();
|
||||
assert_eq!(data.username(), "[email protected]");
|
||||
assert_eq!(data.token(), Some("test-token"));
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use gpapi::{
|
||||
mod browser;
|
||||
|
||||
#[cfg(feature = "browser-auth")]
|
||||
#[cfg_attr(windows, path = "callback/windows.rs")]
|
||||
mod callback;
|
||||
|
||||
#[cfg(feature = "browser-auth")]
|
||||
|
||||
@@ -12,12 +12,17 @@ mod platform_impl;
|
||||
#[path = "webview/macos.rs"]
|
||||
mod platform_impl;
|
||||
|
||||
#[cfg(windows)]
|
||||
#[path = "webview/windows.rs"]
|
||||
mod platform_impl;
|
||||
|
||||
#[cfg(not(any(
|
||||
windows,
|
||||
target_os = "macos",
|
||||
target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd"
|
||||
)))]
|
||||
compile_error!("webview-auth is only supported on macOS and GTK/WebKitGTK Unix targets");
|
||||
compile_error!("webview-auth is only supported on Windows, macOS and GTK/WebKitGTK Unix targets");
|
||||
|
||||
pub use webview_auth::{WebviewAuthenticator, apply_auth_theme};
|
||||
@@ -9,7 +9,7 @@ use tokio_util::sync::CancellationToken;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum AuthDataLocation {
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
Headers,
|
||||
Body,
|
||||
}
|
||||
@@ -155,7 +155,7 @@ impl AuthMessenger {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub fn read_from_response(&self, auth_response: &impl super::webview_auth::GetHeader, generation: u64) {
|
||||
use log::warn;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ impl RecoveryStatus {
|
||||
Self::Hidden => "",
|
||||
Self::Restarting => "Restarting sign-in…",
|
||||
Self::Loading => "Loading sign-in…",
|
||||
Self::Failed => "Couldn’t restart sign-in.",
|
||||
Self::Failed => "Couldn’t load sign-in.",
|
||||
Self::Rejected => "Sign-in wasn’t completed.",
|
||||
Self::Tls {
|
||||
reason: TlsFailureReason::Handshake,
|
||||
@@ -55,6 +55,7 @@ impl RecoveryStatus {
|
||||
matches!(self, Self::Hidden | Self::Loading | Self::CertificateBypassed)
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub fn is_busy(self) -> bool {
|
||||
matches!(self, Self::Restarting | Self::Loading)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(super) enum TlsFailureReason {
|
||||
Expired,
|
||||
#[cfg(not(windows))]
|
||||
NotYetValid,
|
||||
#[cfg(not(windows))]
|
||||
Untrusted,
|
||||
HostnameMismatch,
|
||||
InvalidCertificate,
|
||||
@@ -17,7 +19,9 @@ impl TlsFailureReason {
|
||||
pub fn message(self) -> &'static str {
|
||||
match self {
|
||||
Self::Expired => "The certificate has expired.",
|
||||
#[cfg(not(windows))]
|
||||
Self::NotYetValid => "The certificate is not valid yet.",
|
||||
#[cfg(not(windows))]
|
||||
Self::Untrusted => "The certificate was issued by an untrusted authority.",
|
||||
Self::HostnameMismatch => "The certificate does not match this server’s hostname.",
|
||||
Self::InvalidCertificate => "The server’s certificate could not be verified.",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use std::{future::Future, pin::Pin, sync::Arc, time::Duration};
|
||||
|
||||
use anyhow::bail;
|
||||
#[cfg(not(windows))]
|
||||
use gpapi::utils::window::get_title_bar_height;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use gpapi::utils::window::{WindowTypeHint, set_window_type_hint};
|
||||
use gpapi::{
|
||||
@@ -8,24 +10,51 @@ use gpapi::{
|
||||
error::ServerTlsError,
|
||||
gp_params::GpParams,
|
||||
os_profile::{WebviewUserAgent, WebviewUserAgentTransform},
|
||||
utils::{redact::redact_uri, window::get_title_bar_height},
|
||||
utils::redact::redact_uri,
|
||||
};
|
||||
use log::{info, warn};
|
||||
#[cfg(target_os = "macos")]
|
||||
use tauri::Manager;
|
||||
use tauri::{AppHandle, WebviewUrl, WebviewWindow, WindowEvent};
|
||||
#[cfg(not(windows))]
|
||||
use tauri::WebviewUrl;
|
||||
use tauri::{AppHandle, WindowEvent};
|
||||
use tokio::{sync::oneshot, time};
|
||||
|
||||
use crate::auth_prelogin;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
use super::address_bar::TOOLBAR_HEIGHT;
|
||||
use super::auth_messenger::{AuthError, AuthEvent, AuthMessenger};
|
||||
use super::recovery::{Recovery, RecoveryStatus, RetryPlan, RetrySource, RetryTiming};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
type AuthWindow = tauri::WebviewWindow;
|
||||
#[cfg(windows)]
|
||||
use super::platform_impl::{AuthWindow, create_auth_window};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn create_auth_window(app: &AppHandle, title: &str, theme: Option<tauri::Theme>) -> anyhow::Result<AuthWindow> {
|
||||
let builder = AuthWindow::builder(app, "auth_window", WebviewUrl::default())
|
||||
.title(title)
|
||||
.theme(theme)
|
||||
.devtools(cfg!(any(debug_assertions, feature = "release-devtools")));
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
let builder = builder.on_navigation(super::platform_impl::open_okta_verify);
|
||||
Ok(
|
||||
builder
|
||||
.inner_size(900.0, 650.0 + get_title_bar_height() + TOOLBAR_HEIGHT)
|
||||
.min_inner_size(400.0, 300.0)
|
||||
.focused(true)
|
||||
.visible(false)
|
||||
.center()
|
||||
.build()?,
|
||||
)
|
||||
}
|
||||
|
||||
const RESTART_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
|
||||
pub trait PlatformWebviewExt {
|
||||
fn install_auth_controls(&self, window: &WebviewWindow, messenger: Arc<AuthMessenger>) -> anyhow::Result<()>;
|
||||
pub(super) trait PlatformWebviewExt {
|
||||
fn install_auth_controls(&self, window: &AuthWindow, messenger: Arc<AuthMessenger>) -> anyhow::Result<()>;
|
||||
|
||||
fn set_recovery_status(&self, status: RecoveryStatus) -> anyhow::Result<()>;
|
||||
|
||||
@@ -54,7 +83,7 @@ pub trait PlatformWebviewExt {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub trait GetHeader {
|
||||
fn get_header(&self, key: &str) -> Option<String>;
|
||||
}
|
||||
@@ -125,19 +154,7 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
|
||||
pub async fn authenticate(&self, app_handle: &AppHandle) -> anyhow::Result<SamlAuthData> {
|
||||
let auth_messenger = Arc::new(AuthMessenger::new());
|
||||
let auth_window_builder = WebviewWindow::builder(app_handle, "auth_window", WebviewUrl::default())
|
||||
.title(self.window_title)
|
||||
.theme(native_theme(self.window_theme))
|
||||
.devtools(cfg!(any(debug_assertions, feature = "release-devtools")));
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
let auth_window_builder = auth_window_builder.on_navigation(super::platform_impl::open_okta_verify);
|
||||
let auth_window = auth_window_builder
|
||||
.inner_size(900.0, 650.0 + get_title_bar_height() + TOOLBAR_HEIGHT)
|
||||
.min_inner_size(400.0, 300.0)
|
||||
.focused(true)
|
||||
.visible(false)
|
||||
.center()
|
||||
.build()?;
|
||||
let auth_window = create_auth_window(app_handle, self.window_title, native_theme(self.window_theme))?;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
set_window_type_hint(&auth_window, WindowTypeHint::Dialog)?;
|
||||
@@ -170,7 +187,7 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
|
||||
async fn wait_for_auth(
|
||||
&self,
|
||||
auth_window: &WebviewWindow,
|
||||
auth_window: &AuthWindow,
|
||||
auth_messenger: Arc<AuthMessenger>,
|
||||
) -> anyhow::Result<SamlAuthData> {
|
||||
let mut recovery = Recovery::default();
|
||||
@@ -310,13 +327,16 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
|
||||
async fn setup_auth_window(
|
||||
&self,
|
||||
auth_window: &WebviewWindow,
|
||||
auth_window: &AuthWindow,
|
||||
auth_messenger: Arc<AuthMessenger>,
|
||||
) -> anyhow::Result<()> {
|
||||
info!("Setting up auth window...");
|
||||
|
||||
if self.clean {
|
||||
info!("Clearing all browsing data...");
|
||||
#[cfg(windows)]
|
||||
super::platform_impl::clear_browsing_data(auth_window).await?;
|
||||
#[cfg(not(windows))]
|
||||
auth_window.clear_all_browsing_data()?;
|
||||
}
|
||||
|
||||
@@ -361,7 +381,7 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_not_found(&self, auth_window: &WebviewWindow, auth_messenger: &Arc<AuthMessenger>) {
|
||||
fn handle_not_found(&self, auth_window: &AuthWindow, auth_messenger: &Arc<AuthMessenger>) {
|
||||
let visible = auth_window.is_visible().unwrap_or(false);
|
||||
if visible {
|
||||
return;
|
||||
@@ -370,7 +390,7 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
auth_messenger.schedule_raise_window(2);
|
||||
}
|
||||
|
||||
fn update_recovery(&self, auth_window: &WebviewWindow, status: RecoveryStatus) -> anyhow::Result<()> {
|
||||
fn update_recovery(&self, auth_window: &AuthWindow, status: RecoveryStatus) -> anyhow::Result<()> {
|
||||
if status != RecoveryStatus::Hidden {
|
||||
self.raise_window(auth_window);
|
||||
}
|
||||
@@ -397,7 +417,7 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
|
||||
fn load_restarted_sign_in(
|
||||
&self,
|
||||
auth_window: &WebviewWindow,
|
||||
auth_window: &AuthWindow,
|
||||
messenger: &Arc<AuthMessenger>,
|
||||
auth_request: String,
|
||||
) -> anyhow::Result<()> {
|
||||
@@ -415,7 +435,7 @@ impl<'a> WebviewAuthenticator<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn raise_window(&self, auth_window: &WebviewWindow) {
|
||||
fn raise_window(&self, auth_window: &AuthWindow) {
|
||||
let visible = auth_window.is_visible().unwrap_or(false);
|
||||
if visible {
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,380 @@
|
||||
//! WebView2 authentication. All COM objects and native controls stay on the UI thread.
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
collections::HashMap,
|
||||
rc::Rc,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use super::{
|
||||
auth_messenger::{AuthDataLocation, AuthError, AuthEvent, AuthMessenger},
|
||||
recovery::RecoveryStatus,
|
||||
webview_auth::{GetHeader, PlatformWebviewExt},
|
||||
};
|
||||
use anyhow::{Context, bail};
|
||||
use gpapi::auth::SamlAuthData;
|
||||
use tauri::{
|
||||
AppHandle, LogicalPosition, Webview, WebviewBuilder, WebviewUrl, Window, WindowBuilder, webview::PlatformWebview,
|
||||
};
|
||||
use webview2_com::{
|
||||
ClearBrowsingDataCompletedHandler, CoTaskMemPWSTR, DOMContentLoadedEventHandler, ExecuteScriptCompletedHandler,
|
||||
Microsoft::Web::WebView2::Win32::*, NavigationCompletedEventHandler, NavigationStartingEventHandler,
|
||||
SourceChangedEventHandler, WebResourceResponseReceivedEventHandler,
|
||||
};
|
||||
use windows::core::{BOOL, HSTRING, Interface, PWSTR};
|
||||
|
||||
#[path = "windows/controls.rs"]
|
||||
mod controls;
|
||||
#[path = "windows/tls.rs"]
|
||||
mod tls;
|
||||
|
||||
/// Windows hosts native chrome and a manually sized child webview in one window.
|
||||
/// Host-owned child bounds keep the page surface below the native controls
|
||||
/// throughout live resizing.
|
||||
#[derive(Clone)]
|
||||
pub(super) struct AuthWindow {
|
||||
window: Window,
|
||||
webview: Webview,
|
||||
}
|
||||
|
||||
impl std::ops::Deref for AuthWindow {
|
||||
type Target = Window;
|
||||
fn deref(&self) -> &Window {
|
||||
&self.window
|
||||
}
|
||||
}
|
||||
|
||||
impl AuthWindow {
|
||||
pub(super) fn with_webview(&self, callback: impl FnOnce(PlatformWebview) + Send + 'static) -> tauri::Result<()> {
|
||||
self.webview.with_webview(callback)
|
||||
}
|
||||
}
|
||||
|
||||
impl gpapi::utils::window::WindowExt for AuthWindow {
|
||||
fn raise(&self) -> anyhow::Result<()> {
|
||||
self.window.show()?;
|
||||
self.window.set_focus()?;
|
||||
self.webview.set_focus()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn create_auth_window(
|
||||
app: &AppHandle,
|
||||
title: &str,
|
||||
theme: Option<tauri::Theme>,
|
||||
) -> anyhow::Result<AuthWindow> {
|
||||
let window = WindowBuilder::new(app, "auth_window")
|
||||
.title(title)
|
||||
.theme(theme)
|
||||
.inner_size(900.0, 650.0 + super::address_bar::TOOLBAR_HEIGHT)
|
||||
.min_inner_size(400.0, 300.0)
|
||||
.focused(true)
|
||||
.visible(false)
|
||||
.center()
|
||||
.build()?;
|
||||
let webview = window.add_child(
|
||||
WebviewBuilder::new("auth_webview", WebviewUrl::default())
|
||||
.devtools(cfg!(any(debug_assertions, feature = "release-devtools"))),
|
||||
LogicalPosition::new(0.0, 0.0),
|
||||
window.inner_size()?,
|
||||
)?;
|
||||
Ok(AuthWindow { window, webview })
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
static STATES: RefCell<HashMap<usize, Rc<State>>> = RefCell::default();
|
||||
}
|
||||
|
||||
struct State {
|
||||
core: ICoreWebView2,
|
||||
controller: ICoreWebView2Controller,
|
||||
messenger: Arc<AuthMessenger>,
|
||||
controls: controls::Controls,
|
||||
pending: Cell<Option<u64>>,
|
||||
navigations: RefCell<HashMap<u64, u64>>,
|
||||
document: RefCell<(String, u64)>,
|
||||
tls: RefCell<tls::Policy>,
|
||||
}
|
||||
|
||||
fn text(get: impl FnOnce(*mut PWSTR) -> windows::core::Result<()>) -> windows::core::Result<String> {
|
||||
let mut value = PWSTR::null();
|
||||
let result = get(&mut value);
|
||||
let value = CoTaskMemPWSTR::from(value);
|
||||
result?;
|
||||
Ok(value.to_string())
|
||||
}
|
||||
|
||||
fn state(webview: &PlatformWebview) -> anyhow::Result<Rc<State>> {
|
||||
let core = unsafe { webview.controller().CoreWebView2()? };
|
||||
STATES
|
||||
.with_borrow(|states| states.get(&(core.as_raw() as usize)).cloned())
|
||||
.context("Authentication controls are unavailable")
|
||||
}
|
||||
|
||||
impl State {
|
||||
fn read_html(&self, generation: u64) -> windows::core::Result<()> {
|
||||
if generation != self.messenger.generation() {
|
||||
return Ok(());
|
||||
}
|
||||
let messenger = Arc::clone(&self.messenger);
|
||||
unsafe {
|
||||
self.core.ExecuteScript(
|
||||
&HSTRING::from("document.documentElement.outerHTML"),
|
||||
&ExecuteScriptCompletedHandler::create(Box::new(move |result, json| {
|
||||
result?;
|
||||
if let Ok(html) = serde_json::from_str::<String>(&json) {
|
||||
messenger.read_from_html(&html, generation);
|
||||
}
|
||||
Ok(())
|
||||
})),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn listen(self: &Rc<Self>) -> windows::core::Result<()> {
|
||||
let mut token = 0;
|
||||
let weak = Rc::downgrade(self);
|
||||
let starting = NavigationStartingEventHandler::create(Box::new(move |_, args| {
|
||||
let (Some(state), Some(args)) = (weak.upgrade(), args) else {
|
||||
return Ok(());
|
||||
};
|
||||
unsafe {
|
||||
let mut id = 0;
|
||||
args.NavigationId(&mut id)?;
|
||||
let generation = *state
|
||||
.navigations
|
||||
.borrow_mut()
|
||||
.entry(id)
|
||||
.or_insert_with(|| state.pending.take().unwrap_or_else(|| state.messenger.generation()));
|
||||
let uri = text(|p| args.Uri(p))?;
|
||||
if uri.starts_with("globalprotectcallback:") {
|
||||
args.SetCancel(true)?;
|
||||
match SamlAuthData::from_gpcallback(&uri) {
|
||||
Ok(data) => state
|
||||
.messenger
|
||||
.send_auth_event(AuthEvent::Data(generation, data, AuthDataLocation::Body)),
|
||||
Err(error) => state
|
||||
.messenger
|
||||
.send_auth_event(AuthEvent::Error(generation, AuthError::invalid_from_body(error.into()))),
|
||||
}
|
||||
} else if generation == state.messenger.generation() {
|
||||
*state.document.borrow_mut() = (uri, generation);
|
||||
state.messenger.cancel_raise_window();
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}));
|
||||
unsafe {
|
||||
self.core.add_NavigationStarting(&starting, &mut token)?;
|
||||
}
|
||||
|
||||
let weak = Rc::downgrade(self);
|
||||
let loaded = DOMContentLoadedEventHandler::create(Box::new(move |_, args| {
|
||||
let (Some(state), Some(args)) = (weak.upgrade(), args) else {
|
||||
return Ok(());
|
||||
};
|
||||
let mut id = 0;
|
||||
unsafe {
|
||||
args.NavigationId(&mut id)?;
|
||||
}
|
||||
let generation = state.navigations.borrow().get(&id).copied();
|
||||
if let Some(generation) = generation {
|
||||
state.read_html(generation)?;
|
||||
}
|
||||
Ok(())
|
||||
}));
|
||||
unsafe {
|
||||
self
|
||||
.core
|
||||
.cast::<ICoreWebView2_2>()?
|
||||
.add_DOMContentLoaded(&loaded, &mut token)?;
|
||||
}
|
||||
|
||||
let weak = Rc::downgrade(self);
|
||||
let completed = NavigationCompletedEventHandler::create(Box::new(move |_, args| {
|
||||
let (Some(state), Some(args)) = (weak.upgrade(), args) else {
|
||||
return Ok(());
|
||||
};
|
||||
unsafe {
|
||||
let mut id = 0;
|
||||
args.NavigationId(&mut id)?;
|
||||
let Some(generation) = state.navigations.borrow_mut().remove(&id) else {
|
||||
return Ok(());
|
||||
};
|
||||
let mut success = BOOL(0);
|
||||
args.IsSuccess(&mut success)?;
|
||||
if success.as_bool() {
|
||||
state.read_html(generation)?;
|
||||
state.messenger.send_auth_event(AuthEvent::PageLoaded(generation));
|
||||
} else {
|
||||
let mut error = COREWEBVIEW2_WEB_ERROR_STATUS_UNKNOWN;
|
||||
args.WebErrorStatus(&mut error)?;
|
||||
if error != COREWEBVIEW2_WEB_ERROR_STATUS_OPERATION_CANCELED {
|
||||
state.messenger.send_auth_event(AuthEvent::Error(
|
||||
generation,
|
||||
AuthError::LoadFailed(anyhow::anyhow!("WebView2 navigation failed ({})", error.0)),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}));
|
||||
unsafe {
|
||||
self.core.add_NavigationCompleted(&completed, &mut token)?;
|
||||
}
|
||||
|
||||
let weak = Rc::downgrade(self);
|
||||
let source = SourceChangedEventHandler::create(Box::new(move |_, _| {
|
||||
if let Some(state) = weak.upgrade() {
|
||||
let uri = unsafe { text(|p| state.core.Source(p))? };
|
||||
state.controls.set_address(&uri)?;
|
||||
}
|
||||
Ok(())
|
||||
}));
|
||||
unsafe {
|
||||
self.core.add_SourceChanged(&source, &mut token)?;
|
||||
}
|
||||
|
||||
let weak = Rc::downgrade(self);
|
||||
let response = WebResourceResponseReceivedEventHandler::create(Box::new(move |_, args| {
|
||||
let (Some(state), Some(args)) = (weak.upgrade(), args) else {
|
||||
return Ok(());
|
||||
};
|
||||
unsafe {
|
||||
let uri = text(|p| args.Request()?.Uri(p))?;
|
||||
let (document, generation) = state.document.borrow().clone();
|
||||
// Subresources must not supply authentication credentials for the page.
|
||||
if uri == document && generation == state.messenger.generation() {
|
||||
state
|
||||
.messenger
|
||||
.read_from_response(&Headers(args.Response()?.Headers()?), generation);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}));
|
||||
unsafe {
|
||||
self
|
||||
.core
|
||||
.cast::<ICoreWebView2_2>()?
|
||||
.add_WebResourceResponseReceived(&response, &mut token)?;
|
||||
}
|
||||
tls::install(self)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
struct Headers(ICoreWebView2HttpResponseHeaders);
|
||||
impl GetHeader for Headers {
|
||||
fn get_header(&self, key: &str) -> Option<String> {
|
||||
unsafe { text(|p| self.0.GetHeader(&HSTRING::from(key), p)).ok() }
|
||||
}
|
||||
}
|
||||
|
||||
impl PlatformWebviewExt for PlatformWebview {
|
||||
fn install_auth_controls(&self, window: &AuthWindow, messenger: Arc<AuthMessenger>) -> anyhow::Result<()> {
|
||||
let controller = self.controller();
|
||||
let core = unsafe { controller.CoreWebView2()? };
|
||||
let key = core.as_raw() as usize;
|
||||
let controls = controls::Controls::new(window, &controller, key)?;
|
||||
let state = Rc::new(State {
|
||||
core,
|
||||
controller,
|
||||
messenger,
|
||||
controls,
|
||||
pending: Cell::new(None),
|
||||
navigations: RefCell::default(),
|
||||
document: RefCell::new((String::new(), 0)),
|
||||
tls: RefCell::default(),
|
||||
});
|
||||
STATES.with_borrow_mut(|states| states.insert(key, Rc::clone(&state)));
|
||||
state.listen()?;
|
||||
state.controls.layout(&state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_recovery_status(&self, status: RecoveryStatus) -> anyhow::Result<()> {
|
||||
let state = state(self)?;
|
||||
state.controls.update(&state, status)?;
|
||||
Ok(())
|
||||
}
|
||||
fn stop_loading(&self) {
|
||||
let _ = unsafe { self.controller().CoreWebView2().and_then(|wv| wv.Stop()) };
|
||||
}
|
||||
fn confirm_tls_exception(&self) -> anyhow::Result<()> {
|
||||
tls::confirm(state(self)?.as_ref())
|
||||
}
|
||||
fn ignore_tls_errors(&self) -> anyhow::Result<()> {
|
||||
state(self)?.tls.borrow_mut().ignore_errors = true;
|
||||
Ok(())
|
||||
}
|
||||
fn user_agent(&self) -> anyhow::Result<String> {
|
||||
unsafe {
|
||||
Ok(text(|p| {
|
||||
self
|
||||
.controller()
|
||||
.CoreWebView2()?
|
||||
.Settings()?
|
||||
.cast::<ICoreWebView2Settings2>()?
|
||||
.UserAgent(p)
|
||||
})?)
|
||||
}
|
||||
}
|
||||
fn set_user_agent(&self, user_agent: &str) -> anyhow::Result<()> {
|
||||
unsafe {
|
||||
self
|
||||
.controller()
|
||||
.CoreWebView2()?
|
||||
.Settings()?
|
||||
.cast::<ICoreWebView2Settings2>()?
|
||||
.SetUserAgent(&HSTRING::from(user_agent))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
fn load_url(&self, url: &str) -> anyhow::Result<()> {
|
||||
let state = state(self)?;
|
||||
state.pending.set(Some(state.messenger.generation()));
|
||||
unsafe {
|
||||
state.core.Navigate(&HSTRING::from(url))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
fn load_html(&self, html: &str) -> anyhow::Result<()> {
|
||||
let state = state(self)?;
|
||||
state.pending.set(Some(state.messenger.generation()));
|
||||
unsafe {
|
||||
state.core.NavigateToString(&HSTRING::from(html))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// WebView2 clears profiles asynchronously; do not navigate until cookies are gone.
|
||||
pub(super) async fn clear_browsing_data(window: &AuthWindow) -> anyhow::Result<()> {
|
||||
let (tx, rx) = tokio::sync::oneshot::channel();
|
||||
window.with_webview(move |wv| {
|
||||
let tx = Rc::new(RefCell::new(Some(tx)));
|
||||
let complete = Rc::clone(&tx);
|
||||
let callback = ClearBrowsingDataCompletedHandler::create(Box::new(move |result| {
|
||||
if let Some(tx) = complete.borrow_mut().take() {
|
||||
let _ = tx.send(result);
|
||||
}
|
||||
Ok(())
|
||||
}));
|
||||
let result = (|| unsafe {
|
||||
wv.controller()
|
||||
.CoreWebView2()?
|
||||
.cast::<ICoreWebView2_13>()?
|
||||
.Profile()?
|
||||
.cast::<ICoreWebView2Profile2>()?
|
||||
.ClearBrowsingDataAll(&callback)
|
||||
})();
|
||||
if let Err(error) = result {
|
||||
if let Some(tx) = tx.borrow_mut().take() {
|
||||
let _ = tx.send(Err(error));
|
||||
}
|
||||
}
|
||||
})?;
|
||||
rx.await.context("Could not clear sign-in data")??;
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
//! Native controls remain outside the identity provider's document.
|
||||
use super::*;
|
||||
use windows::{
|
||||
Win32::{
|
||||
Foundation::{COLORREF, HWND, LPARAM, LRESULT, RECT, WPARAM},
|
||||
Graphics::Gdi::*,
|
||||
UI::{
|
||||
Controls::EM_SETRECT,
|
||||
HiDpi::{GetDpiForWindow, SystemParametersInfoForDpi},
|
||||
Shell::{DefSubclassProc, RemoveWindowSubclass, SetWindowSubclass},
|
||||
WindowsAndMessaging::*,
|
||||
},
|
||||
},
|
||||
core::{PCWSTR, w},
|
||||
};
|
||||
|
||||
const SUBCLASS: usize = 0x47504155;
|
||||
const ADDRESS_SUBCLASS: usize = 0x47504156;
|
||||
const ADDRESS_HEIGHT: i32 = 24;
|
||||
const TOOLBAR_HEIGHT: i32 = 34;
|
||||
const RECOVERY_PADDING: i32 = 4;
|
||||
const RETRY: usize = 101;
|
||||
const PROCEED: usize = 102;
|
||||
const CANCEL: usize = 103;
|
||||
|
||||
pub(super) struct Controls {
|
||||
pub(super) parent: HWND,
|
||||
webview_host: HWND,
|
||||
address: HWND,
|
||||
message: HWND,
|
||||
retry: HWND,
|
||||
proceed: HWND,
|
||||
cancel: HWND,
|
||||
status: Cell<RecoveryStatus>,
|
||||
recovery_bounds: Cell<RECT>,
|
||||
font: Cell<Option<(u32, HFONT)>>,
|
||||
}
|
||||
|
||||
impl Controls {
|
||||
pub(super) fn new(window: &AuthWindow, controller: &ICoreWebView2Controller, key: usize) -> anyhow::Result<Self> {
|
||||
// The host owns both the toolbar and the child webview's remaining area.
|
||||
let parent = HWND(window.hwnd()?.0);
|
||||
let mut webview_host = HWND::default();
|
||||
unsafe {
|
||||
controller.ParentWindow(&mut webview_host)?;
|
||||
}
|
||||
let child = |class: PCWSTR, title: &str, style: WINDOW_STYLE, id: usize| -> windows::core::Result<HWND> {
|
||||
unsafe {
|
||||
let hwnd = CreateWindowExW(
|
||||
WINDOW_EX_STYLE::default(),
|
||||
class,
|
||||
&HSTRING::from(title),
|
||||
WS_CHILD | style,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
Some(parent),
|
||||
Some(HMENU(id as *mut _)),
|
||||
None,
|
||||
None,
|
||||
)?;
|
||||
Ok(hwnd)
|
||||
}
|
||||
};
|
||||
let controls = Self {
|
||||
parent,
|
||||
webview_host,
|
||||
address: child(
|
||||
w!("EDIT"),
|
||||
super::super::address_bar::LOADING_ADDRESS,
|
||||
WS_VISIBLE | WS_BORDER | WINDOW_STYLE(ES_READONLY as u32 | ES_MULTILINE as u32 | ES_AUTOHSCROLL as u32),
|
||||
0,
|
||||
)?,
|
||||
message: child(w!("STATIC"), "", WINDOW_STYLE::default(), 0)?,
|
||||
retry: child(w!("BUTTON"), "Try Again", WS_TABSTOP, RETRY)?,
|
||||
proceed: child(w!("BUTTON"), "Continue Anyway…", WS_TABSTOP, PROCEED)?,
|
||||
cancel: child(w!("BUTTON"), "Cancel", WS_TABSTOP, CANCEL)?,
|
||||
status: Cell::new(RecoveryStatus::Hidden),
|
||||
recovery_bounds: Cell::new(RECT::default()),
|
||||
font: Cell::new(None),
|
||||
};
|
||||
unsafe {
|
||||
anyhow::ensure!(
|
||||
SetWindowSubclass(controls.address, Some(address_proc), ADDRESS_SUBCLASS, 0).as_bool(),
|
||||
"Could not style the sign-in address"
|
||||
);
|
||||
anyhow::ensure!(
|
||||
SetWindowSubclass(parent, Some(window_proc), SUBCLASS, key).as_bool(),
|
||||
"Could not install sign-in controls"
|
||||
);
|
||||
}
|
||||
Ok(controls)
|
||||
}
|
||||
|
||||
pub(super) fn set_address(&self, uri: &str) -> windows::core::Result<()> {
|
||||
unsafe {
|
||||
SetWindowTextW(
|
||||
self.address,
|
||||
&HSTRING::from(super::super::address_bar::display_address(Some(uri))),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn update(&self, state: &State, status: RecoveryStatus) -> windows::core::Result<()> {
|
||||
self.status.set(status);
|
||||
let message = if status.detail().is_empty() {
|
||||
status.message().to_owned()
|
||||
} else {
|
||||
format!("{}\r\n{}", status.message(), status.detail())
|
||||
};
|
||||
unsafe {
|
||||
SetWindowTextW(self.message, &HSTRING::from(message))?;
|
||||
for (hwnd, visible) in [
|
||||
(self.message, status != RecoveryStatus::Hidden),
|
||||
(self.retry, status.can_retry()),
|
||||
(self.proceed, status.can_continue()),
|
||||
(self.cancel, status.blocks_page()),
|
||||
] {
|
||||
let _ = ShowWindow(hwnd, if visible { SW_SHOW } else { SW_HIDE });
|
||||
}
|
||||
state.controller.SetIsVisible(!status.blocks_page())?;
|
||||
}
|
||||
self.layout(state)
|
||||
}
|
||||
|
||||
pub(super) fn layout(&self, state: &State) -> windows::core::Result<()> {
|
||||
unsafe {
|
||||
let dpi = GetDpiForWindow(self.parent);
|
||||
let scale = dpi as f64 / 96.0;
|
||||
let px = |value: i32| (value as f64 * scale).round() as i32;
|
||||
let mut bounds = RECT::default();
|
||||
GetClientRect(self.parent, &mut bounds)?;
|
||||
let width = bounds.right;
|
||||
if self.font.get().is_none_or(|(current_dpi, _)| current_dpi != dpi) {
|
||||
let mut metrics = NONCLIENTMETRICSW {
|
||||
cbSize: std::mem::size_of::<NONCLIENTMETRICSW>() as u32,
|
||||
..Default::default()
|
||||
};
|
||||
SystemParametersInfoForDpi(
|
||||
SPI_GETNONCLIENTMETRICS.0,
|
||||
metrics.cbSize,
|
||||
Some(&mut metrics as *mut _ as *mut _),
|
||||
0,
|
||||
dpi,
|
||||
)?;
|
||||
metrics.lfMessageFont.lfHeight = -px(13);
|
||||
let font = CreateFontIndirectW(&metrics.lfMessageFont);
|
||||
if font.is_invalid() {
|
||||
return Err(windows::core::Error::from_thread());
|
||||
}
|
||||
for control in [self.address, self.message, self.retry, self.proceed, self.cancel] {
|
||||
SendMessageW(control, WM_SETFONT, Some(WPARAM(font.0 as usize)), Some(LPARAM(1)));
|
||||
}
|
||||
if let Some((_, old)) = self.font.replace(Some((dpi, font))) {
|
||||
let _ = DeleteObject(old.into());
|
||||
}
|
||||
}
|
||||
MoveWindow(
|
||||
self.address,
|
||||
px(8),
|
||||
px(5),
|
||||
(width - px(16)).max(0),
|
||||
px(ADDRESS_HEIGHT),
|
||||
true,
|
||||
)?;
|
||||
// A one-line formatting rectangle centers the native read-only edit text.
|
||||
// ES_AUTOHSCROLL keeps long URLs on one line and lets users select/copy them.
|
||||
let mut client = RECT::default();
|
||||
GetClientRect(self.address, &mut client)?;
|
||||
let dc = GetDC(Some(self.address));
|
||||
let previous = SelectObject(dc, self.font.get().expect("font initialized").1.into());
|
||||
let mut text_metrics = TEXTMETRICW::default();
|
||||
let measured = GetTextMetricsW(dc, &mut text_metrics);
|
||||
SelectObject(dc, previous);
|
||||
ReleaseDC(Some(self.address), dc);
|
||||
measured.ok()?;
|
||||
let top = ((client.bottom - text_metrics.tmHeight) / 2).max(0);
|
||||
let text = RECT {
|
||||
left: px(6),
|
||||
top,
|
||||
right: client.right - px(6),
|
||||
bottom: top + text_metrics.tmHeight,
|
||||
};
|
||||
SendMessageW(
|
||||
self.address,
|
||||
EM_SETRECT,
|
||||
Some(WPARAM(0)),
|
||||
Some(LPARAM(&text as *const _ as isize)),
|
||||
);
|
||||
let status = self.status.get();
|
||||
let buttons = [
|
||||
(self.cancel, status.blocks_page(), 70),
|
||||
(self.proceed, status.can_continue(), 136),
|
||||
(self.retry, status.can_retry(), 84),
|
||||
];
|
||||
let button_width: i32 = buttons
|
||||
.iter()
|
||||
.filter(|(_, visible, _)| *visible)
|
||||
.map(|(_, _, size)| size + 6)
|
||||
.sum();
|
||||
let stacked = width < px(700) && button_width > 0;
|
||||
let message_height = if status.detail().is_empty() { 20 } else { 40 };
|
||||
let row_height = message_height.max(28);
|
||||
let recovery_content_height = if stacked { message_height + 8 + 28 } else { row_height };
|
||||
// Equal padding surrounds the controls; the divider occupies one physical pixel.
|
||||
let recovery_height = px(recovery_content_height + 2 * RECOVERY_PADDING) + 1;
|
||||
let header_height = if status == RecoveryStatus::Hidden {
|
||||
px(TOOLBAR_HEIGHT)
|
||||
} else {
|
||||
px(TOOLBAR_HEIGHT) + recovery_height
|
||||
};
|
||||
self.recovery_bounds.set(RECT {
|
||||
left: 0,
|
||||
top: px(TOOLBAR_HEIGHT),
|
||||
right: width,
|
||||
bottom: header_height,
|
||||
});
|
||||
let message_width = if stacked {
|
||||
width - px(24)
|
||||
} else {
|
||||
width - px(24 + button_width)
|
||||
};
|
||||
MoveWindow(
|
||||
self.message,
|
||||
px(12),
|
||||
px(TOOLBAR_HEIGHT + RECOVERY_PADDING + if stacked { 0 } else { (row_height - message_height) / 2 }),
|
||||
message_width.max(0),
|
||||
px(message_height),
|
||||
true,
|
||||
)?;
|
||||
let button_top = TOOLBAR_HEIGHT
|
||||
+ RECOVERY_PADDING
|
||||
+ if stacked {
|
||||
message_height + 8
|
||||
} else {
|
||||
(row_height - 28) / 2
|
||||
};
|
||||
let mut right = width - px(8);
|
||||
for (hwnd, visible, size) in buttons {
|
||||
if visible {
|
||||
right -= px(size);
|
||||
MoveWindow(hwnd, right, px(button_top), px(size), px(28), true)?;
|
||||
right -= px(6);
|
||||
}
|
||||
}
|
||||
let content_height = (bounds.bottom - header_height).max(0);
|
||||
MoveWindow(self.webview_host, 0, header_height, width, content_height, true)?;
|
||||
state.controller.SetBounds(RECT {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: width,
|
||||
bottom: content_height,
|
||||
})?;
|
||||
let _ = InvalidateRect(Some(self.parent), None, true);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Controls {
|
||||
fn drop(&mut self) {
|
||||
if let Some((_, font)) = self.font.get() {
|
||||
unsafe {
|
||||
let _ = DeleteObject(font.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Keep the native edit's selection and accessibility, with a quiet, flat frame.
|
||||
unsafe extern "system" fn address_proc(
|
||||
hwnd: HWND,
|
||||
msg: u32,
|
||||
wparam: WPARAM,
|
||||
lparam: LPARAM,
|
||||
id: usize,
|
||||
_: usize,
|
||||
) -> LRESULT {
|
||||
if msg == WM_NCDESTROY {
|
||||
unsafe {
|
||||
let _ = RemoveWindowSubclass(hwnd, Some(address_proc), id);
|
||||
}
|
||||
}
|
||||
let result = unsafe { DefSubclassProc(hwnd, msg, wparam, lparam) };
|
||||
// EDIT also repaints its frame during WM_PAINT, so style it after native drawing.
|
||||
if matches!(msg, WM_NCPAINT | WM_PAINT) {
|
||||
unsafe {
|
||||
let dc = GetWindowDC(Some(hwnd));
|
||||
let mut bounds = RECT::default();
|
||||
if !dc.is_invalid() && GetWindowRect(hwnd, &mut bounds).is_ok() {
|
||||
let background = GetSysColor(COLOR_3DFACE);
|
||||
let foreground = GetSysColor(COLOR_WINDOWTEXT);
|
||||
let mut border = 0;
|
||||
for shift in [0, 8, 16] {
|
||||
let channel = (((background >> shift) & 255) * 82 + ((foreground >> shift) & 255) * 18) / 100;
|
||||
border |= channel << shift;
|
||||
}
|
||||
let brush = CreateSolidBrush(COLORREF(border));
|
||||
FrameRect(
|
||||
dc,
|
||||
&RECT {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: bounds.right - bounds.left,
|
||||
bottom: bounds.bottom - bounds.top,
|
||||
},
|
||||
brush,
|
||||
);
|
||||
let _ = DeleteObject(brush.into());
|
||||
}
|
||||
ReleaseDC(Some(hwnd), dc);
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
unsafe extern "system" fn window_proc(
|
||||
hwnd: HWND,
|
||||
msg: u32,
|
||||
wparam: WPARAM,
|
||||
lparam: LPARAM,
|
||||
id: usize,
|
||||
key: usize,
|
||||
) -> LRESULT {
|
||||
let state = STATES.with_borrow(|states| states.get(&key).cloned());
|
||||
if msg == WM_CTLCOLORSTATIC {
|
||||
unsafe {
|
||||
let dc = HDC(wparam.0 as *mut _);
|
||||
let is_message = state
|
||||
.as_ref()
|
||||
.is_some_and(|state| state.controls.message.0 as isize == lparam.0);
|
||||
let background = if is_message { COLOR_3DFACE } else { COLOR_WINDOW };
|
||||
SetTextColor(dc, COLORREF(GetSysColor(COLOR_WINDOWTEXT)));
|
||||
SetBkColor(dc, COLORREF(GetSysColor(background)));
|
||||
return LRESULT(GetSysColorBrush(background).0 as isize);
|
||||
}
|
||||
}
|
||||
// Paint the native toolbar and recovery surface outside the child webview.
|
||||
if msg == WM_ERASEBKGND {
|
||||
unsafe {
|
||||
let mut bounds = RECT::default();
|
||||
if GetClientRect(hwnd, &mut bounds).is_ok() {
|
||||
let dc = HDC(wparam.0 as *mut _);
|
||||
FillRect(dc, &bounds, GetSysColorBrush(COLOR_WINDOW));
|
||||
if let Some(state) = &state {
|
||||
let row = state.controls.recovery_bounds.get();
|
||||
if row.bottom > row.top {
|
||||
FillRect(dc, &row, GetSysColorBrush(COLOR_3DFACE));
|
||||
let divider = RECT {
|
||||
top: row.bottom - 1,
|
||||
..row
|
||||
};
|
||||
FillRect(dc, ÷r, GetSysColorBrush(COLOR_3DLIGHT));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return LRESULT(1);
|
||||
}
|
||||
if let Some(state) = &state {
|
||||
if msg == WM_COMMAND && (wparam.0 >> 16) == BN_CLICKED as usize {
|
||||
let event = match wparam.0 & 0xffff {
|
||||
RETRY => Some(AuthEvent::Retry),
|
||||
PROCEED => Some(AuthEvent::RequestTlsException),
|
||||
CANCEL => Some(AuthEvent::Close),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(event) = event {
|
||||
state.messenger.send_auth_event(event);
|
||||
return LRESULT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
let result = unsafe { DefSubclassProc(hwnd, msg, wparam, lparam) };
|
||||
if msg == WM_SIZE || msg == WM_DPICHANGED {
|
||||
if let Some(state) = &state {
|
||||
let _ = state.controls.layout(state);
|
||||
}
|
||||
}
|
||||
if msg == WM_NCDESTROY {
|
||||
unsafe {
|
||||
let _ = RemoveWindowSubclass(hwnd, Some(window_proc), id);
|
||||
}
|
||||
STATES.with_borrow_mut(|states| states.remove(&key));
|
||||
if let Some(state) = state {
|
||||
super::tls::clear_exceptions(&state.core);
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
use super::super::tls::{TlsFailure, TlsFailureReason};
|
||||
use super::*;
|
||||
use std::collections::HashSet;
|
||||
use webview2_com::{ClearServerCertificateErrorActionsCompletedHandler, ServerCertificateErrorDetectedEventHandler};
|
||||
use windows::Win32::UI::WindowsAndMessaging::{IDYES, MB_DEFBUTTON2, MB_ICONWARNING, MB_YESNO, MessageBoxW};
|
||||
|
||||
#[derive(Default)]
|
||||
pub(super) struct Policy {
|
||||
pub ignore_errors: bool,
|
||||
approved: HashSet<(String, String)>,
|
||||
pending: Option<Failure>,
|
||||
}
|
||||
#[derive(Clone)]
|
||||
struct Failure {
|
||||
identity: (String, String),
|
||||
failure: TlsFailure,
|
||||
generation: u64,
|
||||
}
|
||||
|
||||
fn reason(error: COREWEBVIEW2_WEB_ERROR_STATUS) -> TlsFailureReason {
|
||||
match error {
|
||||
COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_COMMON_NAME_IS_INCORRECT => TlsFailureReason::HostnameMismatch,
|
||||
COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_EXPIRED => TlsFailureReason::Expired,
|
||||
_ => TlsFailureReason::InvalidCertificate,
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn install(state: &Rc<State>) -> windows::core::Result<()> {
|
||||
let weak = Rc::downgrade(state);
|
||||
let handler = ServerCertificateErrorDetectedEventHandler::create(Box::new(move |_, args| {
|
||||
let (Some(state), Some(args)) = (weak.upgrade(), args) else {
|
||||
return Ok(());
|
||||
};
|
||||
unsafe {
|
||||
let uri = text(|p| args.RequestUri(p))?;
|
||||
let host = url::Url::parse(&uri)
|
||||
.ok()
|
||||
.and_then(|url| url.host_str().map(str::to_owned))
|
||||
.unwrap_or_default();
|
||||
let pem = text(|p| args.ServerCertificate()?.ToPemEncoding(p))?;
|
||||
let mut error = COREWEBVIEW2_WEB_ERROR_STATUS_UNKNOWN;
|
||||
args.ErrorStatus(&mut error)?;
|
||||
let identity = (host.clone(), pem);
|
||||
let mut policy = state.tls.borrow_mut();
|
||||
if policy.ignore_errors || policy.approved.contains(&identity) {
|
||||
args.SetAction(COREWEBVIEW2_SERVER_CERTIFICATE_ERROR_ACTION_ALWAYS_ALLOW)?;
|
||||
} else {
|
||||
args.SetAction(COREWEBVIEW2_SERVER_CERTIFICATE_ERROR_ACTION_CANCEL)?;
|
||||
let generation = state.document.borrow().1;
|
||||
let failure = TlsFailure {
|
||||
host,
|
||||
reason: reason(error),
|
||||
can_continue: error != COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_REVOKED,
|
||||
};
|
||||
state
|
||||
.messenger
|
||||
.send_auth_event(AuthEvent::Error(generation, AuthError::Tls(failure.clone())));
|
||||
policy.pending = Some(Failure {
|
||||
identity,
|
||||
failure,
|
||||
generation,
|
||||
});
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}));
|
||||
let mut token = 0;
|
||||
unsafe {
|
||||
state
|
||||
.core
|
||||
.cast::<ICoreWebView2_14>()?
|
||||
.add_ServerCertificateErrorDetected(&handler, &mut token)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn confirm(state: &State) -> anyhow::Result<()> {
|
||||
let pending = state
|
||||
.tls
|
||||
.borrow()
|
||||
.pending
|
||||
.clone()
|
||||
.context("No certificate error to confirm")?;
|
||||
if !pending.failure.can_continue || pending.generation != state.messenger.generation() {
|
||||
bail!("This certificate exception is no longer available");
|
||||
}
|
||||
let answer = unsafe {
|
||||
MessageBoxW(
|
||||
Some(state.controls.parent),
|
||||
&HSTRING::from(pending.failure.confirmation_message()),
|
||||
&HSTRING::from(pending.failure.confirmation_title()),
|
||||
MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2,
|
||||
)
|
||||
};
|
||||
if answer == IDYES {
|
||||
let identity = pending.identity.clone();
|
||||
let generation = pending.generation;
|
||||
state.tls.borrow_mut().approved.insert(identity);
|
||||
state.messenger.send_auth_event(AuthEvent::TlsAccepted(generation));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// WebView2 caches approvals in the session. Do not leave them for another sign-in window.
|
||||
pub(super) fn clear_exceptions(core: &ICoreWebView2) {
|
||||
if let Ok(core) = core.cast::<ICoreWebView2_14>() {
|
||||
let _ = unsafe {
|
||||
core.ClearServerCertificateErrorActions(&ClearServerCertificateErrorActionsCompletedHandler::create(Box::new(
|
||||
|_| Ok(()),
|
||||
)))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn maps_certificate_failure_reasons() {
|
||||
assert_eq!(
|
||||
reason(COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_COMMON_NAME_IS_INCORRECT),
|
||||
TlsFailureReason::HostnameMismatch
|
||||
);
|
||||
assert_eq!(
|
||||
reason(COREWEBVIEW2_WEB_ERROR_STATUS_CERTIFICATE_EXPIRED),
|
||||
TlsFailureReason::Expired
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,17 @@ license = "MIT"
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
log.workspace = true
|
||||
open = { version = "5", optional = true }
|
||||
webbrowser = { version = "1", optional = true }
|
||||
which = { workspace = true, optional = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
launcher = ["dep:open", "dep:webbrowser", "dep:which"]
|
||||
launcher = ["dep:open", "dep:webbrowser", "dep:which", "dep:winreg"]
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = { version = "0.56", optional = true }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
open = { version = "5", optional = true }
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
|
||||
which = { workspace = true, optional = true }
|
||||
@@ -1,8 +1,11 @@
|
||||
#[cfg(all(feature = "launcher", windows))]
|
||||
#[path = "platform/windows.rs"]
|
||||
mod platform;
|
||||
#[cfg(all(feature = "launcher", target_os = "macos"))]
|
||||
#[path = "platform/macos.rs"]
|
||||
mod platform;
|
||||
|
||||
#[cfg(all(feature = "launcher", not(target_os = "macos")))]
|
||||
#[cfg(all(feature = "launcher", unix, not(target_os = "macos")))]
|
||||
#[path = "platform/generic.rs"]
|
||||
mod platform;
|
||||
|
||||
@@ -38,7 +41,7 @@ impl<'a> Browser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "launcher", not(target_os = "macos")))]
|
||||
#[cfg(all(feature = "launcher", unix, not(target_os = "macos")))]
|
||||
pub(crate) fn as_str(&self) -> &str {
|
||||
match self {
|
||||
Browser::Auto => "auto",
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//! Windows browsers are resolved through their registered App Paths.
|
||||
use crate::Browser;
|
||||
use anyhow::{Context, bail};
|
||||
use std::path::PathBuf;
|
||||
use winreg::{
|
||||
RegKey,
|
||||
enums::{HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE},
|
||||
};
|
||||
|
||||
pub(super) fn open_url(url: &str, browser: Browser<'_>) -> anyhow::Result<()> {
|
||||
let executable = match browser {
|
||||
Browser::Auto | Browser::Default => return webbrowser::open(url).context("Could not open the browser"),
|
||||
Browser::Chrome => registered_browser("chrome.exe").context("Chrome is not installed")?,
|
||||
Browser::Edge => registered_browser("msedge.exe").context("Edge is not installed")?,
|
||||
Browser::Firefox => registered_browser("firefox.exe").context("Firefox is not installed")?,
|
||||
Browser::Safari => bail!("Safari is not available on Windows"),
|
||||
Browser::Other(program) => PathBuf::from(program),
|
||||
};
|
||||
std::process::Command::new(executable)
|
||||
.arg(url)
|
||||
.spawn()
|
||||
.context("Could not open the configured browser")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn registered_browser(name: &str) -> Option<PathBuf> {
|
||||
[HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE].into_iter().find_map(|hive| {
|
||||
let key = RegKey::predef(hive)
|
||||
.open_subkey(format!(r"Software\Microsoft\Windows\CurrentVersion\App Paths\{name}"))
|
||||
.ok()?;
|
||||
let path: String = key.get_value("").ok()?;
|
||||
let path = PathBuf::from(path.trim_matches('"'));
|
||||
path.is_file().then_some(path)
|
||||
})
|
||||
}
|
||||
+10
-5
@@ -5,11 +5,16 @@ fn main() {
|
||||
let workspace_dir = Path::new(manifest_dir).ancestors().nth(2).unwrap();
|
||||
let gpgui_dir = workspace_dir.parent().unwrap().join("gpgui");
|
||||
|
||||
let gp_service_binary = workspace_dir.join("target/debug/gpservice");
|
||||
let gp_client_binary = workspace_dir.join("target/debug/gpclient");
|
||||
let gp_auth_binary = workspace_dir.join("target/debug/gpauth");
|
||||
let gp_gui_helper_binary = workspace_dir.join("target/debug/gpgui-helper");
|
||||
let gp_gui_binary = gpgui_dir.join("target/debug/gpgui");
|
||||
let suffix = if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
|
||||
".exe"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let gp_service_binary = workspace_dir.join(format!("target/debug/gpservice{suffix}"));
|
||||
let gp_client_binary = workspace_dir.join(format!("target/debug/gpclient{suffix}"));
|
||||
let gp_auth_binary = workspace_dir.join(format!("target/debug/gpauth{suffix}"));
|
||||
let gp_gui_helper_binary = workspace_dir.join(format!("target/debug/gpgui-helper{suffix}"));
|
||||
let gp_gui_binary = gpgui_dir.join(format!("target/debug/gpgui{suffix}"));
|
||||
|
||||
println!("cargo:rustc-env=GP_SERVICE_BINARY={}", gp_service_binary.display());
|
||||
println!("cargo:rustc-env=GP_CLIENT_BINARY={}", gp_client_binary.display());
|
||||
|
||||
@@ -89,7 +89,7 @@ fn sibling_binary(binary_name: &str) -> Option<PathBuf> {
|
||||
fn sibling_binary_for_executable(executable: &Path, binary_name: &str) -> Option<PathBuf> {
|
||||
let executable = executable.canonicalize().ok()?;
|
||||
let bin_dir = executable.parent()?;
|
||||
let binary = bin_dir.join(binary_name);
|
||||
let binary = bin_dir.join(format!("{binary_name}{}", std::env::consts::EXE_SUFFIX));
|
||||
if is_file(&binary) {
|
||||
return Some(binary);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ pub const GP_USER_AGENT: &str = "PAN GlobalProtect";
|
||||
pub const GP_CLIENT_VERSION_LINUX: &str = "6.3.3-619";
|
||||
pub const GP_CLIENT_VERSION_WINDOWS: &str = "6.3.3-650";
|
||||
pub const GP_CLIENT_VERSION_MACOS: &str = "6.3.3-915";
|
||||
pub const GP_SERVICE_LOCK_FILE: &str = "/var/run/gpservice.lock";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const GP_VPNC_SCRIPT_INSTALLER_BINARY: &str = "/usr/libexec/gpclient/gp-vpnc-script-installer";
|
||||
#[cfg(target_os = "linux")]
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod binary_paths;
|
||||
pub mod constants;
|
||||
pub mod paths;
|
||||
@@ -0,0 +1,32 @@
|
||||
//! Machine-wide service state shared by the daemon and desktop clients.
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub fn service_lock_file() -> PathBuf {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
PathBuf::from("/var/run/gpservice.lock")
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
std::env::var_os("ProgramData")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(r"C:\ProgramData"))
|
||||
.join("GP Connect")
|
||||
.join("gpservice.lock")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub const SERVICE_PIPE: &str = r"\\.\pipe\GPConnect.Service";
|
||||
|
||||
#[cfg(windows)]
|
||||
pub const SERVICE_NAME: &str = "GPConnect";
|
||||
|
||||
/// Installer-owned SYSTEM/Administrators-only state, including temporary keys.
|
||||
#[cfg(windows)]
|
||||
pub fn service_private_dir() -> PathBuf {
|
||||
service_lock_file()
|
||||
.parent()
|
||||
.expect("service state directory")
|
||||
.join("Private")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "gp-xml"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
version.workspace = true
|
||||
license = "MIT"
|
||||
description = "GlobalProtect response XML redaction for diagnostics"
|
||||
|
||||
[dependencies]
|
||||
url.workspace = true
|
||||
xmltree.workspace = true
|
||||
@@ -0,0 +1,172 @@
|
||||
//! Redact GlobalProtect response bodies before writing diagnostics.
|
||||
use xmltree::{Element, EmitterConfig, XMLNode};
|
||||
|
||||
const REDACTED: &str = "[redacted]";
|
||||
const MAX_XML_BYTES: usize = 1024 * 1024;
|
||||
|
||||
pub fn redact_xml(body: &[u8]) -> String {
|
||||
if body.len() > MAX_XML_BYTES {
|
||||
return "[XML omitted: exceeds 1 MiB]".into();
|
||||
}
|
||||
let Ok(text) = std::str::from_utf8(body) else {
|
||||
return "[XML omitted: invalid UTF-8]".into();
|
||||
};
|
||||
if text.to_ascii_lowercase().contains("<!doctype") {
|
||||
return "[XML omitted: DTD]".into();
|
||||
}
|
||||
let Ok(nodes) = Element::parse_all(body) else {
|
||||
return "[XML omitted: malformed or non-XML response]".into();
|
||||
};
|
||||
let mut roots = nodes.into_iter().filter_map(|node| match node {
|
||||
XMLNode::Element(element) => Some(element),
|
||||
_ => None,
|
||||
});
|
||||
let Some(mut root) = roots.next() else {
|
||||
return "[XML omitted: no document element]".into();
|
||||
};
|
||||
if roots.next().is_some() || root.name.eq_ignore_ascii_case("html") {
|
||||
return "[XML omitted: unsupported response document]".into();
|
||||
}
|
||||
redact_element(&mut root);
|
||||
let mut output = Vec::new();
|
||||
if root
|
||||
.write_with_config(
|
||||
&mut output,
|
||||
EmitterConfig::new()
|
||||
.perform_indent(true)
|
||||
.write_document_declaration(false),
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
return "[XML omitted: serialization failed]".into();
|
||||
}
|
||||
String::from_utf8(output).unwrap_or_else(|_| "[XML omitted: serialization failed]".into())
|
||||
}
|
||||
|
||||
fn sensitive_name(name: &str) -> bool {
|
||||
let name: String = name
|
||||
.chars()
|
||||
.filter(char::is_ascii_alphanumeric)
|
||||
.map(|c| c.to_ascii_lowercase())
|
||||
.collect();
|
||||
if name.ends_with("label") {
|
||||
return false;
|
||||
}
|
||||
name.contains("cookie")
|
||||
|| name.contains("token")
|
||||
|| name.contains("password")
|
||||
|| name.contains("passphrase")
|
||||
|| name.contains("secret")
|
||||
|| name.starts_with("ekey")
|
||||
|| name.starts_with("akey")
|
||||
|| matches!(
|
||||
name.as_str(),
|
||||
"argument"
|
||||
| "samlrequest"
|
||||
| "samlresponse"
|
||||
| "samlrequestid"
|
||||
| "assertion"
|
||||
| "encryptedassertion"
|
||||
| "authnrequest"
|
||||
| "challenge"
|
||||
| "privatekey"
|
||||
| "encryptionkey"
|
||||
| "enckey"
|
||||
| "hskey"
|
||||
| "enchskey"
|
||||
| "tunnelopaque"
|
||||
| "nonce"
|
||||
| "user"
|
||||
| "username"
|
||||
| "ccusername"
|
||||
| "credential"
|
||||
)
|
||||
}
|
||||
|
||||
fn redact_element(element: &mut Element) {
|
||||
let named_secret = matches!(element.name.as_str(), "field" | "param" | "property" | "setting")
|
||||
&& ["name", "key"]
|
||||
.iter()
|
||||
.any(|name| element.attributes.get(*name).is_some_and(|value| sensitive_name(value)));
|
||||
let secret = sensitive_name(&element.name) || named_secret;
|
||||
for (name, value) in &mut element.attributes {
|
||||
if sensitive_name(name) || (secret && !(named_secret && matches!(name.as_str(), "name" | "key"))) {
|
||||
*value = REDACTED.into();
|
||||
} else {
|
||||
*value = redact_url(value);
|
||||
}
|
||||
}
|
||||
if secret {
|
||||
element.children = vec![XMLNode::Text(REDACTED.into())];
|
||||
return;
|
||||
}
|
||||
element
|
||||
.children
|
||||
.retain(|node| matches!(node, XMLNode::Element(_) | XMLNode::Text(_) | XMLNode::CData(_)));
|
||||
for node in &mut element.children {
|
||||
match node {
|
||||
XMLNode::Element(child) => redact_element(child),
|
||||
XMLNode::Text(value) | XMLNode::CData(value) => *value = redact_url(value),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn redact_url(value: &str) -> String {
|
||||
let Ok(mut url) = url::Url::parse(value) else {
|
||||
return value.into();
|
||||
};
|
||||
if !matches!(url.scheme(), "http" | "https") {
|
||||
return value.into();
|
||||
}
|
||||
if !url.username().is_empty() {
|
||||
let _ = url.set_username(REDACTED);
|
||||
}
|
||||
if url.password().is_some() {
|
||||
let _ = url.set_password(Some(REDACTED));
|
||||
}
|
||||
if url.query().is_some() {
|
||||
let pairs: Vec<_> = url
|
||||
.query_pairs()
|
||||
.map(|(name, _)| (name.into_owned(), REDACTED))
|
||||
.collect();
|
||||
url.query_pairs_mut().clear().extend_pairs(pairs);
|
||||
}
|
||||
if url.fragment().is_some() {
|
||||
url.set_fragment(Some(REDACTED));
|
||||
}
|
||||
url.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn redacts_positional_login_arguments_and_session_keys() {
|
||||
let xml = redact_xml(br#"<response><jnlp><application-desc><argument>fixture-auth-cookie</argument><argument>fixture-user</argument></application-desc></jnlp><ipsec><ekey-c2s><bits>256</bits><val>fixture-key-c2s</val></ekey-c2s><ekey-s2c>fixture-key-s2c</ekey-s2c><akey-c2s><val>fixture-auth-c2s</val></akey-c2s><akey-s2c>fixture-auth-s2c</akey-s2c></ipsec><enc-hs-key>fixture-hs-key</enc-hs-key><PrivateKey>fixture-private-key</PrivateKey><SAMLResponse>fixture-saml-response</SAMLResponse><tunnel-opaque><val>fixture-opaque</val></tunnel-opaque><mtu>1400</mtu></response>"#);
|
||||
assert!(!xml.contains("fixture-"));
|
||||
assert!(xml.contains("<mtu>1400</mtu>"));
|
||||
Element::parse(xml.as_bytes()).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn omits_unparseable_html_dtd_and_oversized_bodies_without_echoing_them() {
|
||||
for body in [
|
||||
b"not XML fixture-secret".as_slice(),
|
||||
b"<response><cookie>fixture-secret",
|
||||
b"<html><body>fixture-secret</body></html>",
|
||||
b"<!DOCTYPE response [<!ENTITY secret 'fixture-secret'>]><response>&secret;</response>",
|
||||
b"<response/>fixture-secret",
|
||||
b"\xfffixture-secret",
|
||||
] {
|
||||
let xml = redact_xml(body);
|
||||
assert!(xml.starts_with("[XML omitted:"));
|
||||
assert!(!xml.contains("fixture-secret"));
|
||||
}
|
||||
assert_eq!(
|
||||
redact_xml(&vec![b'x'; MAX_XML_BYTES + 1]),
|
||||
"[XML omitted: exceeds 1 MiB]"
|
||||
);
|
||||
}
|
||||
}
|
||||
+44
-9
@@ -6,9 +6,8 @@ edition.workspace = true
|
||||
license = "MIT"
|
||||
|
||||
[dependencies]
|
||||
nix = { version = "0.31", features = ["fs", "signal", "process"], optional = true }
|
||||
gp-xml = { path = "../gp-xml" }
|
||||
common = { path = "../common" }
|
||||
directories = { workspace = true, optional = true }
|
||||
anyhow.workspace = true
|
||||
base64.workspace = true
|
||||
dns-lookup = { workspace = true, optional = true }
|
||||
@@ -16,8 +15,10 @@ log.workspace = true
|
||||
reqwest.workspace = true
|
||||
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
|
||||
rustls-pemfile = "2"
|
||||
rustls-platform-verifier = "0.7"
|
||||
p12-keystore = "0.4.1"
|
||||
sec1 = { version = "0.8.1", default-features = false, features = ["der"] }
|
||||
pkcs12 = { version = "=0.2.0-pre.0", default-features = false }
|
||||
cms = { version = "=0.3.0-pre.1", default-features = false }
|
||||
pem.workspace = true
|
||||
pkcs8 = { version = "0.11", features = ["pem", "encryption", "sha1-insecure", "3des", "des-insecure"] }
|
||||
x509-cert = { version = "0.3", default-features = false }
|
||||
@@ -34,7 +35,6 @@ thiserror.workspace = true
|
||||
chacha20poly1305 = { version = "0.11", features = ["zeroize"] }
|
||||
url.workspace = true
|
||||
regex.workspace = true
|
||||
uzers = { workspace = true, optional = true }
|
||||
serde_urlencoded.workspace = true
|
||||
md5.workspace = true
|
||||
sha2.workspace = true
|
||||
@@ -43,11 +43,13 @@ chrono.workspace = true
|
||||
humantime.workspace = true
|
||||
netdev = { workspace = true, optional = true }
|
||||
socket2 = { version = "0.6", features = ["all"], optional = true }
|
||||
os_info = { version = "3", default-features = false, optional = true }
|
||||
snow.workspace = true
|
||||
zeroize = { workspace = true, features = ["serde"] }
|
||||
getrandom = "0.4"
|
||||
|
||||
# Used only by the opt-in certificate interoperability tests.
|
||||
openssl = { workspace = true, optional = true }
|
||||
|
||||
# Optional dependencies for features
|
||||
tauri = { workspace = true, optional = true }
|
||||
clap = { workspace = true, optional = true }
|
||||
@@ -63,23 +65,56 @@ oslog = { version = "0.2", default-features = false, optional = true }
|
||||
[target.'cfg(not(any(target_os="macos", target_os="windows")))'.dependencies]
|
||||
gtk = { version = "0.18", optional = true }
|
||||
|
||||
[target.'cfg(any(target_os="linux", target_os="freebsd", target_os="openbsd"))'.dependencies]
|
||||
directories = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(target_os="linux")'.dependencies]
|
||||
libloading = { version = "0.9", optional = true }
|
||||
|
||||
[target.'cfg(target_os="macos")'.dependencies]
|
||||
os_info = { version = "3", default-features = false, optional = true }
|
||||
|
||||
[target.'cfg(target_os="windows")'.dependencies]
|
||||
os_info = { version = "3", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1"
|
||||
pkg-config = "0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
openssl.workspace = true
|
||||
libloading = "0.9"
|
||||
proptest.workspace = true
|
||||
tokio = { workspace = true, features = ["test-util"] }
|
||||
|
||||
[features]
|
||||
default = ["desktop"]
|
||||
desktop = ["tokio/process", "tokio/signal", "dep:directories", "dep:nix", "dep:uzers", "dep:netdev", "dep:os_info", "dep:whoami", "dep:dns-lookup", "dep:socket2", "dep:libloading"]
|
||||
tauri = ["desktop", "dep:tauri", "dep:gtk"]
|
||||
desktop = ["tokio/process", "tokio/signal", "dep:directories", "dep:nix", "dep:uzers", "dep:netdev", "dep:whoami", "dep:dns-lookup", "dep:socket2", "dep:libloading"]
|
||||
tauri = ["desktop", "dep:tauri", "dep:gtk", "dep:os_info"]
|
||||
clap = ["desktop", "dep:clap", "dep:clap-verbosity-flag"]
|
||||
webview-auth = []
|
||||
logger = ["desktop", "dep:env_logger", "dep:log-reload", "dep:oslog"]
|
||||
openssl-tests = ["dep:openssl"]
|
||||
logger = ["desktop", "dep:env_logger", "dep:log-reload", "dep:oslog", "dep:file-rotate"]
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
nix = { version = "0.31", features = ["fs", "signal", "process"], optional = true }
|
||||
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_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"
|
||||
required-features = ["openssl-tests"]
|
||||
|
||||
[[test]]
|
||||
name = "client_certificate_chain"
|
||||
required-features = ["openssl-tests"]
|
||||
|
||||
[[test]]
|
||||
name = "client_certificate_extensions"
|
||||
required-features = ["openssl-tests"]
|
||||
|
||||
[[test]]
|
||||
name = "client_certificate_tls12_hash"
|
||||
required-features = ["openssl-tests"]
|
||||
@@ -0,0 +1,16 @@
|
||||
# gpapi tests
|
||||
|
||||
Ordinary tests do not require OpenSSL. To run the Windows logger regression test:
|
||||
|
||||
```sh
|
||||
cargo test -p gpapi --features logger --lib logger::windows::tests
|
||||
```
|
||||
|
||||
The certificate interoperability suite uses OpenSSL as an independent TLS and
|
||||
signature implementation. Full CI enables it explicitly:
|
||||
|
||||
```sh
|
||||
cargo test -p gpapi --features logger,openssl-tests
|
||||
```
|
||||
|
||||
This optional suite requires OpenSSL development headers and libraries.
|
||||
Loaded 100 of 268 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user