mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -05:00
Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f9f2c6920 | ||
|
|
6f468131c9 | ||
|
|
dc1376dbac | ||
|
|
15d85d1878 | ||
|
|
6edc93b579 | ||
|
|
1c34c52707 | ||
|
|
287d0cc6af | ||
|
|
5f4b2b602a | ||
|
|
43c20d0976 | ||
|
|
6ffb1e8709 | ||
|
|
1bdaf4e8be | ||
|
|
127961cab7 | ||
|
|
754b220a9d | ||
|
|
1072a35817 | ||
|
|
a43785792a | ||
|
|
76310f1494 | ||
|
|
029f292a6d | ||
|
|
dedd06366e | ||
|
|
5031d4dcfb | ||
|
|
1ac01081e0 | ||
|
|
594ab0ea32 | ||
|
|
e2e762dd35 | ||
|
|
9432f0c3e5 | ||
|
|
fdbe3bcbba |
No files matched your search
@@ -12,6 +12,9 @@ on:
|
|||||||
channel:
|
channel:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
build:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
builder:
|
builder:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
@@ -85,7 +88,7 @@ jobs:
|
|||||||
- name: Build gpgui in Docker
|
- name: Build gpgui in Docker
|
||||||
env:
|
env:
|
||||||
GPGUI_BUILDER: ${{ inputs.builder }}
|
GPGUI_BUILDER: ${{ inputs.builder }}
|
||||||
GPGUI_BUILD_VERSION: ${{ github.run_number }}.${{ github.run_attempt }}
|
GPGUI_BUILD_VERSION: ${{ inputs.build }}
|
||||||
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
|
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
|
||||||
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ on:
|
|||||||
channel:
|
channel:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
build:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
secrets:
|
secrets:
|
||||||
GH_PAT:
|
GH_PAT:
|
||||||
required: true
|
required: true
|
||||||
@@ -35,7 +38,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CARGO_INCREMENTAL: '0'
|
CARGO_INCREMENTAL: '0'
|
||||||
CARGO_BUILD_JOBS: '2'
|
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_GIT_COMMIT: ${{ inputs.gpgui_ref }}
|
||||||
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
|
GPGUI_UPDATE_CHANNEL: ${{ inputs.channel }}
|
||||||
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ${{ inputs.architecture == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
|
runs-on: ${{ inputs.architecture == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
|
||||||
|
environment: windows-signing
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
env:
|
env:
|
||||||
BUILD_ARCHITECTURE: ${{ inputs.architecture }}
|
BUILD_ARCHITECTURE: ${{ inputs.architecture }}
|
||||||
@@ -59,6 +63,10 @@ jobs:
|
|||||||
GPGUI_BUILD_VERSION: ${{ inputs.channel == 'snapshot' && inputs.build || '' }}
|
GPGUI_BUILD_VERSION: ${{ inputs.channel == 'snapshot' && inputs.build || '' }}
|
||||||
GPGUI_WINDOWS_UPDATE_PUBLIC_KEY: ${{ vars.WINDOWS_UPDATE_PUBLIC_KEY }}
|
GPGUI_WINDOWS_UPDATE_PUBLIC_KEY: ${{ vars.WINDOWS_UPDATE_PUBLIC_KEY }}
|
||||||
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
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:
|
steps:
|
||||||
- name: Select native build tools
|
- name: Select native build tools
|
||||||
id: native
|
id: native
|
||||||
@@ -125,7 +133,7 @@ jobs:
|
|||||||
& ./source/gp/scripts/build-openconnect-windows.ps1 -MsysRoot $env:MSYS_ROOT -MsysSubsystem ${{ steps.native.outputs.subsystem }} -Prefix $prefix
|
& ./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
|
& ./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
|
"OPENCONNECT_WINDOWS_PREFIX=$prefix" >> $env:GITHUB_ENV
|
||||||
- name: Build and package the matching Windows runtime
|
- name: Build the matching Windows runtime
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
env:
|
env:
|
||||||
MSYS_ROOT: ${{ steps.msys2.outputs.msys2-location }}
|
MSYS_ROOT: ${{ steps.msys2.outputs.msys2-location }}
|
||||||
@@ -134,16 +142,35 @@ jobs:
|
|||||||
$log = Join-Path $env:RUNNER_TEMP 'windows-package.log'
|
$log = Join-Path $env:RUNNER_TEMP 'windows-package.log'
|
||||||
# Compiler diagnostics may contain private GUI source. Keep them on the runner.
|
# Compiler diagnostics may contain private GUI source. Keep them on the runner.
|
||||||
try {
|
try {
|
||||||
& ./source/gpgui/scripts/build-windows.ps1 -Profile Release `
|
& ./source/gpgui/scripts/build-windows.ps1 -Profile Release -BuildOnly `
|
||||||
-NativePrefix $env:OPENCONNECT_WINDOWS_PREFIX -MsysRoot $env:MSYS_ROOT -MsysSubsystem ${{ steps.native.outputs.subsystem }} `
|
-NativePrefix $env:OPENCONNECT_WINDOWS_PREFIX -MsysRoot $env:MSYS_ROOT -MsysSubsystem ${{ steps.native.outputs.subsystem }} `
|
||||||
-WintunDirectory (Join-Path $env:WINDOWS_BUILD_TOOLS 'wintun') `
|
-WintunDirectory (Join-Path $env:WINDOWS_BUILD_TOOLS 'wintun') `
|
||||||
-MakeNsis (Join-Path ${env:ProgramFiles(x86)} 'NSIS/makensis.exe') `
|
-MakeNsis (Join-Path ${env:ProgramFiles(x86)} 'NSIS/makensis.exe') `
|
||||||
-OutputDirectory "$env:GITHUB_WORKSPACE/artifacts" *> $log
|
-OutputDirectory "$env:GITHUB_WORKSPACE/artifacts" *> $log
|
||||||
} catch {
|
} catch {
|
||||||
python ./.ci/scripts/private-ci-diagnostics.py compile $log
|
python ./.ci/scripts/private-ci-diagnostics.py compile $log
|
||||||
throw 'Windows compilation or packaging failed; private diagnostics remain on the runner.'
|
throw 'Windows compilation failed; private diagnostics remain on the runner.'
|
||||||
}
|
}
|
||||||
Write-Host 'Windows compilation and packaging passed.'
|
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
|
- name: Sign and verify update payload
|
||||||
id: sign
|
id: sign
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|||||||
@@ -69,8 +69,10 @@ jobs:
|
|||||||
actions: read
|
actions: read
|
||||||
contents: read
|
contents: read
|
||||||
outputs:
|
outputs:
|
||||||
gp_sha: ${{ steps.sources.outputs.gp_sha }}
|
gp_sha: ${{ steps.identity.outputs.gp_sha }}
|
||||||
gpgui_sha: ${{ steps.sources.outputs.gpgui_sha }}
|
gpgui_sha: ${{ steps.identity.outputs.gpgui_sha }}
|
||||||
|
version: ${{ steps.identity.outputs.version }}
|
||||||
|
build_version: ${{ steps.identity.outputs.build_version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Validate stable refs
|
- name: Validate stable refs
|
||||||
env:
|
env:
|
||||||
@@ -119,11 +121,12 @@ jobs:
|
|||||||
token: ${{ secrets.GH_PAT }}
|
token: ${{ secrets.GH_PAT }}
|
||||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }}
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.gpgui_branch || github.ref_name }}
|
||||||
path: selected/gpgui
|
path: selected/gpgui
|
||||||
- name: Record selected sources
|
- name: Record selected sources and versions
|
||||||
id: sources
|
id: identity
|
||||||
run: |
|
run: |
|
||||||
python3 scripts/record-build-sources.py selected-sources/sources.json \
|
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
|
- name: Retain selected sources for retries
|
||||||
if: steps.restored.outputs.cached != 'true'
|
if: steps.restored.outputs.cached != 'true'
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
@@ -160,7 +163,7 @@ jobs:
|
|||||||
# Tauri generates schemas in the source tree. Keep the host checkout read-only.
|
# Tauri generates schemas in the source tree. Keep the host checkout read-only.
|
||||||
cp -R /workspace /tmp/gp-test-workspace
|
cp -R /workspace /tmp/gp-test-workspace
|
||||||
cd /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.
|
# Exercise only the paths that require an actual root process.
|
||||||
sudo -E env PATH="$PATH" PKEXEC_UID="$(id -u)" cargo test --locked -p gpapi \
|
sudo -E env PATH="$PATH" PKEXEC_UID="$(id -u)" cargo test --locked -p gpapi \
|
||||||
@@ -442,6 +445,7 @@ jobs:
|
|||||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||||
|
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||||
builder: gpgui-builder-tauri2
|
builder: gpgui-builder-tauri2
|
||||||
verify_desktop_assets: true
|
verify_desktop_assets: true
|
||||||
secrets:
|
secrets:
|
||||||
@@ -455,6 +459,7 @@ jobs:
|
|||||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||||
|
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||||
builder: gpgui-alpine-builder-tauri2
|
builder: gpgui-alpine-builder-tauri2
|
||||||
artifact_suffix: -musl
|
artifact_suffix: -musl
|
||||||
secrets:
|
secrets:
|
||||||
@@ -467,11 +472,15 @@ jobs:
|
|||||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||||
|
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||||
secrets:
|
secrets:
|
||||||
GH_PAT: ${{ secrets.GH_PAT }}
|
GH_PAT: ${{ secrets.GH_PAT }}
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
needs: validate-inputs
|
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') }}
|
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_windows) || (startsWith(github.ref, 'refs/tags/') && vars.BUILD_WINDOWS_ON_TAG == 'true') }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -483,7 +492,7 @@ jobs:
|
|||||||
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
gp_ref: ${{ needs.validate-inputs.outputs.gp_sha }}
|
||||||
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
gpgui_ref: ${{ needs.validate-inputs.outputs.gpgui_sha }}
|
||||||
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
channel: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||||
build: ${{ format('{0}.{1}', github.run_number, github.run_attempt) }}
|
build: ${{ needs.validate-inputs.outputs.build_version }}
|
||||||
secrets:
|
secrets:
|
||||||
GH_PAT: ${{ secrets.GH_PAT }}
|
GH_PAT: ${{ secrets.GH_PAT }}
|
||||||
WINDOWS_UPDATE_PRIVATE_KEY: ${{ secrets.WINDOWS_UPDATE_PRIVATE_KEY }}
|
WINDOWS_UPDATE_PRIVATE_KEY: ${{ secrets.WINDOWS_UPDATE_PRIVATE_KEY }}
|
||||||
@@ -682,7 +691,7 @@ jobs:
|
|||||||
FEED_URL: ${{ vars.SPARKLE_FEED_URL }}
|
FEED_URL: ${{ vars.SPARKLE_FEED_URL }}
|
||||||
CHANNEL: ${{ (github.event_name == 'workflow_dispatch' && inputs.channel || 'stable') }}
|
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) }}
|
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: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -850,7 +859,7 @@ jobs:
|
|||||||
CHANNEL: ${{ (github.event_name == 'workflow_dispatch' && inputs.channel || 'stable') }}
|
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) }}
|
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) }}
|
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 }}
|
WORKFLOW_SHA: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -1049,7 +1058,6 @@ jobs:
|
|||||||
nettle \
|
nettle \
|
||||||
gmp \
|
gmp \
|
||||||
gnome-keyring \
|
gnome-keyring \
|
||||||
libayatana-appindicator \
|
|
||||||
polkit \
|
polkit \
|
||||||
webkit2-gtk_41
|
webkit2-gtk_41
|
||||||
pkgconf --exists libxml-2.0 liblz4 gnutls p11-kit-1 hogweed nettle gmp
|
pkgconf --exists libxml-2.0 liblz4 gnutls p11-kit-1 hogweed nettle gmp
|
||||||
@@ -1058,7 +1066,7 @@ jobs:
|
|||||||
exec 3>&1
|
exec 3>&1
|
||||||
(
|
(
|
||||||
set -eu
|
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_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||||
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
||||||
|
|
||||||
@@ -1142,7 +1150,7 @@ jobs:
|
|||||||
set -eu
|
set -eu
|
||||||
export AUTOCONF_VERSION=2.72
|
export AUTOCONF_VERSION=2.72
|
||||||
export AUTOMAKE_VERSION=1.17
|
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_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'stable' }}
|
||||||
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
||||||
|
|
||||||
@@ -1313,6 +1321,61 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd gh-release/gp/scripts && ./gh-release.sh "$RELEASE_TAG"
|
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:
|
publish-docker-image:
|
||||||
needs:
|
needs:
|
||||||
- validate-inputs
|
- validate-inputs
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ jobs:
|
|||||||
in
|
in
|
||||||
assert builtins.elem package
|
assert builtins.elem package
|
||||||
hostSystem.config.environment.systemPackages;
|
hostSystem.config.environment.systemPackages;
|
||||||
assert hostSystem.config.services.ayatana-indicators.enable;
|
|
||||||
package
|
package
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ jobs:
|
|||||||
gettext \
|
gettext \
|
||||||
gmp \
|
gmp \
|
||||||
gnutls \
|
gnutls \
|
||||||
libappindicator-gtk3 \
|
|
||||||
libp11-kit \
|
libp11-kit \
|
||||||
libsecret \
|
libsecret \
|
||||||
libtool \
|
libtool \
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
name: Publish macOS assets
|
name: Publish macOS assets
|
||||||
|
|
||||||
on:
|
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:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
build_run_id:
|
build_run_id:
|
||||||
|
|||||||
@@ -1,6 +1,33 @@
|
|||||||
name: Publish Windows update feed
|
name: Publish Windows update feed
|
||||||
|
|
||||||
on:
|
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:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
gpgui_ref:
|
gpgui_ref:
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -19,3 +19,5 @@ result
|
|||||||
|
|
||||||
# Packages & test assets
|
# Packages & test assets
|
||||||
*.ipa
|
*.ipa
|
||||||
|
|
||||||
|
__pycache__
|
||||||
Generated
+54
-69
@@ -292,7 +292,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "auth"
|
name = "auth"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"block2",
|
"block2",
|
||||||
@@ -321,7 +321,8 @@ dependencies = [
|
|||||||
"webkit2gtk",
|
"webkit2gtk",
|
||||||
"webview2-com",
|
"webview2-com",
|
||||||
"windows",
|
"windows",
|
||||||
"winreg 0.55.0",
|
"windows-sys 0.61.2",
|
||||||
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -553,14 +554,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "browser-launcher"
|
name = "browser-launcher"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"log",
|
"log",
|
||||||
"open",
|
"open",
|
||||||
"webbrowser",
|
"webbrowser",
|
||||||
"which",
|
"which",
|
||||||
"winreg 0.55.0",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -918,7 +919,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "common"
|
name = "common"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
@@ -1558,7 +1559,7 @@ dependencies = [
|
|||||||
"rustc_version",
|
"rustc_version",
|
||||||
"toml 1.1.8+spec-1.1.0",
|
"toml 1.1.8+spec-1.1.0",
|
||||||
"vswhom",
|
"vswhom",
|
||||||
"winreg 0.56.0",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1628,7 +1629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2130,9 +2131,17 @@ dependencies = [
|
|||||||
"system-deps",
|
"system-deps",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gp-xml"
|
||||||
|
version = "3.5.0"
|
||||||
|
dependencies = [
|
||||||
|
"url",
|
||||||
|
"xmltree",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpapi"
|
name = "gpapi"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
@@ -2146,7 +2155,9 @@ dependencies = [
|
|||||||
"directories",
|
"directories",
|
||||||
"dns-lookup",
|
"dns-lookup",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"file-rotate",
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
|
"gp-xml",
|
||||||
"gtk",
|
"gtk",
|
||||||
"humantime",
|
"humantime",
|
||||||
"libloading 0.9.0",
|
"libloading 0.9.0",
|
||||||
@@ -2194,7 +2205,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpauth"
|
name = "gpauth"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"auth",
|
"auth",
|
||||||
@@ -2202,7 +2213,6 @@ dependencies = [
|
|||||||
"common",
|
"common",
|
||||||
"compile-time",
|
"compile-time",
|
||||||
"gpapi",
|
"gpapi",
|
||||||
"home",
|
|
||||||
"log",
|
"log",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tauri",
|
"tauri",
|
||||||
@@ -2213,7 +2223,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpclient"
|
name = "gpclient"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -2244,7 +2254,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpgui-helper"
|
name = "gpgui-helper"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -2265,24 +2275,26 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gphip"
|
name = "gphip"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"askama",
|
"askama",
|
||||||
"chrono",
|
"chrono",
|
||||||
"gpapi",
|
"gpapi",
|
||||||
|
"log",
|
||||||
"netdev",
|
"netdev",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"uuid",
|
"uuid",
|
||||||
"uzers",
|
"uzers",
|
||||||
|
"windows",
|
||||||
"xmltree",
|
"xmltree",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpservice"
|
name = "gpservice"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -2320,7 +2332,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gptunnel"
|
name = "gptunnel"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gpapi",
|
"gpapi",
|
||||||
"log",
|
"log",
|
||||||
@@ -2332,7 +2344,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpvpnc"
|
name = "gpvpnc"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
"ipnet",
|
"ipnet",
|
||||||
@@ -2342,7 +2354,7 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
"uuid",
|
"uuid",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
"winreg 0.56.0",
|
"winreg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2460,15 +2472,6 @@ dependencies = [
|
|||||||
"digest 0.11.3",
|
"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]]
|
[[package]]
|
||||||
name = "html-escape"
|
name = "html-escape"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@@ -3857,11 +3860,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openconnect"
|
name = "openconnect"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autotools",
|
"autotools",
|
||||||
"cc",
|
"cc",
|
||||||
"fs_extra",
|
"fs_extra",
|
||||||
|
"gp-xml",
|
||||||
"is_executable",
|
"is_executable",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
@@ -4709,7 +4713,7 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4774,7 +4778,7 @@ dependencies = [
|
|||||||
"security-framework",
|
"security-framework",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
"webpki-root-certs",
|
"webpki-root-certs",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5644,9 +5648,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri"
|
name = "tauri"
|
||||||
version = "2.12.5"
|
version = "2.12.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5fb0244332cfb9cee7e2a568bf5da29a36ed8fdbd717f6f47a66b6b7b358c072"
|
checksum = "30fbfbb9dc9a2697b0e96d909ddc295fb18d2d82a58ed542ab8d9eba2edbe6da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -5695,9 +5699,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-build"
|
name = "tauri-build"
|
||||||
version = "2.7.4"
|
version = "2.7.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "adddb0e648752aaac5da9c3c3c6a68e1e87cab55e3b757b18a9441ef8c3ac614"
|
checksum = "73d80784e874fa117b9b00a6680cf2f9b8a51bbd14406bea980cf8f328b00646"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cargo_toml",
|
"cargo_toml",
|
||||||
@@ -5718,9 +5722,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-codegen"
|
name = "tauri-codegen"
|
||||||
version = "2.7.4"
|
version = "2.7.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fb37631cf71dab5e8ab55e1bdd701e18a52653d90b78e71d0e5598b1e0a61316"
|
checksum = "c5dc6caab4da5646f57648f39b794bae118f0dd4a4305eeb8c892966171f4852"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
"brotli",
|
"brotli",
|
||||||
@@ -5733,7 +5737,7 @@ dependencies = [
|
|||||||
"semver",
|
"semver",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.9",
|
"sha2 0.11.1",
|
||||||
"syn 2.0.119",
|
"syn 2.0.119",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"thiserror 2.0.21",
|
"thiserror 2.0.21",
|
||||||
@@ -5745,9 +5749,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-macros"
|
name = "tauri-macros"
|
||||||
version = "2.7.4"
|
version = "2.7.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0cc38db58854c10fb5f91a887ed8bf82d3239bb92b5d8db86eda09e96d9963d1"
|
checksum = "2831c5da8603a96b1efc0b650c2cb6decc69b6cda257d815fe70c7f5be53818e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -5759,9 +5763,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime"
|
name = "tauri-runtime"
|
||||||
version = "2.12.2"
|
version = "2.12.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c55766d99cea69055904d1735b93c2049302b2e09effd462120deb5581d78e9"
|
checksum = "60c2b14bd5265b63993cdc34ad526fb836e0fd0cf64a4634a895db0784844d5e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cookie",
|
"cookie",
|
||||||
"dpi",
|
"dpi",
|
||||||
@@ -5784,9 +5788,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime-wry"
|
name = "tauri-runtime-wry"
|
||||||
version = "2.12.3"
|
version = "2.12.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f"
|
checksum = "b8c14a025255cc9816d401635035075b09b6cc9973b7b8fd7b8fcb8753f30f92"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gtk",
|
"gtk",
|
||||||
"http",
|
"http",
|
||||||
@@ -5809,9 +5813,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-utils"
|
name = "tauri-utils"
|
||||||
version = "2.10.2"
|
version = "2.10.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "362ab21cd4cc713f2a02b1a9b5688198b1541cfb6907c4281e9190e0f0ef4aa3"
|
checksum = "28d1d33d4453c5df0bf1672dbc7ada69d8ed74f56a4316d964a4aa73d4ecd3ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"brotli",
|
"brotli",
|
||||||
@@ -5866,7 +5870,7 @@ dependencies = [
|
|||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6409,9 +6413,9 @@ checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.29.0"
|
version = "1.29.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514"
|
checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -6791,7 +6795,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6957,15 +6961,6 @@ dependencies = [
|
|||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-sys"
|
|
||||||
version = "0.59.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets 0.52.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.61.2"
|
version = "0.61.2"
|
||||||
@@ -7132,16 +7127,6 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winreg"
|
|
||||||
version = "0.55.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"windows-sys 0.59.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winreg"
|
name = "winreg"
|
||||||
version = "0.56.0"
|
version = "0.56.0"
|
||||||
@@ -7357,9 +7342,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zeroize"
|
name = "zeroize"
|
||||||
version = "1.9.1"
|
version = "1.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
|
checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ members = [
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
rust-version = "1.91"
|
rust-version = "1.91"
|
||||||
version = "3.4.0"
|
version = "3.5.0"
|
||||||
authors = ["Kevin Yue <[email protected]>"]
|
authors = ["Kevin Yue <[email protected]>"]
|
||||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|||||||
@@ -362,7 +362,6 @@ init-debian: clean-debian tarball
|
|||||||
# Remove the GUI dependencies if neither GUI component is included
|
# Remove the GUI dependencies if neither GUI component is included
|
||||||
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
|
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
|
||||||
sed -i "/libsecret-1-0/d" .build/deb/$(PKG)/debian/control; \
|
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; \
|
sed -i "/gnome-keyring/d" .build/deb/$(PKG)/debian/control; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -475,7 +474,6 @@ init-apk: clean-apk tarball
|
|||||||
|
|
||||||
# Remove the GUI dependencies if neither GUI component is included
|
# Remove the GUI dependencies if neither GUI component is included
|
||||||
if [ $(INCLUDE_GUI) -eq 0 ] && [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
|
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; \
|
sed -i "/^\tlibsecret$$/d" .build/apk/APKBUILD; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# GlobalProtect-openconnect
|
# GlobalProtect-openconnect
|
||||||
|
|
||||||
A GlobalProtect VPN client built on OpenConnect. It provides command-line tools (`gpclient`) 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.
|
> **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.
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@ A GlobalProtect VPN client built on OpenConnect. It provides command-line tools
|
|||||||
- [Command-Line Interface](#command-line-interface)
|
- [Command-Line Interface](#command-line-interface)
|
||||||
- [Graphical User Interface](#graphical-user-interface)
|
- [Graphical User Interface](#graphical-user-interface)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
|
- [Windows](#windows)
|
||||||
- [macOS](#macos)
|
- [macOS](#macos)
|
||||||
- [Debian / Ubuntu](#debian--ubuntu)
|
- [Debian / Ubuntu](#debian--ubuntu)
|
||||||
- [Arch Linux / Manjaro](#arch-linux--manjaro)
|
- [Arch Linux / Manjaro](#arch-linux--manjaro)
|
||||||
@@ -40,8 +41,8 @@ A GlobalProtect VPN client built on OpenConnect. It provides command-line tools
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Multi-Platform** – macOS (Apple silicon), Linux, FreeBSD, and OpenBSD
|
- **Multi-Platform** – Windows (x64 and ARM64), macOS (Apple silicon), Linux, FreeBSD, and OpenBSD
|
||||||
- **Dual Interfaces** – Fast terminal CLI (`gpclient`) and desktop GUI (**GP Connect**)
|
- **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
|
- **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
|
- **Flexible Routing** – Full System VPN tunnel or local SOCKS5 proxy mode
|
||||||
- **Modern Authentication** – SAML / SSO, MFA, FIDO2 (YubiKey), client certificates, and external browser login
|
- **Modern Authentication** – SAML / SSO, MFA, FIDO2 (YubiKey), client certificates, and external browser login
|
||||||
@@ -53,7 +54,7 @@ A GlobalProtect VPN client built on OpenConnect. It provides command-line tools
|
|||||||
|
|
||||||
### Command-Line Interface
|
### Command-Line Interface
|
||||||
|
|
||||||
The open-source `gpclient` CLI handles authentication, connection lifecycle, and HIP generation:
|
On macOS, Linux, and BSD, the open-source `gpclient` CLI handles authentication, connection lifecycle, and HIP generation:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Connect to a portal server
|
# Connect to a portal server
|
||||||
@@ -79,6 +80,7 @@ Run `gpclient --help` or `gpclient <command> --help` to view all available comma
|
|||||||
|
|
||||||
### Graphical User Interface
|
### Graphical User Interface
|
||||||
|
|
||||||
|
- **Windows**: Open **GP Connect** from the Start menu.
|
||||||
- **macOS**: Open **GP Connect** from Applications.
|
- **macOS**: Open **GP Connect** from Applications.
|
||||||
- **Linux / BSD**: Launch GP Connect from your application menu or run:
|
- **Linux / BSD**: Launch GP Connect from your application menu or run:
|
||||||
```bash
|
```bash
|
||||||
@@ -90,6 +92,12 @@ Run `gpclient --help` or `gpclient <command> --help` to view all available comma
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### 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
|
### macOS
|
||||||
|
|
||||||
Requires Apple silicon and macOS 13+. Includes both GP Connect and the `gpclient` CLI.
|
Requires Apple silicon and macOS 13+. Includes both GP Connect and the `gpclient` CLI.
|
||||||
@@ -153,7 +161,7 @@ Download the latest `.apk` package from the [releases](https://github.com/yuezk/
|
|||||||
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
|
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
|
||||||
```
|
```
|
||||||
|
|
||||||
*(Requires `community` repository enabled for WebKitGTK and AppIndicator dependencies).*
|
*(Requires the `community` repository for WebKitGTK dependencies).*
|
||||||
|
|
||||||
### FreeBSD
|
### FreeBSD
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ serde_json.workspace = true
|
|||||||
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
||||||
compile-time.workspace = true
|
compile-time.workspace = true
|
||||||
|
|
||||||
home = "0.5.12"
|
|
||||||
|
|
||||||
# webview auth dependencies
|
# webview auth dependencies
|
||||||
tauri = { workspace = true, optional = true }
|
tauri = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
|||||||
@@ -270,7 +270,21 @@ fn init_logger(cli: &Cli) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run() {
|
pub async fn run() {
|
||||||
|
#[cfg(not(windows))]
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
#[cfg(windows)]
|
||||||
|
let cli = match gpapi::process::auth_bootstrap::receive_arguments().await {
|
||||||
|
Ok(Some(args)) => Cli::parse_from(
|
||||||
|
std::env::args_os()
|
||||||
|
.take(1)
|
||||||
|
.chain(args.into_iter().map(std::ffi::OsString::from)),
|
||||||
|
),
|
||||||
|
Ok(None) => Cli::parse(),
|
||||||
|
Err(error) => {
|
||||||
|
eprintln!("Could not read Windows authentication launch arguments: {error}");
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
#[cfg(any(windows, target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||||
if let Some(CliCommand::AuthCallback { callback }) = &cli.command {
|
if let Some(CliCommand::AuthCallback { callback }) = &cli.command {
|
||||||
|
|||||||
@@ -18,25 +18,27 @@ clap.workspace = true
|
|||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
inquire = "0.9"
|
inquire = "0.9"
|
||||||
log.workspace = true
|
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"] }
|
nix = { version = "0.31", features = ["fs", "signal", "process", "poll", "term"] }
|
||||||
ratatui = { version = "=0.30.2", default-features = false, features = ["crossterm", "unstable-rendered-line-info"] }
|
ratatui = { version = "=0.30.2", default-features = false, features = ["crossterm", "unstable-rendered-line-info"] }
|
||||||
crossterm = { version = "0.29", features = ["use-dev-tty"] }
|
crossterm = { version = "0.29", features = ["use-dev-tty"] }
|
||||||
strip-ansi-escapes = "0.2"
|
strip-ansi-escapes = "0.2"
|
||||||
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
|
||||||
tokio-util.workspace = true
|
|
||||||
sysinfo.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
|
uzers.workspace = true
|
||||||
|
whoami.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["webview-auth"]
|
default = ["webview-auth"]
|
||||||
webview-auth = ["gpapi/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" }
|
gpvpnc = { path = "../../crates/gpvpnc" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
+85
-17
@@ -1,8 +1,10 @@
|
|||||||
|
#[cfg(unix)]
|
||||||
use std::{
|
use std::{
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use gpapi::{
|
use gpapi::{
|
||||||
@@ -10,17 +12,22 @@ use gpapi::{
|
|||||||
log_format::{LogFormat, write_json_record},
|
log_format::{LogFormat, write_json_record},
|
||||||
};
|
};
|
||||||
use log::info;
|
use log::info;
|
||||||
|
#[cfg(unix)]
|
||||||
use sysinfo::{Pid, System};
|
use sysinfo::{Pid, System};
|
||||||
|
#[cfg(unix)]
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
use crate::{
|
use crate::{
|
||||||
GP_CLIENT_LOCK_FILE,
|
GP_CLIENT_LOCK_FILE,
|
||||||
connect::{ConnectArgs, ConnectHandler},
|
|
||||||
diagnostics::DiagnosticsArgs,
|
diagnostics::DiagnosticsArgs,
|
||||||
disconnect::{DisconnectArgs, DisconnectHandler},
|
disconnect::{DisconnectArgs, DisconnectHandler},
|
||||||
hip::{HipArgs, HipHandler},
|
|
||||||
launch_gui::{LaunchGuiArgs, LaunchGuiHandler},
|
launch_gui::{LaunchGuiArgs, LaunchGuiHandler},
|
||||||
};
|
};
|
||||||
|
use crate::{
|
||||||
|
connect::{ConnectArgs, ConnectHandler},
|
||||||
|
hip::{HipArgs, HipHandler},
|
||||||
|
};
|
||||||
|
|
||||||
const VERSION: &str = concat!(
|
const VERSION: &str = concat!(
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
@@ -33,7 +40,10 @@ const VERSION: &str = concat!(
|
|||||||
|
|
||||||
pub(crate) struct SharedArgs<'a> {
|
pub(crate) struct SharedArgs<'a> {
|
||||||
pub(crate) ignore_tls_errors: bool,
|
pub(crate) ignore_tls_errors: bool,
|
||||||
|
#[cfg(unix)]
|
||||||
pub(crate) lock_file: &'a Path,
|
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) verbose: &'a InfoLevelVerbosity,
|
||||||
pub(crate) log_format: LogFormat,
|
pub(crate) log_format: LogFormat,
|
||||||
}
|
}
|
||||||
@@ -42,12 +52,15 @@ pub(crate) struct SharedArgs<'a> {
|
|||||||
enum CliCommand {
|
enum CliCommand {
|
||||||
#[command(about = "Connect to a portal server")]
|
#[command(about = "Connect to a portal server")]
|
||||||
Connect(Box<ConnectArgs>),
|
Connect(Box<ConnectArgs>),
|
||||||
|
#[cfg(unix)]
|
||||||
#[command(about = "Disconnect from the server")]
|
#[command(about = "Disconnect from the server")]
|
||||||
Disconnect(DisconnectArgs),
|
Disconnect(DisconnectArgs),
|
||||||
|
#[cfg(unix)]
|
||||||
#[command(about = "Launch the GUI")]
|
#[command(about = "Launch the GUI")]
|
||||||
LaunchGui(LaunchGuiArgs),
|
LaunchGui(LaunchGuiArgs),
|
||||||
#[command(about = "Generate HIP report")]
|
#[command(about = "Generate HIP report")]
|
||||||
Hip(HipArgs),
|
Hip(HipArgs),
|
||||||
|
#[cfg(unix)]
|
||||||
#[command(about = "Collect system diagnostics for a bug report without connecting to a VPN")]
|
#[command(about = "Collect system diagnostics for a bug report without connecting to a VPN")]
|
||||||
Diagnostics(DiagnosticsArgs),
|
Diagnostics(DiagnosticsArgs),
|
||||||
#[command(hide = true)]
|
#[command(hide = true)]
|
||||||
@@ -89,11 +102,12 @@ struct Cli {
|
|||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: CliCommand,
|
command: CliCommand,
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
#[arg(long, hide = true)]
|
#[arg(long, hide = true)]
|
||||||
fix_openssl: bool,
|
fix_openssl: bool,
|
||||||
#[arg(long, help = "Ignore the TLS errors")]
|
#[arg(long, help = "Ignore the TLS errors")]
|
||||||
ignore_tls_errors: bool,
|
ignore_tls_errors: bool,
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
global = true,
|
global = true,
|
||||||
@@ -102,6 +116,7 @@ struct Cli {
|
|||||||
)]
|
)]
|
||||||
lock_file: PathBuf,
|
lock_file: PathBuf,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(long, hide = true, global = true)]
|
#[arg(long, hide = true, global = true)]
|
||||||
background_worker_fd: Option<i32>,
|
background_worker_fd: Option<i32>,
|
||||||
|
|
||||||
@@ -128,6 +143,7 @@ impl Args for Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Cli {
|
impl Cli {
|
||||||
|
#[cfg(unix)]
|
||||||
fn can_run_alongside_client(&self) -> bool {
|
fn can_run_alongside_client(&self) -> bool {
|
||||||
match &self.command {
|
match &self.command {
|
||||||
CliCommand::Connect(_) => false,
|
CliCommand::Connect(_) => false,
|
||||||
@@ -136,6 +152,7 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
async fn is_running(&self) -> bool {
|
async fn is_running(&self) -> bool {
|
||||||
let Ok(c) = fs::read_to_string(&self.lock_file).await else {
|
let Ok(c) = fs::read_to_string(&self.lock_file).await else {
|
||||||
return false;
|
return false;
|
||||||
@@ -156,13 +173,15 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn run(&self) -> anyhow::Result<()> {
|
async fn run(&self) -> anyhow::Result<()> {
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
if self.fix_openssl
|
if self.fix_openssl
|
||||||
&& !(matches!(&self.command, CliCommand::Connect(args) if args.background) && self.background_worker_fd.is_none())
|
&& !(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.");
|
log::warn!("--fix-openssl is deprecated and has no effect. It will be removed in a future release.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
let background_worker = {
|
||||||
if let CliCommand::Connect(args) = &self.command {
|
if let CliCommand::Connect(args) = &self.command {
|
||||||
if args.dashboard {
|
if args.dashboard {
|
||||||
crate::dashboard::validate(self.log_format)?;
|
crate::dashboard::validate(self.log_format)?;
|
||||||
@@ -180,7 +199,7 @@ impl Cli {
|
|||||||
bail!("Another instance of the client is already running");
|
bail!("Another instance of the client is already running");
|
||||||
}
|
}
|
||||||
|
|
||||||
let background_worker = if let CliCommand::Connect(args) = &self.command {
|
if let CliCommand::Connect(args) = &self.command {
|
||||||
if args.background {
|
if args.background {
|
||||||
let log_file = args
|
let log_file = args
|
||||||
.log_file
|
.log_file
|
||||||
@@ -195,11 +214,26 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
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 {
|
let shared_args = SharedArgs {
|
||||||
ignore_tls_errors: self.ignore_tls_errors,
|
ignore_tls_errors: self.ignore_tls_errors,
|
||||||
|
#[cfg(unix)]
|
||||||
lock_file: &self.lock_file,
|
lock_file: &self.lock_file,
|
||||||
|
#[cfg(windows)]
|
||||||
|
system_tunnel: system_tunnel.into(),
|
||||||
verbose: &self.verbose,
|
verbose: &self.verbose,
|
||||||
log_format: self.log_format,
|
log_format: self.log_format,
|
||||||
};
|
};
|
||||||
@@ -210,14 +244,17 @@ impl Cli {
|
|||||||
|
|
||||||
match &self.command {
|
match &self.command {
|
||||||
CliCommand::Connect(args) => {
|
CliCommand::Connect(args) => {
|
||||||
ConnectHandler::new(args, &shared_args)
|
let handler = ConnectHandler::new(args, &shared_args);
|
||||||
.with_background(background_worker)
|
#[cfg(unix)]
|
||||||
.handle()
|
let handler = handler.with_background(background_worker);
|
||||||
.await
|
handler.handle().await
|
||||||
}
|
}
|
||||||
|
#[cfg(unix)]
|
||||||
CliCommand::Disconnect(args) => DisconnectHandler::new(args, shared_args.lock_file).handle().await,
|
CliCommand::Disconnect(args) => DisconnectHandler::new(args, shared_args.lock_file).handle().await,
|
||||||
|
#[cfg(unix)]
|
||||||
CliCommand::LaunchGui(args) => LaunchGuiHandler::new(args).handle().await,
|
CliCommand::LaunchGui(args) => LaunchGuiHandler::new(args).handle().await,
|
||||||
CliCommand::Hip(args) => HipHandler::new(args).handle().await,
|
CliCommand::Hip(args) => HipHandler::new(args).handle().await,
|
||||||
|
#[cfg(unix)]
|
||||||
CliCommand::Diagnostics(_) => unreachable!("diagnostics is dispatched before VPN setup"),
|
CliCommand::Diagnostics(_) => unreachable!("diagnostics is dispatched before VPN setup"),
|
||||||
CliCommand::DetectInternalHost { address, hostname } => {
|
CliCommand::DetectInternalHost { address, hostname } => {
|
||||||
let internal = gpapi::session::desktop::network::native::detect_in_helper(*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
|
builder
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn run() {
|
fn initialize_logger(cli: &Cli) {
|
||||||
let cli = Cli::parse();
|
#[cfg(unix)]
|
||||||
|
|
||||||
if matches!(&cli.command, CliCommand::Connect(args) if args.dashboard) {
|
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_max_level(logger.filter());
|
||||||
log::set_boxed_logger(Box::new(crate::dashboard::NoticeLogger::new(logger))).expect("failed to initialize logger");
|
log::set_boxed_logger(Box::new(crate::dashboard::NoticeLogger::new(logger))).expect("failed to initialize logger");
|
||||||
} else {
|
return;
|
||||||
build_logger(&cli).init();
|
|
||||||
}
|
}
|
||||||
|
build_logger(cli).init();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn run() {
|
||||||
|
let cli = Cli::parse();
|
||||||
|
initialize_logger(&cli);
|
||||||
info!("gpclient started: {}", VERSION);
|
info!("gpclient started: {}", VERSION);
|
||||||
|
|
||||||
if let Err(err) = cli.run().await {
|
if let Err(err) = cli.run().await {
|
||||||
@@ -269,7 +309,7 @@ pub(crate) async fn run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(all(test, unix))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::{
|
use std::{
|
||||||
io::Write,
|
io::Write,
|
||||||
@@ -360,7 +400,7 @@ mod tests {
|
|||||||
fn diagnostics_accepts_output_options_and_runs_alongside_the_client() {
|
fn diagnostics_accepts_output_options_and_runs_alongside_the_client() {
|
||||||
let cli = Cli::try_parse_from([
|
let cli = Cli::try_parse_from([
|
||||||
"gpclient",
|
"gpclient",
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
"--fix-openssl",
|
"--fix-openssl",
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
"--json",
|
"--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")]
|
#[arg(help = "The portal server to connect to")]
|
||||||
pub(super) server: String,
|
pub(super) server: String,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
conflicts_with = "cookie_only",
|
conflicts_with = "cookie_only",
|
||||||
@@ -20,6 +21,7 @@ pub(crate) struct ConnectArgs {
|
|||||||
)]
|
)]
|
||||||
pub(crate) background: bool,
|
pub(crate) background: bool,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
conflicts_with_all = ["background", "cookie_only"],
|
conflicts_with_all = ["background", "cookie_only"],
|
||||||
@@ -27,6 +29,7 @@ pub(crate) struct ConnectArgs {
|
|||||||
)]
|
)]
|
||||||
pub(crate) dashboard: bool,
|
pub(crate) dashboard: bool,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
requires = "background",
|
requires = "background",
|
||||||
@@ -61,18 +64,21 @@ pub(crate) struct ConnectArgs {
|
|||||||
)]
|
)]
|
||||||
pub(super) cookie_cache: Option<String>,
|
pub(super) cookie_cache: Option<String>,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(long, short, help = "The VPNC script to use", required_if_eq("script_tun", "true"))]
|
#[arg(long, short, help = "The VPNC script to use", required_if_eq("script_tun", "true"))]
|
||||||
pub(super) script: Option<String>,
|
pub(super) script: Option<String>,
|
||||||
|
|
||||||
#[arg(long, short, help = "The IFNAME for tunnel interface")]
|
#[arg(long, short, help = "The IFNAME for tunnel interface")]
|
||||||
pub(super) interface: Option<String>,
|
pub(super) interface: Option<String>,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(long, short = 'S', help = "Pass traffic to '--script' program, not tun")]
|
#[arg(long, short = 'S', help = "Pass traffic to '--script' program, not tun")]
|
||||||
pub(super) script_tun: bool,
|
pub(super) script_tun: bool,
|
||||||
|
|
||||||
#[arg(long, help = "Connect the server as a gateway, instead of a portal")]
|
#[arg(long, help = "Connect the server as a gateway, instead of a portal")]
|
||||||
pub(super) as_gateway: bool,
|
pub(super) as_gateway: bool,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
help = "Enable HIP (Host Information Profile), optionally specify a custom executable",
|
help = "Enable HIP (Host Information Profile), optionally specify a custom executable",
|
||||||
@@ -81,6 +87,11 @@ pub(crate) struct ConnectArgs {
|
|||||||
)]
|
)]
|
||||||
pub(super) hip: Option<String>,
|
pub(super) hip: Option<String>,
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[arg(long, help = "Generate a HIP (Host Information Profile) report")]
|
||||||
|
pub(super) hip: bool,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
help = "Run a custom HIP executable as this user; otherwise inherit the process user"
|
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")]
|
#[arg(short = 'p', long, help = "The key passphrase of the private key")]
|
||||||
pub(super) key_password: Option<String>,
|
pub(super) key_password: Option<String>,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(long, hide = true)]
|
#[arg(long, hide = true)]
|
||||||
pub(super) csd_user: Option<String>,
|
pub(super) csd_user: Option<String>,
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[arg(long, hide = true)]
|
#[arg(long, hide = true)]
|
||||||
pub(super) csd_wrapper: Option<String>,
|
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 \
|
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."
|
--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 {
|
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> {
|
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);
|
let custom = (!path.is_empty()).then_some(path);
|
||||||
cookie_store::cookie_path(custom)
|
cookie_store::cookie_path(custom)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn warn_deprecated_connect_args(args: &ConnectArgs) {
|
pub(super) fn warn_deprecated_connect_args(args: &ConnectArgs) {
|
||||||
|
#[cfg(unix)]
|
||||||
if args.csd_user.is_some() {
|
if args.csd_user.is_some() {
|
||||||
warn!("Deprecated option --csd-user will be removed; use --hip-user instead");
|
warn!("Deprecated option --csd-user will be removed; use --hip-user instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
if args.csd_wrapper.is_some() {
|
if args.csd_wrapper.is_some() {
|
||||||
warn!("Deprecated option --csd-wrapper will be removed; use --hip instead");
|
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 {
|
mod tests {
|
||||||
use super::*;
|
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?;
|
let cred = auth_launcher.cancellation(&self.cancellation).launch().await?;
|
||||||
self.check_cancelled()?;
|
self.check_cancelled()?;
|
||||||
Ok(cred)
|
Ok(cred)
|
||||||
|
|||||||
@@ -36,14 +36,7 @@ fn login_response() -> String {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn gateway(responses: Vec<(&'static str, String)>) -> (String, tokio::task::JoinHandle<Vec<String>>) {
|
async fn read_request(stream: &mut tokio::net::TcpStream) -> String {
|
||||||
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 {
|
|
||||||
let mut requests = Vec::new();
|
|
||||||
for (status, body) in responses {
|
|
||||||
let (mut stream, _) = listener.accept().await.unwrap();
|
|
||||||
let mut request = Vec::new();
|
let mut request = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
let mut buf = [0; 4096];
|
let mut buf = [0; 4096];
|
||||||
@@ -58,11 +51,21 @@ async fn gateway(responses: Vec<(&'static str, String)>) -> (String, tokio::task
|
|||||||
.map(|value| value.trim().parse::<usize>().unwrap())
|
.map(|value| value.trim().parse::<usize>().unwrap())
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
if request.len() >= end + 4 + length {
|
if request.len() >= end + 4 + length {
|
||||||
break;
|
return String::from_utf8(request).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
requests.push(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());
|
||||||
|
let worker = tokio::spawn(async move {
|
||||||
|
tokio::time::timeout(Duration::from_secs(5), async move {
|
||||||
|
let mut requests = Vec::new();
|
||||||
|
for (status, body) in responses {
|
||||||
|
let (mut stream, _) = listener.accept().await.unwrap();
|
||||||
|
requests.push(read_request(&mut stream).await);
|
||||||
stream
|
stream
|
||||||
.write_all(
|
.write_all(
|
||||||
format!(
|
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]
|
#[tokio::test]
|
||||||
async fn internal_tunnel_keeps_gateway_authentication_after_portal_cookie_rejection() {
|
async fn internal_tunnel_keeps_gateway_authentication_after_portal_cookie_rejection() {
|
||||||
let (origin, worker) = gateway(vec![
|
let (origin, worker) = gateway(vec![
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
use std::{
|
use std::sync::{
|
||||||
fs,
|
|
||||||
path::Path,
|
|
||||||
sync::{
|
|
||||||
Arc, Mutex,
|
Arc, Mutex,
|
||||||
atomic::{AtomicBool, Ordering},
|
atomic::{AtomicBool, Ordering},
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
#[cfg(unix)]
|
||||||
|
use std::{fs, path::Path};
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
use gpapi::process::users::get_user_by_name;
|
||||||
use gpapi::{
|
use gpapi::{
|
||||||
clap::report,
|
clap::report,
|
||||||
cookie_store,
|
cookie_store,
|
||||||
@@ -15,19 +15,22 @@ use gpapi::{
|
|||||||
gp_params::GpParams,
|
gp_params::GpParams,
|
||||||
os_profile::OsProfile,
|
os_profile::OsProfile,
|
||||||
portal::{PortalConfig, prelogin},
|
portal::{PortalConfig, prelogin},
|
||||||
process::users::get_user_by_name,
|
|
||||||
session::{GatewayAuthentication, SessionMode},
|
session::{GatewayAuthentication, SessionMode},
|
||||||
};
|
};
|
||||||
use inquire::Text;
|
use inquire::Text;
|
||||||
use log::{Level, info, warn};
|
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 tokio::{runtime::Handle, task::JoinHandle};
|
||||||
|
|
||||||
use crate::session::{
|
use crate::session::{
|
||||||
SessionContextInput, build_session_context, session_info_from_vpn, spawn_session_runtime_with_info,
|
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;
|
const OPENCONNECT_INTERRUPTED_EXIT_CODE: i32 = -4;
|
||||||
|
|
||||||
@@ -101,6 +104,11 @@ impl ConnectHandler<'_> {
|
|||||||
{
|
{
|
||||||
return Some(Err(error));
|
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);
|
cookie_store::clear(&path);
|
||||||
warn!("Cached gateway authentication failed: {error}");
|
warn!("Cached gateway authentication failed: {error}");
|
||||||
return None;
|
return None;
|
||||||
@@ -447,7 +455,10 @@ impl ConnectHandler<'_> {
|
|||||||
disable_ipv6: self.args.disable_ipv6,
|
disable_ipv6: self.args.disable_ipv6,
|
||||||
extension_auth: Some(extension_auth),
|
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())
|
.interface(self.args.interface.clone())
|
||||||
.certificate(certificate)
|
.certificate(certificate)
|
||||||
.sslkey(sslkey)
|
.sslkey(sslkey)
|
||||||
@@ -482,21 +493,8 @@ impl ConnectHandler<'_> {
|
|||||||
let disconnect_requested_on_signal = Arc::clone(&disconnect_requested);
|
let disconnect_requested_on_signal = Arc::clone(&disconnect_requested);
|
||||||
let cancellation = self.cancellation.clone();
|
let cancellation = self.cancellation.clone();
|
||||||
|
|
||||||
let mut background_stdio = self
|
#[cfg(unix)]
|
||||||
.background
|
let mut output = TunnelOutput::prepare(self, gateway).map_err(GatewayConnectError::before_establishment)?;
|
||||||
.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
|
|
||||||
};
|
|
||||||
let monitor = gptunnel::TunnelMonitor::attach(vpn.clone());
|
let monitor = gptunnel::TunnelMonitor::attach(vpn.clone());
|
||||||
|
|
||||||
let disconnect_task = tokio::spawn(async move {
|
let disconnect_task = tokio::spawn(async move {
|
||||||
@@ -506,7 +504,9 @@ impl ConnectHandler<'_> {
|
|||||||
vpn_clone.disconnect();
|
vpn_clone.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
let lock_file_on_connect = self.shared_args.lock_file.to_path_buf();
|
let lock_file_on_connect = self.shared_args.lock_file.to_path_buf();
|
||||||
|
#[cfg(unix)]
|
||||||
let pid_written = self.pid_written.clone();
|
let pid_written = self.pid_written.clone();
|
||||||
let log_format = self.shared_args.log_format;
|
let log_format = self.shared_args.log_format;
|
||||||
let session_cancellation = self.cancellation.clone();
|
let session_cancellation = self.cancellation.clone();
|
||||||
@@ -518,6 +518,7 @@ impl ConnectHandler<'_> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tunnel_established_on_connect.store(true, Ordering::SeqCst);
|
tunnel_established_on_connect.store(true, Ordering::SeqCst);
|
||||||
|
#[cfg(unix)]
|
||||||
pid_written.store(write_pid_file(&lock_file_on_connect), Ordering::SeqCst);
|
pid_written.store(write_pid_file(&lock_file_on_connect), Ordering::SeqCst);
|
||||||
let _ = established_tx.send(());
|
let _ = established_tx.send(());
|
||||||
|
|
||||||
@@ -531,7 +532,6 @@ impl ConnectHandler<'_> {
|
|||||||
session_task_on_connect.lock().unwrap().replace(task);
|
session_task_on_connect.lock().unwrap().replace(task);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
let mut output_error = None;
|
|
||||||
let connect_result = tokio::select! {
|
let connect_result = tokio::select! {
|
||||||
result = &mut worker => result,
|
result = &mut worker => result,
|
||||||
established = established_rx => {
|
established = established_rx => {
|
||||||
@@ -545,23 +545,8 @@ impl ConnectHandler<'_> {
|
|||||||
self.logout_gateway(&server).await;
|
self.logout_gateway(&server).await;
|
||||||
}
|
}
|
||||||
}, || {
|
}, || {
|
||||||
if let Some(dashboard) = &mut dashboard {
|
#[cfg(unix)]
|
||||||
if let Err(error) = dashboard.start_tunnel(monitor.clone()) {
|
output.ready(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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).await
|
}).await
|
||||||
} else {
|
} else {
|
||||||
(&mut worker).await
|
(&mut worker).await
|
||||||
@@ -569,11 +554,8 @@ impl ConnectHandler<'_> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
monitor.stop().await;
|
monitor.stop().await;
|
||||||
if let Some(dashboard) = &mut dashboard {
|
#[cfg(unix)]
|
||||||
if let Err(error) = dashboard.finish() {
|
let output_result = output.finish();
|
||||||
output_error = Some(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let tunnel_established = tunnel_established.load(Ordering::SeqCst);
|
let tunnel_established = tunnel_established.load(Ordering::SeqCst);
|
||||||
disconnect_task.abort();
|
disconnect_task.abort();
|
||||||
let _ = disconnect_task.await;
|
let _ = disconnect_task.await;
|
||||||
@@ -584,15 +566,15 @@ impl ConnectHandler<'_> {
|
|||||||
let _ = task.await;
|
let _ = task.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(error) = output_error {
|
#[cfg(unix)]
|
||||||
return Err(GatewayConnectError::after_establishment(error));
|
output_result.map_err(GatewayConnectError::after_establishment)?;
|
||||||
}
|
|
||||||
|
|
||||||
let disconnect_requested = disconnect_requested.load(Ordering::SeqCst);
|
let disconnect_requested = disconnect_requested.load(Ordering::SeqCst);
|
||||||
let connect_result = connect_result.map_err(|error| GatewayConnectError::after_establishment(error.into()))?;
|
let connect_result = connect_result.map_err(|error| GatewayConnectError::after_establishment(error.into()))?;
|
||||||
classify_openconnect_result(connect_result, tunnel_established, disconnect_requested)
|
classify_openconnect_result(connect_result, tunnel_established, disconnect_requested)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
pub(super) fn hip_source(&self, profile: OsProfile) -> anyhow::Result<HipSource> {
|
pub(super) fn hip_source(&self, profile: OsProfile) -> anyhow::Result<HipSource> {
|
||||||
let user = self.determine_hip_user();
|
let user = self.determine_hip_user();
|
||||||
let script = self.args.hip.as_ref().or(self.args.csd_wrapper.as_ref());
|
let script = self.args.hip.as_ref().or(self.args.csd_wrapper.as_ref());
|
||||||
@@ -600,7 +582,36 @@ impl ConnectHandler<'_> {
|
|||||||
Some(path) if !path.is_empty() => Ok(HipSource::Script(HipScript::new(path.clone(), get_uid(&user)?)?)),
|
Some(path) if !path.is_empty() => Ok(HipSource::Script(HipScript::new(path.clone(), get_uid(&user)?)?)),
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
anyhow::ensure!(user.is_none(), "--hip-user requires an explicit HIP script");
|
anyhow::ensure!(user.is_none(), "--hip-user requires an explicit HIP script");
|
||||||
Ok(HipSource::Generator(Arc::new(move |request, control| {
|
Ok(generated_hip(profile))
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
anyhow::ensure!(user.is_none(), "--hip-user requires an explicit HIP script");
|
||||||
|
Ok(HipSource::Disabled)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[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());
|
||||||
|
}
|
||||||
|
|
||||||
|
self.args.csd_user.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn generated_hip(profile: OsProfile) -> HipSource {
|
||||||
|
HipSource::Generator(Arc::new(move |request, control| {
|
||||||
let input = gphip::ReportInput {
|
let input = gphip::ReportInput {
|
||||||
profile: profile.clone(),
|
profile: profile.clone(),
|
||||||
context: gphip::ReportContext::Connected {
|
context: gphip::ReportContext::Connected {
|
||||||
@@ -612,22 +623,7 @@ impl ConnectHandler<'_> {
|
|||||||
};
|
};
|
||||||
gphip::generate_report_with_control(&input, &|| control.check())
|
gphip::generate_report_with_control(&input, &|| control.check())
|
||||||
.map_err(|error| error.downcast::<std::io::Error>().unwrap_or_else(std::io::Error::other))
|
.map_err(|error| error.downcast::<std::io::Error>().unwrap_or_else(std::io::Error::other))
|
||||||
})))
|
}))
|
||||||
}
|
|
||||||
None => {
|
|
||||||
anyhow::ensure!(user.is_none(), "--hip-user requires an explicit HIP script");
|
|
||||||
Ok(HipSource::Disabled)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn determine_hip_user(&self) -> Option<String> {
|
|
||||||
if let Some(hip_user) = &self.args.hip_user {
|
|
||||||
return Some(hip_user.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
self.args.csd_user.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn wait_for_tunnel_exit(
|
async fn wait_for_tunnel_exit(
|
||||||
@@ -673,10 +669,17 @@ fn classify_openconnect_result(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
fn direct_gateway_command(gateway: &str) -> String {
|
fn direct_gateway_command(gateway: &str) -> String {
|
||||||
format!("gpauth --gateway {gateway} | sudo gpclient connect {gateway} --as-gateway --cookie-on-stdin")
|
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 {
|
pub(super) fn write_pid_file(lock_file: &Path) -> bool {
|
||||||
let pid = std::process::id();
|
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>> {
|
fn get_uid(user: &Option<String>) -> anyhow::Result<Option<u32>> {
|
||||||
user
|
user
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@@ -705,7 +709,7 @@ fn apply_os_profile(builder: VpnBuilder, profile: &OsProfile) -> VpnBuilder {
|
|||||||
.user_agent(Some(profile.user_agent().to_string()))
|
.user_agent(Some(profile.user_agent().to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(all(test, unix))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@@ -830,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 log::{info, warn};
|
||||||
|
|
||||||
use super::ConnectHandler;
|
use super::{ConnectHandler, internal_output::InternalOutput};
|
||||||
|
|
||||||
impl ConnectHandler<'_> {
|
impl ConnectHandler<'_> {
|
||||||
pub(super) async fn connect_internal_gateways(
|
pub(super) async fn connect_internal_gateways(
|
||||||
@@ -26,6 +26,7 @@ impl ConnectHandler<'_> {
|
|||||||
first_session: super::gateway::GatewayLoginSession,
|
first_session: super::gateway::GatewayLoginSession,
|
||||||
remaining: &[&Gateway],
|
remaining: &[&Gateway],
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
|
#[cfg(unix)]
|
||||||
ensure!(
|
ensure!(
|
||||||
self.background.is_none(),
|
self.background.is_none(),
|
||||||
"--background requires a VPN tunnel; internal non-tunnel sessions must run in the foreground"
|
"--background requires a VPN tunnel; internal non-tunnel sessions must run in the foreground"
|
||||||
@@ -70,11 +71,18 @@ impl ConnectHandler<'_> {
|
|||||||
}
|
}
|
||||||
self.check_cancelled()?;
|
self.check_cancelled()?;
|
||||||
let modes = authenticated.iter().map(|(_, session)| session.authentication.mode());
|
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!(
|
ensure!(
|
||||||
internal_session_mode(modes)? == SessionMode::NonTunnel,
|
internal_session_mode(modes)? == SessionMode::NonTunnel,
|
||||||
"Expected non-tunnel authentication"
|
"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(
|
async fn run_internal_session(
|
||||||
@@ -112,23 +120,13 @@ impl ConnectHandler<'_> {
|
|||||||
let source = Arc::new(source);
|
let source = Arc::new(source);
|
||||||
let validate_network = network.clone();
|
let validate_network = network.clone();
|
||||||
let validate_detection = detection.clone();
|
let validate_detection = detection.clone();
|
||||||
let members = crate::dashboard::InternalMembers::default();
|
let (output, observe_status) = InternalOutput::prepare(self, authenticated[0].0.server())?;
|
||||||
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 callbacks = SessionCallbacks {
|
let callbacks = SessionCallbacks {
|
||||||
produce_report: Arc::new(move |request, control| {
|
produce_report: Arc::new(move |request, control| {
|
||||||
control.check()?;
|
control.check()?;
|
||||||
if matches!(source.as_ref(), openconnect::HipSource::Disabled) {
|
if matches!(source.as_ref(), openconnect::HipSource::Disabled) {
|
||||||
return gphip::generate_identity_report(&gphip::ReportInput {
|
return gphip::generate_identity_report(
|
||||||
|
&gphip::ReportInput {
|
||||||
profile: profile.clone(),
|
profile: profile.clone(),
|
||||||
context: gphip::ReportContext::Connected {
|
context: gphip::ReportContext::Connected {
|
||||||
cookie: request.cookie.clone(),
|
cookie: request.cookie.clone(),
|
||||||
@@ -136,7 +134,9 @@ impl ConnectHandler<'_> {
|
|||||||
client_ipv6: request.client_ipv6.clone(),
|
client_ipv6: request.client_ipv6.clone(),
|
||||||
md5: request.md5.clone(),
|
md5: request.md5.clone(),
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
|
control,
|
||||||
|
)
|
||||||
.map_err(std::io::Error::other);
|
.map_err(std::io::Error::other);
|
||||||
}
|
}
|
||||||
source.collect(
|
source.collect(
|
||||||
@@ -162,16 +162,10 @@ impl ConnectHandler<'_> {
|
|||||||
"Internal network — authenticated: {} (IPv4: {:?}, IPv6: {:?})",
|
"Internal network — authenticated: {} (IPv4: {:?}, IPv6: {:?})",
|
||||||
member.gateway, member.client_ip, member.client_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),
|
state => info!("Internal gateway {}: {state:?}", member.gateway),
|
||||||
}
|
}
|
||||||
members.lock().unwrap().insert(
|
observe_status(&member);
|
||||||
member.gateway.server().to_owned(),
|
|
||||||
format!("{}: {:?}", member.gateway, member.maintenance),
|
|
||||||
);
|
|
||||||
}),
|
}),
|
||||||
validate_network: Arc::new(move |cancellation| {
|
validate_network: Arc::new(move |cancellation| {
|
||||||
let network = validate_network.clone();
|
let network = validate_network.clone();
|
||||||
@@ -201,43 +195,20 @@ impl ConnectHandler<'_> {
|
|||||||
|
|
||||||
// The PID spans maintenance and cleanup, including initialization before the
|
// The PID spans maintenance and cleanup, including initialization before the
|
||||||
// first successful HIP exchange. The outer handler owns final session logout.
|
// first successful HIP exchange. The outer handler owns final session logout.
|
||||||
|
#[cfg(unix)]
|
||||||
self.pid_written.store(
|
self.pid_written.store(
|
||||||
super::gateway::write_pid_file(self.shared_args.lock_file),
|
super::gateway::write_pid_file(self.shared_args.lock_file),
|
||||||
std::sync::atomic::Ordering::SeqCst,
|
std::sync::atomic::Ordering::SeqCst,
|
||||||
);
|
);
|
||||||
let mut sessions = self.sessions.take();
|
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 {
|
let maintenance = maintain_non_tunnel_sessions(&mut sessions, policy, callbacks, cancellation, async move {
|
||||||
network_signal.await.unwrap_or(SessionEndReason::NetworkChanged)
|
network_signal.await.unwrap_or(SessionEndReason::NetworkChanged)
|
||||||
});
|
});
|
||||||
tokio::pin!(maintenance);
|
let (result, output_result) = output.run(maintenance).await;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.sessions.replace(sessions);
|
self.sessions.replace(sessions);
|
||||||
monitor_cancel.cancel();
|
monitor_cancel.cancel();
|
||||||
monitor.await.context("Internal network monitor failed")?;
|
monitor.await.context("Internal network monitor failed")?;
|
||||||
if let Some(error) = dashboard_error {
|
output_result?;
|
||||||
return Err(error);
|
|
||||||
}
|
|
||||||
match result? {
|
match result? {
|
||||||
SessionExit::Disconnected => Ok(()),
|
SessionExit::Disconnected => Ok(()),
|
||||||
SessionExit::Failed(reason) => bail!("Internal session ended: {reason:?}. Connect again to authenticate."),
|
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> {
|
fn internal_session_mode(mut modes: impl Iterator<Item = SessionMode>) -> anyhow::Result<SessionMode> {
|
||||||
let mut modes = modes;
|
|
||||||
let mode = modes.next().context("No internal gateway authenticated successfully")?;
|
let mode = modes.next().context("No internal gateway authenticated successfully")?;
|
||||||
ensure!(
|
ensure!(
|
||||||
modes.all(|candidate| candidate == mode),
|
modes.all(|candidate| candidate == mode),
|
||||||
@@ -273,9 +243,39 @@ mod tests {
|
|||||||
internal_session_mode([SessionMode::NonTunnel, SessionMode::NonTunnel].into_iter()).unwrap(),
|
internal_session_mode([SessionMode::NonTunnel, SessionMode::NonTunnel].into_iter()).unwrap(),
|
||||||
SessionMode::NonTunnel
|
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 args;
|
||||||
mod credential;
|
mod credential;
|
||||||
#[cfg(test)]
|
#[cfg(all(test, unix))]
|
||||||
mod flow_tests;
|
mod flow_tests;
|
||||||
mod gateway;
|
mod gateway;
|
||||||
mod internal;
|
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;
|
mod vpn_script;
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
#[cfg(unix)]
|
||||||
use std::sync::{
|
use std::sync::{
|
||||||
Arc,
|
Arc,
|
||||||
atomic::{AtomicBool, Ordering},
|
atomic::{AtomicBool, Ordering},
|
||||||
@@ -46,7 +55,9 @@ pub(crate) struct ConnectHandler<'a> {
|
|||||||
auth_attempt_fixture: RefCell<credential::AuthAttemptFixture>,
|
auth_attempt_fixture: RefCell<credential::AuthAttemptFixture>,
|
||||||
auth_recovery: RefCell<gpapi::process::rendering_recovery::RecoveryState>,
|
auth_recovery: RefCell<gpapi::process::rendering_recovery::RecoveryState>,
|
||||||
sessions: RefCell<GatewaySessions>,
|
sessions: RefCell<GatewaySessions>,
|
||||||
|
#[cfg(unix)]
|
||||||
pid_written: Arc<AtomicBool>,
|
pid_written: Arc<AtomicBool>,
|
||||||
|
#[cfg(unix)]
|
||||||
background: Option<crate::background::BackgroundWorker>,
|
background: Option<crate::background::BackgroundWorker>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,11 +83,14 @@ impl<'a> ConnectHandler<'a> {
|
|||||||
auth_attempt_fixture: Default::default(),
|
auth_attempt_fixture: Default::default(),
|
||||||
auth_recovery: RefCell::default(),
|
auth_recovery: RefCell::default(),
|
||||||
sessions: RefCell::default(),
|
sessions: RefCell::default(),
|
||||||
|
#[cfg(unix)]
|
||||||
pid_written: Arc::default(),
|
pid_written: Arc::default(),
|
||||||
|
#[cfg(unix)]
|
||||||
background: None,
|
background: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
pub(crate) fn with_background(mut self, background: Option<crate::background::BackgroundWorker>) -> Self {
|
pub(crate) fn with_background(mut self, background: Option<crate::background::BackgroundWorker>) -> Self {
|
||||||
self.background = background;
|
self.background = background;
|
||||||
self
|
self
|
||||||
@@ -134,6 +148,7 @@ impl<'a> ConnectHandler<'a> {
|
|||||||
} else {
|
} else {
|
||||||
sessions.logout().await;
|
sessions.logout().await;
|
||||||
}
|
}
|
||||||
|
#[cfg(unix)]
|
||||||
if self.pid_written.load(Ordering::SeqCst) {
|
if self.pid_written.load(Ordering::SeqCst) {
|
||||||
if let Err(error) = std::fs::remove_file(self.shared_args.lock_file) {
|
if let Err(error) = std::fs::remove_file(self.shared_args.lock_file) {
|
||||||
warn!("Failed to remove PID file: {error}");
|
warn!("Failed to remove PID file: {error}");
|
||||||
@@ -292,6 +307,11 @@ impl<'a> ConnectHandler<'a> {
|
|||||||
Ok(config) => Some((cred, config)),
|
Ok(config) => Some((cred, config)),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
self.check_cancelled()?;
|
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}");
|
warn!("Cached portal authentication failed: {error}");
|
||||||
self.clear_cookie_cache();
|
self.clear_cookie_cache();
|
||||||
None
|
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 openconnect::{Vpn, VpnBuilder};
|
||||||
|
|
||||||
use crate::connect::ConnectArgs;
|
use crate::connect::ConnectHandler;
|
||||||
|
|
||||||
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> VpnBuilder {
|
impl ConnectHandler<'_> {
|
||||||
|
pub(in crate::connect) fn vpn_builder(&self, server: &str, cookie: &str) -> anyhow::Result<VpnBuilder> {
|
||||||
|
Ok(
|
||||||
Vpn::builder(server, cookie)
|
Vpn::builder(server, cookie)
|
||||||
.script(args.script.clone())
|
.script(self.args.script.clone())
|
||||||
.script_tun(args.script_tun)
|
.script_tun(self.args.script_tun),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,18 @@ use std::ffi::OsStr;
|
|||||||
|
|
||||||
use openconnect::{Vpn, VpnBuilder};
|
use openconnect::{Vpn, VpnBuilder};
|
||||||
|
|
||||||
use crate::connect::ConnectArgs;
|
use crate::connect::{ConnectArgs, ConnectHandler};
|
||||||
|
|
||||||
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> VpnBuilder {
|
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");
|
let configured_script = std::env::var_os("GP_VPNC_SCRIPT");
|
||||||
configure_builder(server, cookie, args, configured_script.as_deref())
|
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 {
|
fn configure_builder(server: &str, cookie: &str, args: &ConnectArgs, configured_script: Option<&OsStr>) -> VpnBuilder {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
#[path = "macos.rs"]
|
#[path = "macos.rs"]
|
||||||
mod platform;
|
mod platform;
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
#[path = "default.rs"]
|
#[path = "default.rs"]
|
||||||
mod platform;
|
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 background;
|
||||||
mod cli;
|
mod cli;
|
||||||
mod connect;
|
mod connect;
|
||||||
|
#[cfg(unix)]
|
||||||
mod dashboard;
|
mod dashboard;
|
||||||
|
#[cfg(unix)]
|
||||||
mod diagnostics;
|
mod diagnostics;
|
||||||
|
#[cfg(unix)]
|
||||||
mod disconnect;
|
mod disconnect;
|
||||||
mod hip;
|
mod hip;
|
||||||
|
#[cfg(unix)]
|
||||||
mod launch_gui;
|
mod launch_gui;
|
||||||
mod session;
|
mod session;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
pub(crate) const GP_CLIENT_LOCK_FILE: &str = "/var/run/gpclient.lock";
|
pub(crate) const GP_CLIENT_LOCK_FILE: &str = "/var/run/gpclient.lock";
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ async fn run_session_runtime(session_ctx: SessionContext, mut session_info: Sess
|
|||||||
|
|
||||||
tokio::time::sleep(schedule.delay).await;
|
tokio::time::sleep(schedule.delay).await;
|
||||||
|
|
||||||
crate::dashboard::session_notice(Level::Warn, &schedule.message);
|
report_session_notice(log_format, Level::Warn, &schedule.message);
|
||||||
report(log_format, Level::Warn, &format!("\nWARNING: {}", schedule.message));
|
|
||||||
|
|
||||||
if !schedule.should_auto_extend {
|
if !schedule.should_auto_extend {
|
||||||
info!("Session extension is not allowed by the gateway");
|
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;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
crate::dashboard::session_notice(Level::Info, "Session extended.");
|
report_session_notice(log_format, Level::Info, "Session extended.");
|
||||||
report(log_format, Level::Info, "Session extended.");
|
|
||||||
session_info = next_session_info;
|
session_info = next_session_info;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
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> {
|
fn build_session_warning_schedule(session_info: &SessionInfo) -> Option<SessionWarningSchedule> {
|
||||||
let warning = session_info.lifetime_warning.as_ref()?;
|
let warning = session_info.lifetime_warning.as_ref()?;
|
||||||
let warning_secs = if let Some(user_expires) = session_info.user_expires {
|
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]
|
#[test]
|
||||||
fn builds_warning_schedule_for_auto_extend() {
|
fn builds_warning_schedule_for_auto_extend() {
|
||||||
let session_info = sample_session_info(Some(unix_timestamp() + 1830), true);
|
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;
|
use std::process::Command;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![cfg(unix)]
|
||||||
|
|
||||||
use std::{os::unix::fs::PermissionsExt, process::Stdio, time::Duration};
|
use std::{os::unix::fs::PermissionsExt, process::Stdio, time::Duration};
|
||||||
|
|
||||||
use tokio::process::Command;
|
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`
|
`+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+`
|
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
|
`+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" />
|
<link rel="icon" type="image/svg+xml" href="/assets/icon-small-DFuJkDph.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>GPGUI Downloader</title>
|
<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">
|
<link rel="stylesheet" crossorigin href="/assets/main-CVTp2z3I.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -10,25 +10,25 @@
|
|||||||
"tauri": "tauri"
|
"tauri": "tauri"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.12.4",
|
"@tauri-apps/api": "^2.12.5",
|
||||||
"react": "^19.3.1",
|
"react": "^19.3.1",
|
||||||
"react-dom": "^19.3.1"
|
"react-dom": "^19.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "^2.12.4",
|
"@tauri-apps/cli": "^2.12.6",
|
||||||
"@types/node": "^26.6.6",
|
"@types/node": "^26.6.6",
|
||||||
"@types/react": "^19.3.0",
|
"@types/react": "^19.3.0",
|
||||||
"@types/react-dom": "^19.3.0",
|
"@types/react-dom": "^19.3.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.72.1",
|
"@typescript-eslint/eslint-plugin": "^8.73.0",
|
||||||
"@typescript-eslint/parser": "^8.72.1",
|
"@typescript-eslint/parser": "^8.73.0",
|
||||||
"@vitejs/plugin-react": "^6.1.2",
|
"@vitejs/plugin-react": "^6.3.0",
|
||||||
"eslint": "^9.39.5",
|
"eslint": "^9.39.5",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"eslint-plugin-react-hooks": "^7.1.1",
|
"eslint-plugin-react-hooks": "^7.1.1",
|
||||||
"prettier": "3.9.10",
|
"prettier": "3.10.1",
|
||||||
"typescript": "^6.0.3",
|
"typescript": "^6.0.3",
|
||||||
"vite": "^8.3.5"
|
"vite": "^8.3.8"
|
||||||
},
|
},
|
||||||
"packageManager": "[email protected]"
|
"packageManager": "[email protected]"
|
||||||
}
|
}
|
||||||
Generated
+280
-200
@@ -9,8 +9,8 @@ importers:
|
|||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@tauri-apps/api':
|
'@tauri-apps/api':
|
||||||
specifier: ^2.12.4
|
specifier: ^2.12.5
|
||||||
version: 2.12.4
|
version: 2.12.5
|
||||||
react:
|
react:
|
||||||
specifier: ^19.3.1
|
specifier: ^19.3.1
|
||||||
version: 19.3.1
|
version: 19.3.1
|
||||||
@@ -19,8 +19,8 @@ importers:
|
|||||||
version: 19.3.1([email protected])
|
version: 19.3.1([email protected])
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@tauri-apps/cli':
|
'@tauri-apps/cli':
|
||||||
specifier: ^2.12.4
|
specifier: ^2.12.6
|
||||||
version: 2.12.4
|
version: 2.12.6
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^26.6.6
|
specifier: ^26.6.6
|
||||||
version: 26.6.6
|
version: 26.6.6
|
||||||
@@ -31,14 +31,14 @@ importers:
|
|||||||
specifier: ^19.3.0
|
specifier: ^19.3.0
|
||||||
version: 19.3.0(@types/[email protected])
|
version: 19.3.0(@types/[email protected])
|
||||||
'@typescript-eslint/eslint-plugin':
|
'@typescript-eslint/eslint-plugin':
|
||||||
specifier: ^8.72.1
|
specifier: ^8.73.0
|
||||||
version: 8.72.1(@typescript-eslint/[email protected]2.1([email protected])([email protected]))([email protected])([email protected])
|
version: 8.73.0(@typescript-eslint/[email protected]3.0([email protected])([email protected]))([email protected])([email protected])
|
||||||
'@typescript-eslint/parser':
|
'@typescript-eslint/parser':
|
||||||
specifier: ^8.72.1
|
specifier: ^8.73.0
|
||||||
version: 8.72.1([email protected])([email protected])
|
version: 8.73.0([email protected])([email protected])
|
||||||
'@vitejs/plugin-react':
|
'@vitejs/plugin-react':
|
||||||
specifier: ^6.1.2
|
specifier: ^6.3.0
|
||||||
version: 6.1.2([email protected].5(@types/[email protected])([email protected]))
|
version: 6.3.0([email protected].8(@types/[email protected])([email protected]))
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^9.39.5
|
specifier: ^9.39.5
|
||||||
version: 9.39.5
|
version: 9.39.5
|
||||||
@@ -52,14 +52,14 @@ importers:
|
|||||||
specifier: ^7.1.1
|
specifier: ^7.1.1
|
||||||
version: 7.1.1([email protected])
|
version: 7.1.1([email protected])
|
||||||
prettier:
|
prettier:
|
||||||
specifier: 3.9.10
|
specifier: 3.10.1
|
||||||
version: 3.9.10
|
version: 3.10.1
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^6.0.3
|
specifier: ^6.0.3
|
||||||
version: 6.0.3
|
version: 6.0.3
|
||||||
vite:
|
vite:
|
||||||
specifier: ^8.3.5
|
specifier: ^8.3.8
|
||||||
version: 8.3.5(@types/[email protected])([email protected])
|
version: 8.3.8(@types/[email protected])([email protected])
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
@@ -130,6 +130,15 @@ packages:
|
|||||||
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
|
resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==}
|
||||||
engines: {node: '>=6.9.0'}
|
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]':
|
'@esbuild/[email protected]':
|
||||||
resolution: {integrity: sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==}
|
resolution: {integrity: sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
@@ -344,6 +353,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
|
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
|
||||||
engines: {node: '>=18.18'}
|
engines: {node: '>=18.18'}
|
||||||
|
|
||||||
|
'@isaacs/[email protected]':
|
||||||
|
resolution: {integrity: sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==}
|
||||||
|
|
||||||
'@jridgewell/[email protected]':
|
'@jridgewell/[email protected]':
|
||||||
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
|
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
|
||||||
|
|
||||||
@@ -360,95 +372,107 @@ packages:
|
|||||||
'@jridgewell/[email protected]':
|
'@jridgewell/[email protected]':
|
||||||
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
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]':
|
'@oxc-project/[email protected]':
|
||||||
resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==}
|
resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==}
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==}
|
resolution: {integrity: sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==}
|
resolution: {integrity: sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==}
|
resolution: {integrity: sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==}
|
resolution: {integrity: sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==}
|
resolution: {integrity: sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [freebsd]
|
os: [freebsd]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==}
|
resolution: {integrity: sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==}
|
resolution: {integrity: sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==}
|
resolution: {integrity: sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==}
|
resolution: {integrity: sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [ppc64]
|
cpu: [ppc64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==}
|
resolution: {integrity: sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [s390x]
|
cpu: [s390x]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==}
|
resolution: {integrity: sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==}
|
resolution: {integrity: sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==}
|
resolution: {integrity: sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [openharmony]
|
os: [openharmony]
|
||||||
|
|
||||||
'@rolldown/binding-win32-arm64-msvc@1.2.16':
|
'@rolldown/binding-wasm32-wasi@1.2.19':
|
||||||
resolution: {integrity: sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==}
|
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}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
resolution: {integrity: sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==}
|
resolution: {integrity: sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
@@ -456,80 +480,83 @@ packages:
|
|||||||
'@rolldown/[email protected]':
|
'@rolldown/[email protected]':
|
||||||
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
|
resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].5':
|
||||||
resolution: {integrity: sha512-pVmfis+4zT8H0Qhp3xPZx9Ju7kpzvA6rr/PSJPyuwfvucTQ8sVt61NYU9KMkK703UFlYadFmjKA4HhybOtN0gg==}
|
resolution: {integrity: sha512-G9QIMt5fzED+aS4QhVK3w1HWLKpLIwH/MnpCr9z1ugGEHnS2ORmqrLkc0uALOjRK4qXJy+4Yiw8LDl/KicC1Hg==}
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-OxqKSckIkoJ6vX2AjifIJpTasFC0Hbdoo7gEiCmAjauABO3U8m2MRsLWe+QTiBwDx1mIrvgA+rvI7tvDnbnHVg==}
|
resolution: {integrity: sha512-Uokwk1hFfJoG54+kD8iU0St33jAIkNvojnjEfBZ6UbL5rnM10AiFwUS/2DHTJ9R4/Kba4U44v7djfMuWFTQgeg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-fz76/77wMMJOaaUN6n3CybRG0P/MTEjjqYk81mGPyhi9m6Ue5T+LWBnJP/AkPooNatBPI2vtulGqomyMJ44lCQ==}
|
resolution: {integrity: sha512-WhahqzcyHCpCzh4Taf0ZbBm6nGkvuOSh5ffrgOO7EdYaYe+RBQK8LOlFu+bbjul5v9cdLDi3kco+0+7IlZtTVA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-K0w8Bof6Lt8QKLAYhRy0yy36ZH5iA/35VuSOvnxyjvCUZ+A3JKsUTlALviH/sVgAlisaPzzmeJSH8XOn4Q2HBA==}
|
resolution: {integrity: sha512-GB6weN+iFHxiFZ9SOKW6fINis7gnxohoOldR7sryBe7uaavkFGaMCa0yQs5njeXPWvzlE9WTQ13z8oDjmqK+Ww==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-j5rOnjmRUwWrm1oosf0zBYl4D+fqydgUROFCk0hvKZxvbTT8SOERes0QB7rBV/XWNy+kM6pCKzb3oSm2sRglzg==}
|
resolution: {integrity: sha512-mdHoUFYKfztUtPKE0C2hhGkEo7j6swXjg+5yRRKSD7A2gLkRPQFIXWD/DAYhiJdeAkyA8MCP6nvvKvg/4YryWQ==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-aOue3Fy6Jb7+oWcfAVUsVHfeTybSCt2CZoU06aO4jv4d2Ks/KnaTPwMAK3CLEduGOvBLY1lbBBrIyomqLLH5Sg==}
|
resolution: {integrity: sha512-2BxB+9a3JRN0eJ0t0qGe8IKJfgBLOZDE8a499OXH+yg4J9bMpSK1oHXBxnHuSHFWhby4QnQ/t+sBf7tRC0UZeA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-Fx6GShY/RvST+t6LMlTHAwd66+1tEaAAGrnU7cysVfaiRP1BKng5Vl6rVmO6rSLOA1Sp1dRzNYM4f0OWQGb7qA==}
|
resolution: {integrity: sha512-sb58RsNHex9QVqHdN1cf9MMlamUWAtk1NzuxTZalUnBUHfblIbe71hfmdI6whDZ84MufgOdeg/bzvhrbZS1r0w==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-tNzZSa79Z1nRpHxEpQ38lsAFpKlFlYvoXzjTV+lRRn/zSf3wrdUC3wnLcq2XEadchPu4ttK0zivhYzr+XGD19Q==}
|
resolution: {integrity: sha512-ZAb4/CHRma3ErjL2RGfHjITTUBIs4zySf0hIli9BddOtEdSx0ze0hEgxl+HfBVc5OEW/QmbiZ2E2+CkkHc8Pcg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-jmZ1pr0xEqUhuEusWtt9Yt+GF6lCnGHUmIL+KIknpbjK/XQ2qkhDBhaxK/JMHM2A8dAacVXCxXJk2EXpwhQUfA==}
|
resolution: {integrity: sha512-ueSzM2Du6r4i1d/lby9kEvrhPnXw5zM/VYvcW1ldEWSpkUyVohsBXkmD+U7vMskEW5tXeCUenki7nYVxyGBGpQ==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-fGo8pgEHZxdSYgZ/J98m1usJ7NHKmKbq7k6uT0x1rpOq6Bg2YVzzpaAblWk710f5LHYBJIL5QIFS5IrD+4gmTg==}
|
resolution: {integrity: sha512-6bmOt2BQSe0Bba+5CJcTKSML7VOYDxyiAKyBrjo86VxMdC1usIQmklu3Xc83s3QoK1rOMwwbANlPF6i5R2mvIg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-ezl8sQIcjYsye3TUnTH5VcWmWzccZASlQm7hlZt0dYyj1XD0qpVW47u2xYVrIKui0F8uQv/7QGZixdWiClBsbg==}
|
resolution: {integrity: sha512-9q9ZFNuFreBczwyJuhhlrEOBzGClwWUYirQ2GBl66Y6EaNl17IdLH8TRqoY9wYB1LnctNBi+Fa/WMGtFA4BtFQ==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [ia32]
|
cpu: [ia32]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-DJhDeCqjLDNMWYFy7ZS8cfeAHX2RK0RbQMLiA3bMVVkXRDJ4NBYiHriGqsUhsr9iG41aTb+dJGkFPmPw1gWwVw==}
|
resolution: {integrity: sha512-ion7Chbj21ROxMRpjQ7G8rz5sIOaI7IoBQum1oq5sl1V5zGWyc/oYnCrQhVqO2TxK/lBDWxt648BzLi02SY3Xg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
resolution: {integrity: sha512-JI9bHfudSRJikGOrjbXEm6RjzzvmKuLc+JixB1NE8hNzQkNlCCIC3pTES3uypkR9lxHrsbxzcnSwhI2IxBQphw==}
|
resolution: {integrity: sha512-/cOeQgqq8PBDPODOjjT0YHs4qxKCHcQMWMiBm4rLM3JNr9mZE+PHNKOK4zAkhIUtYMNL/0fweW48VNvzD1AbqA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
'@tybys/[email protected]':
|
||||||
|
resolution: {integrity: sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA==}
|
||||||
|
|
||||||
'@types/[email protected]':
|
'@types/[email protected]':
|
||||||
resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}
|
resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==}
|
||||||
|
|
||||||
@@ -547,72 +574,76 @@ packages:
|
|||||||
'@types/[email protected]':
|
'@types/[email protected]':
|
||||||
resolution: {integrity: sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==}
|
resolution: {integrity: sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==}
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==}
|
resolution: {integrity: sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@typescript-eslint/parser': ^8.72.1
|
'@typescript-eslint/parser': ^8.73.0
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-ZGwZP4OCfyA0AQTpEAMWz+rtX01DRhQWW5hB0ucKDEIX5U7jdmPSaMx94rQfaPAQzIYz2BimOgKOJtjfpRFQ9g==}
|
resolution: {integrity: sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==}
|
resolution: {integrity: sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==}
|
resolution: {integrity: sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==}
|
resolution: {integrity: sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-iY2wlmyrXJmx4yxUGP3aYCFF3cA/6ShddOKmLU2dx7LnEykbAM8WThlxZEfd1NddqceF6eJmZUayxx9oKIYNlg==}
|
resolution: {integrity: sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==}
|
resolution: {integrity: sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==}
|
resolution: {integrity: sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
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'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@typescript/native':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-5v5liypurJBFHCBNqh/RjsymAD+VWcE0djuGY/BUqp5fC3Qn+luWDEksjuTtWjPn6i5zQlUtkZCRG/CYG0yCkA==}
|
resolution: {integrity: sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||||
typescript: '>=4.8.4 <6.1.0'
|
typescript: '>=4.8.4 <6.1.0'
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
resolution: {integrity: sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==}
|
resolution: {integrity: sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==}
|
||||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||||
|
|
||||||
'@vitejs/plugin-react@6.1.2':
|
'@vitejs/plugin-react@6.3.0':
|
||||||
resolution: {integrity: sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==}
|
resolution: {integrity: sha512-H9E955aVvD2F4zNHCw4eIZbIfF6xKldlh7MNu+hSU7xwQzh65lI/N+CJWqmfhi0PEjDXIt/H7T7J/4wU63KJiw==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
peerDependencies:
|
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
|
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
|
vite: ^8.0.0
|
||||||
peerDependenciesMeta:
|
peerDependenciesMeta:
|
||||||
'@rolldown/plugin-babel':
|
'@rolldown/plugin-babel':
|
||||||
@@ -1282,9 +1313,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
minimatch@10.2.6:
|
minimatch@11.0.9:
|
||||||
resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
|
resolution: {integrity: sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==}
|
||||||
engines: {node: 18 || 20 || >=22}
|
engines: {node: 20 || >=22}
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==}
|
resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==}
|
||||||
@@ -1386,8 +1417,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
|
|
||||||
prettier@3.9.10:
|
prettier@3.10.1:
|
||||||
resolution: {integrity: sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==}
|
resolution: {integrity: sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -1427,8 +1458,8 @@ packages:
|
|||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
[email protected]6:
|
[email protected]9:
|
||||||
resolution: {integrity: sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==}
|
resolution: {integrity: sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -1541,6 +1572,9 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=4.8.4'
|
typescript: '>=4.8.4'
|
||||||
|
|
||||||
|
[email protected]:
|
||||||
|
resolution: {integrity: sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==}
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||||
engines: {node: '>= 0.8.0'}
|
engines: {node: '>= 0.8.0'}
|
||||||
@@ -1582,8 +1616,8 @@ packages:
|
|||||||
[email protected]:
|
[email protected]:
|
||||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||||
|
|
||||||
[email protected].5:
|
[email protected].8:
|
||||||
resolution: {integrity: sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==}
|
resolution: {integrity: sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -1768,6 +1802,22 @@ snapshots:
|
|||||||
'@babel/helper-string-parser': 7.29.7
|
'@babel/helper-string-parser': 7.29.7
|
||||||
'@babel/helper-validator-identifier': 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]':
|
'@esbuild/[email protected]':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@@ -1908,6 +1958,8 @@ snapshots:
|
|||||||
|
|
||||||
'@humanwhocodes/[email protected]': {}
|
'@humanwhocodes/[email protected]': {}
|
||||||
|
|
||||||
|
'@isaacs/[email protected]': {}
|
||||||
|
|
||||||
'@jridgewell/[email protected]':
|
'@jridgewell/[email protected]':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/sourcemap-codec': 1.6.0
|
'@jridgewell/sourcemap-codec': 1.6.0
|
||||||
@@ -1927,103 +1979,122 @@ snapshots:
|
|||||||
'@jridgewell/resolve-uri': 3.1.2
|
'@jridgewell/resolve-uri': 3.1.2
|
||||||
'@jridgewell/sourcemap-codec': 1.6.0
|
'@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]': {}
|
'@oxc-project/[email protected]': {}
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]6':
|
'@rolldown/[email protected]9':
|
||||||
optional: true
|
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
|
optional: true
|
||||||
|
|
||||||
'@rolldown/binding-win32-x[email protected]6':
|
'@rolldown/binding-win32-arm[email protected]9':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@rolldown/[email protected]':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rolldown/[email protected]': {}
|
'@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
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@tauri-apps/[email protected].4':
|
'@tauri-apps/[email protected].6':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@tauri-apps/cli-darwin-arm64': 2.12.4
|
'@tauri-apps/cli-darwin-arm64': 2.12.6
|
||||||
'@tauri-apps/cli-darwin-x64': 2.12.4
|
'@tauri-apps/cli-darwin-x64': 2.12.6
|
||||||
'@tauri-apps/cli-linux-arm-gnueabihf': 2.12.4
|
'@tauri-apps/cli-linux-arm-gnueabihf': 2.12.6
|
||||||
'@tauri-apps/cli-linux-arm64-gnu': 2.12.4
|
'@tauri-apps/cli-linux-arm64-gnu': 2.12.6
|
||||||
'@tauri-apps/cli-linux-arm64-musl': 2.12.4
|
'@tauri-apps/cli-linux-arm64-musl': 2.12.6
|
||||||
'@tauri-apps/cli-linux-riscv64-gnu': 2.12.4
|
'@tauri-apps/cli-linux-riscv64-gnu': 2.12.6
|
||||||
'@tauri-apps/cli-linux-x64-gnu': 2.12.4
|
'@tauri-apps/cli-linux-x64-gnu': 2.12.6
|
||||||
'@tauri-apps/cli-linux-x64-musl': 2.12.4
|
'@tauri-apps/cli-linux-x64-musl': 2.12.6
|
||||||
'@tauri-apps/cli-win32-arm64-msvc': 2.12.4
|
'@tauri-apps/cli-win32-arm64-msvc': 2.12.6
|
||||||
'@tauri-apps/cli-win32-ia32-msvc': 2.12.4
|
'@tauri-apps/cli-win32-ia32-msvc': 2.12.6
|
||||||
'@tauri-apps/cli-win32-x64-msvc': 2.12.4
|
'@tauri-apps/cli-win32-x64-msvc': 2.12.6
|
||||||
|
|
||||||
|
'@tybys/[email protected]':
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.9.1
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@types/[email protected]': {}
|
'@types/[email protected]': {}
|
||||||
|
|
||||||
@@ -2041,74 +2112,77 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
csstype: 3.2.3
|
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:
|
dependencies:
|
||||||
'@eslint-community/regexpp': 4.12.2
|
'@eslint-community/regexpp': 4.12.2
|
||||||
'@typescript-eslint/parser': 8.72.1([email protected])([email protected])
|
'@typescript-eslint/parser': 8.73.0([email protected])([email protected])
|
||||||
'@typescript-eslint/scope-manager': 8.72.1
|
'@typescript-eslint/scope-manager': 8.73.0
|
||||||
'@typescript-eslint/type-utils': 8.72.1([email protected])([email protected])
|
'@typescript-eslint/type-utils': 8.73.0([email protected])([email protected])
|
||||||
'@typescript-eslint/utils': 8.72.1([email protected])([email protected])
|
'@typescript-eslint/utils': 8.73.0([email protected])([email protected])
|
||||||
'@typescript-eslint/visitor-keys': 8.72.1
|
'@typescript-eslint/visitor-keys': 8.73.0
|
||||||
eslint: 9.39.5
|
eslint: 9.39.5
|
||||||
ignore: 7.0.14
|
ignore: 7.0.14
|
||||||
natural-compare: 1.4.0
|
natural-compare: 1.4.0
|
||||||
ts-api-utils: 2.5.0([email protected])
|
ts-api-utils: 2.5.0([email protected])
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
- '@typescript/native'
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
|
'@typescript-eslint/[email protected]3.0([email protected])([email protected])':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/scope-manager': 8.72.1
|
'@typescript-eslint/scope-manager': 8.73.0
|
||||||
'@typescript-eslint/types': 8.72.1
|
'@typescript-eslint/types': 8.73.0
|
||||||
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
|
'@typescript-eslint/typescript-estree': 8.73.0([email protected])
|
||||||
'@typescript-eslint/visitor-keys': 8.72.1
|
'@typescript-eslint/visitor-keys': 8.73.0
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
eslint: 9.39.5
|
eslint: 9.39.5
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
- '@typescript/native'
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1([email protected])':
|
'@typescript-eslint/[email protected]3.0([email protected])':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/tsconfig-utils': 8.72.1([email protected])
|
'@typescript-eslint/tsconfig-utils': 8.73.0([email protected])
|
||||||
'@typescript-eslint/types': 8.72.1
|
'@typescript-eslint/types': 8.73.0
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.72.1
|
'@typescript-eslint/types': 8.73.0
|
||||||
'@typescript-eslint/visitor-keys': 8.72.1
|
'@typescript-eslint/visitor-keys': 8.73.0
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1([email protected])':
|
'@typescript-eslint/[email protected]3.0([email protected])':
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript: 6.0.3
|
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:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.72.1
|
'@typescript-eslint/types': 8.73.0
|
||||||
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
|
'@typescript-eslint/typescript-estree': 8.73.0([email protected])
|
||||||
'@typescript-eslint/utils': 8.72.1([email protected])([email protected])
|
'@typescript-eslint/utils': 8.73.0([email protected])([email protected])
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
eslint: 9.39.5
|
eslint: 9.39.5
|
||||||
ts-api-utils: 2.5.0([email protected])
|
ts-api-utils: 2.5.0([email protected])
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
- '@typescript/native'
|
||||||
- supports-color
|
- 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:
|
dependencies:
|
||||||
'@typescript-eslint/project-service': 8.72.1([email protected])
|
'@typescript-eslint/project-service': 8.73.0([email protected])
|
||||||
'@typescript-eslint/tsconfig-utils': 8.72.1([email protected])
|
'@typescript-eslint/tsconfig-utils': 8.73.0([email protected])
|
||||||
'@typescript-eslint/types': 8.72.1
|
'@typescript-eslint/types': 8.73.0
|
||||||
'@typescript-eslint/visitor-keys': 8.72.1
|
'@typescript-eslint/visitor-keys': 8.73.0
|
||||||
debug: 4.4.3
|
debug: 4.4.3
|
||||||
minimatch: 10.2.6
|
minimatch: 11.0.9
|
||||||
semver: 7.8.5
|
semver: 7.8.5
|
||||||
tinyglobby: 0.2.17
|
tinyglobby: 0.2.17
|
||||||
ts-api-utils: 2.5.0([email protected])
|
ts-api-utils: 2.5.0([email protected])
|
||||||
@@ -2116,26 +2190,27 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1([email protected])([email protected])':
|
'@typescript-eslint/[email protected]3.0([email protected])([email protected])':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@eslint-community/eslint-utils': 4.10.1([email protected])
|
'@eslint-community/eslint-utils': 4.10.1([email protected])
|
||||||
'@typescript-eslint/scope-manager': 8.72.1
|
'@typescript-eslint/scope-manager': 8.73.0
|
||||||
'@typescript-eslint/types': 8.72.1
|
'@typescript-eslint/types': 8.73.0
|
||||||
'@typescript-eslint/typescript-estree': 8.72.1([email protected])
|
'@typescript-eslint/typescript-estree': 8.73.0([email protected])
|
||||||
eslint: 9.39.5
|
eslint: 9.39.5
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
- '@typescript/native'
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@typescript-eslint/[email protected]2.1':
|
'@typescript-eslint/[email protected]3.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@typescript-eslint/types': 8.72.1
|
'@typescript-eslint/types': 8.73.0
|
||||||
eslint-visitor-keys: 5.0.1
|
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:
|
dependencies:
|
||||||
'@rolldown/pluginutils': 1.0.1
|
'@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]):
|
[email protected]([email protected]):
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2941,8 +3016,9 @@ snapshots:
|
|||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
minimatch@10.2.6:
|
minimatch@11.0.9:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@isaacs/nonrecursive-glob-match': 1.1.0
|
||||||
brace-expansion: 5.0.12
|
brace-expansion: 5.0.12
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
@@ -3048,7 +3124,7 @@ snapshots:
|
|||||||
|
|
||||||
[email protected]: {}
|
[email protected]: {}
|
||||||
|
|
||||||
prettier@3.9.10: {}
|
prettier@3.10.1: {}
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3098,26 +3174,27 @@ snapshots:
|
|||||||
path-parse: 1.0.7
|
path-parse: 1.0.7
|
||||||
supports-preserve-symlinks-flag: 1.0.0
|
supports-preserve-symlinks-flag: 1.0.0
|
||||||
|
|
||||||
[email protected]6:
|
[email protected]9:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@oxc-project/types': 0.156.0
|
'@oxc-project/types': 0.156.0
|
||||||
'@rolldown/pluginutils': 1.0.1
|
'@rolldown/pluginutils': 1.0.1
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@rolldown/binding-android-arm-eabi': 1.2.16
|
'@rolldown/binding-android-arm-eabi': 1.2.19
|
||||||
'@rolldown/binding-android-arm64': 1.2.16
|
'@rolldown/binding-android-arm64': 1.2.19
|
||||||
'@rolldown/binding-darwin-arm64': 1.2.16
|
'@rolldown/binding-darwin-arm64': 1.2.19
|
||||||
'@rolldown/binding-darwin-x64': 1.2.16
|
'@rolldown/binding-darwin-x64': 1.2.19
|
||||||
'@rolldown/binding-freebsd-x64': 1.2.16
|
'@rolldown/binding-freebsd-x64': 1.2.19
|
||||||
'@rolldown/binding-linux-arm-gnueabihf': 1.2.16
|
'@rolldown/binding-linux-arm-gnueabihf': 1.2.19
|
||||||
'@rolldown/binding-linux-arm64-gnu': 1.2.16
|
'@rolldown/binding-linux-arm64-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-arm64-musl': 1.2.16
|
'@rolldown/binding-linux-arm64-musl': 1.2.19
|
||||||
'@rolldown/binding-linux-ppc64-gnu': 1.2.16
|
'@rolldown/binding-linux-ppc64-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-s390x-gnu': 1.2.16
|
'@rolldown/binding-linux-s390x-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-x64-gnu': 1.2.16
|
'@rolldown/binding-linux-x64-gnu': 1.2.19
|
||||||
'@rolldown/binding-linux-x64-musl': 1.2.16
|
'@rolldown/binding-linux-x64-musl': 1.2.19
|
||||||
'@rolldown/binding-openharmony-arm64': 1.2.16
|
'@rolldown/binding-openharmony-arm64': 1.2.19
|
||||||
'@rolldown/binding-win32-arm64-msvc': 1.2.16
|
'@rolldown/binding-wasm32-wasi': 1.2.19
|
||||||
'@rolldown/binding-win32-x64-msvc': 1.2.16
|
'@rolldown/binding-win32-arm64-msvc': 1.2.19
|
||||||
|
'@rolldown/binding-win32-x64-msvc': 1.2.19
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3269,6 +3346,9 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
typescript: 6.0.3
|
typescript: 6.0.3
|
||||||
|
|
||||||
|
[email protected]:
|
||||||
|
optional: true
|
||||||
|
|
||||||
[email protected]:
|
[email protected]:
|
||||||
dependencies:
|
dependencies:
|
||||||
prelude-ls: 1.2.1
|
prelude-ls: 1.2.1
|
||||||
@@ -3326,12 +3406,12 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
punycode: 2.3.1
|
punycode: 2.3.1
|
||||||
|
|
||||||
[email protected].5(@types/[email protected])([email protected]):
|
[email protected].8(@types/[email protected])([email protected]):
|
||||||
dependencies:
|
dependencies:
|
||||||
lightningcss: 1.33.0
|
lightningcss: 1.33.0
|
||||||
picomatch: 4.0.7
|
picomatch: 4.0.7
|
||||||
postcss: 8.5.32
|
postcss: 8.5.32
|
||||||
rolldown: 1.2.16
|
rolldown: 1.2.19
|
||||||
tinyglobby: 0.2.17
|
tinyglobby: 0.2.17
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/node': 26.6.6
|
'@types/node': 26.6.6
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ serde_json.workspace = true
|
|||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
compile-time.workspace = true
|
compile-time.workspace = true
|
||||||
xz2 = "0.1"
|
|
||||||
tar = "0.4"
|
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
uuid = { workspace = true, features = ["v4"] }
|
uuid = { workspace = true, features = ["v4"] }
|
||||||
zeroize.workspace = true
|
zeroize.workspace = true
|
||||||
@@ -33,6 +31,8 @@ getrandom = "0.4"
|
|||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
nix = { version = "0.31", features = ["fs", "socket", "user"] }
|
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]
|
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
|
||||||
mac_address = "1.2.1"
|
mac_address = "1.2.1"
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ impl HipPreviews {
|
|||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
let result = match generated {
|
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)) => {
|
Ok(Err(error)) => {
|
||||||
log::warn!("HIP preview failed: {error:#}");
|
log::warn!("HIP preview failed: {error:#}");
|
||||||
ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview failed")
|
ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview failed")
|
||||||
@@ -132,8 +132,10 @@ impl HipPreviews {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn preview_result(registry: &SessionRegistry, session_id: Uuid, xml: String) -> ServiceResult {
|
fn preview_result(registry: &SessionRegistry, session_id: Uuid, report: gpapi::hip::HipReport) -> ServiceResult {
|
||||||
let result = registry.store_hip_preview(session_id, xml).and_then(|preview_id| {
|
let result = registry
|
||||||
|
.store_hip_preview(session_id, report.xml)
|
||||||
|
.and_then(|preview_id| {
|
||||||
registry
|
registry
|
||||||
.hip_preview_chunk(session_id, preview_id, 0)
|
.hip_preview_chunk(session_id, preview_id, 0)
|
||||||
.map(|(xml, complete)| ServiceResult::HipPreviewChunk {
|
.map(|(xml, complete)| ServiceResult::HipPreviewChunk {
|
||||||
@@ -141,6 +143,7 @@ fn preview_result(registry: &SessionRegistry, session_id: Uuid, xml: String) ->
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
xml,
|
xml,
|
||||||
complete,
|
complete,
|
||||||
|
windows_updates: report.windows_updates,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
result.unwrap_or_else(|_| ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview is unavailable"))
|
result.unwrap_or_else(|_| ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview is unavailable"))
|
||||||
@@ -152,7 +155,7 @@ fn generate(
|
|||||||
desktop_uid: Option<u32>,
|
desktop_uid: Option<u32>,
|
||||||
identity: HostIdentity,
|
identity: HostIdentity,
|
||||||
cancellation: CancellationToken,
|
cancellation: CancellationToken,
|
||||||
) -> anyhow::Result<String> {
|
) -> anyhow::Result<gpapi::hip::HipReport> {
|
||||||
ensure!(request.client_version.len() <= 64, "Invalid HIP client version");
|
ensure!(request.client_version.len() <= 64, "Invalid HIP client version");
|
||||||
ensure!(
|
ensure!(
|
||||||
request.host_id.as_ref().is_none_or(|id| id.len() <= 256),
|
request.host_id.as_ref().is_none_or(|id| id.len() <= 256),
|
||||||
@@ -188,7 +191,15 @@ fn generate(
|
|||||||
};
|
};
|
||||||
let xml = match &request.source {
|
let xml = match &request.source {
|
||||||
HipSource::Disabled => bail!("HIP is disabled"),
|
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 { .. } => {
|
HipSource::Edited { .. } => {
|
||||||
let xml = edited_report.context("Edited HIP report is unavailable")?;
|
let xml = edited_report.context("Edited HIP report is unavailable")?;
|
||||||
crate::hip_source::generate(&profile, Some(&xml), &input, &check, true)?
|
crate::hip_source::generate(&profile, Some(&xml), &input, &check, true)?
|
||||||
@@ -204,7 +215,10 @@ fn generate(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
check()?;
|
check()?;
|
||||||
Ok(xml)
|
Ok(gpapi::hip::HipReport {
|
||||||
|
xml,
|
||||||
|
windows_updates: None,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -158,19 +158,22 @@ pub(crate) fn profile(
|
|||||||
control: &dyn gpapi::collection::CollectionControl,
|
control: &dyn gpapi::collection::CollectionControl,
|
||||||
) -> io::Result<OsProfile> {
|
) -> io::Result<OsProfile> {
|
||||||
let identity = gpapi::os_profile::desktop::identity_from_parts(
|
let identity = gpapi::os_profile::desktop::identity_from_parts(
|
||||||
hostname.unwrap_or_else(|| identity.computer().into()),
|
hostname.as_deref().unwrap_or(identity.computer()).into(),
|
||||||
host_id.unwrap_or_else(|| identity.host_id().into()),
|
host_id.as_deref().unwrap_or(identity.host_id()).into(),
|
||||||
identity.serialno().into(),
|
identity.serialno().into(),
|
||||||
identity.mac_addr().into(),
|
identity.mac_addr().into(),
|
||||||
);
|
);
|
||||||
let mut builder = OsProfileBuilder::new(os).host_identity(identity);
|
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 {
|
if let Some(version) = version {
|
||||||
builder = builder.client_version(version);
|
builder = builder.client_version(version);
|
||||||
}
|
}
|
||||||
if let Some(os_version) = os_version {
|
if let Some(os_version) = os_version {
|
||||||
builder = builder.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 {
|
fn generation_error(error: anyhow::Error) -> io::Error {
|
||||||
@@ -235,6 +238,29 @@ mod tests {
|
|||||||
assert_eq!(profile.host_identity().serialno(), "serial");
|
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]
|
#[test]
|
||||||
fn callback_errors_preserve_cancellation() {
|
fn callback_errors_preserve_cancellation() {
|
||||||
let error = generation_error(io::Error::new(io::ErrorKind::Interrupted, "cancelled").into());
|
let error = generation_error(io::Error::new(io::ErrorKind::Interrupted, "cancelled").into());
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ mod runtime_user;
|
|||||||
mod session_registry;
|
mod session_registry;
|
||||||
mod vpn_script;
|
mod vpn_script;
|
||||||
mod vpn_task;
|
mod vpn_task;
|
||||||
|
#[cfg(windows)]
|
||||||
|
mod windows_patches;
|
||||||
mod ws_connection;
|
mod ws_connection;
|
||||||
mod ws_server;
|
mod ws_server;
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ pub struct RequestDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RequestDispatcher {
|
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> {
|
pub fn subscribe_tunnel(&self) -> tokio::sync::watch::Receiver<crate::vpn_task::TunnelBinding> {
|
||||||
self.lifecycle.subscribe_tunnel()
|
self.lifecycle.subscribe_tunnel()
|
||||||
}
|
}
|
||||||
@@ -262,7 +266,9 @@ impl RequestDispatcher {
|
|||||||
| WsRequest::GetHipApprovalStatus { .. }
|
| WsRequest::GetHipApprovalStatus { .. }
|
||||||
| WsRequest::ReadHipPreviewChunk(_)
|
| WsRequest::ReadHipPreviewChunk(_)
|
||||||
| WsRequest::GetLastSubmittedHipReport
|
| WsRequest::GetLastSubmittedHipReport
|
||||||
| WsRequest::SetTunnelStatisticsEnabled { .. } => {
|
| WsRequest::SetTunnelStatisticsEnabled { .. }
|
||||||
|
| WsRequest::SetWindowsPatchInterest { .. }
|
||||||
|
| WsRequest::RefreshWindowsPatches { .. } => {
|
||||||
unreachable!("session-bound request was already dispatched")
|
unreachable!("session-bound request was already dispatched")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use gpapi::service::request::ConnectArgs;
|
use gpapi::service::request::ConnectArgs;
|
||||||
|
use gpvpnc::windows::SystemTunnel;
|
||||||
use openconnect::{Vpn, VpnBuilder};
|
use openconnect::{Vpn, VpnBuilder};
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
const RECOVERY_KEY: &str = r"SOFTWARE\GP Connect\NetworkRecovery";
|
|
||||||
|
|
||||||
pub(crate) fn recover_network() -> std::io::Result<()> {
|
pub(crate) fn recover_network() -> std::io::Result<()> {
|
||||||
gpvpnc::windows::recover(RECOVERY_KEY)
|
let _tunnel = SystemTunnel::try_acquire()?;
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow::Result<VpnBuilder> {
|
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow::Result<VpnBuilder> {
|
||||||
@@ -12,7 +12,7 @@ pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow:
|
|||||||
args.vpnc_script().is_none(),
|
args.vpnc_script().is_none(),
|
||||||
"Windows does not support custom VPN scripts"
|
"Windows does not support custom VPN scripts"
|
||||||
);
|
);
|
||||||
let network = Mutex::new(gpvpnc::windows::NetworkConfigurator::new(RECOVERY_KEY)?);
|
let network = Mutex::new(SystemTunnel::acquire()?.configurator()?);
|
||||||
Ok(
|
Ok(
|
||||||
Vpn::builder(server, cookie).network_configuration_handler(move |configuration| {
|
Vpn::builder(server, cookie).network_configuration_handler(move |configuration| {
|
||||||
network
|
network
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ mod script_tun;
|
|||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(crate) struct LifecycleHandle {
|
pub(crate) struct LifecycleHandle {
|
||||||
|
#[cfg(windows)]
|
||||||
|
pub(crate) patch_checks: Arc<crate::windows_patches::PatchChecks>,
|
||||||
events: mpsc::Sender<LifecycleEvent>,
|
events: mpsc::Sender<LifecycleEvent>,
|
||||||
admissions: Arc<Mutex<Admissions>>,
|
admissions: Arc<Mutex<Admissions>>,
|
||||||
tunnel: watch::Sender<TunnelBinding>,
|
tunnel: watch::Sender<TunnelBinding>,
|
||||||
@@ -462,6 +464,8 @@ impl VpnTask {
|
|||||||
) -> (Self, LifecycleHandle) {
|
) -> (Self, LifecycleHandle) {
|
||||||
let (events_tx, events) = mpsc::channel(4);
|
let (events_tx, events) = mpsc::channel(4);
|
||||||
let lifecycle = LifecycleHandle {
|
let lifecycle = LifecycleHandle {
|
||||||
|
#[cfg(windows)]
|
||||||
|
patch_checks: crate::windows_patches::PatchChecks::new(),
|
||||||
events: events_tx,
|
events: events_tx,
|
||||||
admissions: Arc::new(Mutex::new(Admissions::default())),
|
admissions: Arc::new(Mutex::new(Admissions::default())),
|
||||||
tunnel: watch::channel(TunnelBinding::default()).0,
|
tunnel: watch::channel(TunnelBinding::default()).0,
|
||||||
|
|||||||
@@ -66,10 +66,13 @@ pub(super) async fn run(
|
|||||||
md5: request.md5.clone(),
|
md5: request.md5.clone(),
|
||||||
};
|
};
|
||||||
if !posture_enabled {
|
if !posture_enabled {
|
||||||
return gphip::generate_identity_report(&gphip::ReportInput {
|
return gphip::generate_identity_report(
|
||||||
|
&gphip::ReportInput {
|
||||||
profile: profile.clone(),
|
profile: profile.clone(),
|
||||||
context,
|
context,
|
||||||
})
|
},
|
||||||
|
control,
|
||||||
|
)
|
||||||
.map_err(std::io::Error::other);
|
.map_err(std::io::Error::other);
|
||||||
}
|
}
|
||||||
source.collect(
|
source.collect(
|
||||||
|
|||||||
@@ -50,6 +50,23 @@ pub(super) fn spawn(
|
|||||||
) -> JoinHandle<()> {
|
) -> JoinHandle<()> {
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let attempt = input.attempt;
|
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 failure = None;
|
||||||
let mut approval = None;
|
let mut approval = None;
|
||||||
if !cancellation.is_cancelled() {
|
if !cancellation.is_cancelled() {
|
||||||
|
|||||||
@@ -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)?)
|
||||||
|
}
|
||||||
@@ -410,6 +410,48 @@ async fn handle_client_message(
|
|||||||
return Ok(());
|
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 {
|
if let WsRequest::StoreEditedHipReportChunk(report) = request {
|
||||||
let upload_id = report.upload_id.as_deref().and_then(|id| Uuid::parse_str(id).ok());
|
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() {
|
let result = if report.upload_id.is_some() && upload_id.is_none() {
|
||||||
@@ -451,6 +493,7 @@ async fn handle_client_message(
|
|||||||
offset: chunk.offset,
|
offset: chunk.offset,
|
||||||
xml,
|
xml,
|
||||||
complete,
|
complete,
|
||||||
|
windows_updates: None,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "HIP preview is unavailable"));
|
.unwrap_or_else(|| ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "HIP preview is unavailable"));
|
||||||
@@ -467,6 +510,7 @@ async fn handle_client_message(
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
xml,
|
xml,
|
||||||
complete,
|
complete,
|
||||||
|
windows_updates: None,
|
||||||
},
|
},
|
||||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::Internal, "Submitted HIP report is unavailable"),
|
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 {
|
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 edited_report = if let HipSource::Edited { report_id } = &preview.source {
|
||||||
let report_id = match Uuid::parse_str(report_id) {
|
let report_id = match Uuid::parse_str(report_id) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ pub(crate) struct WsServerContext {
|
|||||||
state: Mutex<ServiceState>,
|
state: Mutex<ServiceState>,
|
||||||
handshake_slots: Arc<Semaphore>,
|
handshake_slots: Arc<Semaphore>,
|
||||||
pub(crate) hip_previews: crate::hip_preview::HipPreviews,
|
pub(crate) hip_previews: crate::hip_preview::HipPreviews,
|
||||||
|
#[cfg(windows)]
|
||||||
|
pub(crate) patch_checks: Arc<crate::windows_patches::PatchChecks>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WsServerContext {
|
impl WsServerContext {
|
||||||
@@ -75,6 +77,8 @@ impl WsServerContext {
|
|||||||
Self {
|
Self {
|
||||||
product_version,
|
product_version,
|
||||||
registry,
|
registry,
|
||||||
|
#[cfg(windows)]
|
||||||
|
patch_checks: dispatcher.patch_checks(),
|
||||||
dispatcher,
|
dispatcher,
|
||||||
state: Mutex::new(ServiceState {
|
state: Mutex::new(ServiceState {
|
||||||
revision: 0,
|
revision: 0,
|
||||||
@@ -183,6 +187,8 @@ impl WsServerContext {
|
|||||||
|
|
||||||
pub async fn remove_connection(&self, connection_id: Uuid, session_id: Uuid, generation: u64) {
|
pub async fn remove_connection(&self, connection_id: Uuid, session_id: Uuid, generation: u64) {
|
||||||
self.registry.disconnect_if_current(session_id, generation);
|
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;
|
let mut state = self.state.lock().await;
|
||||||
state.connections.remove(&connection_id);
|
state.connections.remove(&connection_id);
|
||||||
state.refresh_demand();
|
state.refresh_demand();
|
||||||
@@ -364,6 +370,12 @@ impl WsServer {
|
|||||||
};
|
};
|
||||||
let _ = ready_tx.send(());
|
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! {
|
tokio::select! {
|
||||||
_ = watch_vpn_state(self.vpn_state_rx.clone(), Arc::clone(&self.ctx)) => {
|
_ = watch_vpn_state(self.vpn_state_rx.clone(), Arc::clone(&self.ctx)) => {
|
||||||
info!("VPN state watch task completed");
|
info!("VPN state watch task completed");
|
||||||
@@ -378,6 +390,9 @@ impl WsServer {
|
|||||||
info!("WS server cancelled");
|
info!("WS server cancelled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.cancel_token.cancel();
|
||||||
|
#[cfg(windows)]
|
||||||
|
let _ = patch_task.await;
|
||||||
self.ctx.hip_previews.shutdown().await;
|
self.ctx.hip_previews.shutdown().await;
|
||||||
let _ = shutdown_tx.send(()).await;
|
let _ = shutdown_tx.send(()).await;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,27 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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
|
## 3.4.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -102,10 +102,11 @@ tempfile.workspace = true
|
|||||||
uzers = { workspace = true, optional = true }
|
uzers = { workspace = true, optional = true }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[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.
|
# Child webviews let the Windows host own layout beside native controls.
|
||||||
tauri = { workspace = true, optional = true, features = ["unstable"] }
|
tauri = { workspace = true, optional = true, features = ["unstable"] }
|
||||||
webview2-com = { version = "0.39", optional = true }
|
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"] }
|
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"
|
dunce = "1"
|
||||||
winreg = "0.55"
|
winreg = "0.56"
|
||||||
common = { path = "../common" }
|
common = { path = "../common" }
|
||||||
@@ -1,15 +1,19 @@
|
|||||||
//! Per-user Windows named pipe for browser authentication callbacks.
|
//! Per-user Windows named pipe for browser authentication callbacks.
|
||||||
use anyhow::{Context, bail};
|
use anyhow::{Context, bail};
|
||||||
use gpapi::{auth::SamlAuthData, error::AuthDataParseError};
|
use gpapi::{auth::SamlAuthData, error::AuthDataParseError};
|
||||||
|
use std::{io, os::windows::io::AsRawHandle};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{AsyncReadExt, AsyncWriteExt},
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
net::windows::named_pipe::{ClientOptions, NamedPipeServer},
|
net::windows::named_pipe::{ClientOptions, NamedPipeClient, NamedPipeServer},
|
||||||
time::timeout,
|
time::timeout,
|
||||||
};
|
};
|
||||||
#[path = "protocol.rs"]
|
#[path = "protocol.rs"]
|
||||||
mod protocol;
|
mod protocol;
|
||||||
pub use protocol::validate_auth_callback;
|
pub use protocol::validate_auth_callback;
|
||||||
use protocol::*;
|
use protocol::*;
|
||||||
|
use windows_sys::Win32::{
|
||||||
|
System::Pipes::GetNamedPipeServerProcessId, UI::WindowsAndMessaging::AllowSetForegroundWindow,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct AuthCallbackReceiver {
|
pub struct AuthCallbackReceiver {
|
||||||
listener: NamedPipeServer,
|
listener: NamedPipeServer,
|
||||||
@@ -52,6 +56,9 @@ impl AuthCallbackReceiver {
|
|||||||
let _ = timeout(IO_TIMEOUT, stream.read_u8()).await;
|
let _ = timeout(IO_TIMEOUT, stream.read_u8()).await;
|
||||||
self.listener.disconnect()?;
|
self.listener.disconnect()?;
|
||||||
if let Some(result) = result {
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,6 +83,12 @@ pub async fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
|
|||||||
stream.write_all(callback.as_bytes()).await?;
|
stream.write_all(callback.as_bytes()).await?;
|
||||||
let version = stream.read_u8().await?;
|
let version = stream.read_u8().await?;
|
||||||
let status = 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?;
|
stream.write_u8(status).await?;
|
||||||
anyhow::ensure!(
|
anyhow::ensure!(
|
||||||
version == PROTOCOL_VERSION,
|
version == PROTOCOL_VERSION,
|
||||||
@@ -91,6 +104,32 @@ pub async fn forward_auth_callback(callback: &str) -> anyhow::Result<()> {
|
|||||||
.context("Timed out forwarding the authentication callback")?
|
.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<()> {
|
pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
|
||||||
use winreg::{RegKey, enums::HKEY_CURRENT_USER};
|
use winreg::{RegKey, enums::HKEY_CURRENT_USER};
|
||||||
let executable = common::binary_paths::gpauth();
|
let executable = common::binary_paths::gpauth();
|
||||||
@@ -99,6 +138,8 @@ pub fn ensure_auth_callback_handler() -> anyhow::Result<()> {
|
|||||||
let (scheme, _) = root.create_subkey(r"Software\Classes\globalprotectcallback")?;
|
let (scheme, _) = root.create_subkey(r"Software\Classes\globalprotectcallback")?;
|
||||||
scheme.set_value("", &"URL:GlobalProtect authentication callback")?;
|
scheme.set_value("", &"URL:GlobalProtect authentication callback")?;
|
||||||
scheme.set_value("URL Protocol", &"")?;
|
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")?;
|
let (command, _) = scheme.create_subkey(r"shell\open\command")?;
|
||||||
// URL association activation requires a shell path, not Rust's verbatim
|
// URL association activation requires a shell path, not Rust's verbatim
|
||||||
// canonical path (\\?\C:\...), even though CreateProcess accepts both.
|
// canonical path (\\?\C:\...), even though CreateProcess accepts both.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ impl RecoveryStatus {
|
|||||||
Self::Hidden => "",
|
Self::Hidden => "",
|
||||||
Self::Restarting => "Restarting sign-in…",
|
Self::Restarting => "Restarting sign-in…",
|
||||||
Self::Loading => "Loading 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::Rejected => "Sign-in wasn’t completed.",
|
||||||
Self::Tls {
|
Self::Tls {
|
||||||
reason: TlsFailureReason::Handshake,
|
reason: TlsFailureReason::Handshake,
|
||||||
@@ -55,6 +55,7 @@ impl RecoveryStatus {
|
|||||||
matches!(self, Self::Hidden | Self::Loading | Self::CertificateBypassed)
|
matches!(self, Self::Hidden | Self::Loading | Self::CertificateBypassed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
pub fn is_busy(self) -> bool {
|
pub fn is_busy(self) -> bool {
|
||||||
matches!(self, Self::Restarting | Self::Loading)
|
matches!(self, Self::Restarting | Self::Loading)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub(super) enum TlsFailureReason {
|
pub(super) enum TlsFailureReason {
|
||||||
Expired,
|
Expired,
|
||||||
|
#[cfg(not(windows))]
|
||||||
NotYetValid,
|
NotYetValid,
|
||||||
|
#[cfg(not(windows))]
|
||||||
Untrusted,
|
Untrusted,
|
||||||
HostnameMismatch,
|
HostnameMismatch,
|
||||||
InvalidCertificate,
|
InvalidCertificate,
|
||||||
@@ -17,7 +19,9 @@ impl TlsFailureReason {
|
|||||||
pub fn message(self) -> &'static str {
|
pub fn message(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::Expired => "The certificate has expired.",
|
Self::Expired => "The certificate has expired.",
|
||||||
|
#[cfg(not(windows))]
|
||||||
Self::NotYetValid => "The certificate is not valid yet.",
|
Self::NotYetValid => "The certificate is not valid yet.",
|
||||||
|
#[cfg(not(windows))]
|
||||||
Self::Untrusted => "The certificate was issued by an untrusted authority.",
|
Self::Untrusted => "The certificate was issued by an untrusted authority.",
|
||||||
Self::HostnameMismatch => "The certificate does not match this server’s hostname.",
|
Self::HostnameMismatch => "The certificate does not match this server’s hostname.",
|
||||||
Self::InvalidCertificate => "The server’s certificate could not be verified.",
|
Self::InvalidCertificate => "The server’s certificate could not be verified.",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const SUBCLASS: usize = 0x47504155;
|
|||||||
const ADDRESS_SUBCLASS: usize = 0x47504156;
|
const ADDRESS_SUBCLASS: usize = 0x47504156;
|
||||||
const ADDRESS_HEIGHT: i32 = 24;
|
const ADDRESS_HEIGHT: i32 = 24;
|
||||||
const TOOLBAR_HEIGHT: i32 = 34;
|
const TOOLBAR_HEIGHT: i32 = 34;
|
||||||
|
const RECOVERY_PADDING: i32 = 4;
|
||||||
const RETRY: usize = 101;
|
const RETRY: usize = 101;
|
||||||
const PROCEED: usize = 102;
|
const PROCEED: usize = 102;
|
||||||
const CANCEL: usize = 103;
|
const CANCEL: usize = 103;
|
||||||
@@ -31,6 +32,7 @@ pub(super) struct Controls {
|
|||||||
proceed: HWND,
|
proceed: HWND,
|
||||||
cancel: HWND,
|
cancel: HWND,
|
||||||
status: Cell<RecoveryStatus>,
|
status: Cell<RecoveryStatus>,
|
||||||
|
recovery_bounds: Cell<RECT>,
|
||||||
font: Cell<Option<(u32, HFONT)>>,
|
font: Cell<Option<(u32, HFONT)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +77,7 @@ impl Controls {
|
|||||||
proceed: child(w!("BUTTON"), "Continue Anyway…", WS_TABSTOP, PROCEED)?,
|
proceed: child(w!("BUTTON"), "Continue Anyway…", WS_TABSTOP, PROCEED)?,
|
||||||
cancel: child(w!("BUTTON"), "Cancel", WS_TABSTOP, CANCEL)?,
|
cancel: child(w!("BUTTON"), "Cancel", WS_TABSTOP, CANCEL)?,
|
||||||
status: Cell::new(RecoveryStatus::Hidden),
|
status: Cell::new(RecoveryStatus::Hidden),
|
||||||
|
recovery_bounds: Cell::new(RECT::default()),
|
||||||
font: Cell::new(None),
|
font: Cell::new(None),
|
||||||
};
|
};
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -186,33 +189,63 @@ impl Controls {
|
|||||||
Some(LPARAM(&text as *const _ as isize)),
|
Some(LPARAM(&text as *const _ as isize)),
|
||||||
);
|
);
|
||||||
let status = self.status.get();
|
let status = self.status.get();
|
||||||
let header = if status == RecoveryStatus::Hidden {
|
let buttons = [
|
||||||
TOOLBAR_HEIGHT
|
|
||||||
} else {
|
|
||||||
TOOLBAR_HEIGHT + 68
|
|
||||||
};
|
|
||||||
MoveWindow(
|
|
||||||
self.message,
|
|
||||||
px(8),
|
|
||||||
px(TOOLBAR_HEIGHT + 2),
|
|
||||||
(width - px(16)).max(0),
|
|
||||||
px(38),
|
|
||||||
true,
|
|
||||||
)?;
|
|
||||||
let mut right = width - px(8);
|
|
||||||
for (hwnd, visible, size) in [
|
|
||||||
(self.cancel, status.blocks_page(), 70),
|
(self.cancel, status.blocks_page(), 70),
|
||||||
(self.proceed, status.can_continue(), 136),
|
(self.proceed, status.can_continue(), 136),
|
||||||
(self.retry, status.can_retry(), 84),
|
(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 {
|
if visible {
|
||||||
right -= px(size);
|
right -= px(size);
|
||||||
MoveWindow(hwnd, right, px(TOOLBAR_HEIGHT + 38), px(size), px(28), true)?;
|
MoveWindow(hwnd, right, px(button_top), px(size), px(28), true)?;
|
||||||
right -= px(6);
|
right -= px(6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let content_height = (bounds.bottom - px(header)).max(0);
|
let content_height = (bounds.bottom - header_height).max(0);
|
||||||
MoveWindow(self.webview_host, 0, px(header), width, content_height, true)?;
|
MoveWindow(self.webview_host, 0, header_height, width, content_height, true)?;
|
||||||
state.controller.SetBounds(RECT {
|
state.controller.SetBounds(RECT {
|
||||||
left: 0,
|
left: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
@@ -291,12 +324,36 @@ unsafe extern "system" fn window_proc(
|
|||||||
key: usize,
|
key: usize,
|
||||||
) -> LRESULT {
|
) -> LRESULT {
|
||||||
let state = STATES.with_borrow(|states| states.get(&key).cloned());
|
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.
|
// Paint the native toolbar and recovery surface outside the child webview.
|
||||||
if msg == WM_ERASEBKGND {
|
if msg == WM_ERASEBKGND {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut bounds = RECT::default();
|
let mut bounds = RECT::default();
|
||||||
if GetClientRect(hwnd, &mut bounds).is_ok() {
|
if GetClientRect(hwnd, &mut bounds).is_ok() {
|
||||||
FillRect(HDC(wparam.0 as *mut _), &bounds, GetSysColorBrush(COLOR_WINDOW));
|
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);
|
return LRESULT(1);
|
||||||
|
|||||||
@@ -10,13 +10,17 @@ license = "MIT"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
open = { version = "5", optional = true }
|
|
||||||
webbrowser = { version = "1", optional = true }
|
webbrowser = { version = "1", optional = true }
|
||||||
which = { workspace = true, optional = true }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
launcher = ["dep:open", "dep:webbrowser", "dep:which", "dep:winreg"]
|
launcher = ["dep:open", "dep:webbrowser", "dep:which", "dep:winreg"]
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winreg = { version = "0.55", optional = true }
|
winreg = { version = "0.56", optional = true }
|
||||||
|
|
||||||
|
[target.'cfg(unix)'.dependencies]
|
||||||
|
open = { version = "5", optional = true }
|
||||||
|
|
||||||
|
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
|
||||||
|
which = { workspace = true, optional = true }
|
||||||
@@ -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]"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
-6
@@ -6,6 +6,7 @@ edition.workspace = true
|
|||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
gp-xml = { path = "../gp-xml" }
|
||||||
common = { path = "../common" }
|
common = { path = "../common" }
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
base64.workspace = true
|
base64.workspace = true
|
||||||
@@ -46,6 +47,9 @@ snow.workspace = true
|
|||||||
zeroize = { workspace = true, features = ["serde"] }
|
zeroize = { workspace = true, features = ["serde"] }
|
||||||
getrandom = "0.4"
|
getrandom = "0.4"
|
||||||
|
|
||||||
|
# Used only by the opt-in certificate interoperability tests.
|
||||||
|
openssl = { workspace = true, optional = true }
|
||||||
|
|
||||||
# Optional dependencies for features
|
# Optional dependencies for features
|
||||||
tauri = { workspace = true, optional = true }
|
tauri = { workspace = true, optional = true }
|
||||||
clap = { workspace = true, optional = true }
|
clap = { workspace = true, optional = true }
|
||||||
@@ -61,8 +65,10 @@ oslog = { version = "0.2", default-features = false, optional = true }
|
|||||||
[target.'cfg(not(any(target_os="macos", target_os="windows")))'.dependencies]
|
[target.'cfg(not(any(target_os="macos", target_os="windows")))'.dependencies]
|
||||||
gtk = { version = "0.18", optional = true }
|
gtk = { version = "0.18", optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os="linux")'.dependencies]
|
[target.'cfg(any(target_os="linux", target_os="freebsd", target_os="openbsd"))'.dependencies]
|
||||||
directories = { workspace = true, optional = true }
|
directories = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
[target.'cfg(target_os="linux")'.dependencies]
|
||||||
libloading = { version = "0.9", optional = true }
|
libloading = { version = "0.9", optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os="macos")'.dependencies]
|
[target.'cfg(target_os="macos")'.dependencies]
|
||||||
@@ -76,7 +82,6 @@ cc = "1"
|
|||||||
pkg-config = "0.3"
|
pkg-config = "0.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
openssl.workspace = true
|
|
||||||
libloading = "0.9"
|
libloading = "0.9"
|
||||||
proptest.workspace = true
|
proptest.workspace = true
|
||||||
tokio = { workspace = true, features = ["test-util"] }
|
tokio = { workspace = true, features = ["test-util"] }
|
||||||
@@ -87,14 +92,29 @@ desktop = ["tokio/process", "tokio/signal", "dep:directories", "dep:nix", "dep:u
|
|||||||
tauri = ["desktop", "dep:tauri", "dep:gtk", "dep:os_info"]
|
tauri = ["desktop", "dep:tauri", "dep:gtk", "dep:os_info"]
|
||||||
clap = ["desktop", "dep:clap", "dep:clap-verbosity-flag"]
|
clap = ["desktop", "dep:clap", "dep:clap-verbosity-flag"]
|
||||||
webview-auth = []
|
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]
|
[target.'cfg(unix)'.dependencies]
|
||||||
nix = { version = "0.31", features = ["fs", "signal", "process"], optional = true }
|
nix = { version = "0.31", features = ["fs", "signal", "process"], optional = true }
|
||||||
uzers = { workspace = true, optional = true }
|
uzers = { workspace = true, optional = true }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
windows-sys = { version = "0.61", features = ["Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock", "Win32_Foundation", "Win32_Security", "Win32_Security_Authorization", "Win32_Storage_FileSystem", "Win32_System_Pipes", "Win32_System_Threading", "Win32_System_Services", "Win32_Globalization", "Win32_System_Environment", "Win32_System_JobObjects", "Win32_System_IO"] }
|
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"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dev-dependencies]
|
[[test]]
|
||||||
windows-sys = { version = "0.61", features = ["Win32_UI_Shell"] }
|
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.
|
||||||
@@ -8,6 +8,13 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::credential::AuthCookieCredential;
|
use crate::credential::AuthCookieCredential;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
#[path = "cookie_store/unix.rs"]
|
||||||
|
mod platform;
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[path = "cookie_store/windows.rs"]
|
||||||
|
mod platform;
|
||||||
|
|
||||||
const STORE_VERSION: u32 = 1;
|
const STORE_VERSION: u32 = 1;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
@@ -45,16 +52,15 @@ impl StoredCookie {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cookie_path(custom: Option<&str>) -> PathBuf {
|
pub fn cookie_path(custom: Option<&str>) -> Option<PathBuf> {
|
||||||
if let Some(p) = custom {
|
match custom {
|
||||||
return PathBuf::from(p);
|
Some(path) => Some(PathBuf::from(path)),
|
||||||
|
None => platform::default_path(),
|
||||||
}
|
}
|
||||||
let home = std::env::var("HOME").unwrap_or_else(|_| "/root".to_string());
|
|
||||||
PathBuf::from(home).join(".config/gpclient/cookie.json")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(path: &Path, server: &str, host_id: &str) -> Option<StoredCookie> {
|
pub fn load(path: &Path, server: &str, host_id: &str) -> Option<StoredCookie> {
|
||||||
let bytes = fs::read(path).ok()?;
|
let bytes = zeroize::Zeroizing::new(platform::decode(fs::read(path).ok()?).ok()?);
|
||||||
let stored: StoredCookie = serde_json::from_slice(&bytes).ok()?;
|
let stored: StoredCookie = serde_json::from_slice(&bytes).ok()?;
|
||||||
if stored.version != STORE_VERSION || stored.server != server || stored.host_id != host_id {
|
if stored.version != STORE_VERSION || stored.server != server || stored.host_id != host_id {
|
||||||
return None;
|
return None;
|
||||||
@@ -67,12 +73,12 @@ pub fn save(path: &Path, stored: &StoredCookie) -> anyhow::Result<()> {
|
|||||||
.parent()
|
.parent()
|
||||||
.ok_or_else(|| anyhow::anyhow!("cookie path has no parent directory"))?;
|
.ok_or_else(|| anyhow::anyhow!("cookie path has no parent directory"))?;
|
||||||
fs::create_dir_all(parent)?;
|
fs::create_dir_all(parent)?;
|
||||||
set_private_dir_permissions(parent)?;
|
platform::prepare_directory(parent)?;
|
||||||
|
|
||||||
let mut tmp = tempfile::NamedTempFile::new_in(parent)?;
|
let mut tmp = tempfile::NamedTempFile::new_in(parent)?;
|
||||||
tmp.write_all(&serde_json::to_vec(stored)?)?;
|
tmp.write_all(&platform::encode(serde_json::to_vec(stored)?)?)?;
|
||||||
tmp.flush()?;
|
tmp.flush()?;
|
||||||
set_private_file_permissions(tmp.path())?;
|
platform::prepare_file(tmp.path())?;
|
||||||
tmp.persist(path)?;
|
tmp.persist(path)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -81,60 +87,6 @@ pub fn clear(path: &Path) {
|
|||||||
let _ = fs::remove_file(path);
|
let _ = fs::remove_file(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
use permissions::{set_private_dir_permissions, set_private_file_permissions};
|
|
||||||
|
|
||||||
mod permissions {
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
mod unix {
|
|
||||||
use std::{fs, os::unix::fs::PermissionsExt, path::Path};
|
|
||||||
|
|
||||||
pub(super) fn set_private_dir(path: &Path) -> anyhow::Result<()> {
|
|
||||||
fs::set_permissions(path, fs::Permissions::from_mode(0o700))?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn set_private_file(path: &Path) -> anyhow::Result<()> {
|
|
||||||
fs::set_permissions(path, fs::Permissions::from_mode(0o600))?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
pub(super) fn file_mode(path: &Path) -> Option<u32> {
|
|
||||||
Some(fs::metadata(path).ok()?.permissions().mode() & 0o777)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn set_private_dir_permissions(path: &Path) -> anyhow::Result<()> {
|
|
||||||
#[cfg(unix)]
|
|
||||||
unix::set_private_dir(path)?;
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
let _ = path;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn set_private_file_permissions(path: &Path) -> anyhow::Result<()> {
|
|
||||||
#[cfg(unix)]
|
|
||||||
unix::set_private_file(path)?;
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
let _ = path;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
pub(super) fn file_mode(path: &Path) -> Option<u32> {
|
|
||||||
#[cfg(unix)]
|
|
||||||
return unix::file_mode(path);
|
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
{
|
|
||||||
let _ = path;
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@@ -149,6 +101,24 @@ mod tests {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[test]
|
||||||
|
fn windows_cookie_cache_uses_profile_storage_and_protects_credentials() {
|
||||||
|
let default_path = cookie_path(None).unwrap();
|
||||||
|
assert!(default_path.starts_with(PathBuf::from(std::env::var_os("LOCALAPPDATA").unwrap())));
|
||||||
|
|
||||||
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
let path = dir.path().join("cookie.json");
|
||||||
|
save(&path, &sample()).unwrap();
|
||||||
|
let bytes = fs::read(&path).unwrap();
|
||||||
|
assert!(
|
||||||
|
!bytes
|
||||||
|
.windows(b"prelogon-auth".len())
|
||||||
|
.any(|part| part == b"prelogon-auth")
|
||||||
|
);
|
||||||
|
assert!(load(&path, "vpn.example.com", "host-1").is_some());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn roundtrip_and_mode_0600() {
|
fn roundtrip_and_mode_0600() {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
@@ -156,8 +126,10 @@ mod tests {
|
|||||||
let s = sample();
|
let s = sample();
|
||||||
save(&path, &s).unwrap();
|
save(&path, &s).unwrap();
|
||||||
|
|
||||||
if let Some(mode) = permissions::file_mode(&path) {
|
#[cfg(unix)]
|
||||||
assert_eq!(mode, 0o600, "cookie file must be mode 0600, got {:o}", mode);
|
{
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600);
|
||||||
}
|
}
|
||||||
|
|
||||||
let loaded = load(&path, "vpn.example.com", "host-1").unwrap();
|
let loaded = load(&path, "vpn.example.com", "host-1").unwrap();
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
use std::{
|
||||||
|
fs, io,
|
||||||
|
os::unix::fs::PermissionsExt,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub(super) fn default_path() -> Option<PathBuf> {
|
||||||
|
let home = std::env::var("HOME").unwrap_or_else(|_| "/root".to_string());
|
||||||
|
Some(PathBuf::from(home).join(".config/gpclient/cookie.json"))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn encode(bytes: Vec<u8>) -> io::Result<Vec<u8>> {
|
||||||
|
Ok(bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) use encode as decode;
|
||||||
|
|
||||||
|
pub(super) fn prepare_directory(path: &Path) -> io::Result<()> {
|
||||||
|
fs::set_permissions(path, fs::Permissions::from_mode(0o700))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn prepare_file(path: &Path) -> io::Result<()> {
|
||||||
|
fs::set_permissions(path, fs::Permissions::from_mode(0o600))
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
use std::{
|
||||||
|
ffi::OsString,
|
||||||
|
io,
|
||||||
|
os::windows::ffi::OsStringExt,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
ptr, slice,
|
||||||
|
};
|
||||||
|
use windows_sys::Win32::{
|
||||||
|
Foundation::LocalFree,
|
||||||
|
Security::Cryptography::{CRYPT_INTEGER_BLOB, CRYPTPROTECT_UI_FORBIDDEN, CryptProtectData, CryptUnprotectData},
|
||||||
|
UI::Shell::{CSIDL_LOCAL_APPDATA, SHGetFolderPathW},
|
||||||
|
};
|
||||||
|
use zeroize::Zeroize;
|
||||||
|
|
||||||
|
pub(super) fn default_path() -> Option<PathBuf> {
|
||||||
|
let mut path = [0; 260];
|
||||||
|
let result = unsafe {
|
||||||
|
SHGetFolderPathW(
|
||||||
|
ptr::null_mut(),
|
||||||
|
CSIDL_LOCAL_APPDATA as i32,
|
||||||
|
ptr::null_mut(),
|
||||||
|
0,
|
||||||
|
path.as_mut_ptr(),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
let length = path.iter().position(|&unit| unit == 0).filter(|&length| length > 0)?;
|
||||||
|
(result >= 0).then(|| PathBuf::from(OsString::from_wide(&path[..length])).join(r"GP Connect\gpclient\cookie.bin"))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn encode(mut bytes: Vec<u8>) -> io::Result<Vec<u8>> {
|
||||||
|
let result = transform(&mut bytes, true);
|
||||||
|
bytes.zeroize();
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn decode(mut bytes: Vec<u8>) -> io::Result<Vec<u8>> {
|
||||||
|
transform(&mut bytes, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DPAPI encrypts for the current Windows user, including at custom paths.
|
||||||
|
fn transform(bytes: &mut [u8], protect: bool) -> io::Result<Vec<u8>> {
|
||||||
|
let input = CRYPT_INTEGER_BLOB {
|
||||||
|
cbData: u32::try_from(bytes.len()).map_err(io::Error::other)?,
|
||||||
|
pbData: bytes.as_mut_ptr(),
|
||||||
|
};
|
||||||
|
let mut output = CRYPT_INTEGER_BLOB::default();
|
||||||
|
let success = unsafe {
|
||||||
|
if protect {
|
||||||
|
CryptProtectData(
|
||||||
|
&input,
|
||||||
|
ptr::null(),
|
||||||
|
ptr::null(),
|
||||||
|
ptr::null(),
|
||||||
|
ptr::null(),
|
||||||
|
CRYPTPROTECT_UI_FORBIDDEN,
|
||||||
|
&mut output,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
CryptUnprotectData(
|
||||||
|
&input,
|
||||||
|
ptr::null_mut(),
|
||||||
|
ptr::null(),
|
||||||
|
ptr::null(),
|
||||||
|
ptr::null(),
|
||||||
|
CRYPTPROTECT_UI_FORBIDDEN,
|
||||||
|
&mut output,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if success == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
if output.pbData.is_null() {
|
||||||
|
return Err(io::Error::other("Windows returned no cookie cache data"));
|
||||||
|
}
|
||||||
|
let buffer = unsafe { slice::from_raw_parts_mut(output.pbData, output.cbData as usize) };
|
||||||
|
let result = buffer.to_vec();
|
||||||
|
buffer.zeroize();
|
||||||
|
unsafe { LocalFree(output.pbData.cast()) };
|
||||||
|
Ok(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn prepare_directory(_: &Path) -> io::Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) use prepare_directory as prepare_file;
|
||||||
@@ -109,6 +109,7 @@ fn classify_with_identity(error: &(dyn Error + 'static), has_client_identity: bo
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
use openssl::{
|
use openssl::{
|
||||||
asn1::Asn1Time,
|
asn1::Asn1Time,
|
||||||
hash::MessageDigest,
|
hash::MessageDigest,
|
||||||
@@ -180,10 +181,12 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
fn server(tls: bool) -> (String, thread::JoinHandle<()>) {
|
fn server(tls: bool) -> (String, thread::JoinHandle<()>) {
|
||||||
server_with_client_auth(tls, SslVerifyMode::NONE)
|
server_with_client_auth(tls, SslVerifyMode::NONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
fn server_with_client_auth(tls: bool, verify: SslVerifyMode) -> (String, thread::JoinHandle<()>) {
|
fn server_with_client_auth(tls: bool, verify: SslVerifyMode) -> (String, thread::JoinHandle<()>) {
|
||||||
let key = PKey::from_rsa(Rsa::generate(2048).unwrap()).unwrap();
|
let key = PKey::from_rsa(Rsa::generate(2048).unwrap()).unwrap();
|
||||||
let mut name = X509NameBuilder::new().unwrap();
|
let mut name = X509NameBuilder::new().unwrap();
|
||||||
@@ -233,6 +236,7 @@ mod tests {
|
|||||||
(address, worker)
|
(address, worker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn prelogin_returns_typed_certificate_failure_with_only_the_server_origin() {
|
async fn prelogin_returns_typed_certificate_failure_with_only_the_server_origin() {
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -254,6 +258,7 @@ mod tests {
|
|||||||
assert_eq!(tls.server, address);
|
assert_eq!(tls.server, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn certificate_bypass_allows_prelogin() {
|
async fn certificate_bypass_allows_prelogin() {
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -270,6 +275,7 @@ mod tests {
|
|||||||
assert!(matches!(result.unwrap(), crate::portal::Prelogin::Saml(_)));
|
assert!(matches!(result.unwrap(), crate::portal::Prelogin::Saml(_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn incompatible_tls_is_not_a_certificate_error_even_with_bypass() {
|
async fn incompatible_tls_is_not_a_certificate_error_even_with_bypass() {
|
||||||
let (address, worker) = server(false);
|
let (address, worker) = server(false);
|
||||||
@@ -303,7 +309,7 @@ mod tests {
|
|||||||
assert_eq!(classify(&error), None);
|
assert_eq!(classify(&error), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(all(feature = "desktop", unix))]
|
||||||
#[test]
|
#[test]
|
||||||
fn rendering_recovery_retains_client_certificate_requirement() {
|
fn rendering_recovery_retains_client_certificate_requirement() {
|
||||||
use crate::process::rendering_recovery::{RecoveryState, RenderingCrash};
|
use crate::process::rendering_recovery::{RecoveryState, RenderingCrash};
|
||||||
@@ -330,6 +336,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn required_client_certificate_is_not_bypassed_by_ignoring_server_trust() {
|
async fn required_client_certificate_is_not_bypassed_by_ignoring_server_trust() {
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -371,6 +378,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn prelogin_explains_peer_rejection_of_an_already_configured_identity() {
|
async fn prelogin_explains_peer_rejection_of_an_already_configured_identity() {
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -403,6 +411,7 @@ mod tests {
|
|||||||
assert!(!error.to_string().contains("passphrase"));
|
assert!(!error.to_string().contains("passphrase"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn prelogin_accepts_a_valid_identity_and_an_optional_certificate_request() {
|
async fn prelogin_accepts_a_valid_identity_and_an_optional_certificate_request() {
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -435,6 +444,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn imported_identity_formats_complete_mutual_tls_prelogin() {
|
async fn imported_identity_formats_complete_mutual_tls_prelogin() {
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ async fn receive_gateway_login(
|
|||||||
let url = res.url().clone();
|
let url = res.url().clone();
|
||||||
let http_version = res.version();
|
let http_version = res.version();
|
||||||
let content_type = res.headers().get(reqwest::header::CONTENT_TYPE).cloned();
|
let content_type = res.headers().get(reqwest::header::CONTENT_TYPE).cloned();
|
||||||
let res = parse_gp_response(res).await.map_err(|err| {
|
let res = parse_gp_response(res).await.map_err(|mut err| {
|
||||||
// Redirect paths and query strings can contain authentication tokens. Log
|
// Redirect paths and query strings can contain authentication tokens. Log
|
||||||
// only the redacted origin and whether the response is from the login path.
|
// only the redacted origin and whether the response is from the login path.
|
||||||
warn!(
|
warn!(
|
||||||
@@ -221,6 +221,9 @@ async fn receive_gateway_login(
|
|||||||
if let Some(tls) = crate::error::ServerTlsError::from_request(origin, &err, gp_params.has_client_identity()) {
|
if let Some(tls) = crate::error::ServerTlsError::from_request(origin, &err, gp_params.has_client_identity()) {
|
||||||
return tls;
|
return tls;
|
||||||
}
|
}
|
||||||
|
if let Some(error) = err.take_body_read_error() {
|
||||||
|
return PortalError::NetworkError(error).into();
|
||||||
|
}
|
||||||
if gp_params.os_profile().client_os() == crate::os_profile::ClientOs::Ios && err.is_authentication_rejection() {
|
if gp_params.os_profile().client_os() == crate::os_profile::ClientOs::Ios && err.is_authentication_rejection() {
|
||||||
return anyhow::anyhow!(crate::error::AuthenticationRejected);
|
return anyhow::anyhow!(crate::error::AuthenticationRejected);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ pub async fn extend_session(ctx: &SessionContext) -> anyhow::Result<()> {
|
|||||||
let response = client.post(&url).form(&form).send().await?;
|
let response = client.post(&url).form(&form).send().await?;
|
||||||
let response = parse_gp_response(response).await?;
|
let response = parse_gp_response(response).await?;
|
||||||
let root = Element::parse(response.as_bytes())?;
|
let root = Element::parse(response.as_bytes())?;
|
||||||
let status = parse_extend_session_status(&root, &response)?;
|
let status = parse_extend_session_status(&root)?;
|
||||||
|
|
||||||
info!("Extend-session gateway response status: {}", status);
|
info!("Extend-session gateway response status: {}", status);
|
||||||
|
|
||||||
@@ -151,11 +151,11 @@ fn build_extend_session_form(ctx: &SessionContext) -> anyhow::Result<HashMap<Str
|
|||||||
Ok(form)
|
Ok(form)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_extend_session_status(root: &Element, response: &str) -> anyhow::Result<String> {
|
fn parse_extend_session_status(root: &Element) -> anyhow::Result<String> {
|
||||||
match root.attr("status") {
|
match root.attr("status") {
|
||||||
Some(status) => Ok(status.to_string()),
|
Some(status) => Ok(status.to_string()),
|
||||||
None => {
|
None => {
|
||||||
warn!("Malformed extend-session response body: {}", response.trim());
|
warn!("Extend-session response is missing status");
|
||||||
bail!("Malformed extend session response")
|
bail!("Malformed extend session response")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,10 +231,7 @@ mod tests {
|
|||||||
fn parses_extend_session_status_attribute() {
|
fn parses_extend_session_status_attribute() {
|
||||||
let root = Element::parse(r#"<response status="success"></response>"#.as_bytes()).unwrap();
|
let root = Element::parse(r#"<response status="success"></response>"#.as_bytes()).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(parse_extend_session_status(&root).unwrap(), "success");
|
||||||
parse_extend_session_status(&root, r#"<response status="success"></response>"#).unwrap(),
|
|
||||||
"success"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -242,9 +239,7 @@ mod tests {
|
|||||||
let root = Element::parse("<response><result>ok</result></response>".as_bytes()).unwrap();
|
let root = Element::parse("<response><result>ok</result></response>".as_bytes()).unwrap();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_extend_session_status(&root, "<response><result>ok</result></response>")
|
parse_extend_session_status(&root).unwrap_err().to_string(),
|
||||||
.unwrap_err()
|
|
||||||
.to_string(),
|
|
||||||
"Malformed extend session response"
|
"Malformed extend session response"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+40
-6
@@ -70,17 +70,17 @@ impl GuiVariant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||||
fn preference_path() -> anyhow::Result<PathBuf> {
|
fn preference_path(name: &str) -> anyhow::Result<PathBuf> {
|
||||||
let dirs = directories::ProjectDirs::from("com.yuezk", "GlobalProtect-openconnect", "gpclient")
|
let dirs = directories::ProjectDirs::from("com.yuezk", "GlobalProtect-openconnect", "gpclient")
|
||||||
.ok_or_else(|| anyhow::anyhow!("Failed to locate GUI preference directory"))?;
|
.ok_or_else(|| anyhow::anyhow!("Failed to locate GUI preference directory"))?;
|
||||||
Ok(dirs.config_dir().join("gui"))
|
Ok(dirs.config_dir().join(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn preferred() -> anyhow::Result<GuiVariant> {
|
pub fn preferred() -> anyhow::Result<GuiVariant> {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
match std::fs::read_to_string(preference_path()?) {
|
match std::fs::read_to_string(preference_path("gui")?) {
|
||||||
Ok(value) => match value.trim() {
|
Ok(value) => match value.trim() {
|
||||||
"gpgui" => Ok(GuiVariant::Tauri),
|
"gpgui" => Ok(GuiVariant::Tauri),
|
||||||
"gpgui-nsh" => Ok(GuiVariant::Nsh),
|
"gpgui-nsh" => Ok(GuiVariant::Nsh),
|
||||||
@@ -96,12 +96,46 @@ pub fn preferred() -> anyhow::Result<GuiVariant> {
|
|||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub fn save_preference(variant: GuiVariant) -> anyhow::Result<()> {
|
pub fn save_preference(variant: GuiVariant) -> anyhow::Result<()> {
|
||||||
|
save_launch_preference("gui", variant.binary_name())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const COMPATIBILITY_GRAPHICS_SUPPORTED: bool =
|
||||||
|
cfg!(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"));
|
||||||
|
|
||||||
|
pub const FORCE_SHARED_MEMORY: &str = "WEBKIT_DMABUF_RENDERER_FORCE_SHM";
|
||||||
|
|
||||||
|
const COMPATIBILITY_GRAPHICS: &str = "compatibility-graphics";
|
||||||
|
|
||||||
|
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
|
||||||
|
fn preference_path(_: &str) -> anyhow::Result<PathBuf> {
|
||||||
|
anyhow::bail!("Compatibility graphics is unavailable")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn compatibility_graphics_enabled() -> bool {
|
||||||
|
COMPATIBILITY_GRAPHICS_SUPPORTED && preference_path(COMPATIBILITY_GRAPHICS).is_ok_and(|path| path.is_file())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_compatibility_graphics(enabled: bool) -> anyhow::Result<()> {
|
||||||
|
anyhow::ensure!(
|
||||||
|
COMPATIBILITY_GRAPHICS_SUPPORTED,
|
||||||
|
"Compatibility graphics is unavailable"
|
||||||
|
);
|
||||||
|
if enabled {
|
||||||
|
return save_launch_preference(COMPATIBILITY_GRAPHICS, "enabled");
|
||||||
|
}
|
||||||
|
match std::fs::remove_file(preference_path(COMPATIBILITY_GRAPHICS)?) {
|
||||||
|
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(()),
|
||||||
|
result => result.map_err(Into::into),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn save_launch_preference(name: &str, value: &str) -> anyhow::Result<()> {
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
let path = preference_path()?;
|
let path = preference_path(name)?;
|
||||||
let directory = path.parent().unwrap();
|
let directory = path.parent().unwrap();
|
||||||
std::fs::create_dir_all(directory)?;
|
std::fs::create_dir_all(directory)?;
|
||||||
let mut file = tempfile::NamedTempFile::new_in(directory)?;
|
let mut file = tempfile::NamedTempFile::new_in(directory)?;
|
||||||
writeln!(file, "{}", variant.binary_name())?;
|
writeln!(file, "{value}")?;
|
||||||
file.persist(path)?;
|
file.persist(path)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,3 +45,27 @@ mod tests {
|
|||||||
assert_eq!(serde_json::from_value::<HipSource>(json).unwrap(), source);
|
assert_eq!(serde_json::from_value::<HipSource>(json).unwrap(), source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Collection metadata for the exact XML returned by a generated preview.
|
||||||
|
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct HipReport {
|
||||||
|
pub xml: String,
|
||||||
|
pub windows_updates: Option<WindowsUpdateStatus>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct WindowsUpdateStatus {
|
||||||
|
/// Present only when this report includes a completed local patch observation.
|
||||||
|
pub checked_at: Option<u64>,
|
||||||
|
/// Time of the observed snapshot when its patch details were too large to include.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub omitted_snapshot_at: Option<u64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WindowsUpdateStatus {
|
||||||
|
pub fn refresh_cursor(&self) -> Option<u64> {
|
||||||
|
self.checked_at.or(self.omitted_snapshot_at)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,20 @@ pub const MACOS_UNIFIED_LOG_BACKEND: &str = "macos-unified";
|
|||||||
type BoxedLogger = Box<dyn Log + Send + Sync>;
|
type BoxedLogger = Box<dyn Log + Send + Sync>;
|
||||||
static LOG_HANDLE: OnceLock<ReloadHandle<log_reload::LevelFilter<BoxedLogger>>> = OnceLock::new();
|
static LOG_HANDLE: OnceLock<ReloadHandle<log_reload::LevelFilter<BoxedLogger>>> = OnceLock::new();
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
mod windows;
|
||||||
|
#[cfg(windows)]
|
||||||
|
pub use windows::init_file;
|
||||||
|
|
||||||
|
/// Keep helper diagnostics with the application's records when a file logger owns them.
|
||||||
|
pub fn diagnostic_writer() -> Box<dyn std::io::Write + Send> {
|
||||||
|
#[cfg(windows)]
|
||||||
|
if let Some(writer) = windows::diagnostic_writer() {
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
Box::new(std::io::stderr())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn init(level: Level, subsystem: &str, category: &str, log_format: LogFormat) {
|
pub fn init(level: Level, subsystem: &str, category: &str, log_format: LogFormat) {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
if log_format == LogFormat::Text && macos_unified_log_enabled() {
|
if log_format == LogFormat::Text && macos_unified_log_enabled() {
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
use file_rotate::{ContentLimit, FileRotate, compression::Compression, suffix::AppendCount};
|
||||||
|
use std::{
|
||||||
|
fs::{self, OpenOptions},
|
||||||
|
io::{self, Write},
|
||||||
|
path::Path,
|
||||||
|
sync::{Arc, Mutex, OnceLock},
|
||||||
|
};
|
||||||
|
|
||||||
|
const ROTATE_BYTES: usize = 5 * 1024 * 1024;
|
||||||
|
const ARCHIVE_COUNT: usize = 3;
|
||||||
|
static DIAGNOSTICS: OnceLock<DiagnosticWriter> = OnceLock::new();
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct DiagnosticWriter(Arc<Mutex<FileRotate<AppendCount>>>);
|
||||||
|
|
||||||
|
impl DiagnosticWriter {
|
||||||
|
fn open(path: &Path) -> io::Result<Self> {
|
||||||
|
if let Some(parent) = path.parent().filter(|parent| !parent.as_os_str().is_empty()) {
|
||||||
|
fs::create_dir_all(parent)?;
|
||||||
|
}
|
||||||
|
// FileRotate's constructor suppresses open errors, so check the destination first.
|
||||||
|
OpenOptions::new().create(true).append(true).open(path)?;
|
||||||
|
Ok(Self(Arc::new(Mutex::new(FileRotate::new(
|
||||||
|
path,
|
||||||
|
AppendCount::new(ARCHIVE_COUNT),
|
||||||
|
ContentLimit::BytesSurpassed(ROTATE_BYTES),
|
||||||
|
Compression::None,
|
||||||
|
None,
|
||||||
|
)))))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Write for DiagnosticWriter {
|
||||||
|
fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
|
||||||
|
self
|
||||||
|
.0
|
||||||
|
.lock()
|
||||||
|
.map_err(|_| io::Error::other("Log writer lock is poisoned"))?
|
||||||
|
.write(bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> io::Result<()> {
|
||||||
|
self
|
||||||
|
.0
|
||||||
|
.lock()
|
||||||
|
.map_err(|_| io::Error::other("Log writer lock is poisoned"))?
|
||||||
|
.flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init_file(path: &Path, level: log::Level) -> io::Result<()> {
|
||||||
|
let writer = DiagnosticWriter::open(path)?;
|
||||||
|
let logger = super::build_env_logger(crate::log_format::LogFormat::Text)
|
||||||
|
.target(env_logger::Target::Pipe(Box::new(writer.clone())))
|
||||||
|
.build();
|
||||||
|
DIAGNOSTICS
|
||||||
|
.set(writer)
|
||||||
|
.map_err(|_| io::Error::other("File logging is already initialized"))?;
|
||||||
|
super::init_with_logger(level, logger);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn diagnostic_writer() -> Option<Box<dyn Write + Send>> {
|
||||||
|
DIAGNOSTICS
|
||||||
|
.get()
|
||||||
|
.map(|writer| Box::new(writer.clone()) as Box<dyn Write + Send>)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn gui_and_helper_writers_share_rotation_and_keep_only_three_archives() {
|
||||||
|
let directory = tempfile::tempdir().unwrap();
|
||||||
|
let path = directory.path().join("logs/gui.log");
|
||||||
|
let mut gui = DiagnosticWriter::open(&path).unwrap();
|
||||||
|
let mut helper = gui.clone();
|
||||||
|
for marker in b'0'..=b'5' {
|
||||||
|
let writer = if marker % 2 == 0 { &mut gui } else { &mut helper };
|
||||||
|
writer.write_all(&vec![marker; ROTATE_BYTES + 1]).unwrap();
|
||||||
|
}
|
||||||
|
helper.flush().unwrap();
|
||||||
|
drop((gui, helper));
|
||||||
|
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')] {
|
||||||
|
assert_eq!(
|
||||||
|
fs::read(path.with_extension(format!("log.{suffix}"))).unwrap(),
|
||||||
|
vec![marker; ROTATE_BYTES + 1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert_eq!(fs::read_dir(path.parent().unwrap()).unwrap().count(), 4);
|
||||||
|
let mut reopened = DiagnosticWriter::open(&path).unwrap();
|
||||||
|
reopened.write_all(b"after restart\n").unwrap();
|
||||||
|
reopened.flush().unwrap();
|
||||||
|
assert_eq!(fs::read(&path).unwrap(), b"after restart\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -173,6 +173,12 @@ pub fn collect_profile_with_control(
|
|||||||
Some(identity) => identity.clone(),
|
Some(identity) => identity.clone(),
|
||||||
None => collect_with_host_id_and_control(host_id_override, control)?,
|
None => collect_with_host_id_and_control(host_id_override, control)?,
|
||||||
};
|
};
|
||||||
|
#[cfg(windows)]
|
||||||
|
let identity = if builder.client_os == ClientOs::Windows {
|
||||||
|
windows::native_profile_identity(identity, host_id_override)?
|
||||||
|
} else {
|
||||||
|
identity
|
||||||
|
};
|
||||||
let runtime_os = runtime_client_os();
|
let runtime_os = runtime_client_os();
|
||||||
// Preserve the old behavior: only probe the native version when reporting it.
|
// Preserve the old behavior: only probe the native version when reporting it.
|
||||||
let (os_version, software_version) = if builder.client_os == runtime_os {
|
let (os_version, software_version) = if builder.client_os == runtime_os {
|
||||||
@@ -181,7 +187,8 @@ pub fn collect_profile_with_control(
|
|||||||
(defaults::os_version(runtime_os), defaults::software_version(runtime_os))
|
(defaults::os_version(runtime_os), defaults::software_version(runtime_os))
|
||||||
};
|
};
|
||||||
control.check()?;
|
control.check()?;
|
||||||
Ok(builder.build(HostSnapshot {
|
// The builder may carry cached hardware identity; use the resolved profile identity.
|
||||||
|
Ok(builder.host_identity(identity.clone()).build(HostSnapshot {
|
||||||
runtime_os,
|
runtime_os,
|
||||||
identity,
|
identity,
|
||||||
os_version,
|
os_version,
|
||||||
|
|||||||
@@ -137,14 +137,24 @@ fn assert_mac(value: &str, separator: char) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn builder_delegates_default_identity_to_host_identity() {
|
fn builder_preserves_supplied_hardware_fields() {
|
||||||
let expected = collect_identity();
|
let expected = collect_identity();
|
||||||
let profile = collect_profile(
|
let profile = collect_profile(
|
||||||
OsProfileBuilder::new(runtime_client_os()).host_identity(expected.clone()),
|
OsProfileBuilder::new(runtime_client_os()).host_identity(expected.clone()),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(profile.host_identity(), &expected);
|
assert!(
|
||||||
|
profile
|
||||||
|
.host_identity()
|
||||||
|
.computer()
|
||||||
|
.eq_ignore_ascii_case(expected.computer())
|
||||||
|
);
|
||||||
|
assert_eq!(profile.host_identity().serialno(), expected.serialno());
|
||||||
|
assert_eq!(profile.host_identity().mac_addr(), expected.mac_addr());
|
||||||
|
if runtime_client_os() != ClientOs::Windows {
|
||||||
|
assert_eq!(profile.host_identity().host_id(), expected.host_id());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -178,3 +188,76 @@ fn controlled_profile_collection_propagates_cancellation_and_deadline() {
|
|||||||
let error = collect_profile_with_control(OsProfileBuilder::new(ClientOs::Linux), None, &expired).unwrap_err();
|
let error = collect_profile_with_control(OsProfileBuilder::new(ClientOs::Linux), None, &expired).unwrap_err();
|
||||||
assert_eq!(error.kind(), io::ErrorKind::TimedOut);
|
assert_eq!(error.kind(), io::ErrorKind::TimedOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[test]
|
||||||
|
fn native_windows_profile_uses_installation_id_and_emulation_keeps_its_seed() {
|
||||||
|
let identity = HostIdentity::from_parts(
|
||||||
|
"test-host".into(),
|
||||||
|
"hardware-seed".into(),
|
||||||
|
"serial".into(),
|
||||||
|
"00:11:22:33:44:55".into(),
|
||||||
|
);
|
||||||
|
let control = CollectionBudget::new(Duration::from_secs(60));
|
||||||
|
let native = collect_profile_with_control(
|
||||||
|
OsProfile::builder(ClientOs::Windows).host_identity(identity.clone()),
|
||||||
|
None,
|
||||||
|
&control,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
// Read independently through the registry CLI to check the native API's source and view.
|
||||||
|
let output = std::process::Command::new("reg")
|
||||||
|
.args([
|
||||||
|
"query",
|
||||||
|
r"HKLM\SOFTWARE\Microsoft\Cryptography",
|
||||||
|
"/v",
|
||||||
|
"MachineGuid",
|
||||||
|
"/reg:64",
|
||||||
|
])
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
assert!(output.status.success());
|
||||||
|
let text = String::from_utf8(output.stdout).unwrap();
|
||||||
|
let expected = text
|
||||||
|
.lines()
|
||||||
|
.find_map(|line| {
|
||||||
|
let mut parts = line.split_whitespace();
|
||||||
|
(parts.next()? == "MachineGuid").then(|| parts.last().unwrap())
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(native.host_id(), expected);
|
||||||
|
assert_eq!(native.host_identity().host_id(), expected);
|
||||||
|
assert!(native.computer().eq_ignore_ascii_case(&fallback_hostname()));
|
||||||
|
let with_host_id = collect_profile_with_control(
|
||||||
|
OsProfile::builder(ClientOs::Windows).host_identity(identity.clone()),
|
||||||
|
Some("explicit-host-id"),
|
||||||
|
&control,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(with_host_id.host_id(), "explicit-host-id");
|
||||||
|
assert_eq!(with_host_id.computer(), native.computer());
|
||||||
|
let overridden = collect_profile_with_control(
|
||||||
|
OsProfile::builder(ClientOs::Windows)
|
||||||
|
.host_identity(identity.clone())
|
||||||
|
.computer_name_override("Custom-Host"),
|
||||||
|
None,
|
||||||
|
&control,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(overridden.computer(), "Custom-Host");
|
||||||
|
|
||||||
|
for client_os in [ClientOs::Mac, ClientOs::Linux] {
|
||||||
|
let builder = OsProfile::builder(client_os).host_identity(identity.clone());
|
||||||
|
let expected = builder.clone().build(HostSnapshot {
|
||||||
|
runtime_os: ClientOs::Windows,
|
||||||
|
identity: identity.clone(),
|
||||||
|
os_version: String::new(),
|
||||||
|
software_version: String::new(),
|
||||||
|
});
|
||||||
|
let actual = collect_profile_with_control(builder, None, &control).unwrap();
|
||||||
|
assert_eq!(actual.host_identity(), &identity);
|
||||||
|
assert_eq!(actual.host_id(), expected.host_id());
|
||||||
|
assert_eq!(actual.serialno(), expected.serialno());
|
||||||
|
assert_eq!(actual.mac_addr(), expected.mac_addr());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
use std::process::Command;
|
use std::{io, os::windows::process::CommandExt, process::Command};
|
||||||
|
use windows_sys::Win32::System::Registry::{HKEY_LOCAL_MACHINE, RRF_RT_REG_SZ, RRF_SUBKEY_WOW6464KEY, RegGetValueW};
|
||||||
|
use windows_sys::Win32::System::SystemInformation::{ComputerNamePhysicalNetBIOS, GetComputerNameExW};
|
||||||
|
use windows_sys::Win32::System::Threading::CREATE_NO_WINDOW;
|
||||||
|
|
||||||
use super::{ClientOs, NativeHostIdentitySnapshot, fallback_hostname, primary_mac_colon, resolve_host_id};
|
use super::{ClientOs, NativeHostIdentitySnapshot, fallback_hostname, primary_mac_colon, resolve_host_id};
|
||||||
|
|
||||||
@@ -36,6 +39,7 @@ impl RuntimeNativeHostIdentity {
|
|||||||
|
|
||||||
fn collect_windows_serial_number() -> Option<String> {
|
fn collect_windows_serial_number() -> Option<String> {
|
||||||
let output = Command::new("wmic")
|
let output = Command::new("wmic")
|
||||||
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
.args(["bios", "get", "serialnumber"])
|
.args(["bios", "get", "serialnumber"])
|
||||||
.output()
|
.output()
|
||||||
.ok()?;
|
.ok()?;
|
||||||
@@ -50,11 +54,15 @@ fn collect_windows_serial_number() -> Option<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn windows_machine_seed() -> Option<String> {
|
fn windows_machine_seed() -> Option<String> {
|
||||||
collect_windows_csproduct_uuid().or_else(collect_windows_machine_guid)
|
collect_windows_csproduct_uuid().or_else(|| collect_windows_machine_guid().ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_windows_csproduct_uuid() -> Option<String> {
|
fn collect_windows_csproduct_uuid() -> Option<String> {
|
||||||
let output = Command::new("wmic").args(["csproduct", "get", "uuid"]).output().ok()?;
|
let output = Command::new("wmic")
|
||||||
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
|
.args(["csproduct", "get", "uuid"])
|
||||||
|
.output()
|
||||||
|
.ok()?;
|
||||||
let stdout = String::from_utf8(output.stdout).ok()?;
|
let stdout = String::from_utf8(output.stdout).ok()?;
|
||||||
|
|
||||||
stdout
|
stdout
|
||||||
@@ -65,24 +73,63 @@ fn collect_windows_csproduct_uuid() -> Option<String> {
|
|||||||
.next()
|
.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_windows_machine_guid() -> Option<String> {
|
// Native Windows uses the OS installation ID and physical NetBIOS name.
|
||||||
let output = Command::new("reg")
|
// Keep the hardware identity used to seed other OS profiles unchanged.
|
||||||
.args(["query", r"HKLM\SOFTWARE\Microsoft\Cryptography", "/v", "MachineGuid"])
|
pub(super) fn native_profile_identity(
|
||||||
.output()
|
identity: super::HostIdentity,
|
||||||
.ok()?;
|
host_id_override: Option<&str>,
|
||||||
if !output.status.success() {
|
) -> io::Result<super::HostIdentity> {
|
||||||
return None;
|
let host_id = match host_id_override.filter(|id| !id.trim().is_empty()) {
|
||||||
}
|
Some(id) => id.to_owned(),
|
||||||
let stdout = String::from_utf8(output.stdout).ok()?;
|
None => collect_windows_machine_guid()?,
|
||||||
|
};
|
||||||
|
Ok(super::HostIdentity::from_parts(
|
||||||
|
collect_windows_computer_name()?,
|
||||||
|
host_id,
|
||||||
|
identity.serialno().into(),
|
||||||
|
identity.mac_addr().into(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
stdout.lines().find_map(|line| {
|
fn collect_windows_computer_name() -> io::Result<String> {
|
||||||
let mut parts = line.split_whitespace();
|
let mut name = [0u16; 256];
|
||||||
if parts.next()? != "MachineGuid" {
|
let mut size = name.len() as u32;
|
||||||
return None;
|
// SAFETY: the buffer and character count describe writable UTF-16 storage.
|
||||||
|
if unsafe { GetComputerNameExW(ComputerNamePhysicalNetBIOS, name.as_mut_ptr(), &mut size) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
|
String::from_utf16(&name[..size as usize]).map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))
|
||||||
|
}
|
||||||
|
|
||||||
parts.last().map(str::to_string)
|
fn collect_windows_machine_guid() -> io::Result<String> {
|
||||||
})
|
let key: Vec<u16> = "SOFTWARE\\Microsoft\\Cryptography\0".encode_utf16().collect();
|
||||||
|
let value: Vec<u16> = "MachineGuid\0".encode_utf16().collect();
|
||||||
|
let mut buffer = [0u16; 128];
|
||||||
|
let mut size = std::mem::size_of_val(&buffer) as u32;
|
||||||
|
// SAFETY: both names are NUL-terminated; buffer and byte length describe writable storage.
|
||||||
|
let status = unsafe {
|
||||||
|
RegGetValueW(
|
||||||
|
HKEY_LOCAL_MACHINE,
|
||||||
|
key.as_ptr(),
|
||||||
|
value.as_ptr(),
|
||||||
|
RRF_RT_REG_SZ | RRF_SUBKEY_WOW6464KEY,
|
||||||
|
std::ptr::null_mut(),
|
||||||
|
buffer.as_mut_ptr().cast(),
|
||||||
|
&mut size,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
if status != 0 {
|
||||||
|
return Err(io::Error::from_raw_os_error(status as i32));
|
||||||
|
}
|
||||||
|
let end = buffer.iter().position(|value| *value == 0).unwrap_or(buffer.len());
|
||||||
|
let guid = String::from_utf16(&buffer[..end]).map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
|
||||||
|
if guid.trim().is_empty() {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::InvalidData,
|
||||||
|
"Windows MachineGuid is empty",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
Ok(guid)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RuntimeNativeHostIdentity {
|
impl RuntimeNativeHostIdentity {
|
||||||
|
|||||||
@@ -124,8 +124,7 @@ impl OsProfile {
|
|||||||
self.runtime_os == self.client_os
|
self.runtime_os == self.client_os
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default software version string for the target OS, matching the
|
/// Software version for the target OS profile.
|
||||||
/// official client values.
|
|
||||||
pub fn software_version(&self) -> &str {
|
pub fn software_version(&self) -> &str {
|
||||||
&self.software_version
|
&self.software_version
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ fn negotiated_os_version_is_used_in_profile_and_user_agent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn csc_support_defaults_match_official_profiles() {
|
fn csc_support_defaults_match_platform_profiles() {
|
||||||
assert!(!ClientOs::Linux.default_csc_support());
|
assert!(!ClientOs::Linux.default_csc_support());
|
||||||
assert!(ClientOs::Mac.default_csc_support());
|
assert!(ClientOs::Mac.default_csc_support());
|
||||||
assert!(ClientOs::Windows.default_csc_support());
|
assert!(ClientOs::Windows.default_csc_support());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn prelogin_param_location_matches_official_profiles() {
|
fn prelogin_param_location_matches_platform_profiles() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
OsProfileBuilder::new(ClientOs::Linux)
|
OsProfileBuilder::new(ClientOs::Linux)
|
||||||
.build(test_snapshot())
|
.build(test_snapshot())
|
||||||
@@ -91,7 +91,7 @@ fn embedded_gateway_default_browser_is_zero_for_all() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn external_default_browser_values_match_official_profiles() {
|
fn external_default_browser_values_match_platform_profiles() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
OsProfileBuilder::new(ClientOs::Linux)
|
OsProfileBuilder::new(ClientOs::Linux)
|
||||||
.build(test_snapshot())
|
.build(test_snapshot())
|
||||||
@@ -132,7 +132,7 @@ fn external_default_browser_values_match_official_profiles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn saml_password_matches_official_profiles() {
|
fn saml_password_matches_platform_profiles() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
OsProfileBuilder::new(ClientOs::Linux)
|
OsProfileBuilder::new(ClientOs::Linux)
|
||||||
.build(test_snapshot())
|
.build(test_snapshot())
|
||||||
@@ -173,7 +173,7 @@ fn gateway_server_uses_resolved_ipv4_for_all() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn kerberos_support_in_query_matches_official_profiles() {
|
fn kerberos_support_in_query_matches_platform_profiles() {
|
||||||
assert!(
|
assert!(
|
||||||
!OsProfileBuilder::new(ClientOs::Linux)
|
!OsProfileBuilder::new(ClientOs::Linux)
|
||||||
.build(test_snapshot())
|
.build(test_snapshot())
|
||||||
@@ -192,7 +192,7 @@ fn kerberos_support_in_query_matches_official_profiles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn os_vendor_matches_official_profiles() {
|
fn os_vendor_matches_platform_profiles() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
OsProfileBuilder::new(ClientOs::Linux)
|
OsProfileBuilder::new(ClientOs::Linux)
|
||||||
.build(test_snapshot())
|
.build(test_snapshot())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use log::{debug, info, warn};
|
use log::{info, warn};
|
||||||
use reqwest::{Client, StatusCode};
|
use reqwest::{Client, StatusCode};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use specta::Type;
|
use specta::Type;
|
||||||
@@ -207,10 +207,13 @@ pub async fn retrieve_config(
|
|||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
parse_gp_response(res).await.or_else(|err| {
|
parse_gp_response(res).await.or_else(|mut err| {
|
||||||
if let Some(tls) = ServerTlsError::from_request(&server_url, &err, gp_params.has_client_identity()) {
|
if let Some(tls) = ServerTlsError::from_request(&server_url, &err, gp_params.has_client_identity()) {
|
||||||
return Err(tls);
|
return Err(tls);
|
||||||
}
|
}
|
||||||
|
if let Some(error) = err.take_body_read_error() {
|
||||||
|
return Err(PortalError::NetworkError(error).into());
|
||||||
|
}
|
||||||
if gp_params.os_profile().client_os() == crate::os_profile::ClientOs::Ios && err.is_authentication_rejection() {
|
if gp_params.os_profile().client_os() == crate::os_profile::ClientOs::Ios && err.is_authentication_rejection() {
|
||||||
return Err(anyhow::anyhow!(crate::error::AuthenticationRejected));
|
return Err(anyhow::anyhow!(crate::error::AuthenticationRejected));
|
||||||
}
|
}
|
||||||
@@ -232,7 +235,6 @@ pub async fn retrieve_config(
|
|||||||
bail!(PortalError::ConfigError("Empty portal config response".to_string()))
|
bail!(PortalError::ConfigError("Empty portal config response".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Portal config response received: {} bytes", res_xml.len());
|
|
||||||
let root = Element::parse(res_xml.as_bytes()).map_err(|e| PortalError::ConfigError(e.to_string()))?;
|
let root = Element::parse(res_xml.as_bytes()).map_err(|e| PortalError::ConfigError(e.to_string()))?;
|
||||||
|
|
||||||
if csc::is_config_criteria(&root) {
|
if csc::is_config_criteria(&root) {
|
||||||
@@ -247,7 +249,6 @@ pub async fn retrieve_config(
|
|||||||
_ = cancellation.cancelled() => bail!("Portal configuration cancelled"),
|
_ = cancellation.cancelled() => bail!("Portal configuration cancelled"),
|
||||||
result = retrieve_csc_config(&client, &portal, &root, cred.username(), gp_params) => result?,
|
result = retrieve_csc_config(&client, &portal, &root, cred.username(), gp_params) => result?,
|
||||||
};
|
};
|
||||||
debug!("Portal CSC config response received: {} bytes", csc_xml.len());
|
|
||||||
let root = Element::parse(csc_xml.as_bytes()).map_err(|e| PortalError::ConfigError(e.to_string()))?;
|
let root = Element::parse(csc_xml.as_bytes()).map_err(|e| PortalError::ConfigError(e.to_string()))?;
|
||||||
return parse_portal_policy(&server, cred, root, cancellation).await;
|
return parse_portal_policy(&server, cred, root, cancellation).await;
|
||||||
}
|
}
|
||||||
@@ -280,10 +281,13 @@ async fn retrieve_csc_config(
|
|||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
parse_gp_response(res).await.or_else(|err| {
|
parse_gp_response(res).await.or_else(|mut err| {
|
||||||
if let Some(tls) = ServerTlsError::from_request(&server_url, &err, gp_params.has_client_identity()) {
|
if let Some(tls) = ServerTlsError::from_request(&server_url, &err, gp_params.has_client_identity()) {
|
||||||
return Err(tls);
|
return Err(tls);
|
||||||
}
|
}
|
||||||
|
if let Some(error) = err.take_body_read_error() {
|
||||||
|
return Err(PortalError::NetworkError(error).into());
|
||||||
|
}
|
||||||
if err.status == StatusCode::NOT_FOUND {
|
if err.status == StatusCode::NOT_FOUND {
|
||||||
bail!(PortalError::ConfigError("CSC config endpoint not found".to_string()));
|
bail!(PortalError::ConfigError("CSC config endpoint not found".to_string()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use anyhow::{anyhow, bail};
|
use anyhow::{anyhow, bail};
|
||||||
use log::{debug, info, warn};
|
use log::{info, warn};
|
||||||
use reqwest::{Client, StatusCode};
|
use reqwest::{Client, StatusCode};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use specta::Type;
|
use specta::Type;
|
||||||
@@ -174,10 +174,8 @@ pub async fn prelogin(portal: &str, gp_params: &GpParams, options: PreloginOptio
|
|||||||
Err(anyhow!(PortalError::PreloginError(err.reason)))
|
Err(anyhow!(PortalError::PreloginError(err.reason)))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
debug!("Prelogin response XML: {}", res_xml);
|
|
||||||
|
|
||||||
let prelogin = parse_prelogin_response(&res_xml, is_gateway).map_err(|err| {
|
let prelogin = parse_prelogin_response(&res_xml, is_gateway).map_err(|err| {
|
||||||
warn!("Parse response error, response: {}", res_xml);
|
warn!("Failed to parse prelogin response: {err}");
|
||||||
PortalError::PreloginError(err.to_string())
|
PortalError::PreloginError(err.to_string())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|||||||
@@ -17,14 +17,23 @@ use super::{
|
|||||||
command_traits::CommandExt,
|
command_traits::CommandExt,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::rendering_recovery::{RenderingCrash, StderrDiagnostic, eligible, is_crash_exit};
|
use super::rendering_recovery::{
|
||||||
|
AUTH_STDERR_PREFIX, GbmBufferFailure, RenderingCrash, StderrDiagnostic, allows_shared_memory_override, eligible,
|
||||||
|
is_crash_exit, is_gbm_diagnostic,
|
||||||
|
};
|
||||||
|
|
||||||
const MAX_AUTH_RESULT_BYTES: usize = 256 * 1024;
|
const MAX_AUTH_RESULT_BYTES: usize = 256 * 1024;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
/// The caller that receives foreground permission after browser authentication.
|
||||||
|
pub const AUTH_PARENT_PROCESS_ID_ENV: &str = "GPAUTH_PARENT_PROCESS_ID";
|
||||||
|
|
||||||
pub struct SamlAuthLauncher<'a> {
|
pub struct SamlAuthLauncher<'a> {
|
||||||
cancellation: CancellationToken,
|
cancellation: CancellationToken,
|
||||||
server: &'a str,
|
server: &'a str,
|
||||||
auth_executable: Option<&'a str>,
|
auth_executable: Option<&'a str>,
|
||||||
|
#[cfg(windows)]
|
||||||
|
windows_cli: bool,
|
||||||
gateway: bool,
|
gateway: bool,
|
||||||
saml_request: Option<&'a str>,
|
saml_request: Option<&'a str>,
|
||||||
os: Option<&'a str>,
|
os: Option<&'a str>,
|
||||||
@@ -49,6 +58,7 @@ pub struct SamlAuthLauncher<'a> {
|
|||||||
verbose: Option<&'a str>,
|
verbose: Option<&'a str>,
|
||||||
log_format: LogFormat,
|
log_format: LogFormat,
|
||||||
dmabuf_disabled: bool,
|
dmabuf_disabled: bool,
|
||||||
|
desktop_compatibility_graphics: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SamlAuthLauncher<'a> {
|
impl<'a> SamlAuthLauncher<'a> {
|
||||||
@@ -57,6 +67,8 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
cancellation: CancellationToken::new(),
|
cancellation: CancellationToken::new(),
|
||||||
server,
|
server,
|
||||||
auth_executable: None,
|
auth_executable: None,
|
||||||
|
#[cfg(windows)]
|
||||||
|
windows_cli: false,
|
||||||
gateway: false,
|
gateway: false,
|
||||||
saml_request: None,
|
saml_request: None,
|
||||||
os: None,
|
os: None,
|
||||||
@@ -81,9 +93,21 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
verbose: None,
|
verbose: None,
|
||||||
log_format: LogFormat::Text,
|
log_format: LogFormat::Text,
|
||||||
dmabuf_disabled: false,
|
dmabuf_disabled: false,
|
||||||
|
desktop_compatibility_graphics: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
pub fn with_windows_cli_launch(mut self) -> Self {
|
||||||
|
self.windows_cli = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn desktop_compatibility_graphics(mut self) -> Self {
|
||||||
|
self.desktop_compatibility_graphics = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn dmabuf_disabled(mut self, disabled: bool) -> Self {
|
pub fn dmabuf_disabled(mut self, disabled: bool) -> Self {
|
||||||
self.dmabuf_disabled = disabled;
|
self.dmabuf_disabled = disabled;
|
||||||
self
|
self
|
||||||
@@ -197,6 +221,8 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
/// argument that never gets appended.
|
/// argument that never gets appended.
|
||||||
fn build_command(&self, program: &Path) -> Command {
|
fn build_command(&self, program: &Path) -> Command {
|
||||||
let mut auth_cmd = Command::new(program);
|
let mut auth_cmd = Command::new(program);
|
||||||
|
#[cfg(windows)]
|
||||||
|
auth_cmd.env(AUTH_PARENT_PROCESS_ID_ENV, std::process::id().to_string());
|
||||||
auth_cmd.arg(self.server);
|
auth_cmd.arg(self.server);
|
||||||
|
|
||||||
if self.gateway {
|
if self.gateway {
|
||||||
@@ -281,6 +307,12 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
.auth_executable
|
.auth_executable
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.unwrap_or_else(binary_paths::gpauth);
|
.unwrap_or_else(binary_paths::gpauth);
|
||||||
|
#[cfg(windows)]
|
||||||
|
let program = if self.windows_cli {
|
||||||
|
crate::windows::application_directory()?.join("gpauth.exe")
|
||||||
|
} else {
|
||||||
|
program
|
||||||
|
};
|
||||||
let auth_cmd = self.build_command(&program);
|
let auth_cmd = self.build_command(&program);
|
||||||
|
|
||||||
let mut command = auth_cmd.into_non_root()?.into_std();
|
let mut command = auth_cmd.into_non_root()?.into_std();
|
||||||
@@ -292,15 +324,36 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
if embedded && bundled && self.dmabuf_disabled {
|
if embedded && bundled && self.dmabuf_disabled {
|
||||||
command.env("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
command.env("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||||
}
|
}
|
||||||
|
let desktop_webview = embedded && bundled && self.desktop_compatibility_graphics;
|
||||||
|
let can_use_shared_memory = desktop_webview && allows_shared_memory_override(&command, true);
|
||||||
|
let use_shared_memory = can_use_shared_memory && crate::gui::compatibility_graphics_enabled();
|
||||||
|
if use_shared_memory {
|
||||||
|
command.env(crate::gui::FORCE_SHARED_MEMORY, "1");
|
||||||
|
}
|
||||||
|
let detect_gbm_failure = can_use_shared_memory && !use_shared_memory;
|
||||||
let stdin = auth_stdin(self.browser);
|
let stdin = auth_stdin(self.browser);
|
||||||
let cancellation = self.cancellation.clone();
|
let cancellation = self.cancellation.clone();
|
||||||
|
#[cfg(windows)]
|
||||||
|
let windows_cli = self.windows_cli;
|
||||||
let output = tokio::task::spawn_blocking(move || {
|
let output = tokio::task::spawn_blocking(move || {
|
||||||
|
#[cfg(feature = "logger")]
|
||||||
|
let stderr = crate::logger::diagnostic_writer();
|
||||||
|
#[cfg(not(feature = "logger"))]
|
||||||
|
let stderr: Box<dyn std::io::Write + Send> = Box::new(std::io::stderr());
|
||||||
|
let mut stderr = if desktop_webview {
|
||||||
|
Box::new(std::io::LineWriter::new(AuthStderr(stderr)))
|
||||||
|
} else {
|
||||||
|
stderr
|
||||||
|
};
|
||||||
|
let gbm_failed = std::cell::Cell::new(false);
|
||||||
let check = || {
|
let check = || {
|
||||||
if cancellation.is_cancelled() {
|
if cancellation.is_cancelled() {
|
||||||
Err(std::io::Error::new(
|
Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::Interrupted,
|
std::io::ErrorKind::Interrupted,
|
||||||
"Authentication cancelled",
|
"Authentication cancelled",
|
||||||
))
|
))
|
||||||
|
} else if gbm_failed.get() {
|
||||||
|
Err(std::io::Error::other(GbmBufferFailure))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -310,19 +363,33 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
command,
|
command,
|
||||||
&check,
|
&check,
|
||||||
Some(MAX_AUTH_RESULT_BYTES),
|
Some(MAX_AUTH_RESULT_BYTES),
|
||||||
&mut |bytes| diagnostic.push(bytes),
|
&mut |bytes| {
|
||||||
&mut std::io::stderr(),
|
diagnostic.push(bytes);
|
||||||
|
gbm_failed.set(detect_gbm_failure && diagnostic.should_retry_gbm(can_recover));
|
||||||
|
},
|
||||||
|
&mut stderr,
|
||||||
stdin,
|
stdin,
|
||||||
)?;
|
#[cfg(windows)]
|
||||||
Ok::<_, std::io::Error>((output.output, diagnostic.matched()))
|
windows_cli,
|
||||||
|
);
|
||||||
|
std::io::Write::flush(&mut stderr)?;
|
||||||
|
if gbm_failed.get() && !cancellation.is_cancelled() {
|
||||||
|
return Err(GbmBufferFailure.into());
|
||||||
|
}
|
||||||
|
let output = output?;
|
||||||
|
Ok::<_, anyhow::Error>((output.output, diagnostic.matched()))
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
let (output, rendering_diagnostic) = match output {
|
let (output, rendering_diagnostic) = match output {
|
||||||
Ok(output) => output,
|
Ok(output) => output,
|
||||||
Err(error) if error.kind() == std::io::ErrorKind::Interrupted => {
|
Err(error)
|
||||||
|
if error
|
||||||
|
.downcast_ref::<std::io::Error>()
|
||||||
|
.is_some_and(|error| error.kind() == std::io::ErrorKind::Interrupted) =>
|
||||||
|
{
|
||||||
return Err(crate::auth::AuthenticationCancelled.into());
|
return Err(crate::auth::AuthenticationCancelled.into());
|
||||||
}
|
}
|
||||||
Err(error) => return Err(error.into()),
|
Err(error) => return Err(error),
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.cancellation.is_cancelled() {
|
if self.cancellation.is_cancelled() {
|
||||||
@@ -332,6 +399,26 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attribute GBM failures to gpauth before forwarding them to the desktop supervisor.
|
||||||
|
struct AuthStderr(Box<dyn std::io::Write + Send>);
|
||||||
|
|
||||||
|
impl std::io::Write for AuthStderr {
|
||||||
|
fn write(&mut self, bytes: &[u8]) -> std::io::Result<usize> {
|
||||||
|
for line in bytes.split_inclusive(|&byte| byte == b'\n') {
|
||||||
|
if is_gbm_diagnostic(line) {
|
||||||
|
self.0.write_all(&[AUTH_STDERR_PREFIX, line].concat())?;
|
||||||
|
} else {
|
||||||
|
self.0.write_all(line)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(bytes.len())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) -> std::io::Result<()> {
|
||||||
|
self.0.flush()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// `gpauth --browser manual` reads the pasted `globalprotectcallback:` data from the user's terminal.
|
/// `gpauth --browser manual` reads the pasted `globalprotectcallback:` data from the user's terminal.
|
||||||
fn auth_stdin(browser: Option<&str>) -> ChildInput<'static> {
|
fn auth_stdin(browser: Option<&str>) -> ChildInput<'static> {
|
||||||
match browser {
|
match browser {
|
||||||
@@ -366,11 +453,14 @@ fn decode_auth_output(output: std::process::Output, rendering_failure: bool) ->
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::os_profile::{ClientOs, OsProfileBuilder};
|
use crate::os_profile::{ClientOs, OsProfileBuilder};
|
||||||
|
#[cfg(unix)]
|
||||||
|
use std::os::unix::process::ExitStatusExt;
|
||||||
|
#[cfg(windows)]
|
||||||
|
use std::os::windows::process::ExitStatusExt;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn server_tls_result_survives_process_decoding_as_a_typed_error() {
|
fn server_tls_result_survives_process_decoding_as_a_typed_error() {
|
||||||
use crate::error::{ServerTlsError, ServerTlsErrorKind};
|
use crate::error::{ServerTlsError, ServerTlsErrorKind};
|
||||||
use std::os::unix::process::ExitStatusExt;
|
|
||||||
let output = std::process::Output {
|
let output = std::process::Output {
|
||||||
status: std::process::ExitStatus::from_raw(0),
|
status: std::process::ExitStatus::from_raw(0),
|
||||||
stdout: br#"{"serverTlsError":{"server":"https://vpn.example.com:8443","kind":"certificate"}}"#.to_vec(),
|
stdout: br#"{"serverTlsError":{"server":"https://vpn.example.com:8443","kind":"certificate"}}"#.to_vec(),
|
||||||
@@ -389,7 +479,6 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn client_certificate_required_result_survives_process_decoding() {
|
fn client_certificate_required_result_survives_process_decoding() {
|
||||||
use crate::error::{ServerTlsError, ServerTlsErrorKind};
|
use crate::error::{ServerTlsError, ServerTlsErrorKind};
|
||||||
use std::os::unix::process::ExitStatusExt;
|
|
||||||
let output = std::process::Output {
|
let output = std::process::Output {
|
||||||
status: std::process::ExitStatus::from_raw(0),
|
status: std::process::ExitStatus::from_raw(0),
|
||||||
stdout: br#"{"serverTlsError":{"server":"https://vpn.example.com","kind":"clientCertificateRequired"}}"#.to_vec(),
|
stdout: br#"{"serverTlsError":{"server":"https://vpn.example.com","kind":"clientCertificateRequired"}}"#.to_vec(),
|
||||||
@@ -487,6 +576,19 @@ mod tests {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[test]
|
||||||
|
fn auth_child_receives_its_foreground_parent() {
|
||||||
|
let command = SamlAuthLauncher::new("portal.example.com").build_command(Path::new("gpauth"));
|
||||||
|
let parent = command
|
||||||
|
.as_std()
|
||||||
|
.get_envs()
|
||||||
|
.find(|(name, _)| *name == AUTH_PARENT_PROCESS_ID_ENV)
|
||||||
|
.and_then(|(_, value)| value)
|
||||||
|
.expect("the authenticator must know its foreground recipient");
|
||||||
|
assert_eq!(parent, std::process::id().to_string().as_str());
|
||||||
|
}
|
||||||
|
|
||||||
/// gpauth writes to the same stderr as its parent, so a caller reading the
|
/// gpauth writes to the same stderr as its parent, so a caller reading the
|
||||||
/// parent's JSON would hit gpauth's text records mid-stream unless the format
|
/// parent's JSON would hit gpauth's text records mid-stream unless the format
|
||||||
/// is passed down.
|
/// is passed down.
|
||||||
@@ -549,11 +651,14 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn failed_authenticator_discards_partial_or_valid_stdout_before_decoding() {
|
fn failed_authenticator_discards_partial_or_valid_stdout_before_decoding() {
|
||||||
use std::os::unix::process::ExitStatusExt;
|
#[cfg(unix)]
|
||||||
|
let status = std::process::ExitStatus::from_raw(71 << 8);
|
||||||
|
#[cfg(windows)]
|
||||||
|
let status = std::process::ExitStatus::from_raw(0xC0000005);
|
||||||
for stdout in [b"{partial".to_vec(), br#"{"cancelled":null}"#.to_vec()] {
|
for stdout in [b"{partial".to_vec(), br#"{"cancelled":null}"#.to_vec()] {
|
||||||
let error = decode_auth_output(
|
let error = decode_auth_output(
|
||||||
std::process::Output {
|
std::process::Output {
|
||||||
status: std::process::ExitStatus::from_raw(71 << 8),
|
status,
|
||||||
stdout,
|
stdout,
|
||||||
stderr: Vec::new(),
|
stderr: Vec::new(),
|
||||||
},
|
},
|
||||||
@@ -566,7 +671,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn successful_malformed_auth_output_is_not_a_rendering_crash() {
|
fn successful_malformed_auth_output_is_not_a_rendering_crash() {
|
||||||
use std::os::unix::process::ExitStatusExt;
|
|
||||||
let error = decode_auth_output(
|
let error = decode_auth_output(
|
||||||
std::process::Output {
|
std::process::Output {
|
||||||
status: std::process::ExitStatus::from_raw(0),
|
status: std::process::ExitStatus::from_raw(0),
|
||||||
@@ -580,6 +684,7 @@ mod tests {
|
|||||||
assert_eq!(error.to_string(), "Failed to parse auth data");
|
assert_eq!(error.to_string(), "Failed to parse auth data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn custom_authenticator_crash_does_not_request_recovery() {
|
async fn custom_authenticator_crash_does_not_request_recovery() {
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
@@ -615,8 +720,11 @@ mod tests {
|
|||||||
std::fs::write(&custom, "custom").unwrap();
|
std::fs::write(&custom, "custom").unwrap();
|
||||||
assert!(is_bundled_authenticator(&bundled, &bundled));
|
assert!(is_bundled_authenticator(&bundled, &bundled));
|
||||||
assert!(!is_bundled_authenticator(&custom, &bundled));
|
assert!(!is_bundled_authenticator(&custom, &bundled));
|
||||||
|
#[cfg(unix)]
|
||||||
|
{
|
||||||
let alias = directory.path().join("auth-alias");
|
let alias = directory.path().join("auth-alias");
|
||||||
std::os::unix::fs::symlink(&bundled, &alias).unwrap();
|
std::os::unix::fs::symlink(&bundled, &alias).unwrap();
|
||||||
assert!(is_bundled_authenticator(&alias, &bundled));
|
assert!(is_bundled_authenticator(&alias, &bundled));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
use super::{
|
use super::{
|
||||||
command_runner::{ChildInput, run_observed},
|
command_runner::{ChildInput, run_observed},
|
||||||
rendering_recovery::{RenderingCrash, StderrDiagnostic, eligible_with_inheritance, is_crash_exit},
|
rendering_recovery::{
|
||||||
|
GbmBufferFailure, RenderingCrash, StderrDiagnostic, allows_shared_memory_override, eligible_with_inheritance,
|
||||||
|
is_crash_exit,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use crate::service::transport::SessionCredential;
|
use crate::service::transport::SessionCredential;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use std::{
|
use std::{
|
||||||
|
cell::Cell,
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
fs::OpenOptions,
|
fs::OpenOptions,
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
@@ -19,8 +23,10 @@ pub(super) async fn launch_desktop_child(
|
|||||||
envs: Option<&HashMap<String, String>>,
|
envs: Option<&HashMap<String, String>>,
|
||||||
credential: &SessionCredential,
|
credential: &SessionCredential,
|
||||||
cancellation: &CancellationToken,
|
cancellation: &CancellationToken,
|
||||||
|
detect_gbm_failure: bool,
|
||||||
) -> anyhow::Result<ExitStatus> {
|
) -> anyhow::Result<ExitStatus> {
|
||||||
let retry_eligible = eligible_with_inheritance(&command, envs.is_none());
|
let retry_eligible = eligible_with_inheritance(&command, envs.is_none());
|
||||||
|
let detect_gbm_failure = detect_gbm_failure && allows_shared_memory_override(&command, envs.is_none());
|
||||||
let log_file = match envs {
|
let log_file = match envs {
|
||||||
Some(envs) => envs.get("GP_LOG_FILE").map(PathBuf::from),
|
Some(envs) => envs.get("GP_LOG_FILE").map(PathBuf::from),
|
||||||
None => std::env::var_os("GP_LOG_FILE").map(PathBuf::from),
|
None => std::env::var_os("GP_LOG_FILE").map(PathBuf::from),
|
||||||
@@ -38,12 +44,15 @@ pub(super) async fn launch_desktop_child(
|
|||||||
let cancellation = cancellation.clone();
|
let cancellation = cancellation.clone();
|
||||||
|
|
||||||
tokio::task::spawn_blocking(move || {
|
tokio::task::spawn_blocking(move || {
|
||||||
|
let gbm_failed = Cell::new(false);
|
||||||
let check = || {
|
let check = || {
|
||||||
if cancellation.is_cancelled() {
|
if cancellation.is_cancelled() {
|
||||||
Err(std::io::Error::new(
|
Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::Interrupted,
|
std::io::ErrorKind::Interrupted,
|
||||||
"Desktop child launch cancelled",
|
"Desktop child launch cancelled",
|
||||||
))
|
))
|
||||||
|
} else if gbm_failed.get() {
|
||||||
|
Err(std::io::Error::other(GbmBufferFailure))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -53,10 +62,17 @@ pub(super) async fn launch_desktop_child(
|
|||||||
command,
|
command,
|
||||||
&check,
|
&check,
|
||||||
None,
|
None,
|
||||||
&mut |bytes| diagnostic.push(bytes),
|
&mut |bytes| {
|
||||||
|
diagnostic.push(bytes);
|
||||||
|
gbm_failed.set(detect_gbm_failure && diagnostic.should_retry_gbm(retry_eligible));
|
||||||
|
},
|
||||||
&mut sink,
|
&mut sink,
|
||||||
ChildInput::Frame(&frame),
|
ChildInput::Frame(&frame),
|
||||||
)?;
|
);
|
||||||
|
if gbm_failed.get() && !cancellation.is_cancelled() {
|
||||||
|
return Err(GbmBufferFailure.into());
|
||||||
|
}
|
||||||
|
let observed = observed?;
|
||||||
let output = observed.output;
|
let output = observed.output;
|
||||||
if is_crash_exit(output.status) && retry_eligible && diagnostic.matched() {
|
if is_crash_exit(output.status) && retry_eligible && diagnostic.matched() {
|
||||||
return Err(RenderingCrash { status: output.status }.into());
|
return Err(RenderingCrash { status: output.status }.into());
|
||||||
|
|||||||
@@ -170,7 +170,11 @@ impl<'a> DesktopLauncher<'a> {
|
|||||||
}
|
}
|
||||||
match outcome {
|
match outcome {
|
||||||
Err(error) if recovery.recover(&error) => {
|
Err(error) if recovery.recover(&error) => {
|
||||||
|
if recovery.shared_memory() {
|
||||||
|
warn!("{error}; restarting the desktop launch with compatibility graphics");
|
||||||
|
} else {
|
||||||
warn!("{error}; restarting the desktop launch with DMABUF disabled and opaque windows");
|
warn!("{error}; restarting the desktop launch with DMABUF disabled and opaque windows");
|
||||||
|
}
|
||||||
expecting_renewal = true;
|
expecting_renewal = true;
|
||||||
input.write_all(&[DESKTOP_RENDERING_RETRY]).await?;
|
input.write_all(&[DESKTOP_RENDERING_RETRY]).await?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ impl<'a> GuiHelperLauncher<'a> {
|
|||||||
self.envs,
|
self.envs,
|
||||||
self.credential,
|
self.credential,
|
||||||
cancellation,
|
cancellation,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -101,6 +101,12 @@ impl<'a> GuiLauncher<'a> {
|
|||||||
if let Some(envs) = &self.envs {
|
if let Some(envs) = &self.envs {
|
||||||
cmd.env_clear().envs(envs);
|
cmd.env_clear().envs(envs);
|
||||||
}
|
}
|
||||||
|
if self.variant == crate::gui::GuiVariant::Tauri
|
||||||
|
&& crate::gui::compatibility_graphics_enabled()
|
||||||
|
&& super::rendering_recovery::allows_shared_memory_override(cmd.as_std(), self.envs.is_none())
|
||||||
|
{
|
||||||
|
cmd.env(crate::gui::FORCE_SHARED_MEMORY, "1");
|
||||||
|
}
|
||||||
cmd.arg("--service-credential-on-stdin");
|
cmd.arg("--service-credential-on-stdin");
|
||||||
if self.minimized {
|
if self.minimized {
|
||||||
cmd.arg("--minimized");
|
cmd.arg("--minimized");
|
||||||
@@ -112,6 +118,7 @@ impl<'a> GuiLauncher<'a> {
|
|||||||
self.envs.as_ref(),
|
self.envs.as_ref(),
|
||||||
&self.credential,
|
&self.credential,
|
||||||
cancellation,
|
cancellation,
|
||||||
|
self.variant == crate::gui::GuiVariant::Tauri,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
@@ -207,6 +214,10 @@ impl<'a> GuiLauncher<'a> {
|
|||||||
gui_switch::reply(&mut socket, Ok(GuiSwitchOutcome::DownloadRequired)).await?;
|
gui_switch::reply(&mut socket, Ok(GuiSwitchOutcome::DownloadRequired)).await?;
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
use super::rendering_recovery::{GbmBufferFailure, RecoveryState};
|
||||||
|
let mut recovery = RecoveryState::default();
|
||||||
|
let mut program = program;
|
||||||
|
let (mut child, start_result) = loop {
|
||||||
service_input.write_all(&[DESKTOP_SWITCH_BEGIN]).await?;
|
service_input.write_all(&[DESKTOP_SWITCH_BEGIN]).await?;
|
||||||
pending = true;
|
pending = true;
|
||||||
let credential = super::desktop_launcher::read_credential(service_output).await?
|
let credential = super::desktop_launcher::read_credential(service_output).await?
|
||||||
@@ -218,21 +229,30 @@ impl<'a> GuiLauncher<'a> {
|
|||||||
let launcher = Self::new(self.version, Arc::new(credential), variant)
|
let launcher = Self::new(self.version, Arc::new(credential), variant)
|
||||||
.envs(envs)
|
.envs(envs)
|
||||||
.minimized(false);
|
.minimized(false);
|
||||||
let program = match program {
|
let executable = match &program {
|
||||||
Some(program) => program,
|
Some(program) => program.clone(),
|
||||||
None => launcher.resolve_program(cancellation, command.theme).await?,
|
None => launcher.resolve_program(cancellation, command.theme).await?,
|
||||||
};
|
};
|
||||||
let mut child = launcher.start_owned(program, cancellation.child_token());
|
let mut child = launcher.start_owned(executable.clone(), cancellation.child_token());
|
||||||
let start_result = tokio::select! {
|
let start_result = tokio::select! {
|
||||||
result = tokio::time::timeout(std::time::Duration::from_secs(30), ready.ready()) => {
|
result = tokio::time::timeout(std::time::Duration::from_secs(30), ready.ready()) => {
|
||||||
result.map_err(|_| anyhow::anyhow!("The selected GUI did not finish starting" )).and_then(|result| result)
|
result.map_err(|_| anyhow::anyhow!("The selected GUI did not finish starting" )).and_then(|result| result)
|
||||||
},
|
},
|
||||||
outcome = &mut child.task => {
|
outcome = &mut child.task => {
|
||||||
return match outcome? {
|
match outcome? {
|
||||||
Ok(status) => Err(anyhow::anyhow!("The selected GUI exited during startup: {status}")),
|
Ok(status) => return Err(anyhow::anyhow!("The selected GUI exited during startup: {status}")),
|
||||||
Err(error) => Err(error),
|
Err(error) if error.is::<GbmBufferFailure>() && recovery.recover(&error) => {
|
||||||
};
|
log::warn!("{error}; restarting the selected GUI with compatibility graphics");
|
||||||
|
service_input.write_all(&[DESKTOP_SWITCH_CANCEL]).await?;
|
||||||
|
pending = false;
|
||||||
|
program = Some(executable);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
Err(error) => return Err(recovery.terminal(error)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break (child, start_result);
|
||||||
};
|
};
|
||||||
if let Err(error) = start_result.and_then(|()| crate::gui::save_preference(variant)) {
|
if let Err(error) = start_result.and_then(|()| crate::gui::save_preference(variant)) {
|
||||||
child.cancel.cancel();
|
child.cancel.cancel();
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ pub mod auth_launcher;
|
|||||||
pub mod desktop_launcher;
|
pub mod desktop_launcher;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub mod gui_launcher;
|
pub mod gui_launcher;
|
||||||
#[cfg(any(target_os = "linux", test))]
|
#[cfg(any(target_os = "linux", all(test, unix)))]
|
||||||
pub mod gui_switch;
|
pub mod gui_switch;
|
||||||
#[cfg(any(target_os = "linux", test))]
|
#[cfg(any(target_os = "linux", all(test, unix)))]
|
||||||
mod nsh_runtime;
|
mod nsh_runtime;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub mod users;
|
pub mod users;
|
||||||
@@ -39,3 +39,15 @@ pub mod rendering_recovery;
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
#[path = "windows/user_process.rs"]
|
#[path = "windows/user_process.rs"]
|
||||||
pub mod user_process;
|
pub mod user_process;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[path = "windows/desktop_auth.rs"]
|
||||||
|
mod desktop_auth;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[path = "windows/auth_bootstrap.rs"]
|
||||||
|
pub mod auth_bootstrap;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[path = "windows/console_input.rs"]
|
||||||
|
mod console_input;
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
use std::process::{Command, ExitStatus};
|
use std::process::{Command, ExitStatus};
|
||||||
|
|
||||||
const DMABUF: &str = "WEBKIT_DISABLE_DMABUF_RENDERER";
|
const DMABUF: &str = "WEBKIT_DISABLE_DMABUF_RENDERER";
|
||||||
|
pub const MAIN_WEBVIEW_INITIALIZED: &str = "GP Connect main webview initialized";
|
||||||
|
const GBM_DIAGNOSTIC: &[u8] = b"Failed to create GBM buffer";
|
||||||
|
pub(crate) const AUTH_STDERR_PREFIX: &[u8] = b"gpauth stderr: ";
|
||||||
const DIAGNOSTIC: &[u8] = b"Error 71 (Protocol error) dispatching to Wayland display";
|
const DIAGNOSTIC: &[u8] = b"Error 71 (Protocol error) dispatching to Wayland display";
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
@@ -16,20 +19,33 @@ pub struct RecoveryFailed(#[source] anyhow::Error);
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct RecoveryState {
|
pub struct RecoveryState {
|
||||||
first_failure: Option<String>,
|
first_failure: Option<String>,
|
||||||
|
shared_memory: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RecoveryState {
|
impl RecoveryState {
|
||||||
pub fn dmabuf_disabled(&self) -> bool {
|
pub fn dmabuf_disabled(&self) -> bool {
|
||||||
self.first_failure.is_some()
|
self.first_failure.is_some() && !self.shared_memory
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn shared_memory(&self) -> bool {
|
||||||
|
self.shared_memory
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn recover(&mut self, error: &anyhow::Error) -> bool {
|
pub fn recover(&mut self, error: &anyhow::Error) -> bool {
|
||||||
if self.first_failure.is_none() && error.downcast_ref::<RenderingCrash>().is_some() {
|
if self.first_failure.is_some() {
|
||||||
self.first_failure = Some(error.to_string());
|
return false;
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
let gbm_failure = error.downcast_ref::<GbmBufferFailure>().is_some();
|
||||||
|
if !gbm_failure && error.downcast_ref::<RenderingCrash>().is_none() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if gbm_failure && let Err(error) = crate::gui::set_compatibility_graphics(true) {
|
||||||
|
log::warn!("Could not save compatibility graphics setting: {error:#}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
self.first_failure = Some(error.to_string());
|
||||||
|
self.shared_memory = gbm_failure;
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn terminal(&self, error: anyhow::Error) -> anyhow::Error {
|
pub fn terminal(&self, error: anyhow::Error) -> anyhow::Error {
|
||||||
@@ -70,6 +86,16 @@ pub(crate) fn eligible_with_inheritance(command: &Command, inherits: bool) -> bo
|
|||||||
&& effective_env(command, DMABUF, inherits).is_none()
|
&& effective_env(command, DMABUF, inherits).is_none()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn allows_shared_memory_override(command: &Command, inherits: bool) -> bool {
|
||||||
|
crate::gui::COMPATIBILITY_GRAPHICS_SUPPORTED
|
||||||
|
&& effective_env(command, DMABUF, inherits).is_none()
|
||||||
|
&& effective_env(command, crate::gui::FORCE_SHARED_MEMORY, inherits).is_none()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
#[error("WebKit failed to create a GBM buffer")]
|
||||||
|
pub(crate) struct GbmBufferFailure;
|
||||||
|
|
||||||
fn effective_env(command: &Command, key: &str, inherits: bool) -> Option<std::ffi::OsString> {
|
fn effective_env(command: &Command, key: &str, inherits: bool) -> Option<std::ffi::OsString> {
|
||||||
for (name, value) in command.get_envs() {
|
for (name, value) in command.get_envs() {
|
||||||
if name == key {
|
if name == key {
|
||||||
@@ -79,12 +105,21 @@ fn effective_env(command: &Command, key: &str, inherits: bool) -> Option<std::ff
|
|||||||
inherits.then(|| std::env::var_os(key)).flatten()
|
inherits.then(|| std::env::var_os(key)).flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn is_gbm_diagnostic(line: &[u8]) -> bool {
|
||||||
|
!line.starts_with(AUTH_STDERR_PREFIX)
|
||||||
|
&& line
|
||||||
|
.windows(GBM_DIAGNOSTIC.len())
|
||||||
|
.any(|message| message == GBM_DIAGNOSTIC)
|
||||||
|
}
|
||||||
|
|
||||||
/// Observes diagnostic lines without retaining arbitrary application output.
|
/// Observes diagnostic lines without retaining arbitrary application output.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub(crate) struct StderrDiagnostic {
|
pub(crate) struct StderrDiagnostic {
|
||||||
line: Vec<u8>,
|
line: Vec<u8>,
|
||||||
overflow: bool,
|
overflow: bool,
|
||||||
matched: bool,
|
matched: bool,
|
||||||
|
gbm_failed: bool,
|
||||||
|
main_webview_initialized: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StderrDiagnostic {
|
impl StderrDiagnostic {
|
||||||
@@ -104,6 +139,14 @@ impl StderrDiagnostic {
|
|||||||
|
|
||||||
fn check_line(&mut self) {
|
fn check_line(&mut self) {
|
||||||
let line = self.line.trim_ascii_end();
|
let line = self.line.trim_ascii_end();
|
||||||
|
if !self.overflow {
|
||||||
|
if line == MAIN_WEBVIEW_INITIALIZED.as_bytes() {
|
||||||
|
self.main_webview_initialized = true;
|
||||||
|
}
|
||||||
|
if !self.main_webview_initialized && is_gbm_diagnostic(line) {
|
||||||
|
self.gbm_failed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
let message = line.strip_suffix(b".").unwrap_or(line);
|
let message = line.strip_suffix(b".").unwrap_or(line);
|
||||||
if !self.overflow
|
if !self.overflow
|
||||||
&& (line.starts_with(b"Gdk-Message:")
|
&& (line.starts_with(b"Gdk-Message:")
|
||||||
@@ -117,6 +160,10 @@ impl StderrDiagnostic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn should_retry_gbm(&self, can_retry_wayland: bool) -> bool {
|
||||||
|
self.gbm_failed && !(can_retry_wayland && self.matched)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn matched(&mut self) -> bool {
|
pub(crate) fn matched(&mut self) -> bool {
|
||||||
self.check_line();
|
self.check_line();
|
||||||
self.matched
|
self.matched
|
||||||
@@ -127,6 +174,43 @@ impl StderrDiagnostic {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn detects_gbm_failure_before_main_webview_initializes() {
|
||||||
|
for line in [
|
||||||
|
b"Failed to create GBM buffer of size 280x404: Invalid argument\n".as_slice(),
|
||||||
|
b"(WebKitWebProcess:42): Warning: Failed to create GBM buffer\n",
|
||||||
|
b"gpauth: Failed to create GBM buffer\n",
|
||||||
|
] {
|
||||||
|
let mut observer = StderrDiagnostic::default();
|
||||||
|
for bytes in line.chunks(7) {
|
||||||
|
observer.push(bytes);
|
||||||
|
}
|
||||||
|
assert!(observer.gbm_failed);
|
||||||
|
assert!(!observer.matched());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ignores_gbm_failure_after_startup_and_from_auth_stderr() {
|
||||||
|
let mut observer = StderrDiagnostic::default();
|
||||||
|
observer
|
||||||
|
.push(b"gpauth stderr: (WebKitWebProcess:42): Failed to create GBM buffer of size 900x648: Invalid argument\n");
|
||||||
|
assert!(!observer.gbm_failed);
|
||||||
|
observer.push(format!("{MAIN_WEBVIEW_INITIALIZED}\n").as_bytes());
|
||||||
|
observer.push(b"Failed to create GBM buffer of size 840x640: Invalid argument\n");
|
||||||
|
assert!(!observer.gbm_failed);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn preserves_wayland_retry_when_both_diagnostics_are_observed() {
|
||||||
|
let mut observer = StderrDiagnostic::default();
|
||||||
|
observer.push(b"Failed to create GBM buffer of size 280x404: Invalid argument\n");
|
||||||
|
observer.push(b"Gdk-Message: Error 71 (Protocol error) dispatching to Wayland display.\n");
|
||||||
|
assert!(observer.matched());
|
||||||
|
assert!(!observer.should_retry_gbm(true));
|
||||||
|
assert!(observer.should_retry_gbm(false));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recognizes_split_diagnostic_without_matching_quoted_warning() {
|
fn recognizes_split_diagnostic_without_matching_quoted_warning() {
|
||||||
let mut observer = StderrDiagnostic::default();
|
let mut observer = StderrDiagnostic::default();
|
||||||
@@ -198,6 +282,7 @@ mod tests {
|
|||||||
assert!(!eligible_with_inheritance(&command, false));
|
assert!(!eligible_with_inheritance(&command, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[test]
|
#[test]
|
||||||
fn recovery_is_once_and_preserves_cancellation_and_both_failures() {
|
fn recovery_is_once_and_preserves_cancellation_and_both_failures() {
|
||||||
use std::os::unix::process::ExitStatusExt;
|
use std::os::unix::process::ExitStatusExt;
|
||||||
@@ -219,6 +304,7 @@ mod tests {
|
|||||||
assert!(error.to_string().contains("71"));
|
assert!(error.to_string().contains("71"));
|
||||||
assert!(error.to_string().contains("second exit 72"));
|
assert!(error.to_string().contains("second exit 72"));
|
||||||
}
|
}
|
||||||
|
#[cfg(unix)]
|
||||||
#[test]
|
#[test]
|
||||||
fn explicit_termination_is_not_a_rendering_crash() {
|
fn explicit_termination_is_not_a_rendering_crash() {
|
||||||
use std::os::unix::process::ExitStatusExt;
|
use std::os::unix::process::ExitStatusExt;
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
//! One-shot launch arguments for the installed Windows CLI authenticator.
|
||||||
|
use std::{env, ffi::OsStr, io, os::windows::io::AsRawHandle, process::Command, time::Duration};
|
||||||
|
use tokio::{
|
||||||
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
|
net::windows::named_pipe::{ClientOptions, NamedPipeServer},
|
||||||
|
time,
|
||||||
|
};
|
||||||
|
use windows_sys::Win32::System::Pipes::{GetNamedPipeClientProcessId, GetNamedPipeServerProcessId};
|
||||||
|
|
||||||
|
use super::auth_launcher::AUTH_PARENT_PROCESS_ID_ENV;
|
||||||
|
use crate::collection::CollectionControl;
|
||||||
|
|
||||||
|
const FLAG: &str = "--windows-cli-bootstrap";
|
||||||
|
const MAX_BYTES: usize = 256 * 1024;
|
||||||
|
const TIMEOUT: Duration = Duration::from_secs(15);
|
||||||
|
const RECEIVED: u8 = 1;
|
||||||
|
|
||||||
|
pub(super) struct AuthBootstrap {
|
||||||
|
name: String,
|
||||||
|
pipe: NamedPipeServer,
|
||||||
|
request: Vec<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AuthBootstrap {
|
||||||
|
pub(super) fn prepare(command: &Command) -> io::Result<Self> {
|
||||||
|
let args: Vec<_> = command
|
||||||
|
.get_args()
|
||||||
|
.map(|arg| {
|
||||||
|
arg
|
||||||
|
.to_str()
|
||||||
|
.ok_or_else(|| invalid("Invalid Windows authentication argument"))
|
||||||
|
})
|
||||||
|
.collect::<io::Result<_>>()?;
|
||||||
|
let request = serde_json::to_vec(&args)?;
|
||||||
|
check_length(request.len())?;
|
||||||
|
let name = format!(r"\\.\pipe\GPConnect.Auth.{}", uuid::Uuid::new_v4());
|
||||||
|
let pipe = crate::windows::create_user_pipe(&name, true)?;
|
||||||
|
Ok(Self { name, pipe, request })
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn arguments(&self) -> [&OsStr; 2] {
|
||||||
|
[OsStr::new(FLAG), OsStr::new(&self.name)]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Build the short command used when the CLI and authenticator share a token.
|
||||||
|
pub(super) fn command(&self, original: &Command) -> Command {
|
||||||
|
let mut command = Command::new(original.get_program());
|
||||||
|
command.args(self.arguments());
|
||||||
|
for (name, value) in original.get_envs() {
|
||||||
|
match value {
|
||||||
|
Some(value) => command.env(name, value),
|
||||||
|
None => command.env_remove(name),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if let Some(directory) = original.get_current_dir() {
|
||||||
|
command.current_dir(directory);
|
||||||
|
}
|
||||||
|
command
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn send_to_child(self, pid: u32, control: &dyn CollectionControl) -> io::Result<()> {
|
||||||
|
tokio::runtime::Handle::current().block_on(self.send(pid, control))
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn send(mut self, expected_pid: u32, control: &dyn CollectionControl) -> io::Result<()> {
|
||||||
|
let send = async {
|
||||||
|
self.pipe.connect().await?;
|
||||||
|
let mut pid = 0;
|
||||||
|
if unsafe { GetNamedPipeClientProcessId(self.pipe.as_raw_handle(), &mut pid) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
if pid != expected_pid {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::PermissionDenied,
|
||||||
|
"Unexpected authentication pipe client",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
self.pipe.write_u32(self.request.len() as u32).await?;
|
||||||
|
self.pipe.write_all(&self.request).await?;
|
||||||
|
if self.pipe.read_u8().await? != RECEIVED {
|
||||||
|
return Err(invalid("Windows authentication arguments were not accepted"));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
};
|
||||||
|
let check = async {
|
||||||
|
loop {
|
||||||
|
control.check()?;
|
||||||
|
time::sleep(Duration::from_millis(25)).await;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
time::timeout(TIMEOUT, async {
|
||||||
|
tokio::select! {
|
||||||
|
result = send => result,
|
||||||
|
result = check => result,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Recognize the internal bootstrap before handing actual arguments to the normal parser.
|
||||||
|
pub async fn receive_arguments() -> io::Result<Option<Vec<String>>> {
|
||||||
|
let mut args = env::args_os().skip(1);
|
||||||
|
if args.next().as_deref() != Some(OsStr::new(FLAG)) {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
let name = args
|
||||||
|
.next()
|
||||||
|
.ok_or_else(|| invalid("Missing Windows authentication pipe"))?;
|
||||||
|
if args.next().is_some() {
|
||||||
|
return Err(invalid("Unexpected Windows authentication bootstrap argument"));
|
||||||
|
}
|
||||||
|
let expected_pid: u32 = env::var(AUTH_PARENT_PROCESS_ID_ENV)
|
||||||
|
.ok()
|
||||||
|
.and_then(|value| value.parse().ok())
|
||||||
|
.filter(|pid| *pid != 0)
|
||||||
|
.ok_or_else(|| invalid("Missing Windows authentication parent process"))?;
|
||||||
|
receive(&name, expected_pid).await.map(Some)
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn receive(name: &OsStr, expected_pid: u32) -> io::Result<Vec<String>> {
|
||||||
|
time::timeout(TIMEOUT, async {
|
||||||
|
let mut pipe = ClientOptions::new().open(name)?;
|
||||||
|
let mut pid = 0;
|
||||||
|
if unsafe { GetNamedPipeServerProcessId(pipe.as_raw_handle(), &mut pid) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
if pid != expected_pid {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::PermissionDenied,
|
||||||
|
"Unexpected authentication pipe server",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let length = pipe.read_u32().await? as usize;
|
||||||
|
check_length(length)?;
|
||||||
|
let mut request = vec![0; length];
|
||||||
|
pipe.read_exact(&mut request).await?;
|
||||||
|
let args = serde_json::from_slice(&request)?;
|
||||||
|
pipe.write_u8(RECEIVED).await?;
|
||||||
|
Ok(args)
|
||||||
|
})
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check_length(length: usize) -> io::Result<()> {
|
||||||
|
if length == 0 || length > MAX_BYTES {
|
||||||
|
return Err(invalid("Windows authentication launch arguments exceed their limit"));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn invalid(message: &str) -> io::Error {
|
||||||
|
io::Error::new(io::ErrorKind::InvalidData, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn large_saml_request_round_trips_outside_the_os_command_line() {
|
||||||
|
let request = format!("<html>{}</html>", "🎵".repeat(20_000));
|
||||||
|
let mut command = Command::new("gpauth.exe");
|
||||||
|
command.args(["portal.example.test", "--saml-request", &request]);
|
||||||
|
let bootstrap = AuthBootstrap::prepare(&command).unwrap();
|
||||||
|
assert!(request.encode_utf16().count() > 32_767);
|
||||||
|
let launch = bootstrap.command(&command);
|
||||||
|
assert_eq!(launch.get_args().collect::<Vec<_>>(), bootstrap.arguments());
|
||||||
|
let name = bootstrap.name.clone();
|
||||||
|
let pid = std::process::id();
|
||||||
|
let (sent, received) = tokio::join!(bootstrap.send(pid, &|| Ok(())), receive(OsStr::new(&name), pid));
|
||||||
|
sent.unwrap();
|
||||||
|
assert_eq!(received.unwrap(), ["portal.example.test", "--saml-request", &request]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
//! Controlled Windows child execution. Pipe polling keeps cancellation responsive.
|
//! Controlled Windows child execution. Pipe polling keeps cancellation responsive.
|
||||||
|
use super::{
|
||||||
|
auth_bootstrap::AuthBootstrap,
|
||||||
|
console_input::{self, ConsoleInput},
|
||||||
|
desktop_auth::DesktopChild,
|
||||||
|
};
|
||||||
use crate::collection::CollectionControl;
|
use crate::collection::CollectionControl;
|
||||||
use std::{
|
use std::{
|
||||||
|
fs::File,
|
||||||
io::{self, Read, Write},
|
io::{self, Read, Write},
|
||||||
os::windows::io::AsRawHandle,
|
os::windows::io::{AsRawHandle, OwnedHandle},
|
||||||
process::{Child, Command, Output, Stdio},
|
process::{Child, Command, ExitStatus, Output, Stdio},
|
||||||
thread,
|
thread,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
@@ -30,45 +36,35 @@ pub(crate) fn run_controlled(command: Command, control: &dyn CollectionControl,
|
|||||||
&mut |_| {},
|
&mut |_| {},
|
||||||
&mut io::sink(),
|
&mut io::sink(),
|
||||||
ChildInput::Null,
|
ChildInput::Null,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
.map(|observed| observed.output)
|
.map(|observed| observed.output)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn run_observed(
|
pub(crate) fn run_observed(
|
||||||
mut command: Command,
|
command: Command,
|
||||||
control: &dyn CollectionControl,
|
control: &dyn CollectionControl,
|
||||||
output_limit: Option<usize>,
|
output_limit: Option<usize>,
|
||||||
observer: &mut dyn FnMut(&[u8]),
|
observer: &mut dyn FnMut(&[u8]),
|
||||||
stderr_sink: &mut dyn Write,
|
stderr_sink: &mut dyn Write,
|
||||||
stdin: ChildInput<'_>,
|
stdin: ChildInput<'_>,
|
||||||
|
windows_cli_auth: bool,
|
||||||
) -> io::Result<ObservedOutput> {
|
) -> io::Result<ObservedOutput> {
|
||||||
control.check()?;
|
control.check()?;
|
||||||
// Windows desktop processes must not open a console for each helper.
|
let bootstrap = windows_cli_auth.then(|| AuthBootstrap::prepare(&command)).transpose()?;
|
||||||
use std::os::windows::process::CommandExt;
|
let (mut child, mut stdout, mut stderr, input) = match bootstrap {
|
||||||
if !matches!(stdin, ChildInput::Terminal) {
|
Some(bootstrap) if crate::windows::is_elevated()? => {
|
||||||
command.creation_flags(0x08000000); // CREATE_NO_WINDOW
|
let (child, stdout, stderr, input) = DesktopChild::spawn(&command, bootstrap, &stdin, control)?;
|
||||||
|
(ControlledChild::Desktop(child), Some(stdout), stderr, input)
|
||||||
}
|
}
|
||||||
command.stdout(if output_limit.is_some() {
|
bootstrap => spawn_command(command, &stdin, output_limit, bootstrap, control)?,
|
||||||
Stdio::piped()
|
};
|
||||||
} else {
|
let input = if let (ChildInput::Frame(frame), Some(mut pipe)) = (stdin, input) {
|
||||||
Stdio::inherit()
|
|
||||||
});
|
|
||||||
command.stderr(Stdio::piped());
|
|
||||||
command.stdin(match stdin {
|
|
||||||
ChildInput::Terminal => Stdio::inherit(),
|
|
||||||
ChildInput::Null => Stdio::null(),
|
|
||||||
ChildInput::Frame(_) => Stdio::piped(),
|
|
||||||
});
|
|
||||||
let mut child = ControlledChild(command.spawn()?);
|
|
||||||
let input = if let ChildInput::Frame(frame) = stdin {
|
|
||||||
let mut pipe = child.0.stdin.take().expect("piped stdin");
|
|
||||||
let frame = frame.to_vec();
|
let frame = frame.to_vec();
|
||||||
Some(thread::spawn(move || pipe.write_all(&frame)))
|
Some(thread::spawn(move || pipe.write_all(&frame)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
let mut stdout = child.0.stdout.take();
|
|
||||||
let mut stderr = child.0.stderr.take().expect("piped stderr");
|
|
||||||
let mut output = Vec::new();
|
let mut output = Vec::new();
|
||||||
let mut buffer = [0u8; 8192];
|
let mut buffer = [0u8; 8192];
|
||||||
loop {
|
loop {
|
||||||
@@ -86,7 +82,7 @@ pub(crate) fn run_observed(
|
|||||||
let length = read_available(&mut stderr, &mut buffer)?;
|
let length = read_available(&mut stderr, &mut buffer)?;
|
||||||
observer(&buffer[..length]);
|
observer(&buffer[..length]);
|
||||||
stderr_sink.write_all(&buffer[..length])?;
|
stderr_sink.write_all(&buffer[..length])?;
|
||||||
if let Some(status) = child.0.try_wait()? {
|
if let Some(status) = child.try_wait()? {
|
||||||
// Drain the remaining buffered output after the process exits.
|
// Drain the remaining buffered output after the process exits.
|
||||||
if let Some(pipe) = &mut stdout {
|
if let Some(pipe) = &mut stdout {
|
||||||
loop {
|
loop {
|
||||||
@@ -126,6 +122,60 @@ pub(crate) fn run_observed(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn spawn_command(
|
||||||
|
command: Command,
|
||||||
|
stdin: &ChildInput<'_>,
|
||||||
|
output_limit: Option<usize>,
|
||||||
|
bootstrap: Option<AuthBootstrap>,
|
||||||
|
control: &dyn CollectionControl,
|
||||||
|
) -> io::Result<(ControlledChild, Option<File>, File, Option<File>)> {
|
||||||
|
let mut command = match &bootstrap {
|
||||||
|
Some(bootstrap) => bootstrap.command(&command),
|
||||||
|
None => command,
|
||||||
|
};
|
||||||
|
// Windows desktop processes must not open a console for each helper.
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
|
if !matches!(stdin, ChildInput::Terminal) {
|
||||||
|
command.creation_flags(0x08000000); // CREATE_NO_WINDOW
|
||||||
|
}
|
||||||
|
command.stdout(if output_limit.is_some() {
|
||||||
|
Stdio::piped()
|
||||||
|
} else {
|
||||||
|
Stdio::inherit()
|
||||||
|
});
|
||||||
|
command.stderr(Stdio::piped());
|
||||||
|
let terminal = if bootstrap.is_some() && matches!(stdin, ChildInput::Terminal) {
|
||||||
|
let input = console_input::terminal_input()?;
|
||||||
|
console_input::is_console(&input).then_some(input)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
command.stdin(match stdin {
|
||||||
|
ChildInput::Terminal if terminal.is_none() => Stdio::inherit(),
|
||||||
|
ChildInput::Terminal => Stdio::piped(),
|
||||||
|
ChildInput::Null => Stdio::null(),
|
||||||
|
ChildInput::Frame(_) => Stdio::piped(),
|
||||||
|
});
|
||||||
|
let mut child = StandardChild {
|
||||||
|
child: command.spawn()?,
|
||||||
|
console_input: None,
|
||||||
|
};
|
||||||
|
if let Some(bootstrap) = bootstrap {
|
||||||
|
bootstrap.send_to_child(child.child.id(), control)?;
|
||||||
|
}
|
||||||
|
let stdout = child
|
||||||
|
.child
|
||||||
|
.stdout
|
||||||
|
.take()
|
||||||
|
.map(|pipe| File::from(OwnedHandle::from(pipe)));
|
||||||
|
let stderr = File::from(OwnedHandle::from(child.child.stderr.take().expect("piped stderr")));
|
||||||
|
let mut input = child.child.stdin.take().map(|pipe| File::from(OwnedHandle::from(pipe)));
|
||||||
|
if let Some(terminal) = terminal {
|
||||||
|
child.console_input = Some(ConsoleInput::start(terminal, input.take().expect("piped stdin"))?);
|
||||||
|
}
|
||||||
|
Ok((ControlledChild::Standard(child), stdout, stderr, input))
|
||||||
|
}
|
||||||
|
|
||||||
fn read_available(pipe: &mut (impl Read + AsRawHandle), buffer: &mut [u8]) -> io::Result<usize> {
|
fn read_available(pipe: &mut (impl Read + AsRawHandle), buffer: &mut [u8]) -> io::Result<usize> {
|
||||||
let mut available = 0;
|
let mut available = 0;
|
||||||
let success = unsafe {
|
let success = unsafe {
|
||||||
@@ -152,11 +202,34 @@ fn read_available(pipe: &mut (impl Read + AsRawHandle), buffer: &mut [u8]) -> io
|
|||||||
pipe.read(&mut buffer[..length])
|
pipe.read(&mut buffer[..length])
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ControlledChild(Child);
|
enum ControlledChild {
|
||||||
impl Drop for ControlledChild {
|
Standard(StandardChild),
|
||||||
|
Desktop(DesktopChild),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ControlledChild {
|
||||||
|
fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
|
||||||
|
match self {
|
||||||
|
Self::Standard(child) => {
|
||||||
|
if let Some(input) = &mut child.console_input {
|
||||||
|
input.check()?;
|
||||||
|
}
|
||||||
|
child.child.try_wait()
|
||||||
|
}
|
||||||
|
Self::Desktop(child) => child.try_wait(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct StandardChild {
|
||||||
|
child: Child,
|
||||||
|
console_input: Option<ConsoleInput>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for StandardChild {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let _ = self.0.kill();
|
let _ = self.child.kill();
|
||||||
let _ = self.0.wait();
|
let _ = self.child.wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
//! Relay a pasted browser callback from the elevated CLI's own console.
|
||||||
|
use std::{
|
||||||
|
fs::File,
|
||||||
|
io::{self, Write},
|
||||||
|
os::windows::io::{AsRawHandle, BorrowedHandle, FromRawHandle, OwnedHandle},
|
||||||
|
ptr,
|
||||||
|
sync::{
|
||||||
|
Arc,
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
|
},
|
||||||
|
thread::{self, JoinHandle},
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
|
use windows_sys::Win32::{
|
||||||
|
Foundation::{DUPLICATE_SAME_ACCESS, DuplicateHandle, ERROR_OPERATION_ABORTED, INVALID_HANDLE_VALUE},
|
||||||
|
System::{
|
||||||
|
Console::{GetConsoleMode, GetStdHandle, ReadConsoleW, STD_INPUT_HANDLE},
|
||||||
|
IO::CancelSynchronousIo,
|
||||||
|
Threading::GetCurrentProcess,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const MAX_CALLBACK_CHARS: usize = 64 * 1024;
|
||||||
|
|
||||||
|
pub(super) fn is_console(input: &OwnedHandle) -> bool {
|
||||||
|
let mut mode = 0;
|
||||||
|
unsafe { GetConsoleMode(input.as_raw_handle(), &mut mode) != 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) struct ConsoleInput {
|
||||||
|
stop: Arc<AtomicBool>,
|
||||||
|
worker: Option<JoinHandle<io::Result<()>>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ConsoleInput {
|
||||||
|
pub(super) fn start(input: OwnedHandle, output: File) -> io::Result<Self> {
|
||||||
|
let stop = Arc::new(AtomicBool::new(false));
|
||||||
|
let worker_stop = stop.clone();
|
||||||
|
let worker = thread::Builder::new().spawn(move || {
|
||||||
|
let line = read_line(input, &worker_stop)?;
|
||||||
|
if !worker_stop.load(Ordering::Relaxed) {
|
||||||
|
let mut output = output;
|
||||||
|
output.write_all(line.as_bytes())?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})?;
|
||||||
|
Ok(Self {
|
||||||
|
stop,
|
||||||
|
worker: Some(worker),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn check(&mut self) -> io::Result<()> {
|
||||||
|
if self.worker.as_ref().is_some_and(JoinHandle::is_finished) {
|
||||||
|
let worker = self.worker.take().expect("completed console reader");
|
||||||
|
worker
|
||||||
|
.join()
|
||||||
|
.map_err(|_| io::Error::other("Console reader stopped unexpectedly"))??;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for ConsoleInput {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if let Some(worker) = self.worker.take() {
|
||||||
|
self.stop.store(true, Ordering::Relaxed);
|
||||||
|
// Retry in case the worker was between checking stop and entering I/O.
|
||||||
|
// Join before returning so a failed sign-in cannot consume a later prompt.
|
||||||
|
while !worker.is_finished() {
|
||||||
|
unsafe { CancelSynchronousIo(worker.as_raw_handle()) };
|
||||||
|
thread::sleep(Duration::from_millis(5));
|
||||||
|
}
|
||||||
|
let _ = worker.join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_line(input: OwnedHandle, stop: &AtomicBool) -> io::Result<String> {
|
||||||
|
let mut text = Vec::new();
|
||||||
|
let mut buffer = [0u16; 4096];
|
||||||
|
while !stop.load(Ordering::Relaxed) {
|
||||||
|
let mut count = 0;
|
||||||
|
if unsafe {
|
||||||
|
ReadConsoleW(
|
||||||
|
input.as_raw_handle(),
|
||||||
|
buffer.as_mut_ptr().cast(),
|
||||||
|
buffer.len() as u32,
|
||||||
|
&mut count,
|
||||||
|
ptr::null(),
|
||||||
|
)
|
||||||
|
} == 0
|
||||||
|
{
|
||||||
|
let error = io::Error::last_os_error();
|
||||||
|
if error.raw_os_error() == Some(ERROR_OPERATION_ABORTED as i32) {
|
||||||
|
return Err(io::Error::new(io::ErrorKind::Interrupted, error));
|
||||||
|
}
|
||||||
|
return Err(error);
|
||||||
|
}
|
||||||
|
if count == 0 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let chunk = &buffer[..count as usize];
|
||||||
|
let newline = chunk.iter().position(|&ch| ch == b'\n' as u16);
|
||||||
|
text.extend_from_slice(&chunk[..newline.map_or(chunk.len(), |index| index + 1)]);
|
||||||
|
if text.len() > MAX_CALLBACK_CHARS {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::InvalidData,
|
||||||
|
"Browser callback is too long",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if newline.is_some() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String::from_utf16(&text).map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn terminal_input() -> io::Result<OwnedHandle> {
|
||||||
|
let input = unsafe { GetStdHandle(STD_INPUT_HANDLE) };
|
||||||
|
if input.is_null() || input == INVALID_HANDLE_VALUE {
|
||||||
|
return Err(io::Error::other("Manual browser sign-in requires terminal input"));
|
||||||
|
}
|
||||||
|
let input = unsafe { BorrowedHandle::borrow_raw(input) };
|
||||||
|
let process = unsafe { GetCurrentProcess() };
|
||||||
|
let mut duplicate = ptr::null_mut();
|
||||||
|
if unsafe {
|
||||||
|
DuplicateHandle(
|
||||||
|
process,
|
||||||
|
input.as_raw_handle(),
|
||||||
|
process,
|
||||||
|
&mut duplicate,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
DUPLICATE_SAME_ACCESS,
|
||||||
|
)
|
||||||
|
} == 0
|
||||||
|
{
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
Ok(unsafe { OwnedHandle::from_raw_handle(duplicate) })
|
||||||
|
}
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
//! Run the CLI's installed authenticator with the interactive user's standard token.
|
||||||
|
use std::{
|
||||||
|
env,
|
||||||
|
fs::File,
|
||||||
|
io,
|
||||||
|
os::windows::{
|
||||||
|
io::{AsHandle, AsRawHandle, FromRawHandle, OwnedHandle},
|
||||||
|
process::ExitStatusExt,
|
||||||
|
},
|
||||||
|
path::Path,
|
||||||
|
process::{Command, ExitStatus},
|
||||||
|
ptr,
|
||||||
|
};
|
||||||
|
use windows_sys::Win32::{
|
||||||
|
Foundation::{HANDLE, HANDLE_FLAG_INHERIT, SetHandleInformation, WAIT_OBJECT_0, WAIT_TIMEOUT},
|
||||||
|
Security::{
|
||||||
|
DuplicateTokenEx, SECURITY_ATTRIBUTES, SecurityImpersonation, TOKEN_DUPLICATE, TOKEN_QUERY, TokenElevation,
|
||||||
|
TokenPrimary, TokenSessionId,
|
||||||
|
},
|
||||||
|
System::{Pipes::CreatePipe, SystemServices::MAXIMUM_ALLOWED, Threading::*},
|
||||||
|
UI::WindowsAndMessaging::{GetShellWindow, GetWindowThreadProcessId},
|
||||||
|
};
|
||||||
|
|
||||||
|
use super::{
|
||||||
|
auth_bootstrap::AuthBootstrap,
|
||||||
|
command_runner::ChildInput,
|
||||||
|
console_input::{self, ConsoleInput},
|
||||||
|
user_process::{command_line, user_environment, wide},
|
||||||
|
};
|
||||||
|
use crate::{
|
||||||
|
collection::CollectionControl,
|
||||||
|
windows::{current_user_sid, token_u32, token_user_sid},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub(super) struct DesktopChild {
|
||||||
|
process: OwnedHandle,
|
||||||
|
console_input: Option<ConsoleInput>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DesktopChild {
|
||||||
|
pub(super) fn spawn(
|
||||||
|
command: &Command,
|
||||||
|
bootstrap: AuthBootstrap,
|
||||||
|
input: &ChildInput<'_>,
|
||||||
|
control: &dyn CollectionControl,
|
||||||
|
) -> io::Result<(Self, File, File, Option<File>)> {
|
||||||
|
let desktop = desktop_token()?;
|
||||||
|
let program = Path::new(command.get_program());
|
||||||
|
if !program.is_absolute() {
|
||||||
|
return Err(io::Error::new(
|
||||||
|
io::ErrorKind::InvalidInput,
|
||||||
|
"The authenticator path must be absolute",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let mut executable = wide(program.as_os_str())?;
|
||||||
|
let mut arguments = command_line(&executable, bootstrap.arguments())?;
|
||||||
|
executable.push(0);
|
||||||
|
let mut environment = user_environment(
|
||||||
|
desktop.as_handle(),
|
||||||
|
command
|
||||||
|
.get_envs()
|
||||||
|
.filter_map(|(name, value)| value.map(|value| (name, value))),
|
||||||
|
)?;
|
||||||
|
let working_directory = match command.get_current_dir() {
|
||||||
|
Some(directory) => directory.to_path_buf(),
|
||||||
|
None => env::current_dir()?,
|
||||||
|
};
|
||||||
|
let mut directory = wide(working_directory.as_os_str())?;
|
||||||
|
directory.push(0);
|
||||||
|
let (stdout, child_out) = pipe(false)?;
|
||||||
|
let (stderr, child_err) = pipe(false)?;
|
||||||
|
let mut console = None;
|
||||||
|
let (child_in, input_pipe) = match input {
|
||||||
|
ChildInput::Terminal => {
|
||||||
|
let terminal = console_input::terminal_input()?;
|
||||||
|
if console_input::is_console(&terminal) {
|
||||||
|
let (writer, reader) = pipe(true)?;
|
||||||
|
console = Some((terminal, File::from(writer)));
|
||||||
|
(reader, None)
|
||||||
|
} else {
|
||||||
|
(terminal, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChildInput::Null => {
|
||||||
|
let (writer, reader) = pipe(true)?;
|
||||||
|
drop(writer);
|
||||||
|
(reader, None)
|
||||||
|
}
|
||||||
|
ChildInput::Frame(_) => {
|
||||||
|
let (writer, reader) = pipe(true)?;
|
||||||
|
(reader, Some(File::from(writer)))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let startup = STARTUPINFOW {
|
||||||
|
cb: std::mem::size_of::<STARTUPINFOW>() as u32,
|
||||||
|
dwFlags: STARTF_USESTDHANDLES,
|
||||||
|
hStdInput: child_in.as_raw_handle(),
|
||||||
|
hStdOutput: child_out.as_raw_handle(),
|
||||||
|
hStdError: child_err.as_raw_handle(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let mut process = PROCESS_INFORMATION::default();
|
||||||
|
let mut flags = CREATE_UNICODE_ENVIRONMENT;
|
||||||
|
if !matches!(input, ChildInput::Terminal) {
|
||||||
|
flags |= CREATE_NO_WINDOW;
|
||||||
|
}
|
||||||
|
if unsafe {
|
||||||
|
CreateProcessWithTokenW(
|
||||||
|
desktop.as_raw_handle(),
|
||||||
|
0,
|
||||||
|
executable.as_ptr(),
|
||||||
|
arguments.as_mut_ptr(),
|
||||||
|
flags,
|
||||||
|
environment.as_mut_ptr().cast(),
|
||||||
|
directory.as_ptr(),
|
||||||
|
&startup,
|
||||||
|
&mut process,
|
||||||
|
)
|
||||||
|
} == 0
|
||||||
|
{
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
let mut child = Self {
|
||||||
|
process: unsafe { OwnedHandle::from_raw_handle(process.hProcess) },
|
||||||
|
console_input: None,
|
||||||
|
};
|
||||||
|
drop(unsafe { OwnedHandle::from_raw_handle(process.hThread) });
|
||||||
|
bootstrap.send_to_child(process.dwProcessId, control)?;
|
||||||
|
child.console_input = console
|
||||||
|
.map(|(terminal, writer)| ConsoleInput::start(terminal, writer))
|
||||||
|
.transpose()?;
|
||||||
|
Ok((child, File::from(stdout), File::from(stderr), input_pipe))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
|
||||||
|
if let Some(input) = &mut self.console_input {
|
||||||
|
input.check()?;
|
||||||
|
}
|
||||||
|
match unsafe { WaitForSingleObject(self.process.as_raw_handle(), 0) } {
|
||||||
|
WAIT_OBJECT_0 => {
|
||||||
|
let mut code = 0;
|
||||||
|
if unsafe { GetExitCodeProcess(self.process.as_raw_handle(), &mut code) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
Ok(Some(ExitStatus::from_raw(code)))
|
||||||
|
}
|
||||||
|
WAIT_TIMEOUT => Ok(None),
|
||||||
|
_ => Err(io::Error::last_os_error()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for DesktopChild {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
unsafe {
|
||||||
|
if WaitForSingleObject(self.process.as_raw_handle(), 0) == WAIT_TIMEOUT
|
||||||
|
&& TerminateProcess(self.process.as_raw_handle(), 1) != 0
|
||||||
|
{
|
||||||
|
WaitForSingleObject(self.process.as_raw_handle(), INFINITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn desktop_token() -> io::Result<OwnedHandle> {
|
||||||
|
let mut pid = 0;
|
||||||
|
let window = unsafe { GetShellWindow() };
|
||||||
|
if window.is_null() || unsafe { GetWindowThreadProcessId(window, &mut pid) } == 0 {
|
||||||
|
return Err(io::Error::other("Sign-in requires an interactive Windows desktop"));
|
||||||
|
}
|
||||||
|
let process = owned(unsafe { OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid) })?;
|
||||||
|
let mut token = ptr::null_mut();
|
||||||
|
if unsafe { OpenProcessToken(process.as_raw_handle(), TOKEN_QUERY | TOKEN_DUPLICATE, &mut token) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
let source = unsafe { OwnedHandle::from_raw_handle(token) };
|
||||||
|
if unsafe { token_user_sid(token) }? != current_user_sid()?
|
||||||
|
|| token_u32(source.as_handle(), TokenElevation)? != 0
|
||||||
|
|| token_u32(source.as_handle(), TokenSessionId)? != session_id()?
|
||||||
|
{
|
||||||
|
return Err(io::Error::other(
|
||||||
|
"Sign-in requires the terminal user's standard Windows desktop",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let mut primary = ptr::null_mut();
|
||||||
|
if unsafe {
|
||||||
|
// A linked token queried without SeTcbPrivilege may only be usable for identification.
|
||||||
|
// The shell already has the primary standard token in the interactive session.
|
||||||
|
DuplicateTokenEx(
|
||||||
|
token,
|
||||||
|
MAXIMUM_ALLOWED,
|
||||||
|
ptr::null(),
|
||||||
|
SecurityImpersonation,
|
||||||
|
TokenPrimary,
|
||||||
|
&mut primary,
|
||||||
|
)
|
||||||
|
} == 0
|
||||||
|
{
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
owned(primary)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn session_id() -> io::Result<u32> {
|
||||||
|
let mut session = 0;
|
||||||
|
if unsafe { windows_sys::Win32::System::RemoteDesktop::ProcessIdToSessionId(std::process::id(), &mut session) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
Ok(session)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn owned(handle: HANDLE) -> io::Result<OwnedHandle> {
|
||||||
|
if handle.is_null() || handle == windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
Ok(unsafe { OwnedHandle::from_raw_handle(handle) })
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns the parent's non-inheritable end, then the child's end.
|
||||||
|
fn pipe(parent_writes: bool) -> io::Result<(OwnedHandle, OwnedHandle)> {
|
||||||
|
let attributes = SECURITY_ATTRIBUTES {
|
||||||
|
nLength: std::mem::size_of::<SECURITY_ATTRIBUTES>() as u32,
|
||||||
|
bInheritHandle: 1,
|
||||||
|
lpSecurityDescriptor: ptr::null_mut(),
|
||||||
|
};
|
||||||
|
let mut read = ptr::null_mut();
|
||||||
|
let mut write = ptr::null_mut();
|
||||||
|
if unsafe { CreatePipe(&mut read, &mut write, &attributes, 0) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
let read = unsafe { OwnedHandle::from_raw_handle(read) };
|
||||||
|
let write = unsafe { OwnedHandle::from_raw_handle(write) };
|
||||||
|
let (parent, child) = if parent_writes { (write, read) } else { (read, write) };
|
||||||
|
if unsafe { SetHandleInformation(parent.as_raw_handle(), HANDLE_FLAG_INHERIT, 0) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
Ok((parent, child))
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ impl Drop for Environment {
|
|||||||
fn invalid(message: &str) -> io::Error {
|
fn invalid(message: &str) -> io::Error {
|
||||||
io::Error::new(io::ErrorKind::InvalidInput, message)
|
io::Error::new(io::ErrorKind::InvalidInput, message)
|
||||||
}
|
}
|
||||||
fn wide(value: &OsStr) -> io::Result<Vec<u16>> {
|
pub(super) fn wide(value: &OsStr) -> io::Result<Vec<u16>> {
|
||||||
let value: Vec<_> = value.encode_wide().collect();
|
let value: Vec<_> = value.encode_wide().collect();
|
||||||
if value.contains(&0) {
|
if value.contains(&0) {
|
||||||
return Err(invalid("Windows process strings cannot contain NUL"));
|
return Err(invalid("Windows process strings cannot contain NUL"));
|
||||||
@@ -63,12 +63,15 @@ fn quote(argument: &[u16], output: &mut Vec<u16>) {
|
|||||||
output.extend(std::iter::repeat_n(b'\\' as u16, backslashes * 2));
|
output.extend(std::iter::repeat_n(b'\\' as u16, backslashes * 2));
|
||||||
output.push(b'"' as u16);
|
output.push(b'"' as u16);
|
||||||
}
|
}
|
||||||
fn command_line(program: &[u16], arguments: &[String]) -> io::Result<Vec<u16>> {
|
pub(super) fn command_line<'a>(
|
||||||
|
program: &[u16],
|
||||||
|
arguments: impl IntoIterator<Item = &'a OsStr>,
|
||||||
|
) -> io::Result<Vec<u16>> {
|
||||||
let mut output = Vec::new();
|
let mut output = Vec::new();
|
||||||
quote(program, &mut output);
|
quote(program, &mut output);
|
||||||
for argument in arguments {
|
for argument in arguments {
|
||||||
output.push(b' ' as u16);
|
output.push(b' ' as u16);
|
||||||
quote(&wide(OsStr::new(argument))?, &mut output);
|
quote(&wide(argument)?, &mut output);
|
||||||
}
|
}
|
||||||
output.push(0);
|
output.push(0);
|
||||||
if output.len() > 32767 {
|
if output.len() > 32767 {
|
||||||
@@ -90,7 +93,10 @@ fn compare(left: &[u16], right: &[u16]) -> std::cmp::Ordering {
|
|||||||
unsafe { CompareStringOrdinal(left.as_ptr(), left.len() as i32, right.as_ptr(), right.len() as i32, 1) }
|
unsafe { CompareStringOrdinal(left.as_ptr(), left.len() as i32, right.as_ptr(), right.len() as i32, 1) }
|
||||||
.cmp(&CSTR_EQUAL)
|
.cmp(&CSTR_EQUAL)
|
||||||
}
|
}
|
||||||
fn user_environment(token: BorrowedHandle<'_>, variables: &[(&str, &str)]) -> io::Result<Vec<u16>> {
|
pub(super) fn user_environment<'a>(
|
||||||
|
token: BorrowedHandle<'_>,
|
||||||
|
variables: impl IntoIterator<Item = (&'a OsStr, &'a OsStr)>,
|
||||||
|
) -> io::Result<Vec<u16>> {
|
||||||
let mut pointer = ptr::null_mut();
|
let mut pointer = ptr::null_mut();
|
||||||
if unsafe { CreateEnvironmentBlock(&mut pointer, token.as_raw_handle(), 0) } == 0 {
|
if unsafe { CreateEnvironmentBlock(&mut pointer, token.as_raw_handle(), 0) } == 0 {
|
||||||
return Err(io::Error::last_os_error());
|
return Err(io::Error::last_os_error());
|
||||||
@@ -109,11 +115,11 @@ fn user_environment(token: BorrowedHandle<'_>, variables: &[(&str, &str)]) -> io
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (name, value) in variables {
|
for (name, value) in variables {
|
||||||
if name.is_empty() || name.contains('=') {
|
let name = wide(name)?;
|
||||||
|
if name.is_empty() || name.contains(&(b'=' as u16)) {
|
||||||
return Err(invalid("Invalid worker environment name"));
|
return Err(invalid("Invalid worker environment name"));
|
||||||
}
|
}
|
||||||
let name = wide(OsStr::new(name))?;
|
let value = wide(value)?;
|
||||||
let value = wide(OsStr::new(value))?;
|
|
||||||
entries.retain(|entry| compare(key(entry), &name) != std::cmp::Ordering::Equal);
|
entries.retain(|entry| compare(key(entry), &name) != std::cmp::Ordering::Equal);
|
||||||
let mut entry = name;
|
let mut entry = name;
|
||||||
entry.push(b'=' as u16);
|
entry.push(b'=' as u16);
|
||||||
@@ -145,9 +151,14 @@ impl UserProcess {
|
|||||||
return Err(invalid("Windows worker executable must be absolute"));
|
return Err(invalid("Windows worker executable must be absolute"));
|
||||||
}
|
}
|
||||||
let mut executable = wide(program.as_os_str())?;
|
let mut executable = wide(program.as_os_str())?;
|
||||||
let mut command = command_line(&executable, arguments)?;
|
let mut command = command_line(&executable, arguments.iter().map(OsStr::new))?;
|
||||||
executable.push(0);
|
executable.push(0);
|
||||||
let mut environment = user_environment(token, variables)?;
|
let mut environment = user_environment(
|
||||||
|
token,
|
||||||
|
variables
|
||||||
|
.iter()
|
||||||
|
.map(|(name, value)| (OsStr::new(name), OsStr::new(value))),
|
||||||
|
)?;
|
||||||
let directory = program.parent().ok_or_else(|| invalid("Worker directory is missing"))?;
|
let directory = program.parent().ok_or_else(|| invalid("Worker directory is missing"))?;
|
||||||
let mut directory = wide(directory.as_os_str())?;
|
let mut directory = wide(directory.as_os_str())?;
|
||||||
directory.push(0);
|
directory.push(0);
|
||||||
@@ -286,7 +297,7 @@ mod tests {
|
|||||||
"&|<>",
|
"&|<>",
|
||||||
]
|
]
|
||||||
.map(String::from);
|
.map(String::from);
|
||||||
let command = command_line(&program, &arguments).unwrap();
|
let command = command_line(&program, arguments.iter().map(OsStr::new)).unwrap();
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
unsafe {
|
unsafe {
|
||||||
let parsed = CommandLineToArgvW(command.as_ptr(), &mut count);
|
let parsed = CommandLineToArgvW(command.as_ptr(), &mut count);
|
||||||
|
|||||||
@@ -424,6 +424,8 @@ pub struct UpdateLogLevelRequest(pub String);
|
|||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum WsRequest {
|
pub enum WsRequest {
|
||||||
SetTunnelStatisticsEnabled { enabled: bool },
|
SetTunnelStatisticsEnabled { enabled: bool },
|
||||||
|
SetWindowsPatchInterest { enabled: bool },
|
||||||
|
RefreshWindowsPatches { after: Option<u64> },
|
||||||
Connect(Box<ConnectRequest>),
|
Connect(Box<ConnectRequest>),
|
||||||
Disconnect(DisconnectRequest),
|
Disconnect(DisconnectRequest),
|
||||||
StopNonTunnelAttachment { connection_id: uuid::Uuid },
|
StopNonTunnelAttachment { connection_id: uuid::Uuid },
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ pub enum ServiceResult {
|
|||||||
offset: usize,
|
offset: usize,
|
||||||
xml: String,
|
xml: String,
|
||||||
complete: bool,
|
complete: bool,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
windows_updates: Option<crate::hip::WindowsUpdateStatus>,
|
||||||
},
|
},
|
||||||
HipApprovalStatus(HipApprovalStatus),
|
HipApprovalStatus(HipApprovalStatus),
|
||||||
NoSubmittedHipReport,
|
NoSubmittedHipReport,
|
||||||
|
|||||||
@@ -8,6 +8,32 @@ use super::*;
|
|||||||
|
|
||||||
const MAX_ADDRESSES: usize = 64;
|
const MAX_ADDRESSES: usize = 64;
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
fn native_helper() -> anyhow::Result<PathBuf> {
|
||||||
|
Ok(common::binary_paths::gpclient())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn native_helper() -> anyhow::Result<PathBuf> {
|
||||||
|
windows_native_helper(&crate::windows::application_directory()?)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn windows_native_helper(directory: &std::path::Path) -> anyhow::Result<PathBuf> {
|
||||||
|
let installed = directory.join(r"bin\gpclient.exe");
|
||||||
|
if installed.is_file() {
|
||||||
|
return Ok(installed);
|
||||||
|
}
|
||||||
|
// Every Windows package includes build metadata. A missing bundled helper
|
||||||
|
// in that layout is a package error, even when a development override exists.
|
||||||
|
ensure!(
|
||||||
|
!directory.join("build-info.json").try_exists()?,
|
||||||
|
"The GP Connect package is missing its resolver helper: {}",
|
||||||
|
installed.display()
|
||||||
|
);
|
||||||
|
Ok(common::binary_paths::gpclient())
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn detect_in_helper(address: std::net::IpAddr, hostname: &str) -> anyhow::Result<bool> {
|
pub fn detect_in_helper(address: std::net::IpAddr, hostname: &str) -> anyhow::Result<bool> {
|
||||||
super::detection::validate_target(address, hostname)?;
|
super::detection::validate_target(address, hostname)?;
|
||||||
@@ -27,7 +53,7 @@ pub(in crate::session) async fn detect(
|
|||||||
"--hostname".into(),
|
"--hostname".into(),
|
||||||
hostname.into(),
|
hostname.into(),
|
||||||
];
|
];
|
||||||
let output = run_helper(common::binary_paths::gpclient(), args, cancellation.clone()).await?;
|
let output = run_helper(native_helper()?, args, cancellation.clone()).await?;
|
||||||
serde_json::from_slice(&output).context("Invalid internal detection helper response")
|
serde_json::from_slice(&output).context("Invalid internal detection helper response")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,14 +94,7 @@ pub(super) async fn resolve(
|
|||||||
if disable_ipv6 {
|
if disable_ipv6 {
|
||||||
args.push("--disable-ipv6".into());
|
args.push("--disable-ipv6".into());
|
||||||
}
|
}
|
||||||
run_resolver(
|
run_resolver(native_helper()?, args, port, disable_ipv6, cancellation.clone()).await
|
||||||
common::binary_paths::gpclient(),
|
|
||||||
args,
|
|
||||||
port,
|
|
||||||
disable_ipv6,
|
|
||||||
cancellation.clone(),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run_resolver(
|
async fn run_resolver(
|
||||||
@@ -147,6 +166,26 @@ fn validate_addresses(addresses: &[SocketAddr], port: u16, disable_ipv6: bool) -
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[test]
|
||||||
|
fn packaged_resolver_requires_the_bundled_cli() {
|
||||||
|
let package = tempfile::tempdir().unwrap();
|
||||||
|
let directory = package.path();
|
||||||
|
assert_eq!(
|
||||||
|
windows_native_helper(directory).unwrap(),
|
||||||
|
common::binary_paths::gpclient()
|
||||||
|
);
|
||||||
|
|
||||||
|
std::fs::write(directory.join("build-info.json"), "{}").unwrap();
|
||||||
|
let helper = directory.join(r"bin\gpclient.exe");
|
||||||
|
let error = windows_native_helper(directory).unwrap_err().to_string();
|
||||||
|
assert!(error.contains(&helper.display().to_string()), "{error}");
|
||||||
|
|
||||||
|
std::fs::create_dir(directory.join("bin")).unwrap();
|
||||||
|
std::fs::write(&helper, "").unwrap();
|
||||||
|
assert_eq!(windows_native_helper(directory).unwrap(), helper);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn actual_helper_output_is_validated_before_admission() {
|
async fn actual_helper_output_is_validated_before_admission() {
|
||||||
let addresses = run_resolver(
|
let addresses = run_resolver(
|
||||||
@@ -172,6 +211,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn cancellation_kills_and_joins_the_running_resolver_process() {
|
async fn cancellation_kills_and_joins_the_running_resolver_process() {
|
||||||
let file = tempfile::NamedTempFile::new().unwrap();
|
let file = tempfile::NamedTempFile::new().unwrap();
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ async fn post(
|
|||||||
crate::utils::request::ResponseBodyError::Transport(error) => GatewayRequestError::Transport(error),
|
crate::utils::request::ResponseBodyError::Transport(error) => GatewayRequestError::Transport(error),
|
||||||
crate::utils::request::ResponseBodyError::TooLarge => GatewayRequestError::ResponseTooLarge,
|
crate::utils::request::ResponseBodyError::TooLarge => GatewayRequestError::ResponseTooLarge,
|
||||||
})?;
|
})?;
|
||||||
|
crate::utils::log_response_xml(&format!("/ssl-vpn/{endpoint}"), status, &body);
|
||||||
parse_response(&body)
|
parse_response(&body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ impl Signer for ClientSigner {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
use openssl::{
|
use openssl::{
|
||||||
hash::MessageDigest,
|
hash::MessageDigest,
|
||||||
pkey::PKey,
|
pkey::PKey,
|
||||||
@@ -220,6 +221,7 @@ mod tests {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
fn native_key(bytes: &[u8]) -> ClientKey {
|
fn native_key(bytes: &[u8]) -> ClientKey {
|
||||||
let key = rustls_pemfile::private_key(&mut std::io::Cursor::new(bytes))
|
let key = rustls_pemfile::private_key(&mut std::io::Cursor::new(bytes))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@@ -227,6 +229,7 @@ mod tests {
|
|||||||
ClientKey::load(&key).unwrap()
|
ClientKey::load(&key).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[test]
|
#[test]
|
||||||
fn rsa_signatures_use_the_offered_scheme_and_tls_pss_salt_length() {
|
fn rsa_signatures_use_the_offered_scheme_and_tls_pss_salt_length() {
|
||||||
let bytes = fixture("rsa-pkcs8.pem");
|
let bytes = fixture("rsa-pkcs8.pem");
|
||||||
@@ -255,6 +258,7 @@ mod tests {
|
|||||||
assert!(key.choose_scheme(&[SignatureScheme::ECDSA_NISTP256_SHA256]).is_none());
|
assert!(key.choose_scheme(&[SignatureScheme::ECDSA_NISTP256_SHA256]).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[test]
|
#[test]
|
||||||
fn p256_signatures_verify_with_an_independent_backend() {
|
fn p256_signatures_verify_with_an_independent_backend() {
|
||||||
let bytes = fixture("ec-pkcs8.pem");
|
let bytes = fixture("ec-pkcs8.pem");
|
||||||
@@ -281,6 +285,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "openssl-tests")]
|
||||||
#[test]
|
#[test]
|
||||||
fn a_key_remains_usable_when_shared_clients_sign_concurrently() {
|
fn a_key_remains_usable_when_shared_clients_sign_concurrently() {
|
||||||
let key = native_key(&fixture("rsa-pkcs8.pem"));
|
let key = native_key(&fixture("rsa-pkcs8.pem"));
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ mod identity_encoding;
|
|||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
pub mod lock_file;
|
pub mod lock_file;
|
||||||
pub mod redact;
|
pub mod redact;
|
||||||
|
mod response_log;
|
||||||
|
pub(crate) use response_log::log_response_xml;
|
||||||
pub mod request;
|
pub mod request;
|
||||||
#[cfg(feature = "tauri")]
|
#[cfg(feature = "tauri")]
|
||||||
pub mod window;
|
pub mod window;
|
||||||
@@ -53,16 +55,23 @@ pub fn remove_url_scheme(s: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
#[error("GP response error: reason={reason}, status={status}, body={body}")]
|
#[error("GP response error: reason={reason}, status={status}")]
|
||||||
pub struct GpError {
|
pub struct GpError {
|
||||||
pub status: StatusCode,
|
pub status: StatusCode,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
body: String,
|
|
||||||
#[source]
|
#[source]
|
||||||
source: Option<reqwest::Error>,
|
source: Option<reqwest::Error>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GpError {
|
impl GpError {
|
||||||
|
pub(crate) fn take_body_read_error(&mut self) -> Option<reqwest::Error> {
|
||||||
|
if self.is_status_error() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
self.source.take()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_status_error(&self) -> bool {
|
pub fn is_status_error(&self) -> bool {
|
||||||
self.status.is_client_error() || self.status.is_server_error()
|
self.status.is_client_error() || self.status.is_server_error()
|
||||||
}
|
}
|
||||||
@@ -79,16 +88,20 @@ pub async fn parse_gp_response(res: Response) -> anyhow::Result<String, GpError>
|
|||||||
return Err(parse_gp_error(res).await);
|
return Err(parse_gp_error(res).await);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.text().await.map_err(|err| {
|
let path = log::log_enabled!(log::Level::Debug).then(|| res.url().path().to_owned());
|
||||||
|
let body = res.text().await.map_err(|err| {
|
||||||
warn!("Failed to read response: {}", err);
|
warn!("Failed to read response: {}", err);
|
||||||
|
|
||||||
GpError {
|
GpError {
|
||||||
status,
|
status,
|
||||||
reason: "failed to read response".to_string(),
|
reason: "failed to read response".to_string(),
|
||||||
body: "<failed to read response>".to_string(),
|
|
||||||
source: Some(err),
|
source: Some(err),
|
||||||
}
|
}
|
||||||
})
|
})?;
|
||||||
|
if let Some(path) = path {
|
||||||
|
log_response_xml(&path, status, body.as_bytes());
|
||||||
|
}
|
||||||
|
Ok(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn parse_gp_error(res: Response) -> GpError {
|
async fn parse_gp_error(res: Response) -> GpError {
|
||||||
@@ -99,15 +112,16 @@ async fn parse_gp_error(res: Response) -> GpError {
|
|||||||
.map_or_else(|| "<none>", |v| v.to_str().unwrap_or("<invalid header>"))
|
.map_or_else(|| "<none>", |v| v.to_str().unwrap_or("<invalid header>"))
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let (body, source) = match res.text().await {
|
let path = log::log_enabled!(log::Level::Debug).then(|| res.url().path().to_owned());
|
||||||
Ok(body) => (if body.is_empty() { "<empty>".to_string() } else { body }, None),
|
let source = match res.text().await {
|
||||||
Err(error) => ("<failed to read response>".to_string(), Some(error)),
|
Ok(body) => {
|
||||||
|
if let Some(path) = path {
|
||||||
|
log_response_xml(&path, status, body.as_bytes());
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
Err(error) => Some(error),
|
||||||
};
|
};
|
||||||
|
|
||||||
GpError {
|
GpError { status, reason, source }
|
||||||
status,
|
|
||||||
reason,
|
|
||||||
body,
|
|
||||||
source,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -266,6 +266,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unencrypted_key_ignores_unused_password_and_archive_owned_file_is_private() {
|
fn unencrypted_key_ignores_unused_password_and_archive_owned_file_is_private() {
|
||||||
|
#[cfg(unix)]
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
let identity = ClientIdentity::from_data(
|
let identity = ClientIdentity::from_data(
|
||||||
Zeroizing::new(CERTIFICATE.to_vec()),
|
Zeroizing::new(CERTIFICATE.to_vec()),
|
||||||
@@ -280,6 +281,7 @@ mod tests {
|
|||||||
let path = files.certificate().to_owned();
|
let path = files.certificate().to_owned();
|
||||||
assert!(path.ends_with(".p12"));
|
assert!(path.ends_with(".p12"));
|
||||||
assert!(files.key().is_none());
|
assert!(files.key().is_none());
|
||||||
|
#[cfg(unix)]
|
||||||
assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600);
|
assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600);
|
||||||
drop(files);
|
drop(files);
|
||||||
assert!(!Path::new(&path).exists());
|
assert!(!Path::new(&path).exists());
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
use gp_xml::redact_xml;
|
||||||
|
use reqwest::StatusCode;
|
||||||
|
|
||||||
|
pub(crate) fn log_response_xml(path: &str, status: StatusCode, body: &[u8]) {
|
||||||
|
if !log::log_enabled!(log::Level::Debug) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Redirect paths can themselves contain authentication tokens.
|
||||||
|
let endpoint = match path {
|
||||||
|
"/global-protect/prelogin.esp"
|
||||||
|
| "/ssl-vpn/prelogin.esp"
|
||||||
|
| "/global-protect/getconfig.esp"
|
||||||
|
| "/global-protect/getconfig_csc.esp"
|
||||||
|
| "/ssl-vpn/login.esp"
|
||||||
|
| "/ssl-vpn/getconfig.esp"
|
||||||
|
| "/ssl-vpn/agentmessage.esp"
|
||||||
|
| "/ssl-vpn/hipreportcheck.esp"
|
||||||
|
| "/ssl-vpn/hipreport.esp"
|
||||||
|
| "/ssl-vpn/logout.esp" => path,
|
||||||
|
_ => "[response endpoint]",
|
||||||
|
};
|
||||||
|
// Individual XML lines remain readable in macOS unified logs with limited record sizes.
|
||||||
|
for line in redact_xml(body).lines() {
|
||||||
|
log::debug!("{endpoint} response XML (HTTP {}): {line}", status.as_u16());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use xmltree::Element;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn preserves_policy_checks_and_redacts_authentication_material() {
|
||||||
|
let input = include_str!("../../tests/fixtures/portal-response.xml");
|
||||||
|
let xml = redact_xml(input.as_bytes());
|
||||||
|
let root = Element::parse(xml.as_bytes()).unwrap();
|
||||||
|
assert!(xml.contains("custom-checks") && xml.contains("HipID") && xml.contains("NV Domain"));
|
||||||
|
assert!(xml.contains("Corp.Example.test"));
|
||||||
|
assert!(xml.contains("com.1password.1password") && xml.contains("Version"));
|
||||||
|
for secret in [
|
||||||
|
"fixture-user-cookie",
|
||||||
|
"fixture-prelogon-cookie",
|
||||||
|
"fixture-csc-cookie",
|
||||||
|
"fixture-username",
|
||||||
|
"fixture-saml",
|
||||||
|
"fixture-attribute-token",
|
||||||
|
"fixture-property-password",
|
||||||
|
"fixture-cookie-name",
|
||||||
|
"fixture-query-token",
|
||||||
|
"fixture-url-password",
|
||||||
|
"fixture-comment",
|
||||||
|
"fixture-pi",
|
||||||
|
] {
|
||||||
|
assert!(!xml.contains(secret), "secret retained: {secret}");
|
||||||
|
}
|
||||||
|
assert_eq!(root.name, "policy");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
//! Windows user identity and private local IPC.
|
//! Windows user identity and private local IPC.
|
||||||
use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, OwnedHandle};
|
use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, OwnedHandle};
|
||||||
use std::{io, ptr};
|
use std::{
|
||||||
|
env, io,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
ptr,
|
||||||
|
};
|
||||||
mod pipes;
|
mod pipes;
|
||||||
pub use pipes::{PacketPipe, connect_service_admission, connect_service_worker, create_service_admission_pipe};
|
pub use pipes::{PacketPipe, connect_service_admission, connect_service_worker, create_service_admission_pipe};
|
||||||
use tokio::net::windows::named_pipe::NamedPipeServer;
|
use tokio::net::windows::named_pipe::NamedPipeServer;
|
||||||
@@ -22,6 +26,54 @@ pub fn current_user_sid() -> io::Result<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Locate bundled Windows helpers relative to the installed executable.
|
||||||
|
pub fn application_directory() -> std::io::Result<PathBuf> {
|
||||||
|
let executable = env::current_exe()?;
|
||||||
|
let directory = executable
|
||||||
|
.parent()
|
||||||
|
.ok_or_else(|| std::io::Error::other("Application directory is unavailable"))?;
|
||||||
|
if directory
|
||||||
|
.file_name()
|
||||||
|
.is_some_and(|name| name.eq_ignore_ascii_case("bin"))
|
||||||
|
&& executable
|
||||||
|
.file_name()
|
||||||
|
.is_some_and(|name| name.eq_ignore_ascii_case("gpclient.exe"))
|
||||||
|
{
|
||||||
|
return directory
|
||||||
|
.parent()
|
||||||
|
.map(Path::to_path_buf)
|
||||||
|
.ok_or_else(|| std::io::Error::other("GP Connect installation directory is unavailable"));
|
||||||
|
}
|
||||||
|
Ok(directory.to_path_buf())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_elevated() -> io::Result<bool> {
|
||||||
|
let mut token = ptr::null_mut();
|
||||||
|
if unsafe { OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &mut token) } == 0 {
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
let token = unsafe { OwnedHandle::from_raw_handle(token) };
|
||||||
|
Ok(token_u32(token.as_handle(), windows_sys::Win32::Security::TokenElevation)? != 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn token_u32(token: BorrowedHandle<'_>, field: i32) -> io::Result<u32> {
|
||||||
|
let mut value = 0u32;
|
||||||
|
let mut length = 0;
|
||||||
|
if unsafe {
|
||||||
|
GetTokenInformation(
|
||||||
|
token.as_raw_handle(),
|
||||||
|
field,
|
||||||
|
(&mut value as *mut u32).cast(),
|
||||||
|
4,
|
||||||
|
&mut length,
|
||||||
|
)
|
||||||
|
} == 0
|
||||||
|
{
|
||||||
|
return Err(io::Error::last_os_error());
|
||||||
|
}
|
||||||
|
Ok(value)
|
||||||
|
}
|
||||||
|
|
||||||
/// An authenticated pipe client's primary token, retained for its user-session worker.
|
/// An authenticated pipe client's primary token, retained for its user-session worker.
|
||||||
/// Windows user identity is a SID and token; it is never represented as a Unix UID.
|
/// Windows user identity is a SID and token; it is never represented as a Unix UID.
|
||||||
pub struct PipeClientIdentity {
|
pub struct PipeClientIdentity {
|
||||||
@@ -111,7 +163,7 @@ pub fn process_user_sid(pid: u32) -> io::Result<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn token_user_sid(token: windows_sys::Win32::Foundation::HANDLE) -> io::Result<String> {
|
pub(crate) unsafe fn token_user_sid(token: windows_sys::Win32::Foundation::HANDLE) -> io::Result<String> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut length = 0;
|
let mut length = 0;
|
||||||
GetTokenInformation(token, TokenUser, ptr::null_mut(), 0, &mut length);
|
GetTokenInformation(token, TokenUser, ptr::null_mut(), 0, &mut length);
|
||||||
|
|||||||
Loaded 100 of 150 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user