mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-17 13:46:27 -05:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05814e9da7 | ||
|
|
cc43a88ade | ||
|
|
b5f3bac256 | ||
|
|
688e3e4ee7 | ||
|
|
2f76b3d4eb | ||
|
|
c67998a540 | ||
|
|
bdd2fc9883 | ||
|
|
91c480c274 | ||
|
|
ba1a70f3ce | ||
|
|
56c3babfe7 | ||
|
|
a91c04fa64 | ||
|
|
739cf7234b | ||
|
|
24d935ea61 | ||
|
|
00a92dabeb | ||
|
|
05b63991a8 | ||
|
|
42ac612916 | ||
|
|
56516abc62 | ||
|
|
308957283b | ||
|
|
0425ee6ddb | ||
|
|
9d8c3b4e34 | ||
|
|
9e4f45997e | ||
|
|
e2a64ed7d4 | ||
|
|
3882e29b0e | ||
|
|
32bac9b675 | ||
|
|
0e1aedce82 | ||
|
|
8eb4d48887 | ||
|
|
87f91e3c13 |
No files matched your search
@@ -313,11 +313,14 @@ jobs:
|
||||
cd gpgui-source
|
||||
tar -czf gpgui.tar.gz gpgui gp
|
||||
- name: Build gpgui in Docker
|
||||
env:
|
||||
GPGUI_LICENSE_SIGNING_KEYS: ${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e COREPACK_INTEGRITY_KEYS=0 \
|
||||
-e GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }} \
|
||||
-e GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }} \
|
||||
-e GPGUI_LICENSE_SIGNING_KEYS \
|
||||
-v $(pwd)/gpgui-source:/workspace yuezk/gpdev:${{ matrix.libc.builder }}
|
||||
- name: Install gpgui in Docker
|
||||
run: |
|
||||
@@ -568,6 +571,7 @@ jobs:
|
||||
set -eu
|
||||
export GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }}
|
||||
export GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }}
|
||||
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
||||
|
||||
cd "${{ matrix.workspace }}/gp"
|
||||
cargo build --release --workspace
|
||||
@@ -591,22 +595,23 @@ jobs:
|
||||
arch: ${{ matrix.arch }}
|
||||
usesh: true
|
||||
prepare: |
|
||||
pkg_add -z \
|
||||
set -eu
|
||||
pkg_add -u -I
|
||||
pkg_add -I \
|
||||
git \
|
||||
rust \
|
||||
libiconv \
|
||||
gettext-tools \
|
||||
autoconf-2.72 \
|
||||
automake-1.17 \
|
||||
autoconf%2.72 \
|
||||
automake%1.17 \
|
||||
libtool \
|
||||
patch \
|
||||
gmake \
|
||||
pkgconf \
|
||||
libxml \
|
||||
gnutls \
|
||||
p11-kit \
|
||||
nettle \
|
||||
gmp \
|
||||
lz4 \
|
||||
dbus \
|
||||
gnome-keyring \
|
||||
polkit \
|
||||
webkitgtk41 \
|
||||
@@ -623,6 +628,7 @@ jobs:
|
||||
export AUTOMAKE_VERSION=1.17
|
||||
export GPGUI_BUILD_VERSION=${{ github.run_number }}.${{ github.run_attempt }}
|
||||
export GPGUI_UPDATE_CHANNEL=${{ github.event_name == 'workflow_dispatch' && 'snapshot' || 'stable' }}
|
||||
export GPGUI_LICENSE_SIGNING_KEYS='${{ vars.GPGUI_LICENSE_SIGNING_KEYS }}'
|
||||
|
||||
cd "${{ matrix.workspace }}/gp"
|
||||
cargo build --release --workspace
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
name: Nix
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "flake.nix"
|
||||
- "flake.lock"
|
||||
- "nix/**"
|
||||
- ".github/workflows/nix.yaml"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "flake.nix"
|
||||
- "flake.lock"
|
||||
- "nix/**"
|
||||
- ".github/workflows/nix.yaml"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
standalone-package:
|
||||
name: standalone-package (${{ matrix.platform.system }})
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- runner: ubuntu-latest
|
||||
system: x86_64-linux
|
||||
- runner: ubuntu-24.04-arm
|
||||
system: aarch64-linux
|
||||
runs-on: ${{ matrix.platform.runner }}
|
||||
steps:
|
||||
- name: Checkout GlobalProtect-openconnect
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v31
|
||||
|
||||
- name: Build standalone prebuilt package
|
||||
run: |
|
||||
nix build .#prebuilt \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--print-build-logs
|
||||
|
||||
- name: Inspect prebuilt package
|
||||
run: |
|
||||
test -x result/bin/gpclient
|
||||
test -x result/bin/gpauth
|
||||
test -x result/bin/gpservice
|
||||
test -x result/bin/gpgui-helper
|
||||
test -x result/bin/gpgui
|
||||
|
||||
nixos-module:
|
||||
name: nixos-module (${{ matrix.platform.system }}, ${{ matrix.nixpkgs }})
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- runner: ubuntu-latest
|
||||
system: x86_64-linux
|
||||
- runner: ubuntu-24.04-arm
|
||||
system: aarch64-linux
|
||||
nixpkgs:
|
||||
- nixos-25.11
|
||||
- nixos-26.05
|
||||
- nixpkgs-unstable
|
||||
runs-on: ${{ matrix.platform.runner }}
|
||||
steps:
|
||||
- name: Checkout GlobalProtect-openconnect
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v31
|
||||
|
||||
- name: Build package through host NixOS module
|
||||
env:
|
||||
NIXPKGS_URL: github:NixOS/nixpkgs/${{ matrix.nixpkgs }}
|
||||
NIX_SYSTEM: ${{ matrix.platform.system }}
|
||||
run: |
|
||||
nix build \
|
||||
--impure \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--print-build-logs \
|
||||
--expr '
|
||||
let
|
||||
gp = builtins.getFlake (toString ./.);
|
||||
hostNixpkgs =
|
||||
builtins.getFlake (builtins.getEnv "NIXPKGS_URL");
|
||||
|
||||
hostSystem = hostNixpkgs.lib.nixosSystem {
|
||||
system = builtins.getEnv "NIX_SYSTEM";
|
||||
modules = [
|
||||
gp.nixosModules.default
|
||||
{
|
||||
programs.globalprotect-openconnect.enable = true;
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
package =
|
||||
hostSystem.config.programs.globalprotect-openconnect.package;
|
||||
in
|
||||
assert builtins.elem package
|
||||
hostSystem.config.environment.systemPackages;
|
||||
assert hostSystem.config.services.ayatana-indicators.enable;
|
||||
package
|
||||
'
|
||||
|
||||
- name: Inspect module package
|
||||
run: |
|
||||
test -x result/bin/gpclient
|
||||
test -x result/bin/gpauth
|
||||
test -x result/bin/gpservice
|
||||
test -x result/bin/gpgui-helper
|
||||
test -x result/bin/gpgui
|
||||
@@ -19,7 +19,7 @@ on:
|
||||
description: 'Rust version to use'
|
||||
type: "string"
|
||||
required: true
|
||||
default: "1.89"
|
||||
default: "1.91"
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -24,6 +24,11 @@ jobs:
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v31
|
||||
|
||||
- name: Update Nixpkgs lock
|
||||
run: |
|
||||
nix flake update nixpkgs \
|
||||
--extra-experimental-features "nix-command flakes"
|
||||
|
||||
- name: Update flake hashes
|
||||
env:
|
||||
RELEASE_VERSION: ${{ inputs.version }}
|
||||
@@ -39,7 +44,9 @@ jobs:
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: updated-flake
|
||||
path: flake.nix
|
||||
path: |
|
||||
flake.nix
|
||||
flake.lock
|
||||
if-no-files-found: error
|
||||
|
||||
validate-nix-prebuilt:
|
||||
@@ -48,22 +55,22 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- runner: ubuntu-latest
|
||||
nixpkgs: nixos-25.11
|
||||
- runner: ubuntu-latest
|
||||
nixpkgs: nixos-26.05
|
||||
runner:
|
||||
- ubuntu-latest
|
||||
- ubuntu-24.04-arm
|
||||
nixpkgs:
|
||||
- locked
|
||||
- nixos-25.11
|
||||
- nixos-26.05
|
||||
- nixpkgs-unstable
|
||||
exclude:
|
||||
- runner: ubuntu-24.04-arm
|
||||
nixpkgs: nixos-25.11
|
||||
- runner: ubuntu-24.04-arm
|
||||
nixpkgs: nixos-26.05
|
||||
nixpkgs: locked
|
||||
name: validate-nix-prebuilt (${{ matrix.nixpkgs }}, ${{ matrix.runner }})
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout GlobalProtect-openconnect
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Download updated flake
|
||||
uses: actions/download-artifact@v8
|
||||
@@ -75,11 +82,19 @@ jobs:
|
||||
uses: cachix/install-nix-action@v31
|
||||
|
||||
- name: Build prebuilt Nix package
|
||||
env:
|
||||
NIXPKGS: ${{ matrix.nixpkgs }}
|
||||
run: |
|
||||
nix build .#prebuilt \
|
||||
--override-input nixpkgs "github:NixOS/nixpkgs/${{ matrix.nixpkgs }}" \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--print-build-logs
|
||||
if [[ "$NIXPKGS" == "locked" ]]; then
|
||||
nix build .#prebuilt \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--print-build-logs
|
||||
else
|
||||
nix build .#prebuilt \
|
||||
--override-input nixpkgs "github:NixOS/nixpkgs/$NIXPKGS" \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--print-build-logs
|
||||
fi
|
||||
|
||||
- name: Inspect prebuilt Nix package
|
||||
run: |
|
||||
|
||||
+1
-2
@@ -1,4 +1,5 @@
|
||||
.idea
|
||||
.DS_Store
|
||||
/target
|
||||
.pnpm-store
|
||||
.env
|
||||
@@ -15,5 +16,3 @@ gen
|
||||
|
||||
# Nix files
|
||||
result
|
||||
|
||||
.DS_Store
|
||||
Generated
+666
-587
File diff suppressed because it is too large.
Load diff
+7
-1
@@ -10,7 +10,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
rust-version = "1.89"
|
||||
rust-version = "1.91"
|
||||
version = "2.6.5"
|
||||
authors = ["Kevin Yue <[email protected]>"]
|
||||
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
|
||||
@@ -67,6 +67,12 @@ tauri = { version = "2" }
|
||||
specta = "=2.0.0-rc.20"
|
||||
proptest = "1"
|
||||
|
||||
[patch.crates-io]
|
||||
# Restore BSD GTK resize hit testing until https://github.com/tauri-apps/tao/pull/1356 is released.
|
||||
tao = { git = "https://github.com/yuezk/tao", rev = "1452ae7a42c9f134296ba199f91f514fc9077f61" }
|
||||
# Use one macro source for Tao and Wry so Cargo can vendor the workspace.
|
||||
tao-macros = { git = "https://github.com/yuezk/tao", rev = "1452ae7a42c9f134296ba199f91f514fc9077f61" }
|
||||
|
||||
[profile.release]
|
||||
opt-level = 'z' # Optimize for size
|
||||
lto = true # Enable link-time optimization
|
||||
|
||||
@@ -4,7 +4,7 @@ SHELL := /bin/sh
|
||||
INCLUDE_GUI ?= 0
|
||||
CARGO ?= cargo
|
||||
DISABLE_RUST_TOOLCHAIN ?= 0
|
||||
RUST_VERSION ?= 1.89
|
||||
RUST_VERSION ?= 1.91
|
||||
IGNORE_RUST_VERSION ?= 0
|
||||
|
||||
VERSION = $(shell grep '^version' Cargo.toml | head -1 | sed 's/version *= *"\(.*\)"/\1/')
|
||||
@@ -145,6 +145,8 @@ install:
|
||||
install -Dm755 target/release/gpclient $(DESTDIR)/usr/bin/gpclient
|
||||
install -Dm755 target/release/gpauth $(DESTDIR)/usr/bin/gpauth
|
||||
install -Dm755 target/release/gpservice $(DESTDIR)/usr/bin/gpservice
|
||||
install -Dm755 target/release/gp-hip-runner $(DESTDIR)/usr/libexec/gpclient/gp-hip-runner
|
||||
install -Dm755 target/release/gp-hip-script-installer $(DESTDIR)/usr/libexec/gpclient/gp-hip-script-installer
|
||||
install -Dm755 target/release/gp-vpnc-script-installer $(DESTDIR)/usr/libexec/gpclient/gp-vpnc-script-installer
|
||||
|
||||
# Install the GUI components if BUILD_GUI_HELPER is set to 1
|
||||
@@ -169,6 +171,12 @@ install:
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/256x256/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/gpgui.png
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/256x256@2/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg
|
||||
install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg
|
||||
install -Dm644 packaging/files/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
install-bsd:
|
||||
@@ -188,6 +196,8 @@ install-bsd:
|
||||
fi
|
||||
|
||||
install -d $(DESTDIR)$(PREFIX)/libexec/gpclient
|
||||
install -m 755 target/release/gp-hip-runner $(DESTDIR)$(PREFIX)/libexec/gpclient/gp-hip-runner
|
||||
install -m 755 target/release/gp-hip-script-installer $(DESTDIR)$(PREFIX)/libexec/gpclient/gp-hip-script-installer
|
||||
install -m 755 target/release/gp-vpnc-script-installer $(DESTDIR)$(PREFIX)/libexec/gpclient/gp-vpnc-script-installer
|
||||
install -m 755 packaging/files/usr/libexec/gpclient/vpnc-script $(DESTDIR)$(PREFIX)/libexec/gpclient/vpnc-script
|
||||
install -m 755 packaging/files/usr/libexec/gpclient/hipreport.sh $(DESTDIR)$(PREFIX)/libexec/gpclient/hipreport.sh
|
||||
@@ -199,11 +209,18 @@ install-bsd:
|
||||
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps
|
||||
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps
|
||||
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256@2/apps
|
||||
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/status
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/gpgui.svg
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps/gpgui.png
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/gpgui.png
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/256x256/apps/gpgui.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/gpgui.png
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/256x256@2/apps/gpgui.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg
|
||||
install -m 644 packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg
|
||||
install -d $(DESTDIR)$(PREFIX)/share/polkit-1/actions
|
||||
install -m 644 packaging/bsd/com.yuezk.gpgui.policy $(DESTDIR)$(PREFIX)/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
@@ -259,6 +276,7 @@ package-openbsd: clean-bsd-package
|
||||
comment=$$(cat .build/openbsd/+COMMENT); \
|
||||
openbsd_arch=$$(uname -m | sed 's/x86_64/amd64/'); \
|
||||
gnome_keyring_pkg=$$(pkg_info -e 'gnome-keyring-*' | sed 's/^inst://' | head -n 1); \
|
||||
dbus_pkg=$$(pkg_info -e 'dbus-*' | sed 's/^inst://' | head -n 1); \
|
||||
polkit_pkg=$$(pkg_info -e 'polkit-*' | sed 's/^inst://' | head -n 1); \
|
||||
webkitgtk_pkg=$$(pkg_info -e 'webkitgtk41-*' | sed 's/^inst://' | head -n 1); \
|
||||
xdg_utils_pkg=$$(pkg_info -e 'xdg-utils-*' | sed 's/^inst://' | head -n 1); \
|
||||
@@ -269,6 +287,7 @@ package-openbsd: clean-bsd-package
|
||||
-f .build/openbsd/PLIST \
|
||||
-p $(PREFIX) \
|
||||
-P x11/gnome/keyring:gnome-keyring-*:$$gnome_keyring_pkg \
|
||||
-P x11/dbus:dbus-*:$$dbus_pkg \
|
||||
-P sysutils/polkit:polkit-*:$$polkit_pkg \
|
||||
-P www/webkitgtk4,webkitgtk41:webkitgtk41-*:$$webkitgtk_pkg \
|
||||
-P devel/xdg-utils:xdg-utils-*:$$xdg_utils_pkg \
|
||||
@@ -281,6 +300,8 @@ uninstall:
|
||||
rm -f $(DESTDIR)/usr/bin/gpclient
|
||||
rm -f $(DESTDIR)/usr/bin/gpauth
|
||||
rm -f $(DESTDIR)/usr/bin/gpservice
|
||||
rm -f $(DESTDIR)/usr/libexec/gpclient/gp-hip-runner
|
||||
rm -f $(DESTDIR)/usr/libexec/gpclient/gp-hip-script-installer
|
||||
rm -f $(DESTDIR)/usr/bin/gpgui-helper
|
||||
rm -f $(DESTDIR)/usr/bin/gpgui
|
||||
|
||||
@@ -297,6 +318,12 @@ uninstall:
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
rm -f $(DESTDIR)/var/lib/gpclient/gpgui \
|
||||
|
||||
@@ -241,7 +241,10 @@ This repository includes a flake for NixOS integration.
|
||||
|
||||
#### Installation Steps
|
||||
|
||||
Add the flake input and package to your `flake.nix`:
|
||||
Add the flake input and NixOS module to your `flake.nix`:
|
||||
|
||||
The module builds the package with your NixOS configuration's `pkgs`, so the
|
||||
GlobalProtect GUI and the system use the same Nixpkgs dependency versions.
|
||||
|
||||
```nix
|
||||
{
|
||||
@@ -260,11 +263,11 @@ Add the flake input and package to your `flake.nix`:
|
||||
|
||||
modules = [
|
||||
./configuration.nix
|
||||
globalprotect-openconnect.nixosModules.default
|
||||
{
|
||||
services.ayatana-indicators.enable = true;
|
||||
programs.globalprotect-openconnect.enable = true;
|
||||
|
||||
environment.systemPackages = [
|
||||
globalprotect-openconnect.packages.${system}.default
|
||||
nixpkgs.legacyPackages.${system}.gnomeExtensions.appindicator
|
||||
];
|
||||
}
|
||||
@@ -424,7 +427,7 @@ This project includes a DevContainer configuration that provides a consistent, r
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- [Rust 1.89 or later](https://www.rust-lang.org/tools/install)
|
||||
- [Rust 1.91 or later](https://www.rust-lang.org/tools/install)
|
||||
- [Tauri dependencies](https://tauri.app/start/prerequisites/)
|
||||
- OpenConnect source-build dependencies: `autoconf`, `automake`, `autopoint`/`gettext`, `libtool`, `patch`, `pkg-config`, `libxml2`, `zlib`, `lz4`, `gnutls`, `p11-kit`, `nettle`, and `gmp` development packages
|
||||
- `pkexec` and `gnome-keyring` (or `pam_kwallet` on KDE)
|
||||
|
||||
@@ -9,11 +9,10 @@ license.workspace = true
|
||||
[dependencies]
|
||||
common = { path = "../../crates/common" }
|
||||
gpapi = { path = "../../crates/gpapi", features = ["clap"] }
|
||||
gphip = { path = "../../crates/gphip" }
|
||||
openconnect = { path = "../../crates/openconnect" }
|
||||
|
||||
anyhow.workspace = true
|
||||
askama.workspace = true
|
||||
chrono.workspace = true
|
||||
clap.workspace = true
|
||||
env_logger.workspace = true
|
||||
inquire = "0.9"
|
||||
@@ -22,15 +21,12 @@ tokio = { workspace = true, features = ["rt-multi-thread"] }
|
||||
sysinfo.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde_urlencoded.workspace = true
|
||||
whoami.workspace = true
|
||||
tempfile.workspace = true
|
||||
reqwest.workspace = true
|
||||
directories.workspace = true
|
||||
compile-time.workspace = true
|
||||
netdev.workspace = true
|
||||
xmltree.workspace = true
|
||||
uuid = { workspace = true, features = ["v5"] }
|
||||
uzers.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["webview-auth"]
|
||||
|
||||
@@ -119,6 +119,7 @@ impl Cli {
|
||||
fn can_run_alongside_client(&self) -> bool {
|
||||
match &self.command {
|
||||
CliCommand::Disconnect(_) => true,
|
||||
CliCommand::Hip(_) => true,
|
||||
CliCommand::LaunchGui(args) => args.is_auth_callback(),
|
||||
_ => false,
|
||||
}
|
||||
@@ -240,6 +241,25 @@ mod tests {
|
||||
assert_eq!(cli.lock_file, PathBuf::from("/tmp/gpclient-portal.lock"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hip_can_run_alongside_connected_client() {
|
||||
let cli = Cli::try_parse_from([
|
||||
"gpclient",
|
||||
"hip",
|
||||
"--client-version",
|
||||
"6.2.4-49",
|
||||
"--client-os",
|
||||
"Mac",
|
||||
"--cookie",
|
||||
"user=alice",
|
||||
"--md5",
|
||||
"test",
|
||||
])
|
||||
.expect("HIP arguments should parse");
|
||||
|
||||
assert!(cli.can_run_alongside_client());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
fn launch_gui_accepts_auth_callback() {
|
||||
|
||||
@@ -149,6 +149,14 @@ pub(crate) struct ConnectArgs {
|
||||
|
||||
#[arg(long, help = "Listen on this IP address when using '--browser remote'")]
|
||||
pub(super) browser_listen: Option<IpAddr>,
|
||||
|
||||
#[arg(
|
||||
long,
|
||||
help = "Authenticate and print the gateway cookie to stdout, then exit without starting the \
|
||||
VPN tunnel. Outputs two lines: COOKIE='<value>' and HOST='<gateway>'. Combine with \
|
||||
--cookie-cache to avoid re-authenticating when the portal session is still valid."
|
||||
)]
|
||||
pub(super) cookie_only: bool,
|
||||
}
|
||||
|
||||
pub(super) fn build_os_profile(args: &ConnectArgs) -> OsProfile {
|
||||
@@ -418,4 +426,23 @@ mod tests {
|
||||
};
|
||||
assert_eq!(err.kind(), ErrorKind::ArgumentConflict);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cookie_only_flag_parses() {
|
||||
use clap::Parser;
|
||||
|
||||
let cli = ConnectArgsTestCli::try_parse_from(["test", "portal.example.com", "--cookie-only"])
|
||||
.expect("--cookie-only should parse");
|
||||
|
||||
assert!(cli.args.cookie_only);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cookie_only_is_disabled_by_default() {
|
||||
use clap::Parser;
|
||||
|
||||
let cli = ConnectArgsTestCli::try_parse_from(["test", "portal.example.com"]).expect("connect args should parse");
|
||||
|
||||
assert!(!cli.args.cookie_only);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ use gpapi::{
|
||||
gp_params::GpParams,
|
||||
os_profile::OsProfile,
|
||||
portal::prelogin,
|
||||
process::users::{get_non_root_user, get_user_by_name},
|
||||
process::users::get_user_by_name,
|
||||
utils::shutdown_signal,
|
||||
};
|
||||
use inquire::Text;
|
||||
@@ -341,6 +341,16 @@ impl ConnectHandler<'_> {
|
||||
allow_extend_session: bool,
|
||||
extension_auth: SessionExtensionAuth,
|
||||
) -> Result<(), GatewayConnectError> {
|
||||
// --cookie-only: print the gateway cookie and exit without opening a tunnel.
|
||||
// No tun device is allocated, no root is required, and no logout is issued
|
||||
// against the gateway — the cookie remains valid for subsequent use.
|
||||
// Output format matches openconnect --authenticate for easy shell consumption.
|
||||
if self.args.cookie_only {
|
||||
println!("COOKIE='{}'", cookie);
|
||||
println!("HOST='{}'", gateway);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let mtu = self.args.mtu.unwrap_or(0);
|
||||
let (hip, csd_wrapper) = self.determine_hip_script();
|
||||
let hip_user = self.determine_hip_user();
|
||||
@@ -489,7 +499,7 @@ fn get_uid(user: &Option<String>) -> anyhow::Result<u32> {
|
||||
if let Some(user) = user {
|
||||
get_user_by_name(user).map(|user| user.uid())
|
||||
} else {
|
||||
get_non_root_user().map_or_else(|_| Ok(0), |user| Ok(user.uid()))
|
||||
Ok(uzers::get_effective_uid())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,6 +516,23 @@ fn apply_os_profile(builder: VpnBuilder, profile: &OsProfile) -> VpnBuilder {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn hip_script_defaults_to_process_effective_uid() {
|
||||
assert_eq!(get_uid(&None).unwrap(), uzers::get_effective_uid());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explicit_hip_user_must_exist() {
|
||||
assert!(get_uid(&Some("gpclient-nonexistent-hip-user".to_string())).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn explicit_hip_user_resolves_to_the_selected_account() {
|
||||
let current = uzers::get_user_by_uid(uzers::get_effective_uid()).unwrap();
|
||||
let name = current.name().to_string_lossy().into_owned();
|
||||
assert_eq!(get_uid(&Some(name)).unwrap(), current.uid());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn openconnect_success_is_not_a_gateway_failure() {
|
||||
assert!(classify_openconnect_result(0, false, false).is_ok());
|
||||
|
||||
+18
-536
@@ -1,122 +1,9 @@
|
||||
use askama::Template;
|
||||
use clap::Args;
|
||||
use gpapi::{
|
||||
clap::args::Os,
|
||||
os_profile::{ClientOs, OsProfile, OsProfileBuilder},
|
||||
os_profile::{ClientOs, OsProfileBuilder},
|
||||
};
|
||||
use log::debug;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::process::Command;
|
||||
use xmltree::Element;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "hip_report.xml")]
|
||||
struct HipReportTemplate<'a> {
|
||||
client_version: &'a str,
|
||||
generate_time: String,
|
||||
day: String,
|
||||
month: String,
|
||||
year: String,
|
||||
user_name: &'a str,
|
||||
host_info: HostInfo,
|
||||
md5: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
struct DefenderInfo {
|
||||
#[serde(rename = "appVersion")]
|
||||
app_version: String,
|
||||
#[serde(rename = "engineVersion")]
|
||||
engine_version: String,
|
||||
#[serde(rename = "definitionsVersion")]
|
||||
definitions_version: String,
|
||||
#[serde(rename = "realTimeProtectionEnabled")]
|
||||
real_time_protection_enabled: RealTimeProtection,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
struct RealTimeProtection {
|
||||
value: bool,
|
||||
}
|
||||
|
||||
/// Host information for HIP reporting
|
||||
struct HostInfo {
|
||||
/// Common for all OSes, e.g., "Apple", "Microsoft", "Linux"
|
||||
os_vendor: String,
|
||||
/// Common for all OSes, e.g., "Linux Ubuntu 20.04", "Apple Mac OS X 10.15.7", etc.
|
||||
os_version: String,
|
||||
/// Per-OS machine identifier (UUID for Linux/Windows, MAC for macOS)
|
||||
host_id: String,
|
||||
/// Common for all OSes
|
||||
host_name: String,
|
||||
/// Only for macOS and Windows, e.g., "10.15.7", "10.0.19044.2130"
|
||||
software_version: String,
|
||||
domain: String,
|
||||
network_interfaces: Vec<NetworkInterface>,
|
||||
defender: Option<DefenderInfo>,
|
||||
}
|
||||
|
||||
impl HostInfo {
|
||||
/// Get the first available IPv4 address from network interfaces
|
||||
pub fn default_ipv4(&self) -> &str {
|
||||
self
|
||||
.network_interfaces
|
||||
.first()
|
||||
.and_then(|iface| iface.ipv4.as_deref())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Get the first available IPv6 address from network interfaces
|
||||
pub fn default_ipv6(&self) -> &str {
|
||||
self
|
||||
.network_interfaces
|
||||
.first()
|
||||
.and_then(|iface| iface.ipv6.as_deref())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Network interface information
|
||||
#[derive(Clone)]
|
||||
struct NetworkInterface {
|
||||
name: String,
|
||||
description: String,
|
||||
mac_address: Option<String>,
|
||||
ipv4: Option<String>,
|
||||
ipv6: Option<String>,
|
||||
}
|
||||
|
||||
impl NetworkInterface {
|
||||
/// Create a new network interface with basic information
|
||||
fn new(name: String, description: String) -> Self {
|
||||
Self {
|
||||
name,
|
||||
description,
|
||||
mac_address: None,
|
||||
ipv4: None,
|
||||
ipv6: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Set MAC address
|
||||
fn with_mac(mut self, mac: Option<String>) -> Self {
|
||||
self.mac_address = mac;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set IPv4 address
|
||||
fn with_ipv4(mut self, ipv4: Option<String>) -> Self {
|
||||
self.ipv4 = ipv4;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set IPv6 address
|
||||
fn with_ipv6(mut self, ipv6: Option<String>) -> Self {
|
||||
self.ipv6 = ipv6;
|
||||
self
|
||||
}
|
||||
}
|
||||
use gphip::{ReportContext, ReportInput, generate_report};
|
||||
|
||||
#[derive(Args)]
|
||||
pub(crate) struct HipArgs {
|
||||
@@ -147,434 +34,29 @@ pub(crate) struct HipArgs {
|
||||
|
||||
pub(crate) struct HipHandler<'a> {
|
||||
args: &'a HipArgs,
|
||||
profile: OsProfile,
|
||||
}
|
||||
|
||||
impl<'a> HipHandler<'a> {
|
||||
pub(crate) fn new(args: &'a HipArgs) -> Self {
|
||||
let profile = build_os_profile(args);
|
||||
Self { args, profile }
|
||||
Self { args }
|
||||
}
|
||||
|
||||
pub(crate) async fn handle(&self) -> anyhow::Result<()> {
|
||||
let cookie_params = self.parse_cookie();
|
||||
let report = self.generate_hip_report(&cookie_params)?;
|
||||
|
||||
debug!("Generated HIP report:\n{}", report);
|
||||
println!("{}", report);
|
||||
|
||||
let client_os = ClientOs::from(self.args.client_os);
|
||||
let mut builder = OsProfileBuilder::new(client_os).client_version(self.args.client_version.clone());
|
||||
if let Some(host_id) = self.args.host_id.as_deref() {
|
||||
builder = builder.host_id_override(host_id);
|
||||
}
|
||||
let input = ReportInput {
|
||||
profile: builder.build(),
|
||||
context: ReportContext::Connected {
|
||||
cookie: self.args.cookie.clone(),
|
||||
client_ip: self.args.client_ip.clone(),
|
||||
client_ipv6: self.args.client_ipv6.clone(),
|
||||
md5: self.args.md5.clone(),
|
||||
},
|
||||
};
|
||||
println!("{}", generate_report(&input)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn parse_cookie(&self) -> HashMap<String, String> {
|
||||
// Parse URL-encoded cookie string using serde_urlencoded
|
||||
serde_urlencoded::from_str(&self.args.cookie).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Generate the complete HIP report XML
|
||||
fn generate_hip_report(&self, cookie_params: &HashMap<String, String>) -> anyhow::Result<String> {
|
||||
let (generate_time, day, month, year) = get_current_time_components();
|
||||
let user_name = cookie_params.get("user").map(|s| s.as_str()).unwrap_or("");
|
||||
let host_info = self.collect_host_info(cookie_params);
|
||||
|
||||
let template = HipReportTemplate {
|
||||
client_version: &self.args.client_version,
|
||||
generate_time,
|
||||
day,
|
||||
month,
|
||||
year,
|
||||
user_name,
|
||||
host_info,
|
||||
md5: &self.args.md5,
|
||||
};
|
||||
|
||||
let report = template.render()?;
|
||||
format_xml(&report)
|
||||
}
|
||||
|
||||
/// Collect host information using the configured OsProfile.
|
||||
fn collect_host_info(&self, cookie_params: &'a HashMap<String, String>) -> HostInfo {
|
||||
HostInfoCollector::new(&self.profile, self.args, cookie_params).collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct an `OsProfile` from CLI args, falling back to per-OS defaults
|
||||
/// for any value not supplied on the command line.
|
||||
fn build_os_profile(args: &HipArgs) -> OsProfile {
|
||||
let client_os = ClientOs::from(args.client_os);
|
||||
let mut builder = OsProfileBuilder::new(client_os).client_version(args.client_version.clone());
|
||||
if let Some(host_id) = args.host_id.as_deref() {
|
||||
debug!("HIP host-id override supplied: {}", host_id);
|
||||
builder = builder.host_id_override(host_id);
|
||||
}
|
||||
let profile = builder.build();
|
||||
debug!(
|
||||
"HIP OS profile host-id: runtime={}, projected={}, client_os={}",
|
||||
profile.host_identity().host_id(),
|
||||
profile.host_id(),
|
||||
client_os.as_str()
|
||||
);
|
||||
profile
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Host Information Collector
|
||||
// ============================================================================
|
||||
|
||||
/// Helper struct for collecting host information.
|
||||
///
|
||||
/// Identity values (vendor, host_id, computer name, software version) come
|
||||
/// from the configured `OsProfile`, while runtime state (network interfaces,
|
||||
/// IP addresses) is enumerated here from the underlying machine.
|
||||
struct HostInfoCollector<'p, 'a> {
|
||||
profile: &'p OsProfile,
|
||||
args: &'a HipArgs,
|
||||
cookie_params: &'a HashMap<String, String>,
|
||||
}
|
||||
|
||||
impl<'p, 'a> HostInfoCollector<'p, 'a> {
|
||||
fn new(profile: &'p OsProfile, args: &'a HipArgs, cookie_params: &'a HashMap<String, String>) -> Self {
|
||||
Self {
|
||||
profile,
|
||||
args,
|
||||
cookie_params,
|
||||
}
|
||||
}
|
||||
|
||||
/// Domain belongs to the runtime user/session, not the simulated OS, so
|
||||
/// it is sourced from the auth cookie when available.
|
||||
fn get_domain(&self) -> String {
|
||||
self
|
||||
.cookie_params
|
||||
.get("domain")
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Collect network interface information with fallback
|
||||
fn collect_network_interface(&self) -> NetworkInterface {
|
||||
match netdev::get_default_interface() {
|
||||
Ok(iface) => NetworkInterface::new(
|
||||
iface.name.clone(),
|
||||
iface.description.unwrap_or_else(|| iface.name.clone()),
|
||||
)
|
||||
.with_mac(iface.mac_addr.map(|mac| mac.address()))
|
||||
.with_ipv4(iface.ipv4.first().map(|ip| ip.addr().to_string()))
|
||||
.with_ipv6(iface.ipv6.first().map(|ip| ip.addr().to_string())),
|
||||
|
||||
Err(_) => NetworkInterface::new("unknown".to_string(), "unknown".to_string())
|
||||
.with_ipv4(self.args.client_ip.clone())
|
||||
.with_ipv6(self.args.client_ipv6.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Single entry point for collecting host info — dispatches per-OS
|
||||
/// behavior via `OsProfile` methods rather than `#[cfg(target_os)]`.
|
||||
fn collect(&self) -> HostInfo {
|
||||
let runtime_iface = self.collect_network_interface();
|
||||
let primary = self.adapt_primary_interface(&runtime_iface);
|
||||
|
||||
let mut interfaces = vec![primary.clone()];
|
||||
interfaces.extend(self.extra_interfaces(&primary));
|
||||
|
||||
HostInfo {
|
||||
os_vendor: self.profile.os_vendor().to_string(),
|
||||
os_version: self.profile.os_version().to_string(),
|
||||
host_id: self.profile.host_id().to_string(),
|
||||
host_name: self.profile.computer().to_string(),
|
||||
software_version: self.profile.software_version().to_string(),
|
||||
domain: self.domain_for_profile(),
|
||||
network_interfaces: interfaces,
|
||||
defender: self.defender_for_profile(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the primary network interface with OS-appropriate naming and
|
||||
/// MAC formatting. When emulating a different OS, the runtime interface
|
||||
/// name/description are replaced with the canonical placeholder for the
|
||||
/// target OS.
|
||||
fn adapt_primary_interface(&self, runtime: &NetworkInterface) -> NetworkInterface {
|
||||
let (name, description) = if self.profile.is_native() {
|
||||
(runtime.name.clone(), runtime.description.clone())
|
||||
} else {
|
||||
placeholder_interface_for(self.profile, runtime)
|
||||
};
|
||||
|
||||
NetworkInterface {
|
||||
name,
|
||||
description,
|
||||
mac_address: format_mac_for(self.profile, runtime.mac_address.clone()),
|
||||
ipv4: runtime.ipv4.clone(),
|
||||
ipv6: runtime.ipv6.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Additional interfaces appended after the primary. Only Windows
|
||||
/// emits the software loopback interface in HIP reports.
|
||||
fn extra_interfaces(&self, primary: &NetworkInterface) -> Vec<NetworkInterface> {
|
||||
match self.profile.client_os() {
|
||||
ClientOs::Windows => vec![NetworkInterface {
|
||||
name: derive_windows_network_name(self.profile.host_id(), primary),
|
||||
description: "Software Loopback Interface 1".to_string(),
|
||||
mac_address: Some(String::new()),
|
||||
ipv4: Some("127.0.0.1".to_string()),
|
||||
ipv6: Some("::1".to_string()),
|
||||
}],
|
||||
ClientOs::Linux | ClientOs::Mac => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
/// Linux HIP reports omit the domain field; macOS/Windows include it
|
||||
/// from the auth cookie.
|
||||
fn domain_for_profile(&self) -> String {
|
||||
match self.profile.client_os() {
|
||||
ClientOs::Linux => String::new(),
|
||||
ClientOs::Mac | ClientOs::Windows => self.get_domain(),
|
||||
}
|
||||
}
|
||||
|
||||
fn defender_for_profile(&self) -> Option<DefenderInfo> {
|
||||
match self.profile.client_os() {
|
||||
ClientOs::Linux => detect_microsoft_defender_blocking(),
|
||||
ClientOs::Mac | ClientOs::Windows => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn detect_microsoft_defender_blocking() -> Option<DefenderInfo> {
|
||||
let output = Command::new("mdatp")
|
||||
.arg("health")
|
||||
.arg("--output")
|
||||
.arg("json")
|
||||
.output()
|
||||
.ok()?;
|
||||
|
||||
if !output.status.success() {
|
||||
debug!("mdatp health command failed");
|
||||
return None;
|
||||
}
|
||||
|
||||
let json = String::from_utf8(output.stdout).ok()?;
|
||||
let defender = parse_defender_info(&json)?;
|
||||
|
||||
debug!("Detected Microsoft Defender: {:?}", defender);
|
||||
Some(defender)
|
||||
}
|
||||
|
||||
fn parse_defender_info(json: &str) -> Option<DefenderInfo> {
|
||||
serde_json::from_str(json).ok()
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Per-OS interface helpers (selected via OsProfile, not cfg)
|
||||
// ============================================================================
|
||||
|
||||
/// Canonical interface name/description for the target OS when the runtime
|
||||
/// is a different OS (i.e. emulation).
|
||||
fn placeholder_interface_for(profile: &OsProfile, runtime: &NetworkInterface) -> (String, String) {
|
||||
match profile.client_os() {
|
||||
ClientOs::Linux => ("enp1s0f0".to_string(), "enp1s0f0".to_string()),
|
||||
ClientOs::Mac => ("en0".to_string(), "en0".to_string()),
|
||||
ClientOs::Windows => (
|
||||
derive_windows_network_name(profile.host_id(), runtime),
|
||||
"PANGP Virtual Ethernet Adapter Secure".to_string(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
/// MAC address formatting per target OS. Windows uses hyphen separators;
|
||||
/// Linux and macOS preserve the colon-separated form returned by the
|
||||
/// platform.
|
||||
fn format_mac_for(profile: &OsProfile, mac: Option<String>) -> Option<String> {
|
||||
match profile.client_os() {
|
||||
ClientOs::Windows => mac.map(|m| m.replace(':', "-")),
|
||||
ClientOs::Linux | ClientOs::Mac => mac,
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Utility Functions
|
||||
// ============================================================================
|
||||
|
||||
/// Get current time components for HIP report
|
||||
fn get_current_time_components() -> (String, String, String, String) {
|
||||
let now = chrono::Local::now();
|
||||
(
|
||||
now.format("%m/%d/%Y %H:%M:%S").to_string(),
|
||||
now.format("%d").to_string(),
|
||||
now.format("%m").to_string(),
|
||||
now.format("%Y").to_string(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Format XML string with proper indentation
|
||||
fn format_xml(xml_str: &str) -> anyhow::Result<String> {
|
||||
let xml = Element::parse(xml_str.as_bytes())?;
|
||||
|
||||
let config = xmltree::EmitterConfig::new().perform_indent(true);
|
||||
let mut xml_buf = Vec::new();
|
||||
xml.write_with_config(&mut xml_buf, config)?;
|
||||
|
||||
Ok(String::from_utf8(xml_buf)?)
|
||||
}
|
||||
|
||||
fn derive_windows_network_name(host_id: &str, iface: &NetworkInterface) -> String {
|
||||
let seed = format!(
|
||||
"{}-{}-{}",
|
||||
host_id,
|
||||
iface.mac_address.as_deref().unwrap_or("00:00:00:00:00:00"),
|
||||
iface.name
|
||||
);
|
||||
|
||||
format!(
|
||||
"{{{}}}",
|
||||
uuid::Uuid::new_v5(&uuid::Uuid::NAMESPACE_DNS, seed.as_bytes())
|
||||
.to_string()
|
||||
.to_uppercase()
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use gpapi::os_profile::runtime_client_os;
|
||||
|
||||
fn make_hip_args(client_os: Os) -> HipArgs {
|
||||
HipArgs {
|
||||
client_version: "6.2.4-49".to_string(),
|
||||
client_os,
|
||||
os_version: Some("test-os-version".to_string()),
|
||||
host_id: None,
|
||||
cookie: String::new(),
|
||||
client_ip: None,
|
||||
client_ipv6: None,
|
||||
md5: "deadbeef".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn make_profile(client_os: ClientOs) -> OsProfile {
|
||||
OsProfileBuilder::new(client_os).build()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_info_os_vendor_is_linux_for_linux_profile() {
|
||||
let args = make_hip_args(Os::Linux);
|
||||
let profile = make_profile(ClientOs::Linux);
|
||||
let cookie_params: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let info = HostInfoCollector::new(&profile, &args, &cookie_params).collect();
|
||||
|
||||
assert_eq!(info.os_vendor, "Linux");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_info_os_vendor_is_apple_for_mac_profile() {
|
||||
let args = make_hip_args(Os::Mac);
|
||||
let profile = make_profile(ClientOs::Mac);
|
||||
let cookie_params: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let info = HostInfoCollector::new(&profile, &args, &cookie_params).collect();
|
||||
|
||||
assert_eq!(info.os_vendor, "Apple");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_info_os_vendor_is_microsoft_for_windows_profile() {
|
||||
let args = make_hip_args(Os::Windows);
|
||||
let profile = make_profile(ClientOs::Windows);
|
||||
let cookie_params: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let info = HostInfoCollector::new(&profile, &args, &cookie_params).collect();
|
||||
|
||||
assert_eq!(info.os_vendor, "Microsoft");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_info_host_id_comes_from_os_profile() {
|
||||
let args = make_hip_args(Os::Linux);
|
||||
let profile = make_profile(ClientOs::Linux);
|
||||
let cookie_params: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let info = HostInfoCollector::new(&profile, &args, &cookie_params).collect();
|
||||
|
||||
assert_eq!(info.host_id, profile.host_id());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_info_host_id_independent_of_runtime_for_each_os() {
|
||||
// host_id should reflect the OsProfile's machine identity for every
|
||||
// simulated OS, regardless of the runtime platform.
|
||||
for (client_os, os_arg) in [
|
||||
(ClientOs::Linux, Os::Linux),
|
||||
(ClientOs::Mac, Os::Mac),
|
||||
(ClientOs::Windows, Os::Windows),
|
||||
] {
|
||||
let args = make_hip_args(os_arg);
|
||||
let profile = make_profile(client_os);
|
||||
let cookie_params: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let info = HostInfoCollector::new(&profile, &args, &cookie_params).collect();
|
||||
|
||||
assert_eq!(info.host_id, profile.host_id());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hip_os_version_argument_is_ignored() {
|
||||
let args = make_hip_args(Os::Linux);
|
||||
let profile = build_os_profile(&args);
|
||||
let cookie_params: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let info = HostInfoCollector::new(&profile, &args, &cookie_params).collect();
|
||||
|
||||
assert_eq!(info.os_version, profile.os_version());
|
||||
assert_ne!(info.os_version, "test-os-version");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_id_argument_sets_profile_runtime_identity() {
|
||||
let mut args = make_hip_args(Os::default());
|
||||
args.host_id = Some("auth-host-id".to_string());
|
||||
|
||||
let profile = build_os_profile(&args);
|
||||
|
||||
assert_eq!(profile.client_os(), runtime_client_os());
|
||||
assert_eq!(profile.host_identity().host_id(), "auth-host-id");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn host_info_uses_host_id_argument_for_native_profile() {
|
||||
let mut args = make_hip_args(Os::default());
|
||||
args.host_id = Some("auth-host-id".to_string());
|
||||
let profile = build_os_profile(&args);
|
||||
let cookie_params: HashMap<String, String> = HashMap::new();
|
||||
|
||||
let info = HostInfoCollector::new(&profile, &args, &cookie_params).collect();
|
||||
|
||||
assert_eq!(profile.host_identity().host_id(), "auth-host-id");
|
||||
assert_eq!(info.host_id, profile.host_id());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_microsoft_defender_health_json() {
|
||||
let defender = parse_defender_info(
|
||||
r#"{
|
||||
"appVersion": "101.25042.0000",
|
||||
"engineVersion": "1.1.25040.2",
|
||||
"definitionsVersion": "1.429.201.0",
|
||||
"realTimeProtectionEnabled": { "value": true }
|
||||
}"#,
|
||||
)
|
||||
.expect("defender health json should parse");
|
||||
|
||||
assert_eq!(defender.app_version, "101.25042.0000");
|
||||
assert_eq!(defender.engine_version, "1.1.25040.2");
|
||||
assert_eq!(defender.definitions_version, "1.429.201.0");
|
||||
assert!(defender.real_time_protection_enabled.value);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_invalid_microsoft_defender_health_json() {
|
||||
assert!(parse_defender_info("{}").is_none());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function ee(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,x||(x=!0,ie());else{var t=n(l);t!==null&&se(ee,t.startTime-e)}}}var x=!1,te=-1,ne=5,S=-1;function re(){return g?!0:!(e.unstable_now()-S<ne)}function C(){if(g=!1,x){var t=e.unstable_now();S=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(te),te=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&se(ee,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ie():x=!1}}}var ie;if(typeof y==`function`)ie=function(){y(C)};else if(typeof MessageChannel<`u`){var ae=new MessageChannel,oe=ae.port2;ae.port1.onmessage=C,ie=function(){oe.postMessage(null)}}else ie=function(){_(C,0)};function se(t,n){te=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ne=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(te),te=-1):h=!0,se(ee,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,x||(x=!0,ie()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){Line truncated
|
||||
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
||||
`+ze+e+Be}var He=!1;function Ue(e,t){if(!e||He)return``;He=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
||||
`),l=s.split(`
|
||||
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
||||
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{He=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ve(n):``}function We(e,t){switch(e.tag){case 26:case 27:case 5:return Ve(e.type);case 16:return Ve(`Lazy`);case 13:return e.child!==t&&t!==null?Ve(`Suspense Fallback`):Ve(`Suspense`);case 19:return Ve(`SuspenseList`);case 0:case 15:return Ue(e.type,!1);case 11:return Ue(e.type.render,!1);case 1:return Ue(e.type,!0);case 31:return Ve(`Activity`);case 30:return Ve(`ViewTransition`);default:return``}}function Ge(e){try{var t=``,n=null;do t+=We(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
||||
Error generating stack: `+e.message+`
|
||||
`+e.stack}}var Ke=Object.prototype.hasOwnProperty,qe=t.unstable_scheduleCallback,Je=t.unstable_cancelCallback,Ye=t.unstable_shouldYield,Xe=t.unstable_requestPaint,Ze=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,$e=t.unstable_ImmediatePriority,et=t.unstable_UserBlockingPriority,tt=t.unstable_NormalPriority,nt=t.unstable_LowPriority,rt=t.unstable_IdlePriority,it=t.log,at=t.unstable_setDisableYieldValue,ot=null,st=null;function ct(e){if(typeof it==`function`&&at(e),st&&typeof st.setStrictMode==`function`)try{st.setStrictMode(ot,e)}catch{}}var lt=Math.clz32?Math.clz32:ft,ut=Math.log,dt=Math.LN2;function ft(e){return e>>>=0,e===0?32:31-(ut(e)/dt|0)|0}var pt=256,mt=262144,ht=4194304;function gt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _t(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=gt(n))):i=gt(o):i=gt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=gt(n))):i=gt(o)):i=gt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function vt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function yt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-lt(n),i=1<<r;t|=e[r],n&=~i}return t}function bt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xt(){var e=ht;return ht<<=1,!(ht&62914560)&&(ht=4194304),e}function St(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ct(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-lt(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-lt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Et(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-lt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Dt(e,t){var n=t&-t;return n=n&42?1:Ot(n),(n&(e.suspendedLanes|t))===0?n:0}function Ot(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function kt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function At(){var e=E.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function jt(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var Mt=Math.random().toString(36).slice(2),Nt=`__reactFiber$`+Mt,Pt=`__reactProps$`+Mt,Ft=`__reactContainer$`+Mt,It=`__reactEvents$`+Mt,Lt=`__reactListeners$`+Mt,Rt=`__reactHandles$`+Mt,zt=`__reactResources$`+Mt,Bt=`__reactMarker$`+Mt,Vt=`__reactLoad$`+Mt;function Ht(e){delete e[Nt],delete e[Pt],delete e[Lt],delete e[Rt]}function Ut(e){var t;if(t=e[Nt])return t;for(var n=e.parentNode;n;){if(t=n[Ft]||n[Nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[Nt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Wt(e){if(e=e[Nt]||e[Ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Kt(e){var t=e[zt];return t||=e[zt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function qt(e){e[Bt]=!0}function Jt(e){e[Vt]=void 0}var Yt=new Set,Xt={};function Zt(e,t){Qt(e,t),Qt(e+`Capture`,t)}function Qt(e,t){for(Xt[e]=t,e=0;e<t.le
Line truncated
|
||||
`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||xn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&xn(e,``+r);else return;break;case`className`:on(e,`class`,r);break;case`tabIndex`:on(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:on(e,n,r);break;case`style`:wn(e,r,a);return;case`data`:if(t!==`object`){on(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(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=k
Line truncated
|
||||
@@ -1,9 +0,0 @@
|
||||
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,re());else{var t=n(l);t!==null&&oe(x,t.startTime-e)}}var S=!1,C=-1,w=5,ee=-1;function te(){return g?!0:!(e.unstable_now()-ee<w)}function ne(){if(g=!1,S){var t=e.unstable_now();ee=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&te());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&oe(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?re():S=!1}}}var re;if(typeof y==`function`)re=function(){y(ne)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,ae=ie.port2;ie.port1.onmessage=ne,re=function(){ae.postMessage(null)}}else re=function(){_(ne,0)};function oe(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,oe(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,re()))),r},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.Line truncated
|
||||
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
||||
`+Se+e+Ce}var Te=!1;function Ee(e,t){if(!e||Te)return``;Te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
||||
`),l=s.split(`
|
||||
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
||||
`+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{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?we(n):``}function De(e,t){switch(e.tag){case 26:case 27:case 5:return we(e.type);case 16:return we(`Lazy`);case 13:return e.child!==t&&t!==null?we(`Suspense Fallback`):we(`Suspense`);case 19:return we(`SuspenseList`);case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return we(`Activity`);default:return``}}function Oe(e){try{var t=``,n=null;do t+=De(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
||||
Error generating stack: `+e.message+`
|
||||
`+e.stack}}var ke=Object.prototype.hasOwnProperty,Ae=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Me=t.unstable_shouldYield,Ne=t.unstable_requestPaint,Pe=t.unstable_now,Fe=t.unstable_getCurrentPriorityLevel,Ie=t.unstable_ImmediatePriority,Le=t.unstable_UserBlockingPriority,Re=t.unstable_NormalPriority,ze=t.unstable_LowPriority,Be=t.unstable_IdlePriority,Ve=t.log,He=t.unstable_setDisableYieldValue,Ue=null,We=null;function Ge(e){if(typeof Ve==`function`&&He(e),We&&typeof We.setStrictMode==`function`)try{We.setStrictMode(Ue,e)}catch{}}var Ke=Math.clz32?Math.clz32:Ye,qe=Math.log,Je=Math.LN2;function Ye(e){return e>>>=0,e===0?32:31-(qe(e)/Je|0)|0}var Xe=256,Ze=262144,Qe=4194304;function $e(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&261888;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 et(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=$e(n))):i=$e(o):i=$e(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=$e(n))):i=$e(o)):i=$e(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 tt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nt(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 rt(){var e=Qe;return Qe<<=1,!(Qe&62914560)&&(Qe=4194304),e}function it(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function at(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ot(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-Ke(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&&st(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function st(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ke(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ct(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ke(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function lt(e,t){var n=t&-t;return n=n&42?1:ut(n),(n&(e.suspendedLanes|t))===0?n:0}function ut(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 dt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ft(){var e=E.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function pt(e,t){var n=E.p;try{return E.p=e,t()}finally{E.p=n}}var mt=Math.random().toString(36).slice(2),ht=`__reactFiber$`+mt,gt=`__reactProps$`+mt,_t=`__reactContainer$`+mt,vt=`__reactEvents$`+mt,yt=`__reactListeners$`+mt,bt=`__reactHandles$`+mt,xt=`__reactResources$`+mt,St=`__reactMarker$`+mt;function Ct(e){delete e[ht],delete e[gt],delete e[vt],delete e[yt],delete e[bt]}function wt(e){var t=e[ht];if(t)return t;for(var n=e.parentNode;n;){if(t=n[_t]||n[ht]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[ht])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function Tt(e){if(e=e[ht]||e[_t]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Et(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Dt(e){var t=e[xt];return t||=e[xt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ot(e){e[St]=!0}var kt=new Set,At={};function jt(e,t){Mt(e,t),Mt(e+`Capture`,t)}function Mt(e,t){for(At[e]=t,e=0;e<t.length;e++)kt.add(t[e])}var Nt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001Line truncated
|
||||
`).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||en(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&en(e,``+r);break;case`className`:Rt(e,`class`,r);break;case`tabIndex`:Rt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Rt(e,n,r);break;case`style`:rn(e,r,a);break;case`data`:if(t!==`object`){Rt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(``+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}else 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)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=cn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=ln);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;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));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=cn(``+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`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),Lt(e,`popover`,r);break;case`xlinkActuate`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:zt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Lt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=on.get(n)||n,Lt(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:rn(e,r,a);break;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));e.innerHTML=n}}break;case`children`:typeof r==`string`?en(e,r):(typeof r==`number`||typeof r==`bigint`)&&en(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=ln);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`re
Line truncated
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/icon-small-BO4dlTNl.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>GPGUI Downloader</title>
|
||||
<script type="module" crossorigin src="/assets/main-BD0fDtWU.js"></script>
|
||||
<script type="module" crossorigin src="/assets/main-B7u6_mhO.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/main-DiWGniCh.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -9,25 +9,25 @@
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.11.1",
|
||||
"react": "^19.2.7",
|
||||
"react-dom": "^19.2.7"
|
||||
"@tauri-apps/api": "^2.12.0",
|
||||
"react": "^19.3.0",
|
||||
"react-dom": "^19.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2.11.2",
|
||||
"@types/node": "^25.9.4",
|
||||
"@types/react": "^19.2.17",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.61.1",
|
||||
"@typescript-eslint/parser": "^8.61.1",
|
||||
"@vitejs/plugin-react": "^6.0.2",
|
||||
"eslint": "^9.39.4",
|
||||
"@tauri-apps/cli": "^2.12.0",
|
||||
"@types/node": "^26.6.3",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.71.0",
|
||||
"@typescript-eslint/parser": "^8.71.0",
|
||||
"@vitejs/plugin-react": "^6.1.1",
|
||||
"eslint": "^9.39.5",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"prettier": "3.8.3",
|
||||
"prettier": "3.9.9",
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.0.16"
|
||||
"vite": "^8.3.1"
|
||||
},
|
||||
"packageManager": "[email protected]"
|
||||
}
|
||||
Generated
+484
-534
File diff suppressed because it is too large.
Load diff
@@ -246,9 +246,7 @@ async fn run_installer_connection(
|
||||
rejection.code(),
|
||||
rejection.message()
|
||||
)),
|
||||
ServiceResult::VpncScriptMetadata(_) => {
|
||||
Err(anyhow::anyhow!("Service sent an unexpected VPNC script metadata reply"))
|
||||
}
|
||||
_ => Err(anyhow::anyhow!("Service sent an unexpected GUI installation reply")),
|
||||
};
|
||||
let _ = command.reply.send(result);
|
||||
}
|
||||
@@ -301,6 +299,7 @@ async fn connect_installer_at(
|
||||
let (mut socket, _) = connect_async_with_config(endpoint, Some(config), false).await?;
|
||||
let prelude = ClientPrelude {
|
||||
product_version: credential.product_version().to_owned(),
|
||||
hip_protocol_version: gpapi::service::transport::HIP_PROTOCOL_VERSION,
|
||||
service_instance_id: credential.service_instance_id(),
|
||||
session_id: credential.session_id(),
|
||||
};
|
||||
@@ -633,7 +632,6 @@ mod tests {
|
||||
snapshot: VpnEnv {
|
||||
vpn_state: VpnState::Disconnected,
|
||||
vpnc_script: None,
|
||||
csd_wrapper: None,
|
||||
auth_executable: String::new(),
|
||||
host_info: HostInfo {
|
||||
host_identity: HostIdentity::collect(),
|
||||
|
||||
@@ -22,7 +22,7 @@ export default defineConfig(async () => {
|
||||
build: {
|
||||
rolldownOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, "index.html"),
|
||||
main: resolve(import.meta.dirname, "index.html"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -7,6 +7,9 @@ license.workspace = true
|
||||
[dependencies]
|
||||
common = { path = "../../crates/common" }
|
||||
gpapi = { path = "../../crates/gpapi", features = ["clap", "logger"] }
|
||||
gphip = { path = "../../crates/gphip" }
|
||||
base64.workspace = true
|
||||
sha256.workspace = true
|
||||
openconnect = { path = "../../crates/openconnect" }
|
||||
clap.workspace = true
|
||||
anyhow.workspace = true
|
||||
@@ -25,10 +28,11 @@ thiserror.workspace = true
|
||||
uuid = { workspace = true, features = ["v4"] }
|
||||
zeroize.workspace = true
|
||||
tempfile.workspace = true
|
||||
getrandom = "0.4"
|
||||
mac_address = "1"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
nix = { version = "0.31", features = ["fs", "socket", "user"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-tungstenite = "0.29"
|
||||
sha256.workspace = true
|
||||
@@ -0,0 +1,137 @@
|
||||
use std::{
|
||||
env, fs,
|
||||
io::{self, Write},
|
||||
};
|
||||
|
||||
use anyhow::{Context, ensure};
|
||||
use clap::Parser;
|
||||
use gpapi::{
|
||||
clap::args::Os,
|
||||
os_profile::{ClientOs, OsProfileBuilder},
|
||||
};
|
||||
use gphip::{ReportContext, ReportInput, generate_report, refresh_edited_report};
|
||||
use gpservice::hip_runner_state::{MAX_STATE_BYTES, RunnerReport, STATE_NAME, validate_root_owned_path};
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
#[arg(long)]
|
||||
client_version: String,
|
||||
#[arg(long, value_enum)]
|
||||
client_os: Os,
|
||||
#[arg(long)]
|
||||
os_version: Option<String>,
|
||||
#[arg(long)]
|
||||
host_id: Option<String>,
|
||||
#[arg(long)]
|
||||
cookie: Option<String>,
|
||||
#[arg(long)]
|
||||
client_ip: Option<String>,
|
||||
#[arg(long)]
|
||||
client_ipv6: Option<String>,
|
||||
#[arg(long)]
|
||||
md5: Option<String>,
|
||||
#[arg(long)]
|
||||
preview: bool,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if let Err(err) = run() {
|
||||
eprintln!("HIP report generation failed: {err:#}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn run() -> anyhow::Result<()> {
|
||||
let args = Args::parse();
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
let original_args: Vec<_> = env::args_os().skip(1).collect();
|
||||
let executable = env::current_exe().context("Cannot locate HIP runner")?;
|
||||
validate_root_owned_path(&executable, true)?;
|
||||
let state = executable
|
||||
.parent()
|
||||
.context("HIP runner has no parent")?
|
||||
.join(STATE_NAME);
|
||||
let metadata = fs::symlink_metadata(&state).context("Cannot inspect HIP report state")?;
|
||||
ensure!(
|
||||
metadata.is_file() && !metadata.file_type().is_symlink(),
|
||||
"Invalid HIP report state"
|
||||
);
|
||||
use std::os::unix::fs::{MetadataExt, PermissionsExt};
|
||||
ensure!(
|
||||
metadata.uid() == 0 && metadata.permissions().mode() & 0o077 == 0,
|
||||
"HIP report state is not private"
|
||||
);
|
||||
ensure!(
|
||||
metadata.len() <= MAX_STATE_BYTES as u64,
|
||||
"HIP report state is too large"
|
||||
);
|
||||
let bytes = fs::read(&state).context("Cannot read HIP report state")?;
|
||||
ensure!(bytes.len() <= MAX_STATE_BYTES, "HIP report state is too large");
|
||||
let report: RunnerReport = serde_json::from_slice(&bytes).context("Invalid HIP report state")?;
|
||||
|
||||
// This binary is single-threaded. Clear the VPN and desktop environment
|
||||
// before host collectors invoke any external system utilities.
|
||||
for (key, _) in env::vars_os() {
|
||||
unsafe { env::remove_var(key) };
|
||||
}
|
||||
unsafe {
|
||||
env::set_var("PATH", "/usr/bin:/bin:/usr/sbin:/sbin");
|
||||
env::set_var("LC_ALL", "C");
|
||||
env::set_var(
|
||||
"HOME",
|
||||
if cfg!(target_os = "macos") {
|
||||
"/var/root"
|
||||
} else {
|
||||
"/root"
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
let report = match report {
|
||||
RunnerReport::ApprovedRootScript { approval_id, owner_uid } => {
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
{
|
||||
let approved = gpservice::hip_approval::resolve(&approval_id, owner_uid)?;
|
||||
let script_args = original_args.into_iter().filter(|arg| arg != "--preview");
|
||||
let status = std::process::Command::new(approved.path)
|
||||
.args(script_args)
|
||||
.status()
|
||||
.context("Approved HIP script did not start")?;
|
||||
ensure!(status.success(), "Approved HIP script failed");
|
||||
return Ok(());
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
|
||||
{
|
||||
let _ = (approval_id, owner_uid);
|
||||
anyhow::bail!("Root HIP script approvals are unavailable on this platform");
|
||||
}
|
||||
}
|
||||
report => report,
|
||||
};
|
||||
|
||||
let mut builder = OsProfileBuilder::new(ClientOs::from(args.client_os)).client_version(args.client_version);
|
||||
if let Some(host_id) = args.host_id {
|
||||
builder = builder.host_id_override(host_id);
|
||||
}
|
||||
let context = if args.preview {
|
||||
ReportContext::Preview
|
||||
} else {
|
||||
ReportContext::Connected {
|
||||
cookie: args.cookie.context("Missing HIP cookie")?,
|
||||
client_ip: args.client_ip,
|
||||
client_ipv6: args.client_ipv6,
|
||||
md5: args.md5.context("Missing HIP digest")?,
|
||||
}
|
||||
};
|
||||
let input = ReportInput {
|
||||
profile: builder.build(),
|
||||
context,
|
||||
};
|
||||
let xml = match report {
|
||||
RunnerReport::Generated => generate_report(&input)?,
|
||||
RunnerReport::Edited { xml } => refresh_edited_report(&xml, &input)?,
|
||||
RunnerReport::ApprovedRootScript { .. } => unreachable!("approved script returned before report generation"),
|
||||
};
|
||||
io::stdout().write_all(xml.as_bytes())?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[path = "privileged_unix.rs"]
|
||||
mod platform;
|
||||
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
|
||||
#[path = "unsupported.rs"]
|
||||
mod platform;
|
||||
|
||||
fn main() {
|
||||
platform::run();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
use std::io::Read;
|
||||
|
||||
use anyhow::{Context, ensure};
|
||||
use clap::{Parser, Subcommand};
|
||||
use gpservice::hip_approval::{self, InstallRequest};
|
||||
use nix::unistd::Uid;
|
||||
|
||||
const MAX_INSTALL_REQUEST_SIZE: u64 = 2 * 1024 * 1024;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Command,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Command {
|
||||
Install,
|
||||
Revoke { approval_id: String },
|
||||
}
|
||||
|
||||
fn try_run() -> anyhow::Result<()> {
|
||||
ensure!(Uid::effective().is_root(), "HIP script installer must run as root");
|
||||
let approving_uid = std::env::var("PKEXEC_UID")
|
||||
.context("HIP script installer requires pkexec authorization")?
|
||||
.parse::<u32>()
|
||||
.context("Invalid pkexec user identity")?;
|
||||
ensure!(approving_uid != 0, "HIP script installer requires a desktop user");
|
||||
|
||||
match Cli::parse().command {
|
||||
Command::Install => {
|
||||
let mut input = Vec::new();
|
||||
std::io::stdin()
|
||||
.lock()
|
||||
.take(MAX_INSTALL_REQUEST_SIZE + 1)
|
||||
.read_to_end(&mut input)?;
|
||||
ensure!(
|
||||
input.len() as u64 <= MAX_INSTALL_REQUEST_SIZE,
|
||||
"HIP install request is too large"
|
||||
);
|
||||
let request: InstallRequest = serde_json::from_slice(&input).context("Invalid HIP install request")?;
|
||||
let info = hip_approval::install(request, approving_uid)?;
|
||||
serde_json::to_writer(std::io::stdout().lock(), &info)?;
|
||||
println!();
|
||||
}
|
||||
Command::Revoke { approval_id } => hip_approval::revoke(&approval_id, approving_uid)?,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn run() {
|
||||
if let Err(err) = try_run() {
|
||||
eprintln!("HIP approval failed: {err:#}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
pub(super) fn run() {
|
||||
eprintln!("Root HIP script approvals are unavailable on this platform");
|
||||
std::process::exit(1);
|
||||
}
|
||||
+13
-15
@@ -16,7 +16,7 @@ use gpapi::logger;
|
||||
use gpapi::utils::lock_file::dev_service_lock_file_path;
|
||||
use gpapi::{
|
||||
process::gui_launcher::GuiLauncher,
|
||||
service::{request::WsRequest, vpn_state::VpnState},
|
||||
service::vpn_state::VpnState,
|
||||
utils::{env_utils, lock_file::LockFile, redact::Redaction, shutdown_signal},
|
||||
};
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -95,14 +95,12 @@ impl Cli {
|
||||
bail!("Another instance of the service is already running");
|
||||
}
|
||||
|
||||
// Channel for sending requests to the VPN task
|
||||
let (ws_req_tx, ws_req_rx) = mpsc::channel::<WsRequest>(32);
|
||||
// Channel for receiving the VPN state from the VPN task
|
||||
// Channel for receiving VPN state from the lifecycle actor
|
||||
let (vpn_state_tx, vpn_state_rx) = watch::channel(VpnState::Disconnected);
|
||||
let gui_restart_requested = Arc::new(AtomicBool::new(false));
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let externally_brokered = self.externally_brokered();
|
||||
let trusted_csd_uid = crate::runtime_user::trusted_csd_uid()?;
|
||||
let desktop_uid = crate::runtime_user::desktop_uid();
|
||||
let brokered_scripts_dir = if externally_brokered {
|
||||
let executable = std::env::current_exe().context("Failed to locate the gpservice executable")?;
|
||||
let contents_dir = executable
|
||||
@@ -113,15 +111,14 @@ impl Cli {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let (mut vpn_task, lifecycle) = VpnTask::new(vpn_state_tx, externally_brokered, Arc::clone(®istry));
|
||||
let dispatcher = Arc::new(RequestDispatcher::new(
|
||||
ws_req_tx.clone(),
|
||||
lifecycle.clone(),
|
||||
Arc::clone(&gui_restart_requested),
|
||||
Arc::clone(&redaction),
|
||||
!externally_brokered,
|
||||
brokered_scripts_dir,
|
||||
));
|
||||
|
||||
let mut vpn_task = VpnTask::new(ws_req_rx, vpn_state_tx, externally_brokered, trusted_csd_uid);
|
||||
#[cfg(target_os = "macos")]
|
||||
let idle_vpn_state_rx = vpn_state_rx.clone();
|
||||
let ws_server = WsServer::new(
|
||||
@@ -179,10 +176,10 @@ impl Cli {
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let vpn_ctx = vpn_task.context();
|
||||
let lifecycle = lifecycle.clone();
|
||||
let ws_ctx = ws_server.context();
|
||||
|
||||
tokio::spawn(async move { signals::handle_signals(vpn_ctx, ws_ctx).await });
|
||||
tokio::spawn(async move { signals::handle_signals(lifecycle, ws_ctx).await });
|
||||
}
|
||||
|
||||
let vpn_task_handle = tokio::spawn(async move { vpn_task.start(server_token).await });
|
||||
@@ -199,7 +196,7 @@ impl Cli {
|
||||
let envs = self.env_file.as_ref().map(env_utils::load_env_vars).transpose()?;
|
||||
let minimized = self.minimized;
|
||||
tokio::spawn(async move {
|
||||
launch_gui(envs, registry, minimized, gui_restart_requested).await;
|
||||
launch_gui(envs, registry, desktop_uid, minimized, gui_restart_requested).await;
|
||||
let _ = shutdown_tx.send(()).await;
|
||||
});
|
||||
} else {
|
||||
@@ -324,12 +321,12 @@ mod signals {
|
||||
|
||||
use log::{info, warn};
|
||||
|
||||
use crate::vpn_task::VpnTaskContext;
|
||||
use crate::vpn_task::LifecycleHandle;
|
||||
use crate::ws_server::WsServerContext;
|
||||
|
||||
const DISCONNECTED_PID_FILE: &str = "/tmp/gpservice_disconnected.pid";
|
||||
|
||||
pub async fn handle_signals(vpn_ctx: Arc<VpnTaskContext>, ws_ctx: Arc<WsServerContext>) {
|
||||
pub async fn handle_signals(lifecycle: LifecycleHandle, ws_ctx: Arc<WsServerContext>) {
|
||||
use gpapi::service::event::WsEvent;
|
||||
use tokio::signal::unix::{Signal, SignalKind, signal};
|
||||
|
||||
@@ -349,7 +346,7 @@ mod signals {
|
||||
tokio::select! {
|
||||
_ = user_sig1.recv() => {
|
||||
info!("Received SIGUSR1 signal");
|
||||
if vpn_ctx.disconnect().await {
|
||||
if lifecycle.disconnect_and_wait().await {
|
||||
// Write the PID to a dedicated file to indicate that the VPN task is disconnected via SIGUSR1
|
||||
let pid = std::process::id();
|
||||
if let Err(err) = tokio::fs::write(DISCONNECTED_PID_FILE, pid.to_string()).await {
|
||||
@@ -369,11 +366,12 @@ mod signals {
|
||||
async fn launch_gui(
|
||||
envs: Option<HashMap<String, String>>,
|
||||
registry: Arc<SessionRegistry>,
|
||||
desktop_uid: Option<u32>,
|
||||
mut minimized: bool,
|
||||
restart_requested: Arc<AtomicBool>,
|
||||
) {
|
||||
loop {
|
||||
let credential = match registry.issue(env!("CARGO_PKG_VERSION")) {
|
||||
let credential = match registry.issue(env!("CARGO_PKG_VERSION"), desktop_uid) {
|
||||
Ok(credential) => credential,
|
||||
Err(err) => {
|
||||
warn!("Failed to issue GUI credential: {err}");
|
||||
|
||||
@@ -7,8 +7,12 @@ use tokio::{
|
||||
|
||||
use crate::session_registry::SessionRegistry;
|
||||
|
||||
pub(crate) async fn serve(mut stream: UnixStream, registry: Arc<SessionRegistry>) -> anyhow::Result<()> {
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION"))?;
|
||||
pub(crate) async fn serve(
|
||||
mut stream: UnixStream,
|
||||
registry: Arc<SessionRegistry>,
|
||||
desktop_uid: Option<u32>,
|
||||
) -> anyhow::Result<()> {
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION"), desktop_uid)?;
|
||||
let session_id = credential.session_id();
|
||||
let result = async {
|
||||
stream.write_all(&credential.encode_frame()?).await?;
|
||||
|
||||
@@ -54,7 +54,7 @@ impl DevBootstrap {
|
||||
}
|
||||
let registry = Arc::clone(&self.registry);
|
||||
tokio::spawn(async move {
|
||||
if let Err(err) = credential_lease::serve(stream, registry).await {
|
||||
if let Err(err) = credential_lease::serve(stream, registry, Some(self.allowed_uid)).await {
|
||||
warn!("Debug credential client ended: {err}");
|
||||
}
|
||||
});
|
||||
@@ -188,7 +188,7 @@ mod tests {
|
||||
async fn anchor_eof_revokes_issued_credential() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let (service, mut client) = UnixStream::pair().unwrap();
|
||||
let task = tokio::spawn(credential_lease::serve(service, Arc::clone(®istry)));
|
||||
let task = tokio::spawn(credential_lease::serve(service, Arc::clone(®istry), Some(1234)));
|
||||
|
||||
let mut header = [0_u8; 2];
|
||||
client.read_exact(&mut header).await.unwrap();
|
||||
|
||||
@@ -0,0 +1,380 @@
|
||||
//! Root-owned Unix installation identity. Failure affects GUI issuance only.
|
||||
use anyhow::{Context, ensure};
|
||||
use gpapi::device_anchor::{AnchorSource, DeviceAnchor};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fs::{self, File, OpenOptions},
|
||||
io::{Read, Write},
|
||||
os::unix::fs::{DirBuilderExt, MetadataExt, OpenOptionsExt, PermissionsExt},
|
||||
path::Path,
|
||||
};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Record {
|
||||
version: u32,
|
||||
anchor: DeviceAnchor,
|
||||
}
|
||||
|
||||
pub fn resolve() -> anyhow::Result<DeviceAnchor> {
|
||||
resolve_in(Path::new("/var/lib/gp"), 0, collect_unix).context("cannot resolve persistent GUI device anchor")
|
||||
}
|
||||
|
||||
fn collect_unix() -> anyhow::Result<DeviceAnchor> {
|
||||
collect_from(mac_address::get_mac_address()?, || {
|
||||
let mut random = [0_u8; 32];
|
||||
getrandom::fill(&mut random).map_err(|_| anyhow::anyhow!("cannot initialize device anchor"))?;
|
||||
Ok(random)
|
||||
})
|
||||
}
|
||||
|
||||
fn collect_from(
|
||||
mac: Option<mac_address::MacAddress>,
|
||||
random: impl FnOnce() -> anyhow::Result<[u8; 32]>,
|
||||
) -> anyhow::Result<DeviceAnchor> {
|
||||
if let Some(mac) = mac {
|
||||
let bytes = mac.bytes();
|
||||
if bytes != [0; 6] && bytes[0] & 1 == 0 {
|
||||
return Ok(DeviceAnchor::derive(AnchorSource::UnixMac, bytes));
|
||||
}
|
||||
}
|
||||
Ok(DeviceAnchor::derive(AnchorSource::UnixRandom, random()?))
|
||||
}
|
||||
|
||||
fn validate_metadata(metadata: &fs::Metadata, owner: u32, directory: bool) -> anyhow::Result<()> {
|
||||
ensure!(
|
||||
if directory {
|
||||
metadata.is_dir()
|
||||
} else {
|
||||
metadata.is_file()
|
||||
},
|
||||
"unexpected device anchor state type"
|
||||
);
|
||||
ensure!(metadata.uid() == owner, "unexpected device anchor state owner");
|
||||
ensure!(
|
||||
metadata.permissions().mode() & 0o777 == if directory { 0o700 } else { 0o600 },
|
||||
"unsafe device anchor state permissions"
|
||||
);
|
||||
if !directory {
|
||||
ensure!(metadata.nlink() == 1, "device anchor state must not have hard links");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_record(path: &Path, owner: u32) -> anyhow::Result<Option<DeviceAnchor>> {
|
||||
let mut file = match OpenOptions::new()
|
||||
.read(true)
|
||||
.custom_flags(nix::libc::O_NOFOLLOW | nix::libc::O_NONBLOCK)
|
||||
.open(path)
|
||||
{
|
||||
Ok(file) => file,
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(None),
|
||||
Err(error) => return Err(error.into()),
|
||||
};
|
||||
validate_metadata(&file.metadata()?, owner, false)?;
|
||||
ensure!(file.metadata()?.len() <= 4096, "oversized device anchor record");
|
||||
let mut bytes = Vec::new();
|
||||
file.read_to_end(&mut bytes)?;
|
||||
let record: Record = serde_json::from_slice(&bytes).context("malformed device anchor record")?;
|
||||
ensure!(
|
||||
record.version == 1 && record.anchor.validate(),
|
||||
"unsupported or invalid device anchor record"
|
||||
);
|
||||
ensure!(
|
||||
matches!(record.anchor.source, AnchorSource::UnixMac | AnchorSource::UnixRandom),
|
||||
"invalid Unix device anchor source"
|
||||
);
|
||||
Ok(Some(record.anchor))
|
||||
}
|
||||
|
||||
fn resolve_in(
|
||||
directory: &Path,
|
||||
owner: u32,
|
||||
collect: impl FnOnce() -> anyhow::Result<DeviceAnchor>,
|
||||
) -> anyhow::Result<DeviceAnchor> {
|
||||
match fs::DirBuilder::new().mode(0o700).create(directory) {
|
||||
Ok(()) => {
|
||||
if let Some(parent) = directory.parent() {
|
||||
File::open(parent)?.sync_all()?;
|
||||
}
|
||||
}
|
||||
Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => {}
|
||||
Err(error) => return Err(error.into()),
|
||||
}
|
||||
validate_metadata(&fs::symlink_metadata(directory)?, owner, true)?;
|
||||
let path = directory.join("hardware-id");
|
||||
let lock = OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(false)
|
||||
.mode(0o600)
|
||||
.custom_flags(nix::libc::O_NOFOLLOW | nix::libc::O_NONBLOCK)
|
||||
.open(directory.join("hardware-id.lock"))?;
|
||||
validate_metadata(&lock.metadata()?, owner, false)?;
|
||||
lock.lock()?;
|
||||
if let Some(anchor) = read_record(&path, owner)? {
|
||||
return Ok(anchor);
|
||||
}
|
||||
let anchor = collect()?;
|
||||
ensure!(
|
||||
anchor.validate() && matches!(anchor.source, AnchorSource::UnixMac | AnchorSource::UnixRandom),
|
||||
"invalid collected Unix device anchor"
|
||||
);
|
||||
let mut temporary = tempfile::NamedTempFile::new_in(directory)?;
|
||||
temporary.as_file().set_permissions(fs::Permissions::from_mode(0o600))?;
|
||||
temporary.write_all(&serde_json::to_vec(&Record {
|
||||
version: 1,
|
||||
anchor: anchor.clone(),
|
||||
})?)?;
|
||||
temporary.as_file().sync_all()?;
|
||||
temporary.persist_noclobber(&path)?;
|
||||
File::open(directory)?.sync_all()?;
|
||||
Ok(anchor)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn anchor() -> anyhow::Result<DeviceAnchor> {
|
||||
Ok(DeviceAnchor {
|
||||
hardware_id: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".to_owned(),
|
||||
source: AnchorSource::UnixMac,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn persistence_reuses_the_existing_record_without_rediscovery() {
|
||||
let _ = resolve as fn() -> anyhow::Result<DeviceAnchor>;
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let path = temporary.path().join("state");
|
||||
let owner = nix::unistd::Uid::current().as_raw();
|
||||
assert_eq!(resolve_in(&path, owner, anchor).unwrap(), anchor().unwrap());
|
||||
assert_eq!(
|
||||
resolve_in(&path, owner, || anyhow::bail!("must not rediscover")).unwrap(),
|
||||
anchor().unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collector_preserves_an_eligible_mac_and_randomizes_ineligible_addresses() {
|
||||
use mac_address::MacAddress;
|
||||
|
||||
let eligible = collect_from(Some(MacAddress::new([0, 17, 34, 51, 68, 85])), || {
|
||||
anyhow::bail!("must not randomize")
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
eligible,
|
||||
DeviceAnchor::derive(AnchorSource::UnixMac, [0, 17, 34, 51, 68, 85])
|
||||
);
|
||||
|
||||
for rejected in [[0; 6], [1, 2, 3, 4, 5, 6], [0xff; 6]] {
|
||||
assert_eq!(
|
||||
collect_from(Some(MacAddress::new(rejected)), || Ok([9; 32])).unwrap(),
|
||||
DeviceAnchor::derive(AnchorSource::UnixRandom, [9; 32])
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
collect_from(None, || Ok([8; 32])).unwrap(),
|
||||
DeviceAnchor::derive(AnchorSource::UnixRandom, [8; 32])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deleting_the_record_recreates_the_same_mac_anchor() {
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let path = temporary.path().join("state");
|
||||
let owner = nix::unistd::Uid::current().as_raw();
|
||||
let first = resolve_in(&path, owner, anchor).unwrap();
|
||||
fs::remove_file(path.join("hardware-id")).unwrap();
|
||||
assert_eq!(resolve_in(&path, owner, anchor).unwrap(), first);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parallel_first_start_converges_on_one_record() {
|
||||
use std::sync::{Arc, Barrier};
|
||||
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let path = Arc::new(temporary.path().join("state"));
|
||||
fs::create_dir(&*path).unwrap();
|
||||
fs::set_permissions(&*path, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
let owner = nix::unistd::Uid::current().as_raw();
|
||||
let barrier = Arc::new(Barrier::new(2));
|
||||
let handles: Vec<_> = [AnchorSource::UnixMac, AnchorSource::UnixRandom]
|
||||
.into_iter()
|
||||
.map(|source| {
|
||||
let path = Arc::clone(&path);
|
||||
let barrier = Arc::clone(&barrier);
|
||||
std::thread::spawn(move || {
|
||||
barrier.wait();
|
||||
resolve_in(&path, owner, || Ok(DeviceAnchor::derive(source, [source.into()])))
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
let results: Vec<_> = handles
|
||||
.into_iter()
|
||||
.map(|handle| handle.join().unwrap().unwrap())
|
||||
.collect();
|
||||
assert_eq!(results[0], results[1]);
|
||||
assert_eq!(
|
||||
read_record(&path.join("hardware-id"), owner).unwrap(),
|
||||
Some(results[0].clone())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_malformed_linked_and_unsafe_records() {
|
||||
use std::os::unix::fs::symlink;
|
||||
|
||||
let owner = nix::unistd::Uid::current().as_raw();
|
||||
for case in ["malformed", "symlink", "hard-link", "permissions"] {
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let directory = temporary.path().join("state");
|
||||
fs::create_dir(&directory).unwrap();
|
||||
fs::set_permissions(&directory, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
let record = directory.join("hardware-id");
|
||||
match case {
|
||||
"malformed" => fs::write(&record, b"not-json").unwrap(),
|
||||
"symlink" => {
|
||||
let target = temporary.path().join("target");
|
||||
fs::write(
|
||||
&target,
|
||||
serde_json::to_vec(&Record {
|
||||
version: 1,
|
||||
anchor: anchor().unwrap(),
|
||||
})
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
symlink(target, &record).unwrap();
|
||||
}
|
||||
"hard-link" => {
|
||||
fs::write(
|
||||
&record,
|
||||
serde_json::to_vec(&Record {
|
||||
version: 1,
|
||||
anchor: anchor().unwrap(),
|
||||
})
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
fs::hard_link(&record, temporary.path().join("second-link")).unwrap();
|
||||
}
|
||||
"permissions" => {
|
||||
fs::write(
|
||||
&record,
|
||||
serde_json::to_vec(&Record {
|
||||
version: 1,
|
||||
anchor: anchor().unwrap(),
|
||||
})
|
||||
.unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
fs::set_permissions(&record, fs::Permissions::from_mode(0o644)).unwrap();
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
if case != "symlink" && case != "permissions" {
|
||||
fs::set_permissions(&record, fs::Permissions::from_mode(0o600)).unwrap();
|
||||
}
|
||||
assert!(resolve_in(&directory, owner, anchor).is_err(), "accepted {case}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recovers_with_an_interrupted_temporary_file_present() {
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let directory = temporary.path().join("state");
|
||||
fs::create_dir(&directory).unwrap();
|
||||
fs::set_permissions(&directory, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
fs::write(directory.join(".hardware-id.interrupted"), b"partial").unwrap();
|
||||
assert_eq!(
|
||||
resolve_in(&directory, nix::unistd::Uid::current().as_raw(), anchor).unwrap(),
|
||||
anchor().unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_unsafe_directory_and_lock_metadata_and_read_only_storage() {
|
||||
use std::os::unix::fs::symlink;
|
||||
|
||||
let owner = nix::unistd::Uid::current().as_raw();
|
||||
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let directory = temporary.path().join("state");
|
||||
fs::create_dir(&directory).unwrap();
|
||||
fs::set_permissions(&directory, fs::Permissions::from_mode(0o755)).unwrap();
|
||||
assert!(resolve_in(&directory, owner, anchor).is_err());
|
||||
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let directory = temporary.path().join("state");
|
||||
fs::create_dir(&directory).unwrap();
|
||||
fs::set_permissions(&directory, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
assert!(resolve_in(&directory, owner.wrapping_add(1), anchor).is_err());
|
||||
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let directory = temporary.path().join("state");
|
||||
fs::write(&directory, b"not-a-directory").unwrap();
|
||||
assert!(resolve_in(&directory, owner, anchor).is_err());
|
||||
|
||||
for case in ["symlink", "hard-link", "permissions"] {
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let directory = temporary.path().join("state");
|
||||
fs::create_dir(&directory).unwrap();
|
||||
fs::set_permissions(&directory, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
let lock = directory.join("hardware-id.lock");
|
||||
match case {
|
||||
"symlink" => {
|
||||
let target = temporary.path().join("target");
|
||||
fs::write(&target, b"").unwrap();
|
||||
symlink(target, &lock).unwrap();
|
||||
}
|
||||
"hard-link" => {
|
||||
fs::write(&lock, b"").unwrap();
|
||||
fs::set_permissions(&lock, fs::Permissions::from_mode(0o600)).unwrap();
|
||||
fs::hard_link(&lock, temporary.path().join("second-link")).unwrap();
|
||||
}
|
||||
"permissions" => {
|
||||
fs::write(&lock, b"").unwrap();
|
||||
fs::set_permissions(&lock, fs::Permissions::from_mode(0o644)).unwrap();
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
assert!(resolve_in(&directory, owner, anchor).is_err(), "accepted {case} lock");
|
||||
}
|
||||
|
||||
let temporary = tempfile::tempdir().unwrap();
|
||||
let directory = temporary.path().join("state");
|
||||
fs::create_dir(&directory).unwrap();
|
||||
fs::set_permissions(&directory, fs::Permissions::from_mode(0o500)).unwrap();
|
||||
assert!(resolve_in(&directory, owner, anchor).is_err());
|
||||
fs::set_permissions(&directory, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn record_serializes_source_as_a_number_and_rejects_unknown_codes() {
|
||||
let record = Record {
|
||||
version: 1,
|
||||
anchor: anchor().unwrap(),
|
||||
};
|
||||
let json = serde_json::to_value(&record).unwrap();
|
||||
assert_eq!(json["anchor"]["source"], 1);
|
||||
assert_eq!(
|
||||
serde_json::to_string(&record).unwrap(),
|
||||
r#"{"version":1,"anchor":{"hardware_id":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","source":1}}"#
|
||||
);
|
||||
|
||||
for source in [0, 4] {
|
||||
let json = serde_json::json!({
|
||||
"version": 1,
|
||||
"anchor": {
|
||||
"hardware_id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"source": source
|
||||
}
|
||||
});
|
||||
assert!(serde_json::from_value::<Record>(json).is_err());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
use std::{
|
||||
fs::{self, File, OpenOptions},
|
||||
io::Write,
|
||||
os::unix::fs::{MetadataExt, OpenOptionsExt, PermissionsExt},
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use anyhow::{Context, ensure};
|
||||
use base64::{Engine, engine::general_purpose::STANDARD};
|
||||
use gpapi::hip::HipApprovalStatus;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tempfile::Builder;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::hip_runner_state::validate_root_owned_path;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const APPROVAL_DIRECTORY: &str = "/var/lib/gpclient/hip-approvals";
|
||||
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub const APPROVAL_DIRECTORY: &str = "/var/db/gpclient/hip-approvals";
|
||||
pub const MAX_SCRIPT_SIZE: usize = common::constants::MAX_HIP_SCRIPT_SIZE;
|
||||
const MAX_METADATA_SIZE: u64 = 8 * 1024;
|
||||
const METADATA_VERSION: u8 = 1;
|
||||
const SCRIPT_NAME: &str = "script";
|
||||
const METADATA_NAME: &str = "metadata.json";
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct InstallRequest {
|
||||
pub original_path: String,
|
||||
pub contents_base64: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ApprovalInfo {
|
||||
pub approval_id: String,
|
||||
pub owner_uid: u32,
|
||||
pub sha256: String,
|
||||
pub original_path: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ApprovedScript {
|
||||
pub info: ApprovalInfo,
|
||||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
struct StoredMetadata {
|
||||
version: u8,
|
||||
info: ApprovalInfo,
|
||||
}
|
||||
|
||||
impl InstallRequest {
|
||||
fn contents(&self) -> anyhow::Result<Vec<u8>> {
|
||||
ensure!(self.original_path.len() <= 4096, "HIP script path is too long");
|
||||
ensure!(
|
||||
Path::new(&self.original_path).is_absolute(),
|
||||
"HIP script path must be absolute"
|
||||
);
|
||||
ensure!(
|
||||
!self.original_path.contains('\0'),
|
||||
"HIP script path contains a NUL byte"
|
||||
);
|
||||
ensure!(
|
||||
self.contents_base64.len() <= (MAX_SCRIPT_SIZE + 2).div_ceil(3) * 4,
|
||||
"HIP script exceeds 1 MiB"
|
||||
);
|
||||
let contents = STANDARD
|
||||
.decode(&self.contents_base64)
|
||||
.context("Invalid HIP script content encoding")?;
|
||||
ensure!(
|
||||
!contents.is_empty() && contents.len() <= MAX_SCRIPT_SIZE,
|
||||
"HIP script must be 1 MiB or smaller"
|
||||
);
|
||||
Ok(contents)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn install(request: InstallRequest, approving_uid: u32) -> anyhow::Result<ApprovalInfo> {
|
||||
ensure!(approving_uid != 0, "Root cannot approve a desktop HIP script");
|
||||
let contents = request.contents()?;
|
||||
let base = Path::new(APPROVAL_DIRECTORY);
|
||||
fs::create_dir_all(base).context("Cannot create HIP approval directory")?;
|
||||
validate_root_owned_path(base, false)?;
|
||||
fs::set_permissions(base, fs::Permissions::from_mode(0o700))?;
|
||||
install_at(base, &contents, request.original_path, approving_uid, 0)
|
||||
}
|
||||
|
||||
pub fn resolve(approval_id: &str, desktop_uid: u32) -> anyhow::Result<ApprovedScript> {
|
||||
ensure!(desktop_uid != 0, "Root is not a desktop HIP approval owner");
|
||||
let base = Path::new(APPROVAL_DIRECTORY);
|
||||
validate_root_owned_path(base, false)?;
|
||||
resolve_at(base, approval_id, desktop_uid, 0)
|
||||
}
|
||||
|
||||
pub fn revoke(approval_id: &str, approving_uid: u32) -> anyhow::Result<()> {
|
||||
ensure!(approving_uid != 0, "Root cannot revoke another user's HIP approval");
|
||||
let base = Path::new(APPROVAL_DIRECTORY);
|
||||
validate_root_owned_path(base, false)?;
|
||||
revoke_at(base, approval_id, approving_uid, 0)
|
||||
}
|
||||
|
||||
pub fn status(approval_id: &str, desktop_uid: u32) -> anyhow::Result<HipApprovalStatus> {
|
||||
status_at(Path::new(APPROVAL_DIRECTORY), approval_id, desktop_uid, 0, true)
|
||||
}
|
||||
|
||||
fn status_at(
|
||||
base: &Path,
|
||||
approval_id: &str,
|
||||
desktop_uid: u32,
|
||||
file_owner: u32,
|
||||
validate_root_ancestors: bool,
|
||||
) -> anyhow::Result<HipApprovalStatus> {
|
||||
ensure!(desktop_uid != 0, "HIP approval status requires a desktop user");
|
||||
validate_id(approval_id)?;
|
||||
for path in [
|
||||
base.to_path_buf(),
|
||||
base.join(approval_id),
|
||||
base.join(approval_id).join(METADATA_NAME),
|
||||
] {
|
||||
match fs::symlink_metadata(&path) {
|
||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound => return Ok(HipApprovalStatus::Revoked),
|
||||
Err(_) => return Ok(HipApprovalStatus::Corrupt),
|
||||
Ok(_) => {}
|
||||
}
|
||||
}
|
||||
if validate_private_dir(base, file_owner).is_err()
|
||||
|| (validate_root_ancestors && validate_root_owned_path(base, false).is_err())
|
||||
{
|
||||
return Ok(HipApprovalStatus::Corrupt);
|
||||
}
|
||||
let info = match read_metadata_unbound_at(base, approval_id, file_owner) {
|
||||
Ok(info) => info,
|
||||
Err(_) => return Ok(HipApprovalStatus::Corrupt),
|
||||
};
|
||||
if info.owner_uid != desktop_uid {
|
||||
return Ok(HipApprovalStatus::OtherUser);
|
||||
}
|
||||
Ok(if resolve_at(base, approval_id, desktop_uid, file_owner).is_ok() {
|
||||
HipApprovalStatus::Valid
|
||||
} else {
|
||||
HipApprovalStatus::Corrupt
|
||||
})
|
||||
}
|
||||
|
||||
fn install_at(
|
||||
base: &Path,
|
||||
contents: &[u8],
|
||||
original_path: String,
|
||||
approving_uid: u32,
|
||||
file_owner: u32,
|
||||
) -> anyhow::Result<ApprovalInfo> {
|
||||
validate_private_dir(base, file_owner)?;
|
||||
ensure!(
|
||||
!contents.is_empty() && contents.len() <= MAX_SCRIPT_SIZE,
|
||||
"HIP script must be 1 MiB or smaller"
|
||||
);
|
||||
let approval_id = Uuid::new_v4().to_string();
|
||||
let info = ApprovalInfo {
|
||||
approval_id: approval_id.clone(),
|
||||
owner_uid: approving_uid,
|
||||
sha256: sha256::digest(contents),
|
||||
original_path,
|
||||
};
|
||||
let staged = Builder::new().prefix(".install-").tempdir_in(base)?;
|
||||
fs::set_permissions(staged.path(), fs::Permissions::from_mode(0o700))?;
|
||||
validate_private_dir(staged.path(), file_owner)?;
|
||||
|
||||
let script = staged.path().join(SCRIPT_NAME);
|
||||
write_new(&script, contents, 0o500)?;
|
||||
let metadata = staged.path().join(METADATA_NAME);
|
||||
let stored = StoredMetadata {
|
||||
version: METADATA_VERSION,
|
||||
info: info.clone(),
|
||||
};
|
||||
let encoded = serde_json::to_vec(&stored)?;
|
||||
ensure!(
|
||||
encoded.len() as u64 <= MAX_METADATA_SIZE,
|
||||
"HIP approval metadata is too large"
|
||||
);
|
||||
write_new(&metadata, &encoded, 0o600)?;
|
||||
File::open(staged.path())?.sync_all()?;
|
||||
|
||||
let target = base.join(&approval_id);
|
||||
ensure!(!target.exists(), "HIP approval ID collision");
|
||||
fs::rename(staged.path(), &target).context("Cannot publish HIP approval")?;
|
||||
File::open(base)?.sync_all()?;
|
||||
Ok(info)
|
||||
}
|
||||
|
||||
fn resolve_at(base: &Path, approval_id: &str, desktop_uid: u32, file_owner: u32) -> anyhow::Result<ApprovedScript> {
|
||||
let info = read_metadata_at(base, approval_id, desktop_uid, file_owner)?;
|
||||
let script = base.join(approval_id).join(SCRIPT_NAME);
|
||||
validate_file(&script, file_owner, 0o500, MAX_SCRIPT_SIZE as u64)?;
|
||||
let contents = fs::read(&script)?;
|
||||
ensure!(!contents.is_empty(), "Approved HIP script is empty");
|
||||
ensure!(
|
||||
sha256::digest(&contents) == info.sha256,
|
||||
"Approved HIP script digest mismatch"
|
||||
);
|
||||
Ok(ApprovedScript { info, path: script })
|
||||
}
|
||||
|
||||
fn read_metadata_at(base: &Path, approval_id: &str, desktop_uid: u32, file_owner: u32) -> anyhow::Result<ApprovalInfo> {
|
||||
let info = read_metadata_unbound_at(base, approval_id, file_owner)?;
|
||||
ensure!(info.owner_uid == desktop_uid, "HIP approval belongs to another user");
|
||||
Ok(info)
|
||||
}
|
||||
|
||||
fn read_metadata_unbound_at(base: &Path, approval_id: &str, file_owner: u32) -> anyhow::Result<ApprovalInfo> {
|
||||
validate_id(approval_id)?;
|
||||
validate_private_dir(base, file_owner)?;
|
||||
let directory = base.join(approval_id);
|
||||
validate_private_dir(&directory, file_owner)?;
|
||||
let metadata_path = directory.join(METADATA_NAME);
|
||||
validate_file(&metadata_path, file_owner, 0o600, MAX_METADATA_SIZE)?;
|
||||
let stored: StoredMetadata = serde_json::from_slice(&fs::read(metadata_path)?)?;
|
||||
ensure!(stored.version == METADATA_VERSION, "Unsupported HIP approval version");
|
||||
ensure!(stored.info.approval_id == approval_id, "HIP approval ID mismatch");
|
||||
ensure!(
|
||||
stored.info.sha256.len() == 64 && stored.info.sha256.bytes().all(|byte| byte.is_ascii_hexdigit()),
|
||||
"Invalid HIP approval digest"
|
||||
);
|
||||
|
||||
Ok(stored.info)
|
||||
}
|
||||
|
||||
fn revoke_at(base: &Path, approval_id: &str, approving_uid: u32, file_owner: u32) -> anyhow::Result<()> {
|
||||
validate_id(approval_id)?;
|
||||
let directory = base.join(approval_id);
|
||||
// The GUI may retry after removal succeeds but saving its settings fails.
|
||||
if let Err(err) = fs::symlink_metadata(&directory) {
|
||||
if err.kind() == std::io::ErrorKind::NotFound {
|
||||
return Ok(());
|
||||
}
|
||||
return Err(err).context("Cannot inspect HIP approval directory");
|
||||
}
|
||||
read_metadata_at(base, approval_id, approving_uid, file_owner)?;
|
||||
// Renaming first makes revocation atomic for the runner. Cleanup is separate:
|
||||
// a failed cleanup cannot make this approval executable again.
|
||||
let revoked = base.join(format!(".revoked-{approval_id}"));
|
||||
fs::rename(&directory, &revoked).context("Cannot revoke HIP approval")?;
|
||||
File::open(base)?.sync_all()?;
|
||||
if let Err(err) = fs::remove_dir_all(&revoked) {
|
||||
log::warn!("HIP approval was revoked but its snapshot could not be removed: {err}");
|
||||
} else {
|
||||
File::open(base)?.sync_all()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_new(path: &Path, bytes: &[u8], mode: u32) -> anyhow::Result<()> {
|
||||
let mut file = OpenOptions::new().write(true).create_new(true).mode(mode).open(path)?;
|
||||
file.write_all(bytes)?;
|
||||
file.sync_all()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_id(value: &str) -> anyhow::Result<()> {
|
||||
let parsed = Uuid::parse_str(value).context("Invalid HIP approval ID")?;
|
||||
ensure!(parsed.to_string() == value, "HIP approval ID must use canonical form");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_private_dir(path: &Path, owner_uid: u32) -> anyhow::Result<()> {
|
||||
let metadata = fs::symlink_metadata(path).with_context(|| format!("Cannot inspect {}", path.display()))?;
|
||||
ensure!(
|
||||
metadata.is_dir() && !metadata.file_type().is_symlink(),
|
||||
"HIP approval directory is not a directory"
|
||||
);
|
||||
ensure!(
|
||||
metadata.uid() == owner_uid && metadata.permissions().mode() & 0o077 == 0,
|
||||
"HIP approval directory {} is not private (owner {}, mode {:o})",
|
||||
path.display(),
|
||||
metadata.uid(),
|
||||
metadata.permissions().mode() & 0o777
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_file(path: &Path, owner_uid: u32, mode: u32, max_size: u64) -> anyhow::Result<()> {
|
||||
let metadata = fs::symlink_metadata(path).with_context(|| format!("Cannot inspect {}", path.display()))?;
|
||||
ensure!(
|
||||
metadata.is_file() && !metadata.file_type().is_symlink(),
|
||||
"HIP approval file is not regular"
|
||||
);
|
||||
ensure!(
|
||||
metadata.uid() == owner_uid && metadata.permissions().mode() & 0o777 == mode,
|
||||
"HIP approval file has unsafe ownership or mode"
|
||||
);
|
||||
ensure!(metadata.len() <= max_size, "HIP approval file is too large");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn fixture() -> (tempfile::TempDir, u32) {
|
||||
let base = tempfile::tempdir().unwrap();
|
||||
fs::set_permissions(base.path(), fs::Permissions::from_mode(0o700)).unwrap();
|
||||
let owner = fs::symlink_metadata(base.path()).unwrap().uid();
|
||||
(base, owner)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn install_request_rejects_oversized_or_relative_script() {
|
||||
let request = InstallRequest {
|
||||
original_path: "hip.sh".into(),
|
||||
contents_base64: STANDARD.encode(b"#!/bin/sh\n"),
|
||||
};
|
||||
assert!(request.contents().is_err());
|
||||
let oversized = InstallRequest {
|
||||
original_path: "/home/user/hip.sh".into(),
|
||||
contents_base64: STANDARD.encode(vec![b'x'; MAX_SCRIPT_SIZE + 1]),
|
||||
};
|
||||
assert!(oversized.contents().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn approval_binds_owner_and_exact_script_digest() {
|
||||
let (base, owner) = fixture();
|
||||
let info = install_at(
|
||||
base.path(),
|
||||
b"#!/bin/sh\necho ok\n",
|
||||
"/home/user/hip.sh".into(),
|
||||
1000,
|
||||
owner,
|
||||
)
|
||||
.unwrap();
|
||||
let approved = resolve_at(base.path(), &info.approval_id, 1000, owner).unwrap();
|
||||
assert_eq!(approved.info.sha256, info.sha256);
|
||||
assert!(resolve_at(base.path(), &info.approval_id, 1001, owner).is_err());
|
||||
fs::set_permissions(&approved.path, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
fs::write(&approved.path, b"#!/bin/sh\necho changed\n").unwrap();
|
||||
fs::set_permissions(&approved.path, fs::Permissions::from_mode(0o500)).unwrap();
|
||||
assert!(resolve_at(base.path(), &info.approval_id, 1000, owner).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn revoked_approval_is_unavailable() {
|
||||
let (base, owner) = fixture();
|
||||
let info = install_at(base.path(), b"#!/bin/sh\n", "/home/user/hip.sh".into(), 1000, owner).unwrap();
|
||||
assert!(revoke_at(base.path(), &info.approval_id, 1001, owner).is_err());
|
||||
revoke_at(base.path(), &info.approval_id, 1000, owner).unwrap();
|
||||
revoke_at(base.path(), &info.approval_id, 1000, owner).unwrap();
|
||||
assert!(resolve_at(base.path(), &info.approval_id, 1000, owner).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn status_distinguishes_owner_corruption_and_revocation() {
|
||||
let (base, owner) = fixture();
|
||||
let info = install_at(
|
||||
base.path(),
|
||||
b"#!/bin/sh\necho ok\n",
|
||||
"/home/user/hip.sh".into(),
|
||||
1000,
|
||||
owner,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
status_at(base.path(), &info.approval_id, 1000, owner, false).unwrap(),
|
||||
HipApprovalStatus::Valid
|
||||
);
|
||||
assert_eq!(
|
||||
status_at(base.path(), &info.approval_id, 1001, owner, false).unwrap(),
|
||||
HipApprovalStatus::OtherUser
|
||||
);
|
||||
let script = base.path().join(&info.approval_id).join(SCRIPT_NAME);
|
||||
fs::set_permissions(&script, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
assert_eq!(
|
||||
status_at(base.path(), &info.approval_id, 1000, owner, false).unwrap(),
|
||||
HipApprovalStatus::Corrupt
|
||||
);
|
||||
fs::remove_file(base.path().join(&info.approval_id).join(METADATA_NAME)).unwrap();
|
||||
assert_eq!(
|
||||
status_at(base.path(), &info.approval_id, 1000, owner, false).unwrap(),
|
||||
HipApprovalStatus::Revoked
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn revoke_succeeds_if_script_was_corrupted() {
|
||||
let (base, owner) = fixture();
|
||||
let info = install_at(base.path(), b"#!/bin/sh\n", "/home/user/hip.sh".into(), 1000, owner).unwrap();
|
||||
let script = base.path().join(&info.approval_id).join(SCRIPT_NAME);
|
||||
fs::set_permissions(&script, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
fs::write(&script, b"changed").unwrap();
|
||||
assert!(resolve_at(base.path(), &info.approval_id, 1000, owner).is_err());
|
||||
revoke_at(base.path(), &info.approval_id, 1000, owner).unwrap();
|
||||
assert!(!base.path().join(&info.approval_id).exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_symlinked_script() {
|
||||
use std::os::unix::fs::symlink;
|
||||
let (base, owner) = fixture();
|
||||
let info = install_at(base.path(), b"#!/bin/sh\n", "/home/user/hip.sh".into(), 1000, owner).unwrap();
|
||||
let script = base.path().join(&info.approval_id).join(SCRIPT_NAME);
|
||||
fs::remove_file(&script).unwrap();
|
||||
symlink("/bin/sh", &script).unwrap();
|
||||
assert!(resolve_at(base.path(), &info.approval_id, 1000, owner).is_err());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
use std::{os::unix::process::CommandExt, process::Stdio, sync::Arc, time::Duration};
|
||||
|
||||
use anyhow::{Context, bail, ensure};
|
||||
use gpapi::{hip::HipSource, service::request::PreviewHipReportRequest};
|
||||
use tokio::{io::AsyncReadExt, process::Command};
|
||||
|
||||
const MAX_PREVIEW_BYTES: u64 = 1024 * 1024;
|
||||
const PREVIEW_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
const PREVIEW_COOKIE: &str = "user=preview&domain=preview&computer=preview";
|
||||
const PREVIEW_IP: &str = "192.0.2.1";
|
||||
const PREVIEW_MD5: &str = "00000000000000000000000000000000";
|
||||
|
||||
pub(crate) async fn generate(
|
||||
request: PreviewHipReportRequest,
|
||||
edited_report: Option<Arc<str>>,
|
||||
desktop_uid: Option<u32>,
|
||||
) -> anyhow::Result<String> {
|
||||
ensure!(request.client_version.len() <= 64, "Invalid HIP client version");
|
||||
ensure!(
|
||||
request.host_id.as_ref().is_none_or(|id| id.len() <= 256),
|
||||
"Invalid HIP host ID"
|
||||
);
|
||||
|
||||
let source = &request.source;
|
||||
let execution = match source {
|
||||
HipSource::Disabled => bail!("HIP is disabled"),
|
||||
HipSource::Generated | HipSource::Edited { .. } => crate::hip_source::preview_runner(edited_report)?,
|
||||
HipSource::UserScript { .. } | HipSource::ApprovedRootScript { .. } => {
|
||||
crate::hip_source::resolve(source, desktop_uid, false, None)?
|
||||
}
|
||||
};
|
||||
let script = execution
|
||||
.wrapper
|
||||
.as_deref()
|
||||
.context("HIP preview script is unavailable")?;
|
||||
let is_runner = !matches!(source, HipSource::UserScript { .. });
|
||||
let mut command = Command::new(script);
|
||||
command
|
||||
.arg("--client-version")
|
||||
.arg(&request.client_version)
|
||||
.arg("--client-os")
|
||||
.arg(request.client_os.as_str())
|
||||
.arg("--os-version")
|
||||
.arg(request.client_os.default_os_version());
|
||||
if let Some(host_id) = request.host_id {
|
||||
command.arg("--host-id").arg(host_id);
|
||||
}
|
||||
if is_runner {
|
||||
command.arg("--preview");
|
||||
}
|
||||
command
|
||||
.arg("--cookie")
|
||||
.arg(PREVIEW_COOKIE)
|
||||
.arg("--client-ip")
|
||||
.arg(PREVIEW_IP)
|
||||
.arg("--md5")
|
||||
.arg(PREVIEW_MD5)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::null());
|
||||
command.as_std_mut().process_group(0);
|
||||
configure_identity(&mut command, execution.uid, &request.client_version)?;
|
||||
command.kill_on_drop(true);
|
||||
|
||||
let mut child = command.spawn().context("Failed to launch HIP preview")?;
|
||||
let mut process_group = ProcessGroupGuard::new(child.id());
|
||||
let mut stdout = child
|
||||
.stdout
|
||||
.take()
|
||||
.context("HIP preview has no output stream")?
|
||||
.take(MAX_PREVIEW_BYTES + 1);
|
||||
let output = tokio::time::timeout(PREVIEW_TIMEOUT, async {
|
||||
let mut bytes = Vec::new();
|
||||
stdout.read_to_end(&mut bytes).await?;
|
||||
ensure!(bytes.len() as u64 <= MAX_PREVIEW_BYTES, "HIP preview exceeds 1 MiB");
|
||||
let status = child.wait().await?;
|
||||
process_group.disarm();
|
||||
ensure!(status.success(), "HIP preview generator failed");
|
||||
Ok::<_, anyhow::Error>(String::from_utf8(bytes)?)
|
||||
})
|
||||
.await;
|
||||
match output {
|
||||
Ok(Ok(xml)) => {
|
||||
if matches!(
|
||||
source,
|
||||
HipSource::UserScript { .. } | HipSource::ApprovedRootScript { .. }
|
||||
) {
|
||||
gphip::validate_edited_report(&xml).context("Custom HIP script did not emit a valid HIP report")?;
|
||||
}
|
||||
Ok(xml)
|
||||
}
|
||||
Ok(Err(error)) => {
|
||||
terminate_group(&mut child, &mut process_group).await;
|
||||
Err(error)
|
||||
}
|
||||
Err(_) => {
|
||||
terminate_group(&mut child, &mut process_group).await;
|
||||
anyhow::bail!("HIP preview timed out")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn configure_identity(command: &mut Command, uid: u32, app_version: &str) -> anyhow::Result<()> {
|
||||
command
|
||||
.as_std_mut()
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin:/usr/sbin:/sbin")
|
||||
.env("LC_ALL", "C")
|
||||
.env("APP_VERSION", app_version);
|
||||
if uid == 0 {
|
||||
command.as_std_mut().env("HOME", "/root");
|
||||
return Ok(());
|
||||
}
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
{
|
||||
use nix::unistd::{Uid, User};
|
||||
let user = User::from_uid(Uid::from_raw(uid))?.context("Desktop user is unavailable")?;
|
||||
command
|
||||
.as_std_mut()
|
||||
.env("HOME", &user.dir)
|
||||
.env("USER", &user.name)
|
||||
.env("LOGNAME", &user.name)
|
||||
.current_dir(&user.dir);
|
||||
if Uid::effective().as_raw() == uid {
|
||||
return Ok(());
|
||||
}
|
||||
// Match OpenConnect's CSD child: a single primary group, then the desktop UID.
|
||||
unsafe {
|
||||
command.as_std_mut().pre_exec(move || {
|
||||
nix::unistd::setgid(user.gid).map_err(std::io::Error::from)?;
|
||||
nix::unistd::setgroups(&[user.gid]).map_err(std::io::Error::from)?;
|
||||
nix::unistd::setuid(Uid::from_raw(uid)).map_err(std::io::Error::from)?;
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
|
||||
{
|
||||
bail!("Custom HIP previews are unavailable on this platform")
|
||||
}
|
||||
}
|
||||
|
||||
struct ProcessGroupGuard(Option<u32>);
|
||||
|
||||
impl ProcessGroupGuard {
|
||||
fn new(pid: Option<u32>) -> Self {
|
||||
Self(pid)
|
||||
}
|
||||
|
||||
fn kill(&mut self) {
|
||||
if let Some(pid) = self.0.take() {
|
||||
unsafe { nix::libc::kill(-(pid as i32), nix::libc::SIGKILL) };
|
||||
}
|
||||
}
|
||||
|
||||
fn disarm(&mut self) {
|
||||
self.0 = None;
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ProcessGroupGuard {
|
||||
fn drop(&mut self) {
|
||||
self.kill();
|
||||
}
|
||||
}
|
||||
|
||||
async fn terminate_group(child: &mut tokio::process::Child, process_group: &mut ProcessGroupGuard) {
|
||||
process_group.kill();
|
||||
let _ = child.start_kill();
|
||||
let _ = child.wait().await;
|
||||
}
|
||||
|
||||
#[cfg(all(test, any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use gpapi::os_profile::ClientOs;
|
||||
use std::{fs, os::unix::fs::PermissionsExt};
|
||||
|
||||
fn request(path: &std::path::Path) -> PreviewHipReportRequest {
|
||||
PreviewHipReportRequest {
|
||||
source: HipSource::UserScript {
|
||||
path: path.to_string_lossy().into_owned(),
|
||||
},
|
||||
client_os: ClientOs::Linux,
|
||||
client_version: "6.3.3".into(),
|
||||
host_id: Some("host-test".into()),
|
||||
}
|
||||
}
|
||||
|
||||
fn script(path: &std::path::Path, body: &str) {
|
||||
fs::write(path, format!("#!/bin/sh\n{body}\n")).unwrap();
|
||||
fs::set_permissions(path, fs::Permissions::from_mode(0o700)).unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn user_script_preview_receives_placeholders_and_validates_output() {
|
||||
let uid = nix::unistd::Uid::effective().as_raw();
|
||||
if uid == 0 {
|
||||
return;
|
||||
}
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("hip.sh");
|
||||
script(
|
||||
&path,
|
||||
r#"
|
||||
test "$1" = --client-version && test "$2" = 6.3.3 || exit 2
|
||||
test "$3" = --client-os && test "$4" = Linux || exit 2
|
||||
test "$5" = --os-version || exit 2
|
||||
test "$7" = --host-id && test "$8" = host-test || exit 2
|
||||
test "$9" = --cookie && test "${10}" = 'user=preview&domain=preview&computer=preview' || exit 2
|
||||
test "${11}" = --client-ip && test "${12}" = 192.0.2.1 || exit 2
|
||||
test "${13}" = --md5 && test "${14}" = 00000000000000000000000000000000 || exit 2
|
||||
test "$#" = 14 || exit 2
|
||||
test "$APP_VERSION" = 6.3.3 || exit 2
|
||||
printf '%s' '<hip-report><md5-sum/><user-name/><domain/><host-name/><host-id/><ip-address/><ipv6-address/><generate-time/><hip-report-version/><categories><entry name="host-info"><client-version/><os/><os-vendor/><domain/><host-name/><host-id/></entry></categories></hip-report>'
|
||||
"#,
|
||||
);
|
||||
let xml = generate(request(&path), None, Some(uid)).await.unwrap();
|
||||
assert!(xml.starts_with("<hip-report>"));
|
||||
|
||||
script(&path, "printf '%s' '<not-hip/>'");
|
||||
assert!(generate(request(&path), None, Some(uid)).await.is_err());
|
||||
|
||||
script(&path, "head -c 1048577 /dev/zero");
|
||||
let err = generate(request(&path), None, Some(uid)).await.unwrap_err();
|
||||
assert!(err.to_string().contains("exceeds 1 MiB"));
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[tokio::test]
|
||||
async fn cancelling_preview_stops_its_process_group() {
|
||||
let uid = nix::unistd::Uid::effective().as_raw();
|
||||
if uid == 0 {
|
||||
return;
|
||||
}
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let path = dir.path().join("hip.sh");
|
||||
let pid_file = dir.path().join("pids");
|
||||
script(
|
||||
&path,
|
||||
&format!(
|
||||
"sleep 30 & child=$!; echo \"$$ $child\" > \"{}\"; wait",
|
||||
pid_file.display()
|
||||
),
|
||||
);
|
||||
let preview = tokio::spawn(generate(request(&path), None, Some(uid)));
|
||||
let pids = tokio::time::timeout(Duration::from_secs(3), async {
|
||||
loop {
|
||||
if let Ok(pids) = fs::read_to_string(&pid_file) {
|
||||
break pids;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(10)).await;
|
||||
}
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
let child_pid = pids.split_whitespace().nth(1).unwrap().parse::<u32>().unwrap();
|
||||
preview.abort();
|
||||
assert!(preview.await.unwrap_err().is_cancelled());
|
||||
tokio::time::timeout(Duration::from_secs(3), async {
|
||||
loop {
|
||||
let state = fs::read_to_string(format!("/proc/{child_pid}/stat"))
|
||||
.ok()
|
||||
.and_then(|stat| stat.rsplit_once(") ").and_then(|(_, fields)| fields.chars().next()));
|
||||
if state.is_none_or(|state| state == 'Z') {
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(10)).await;
|
||||
}
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
use std::{
|
||||
fs,
|
||||
os::unix::fs::{MetadataExt, PermissionsExt},
|
||||
path::Path,
|
||||
};
|
||||
|
||||
use anyhow::{Context, ensure};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub const RUNNER_NAME: &str = "gp-hip-runner";
|
||||
pub const STATE_NAME: &str = "report.json";
|
||||
pub const MAX_STATE_BYTES: usize = 512 * 1024;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[serde(tag = "source", rename_all = "camelCase")]
|
||||
pub enum RunnerReport {
|
||||
Generated,
|
||||
Edited { xml: String },
|
||||
ApprovedRootScript { approval_id: String, owner_uid: u32 },
|
||||
}
|
||||
|
||||
/// Check every component because a trusted file below a writable parent can
|
||||
/// be replaced before a later HIP refresh.
|
||||
pub fn validate_root_owned_path(path: &Path, file: bool) -> anyhow::Result<()> {
|
||||
ensure!(path.is_absolute(), "HIP runner path must be absolute");
|
||||
for component in path.ancestors().take_while(|part| part.as_os_str() != "/") {
|
||||
let metadata =
|
||||
fs::symlink_metadata(component).with_context(|| format!("Cannot inspect {}", component.display()))?;
|
||||
ensure!(!metadata.file_type().is_symlink(), "HIP runner path contains a symlink");
|
||||
ensure!(metadata.uid() == 0, "HIP runner path is not root-owned");
|
||||
ensure!(
|
||||
metadata.permissions().mode() & 0o022 == 0,
|
||||
"HIP runner path is writable by another user"
|
||||
);
|
||||
if component == path && file {
|
||||
ensure!(metadata.is_file(), "HIP runner is not a regular file");
|
||||
ensure!(
|
||||
metadata.permissions().mode() & 0o111 != 0,
|
||||
"HIP runner is not executable"
|
||||
);
|
||||
} else {
|
||||
ensure!(metadata.is_dir(), "HIP runner parent is not a directory");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn rejects_user_owned_runner_directory() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
if unsafe { nix::libc::geteuid() } != 0 {
|
||||
assert!(validate_root_owned_path(temp.path(), false).is_err());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
use std::{
|
||||
fs::{self, OpenOptions},
|
||||
io::Write,
|
||||
os::unix::fs::{OpenOptionsExt, PermissionsExt},
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use anyhow::{Context, bail, ensure};
|
||||
use gpapi::hip::HipSource;
|
||||
use gpservice::hip_runner_state::{MAX_STATE_BYTES, RUNNER_NAME, RunnerReport, STATE_NAME, validate_root_owned_path};
|
||||
use tempfile::{Builder, TempDir};
|
||||
|
||||
pub(crate) struct HipExecution {
|
||||
pub enabled: bool,
|
||||
pub uid: u32,
|
||||
pub wrapper: Option<String>,
|
||||
_state_dir: Option<TempDir>,
|
||||
approval: Option<(String, u32)>,
|
||||
}
|
||||
|
||||
impl HipExecution {
|
||||
fn disabled() -> Self {
|
||||
Self {
|
||||
enabled: false,
|
||||
uid: 0,
|
||||
wrapper: None,
|
||||
_state_dir: None,
|
||||
approval: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn script(uid: u32, wrapper: PathBuf, state_dir: Option<TempDir>) -> Self {
|
||||
Self {
|
||||
enabled: true,
|
||||
uid,
|
||||
wrapper: Some(wrapper.to_string_lossy().into_owned()),
|
||||
_state_dir: state_dir,
|
||||
approval: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn approval_id(&self) -> Option<&str> {
|
||||
self.approval.as_ref().map(|(id, _)| id.as_str())
|
||||
}
|
||||
|
||||
pub(crate) fn approval_is_valid(&self) -> bool {
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
if let Some((id, uid)) = &self.approval {
|
||||
return gpservice::hip_approval::resolve(id, *uid).is_ok();
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn resolve(
|
||||
source: &HipSource,
|
||||
desktop_uid: Option<u32>,
|
||||
brokered_macos: bool,
|
||||
edited_report: Option<Arc<str>>,
|
||||
) -> anyhow::Result<HipExecution> {
|
||||
match source {
|
||||
HipSource::Disabled => Ok(HipExecution::disabled()),
|
||||
HipSource::Generated => stage_runner(RunnerReport::Generated),
|
||||
HipSource::Edited { .. } => {
|
||||
let xml = edited_report.context("Edited HIP report was not uploaded for this connection")?;
|
||||
gphip::validate_edited_report(&xml)?;
|
||||
stage_runner(RunnerReport::Edited { xml: xml.to_string() })
|
||||
}
|
||||
HipSource::UserScript { path } => {
|
||||
if cfg!(target_os = "macos") || brokered_macos {
|
||||
bail!("Custom HIP scripts are unavailable on macOS");
|
||||
}
|
||||
let uid = desktop_uid.context("HIP custom scripts require a verified desktop user")?;
|
||||
ensure!(uid != 0, "HIP custom scripts require a non-root desktop user");
|
||||
let path = PathBuf::from(path);
|
||||
let metadata = fs::symlink_metadata(&path).context("Failed to inspect the HIP script")?;
|
||||
ensure!(
|
||||
metadata.is_file() && !metadata.file_type().is_symlink() && metadata.permissions().mode() & 0o111 != 0,
|
||||
"HIP custom script must be an executable regular file"
|
||||
);
|
||||
Ok(HipExecution::script(uid, path, None))
|
||||
}
|
||||
HipSource::ApprovedRootScript { approval_id } => {
|
||||
if cfg!(target_os = "macos") || brokered_macos {
|
||||
bail!("Custom HIP scripts are unavailable on macOS");
|
||||
}
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
{
|
||||
let owner_uid = desktop_uid.context("Root HIP scripts require a verified desktop user")?;
|
||||
gpservice::hip_approval::resolve(approval_id, owner_uid)?;
|
||||
let mut execution = stage_runner(RunnerReport::ApprovedRootScript {
|
||||
approval_id: approval_id.clone(),
|
||||
owner_uid,
|
||||
})?;
|
||||
execution.approval = Some((approval_id.clone(), owner_uid));
|
||||
Ok(execution)
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
|
||||
{
|
||||
let _ = (approval_id, desktop_uid);
|
||||
bail!("Root HIP script approvals are unavailable on this platform")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn preview_runner(edited_report: Option<Arc<str>>) -> anyhow::Result<HipExecution> {
|
||||
let report = if let Some(xml) = edited_report {
|
||||
gphip::validate_edited_report(&xml)?;
|
||||
RunnerReport::Edited { xml: xml.to_string() }
|
||||
} else {
|
||||
RunnerReport::Generated
|
||||
};
|
||||
stage_runner(report)
|
||||
}
|
||||
|
||||
fn stage_runner(report: RunnerReport) -> anyhow::Result<HipExecution> {
|
||||
let source = packaged_runner()?;
|
||||
let base = runner_state_base();
|
||||
fs::create_dir_all(base).context("Cannot create HIP runtime directory")?;
|
||||
validate_root_owned_path(base, false)?;
|
||||
fs::set_permissions(base, fs::Permissions::from_mode(0o700))?;
|
||||
let state_dir = Builder::new().prefix("session-").tempdir_in(base)?;
|
||||
fs::set_permissions(state_dir.path(), fs::Permissions::from_mode(0o700))?;
|
||||
validate_root_owned_path(state_dir.path(), false)?;
|
||||
|
||||
let runner = state_dir.path().join(RUNNER_NAME);
|
||||
fs::copy(&source, &runner).context("Cannot stage HIP runner")?;
|
||||
fs::set_permissions(&runner, fs::Permissions::from_mode(0o500))?;
|
||||
validate_root_owned_path(&runner, true)?;
|
||||
verify_staged_runner(&runner)?;
|
||||
|
||||
let encoded_state = serde_json::to_vec(&report)?;
|
||||
ensure!(
|
||||
encoded_state.len() <= MAX_STATE_BYTES,
|
||||
"HIP runner state exceeds its size limit"
|
||||
);
|
||||
let state = state_dir.path().join(STATE_NAME);
|
||||
let mut state_file = OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.mode(0o600)
|
||||
.open(&state)?;
|
||||
state_file.write_all(&encoded_state)?;
|
||||
state_file.flush()?;
|
||||
Ok(HipExecution::script(0, runner, Some(state_dir)))
|
||||
}
|
||||
|
||||
fn runner_state_base() -> &'static Path {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
Path::new("/private/var/db/gpclient/hip")
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
Path::new("/var/lib/gpclient/hip")
|
||||
}
|
||||
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
|
||||
{
|
||||
Path::new("/var/db/gpclient/hip")
|
||||
}
|
||||
}
|
||||
|
||||
fn packaged_runner() -> anyhow::Result<PathBuf> {
|
||||
#[cfg(target_os = "macos")]
|
||||
let path = std::env::current_exe()
|
||||
.context("Cannot locate HIP runner")?
|
||||
.with_file_name(RUNNER_NAME);
|
||||
#[cfg(target_os = "linux")]
|
||||
let path = PathBuf::from("/usr/libexec/gpclient/gp-hip-runner");
|
||||
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
|
||||
let path = PathBuf::from("/usr/local/libexec/gpclient/gp-hip-runner");
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
validate_root_owned_path(&path, true)?;
|
||||
#[cfg(target_os = "macos")]
|
||||
verify_packaged_macos_runner(&path)?;
|
||||
ensure!(path.is_file(), "Bundled HIP runner is missing");
|
||||
Ok(path)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn verify_packaged_macos_runner(path: &Path) -> anyhow::Result<()> {
|
||||
use std::process::Command;
|
||||
let service = std::env::current_exe()?;
|
||||
let app = service
|
||||
.parent()
|
||||
.and_then(Path::parent)
|
||||
.and_then(Path::parent)
|
||||
.context("gpservice is not in an app bundle")?;
|
||||
ensure!(
|
||||
path.parent() == service.parent(),
|
||||
"HIP runner is outside the app Helpers directory"
|
||||
);
|
||||
let status = Command::new("/usr/bin/codesign")
|
||||
.args(["--verify", "--deep", "--strict"])
|
||||
.arg(app)
|
||||
.status()?;
|
||||
ensure!(status.success(), "HIP application bundle signature is invalid");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn verify_staged_runner(path: &Path) -> anyhow::Result<()> {
|
||||
use std::process::Command;
|
||||
let status = Command::new("/usr/bin/codesign")
|
||||
.args(["--verify", "--strict"])
|
||||
.arg(path)
|
||||
.status()?;
|
||||
ensure!(status.success(), "Staged HIP runner signature is invalid");
|
||||
let service = std::env::current_exe()?;
|
||||
ensure!(
|
||||
signing_team(path)? == signing_team(&service)?,
|
||||
"HIP runner and service have different signing teams"
|
||||
);
|
||||
|
||||
// The staged runner has no app Frameworks directory. Reject any library
|
||||
// reference that could resolve through a writable bundle or search path.
|
||||
let output = Command::new("/usr/bin/otool").arg("-L").arg(path).output()?;
|
||||
ensure!(output.status.success(), "Cannot inspect HIP runner libraries");
|
||||
for library in String::from_utf8(output.stdout)?
|
||||
.lines()
|
||||
.skip(1)
|
||||
.filter_map(|line| line.trim().split_whitespace().next())
|
||||
{
|
||||
ensure!(
|
||||
library.starts_with("/usr/lib/") || library.starts_with("/System/Library/"),
|
||||
"HIP runner loads a library outside the trusted system paths"
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn signing_team(path: &Path) -> anyhow::Result<String> {
|
||||
let output = std::process::Command::new("/usr/bin/codesign")
|
||||
.args(["-d", "--verbose=4"])
|
||||
.arg(path)
|
||||
.output()?;
|
||||
ensure!(output.status.success(), "Cannot inspect code signature");
|
||||
let details = String::from_utf8(output.stderr)?;
|
||||
details
|
||||
.lines()
|
||||
.find_map(|line| line.strip_prefix("TeamIdentifier="))
|
||||
.filter(|team| !team.is_empty() && *team != "not set")
|
||||
.map(str::to_owned)
|
||||
.context("Signed HIP binary has no team identifier")
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
fn verify_staged_runner(_path: &Path) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn disabled_has_no_script_on_both_gui_platforms() {
|
||||
for brokered_macos in [false, true] {
|
||||
let execution = resolve(&HipSource::Disabled, None, brokered_macos, None).unwrap();
|
||||
assert!(!execution.enabled);
|
||||
assert!(execution.wrapper.is_none());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn custom_source_cannot_choose_root_or_run_on_macos() {
|
||||
let source = HipSource::UserScript {
|
||||
path: "/tmp/hip.sh".into(),
|
||||
};
|
||||
assert!(resolve(&source, None, false, None).is_err());
|
||||
assert!(resolve(&source, Some(0), false, None).is_err());
|
||||
assert!(resolve(&source, Some(1000), true, None).is_err());
|
||||
#[cfg(target_os = "macos")]
|
||||
assert!(resolve(&source, Some(1000), false, None).is_err());
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[test]
|
||||
fn root_source_requires_a_bound_user_and_installed_approval() {
|
||||
let source = HipSource::ApprovedRootScript {
|
||||
approval_id: "00000000-0000-4000-8000-000000000000".into(),
|
||||
};
|
||||
assert!(resolve(&source, None, false, None).is_err());
|
||||
assert!(resolve(&source, Some(0), false, None).is_err());
|
||||
assert!(resolve(&source, Some(1000), false, None).is_err());
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,5 @@
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub mod hip_approval;
|
||||
pub mod hip_runner_state;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub mod vpnc_script;
|
||||
@@ -45,7 +45,7 @@ impl CredentialServer {
|
||||
}
|
||||
let registry = Arc::clone(&self.registry);
|
||||
tokio::spawn(async move {
|
||||
if let Err(err) = credential_lease::serve(stream, registry).await {
|
||||
if let Err(err) = credential_lease::serve(stream, registry, None).await {
|
||||
warn!("Broker credential lease ended: {err}");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,7 +3,11 @@ mod cli;
|
||||
mod credential_lease;
|
||||
#[cfg(debug_assertions)]
|
||||
mod dev_bootstrap;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", all(test, unix)))]
|
||||
mod device_anchor;
|
||||
mod handlers;
|
||||
mod hip_preview;
|
||||
mod hip_source;
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos_broker;
|
||||
mod request_dispatcher;
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::{
|
||||
use common::binary_paths;
|
||||
use gpapi::{
|
||||
service::{
|
||||
request::{UpdateGuiRequest, WsRequest},
|
||||
request::{UpdateGuiRequest, UpdateLogLevelRequest, WsRequest},
|
||||
transport::{ServiceErrorCode, ServiceResult},
|
||||
},
|
||||
utils::{checksum::verify_checksum, redact::Redaction},
|
||||
@@ -17,7 +17,7 @@ use gpapi::{
|
||||
use log::{info, warn};
|
||||
use tar::Archive;
|
||||
use tempfile::NamedTempFile;
|
||||
use tokio::sync::{Mutex, mpsc};
|
||||
use tokio::sync::Mutex;
|
||||
use xz2::read::XzDecoder;
|
||||
|
||||
const MAX_GUI_ARCHIVE_SIZE: u64 = 256 * 1024 * 1024;
|
||||
@@ -25,7 +25,7 @@ const MAX_GUI_ARCHIVE_CONTENT_SIZE: u64 = 512 * 1024 * 1024;
|
||||
const MAX_GUI_BINARY_SIZE: u64 = 256 * 1024 * 1024;
|
||||
|
||||
pub struct RequestDispatcher {
|
||||
ws_req_tx: mpsc::Sender<WsRequest>,
|
||||
lifecycle: crate::vpn_task::LifecycleHandle,
|
||||
gui_restart_requested: Arc<AtomicBool>,
|
||||
redaction: Arc<Redaction>,
|
||||
install_lock: Mutex<()>,
|
||||
@@ -35,14 +35,14 @@ pub struct RequestDispatcher {
|
||||
|
||||
impl RequestDispatcher {
|
||||
pub fn new(
|
||||
ws_req_tx: mpsc::Sender<WsRequest>,
|
||||
lifecycle: crate::vpn_task::LifecycleHandle,
|
||||
gui_restart_requested: Arc<AtomicBool>,
|
||||
redaction: Arc<Redaction>,
|
||||
gui_management_enabled: bool,
|
||||
brokered_scripts_dir: Option<std::path::PathBuf>,
|
||||
) -> Self {
|
||||
Self {
|
||||
ws_req_tx,
|
||||
lifecycle,
|
||||
gui_restart_requested,
|
||||
redaction,
|
||||
install_lock: Mutex::new(()),
|
||||
@@ -51,7 +51,45 @@ impl RequestDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn dispatch_lifecycle(
|
||||
&self,
|
||||
request: WsRequest,
|
||||
desktop_uid: Option<u32>,
|
||||
edited_report: Option<Arc<str>>,
|
||||
session_id: Option<uuid::Uuid>,
|
||||
) -> Result<WsRequest, ServiceResult> {
|
||||
match request {
|
||||
WsRequest::Connect(request) => {
|
||||
if let Err(message) = self.validate_connect_paths(&request) {
|
||||
return Err(ServiceResult::rejected(ServiceErrorCode::InvalidRequest, message));
|
||||
}
|
||||
if let Err(err) = self
|
||||
.redaction
|
||||
.add_values(&[request.gateway().server(), request.args().cookie()])
|
||||
{
|
||||
warn!("Failed to update log redaction: {err}");
|
||||
return Err(ServiceResult::rejected(
|
||||
ServiceErrorCode::Internal,
|
||||
"Request could not be accepted",
|
||||
));
|
||||
}
|
||||
Err(
|
||||
self
|
||||
.lifecycle
|
||||
.submit_connect(*request, desktop_uid, edited_report, session_id),
|
||||
)
|
||||
}
|
||||
WsRequest::Disconnect(_) => Err(self.lifecycle.request_disconnect()),
|
||||
request => Ok(request),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn dispatch(&self, request: WsRequest) -> ServiceResult {
|
||||
let request = match self.dispatch_lifecycle(request, None, None, None) {
|
||||
Ok(request) => request,
|
||||
Err(result) => return result,
|
||||
};
|
||||
|
||||
match request {
|
||||
WsRequest::RestartGui => {
|
||||
if !self.gui_management_enabled {
|
||||
@@ -85,29 +123,22 @@ impl RequestDispatcher {
|
||||
ServiceResult::VpncScriptMetadata(None)
|
||||
}
|
||||
}
|
||||
request => {
|
||||
if let WsRequest::Connect(ref connect) = request {
|
||||
if let Err(message) = self.validate_connect_paths(connect) {
|
||||
return ServiceResult::rejected(ServiceErrorCode::InvalidRequest, message);
|
||||
}
|
||||
if let Err(err) = self
|
||||
.redaction
|
||||
.add_values(&[connect.gateway().server(), connect.args().cookie()])
|
||||
{
|
||||
warn!("Failed to update log redaction: {err}");
|
||||
return ServiceResult::rejected(ServiceErrorCode::Internal, "Request could not be accepted");
|
||||
}
|
||||
}
|
||||
|
||||
match self.ws_req_tx.try_send(request) {
|
||||
Ok(()) => ServiceResult::Accepted,
|
||||
Err(mpsc::error::TrySendError::Full(_)) => {
|
||||
ServiceResult::rejected(ServiceErrorCode::Busy, "Service request queue is full")
|
||||
}
|
||||
Err(mpsc::error::TrySendError::Closed(_)) => {
|
||||
ServiceResult::rejected(ServiceErrorCode::Internal, "VPN task is unavailable")
|
||||
}
|
||||
WsRequest::UpdateLogLevel(UpdateLogLevelRequest(level)) => {
|
||||
let level = level.parse().unwrap_or(log::Level::Info);
|
||||
info!("Updating log level to: {level}");
|
||||
if let Err(err) = gpapi::logger::set_max_level(level) {
|
||||
warn!("Failed to update log level: {err}");
|
||||
}
|
||||
ServiceResult::Accepted
|
||||
}
|
||||
WsRequest::Connect(_)
|
||||
| WsRequest::Disconnect(_)
|
||||
| WsRequest::StoreEditedHipReportChunk(_)
|
||||
| WsRequest::PreviewHipReport(_)
|
||||
| WsRequest::GetHipApprovalStatus { .. }
|
||||
| WsRequest::ReadHipPreviewChunk(_)
|
||||
| WsRequest::GetLastSubmittedHipReport => {
|
||||
unreachable!("session-bound request was already dispatched")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,12 +148,14 @@ impl RequestDispatcher {
|
||||
return Ok(());
|
||||
};
|
||||
let expected_script = scripts.join("vpnc-script").to_string_lossy().into_owned();
|
||||
let expected_wrapper = scripts.join("hipreport.sh").to_string_lossy().into_owned();
|
||||
if request.args().vpnc_script().as_deref() != Some(expected_script.as_str()) {
|
||||
return Err("macOS VPN script must be the bundled script");
|
||||
}
|
||||
if request.args().csd_wrapper().as_deref() != Some(expected_wrapper.as_str()) {
|
||||
return Err("macOS HIP wrapper must be the bundled wrapper");
|
||||
if matches!(
|
||||
request.args().hip_source(),
|
||||
gpapi::hip::HipSource::UserScript { .. } | gpapi::hip::HipSource::ApprovedRootScript { .. }
|
||||
) {
|
||||
return Err("macOS does not support custom HIP scripts");
|
||||
}
|
||||
if request.args().certificate().is_some() || request.args().sslkey().is_some() {
|
||||
return Err("macOS client identity must be provided as protected data, not root-readable paths");
|
||||
@@ -379,9 +412,8 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn brokered_mode_rejects_gui_management_and_root_readable_identity_paths() {
|
||||
let (request_tx, _request_rx) = mpsc::channel(1);
|
||||
let dispatcher = RequestDispatcher::new(
|
||||
request_tx,
|
||||
crate::vpn_task::LifecycleHandle::for_tests(),
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
Arc::new(Redaction::new()),
|
||||
false,
|
||||
@@ -396,7 +428,6 @@ mod tests {
|
||||
let info = gpapi::service::vpn_state::ConnectInfo::new("portal.example.com".into(), gateway.clone(), vec![gateway]);
|
||||
let request = ConnectRequest::new(info, "cookie".into())
|
||||
.with_vpnc_script(Some("/app/Contents/Resources/Scripts/vpnc-script".to_string()))
|
||||
.with_csd_wrapper(Some("/app/Contents/Resources/Scripts/hipreport.sh".to_string()))
|
||||
.with_certificate(Some("/Users/example/client.pem".to_string()));
|
||||
let ServiceResult::Rejected(rejection) = dispatcher.dispatch(WsRequest::Connect(Box::new(request))).await else {
|
||||
panic!("brokered mode accepted a root-readable identity path");
|
||||
@@ -406,9 +437,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn brokered_mode_accepts_only_resource_script_paths() {
|
||||
let (request_tx, _request_rx) = mpsc::channel(1);
|
||||
let dispatcher = RequestDispatcher::new(
|
||||
request_tx,
|
||||
crate::vpn_task::LifecycleHandle::for_tests(),
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
Arc::new(Redaction::new()),
|
||||
false,
|
||||
@@ -417,16 +447,24 @@ mod tests {
|
||||
let gateway = Gateway::new("Gateway".into(), "vpn.example.com".into());
|
||||
let info = gpapi::service::vpn_state::ConnectInfo::new("portal.example.com".into(), gateway.clone(), vec![gateway]);
|
||||
let bundled = ConnectRequest::new(info.clone(), "cookie".into())
|
||||
.with_vpnc_script(Some("/app/Contents/Resources/Scripts/vpnc-script".to_string()))
|
||||
.with_csd_wrapper(Some("/app/Contents/Resources/Scripts/hipreport.sh".to_string()));
|
||||
.with_vpnc_script(Some("/app/Contents/Resources/Scripts/vpnc-script".to_string()));
|
||||
assert_eq!(dispatcher.validate_connect_paths(&bundled), Ok(()));
|
||||
|
||||
let old_layout = ConnectRequest::new(info, "cookie".into())
|
||||
.with_vpnc_script(Some("/app/Contents/Helpers/vpnc-script".to_string()))
|
||||
.with_csd_wrapper(Some("/app/Contents/Helpers/hipreport.sh".to_string()));
|
||||
let old_layout = ConnectRequest::new(info.clone(), "cookie".into())
|
||||
.with_vpnc_script(Some("/app/Contents/Helpers/vpnc-script".to_string()));
|
||||
assert_eq!(
|
||||
dispatcher.validate_connect_paths(&old_layout),
|
||||
Err("macOS VPN script must be the bundled script")
|
||||
);
|
||||
|
||||
let custom = ConnectRequest::new(info, "cookie".into())
|
||||
.with_vpnc_script(Some("/app/Contents/Resources/Scripts/vpnc-script".to_string()))
|
||||
.with_hip_source(gpapi::hip::HipSource::UserScript {
|
||||
path: "/tmp/hip.sh".into(),
|
||||
});
|
||||
assert_eq!(
|
||||
dispatcher.validate_connect_paths(&custom),
|
||||
Err("macOS does not support custom HIP scripts")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
pub(crate) fn trusted_csd_uid() -> anyhow::Result<Option<u32>> {
|
||||
Ok(None)
|
||||
pub(crate) fn desktop_uid() -> Option<u32> {
|
||||
None
|
||||
}
|
||||
@@ -5,4 +5,4 @@ mod platform;
|
||||
#[path = "default.rs"]
|
||||
mod platform;
|
||||
|
||||
pub(crate) use platform::trusted_csd_uid;
|
||||
pub(crate) use platform::desktop_uid;
|
||||
@@ -1,7 +1,9 @@
|
||||
pub(crate) fn trusted_csd_uid() -> anyhow::Result<Option<u32>> {
|
||||
let uid = gpapi::process::users::get_non_root_user()?.uid();
|
||||
if uid == 0 {
|
||||
anyhow::bail!("The HIP script user must not be root");
|
||||
pub(crate) fn desktop_uid() -> Option<u32> {
|
||||
match gpapi::process::users::get_non_root_user() {
|
||||
Ok(user) => Some(user.uid()),
|
||||
Err(err) => {
|
||||
log::warn!("No verified desktop user is available for custom HIP scripts: {err}");
|
||||
None
|
||||
}
|
||||
}
|
||||
Ok(Some(uid))
|
||||
}
|
||||
@@ -13,9 +13,11 @@ use crate::ws_connection::ConnectionControl;
|
||||
|
||||
const ACTIVATION_TIMEOUT: Duration = Duration::from_secs(15);
|
||||
const MAX_PENDING_SESSIONS: usize = 16;
|
||||
const HIP_PREVIEW_CHUNK_BYTES: usize = 16 * 1024;
|
||||
|
||||
pub struct HandshakePermit {
|
||||
pub session_id: Uuid,
|
||||
pub desktop_uid: Option<u32>,
|
||||
pub observed_generation: u64,
|
||||
pub secret: Zeroizing<[u8; 32]>,
|
||||
token: Uuid,
|
||||
@@ -38,6 +40,13 @@ pub enum SessionError {
|
||||
ReconnectSuperseded,
|
||||
#[error("session registry is unavailable")]
|
||||
Unavailable,
|
||||
#[error("invalid HIP report upload")]
|
||||
InvalidHipUpload,
|
||||
}
|
||||
|
||||
pub enum HipUploadResult {
|
||||
Progress(Uuid),
|
||||
Stored(Uuid),
|
||||
}
|
||||
|
||||
enum SessionStatus {
|
||||
@@ -55,6 +64,11 @@ enum SessionStatus {
|
||||
struct SessionRecord {
|
||||
secret: Zeroizing<[u8; 32]>,
|
||||
product_version: String,
|
||||
desktop_uid: Option<u32>,
|
||||
edited_hip_report: Option<(Uuid, Arc<str>)>,
|
||||
edited_hip_upload: Option<(Uuid, String)>,
|
||||
hip_preview: Option<(Uuid, Arc<str>)>,
|
||||
last_successful_hip_report: Option<Arc<str>>,
|
||||
status: SessionStatus,
|
||||
}
|
||||
|
||||
@@ -71,7 +85,7 @@ impl SessionRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn issue(&self, product_version: &str) -> Result<Arc<SessionCredential>, SessionError> {
|
||||
pub fn issue(&self, product_version: &str, desktop_uid: Option<u32>) -> Result<Arc<SessionCredential>, SessionError> {
|
||||
let mut sessions = self.sessions.lock().map_err(|_| SessionError::Unavailable)?;
|
||||
let now = Instant::now();
|
||||
sessions.retain(|_, record| {
|
||||
@@ -90,14 +104,29 @@ impl SessionRegistry {
|
||||
return Err(SessionError::TooManyPending);
|
||||
}
|
||||
|
||||
let credential = Arc::new(
|
||||
SessionCredential::generate(self.service_instance_id, product_version).map_err(|_| SessionError::Unavailable)?,
|
||||
);
|
||||
let credential =
|
||||
SessionCredential::generate(self.service_instance_id, product_version).map_err(|_| SessionError::Unavailable)?;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
let credential = {
|
||||
let anchor = crate::device_anchor::resolve().map_err(|error| {
|
||||
log::warn!("GUI device anchor unavailable: {error:#}");
|
||||
SessionError::Unavailable
|
||||
})?;
|
||||
credential
|
||||
.with_device_anchor(anchor)
|
||||
.map_err(|_| SessionError::Unavailable)?
|
||||
};
|
||||
let credential = Arc::new(credential);
|
||||
sessions.insert(
|
||||
credential.session_id(),
|
||||
SessionRecord {
|
||||
secret: Zeroizing::new(*credential.secret()),
|
||||
product_version: credential.product_version().to_owned(),
|
||||
desktop_uid,
|
||||
edited_hip_report: None,
|
||||
edited_hip_upload: None,
|
||||
hip_preview: None,
|
||||
last_successful_hip_report: None,
|
||||
status: SessionStatus::Pending {
|
||||
activation_deadline: Instant::now() + ACTIVATION_TIMEOUT,
|
||||
handshake_token: None,
|
||||
@@ -176,6 +205,7 @@ impl SessionRegistry {
|
||||
let record = sessions.get(&session_id).ok_or(SessionError::Unauthorized)?;
|
||||
Ok(HandshakePermit {
|
||||
session_id,
|
||||
desktop_uid: record.desktop_uid,
|
||||
observed_generation,
|
||||
secret: Zeroizing::new(*record.secret),
|
||||
token,
|
||||
@@ -268,6 +298,122 @@ impl SessionRegistry {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn append_edited_hip_report_chunk(
|
||||
&self,
|
||||
session_id: Uuid,
|
||||
upload_id: Option<Uuid>,
|
||||
offset: usize,
|
||||
chunk: String,
|
||||
complete: bool,
|
||||
) -> Result<HipUploadResult, SessionError> {
|
||||
let mut sessions = self.sessions.lock().map_err(|_| SessionError::Unavailable)?;
|
||||
let record = sessions.get_mut(&session_id).ok_or(SessionError::Unauthorized)?;
|
||||
if !matches!(record.status, SessionStatus::Active { .. }) {
|
||||
return Err(SessionError::Unauthorized);
|
||||
}
|
||||
if upload_id.is_none() {
|
||||
if offset != 0 {
|
||||
return Err(SessionError::InvalidHipUpload);
|
||||
}
|
||||
record.edited_hip_upload = Some((Uuid::new_v4(), String::new()));
|
||||
}
|
||||
let (current_id, xml) = record
|
||||
.edited_hip_upload
|
||||
.as_mut()
|
||||
.ok_or(SessionError::InvalidHipUpload)?;
|
||||
if upload_id.is_some_and(|id| id != *current_id) || offset != xml.len() || chunk.len() > 8 * 1024 {
|
||||
return Err(SessionError::InvalidHipUpload);
|
||||
}
|
||||
if xml.len() + chunk.len() > gphip::MAX_EDITED_REPORT_BYTES {
|
||||
record.edited_hip_upload = None;
|
||||
return Err(SessionError::InvalidHipUpload);
|
||||
}
|
||||
xml.push_str(&chunk);
|
||||
if !complete {
|
||||
return Ok(HipUploadResult::Progress(*current_id));
|
||||
}
|
||||
if gphip::validate_edited_report(xml).is_err() {
|
||||
record.edited_hip_upload = None;
|
||||
return Err(SessionError::InvalidHipUpload);
|
||||
}
|
||||
let (_, xml) = record.edited_hip_upload.take().ok_or(SessionError::InvalidHipUpload)?;
|
||||
let report_id = Uuid::new_v4();
|
||||
record.edited_hip_report = Some((report_id, Arc::from(xml)));
|
||||
Ok(HipUploadResult::Stored(report_id))
|
||||
}
|
||||
|
||||
pub fn edited_hip_report(&self, session_id: Uuid, report_id: Uuid) -> Result<Arc<str>, SessionError> {
|
||||
let sessions = self.sessions.lock().map_err(|_| SessionError::Unavailable)?;
|
||||
let record = sessions.get(&session_id).ok_or(SessionError::Unauthorized)?;
|
||||
record
|
||||
.edited_hip_report
|
||||
.as_ref()
|
||||
.filter(|(id, _)| *id == report_id)
|
||||
.map(|(_, xml)| Arc::clone(xml))
|
||||
.ok_or(SessionError::Unauthorized)
|
||||
}
|
||||
|
||||
pub fn store_hip_preview(&self, session_id: Uuid, xml: String) -> Result<Uuid, SessionError> {
|
||||
let mut sessions = self.sessions.lock().map_err(|_| SessionError::Unavailable)?;
|
||||
let record = sessions.get_mut(&session_id).ok_or(SessionError::Unauthorized)?;
|
||||
if !matches!(record.status, SessionStatus::Active { .. }) {
|
||||
return Err(SessionError::Unauthorized);
|
||||
}
|
||||
let preview_id = Uuid::new_v4();
|
||||
record.hip_preview = Some((preview_id, Arc::from(xml)));
|
||||
Ok(preview_id)
|
||||
}
|
||||
|
||||
pub fn hip_preview_chunk(
|
||||
&self,
|
||||
session_id: Uuid,
|
||||
preview_id: Uuid,
|
||||
offset: usize,
|
||||
) -> Result<(String, bool), SessionError> {
|
||||
let sessions = self.sessions.lock().map_err(|_| SessionError::Unavailable)?;
|
||||
let record = sessions.get(&session_id).ok_or(SessionError::Unauthorized)?;
|
||||
let (_, xml) = record
|
||||
.hip_preview
|
||||
.as_ref()
|
||||
.filter(|(id, _)| *id == preview_id)
|
||||
.ok_or(SessionError::Unauthorized)?;
|
||||
if offset > xml.len() || !xml.is_char_boundary(offset) {
|
||||
return Err(SessionError::Unauthorized);
|
||||
}
|
||||
let mut end = (offset + HIP_PREVIEW_CHUNK_BYTES).min(xml.len());
|
||||
while !xml.is_char_boundary(end) {
|
||||
end -= 1;
|
||||
}
|
||||
Ok((xml[offset..end].to_owned(), end == xml.len()))
|
||||
}
|
||||
|
||||
pub fn store_successful_hip_report(&self, session_id: Uuid, xml: &str) -> Result<(), SessionError> {
|
||||
if xml.len() > 1024 * 1024 {
|
||||
return Err(SessionError::Unavailable);
|
||||
}
|
||||
let mut sessions = self.sessions.lock().map_err(|_| SessionError::Unavailable)?;
|
||||
let record = sessions.get_mut(&session_id).ok_or(SessionError::Unauthorized)?;
|
||||
if !matches!(record.status, SessionStatus::Active { .. }) {
|
||||
return Err(SessionError::Unauthorized);
|
||||
}
|
||||
record.last_successful_hip_report = Some(Arc::from(xml));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn last_successful_hip_report(&self, session_id: Uuid) -> Result<Option<Arc<str>>, SessionError> {
|
||||
let sessions = self.sessions.lock().map_err(|_| SessionError::Unavailable)?;
|
||||
let record = sessions.get(&session_id).ok_or(SessionError::Unauthorized)?;
|
||||
Ok(record.last_successful_hip_report.as_ref().map(Arc::clone))
|
||||
}
|
||||
|
||||
pub fn clear_successful_hip_report(&self, session_id: Uuid) {
|
||||
if let Ok(mut sessions) = self.sessions.lock()
|
||||
&& let Some(record) = sessions.get_mut(&session_id)
|
||||
{
|
||||
record.last_successful_hip_report = None;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn disconnect_if_current(&self, session_id: Uuid, generation: u64) {
|
||||
let Ok(mut sessions) = self.sessions.lock() else {
|
||||
return;
|
||||
@@ -322,10 +468,144 @@ mod tests {
|
||||
ConnectionControl::new(Uuid::new_v4(), tx).0
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn credential_retains_verified_desktop_user_across_reconnect() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue("2.6.4", Some(1000)).unwrap();
|
||||
let first = registry
|
||||
.begin_handshake(credential.service_instance_id(), credential.session_id(), "2.6.4")
|
||||
.unwrap();
|
||||
assert_eq!(first.desktop_uid, Some(1000));
|
||||
registry.commit_attach(&first, control()).unwrap();
|
||||
|
||||
let reconnect = registry
|
||||
.begin_handshake(credential.service_instance_id(), credential.session_id(), "2.6.4")
|
||||
.unwrap();
|
||||
assert_eq!(reconnect.desktop_uid, Some(1000));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn edited_hip_report_is_session_bound_and_replaced_without_affecting_pinned_content() {
|
||||
fn upload(registry: &SessionRegistry, session_id: Uuid, xml: &str) -> Uuid {
|
||||
let mut upload_id = None;
|
||||
let mut offset = 0;
|
||||
while offset < xml.len() {
|
||||
let mut end = (offset + 8 * 1024).min(xml.len());
|
||||
while !xml.is_char_boundary(end) {
|
||||
end -= 1;
|
||||
}
|
||||
let complete = end == xml.len();
|
||||
match registry
|
||||
.append_edited_hip_report_chunk(session_id, upload_id, offset, xml[offset..end].into(), complete)
|
||||
.unwrap()
|
||||
{
|
||||
HipUploadResult::Progress(id) => upload_id = Some(id),
|
||||
HipUploadResult::Stored(id) => return id,
|
||||
}
|
||||
offset = end;
|
||||
}
|
||||
panic!("upload did not complete")
|
||||
}
|
||||
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let first_credential = registry.issue("2.6.4", Some(1000)).unwrap();
|
||||
let second_credential = registry.issue("2.6.4", Some(1001)).unwrap();
|
||||
for credential in [&first_credential, &second_credential] {
|
||||
let permit = registry
|
||||
.begin_handshake(credential.service_instance_id(), credential.session_id(), "2.6.4")
|
||||
.unwrap();
|
||||
registry.commit_attach(&permit, control()).unwrap();
|
||||
}
|
||||
|
||||
let valid = gphip::generate_report(&gphip::ReportInput {
|
||||
profile: gpapi::os_profile::OsProfile::builder(gpapi::os_profile::ClientOs::Linux).build(),
|
||||
context: gphip::ReportContext::Preview,
|
||||
})
|
||||
.unwrap();
|
||||
let first_id = upload(®istry, first_credential.session_id(), &valid);
|
||||
let pinned = registry
|
||||
.edited_hip_report(first_credential.session_id(), first_id)
|
||||
.unwrap();
|
||||
assert!(matches!(
|
||||
registry.edited_hip_report(second_credential.session_id(), first_id),
|
||||
Err(SessionError::Unauthorized)
|
||||
));
|
||||
let second_id = upload(®istry, first_credential.session_id(), &valid);
|
||||
assert!(matches!(
|
||||
registry.edited_hip_report(first_credential.session_id(), first_id),
|
||||
Err(SessionError::Unauthorized)
|
||||
));
|
||||
assert_eq!(
|
||||
&*registry
|
||||
.edited_hip_report(first_credential.session_id(), second_id)
|
||||
.unwrap(),
|
||||
valid
|
||||
);
|
||||
assert_eq!(&*pinned, valid);
|
||||
registry.revoke(first_credential.session_id());
|
||||
assert!(matches!(
|
||||
registry.edited_hip_report(first_credential.session_id(), second_id),
|
||||
Err(SessionError::Unauthorized)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn submitted_report_changes_only_after_success_callback_and_is_session_bound() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue("2.6.4", Some(1000)).unwrap();
|
||||
let permit = registry
|
||||
.begin_handshake(credential.service_instance_id(), credential.session_id(), "2.6.4")
|
||||
.unwrap();
|
||||
registry.commit_attach(&permit, control()).unwrap();
|
||||
assert!(
|
||||
registry
|
||||
.last_successful_hip_report(credential.session_id())
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
registry
|
||||
.store_successful_hip_report(credential.session_id(), "first")
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
registry
|
||||
.last_successful_hip_report(credential.session_id())
|
||||
.unwrap()
|
||||
.as_deref(),
|
||||
Some("first")
|
||||
);
|
||||
let preview_id = registry
|
||||
.store_hip_preview(credential.session_id(), "é".repeat(8193))
|
||||
.unwrap();
|
||||
let (first_chunk, complete) = registry
|
||||
.hip_preview_chunk(credential.session_id(), preview_id, 0)
|
||||
.unwrap();
|
||||
assert!(!complete);
|
||||
assert!(first_chunk.len() <= HIP_PREVIEW_CHUNK_BYTES);
|
||||
assert!(
|
||||
registry
|
||||
.hip_preview_chunk(credential.session_id(), preview_id, 1)
|
||||
.is_err()
|
||||
);
|
||||
assert_eq!(
|
||||
registry
|
||||
.last_successful_hip_report(credential.session_id())
|
||||
.unwrap()
|
||||
.as_deref(),
|
||||
Some("first")
|
||||
);
|
||||
registry.clear_successful_hip_report(credential.session_id());
|
||||
assert!(
|
||||
registry
|
||||
.last_successful_hip_report(credential.session_id())
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reconnect_uses_generation_compare_and_swap() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue("2.6.4").unwrap();
|
||||
let credential = registry.issue("2.6.4", None).unwrap();
|
||||
let first = registry
|
||||
.begin_handshake(credential.service_instance_id(), credential.session_id(), "2.6.4")
|
||||
.unwrap();
|
||||
@@ -346,7 +626,7 @@ mod tests {
|
||||
#[test]
|
||||
fn failed_initial_handshake_only_revokes_its_own_reservation() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue("2.6.4").unwrap();
|
||||
let credential = registry.issue("2.6.4", None).unwrap();
|
||||
let first = registry
|
||||
.begin_handshake(credential.service_instance_id(), credential.session_id(), "2.6.4")
|
||||
.unwrap();
|
||||
@@ -360,7 +640,7 @@ mod tests {
|
||||
#[test]
|
||||
fn failed_reconnect_keeps_active_connection_authoritative() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue("2.6.4").unwrap();
|
||||
let credential = registry.issue("2.6.4", None).unwrap();
|
||||
let first = registry
|
||||
.begin_handshake(credential.service_instance_id(), credential.session_id(), "2.6.4")
|
||||
.unwrap();
|
||||
|
||||
+597
-175
@@ -1,73 +1,389 @@
|
||||
use std::{io::Write, os::unix::fs::PermissionsExt, sync::Arc, thread};
|
||||
use std::{
|
||||
io::Write,
|
||||
os::unix::fs::PermissionsExt,
|
||||
sync::{
|
||||
Arc, Mutex,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
},
|
||||
thread,
|
||||
};
|
||||
|
||||
use gpapi::{
|
||||
logger,
|
||||
service::{
|
||||
request::{ConnectRequest, MAX_CLIENT_IDENTITY_DATA, UpdateLogLevelRequest, WsRequest},
|
||||
vpn_state::{ConnectedInfo, VpnState},
|
||||
request::{ConnectRequest, MAX_CLIENT_IDENTITY_DATA},
|
||||
transport::{ServiceErrorCode, ServiceResult},
|
||||
vpn_state::{ConnectInfo, ConnectedInfo, VpnState},
|
||||
},
|
||||
session::{SessionInfo, SessionWarning},
|
||||
};
|
||||
use log::{info, warn};
|
||||
use openconnect::Vpn;
|
||||
use tokio::sync::{RwLock, mpsc, oneshot, watch};
|
||||
use openconnect::{Vpn, VpnSessionInfo};
|
||||
use tokio::sync::{Notify, mpsc, watch};
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use uuid::Uuid;
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
pub(crate) struct VpnTaskContext {
|
||||
vpn_handle: Arc<RwLock<Option<Vpn>>>,
|
||||
vpn_state_tx: Arc<watch::Sender<VpnState>>,
|
||||
disconnect_rx: RwLock<Option<oneshot::Receiver<()>>>,
|
||||
brokered_macos: bool,
|
||||
trusted_csd_uid: Option<u32>,
|
||||
identity_files: Arc<RwLock<Vec<tempfile::NamedTempFile>>>,
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct LifecycleHandle {
|
||||
events: mpsc::Sender<LifecycleEvent>,
|
||||
admissions: Arc<Mutex<Admissions>>,
|
||||
}
|
||||
|
||||
impl VpnTaskContext {
|
||||
pub fn new(vpn_state_tx: watch::Sender<VpnState>, brokered_macos: bool, trusted_csd_uid: Option<u32>) -> Self {
|
||||
Self {
|
||||
vpn_handle: Default::default(),
|
||||
vpn_state_tx: Arc::new(vpn_state_tx),
|
||||
disconnect_rx: Default::default(),
|
||||
brokered_macos,
|
||||
trusted_csd_uid,
|
||||
identity_files: Default::default(),
|
||||
impl LifecycleHandle {
|
||||
pub fn submit_connect(
|
||||
&self,
|
||||
request: ConnectRequest,
|
||||
desktop_uid: Option<u32>,
|
||||
edited_report: Option<Arc<str>>,
|
||||
session_id: Option<Uuid>,
|
||||
) -> ServiceResult {
|
||||
let attempt = {
|
||||
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
|
||||
if admissions.current.is_some() {
|
||||
return ServiceResult::rejected(ServiceErrorCode::Busy, "A VPN connection is already in progress");
|
||||
}
|
||||
let attempt = admissions.next_attempt;
|
||||
admissions.next_attempt += 1;
|
||||
admissions.current = Some(Admission {
|
||||
attempt,
|
||||
phase: AdmissionPhase::Pending,
|
||||
stop_requested: false,
|
||||
completion: Arc::new(AttemptCompletion::default()),
|
||||
});
|
||||
attempt
|
||||
};
|
||||
|
||||
match self.events.try_send(LifecycleEvent::Start {
|
||||
attempt,
|
||||
request,
|
||||
desktop_uid,
|
||||
edited_report,
|
||||
session_id,
|
||||
}) {
|
||||
Ok(()) => ServiceResult::Accepted,
|
||||
Err(mpsc::error::TrySendError::Full(_)) => {
|
||||
self.clear_attempt(attempt);
|
||||
ServiceResult::rejected(ServiceErrorCode::Busy, "VPN lifecycle queue is full")
|
||||
}
|
||||
Err(mpsc::error::TrySendError::Closed(_)) => {
|
||||
self.clear_attempt(attempt);
|
||||
ServiceResult::rejected(ServiceErrorCode::Internal, "VPN task is unavailable")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn connect(&self, req: ConnectRequest) {
|
||||
let vpn_state = self.vpn_state_tx.borrow().clone();
|
||||
if !matches!(vpn_state, VpnState::Disconnected) {
|
||||
info!("VPN is not disconnected, ignore the request");
|
||||
pub fn request_disconnect(&self) -> ServiceResult {
|
||||
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
|
||||
let Some(admission) = admissions.current.as_mut() else {
|
||||
return ServiceResult::Accepted;
|
||||
};
|
||||
if admission.stop_requested {
|
||||
return ServiceResult::Accepted;
|
||||
}
|
||||
|
||||
match self.events.try_send(LifecycleEvent::Stop {
|
||||
attempt: admission.attempt,
|
||||
}) {
|
||||
Ok(()) => {
|
||||
admission.stop_requested = true;
|
||||
admission.phase = AdmissionPhase::Stopping;
|
||||
ServiceResult::Accepted
|
||||
}
|
||||
Err(mpsc::error::TrySendError::Full(_)) => {
|
||||
ServiceResult::rejected(ServiceErrorCode::Busy, "VPN lifecycle queue is full")
|
||||
}
|
||||
Err(mpsc::error::TrySendError::Closed(_)) => {
|
||||
ServiceResult::rejected(ServiceErrorCode::Internal, "VPN task is unavailable")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn disconnect_and_wait(&self) -> bool {
|
||||
let completion = {
|
||||
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
|
||||
let Some(admission) = admissions.current.as_mut() else {
|
||||
return false;
|
||||
};
|
||||
if !admission.stop_requested {
|
||||
if self
|
||||
.events
|
||||
.try_send(LifecycleEvent::Stop {
|
||||
attempt: admission.attempt,
|
||||
})
|
||||
.is_err()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
admission.stop_requested = true;
|
||||
admission.phase = AdmissionPhase::Stopping;
|
||||
}
|
||||
Arc::clone(&admission.completion)
|
||||
};
|
||||
|
||||
loop {
|
||||
let notified = completion.notify.notified();
|
||||
if completion.completed.load(Ordering::Acquire) {
|
||||
return true;
|
||||
}
|
||||
notified.await;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn has_attempt(&self, attempt: u64) -> bool {
|
||||
self
|
||||
.admissions
|
||||
.lock()
|
||||
.expect("VPN lifecycle admissions mutex poisoned")
|
||||
.current
|
||||
.as_ref()
|
||||
.is_some_and(|admission| admission.attempt == attempt)
|
||||
}
|
||||
|
||||
fn is_stop_requested(&self, attempt: u64) -> bool {
|
||||
self
|
||||
.admissions
|
||||
.lock()
|
||||
.expect("VPN lifecycle admissions mutex poisoned")
|
||||
.current
|
||||
.as_ref()
|
||||
.is_some_and(|admission| admission.attempt == attempt && admission.stop_requested)
|
||||
}
|
||||
|
||||
fn activate_attempt(&self, attempt: u64) -> bool {
|
||||
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
|
||||
let Some(admission) = admissions.current.as_mut() else {
|
||||
return false;
|
||||
};
|
||||
if admission.attempt != attempt || admission.stop_requested || admission.phase != AdmissionPhase::Pending {
|
||||
return false;
|
||||
}
|
||||
admission.phase = AdmissionPhase::Active;
|
||||
true
|
||||
}
|
||||
|
||||
fn clear_attempt(&self, attempt: u64) {
|
||||
let completion = {
|
||||
let mut admissions = self.admissions.lock().expect("VPN lifecycle admissions mutex poisoned");
|
||||
let Some(admission) = admissions.current.as_ref() else {
|
||||
return;
|
||||
};
|
||||
if admission.attempt != attempt {
|
||||
return;
|
||||
}
|
||||
let completion = Arc::clone(&admission.completion);
|
||||
admissions.current = None;
|
||||
completion
|
||||
};
|
||||
completion.completed.store(true, Ordering::Release);
|
||||
completion.notify.notify_waiters();
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn for_tests() -> Self {
|
||||
let (vpn_state_tx, _vpn_state_rx) = watch::channel(VpnState::Disconnected);
|
||||
let registry = Arc::new(crate::session_registry::SessionRegistry::new(Uuid::new_v4()));
|
||||
let (_task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry);
|
||||
lifecycle
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Admissions {
|
||||
next_attempt: u64,
|
||||
current: Option<Admission>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Admission {
|
||||
attempt: u64,
|
||||
phase: AdmissionPhase,
|
||||
stop_requested: bool,
|
||||
completion: Arc<AttemptCompletion>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct AttemptCompletion {
|
||||
completed: AtomicBool,
|
||||
notify: Notify,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
enum AdmissionPhase {
|
||||
Pending,
|
||||
Active,
|
||||
Stopping,
|
||||
}
|
||||
|
||||
enum LifecycleEvent {
|
||||
Start {
|
||||
attempt: u64,
|
||||
request: ConnectRequest,
|
||||
desktop_uid: Option<u32>,
|
||||
edited_report: Option<Arc<str>>,
|
||||
session_id: Option<Uuid>,
|
||||
},
|
||||
Stop {
|
||||
attempt: u64,
|
||||
},
|
||||
Established {
|
||||
attempt: u64,
|
||||
session: VpnSessionInfo,
|
||||
},
|
||||
Ended {
|
||||
attempt: u64,
|
||||
},
|
||||
}
|
||||
|
||||
struct ActiveAttempt {
|
||||
attempt: u64,
|
||||
session_id: Option<Uuid>,
|
||||
vpn: Arc<Vpn>,
|
||||
info: ConnectInfo,
|
||||
allow_extend_session: bool,
|
||||
_identity_files: Vec<tempfile::NamedTempFile>,
|
||||
_hip_execution: crate::hip_source::HipExecution,
|
||||
}
|
||||
|
||||
pub(crate) struct VpnTask {
|
||||
events: mpsc::Receiver<LifecycleEvent>,
|
||||
lifecycle: LifecycleHandle,
|
||||
vpn_state_tx: watch::Sender<VpnState>,
|
||||
brokered_macos: bool,
|
||||
registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
active: Option<ActiveAttempt>,
|
||||
cancel_token: CancellationToken,
|
||||
}
|
||||
|
||||
impl VpnTask {
|
||||
pub fn new(
|
||||
vpn_state_tx: watch::Sender<VpnState>,
|
||||
brokered_macos: bool,
|
||||
registry: Arc<crate::session_registry::SessionRegistry>,
|
||||
) -> (Self, LifecycleHandle) {
|
||||
let (events_tx, events) = mpsc::channel(4);
|
||||
let lifecycle = LifecycleHandle {
|
||||
events: events_tx,
|
||||
admissions: Arc::new(Mutex::new(Admissions::default())),
|
||||
};
|
||||
let task = Self {
|
||||
events,
|
||||
lifecycle: lifecycle.clone(),
|
||||
vpn_state_tx,
|
||||
brokered_macos,
|
||||
registry,
|
||||
active: None,
|
||||
cancel_token: CancellationToken::new(),
|
||||
};
|
||||
(task, lifecycle)
|
||||
}
|
||||
|
||||
pub fn cancel_token(&self) -> CancellationToken {
|
||||
self.cancel_token.clone()
|
||||
}
|
||||
|
||||
pub async fn start(&mut self, server_cancel_token: CancellationToken) {
|
||||
let cancel_token = self.cancel_token.clone();
|
||||
let mut shutting_down = false;
|
||||
let mut approval_poll = tokio::time::interval(std::time::Duration::from_secs(1));
|
||||
|
||||
loop {
|
||||
if shutting_down {
|
||||
if self.active.is_none() && !self.has_admission() {
|
||||
break;
|
||||
}
|
||||
let Some(event) = self.events.recv().await else { break };
|
||||
self.handle_event(event);
|
||||
continue;
|
||||
}
|
||||
|
||||
tokio::select! {
|
||||
event = self.events.recv() => {
|
||||
let Some(event) = event else { break };
|
||||
self.handle_event(event);
|
||||
}
|
||||
_ = cancel_token.cancelled() => {
|
||||
info!("VPN task cancelled");
|
||||
shutting_down = true;
|
||||
self.lifecycle.request_disconnect();
|
||||
}
|
||||
_ = approval_poll.tick() => {
|
||||
if self.active.as_ref().is_some_and(|active| {
|
||||
active._hip_execution.approval_id().is_some() && !active._hip_execution.approval_is_valid()
|
||||
}) {
|
||||
warn!("Active HIP script approval is no longer valid; disconnecting VPN");
|
||||
self.lifecycle.request_disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server_cancel_token.cancel();
|
||||
info!("VPN task stopped");
|
||||
}
|
||||
|
||||
fn has_admission(&self) -> bool {
|
||||
self
|
||||
.lifecycle
|
||||
.admissions
|
||||
.lock()
|
||||
.expect("VPN lifecycle admissions mutex poisoned")
|
||||
.current
|
||||
.is_some()
|
||||
}
|
||||
|
||||
fn handle_event(&mut self, event: LifecycleEvent) {
|
||||
match event {
|
||||
LifecycleEvent::Start {
|
||||
attempt,
|
||||
request,
|
||||
desktop_uid,
|
||||
edited_report,
|
||||
session_id,
|
||||
} => self.start_attempt(attempt, request, desktop_uid, edited_report, session_id),
|
||||
LifecycleEvent::Stop { attempt } => self.stop_attempt(attempt),
|
||||
LifecycleEvent::Established { attempt, session } => self.establish_attempt(attempt, session),
|
||||
LifecycleEvent::Ended { attempt } => self.end_attempt(attempt),
|
||||
}
|
||||
}
|
||||
|
||||
fn start_attempt(
|
||||
&mut self,
|
||||
attempt: u64,
|
||||
request: ConnectRequest,
|
||||
desktop_uid: Option<u32>,
|
||||
edited_report: Option<Arc<str>>,
|
||||
session_id: Option<Uuid>,
|
||||
) {
|
||||
if !self.lifecycle.activate_attempt(attempt) {
|
||||
self.finish_attempt(attempt);
|
||||
return;
|
||||
}
|
||||
|
||||
let vpn_state_tx = self.vpn_state_tx.clone();
|
||||
let info = req.info().clone();
|
||||
let vpn_handle = Arc::clone(&self.vpn_handle);
|
||||
let args = req.args();
|
||||
let info = request.info().clone();
|
||||
let args = request.args();
|
||||
let identity = match prepare_identity(args, self.brokered_macos) {
|
||||
Ok(identity) => identity,
|
||||
Err(err) => {
|
||||
warn!("Failed to prepare client identity: {err}");
|
||||
vpn_state_tx.send(VpnState::Disconnected).ok();
|
||||
self.finish_attempt(attempt);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let allow_extend_session = args.allow_extend_session();
|
||||
let vpn_builder = match crate::vpn_script::builder(req.gateway().server(), args.cookie(), args) {
|
||||
let vpn_builder = match crate::vpn_script::builder(request.gateway().server(), args.cookie(), args) {
|
||||
Ok(builder) => builder,
|
||||
Err(err) => {
|
||||
warn!("Failed to select the VPNC script: {err}");
|
||||
vpn_state_tx.send(VpnState::Disconnected).ok();
|
||||
self.finish_attempt(attempt);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let csd_uid = match resolve_csd_uid(self.trusted_csd_uid, args.csd_uid(), args.hip()) {
|
||||
Ok(uid) => uid,
|
||||
let hip = match crate::hip_source::resolve(args.hip_source(), desktop_uid, self.brokered_macos, edited_report) {
|
||||
Ok(execution) => execution,
|
||||
Err(err) => {
|
||||
warn!("Failed to select the HIP script user: {err}");
|
||||
vpn_state_tx.send(VpnState::Disconnected).ok();
|
||||
self.finish_attempt(attempt);
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -80,9 +396,9 @@ impl VpnTaskContext {
|
||||
.certificate(identity.certificate.clone())
|
||||
.sslkey(identity.sslkey.clone())
|
||||
.key_password(args.key_password())
|
||||
.hip(args.hip())
|
||||
.csd_uid(csd_uid)
|
||||
.csd_wrapper(args.csd_wrapper())
|
||||
.hip(hip.enabled)
|
||||
.csd_uid(hip.uid)
|
||||
.csd_wrapper(hip.wrapper.clone())
|
||||
.reconnect_timeout(args.reconnect_timeout())
|
||||
.mtu(args.mtu())
|
||||
.disable_ipv6(args.disable_ipv6())
|
||||
@@ -92,137 +408,135 @@ impl VpnTaskContext {
|
||||
.no_xmlpost(args.no_xmlpost())
|
||||
.build()
|
||||
{
|
||||
Ok(vpn) => vpn,
|
||||
Ok(vpn) => Arc::new(vpn),
|
||||
Err(err) => {
|
||||
warn!("Failed to create VPN: {}", err);
|
||||
vpn_state_tx.send(VpnState::Disconnected).ok();
|
||||
warn!("Failed to create VPN: {err}");
|
||||
self.finish_attempt(attempt);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
// Save the VPN handle
|
||||
vpn_handle.write().await.replace(vpn);
|
||||
*self.identity_files.write().await = identity.files;
|
||||
let connect_info = Box::new(info.clone());
|
||||
vpn_state_tx.send(VpnState::Connecting(connect_info)).ok();
|
||||
|
||||
let (disconnect_tx, disconnect_rx) = oneshot::channel::<()>();
|
||||
self.disconnect_rx.write().await.replace(disconnect_rx);
|
||||
let identity_files = Arc::clone(&self.identity_files);
|
||||
|
||||
// Spawn a new thread to process the VPN connection, cannot use tokio::spawn here.
|
||||
// Otherwise, it will block the tokio runtime and cannot send the VPN state to the channel
|
||||
thread::spawn(move || {
|
||||
let vpn_state_tx_clone = vpn_state_tx.clone();
|
||||
|
||||
vpn_handle.blocking_read().as_ref().map(|vpn| {
|
||||
vpn.connect(move |vpn_session_info| {
|
||||
let session_info = SessionInfo::from_vpn_session_fields(
|
||||
vpn_session_info.lifetime_secs,
|
||||
vpn_session_info.user_expires,
|
||||
vpn_session_info.lifetime_warning.map(|warning| SessionWarning {
|
||||
prior_secs: warning.prior_secs,
|
||||
message: warning.message,
|
||||
}),
|
||||
allow_extend_session,
|
||||
);
|
||||
info!("VPN session info: {}", session_info.log_summary());
|
||||
let connected_info = Box::new(ConnectedInfo::new(info.clone(), Some(session_info)));
|
||||
vpn_state_tx.send(VpnState::Connected(connected_info)).ok();
|
||||
})
|
||||
if let Some(session_id) = session_id {
|
||||
let registry = Arc::clone(&self.registry);
|
||||
vpn.set_hip_report_callback(move |xml| {
|
||||
if let Err(error) = registry.store_successful_hip_report(session_id, xml) {
|
||||
warn!("Could not retain the submitted HIP report: {error}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Notify the VPN is disconnected
|
||||
vpn_state_tx_clone.send(VpnState::Disconnected).ok();
|
||||
// Remove the VPN handle
|
||||
vpn_handle.blocking_write().take();
|
||||
identity_files.blocking_write().clear();
|
||||
if self.lifecycle.is_stop_requested(attempt) {
|
||||
self.finish_attempt(attempt);
|
||||
return;
|
||||
}
|
||||
|
||||
disconnect_tx.send(()).ok();
|
||||
});
|
||||
}
|
||||
|
||||
pub async fn disconnect(&self) -> bool {
|
||||
if let Some(disconnect_rx) = self.disconnect_rx.write().await.take() {
|
||||
info!("Disconnecting VPN...");
|
||||
if let Some(vpn) = self.vpn_handle.read().await.as_ref() {
|
||||
info!("VPN is connected, start disconnecting...");
|
||||
self.vpn_state_tx.send(VpnState::Disconnecting).ok();
|
||||
vpn.disconnect()
|
||||
let events = self.lifecycle.events.clone();
|
||||
let started = {
|
||||
let admissions = self
|
||||
.lifecycle
|
||||
.admissions
|
||||
.lock()
|
||||
.expect("VPN lifecycle admissions mutex poisoned");
|
||||
let can_start = admissions.current.as_ref().is_some_and(|admission| {
|
||||
admission.attempt == attempt && admission.phase == AdmissionPhase::Active && !admission.stop_requested
|
||||
});
|
||||
if !can_start {
|
||||
false
|
||||
} else {
|
||||
self.active = Some(ActiveAttempt {
|
||||
attempt,
|
||||
session_id,
|
||||
vpn: Arc::clone(&vpn),
|
||||
info: info.clone(),
|
||||
allow_extend_session,
|
||||
_identity_files: identity.files,
|
||||
_hip_execution: hip,
|
||||
});
|
||||
self.send_state(VpnState::Connecting(Box::new(info)));
|
||||
thread::spawn(move || {
|
||||
let established_events = events.clone();
|
||||
vpn.connect(move |vpn_session_info| {
|
||||
let _ = established_events.blocking_send(LifecycleEvent::Established {
|
||||
attempt,
|
||||
session: vpn_session_info,
|
||||
});
|
||||
});
|
||||
let _ = events.blocking_send(LifecycleEvent::Ended { attempt });
|
||||
});
|
||||
true
|
||||
}
|
||||
// Wait for the VPN to be disconnected
|
||||
disconnect_rx.await.ok();
|
||||
info!("VPN disconnected");
|
||||
|
||||
true
|
||||
} else {
|
||||
info!("VPN is not connected, skip disconnect");
|
||||
self.vpn_state_tx.send(VpnState::Disconnected).ok();
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct VpnTask {
|
||||
ws_req_rx: mpsc::Receiver<WsRequest>,
|
||||
ctx: Arc<VpnTaskContext>,
|
||||
cancel_token: CancellationToken,
|
||||
}
|
||||
|
||||
impl VpnTask {
|
||||
pub fn new(
|
||||
ws_req_rx: mpsc::Receiver<WsRequest>,
|
||||
vpn_state_tx: watch::Sender<VpnState>,
|
||||
brokered_macos: bool,
|
||||
trusted_csd_uid: Option<u32>,
|
||||
) -> Self {
|
||||
let ctx = Arc::new(VpnTaskContext::new(vpn_state_tx, brokered_macos, trusted_csd_uid));
|
||||
let cancel_token = CancellationToken::new();
|
||||
|
||||
Self {
|
||||
ws_req_rx,
|
||||
ctx,
|
||||
cancel_token,
|
||||
};
|
||||
if !started {
|
||||
self.finish_attempt(attempt);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cancel_token(&self) -> CancellationToken {
|
||||
self.cancel_token.clone()
|
||||
}
|
||||
|
||||
pub async fn start(&mut self, server_cancel_token: CancellationToken) {
|
||||
let cancel_token = self.cancel_token.clone();
|
||||
|
||||
tokio::select! {
|
||||
_ = self.recv() => {
|
||||
info!("VPN task stopped");
|
||||
}
|
||||
_ = cancel_token.cancelled() => {
|
||||
info!("VPN task cancelled");
|
||||
self.ctx.disconnect().await;
|
||||
}
|
||||
fn stop_attempt(&mut self, attempt: u64) {
|
||||
let Some(active) = self.active.as_ref() else {
|
||||
return;
|
||||
};
|
||||
if active.attempt != attempt || !self.lifecycle.is_stop_requested(attempt) {
|
||||
return;
|
||||
}
|
||||
|
||||
server_cancel_token.cancel();
|
||||
info!("Disconnecting VPN...");
|
||||
self.send_state(VpnState::Disconnecting);
|
||||
active.vpn.disconnect();
|
||||
}
|
||||
|
||||
pub fn context(&self) -> Arc<VpnTaskContext> {
|
||||
Arc::clone(&self.ctx)
|
||||
fn establish_attempt(&mut self, attempt: u64, vpn_session_info: VpnSessionInfo) {
|
||||
let Some(active) = self.active.as_ref() else {
|
||||
return;
|
||||
};
|
||||
if active.attempt != attempt {
|
||||
return;
|
||||
}
|
||||
|
||||
let session_info = SessionInfo::from_vpn_session_fields(
|
||||
vpn_session_info.lifetime_secs,
|
||||
vpn_session_info.user_expires,
|
||||
vpn_session_info.lifetime_warning.map(|warning| SessionWarning {
|
||||
prior_secs: warning.prior_secs,
|
||||
message: warning.message,
|
||||
}),
|
||||
active.allow_extend_session,
|
||||
);
|
||||
self.publish_connected(attempt, active.info.clone(), session_info);
|
||||
}
|
||||
|
||||
async fn recv(&mut self) {
|
||||
while let Some(req) = self.ws_req_rx.recv().await {
|
||||
tokio::spawn(process_ws_req(req, self.ctx.clone()));
|
||||
fn publish_connected(&self, attempt: u64, info: ConnectInfo, session_info: SessionInfo) {
|
||||
let connected = VpnState::Connected(Box::new(ConnectedInfo::new(info, Some(session_info))));
|
||||
let admissions = self
|
||||
.lifecycle
|
||||
.admissions
|
||||
.lock()
|
||||
.expect("VPN lifecycle admissions mutex poisoned");
|
||||
if admissions.current.as_ref().is_some_and(|admission| {
|
||||
admission.attempt == attempt && admission.phase == AdmissionPhase::Active && !admission.stop_requested
|
||||
}) {
|
||||
self.send_state(connected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_csd_uid(trusted_uid: Option<u32>, requested_uid: u32, hip_enabled: bool) -> anyhow::Result<u32> {
|
||||
let uid = trusted_uid.unwrap_or(requested_uid);
|
||||
if hip_enabled && uid == 0 {
|
||||
anyhow::bail!("HIP scripts must not run as root");
|
||||
fn end_attempt(&mut self, attempt: u64) {
|
||||
if self.active.as_ref().is_none_or(|active| active.attempt != attempt) {
|
||||
return;
|
||||
}
|
||||
if let Some(session_id) = self.active.as_ref().and_then(|active| active.session_id) {
|
||||
self.registry.clear_successful_hip_report(session_id);
|
||||
}
|
||||
self.active = None;
|
||||
self.finish_attempt(attempt);
|
||||
}
|
||||
|
||||
fn finish_attempt(&self, attempt: u64) {
|
||||
self.send_state(VpnState::Disconnected);
|
||||
self.lifecycle.clear_attempt(attempt);
|
||||
}
|
||||
|
||||
fn send_state(&self, state: VpnState) {
|
||||
let _ = self.vpn_state_tx.send(state);
|
||||
}
|
||||
Ok(uid)
|
||||
}
|
||||
|
||||
struct PreparedIdentity {
|
||||
@@ -274,40 +588,148 @@ fn write_identity_file(
|
||||
Ok(Some(path))
|
||||
}
|
||||
|
||||
async fn process_ws_req(req: WsRequest, ctx: Arc<VpnTaskContext>) {
|
||||
match req {
|
||||
WsRequest::Connect(req) => {
|
||||
ctx.connect(*req).await;
|
||||
}
|
||||
WsRequest::Disconnect(_) => {
|
||||
ctx.disconnect().await;
|
||||
}
|
||||
WsRequest::UpdateLogLevel(UpdateLogLevelRequest(level)) => {
|
||||
let level = level.parse().unwrap_or(log::Level::Info);
|
||||
info!("Updating log level to: {}", level);
|
||||
if let Err(err) = logger::set_max_level(level) {
|
||||
warn!("Failed to update log level: {}", err);
|
||||
}
|
||||
}
|
||||
WsRequest::RestartGui | WsRequest::UpdateGui(_) | WsRequest::GetVpncScriptMetadata => {
|
||||
warn!("Non-VPN request reached the VPN task");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::session_registry::SessionRegistry;
|
||||
|
||||
#[test]
|
||||
fn trusted_csd_uid_overrides_request_uid() {
|
||||
assert_eq!(resolve_csd_uid(Some(1000), 0, true).unwrap(), 1000);
|
||||
fn registry() -> Arc<SessionRegistry> {
|
||||
Arc::new(SessionRegistry::new(Uuid::new_v4()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn root_csd_uid_is_rejected_when_hip_is_enabled() {
|
||||
assert!(resolve_csd_uid(None, 0, true).is_err());
|
||||
assert_eq!(resolve_csd_uid(None, 0, false).unwrap(), 0);
|
||||
fn disconnect_before_start_discards_the_pending_attempt() {
|
||||
let (vpn_state_tx, _vpn_state_rx) = watch::channel(VpnState::Disconnected);
|
||||
let (mut task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
|
||||
let request = ConnectRequest::new(
|
||||
ConnectInfo::new(
|
||||
"portal.example.com".to_string(),
|
||||
gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()),
|
||||
vec![],
|
||||
),
|
||||
"cookie".to_string(),
|
||||
);
|
||||
|
||||
assert!(matches!(
|
||||
lifecycle.submit_connect(request, None, None, None),
|
||||
ServiceResult::Accepted
|
||||
));
|
||||
assert!(matches!(lifecycle.request_disconnect(), ServiceResult::Accepted));
|
||||
let start = task.events.try_recv().unwrap();
|
||||
task.handle_event(start);
|
||||
|
||||
assert!(!lifecycle.has_attempt(0));
|
||||
assert!(task.active.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn late_established_event_is_ignored_after_disconnect_is_accepted() {
|
||||
let (vpn_state_tx, vpn_state_rx) = watch::channel(VpnState::Disconnected);
|
||||
let state_rx = vpn_state_rx.clone();
|
||||
let (task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
|
||||
let info = ConnectInfo::new(
|
||||
"portal.example.com".to_string(),
|
||||
gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()),
|
||||
vec![],
|
||||
);
|
||||
let request = ConnectRequest::new(info.clone(), "cookie".to_string());
|
||||
|
||||
assert!(matches!(
|
||||
lifecycle.submit_connect(request, None, None, None),
|
||||
ServiceResult::Accepted
|
||||
));
|
||||
assert!(lifecycle.activate_attempt(0));
|
||||
assert!(matches!(lifecycle.request_disconnect(), ServiceResult::Accepted));
|
||||
task.publish_connected(0, info, SessionInfo::default());
|
||||
|
||||
assert!(matches!(*state_rx.borrow(), VpnState::Disconnected));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn disconnect_waiter_completes_for_its_attempt_before_a_later_connect() {
|
||||
let (vpn_state_tx, _vpn_state_rx) = watch::channel(VpnState::Disconnected);
|
||||
let (task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
|
||||
let request = || {
|
||||
ConnectRequest::new(
|
||||
ConnectInfo::new(
|
||||
"portal.example.com".to_string(),
|
||||
gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()),
|
||||
vec![],
|
||||
),
|
||||
"cookie".to_string(),
|
||||
)
|
||||
};
|
||||
|
||||
assert!(matches!(
|
||||
lifecycle.submit_connect(request(), None, None, None),
|
||||
ServiceResult::Accepted
|
||||
));
|
||||
let waiter_lifecycle = lifecycle.clone();
|
||||
let waiter = tokio::spawn(async move { waiter_lifecycle.disconnect_and_wait().await });
|
||||
while !lifecycle.is_stop_requested(0) {
|
||||
tokio::task::yield_now().await;
|
||||
}
|
||||
|
||||
task.finish_attempt(0);
|
||||
assert!(matches!(
|
||||
lifecycle.submit_connect(request(), None, None, None),
|
||||
ServiceResult::Accepted
|
||||
));
|
||||
assert!(
|
||||
tokio::time::timeout(std::time::Duration::from_secs(1), waiter)
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repeated_disconnects_enqueue_one_stop_for_an_attempt() {
|
||||
let (vpn_state_tx, _vpn_state_rx) = watch::channel(VpnState::Disconnected);
|
||||
let (mut task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
|
||||
let request = ConnectRequest::new(
|
||||
ConnectInfo::new(
|
||||
"portal.example.com".to_string(),
|
||||
gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()),
|
||||
vec![],
|
||||
),
|
||||
"cookie".to_string(),
|
||||
);
|
||||
|
||||
assert!(matches!(
|
||||
lifecycle.submit_connect(request, None, None, None),
|
||||
ServiceResult::Accepted
|
||||
));
|
||||
assert!(matches!(lifecycle.request_disconnect(), ServiceResult::Accepted));
|
||||
assert!(matches!(lifecycle.request_disconnect(), ServiceResult::Accepted));
|
||||
assert!(matches!(task.events.try_recv(), Ok(LifecycleEvent::Start { .. })));
|
||||
assert!(matches!(task.events.try_recv(), Ok(LifecycleEvent::Stop { .. })));
|
||||
assert!(matches!(task.events.try_recv(), Err(mpsc::error::TryRecvError::Empty)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn second_connect_is_rejected_while_an_attempt_is_admitted() {
|
||||
let (vpn_state_tx, _vpn_state_rx) = watch::channel(VpnState::Disconnected);
|
||||
let (_task, lifecycle) = VpnTask::new(vpn_state_tx, false, registry());
|
||||
let request = || {
|
||||
ConnectRequest::new(
|
||||
ConnectInfo::new(
|
||||
"portal.example.com".to_string(),
|
||||
gpapi::gateway::Gateway::new("vpn".to_string(), "vpn.example.com".to_string()),
|
||||
vec![],
|
||||
),
|
||||
"cookie".to_string(),
|
||||
)
|
||||
};
|
||||
|
||||
assert!(matches!(
|
||||
lifecycle.submit_connect(request(), None, None, None),
|
||||
ServiceResult::Accepted
|
||||
));
|
||||
assert!(matches!(
|
||||
lifecycle.submit_connect(request(), None, None, None),
|
||||
ServiceResult::Rejected(rejection) if rejection.code() == ServiceErrorCode::Busy
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -4,8 +4,9 @@ use axum::extract::ws::{CloseFrame, Message, Utf8Bytes, WebSocket};
|
||||
use futures::StreamExt;
|
||||
use gpapi::service::transport::{
|
||||
ClientMessage, ClientPrelude, CloseReason, HandshakeRejection, NoiseResponder, NoiseTransport, ServerMessage,
|
||||
ServerPrelude, ServiceResult,
|
||||
ServerPrelude, ServiceErrorCode, ServiceResult,
|
||||
};
|
||||
use gpapi::{hip::HipSource, service::request::WsRequest};
|
||||
use log::{info, warn};
|
||||
use tokio::sync::{mpsc, watch};
|
||||
use tokio::time::Instant;
|
||||
@@ -148,6 +149,7 @@ impl WsConnection {
|
||||
&ctx,
|
||||
&control,
|
||||
permit.session_id,
|
||||
permit.desktop_uid,
|
||||
generation,
|
||||
&mut pending_requests,
|
||||
).await.is_err() {
|
||||
@@ -215,6 +217,17 @@ async fn establish(
|
||||
.await?;
|
||||
return Err(CloseReason::VersionMismatch);
|
||||
}
|
||||
if prelude.hip_protocol_version != gpapi::service::transport::HIP_PROTOCOL_VERSION {
|
||||
send_server_prelude(
|
||||
socket,
|
||||
ServerPrelude::Rejected(HandshakeRejection::HipProtocolMismatch {
|
||||
client: prelude.hip_protocol_version,
|
||||
service: gpapi::service::transport::HIP_PROTOCOL_VERSION,
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
return Err(CloseReason::VersionMismatch);
|
||||
}
|
||||
|
||||
let permit = match ctx.registry().begin_handshake(
|
||||
prelude.service_instance_id,
|
||||
@@ -308,6 +321,7 @@ async fn handle_client_message(
|
||||
ctx: &Arc<WsServerContext>,
|
||||
control: &ConnectionControl,
|
||||
session_id: Uuid,
|
||||
desktop_uid: Option<u32>,
|
||||
generation: u64,
|
||||
pending_requests: &mut HashSet<Uuid>,
|
||||
) -> Result<(), ()> {
|
||||
@@ -323,7 +337,201 @@ async fn handle_client_message(
|
||||
return Err(());
|
||||
}
|
||||
|
||||
if let WsRequest::StoreEditedHipReportChunk(report) = request {
|
||||
let upload_id = report.upload_id.as_deref().and_then(|id| Uuid::parse_str(id).ok());
|
||||
let result = if report.upload_id.is_some() && upload_id.is_none() {
|
||||
ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Invalid HIP upload ID")
|
||||
} else {
|
||||
match ctx.registry().append_edited_hip_report_chunk(
|
||||
session_id,
|
||||
upload_id,
|
||||
report.offset,
|
||||
report.xml,
|
||||
report.complete,
|
||||
) {
|
||||
Ok(crate::session_registry::HipUploadResult::Progress(upload_id)) => ServiceResult::HipUploadProgress {
|
||||
upload_id: upload_id.to_string(),
|
||||
},
|
||||
Ok(crate::session_registry::HipUploadResult::Stored(report_id)) => ServiceResult::StoredHipReport {
|
||||
report_id: report_id.to_string(),
|
||||
},
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Invalid HIP report upload"),
|
||||
}
|
||||
};
|
||||
if control.send(ConnectionCommand::Reply { id, result }).is_err() {
|
||||
pending_requests.remove(&id);
|
||||
control.close(CloseReason::InternalError);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let WsRequest::ReadHipPreviewChunk(chunk) = request {
|
||||
let result = Uuid::parse_str(&chunk.preview_id)
|
||||
.ok()
|
||||
.and_then(|preview_id| {
|
||||
ctx
|
||||
.registry()
|
||||
.hip_preview_chunk(session_id, preview_id, chunk.offset)
|
||||
.ok()
|
||||
.map(|(xml, complete)| ServiceResult::HipPreviewChunk {
|
||||
preview_id: preview_id.to_string(),
|
||||
offset: chunk.offset,
|
||||
xml,
|
||||
complete,
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "HIP preview is unavailable"));
|
||||
control.send(ConnectionCommand::Reply { id, result }).map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let WsRequest::GetLastSubmittedHipReport = request {
|
||||
let result = match ctx.registry().last_successful_hip_report(session_id) {
|
||||
Ok(Some(report)) => match ctx.registry().store_hip_preview(session_id, report.to_string()) {
|
||||
Ok(preview_id) => match ctx.registry().hip_preview_chunk(session_id, preview_id, 0) {
|
||||
Ok((xml, complete)) => ServiceResult::HipPreviewChunk {
|
||||
preview_id: preview_id.to_string(),
|
||||
offset: 0,
|
||||
xml,
|
||||
complete,
|
||||
},
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::Internal, "Submitted HIP report is unavailable"),
|
||||
},
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::Internal, "Submitted HIP report is unavailable"),
|
||||
},
|
||||
Ok(None) => ServiceResult::NoSubmittedHipReport,
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Session is unavailable"),
|
||||
};
|
||||
control.send(ConnectionCommand::Reply { id, result }).map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let WsRequest::GetHipApprovalStatus { approval_id } = request {
|
||||
let result = if let Some(uid) = desktop_uid.filter(|uid| *uid != 0) {
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
{
|
||||
match gpservice::hip_approval::status(&approval_id, uid) {
|
||||
Ok(status) => ServiceResult::HipApprovalStatus(status),
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Invalid HIP approval ID"),
|
||||
}
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")))]
|
||||
{
|
||||
let _ = (uid, approval_id);
|
||||
ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "HIP script approvals are unavailable")
|
||||
}
|
||||
} else {
|
||||
ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Desktop user is unavailable")
|
||||
};
|
||||
control.send(ConnectionCommand::Reply { id, result }).map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if let WsRequest::PreviewHipReport(preview) = request {
|
||||
let edited_report = if let HipSource::Edited { report_id } = &preview.source {
|
||||
let report_id = match Uuid::parse_str(report_id) {
|
||||
Ok(id) => id,
|
||||
Err(_) => {
|
||||
control
|
||||
.send(ConnectionCommand::Reply {
|
||||
id,
|
||||
result: ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Invalid HIP report ID"),
|
||||
})
|
||||
.map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
match ctx.registry().edited_hip_report(session_id, report_id) {
|
||||
Ok(report) => Some(report),
|
||||
Err(_) => {
|
||||
control
|
||||
.send(ConnectionCommand::Reply {
|
||||
id,
|
||||
result: ServiceResult::rejected(
|
||||
ServiceErrorCode::InvalidRequest,
|
||||
"HIP report is unavailable for this session",
|
||||
),
|
||||
})
|
||||
.map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let registry = Arc::clone(ctx.registry());
|
||||
let control = control.clone();
|
||||
tokio::spawn(async move {
|
||||
let result = match crate::hip_preview::generate(preview, edited_report, desktop_uid).await {
|
||||
Ok(xml) => match registry.store_hip_preview(session_id, xml) {
|
||||
Ok(preview_id) => match registry.hip_preview_chunk(session_id, preview_id, 0) {
|
||||
Ok((xml, complete)) => ServiceResult::HipPreviewChunk {
|
||||
preview_id: preview_id.to_string(),
|
||||
offset: 0,
|
||||
xml,
|
||||
complete,
|
||||
},
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview is unavailable"),
|
||||
},
|
||||
Err(_) => ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview is unavailable"),
|
||||
},
|
||||
Err(error) => {
|
||||
warn!("HIP preview failed: {error:#}");
|
||||
ServiceResult::rejected(ServiceErrorCode::Internal, "HIP preview failed")
|
||||
}
|
||||
};
|
||||
control.send_reply(id, result).await;
|
||||
});
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let edited_report = if let WsRequest::Connect(connect) = &request {
|
||||
if let HipSource::Edited { report_id } = connect.args().hip_source() {
|
||||
let report_id = match Uuid::parse_str(report_id) {
|
||||
Ok(id) => id,
|
||||
Err(_) => {
|
||||
control
|
||||
.send(ConnectionCommand::Reply {
|
||||
id,
|
||||
result: ServiceResult::rejected(ServiceErrorCode::InvalidRequest, "Invalid HIP report ID"),
|
||||
})
|
||||
.map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
match ctx.registry().edited_hip_report(session_id, report_id) {
|
||||
Ok(report) => Some(report),
|
||||
Err(_) => {
|
||||
control
|
||||
.send(ConnectionCommand::Reply {
|
||||
id,
|
||||
result: ServiceResult::rejected(
|
||||
ServiceErrorCode::InvalidRequest,
|
||||
"HIP report is unavailable for this session",
|
||||
),
|
||||
})
|
||||
.map_err(|_| ())?;
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let dispatcher = ctx.dispatcher();
|
||||
let request = match dispatcher.dispatch_lifecycle(request, desktop_uid, edited_report, Some(session_id)) {
|
||||
Ok(request) => request,
|
||||
Err(result) => {
|
||||
if control.send(ConnectionCommand::Reply { id, result }).is_err() {
|
||||
pending_requests.remove(&id);
|
||||
control.close(CloseReason::InternalError);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
let control = control.clone();
|
||||
tokio::spawn(async move {
|
||||
let result = dispatcher.dispatch(request).await;
|
||||
@@ -396,7 +604,7 @@ mod tests {
|
||||
},
|
||||
utils::redact::Redaction,
|
||||
};
|
||||
use tokio::sync::{mpsc, watch};
|
||||
use tokio::sync::watch;
|
||||
use tokio_tungstenite::{connect_async, tungstenite::Message as ClientFrame};
|
||||
|
||||
use super::*;
|
||||
@@ -407,10 +615,9 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn authenticates_attaches_and_replies_to_a_request() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION")).unwrap();
|
||||
let (request_tx, mut request_rx) = mpsc::channel(4);
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION"), None).unwrap();
|
||||
let dispatcher = Arc::new(RequestDispatcher::new(
|
||||
request_tx,
|
||||
crate::vpn_task::LifecycleHandle::for_tests(),
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
Arc::new(Redaction::new()),
|
||||
true,
|
||||
@@ -432,6 +639,7 @@ mod tests {
|
||||
let (mut socket, _) = connect_async(format!("ws://{address}/ws")).await.unwrap();
|
||||
let prelude = ClientPrelude {
|
||||
product_version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||
hip_protocol_version: gpapi::service::transport::HIP_PROTOCOL_VERSION,
|
||||
service_instance_id: credential.service_instance_id(),
|
||||
session_id: credential.session_id(),
|
||||
};
|
||||
@@ -475,7 +683,6 @@ mod tests {
|
||||
.send(ClientFrame::Binary(noise.encrypt(&request).unwrap().into()))
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(matches!(request_rx.recv().await, Some(WsRequest::UpdateLogLevel(_))));
|
||||
let reply = noise
|
||||
.decrypt::<ServerMessage>(&receive_client_binary(&mut socket).await)
|
||||
.unwrap();
|
||||
|
||||
@@ -12,7 +12,7 @@ use gpapi::{
|
||||
utils::lock_file::LockFile,
|
||||
};
|
||||
use log::{info, warn};
|
||||
use openconnect::{find_csd_wrapper, find_vpnc_script};
|
||||
use openconnect::find_vpnc_script;
|
||||
use tokio::{
|
||||
net::TcpListener,
|
||||
sync::{Mutex, Semaphore, mpsc, oneshot, watch},
|
||||
@@ -259,7 +259,6 @@ fn build_snapshot(vpn_state: VpnState) -> VpnEnv {
|
||||
VpnEnv {
|
||||
vpn_state,
|
||||
vpnc_script: find_vpnc_script().map(ToOwned::to_owned),
|
||||
csd_wrapper: find_csd_wrapper().map(ToOwned::to_owned),
|
||||
auth_executable: binary_paths::gpauth().to_string_lossy().into_owned(),
|
||||
host_info: HostInfo {
|
||||
host_identity: HostIdentity::collect(),
|
||||
@@ -282,7 +281,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn resync_snapshot_is_ordered_with_state_events() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION")).unwrap();
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION"), None).unwrap();
|
||||
let permit = registry
|
||||
.begin_handshake(
|
||||
credential.service_instance_id(),
|
||||
@@ -290,9 +289,8 @@ mod tests {
|
||||
credential.product_version(),
|
||||
)
|
||||
.unwrap();
|
||||
let (request_tx, _request_rx) = mpsc::channel(1);
|
||||
let dispatcher = Arc::new(RequestDispatcher::new(
|
||||
request_tx,
|
||||
crate::vpn_task::LifecycleHandle::for_tests(),
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
Arc::new(Redaction::new()),
|
||||
true,
|
||||
@@ -340,10 +338,9 @@ mod tests {
|
||||
#[tokio::test]
|
||||
async fn removed_prepared_candidate_cannot_commit_takeover() {
|
||||
let registry = Arc::new(SessionRegistry::new(Uuid::new_v4()));
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION")).unwrap();
|
||||
let (request_tx, _request_rx) = mpsc::channel(1);
|
||||
let credential = registry.issue(env!("CARGO_PKG_VERSION"), None).unwrap();
|
||||
let dispatcher = Arc::new(RequestDispatcher::new(
|
||||
request_tx,
|
||||
crate::vpn_task::LifecycleHandle::for_tests(),
|
||||
Arc::new(AtomicBool::new(false)),
|
||||
Arc::new(Redaction::new()),
|
||||
true,
|
||||
|
||||
@@ -9,6 +9,8 @@ use std::{
|
||||
))]
|
||||
use crate::constants::GP_DOWNLOADED_GUI_BINARY;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use crate::constants::GP_HIP_SCRIPT_INSTALLER_BINARY;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use crate::constants::GP_VPNC_SCRIPT_INSTALLER_BINARY;
|
||||
use crate::constants::{GP_AUTH_BINARY, GP_CLIENT_BINARY, GP_GUI_BINARY, GP_GUI_HELPER_BINARY, GP_SERVICE_BINARY};
|
||||
|
||||
@@ -29,6 +31,14 @@ pub fn gp_vpnc_script_installer() -> PathBuf {
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub fn gp_hip_script_installer() -> PathBuf {
|
||||
env::var_os("GP_HIP_SCRIPT_INSTALLER_BINARY")
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(GP_HIP_SCRIPT_INSTALLER_BINARY))
|
||||
}
|
||||
|
||||
pub fn gpauth() -> PathBuf {
|
||||
resolve("GP_AUTH_BINARY", "gpauth", GP_AUTH_BINARY)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@ pub const GP_SERVICE_LOCK_FILE: &str = "/var/run/gpservice.lock";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const GP_VPNC_SCRIPT_INSTALLER_BINARY: &str = "/usr/libexec/gpclient/gp-vpnc-script-installer";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const GP_HIP_SCRIPT_INSTALLER_BINARY: &str = "/usr/libexec/gpclient/gp-hip-script-installer";
|
||||
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub const GP_HIP_SCRIPT_INSTALLER_BINARY: &str = "/usr/local/libexec/gpclient/gp-hip-script-installer";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const INSTALLED_VPNC_SCRIPT: &str = "/var/lib/gpclient/scripts/vpnc-script";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const INSTALLED_VPNC_SCRIPT_METADATA: &str = "/var/lib/gpclient/scripts/vpnc-script.metadata";
|
||||
@@ -16,6 +20,7 @@ pub const INSTALLED_VPNC_SCRIPT: &str = "/var/db/gpclient/scripts/vpnc-script";
|
||||
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub const INSTALLED_VPNC_SCRIPT_METADATA: &str = "/var/db/gpclient/scripts/vpnc-script.metadata";
|
||||
pub const MAX_VPNC_SCRIPT_SIZE: usize = 1024 * 1024;
|
||||
pub const MAX_HIP_SCRIPT_SIZE: usize = 1024 * 1024;
|
||||
|
||||
// Release binaries - macOS (Apple Silicon Homebrew)
|
||||
#[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))]
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
//! Neutral device-anchor transport model and deterministic derivation.
|
||||
use base64::{Engine, engine::general_purpose::URL_SAFE_NO_PAD};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(try_from = "u8", into = "u8")]
|
||||
pub enum AnchorSource {
|
||||
UnixMac,
|
||||
UnixRandom,
|
||||
MacosIokit,
|
||||
}
|
||||
|
||||
impl From<AnchorSource> for u8 {
|
||||
fn from(source: AnchorSource) -> Self {
|
||||
match source {
|
||||
AnchorSource::UnixMac => 1,
|
||||
AnchorSource::UnixRandom => 2,
|
||||
AnchorSource::MacosIokit => 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct InvalidAnchorSource(u8);
|
||||
|
||||
impl fmt::Display for InvalidAnchorSource {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(formatter, "unsupported device anchor source {}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for InvalidAnchorSource {}
|
||||
|
||||
impl TryFrom<u8> for AnchorSource {
|
||||
type Error = InvalidAnchorSource;
|
||||
|
||||
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
||||
match value {
|
||||
1 => Ok(Self::UnixMac),
|
||||
2 => Ok(Self::UnixRandom),
|
||||
3 => Ok(Self::MacosIokit),
|
||||
value => Err(InvalidAnchorSource(value)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct DeviceAnchor {
|
||||
pub hardware_id: String,
|
||||
pub source: AnchorSource,
|
||||
}
|
||||
|
||||
impl DeviceAnchor {
|
||||
pub fn validate(&self) -> bool {
|
||||
URL_SAFE_NO_PAD
|
||||
.decode(&self.hardware_id)
|
||||
.is_ok_and(|bytes| bytes.len() == 32 && URL_SAFE_NO_PAD.encode(&bytes) == self.hardware_id)
|
||||
}
|
||||
|
||||
pub fn derive(source: AnchorSource, seed: impl AsRef<[u8]>) -> Self {
|
||||
let domain = match source {
|
||||
AnchorSource::UnixMac => b"gp-device-anchor:v1:unix-mac:".as_slice(),
|
||||
AnchorSource::UnixRandom => b"gp-device-anchor:v1:unix-random:".as_slice(),
|
||||
AnchorSource::MacosIokit => b"gp-device-anchor:v1:macos-platform-uuid:".as_slice(),
|
||||
};
|
||||
let mut input = domain.to_vec();
|
||||
input.extend_from_slice(seed.as_ref());
|
||||
Self {
|
||||
hardware_id: URL_SAFE_NO_PAD.encode(openssl::sha::sha256(&input)),
|
||||
source,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn hashes_original_seed_order_with_stable_domain_separation() {
|
||||
let mac = DeviceAnchor::derive(AnchorSource::UnixMac, [0, 17, 34, 51, 68, 85]);
|
||||
assert!(mac.validate());
|
||||
assert_eq!(mac.hardware_id, "UWDOx4AVJEuCAYfJBaPioyGtRfAkJBhMYSi8LuFsE1A");
|
||||
assert_ne!(
|
||||
mac.hardware_id,
|
||||
DeviceAnchor::derive(AnchorSource::UnixMac, [85, 68, 51, 34, 17, 0]).hardware_id
|
||||
);
|
||||
assert_ne!(
|
||||
mac.hardware_id,
|
||||
DeviceAnchor::derive(AnchorSource::UnixRandom, [0, 17, 34, 51, 68, 85]).hardware_id
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_uses_stable_numeric_json_codes() {
|
||||
assert_eq!(serde_json::to_string(&AnchorSource::UnixMac).unwrap(), "1");
|
||||
assert_eq!(serde_json::to_string(&AnchorSource::UnixRandom).unwrap(), "2");
|
||||
assert_eq!(serde_json::to_string(&AnchorSource::MacosIokit).unwrap(), "3");
|
||||
assert_eq!(
|
||||
serde_json::from_str::<AnchorSource>("1").unwrap(),
|
||||
AnchorSource::UnixMac
|
||||
);
|
||||
assert!(serde_json::from_str::<AnchorSource>("0").is_err());
|
||||
assert!(serde_json::from_str::<AnchorSource>("4").is_err());
|
||||
assert!(serde_json::from_str::<AnchorSource>(r#""unix_mac""#).is_err());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
|
||||
/// The GUI's choice of HIP report source. gpservice resolves execution details.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Type, PartialEq, Eq)]
|
||||
#[serde(tag = "source", rename_all = "camelCase", rename_all_fields = "camelCase")]
|
||||
pub enum HipSource {
|
||||
#[default]
|
||||
Disabled,
|
||||
Generated,
|
||||
Edited {
|
||||
report_id: String,
|
||||
},
|
||||
UserScript {
|
||||
path: String,
|
||||
},
|
||||
ApprovedRootScript {
|
||||
approval_id: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, Type, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum HipApprovalStatus {
|
||||
Valid,
|
||||
Revoked,
|
||||
Corrupt,
|
||||
OtherUser,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn source_round_trips_without_execution_uid_or_wrapper() {
|
||||
let source = HipSource::ApprovedRootScript {
|
||||
approval_id: "approved-1".into(),
|
||||
};
|
||||
let json = serde_json::to_value(&source).unwrap();
|
||||
assert_eq!(
|
||||
json,
|
||||
serde_json::json!({ "source": "approvedRootScript", "approvalId": "approved-1" })
|
||||
);
|
||||
assert_eq!(serde_json::from_value::<HipSource>(json).unwrap(), source);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
pub mod auth;
|
||||
pub mod cookie_store;
|
||||
pub mod credential;
|
||||
pub mod device_anchor;
|
||||
pub mod error;
|
||||
pub mod gateway;
|
||||
pub mod gp_params;
|
||||
pub mod hip;
|
||||
pub mod log_format;
|
||||
pub mod os_profile;
|
||||
pub mod params;
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
use std::process::Stdio;
|
||||
|
||||
use anyhow::bail;
|
||||
use tokio::process::Command;
|
||||
|
||||
pub struct HipLauncher<'a> {
|
||||
program: &'a str,
|
||||
cookie: Option<&'a str>,
|
||||
client_ip: Option<&'a str>,
|
||||
md5: Option<&'a str>,
|
||||
client_os: Option<&'a str>,
|
||||
client_version: Option<&'a str>,
|
||||
}
|
||||
|
||||
impl<'a> HipLauncher<'a> {
|
||||
pub fn new(program: &'a str) -> Self {
|
||||
Self {
|
||||
program,
|
||||
cookie: None,
|
||||
client_ip: None,
|
||||
md5: None,
|
||||
client_os: None,
|
||||
client_version: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cookie(mut self, cookie: &'a str) -> Self {
|
||||
self.cookie = Some(cookie);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn client_ip(mut self, client_ip: &'a str) -> Self {
|
||||
self.client_ip = Some(client_ip);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn md5(mut self, md5: &'a str) -> Self {
|
||||
self.md5 = Some(md5);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn client_os(mut self, client_os: &'a str) -> Self {
|
||||
self.client_os = Some(client_os);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn client_version(mut self, client_version: Option<&'a str>) -> Self {
|
||||
self.client_version = client_version;
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn launch(&self) -> anyhow::Result<String> {
|
||||
let mut cmd = Command::new(self.program);
|
||||
|
||||
if let Some(cookie) = self.cookie {
|
||||
cmd.arg("--cookie").arg(cookie);
|
||||
}
|
||||
|
||||
if let Some(client_ip) = self.client_ip {
|
||||
cmd.arg("--client-ip").arg(client_ip);
|
||||
}
|
||||
|
||||
if let Some(md5) = self.md5 {
|
||||
cmd.arg("--md5").arg(md5);
|
||||
}
|
||||
|
||||
if let Some(client_os) = self.client_os {
|
||||
cmd.arg("--client-os").arg(client_os);
|
||||
}
|
||||
|
||||
if let Some(client_version) = self.client_version {
|
||||
cmd.env("APP_VERSION", client_version);
|
||||
}
|
||||
|
||||
let child = cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn();
|
||||
|
||||
let child = match child {
|
||||
Ok(child) => child,
|
||||
Err(err) => bail!("Failed to spawn {}: {}", self.program, err),
|
||||
};
|
||||
|
||||
let output = child.wait_with_output().await?;
|
||||
|
||||
if let Some(exit_status) = output.status.code() {
|
||||
if exit_status != 0 {
|
||||
bail!("HIP report generation failed with exit code {}", exit_status);
|
||||
}
|
||||
|
||||
let report = String::from_utf8(output.stdout)?;
|
||||
|
||||
Ok(report)
|
||||
} else {
|
||||
bail!("HIP report generation failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,5 @@ pub use command_traits::CommandExt;
|
||||
|
||||
pub mod auth_launcher;
|
||||
pub mod gui_launcher;
|
||||
pub mod hip_launcher;
|
||||
pub mod service_launcher;
|
||||
pub mod users;
|
||||
@@ -6,6 +6,7 @@ use zeroize::Zeroize;
|
||||
|
||||
use crate::{
|
||||
gateway::Gateway,
|
||||
hip::HipSource,
|
||||
os_profile::{ClientOs, OsProfile},
|
||||
};
|
||||
|
||||
@@ -13,6 +14,28 @@ use super::vpn_state::ConnectInfo;
|
||||
|
||||
pub const MAX_CLIENT_IDENTITY_DATA: usize = 32 * 1024;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct StoreEditedHipReportChunkRequest {
|
||||
pub upload_id: Option<String>,
|
||||
pub offset: usize,
|
||||
pub xml: String,
|
||||
pub complete: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct PreviewHipReportRequest {
|
||||
pub source: HipSource,
|
||||
pub client_os: ClientOs,
|
||||
pub client_version: String,
|
||||
pub host_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct ReadHipPreviewChunkRequest {
|
||||
pub preview_id: String,
|
||||
pub offset: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct LaunchGuiRequest {
|
||||
user: String,
|
||||
@@ -50,9 +73,7 @@ pub struct ConnectArgs {
|
||||
sslkey_data: Option<String>,
|
||||
key_password: Option<String>,
|
||||
|
||||
hip: bool,
|
||||
csd_uid: u32,
|
||||
csd_wrapper: Option<String>,
|
||||
hip_source: HipSource,
|
||||
|
||||
reconnect_timeout: u32,
|
||||
mtu: u32,
|
||||
@@ -80,9 +101,7 @@ impl ConnectArgs {
|
||||
certificate_data: None,
|
||||
sslkey_data: None,
|
||||
key_password: None,
|
||||
hip: false,
|
||||
csd_uid: 0,
|
||||
csd_wrapper: None,
|
||||
hip_source: HipSource::Disabled,
|
||||
reconnect_timeout: 300,
|
||||
mtu: 0,
|
||||
disable_ipv6: false,
|
||||
@@ -154,16 +173,8 @@ impl ConnectArgs {
|
||||
self.key_password.clone()
|
||||
}
|
||||
|
||||
pub fn hip(&self) -> bool {
|
||||
self.hip
|
||||
}
|
||||
|
||||
pub fn csd_uid(&self) -> u32 {
|
||||
self.csd_uid
|
||||
}
|
||||
|
||||
pub fn csd_wrapper(&self) -> Option<String> {
|
||||
self.csd_wrapper.clone()
|
||||
pub fn hip_source(&self) -> &HipSource {
|
||||
&self.hip_source
|
||||
}
|
||||
|
||||
pub fn reconnect_timeout(&self) -> u32 {
|
||||
@@ -212,9 +223,7 @@ impl fmt::Debug for ConnectArgs {
|
||||
"client_auth_data",
|
||||
&(self.certificate_data.is_some() || self.sslkey_data.is_some()),
|
||||
)
|
||||
.field("hip", &self.hip)
|
||||
.field("csd_uid", &self.csd_uid)
|
||||
.field("csd_wrapper", &self.csd_wrapper)
|
||||
.field("hip_source", &self.hip_source)
|
||||
.field("reconnect_timeout", &self.reconnect_timeout)
|
||||
.field("mtu", &self.mtu)
|
||||
.field("disable_ipv6", &self.disable_ipv6)
|
||||
@@ -252,18 +261,8 @@ impl ConnectRequest {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_hip(mut self, hip: bool) -> Self {
|
||||
self.args.hip = hip;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_csd_uid(mut self, csd_uid: u32) -> Self {
|
||||
self.args.csd_uid = csd_uid;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_csd_wrapper<T: Into<Option<String>>>(mut self, csd_wrapper: T) -> Self {
|
||||
self.args.csd_wrapper = csd_wrapper.into();
|
||||
pub fn with_hip_source(mut self, hip_source: HipSource) -> Self {
|
||||
self.args.hip_source = hip_source;
|
||||
self
|
||||
}
|
||||
|
||||
@@ -371,6 +370,11 @@ pub struct UpdateLogLevelRequest(pub String);
|
||||
pub enum WsRequest {
|
||||
Connect(Box<ConnectRequest>),
|
||||
Disconnect(DisconnectRequest),
|
||||
StoreEditedHipReportChunk(StoreEditedHipReportChunkRequest),
|
||||
PreviewHipReport(PreviewHipReportRequest),
|
||||
GetHipApprovalStatus { approval_id: String },
|
||||
ReadHipPreviewChunk(ReadHipPreviewChunkRequest),
|
||||
GetLastSubmittedHipReport,
|
||||
UpdateLogLevel(UpdateLogLevelRequest),
|
||||
RestartGui,
|
||||
UpdateGui(UpdateGuiRequest),
|
||||
|
||||
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use crate::device_anchor::DeviceAnchor;
|
||||
use crate::utils::base64;
|
||||
|
||||
use super::{MAX_CREDENTIAL_FRAME, MAX_PRODUCT_VERSION, TransportError};
|
||||
@@ -14,6 +15,7 @@ pub struct SessionCredential {
|
||||
session_id: Uuid,
|
||||
secret: Zeroizing<[u8; 32]>,
|
||||
product_version: String,
|
||||
device_anchor: Option<DeviceAnchor>,
|
||||
}
|
||||
|
||||
impl SessionCredential {
|
||||
@@ -30,6 +32,7 @@ impl SessionCredential {
|
||||
session_id: Uuid::new_v4(),
|
||||
secret,
|
||||
product_version: product_version.to_owned(),
|
||||
device_anchor: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -49,6 +52,18 @@ impl SessionCredential {
|
||||
&self.product_version
|
||||
}
|
||||
|
||||
pub fn with_device_anchor(mut self, anchor: DeviceAnchor) -> Result<Self, TransportError> {
|
||||
if !anchor.validate() {
|
||||
return Err(TransportError::InvalidCredential);
|
||||
}
|
||||
self.device_anchor = Some(anchor);
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
pub fn device_anchor(&self) -> Option<&DeviceAnchor> {
|
||||
self.device_anchor.as_ref()
|
||||
}
|
||||
|
||||
pub fn encode_frame(&self) -> Result<Zeroizing<Vec<u8>>, TransportError> {
|
||||
let encoded_secret = Zeroizing::new(base64::encode(self.secret()));
|
||||
let dto = CredentialDtoRef {
|
||||
@@ -56,6 +71,7 @@ impl SessionCredential {
|
||||
session_id: self.session_id,
|
||||
secret: encoded_secret.as_str(),
|
||||
product_version: &self.product_version,
|
||||
device_anchor: self.device_anchor.as_ref(),
|
||||
};
|
||||
let payload = Zeroizing::new(serde_json::to_vec(&dto)?);
|
||||
|
||||
@@ -85,8 +101,12 @@ impl SessionCredential {
|
||||
session_id,
|
||||
secret,
|
||||
product_version,
|
||||
device_anchor,
|
||||
} = dto;
|
||||
let encoded_secret = secret;
|
||||
if device_anchor.as_ref().is_some_and(|anchor| !anchor.validate()) {
|
||||
return Err(TransportError::InvalidCredential);
|
||||
}
|
||||
if product_version.is_empty() || product_version.len() > MAX_PRODUCT_VERSION {
|
||||
return Err(TransportError::InvalidCredential);
|
||||
}
|
||||
@@ -104,6 +124,7 @@ impl SessionCredential {
|
||||
session_id,
|
||||
secret,
|
||||
product_version,
|
||||
device_anchor,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -126,6 +147,7 @@ struct CredentialDtoRef<'a> {
|
||||
session_id: Uuid,
|
||||
secret: &'a str,
|
||||
product_version: &'a str,
|
||||
device_anchor: Option<&'a DeviceAnchor>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -135,6 +157,7 @@ struct CredentialDto {
|
||||
session_id: Uuid,
|
||||
secret: Zeroizing<String>,
|
||||
product_version: String,
|
||||
device_anchor: Option<DeviceAnchor>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -161,4 +184,40 @@ mod tests {
|
||||
assert!(SessionCredential::decode_frame(&[0, 2, b'{']).is_err());
|
||||
assert!(SessionCredential::decode_frame(&vec![0; MAX_CREDENTIAL_FRAME + 1]).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn credential_round_trips_a_validated_device_anchor() {
|
||||
let anchor = DeviceAnchor {
|
||||
hardware_id: general_purpose::URL_SAFE_NO_PAD.encode([1_u8; 32]),
|
||||
source: crate::device_anchor::AnchorSource::UnixMac,
|
||||
};
|
||||
let credential = SessionCredential::generate(Uuid::new_v4(), "2.6.5")
|
||||
.unwrap()
|
||||
.with_device_anchor(anchor.clone())
|
||||
.unwrap();
|
||||
let frame = credential.encode_frame().unwrap();
|
||||
let payload: serde_json::Value = serde_json::from_slice(&frame[2..]).unwrap();
|
||||
assert_eq!(payload["device_anchor"]["source"], 1);
|
||||
let decoded = SessionCredential::decode_frame(&frame).unwrap();
|
||||
assert_eq!(decoded.device_anchor(), Some(&anchor));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn credential_rejects_reserved_and_unknown_anchor_sources() {
|
||||
let credential = SessionCredential::generate(Uuid::new_v4(), "2.6.5").unwrap();
|
||||
let frame = credential.encode_frame().unwrap();
|
||||
let mut payload: serde_json::Value = serde_json::from_slice(&frame[2..]).unwrap();
|
||||
let hardware_id = general_purpose::URL_SAFE_NO_PAD.encode([1_u8; 32]);
|
||||
|
||||
for source in [0, 4] {
|
||||
payload["device_anchor"] = serde_json::json!({
|
||||
"hardware_id": hardware_id,
|
||||
"source": source
|
||||
});
|
||||
let bytes = serde_json::to_vec(&payload).unwrap();
|
||||
let mut invalid_frame = (bytes.len() as u16).to_be_bytes().to_vec();
|
||||
invalid_frame.extend_from_slice(&bytes);
|
||||
assert!(SessionCredential::decode_frame(&invalid_frame).is_err());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ pub enum TransportError {
|
||||
#[serde(tag = "type", rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub enum HandshakeRejection {
|
||||
VersionMismatch { client: String, service: String },
|
||||
HipProtocolMismatch { client: u16, service: u16 },
|
||||
ServiceRestarted { service_instance_id: Uuid },
|
||||
ReconnectSuperseded,
|
||||
Unauthorized,
|
||||
|
||||
@@ -7,6 +7,8 @@ use super::{HandshakeRejection, MAX_PRELUDE, MAX_PRODUCT_VERSION, TransportError
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ClientPrelude {
|
||||
pub product_version: String,
|
||||
#[serde(default)]
|
||||
pub hip_protocol_version: u16,
|
||||
pub service_instance_id: Uuid,
|
||||
pub session_id: Uuid,
|
||||
}
|
||||
@@ -71,9 +73,16 @@ mod tests {
|
||||
r#"{{"product_version":"2.6.4","service_instance_id":"{instance}","session_id":"{session}","extra":true}}"#
|
||||
);
|
||||
assert!(ClientPrelude::decode(unknown.as_bytes()).is_err());
|
||||
let legacy =
|
||||
format!(r#"{{"product_version":"2.6.4","service_instance_id":"{instance}","session_id":"{session}"}}"#);
|
||||
assert_eq!(
|
||||
ClientPrelude::decode(legacy.as_bytes()).unwrap().hip_protocol_version,
|
||||
0
|
||||
);
|
||||
assert!(
|
||||
ClientPrelude {
|
||||
product_version: String::new(),
|
||||
hip_protocol_version: super::super::HIP_PROTOCOL_VERSION,
|
||||
service_instance_id: instance,
|
||||
session_id: session,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::hip::HipApprovalStatus;
|
||||
use crate::service::{event::WsEvent, request::WsRequest, vpn_env::VpnEnv, vpnc_script::VpncScriptMetadata};
|
||||
|
||||
use super::{MAX_PLAINTEXT, MAX_SERVICE_MESSAGE, ServiceErrorCode, TransportError};
|
||||
@@ -39,6 +40,20 @@ pub enum ServerMessage {
|
||||
#[serde(tag = "type", content = "data", rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub enum ServiceResult {
|
||||
Accepted,
|
||||
StoredHipReport {
|
||||
report_id: String,
|
||||
},
|
||||
HipUploadProgress {
|
||||
upload_id: String,
|
||||
},
|
||||
HipPreviewChunk {
|
||||
preview_id: String,
|
||||
offset: usize,
|
||||
xml: String,
|
||||
complete: bool,
|
||||
},
|
||||
HipApprovalStatus(HipApprovalStatus),
|
||||
NoSubmittedHipReport,
|
||||
VpncScriptMetadata(Option<VpncScriptMetadata>),
|
||||
Rejected(ServiceRejection),
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ pub use noise::{NoiseInitiator, NoiseResponder, NoiseTransport};
|
||||
pub const MAX_CREDENTIAL_FRAME: usize = 512;
|
||||
pub const MAX_PRELUDE: usize = 256;
|
||||
pub const MAX_PRODUCT_VERSION: usize = 64;
|
||||
pub const HIP_PROTOCOL_VERSION: u16 = 1;
|
||||
pub const MAX_PLAINTEXT: usize = 60 * 1024;
|
||||
pub const MAX_WS_MESSAGE: usize = u16::MAX as usize;
|
||||
pub const MAX_SERVICE_MESSAGE: usize = 256;
|
||||
@@ -24,9 +24,6 @@ pub struct VpnEnv {
|
||||
/// The default VPN script path
|
||||
pub vpnc_script: Option<String>,
|
||||
|
||||
/// The default CSD wrapper script path
|
||||
pub csd_wrapper: Option<String>,
|
||||
|
||||
/// The gpauth executable path
|
||||
/// Used by the client to launch gpauth for authentication
|
||||
pub auth_executable: String,
|
||||
|
||||
@@ -39,15 +39,11 @@ pub fn load_env_vars<T: AsRef<Path>>(env_file: T) -> anyhow::Result<HashMap<Stri
|
||||
}
|
||||
|
||||
pub fn patch_gui_runtime_env(hidpi: bool) {
|
||||
// This is to avoid blank screen on some systems
|
||||
unsafe { std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1") };
|
||||
|
||||
if is_wayland_session(
|
||||
env::var_os("WAYLAND_DISPLAY").as_deref(),
|
||||
env::var("XDG_SESSION_TYPE").ok().as_deref(),
|
||||
) {
|
||||
info!("Wayland session detected, enabling Linux WebKit rendering fallbacks");
|
||||
set_env_if_missing("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
info!("Wayland session detected, enabling software GL");
|
||||
set_env_if_missing("LIBGL_ALWAYS_SOFTWARE", "1");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
[package]
|
||||
name = "gphip"
|
||||
rust-version.workspace = true
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
gpapi = { path = "../gpapi" }
|
||||
anyhow.workspace = true
|
||||
askama.workspace = true
|
||||
chrono.workspace = true
|
||||
log.workspace = true
|
||||
netdev.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde_urlencoded.workspace = true
|
||||
uuid = { workspace = true, features = ["v5"] }
|
||||
uzers.workspace = true
|
||||
xmltree.workspace = true
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,143 @@
|
||||
use std::{
|
||||
fs,
|
||||
os::unix::fs::{MetadataExt, PermissionsExt},
|
||||
path::Path,
|
||||
process::Command,
|
||||
};
|
||||
|
||||
use super::SentinelInfo;
|
||||
|
||||
const SENTINELCTL: &str = "/Library/Sentinel/sentinel-agent.bundle/Contents/MacOS/sentinelctl";
|
||||
|
||||
pub(super) fn detect() -> Option<SentinelInfo> {
|
||||
if !trusted_cli(Path::new(SENTINELCTL)) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let status = run(&["status"])?;
|
||||
let status = parse_status(&status)?;
|
||||
let real_time_protection = if status.active {
|
||||
let scan_status = run(&["scan-on-write"])?;
|
||||
parse_yes_no(scan_status.trim().strip_prefix("scan-on-write:")?)?
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let firewall_enabled = run(&["firewall", "enabled"]).as_deref().and_then(parse_yes_no);
|
||||
|
||||
Some(SentinelInfo {
|
||||
version: status.version,
|
||||
real_time_protection,
|
||||
firewall_enabled,
|
||||
})
|
||||
}
|
||||
|
||||
fn trusted_cli(path: &Path) -> bool {
|
||||
path.ancestors().take_while(|part| part.as_os_str() != "/").all(|part| {
|
||||
let Ok(metadata) = fs::symlink_metadata(part) else {
|
||||
return false;
|
||||
};
|
||||
if metadata.uid() != 0 || metadata.permissions().mode() & 0o022 != 0 || metadata.file_type().is_symlink() {
|
||||
return false;
|
||||
}
|
||||
if part == path {
|
||||
metadata.is_file()
|
||||
} else {
|
||||
metadata.is_dir()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn run(args: &[&str]) -> Option<String> {
|
||||
let output = Command::new(SENTINELCTL)
|
||||
.args(args)
|
||||
.env("LC_ALL", "C")
|
||||
.env_remove("SENTINEL_OUTPUT_JSON")
|
||||
.output()
|
||||
.ok()?;
|
||||
if !output.status.success() {
|
||||
return None;
|
||||
}
|
||||
String::from_utf8(output.stdout).ok()
|
||||
}
|
||||
|
||||
struct AgentStatus {
|
||||
version: String,
|
||||
active: bool,
|
||||
}
|
||||
|
||||
fn parse_status(output: &str) -> Option<AgentStatus> {
|
||||
let version = status_value(output, "Version:")?;
|
||||
if version.is_empty()
|
||||
|| version.len() > 64
|
||||
|| !version
|
||||
.chars()
|
||||
.all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '.' | '-' | '_'))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
let operational = parse_status_bool(output, "Agent Operational State:", "enabled", "disabled")?;
|
||||
let ready = parse_status_bool(output, "Ready:", "yes", "no")?;
|
||||
let protected = parse_status_bool(output, "Protection:", "enabled", "disabled")?;
|
||||
Some(AgentStatus {
|
||||
version: version.to_string(),
|
||||
active: operational && ready && protected,
|
||||
})
|
||||
}
|
||||
|
||||
fn status_value<'a>(output: &'a str, label: &str) -> Option<&'a str> {
|
||||
output
|
||||
.lines()
|
||||
.find_map(|line| line.trim().strip_prefix(label).map(str::trim))
|
||||
}
|
||||
|
||||
fn parse_status_bool(output: &str, label: &str, yes: &str, no: &str) -> Option<bool> {
|
||||
match status_value(output, label)? {
|
||||
value if value == yes => Some(true),
|
||||
value if value == no => Some(false),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_yes_no(output: &str) -> Option<bool> {
|
||||
match output.trim() {
|
||||
"yes" => Some(true),
|
||||
"no" => Some(false),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parses_running_agent_status() {
|
||||
let status = parse_status(
|
||||
"Agent\n Version: 25.3.4.8365\n Agent Operational State: enabled\n Ready: yes\n Protection: enabled\n",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(status.version, "25.3.4.8365");
|
||||
assert!(status.active);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_unknown_agent_state() {
|
||||
assert!(parse_status("Version: 25.3.4.8365\nProtection: maybe\n").is_none());
|
||||
assert!(
|
||||
!parse_status("Version: 25.3.4.8365\nAgent Operational State: disabled\nReady: yes\nProtection: enabled\n")
|
||||
.unwrap()
|
||||
.active
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_scan_and_firewall_states() {
|
||||
assert_eq!(
|
||||
parse_yes_no("scan-on-write:\tyes\n".trim().strip_prefix("scan-on-write:").unwrap()),
|
||||
Some(true)
|
||||
);
|
||||
assert_eq!(parse_yes_no("no\n"), Some(false));
|
||||
assert_eq!(parse_yes_no("unknown\n"), None);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
use std::{
|
||||
fs,
|
||||
os::unix::fs::{MetadataExt, PermissionsExt},
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
};
|
||||
|
||||
use super::SentinelInfo;
|
||||
|
||||
const SENTINEL_DIR: &str = "/opt/sentinelone";
|
||||
|
||||
pub(super) fn detect() -> Option<SentinelInfo> {
|
||||
let cli = trusted_cli()?;
|
||||
|
||||
let version = parse_version(&run(&cli, &["version"])?)?;
|
||||
let agent_enabled = parse_enabled(&run(&cli, &["control", "status"])?, "Agent state")?;
|
||||
let real_time_protection = if agent_enabled {
|
||||
let policy = run(&cli, &["policy", "status"])?;
|
||||
let on_write = parse_enabled(&policy, "On-Write:")?;
|
||||
let on_execute = parse_enabled(&policy, "On-Execute:")?;
|
||||
on_write || on_execute
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
Some(SentinelInfo {
|
||||
version,
|
||||
real_time_protection,
|
||||
firewall_enabled: None,
|
||||
})
|
||||
}
|
||||
|
||||
fn trusted_cli() -> Option<PathBuf> {
|
||||
let agent_uid = uzers::get_user_by_name("sentinelone")?.uid();
|
||||
let agent_dir = Path::new(SENTINEL_DIR);
|
||||
if !trusted_dir(Path::new("/opt"), 0) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let link = fs::symlink_metadata(agent_dir).ok()?;
|
||||
if link.file_type().is_symlink() && link.uid() != 0 {
|
||||
return None;
|
||||
}
|
||||
let resolved_dir = fs::canonicalize(agent_dir).ok()?;
|
||||
for ancestor in resolved_dir.ancestors().skip(1) {
|
||||
if !trusted_dir(ancestor, 0) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
if !(trusted_dir(&resolved_dir, 0) || trusted_dir(&resolved_dir, agent_uid))
|
||||
|| !trusted_dir(&resolved_dir.join("bin"), 0)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
let cli = resolved_dir.join("bin/sentinelctl");
|
||||
let metadata = fs::symlink_metadata(&cli).ok()?;
|
||||
if !metadata.is_file()
|
||||
|| metadata.uid() != 0
|
||||
|| metadata.permissions().mode() & 0o022 != 0
|
||||
|| metadata.permissions().mode() & 0o111 == 0
|
||||
{
|
||||
return None;
|
||||
}
|
||||
Some(cli)
|
||||
}
|
||||
|
||||
fn trusted_dir(path: &Path, owner: u32) -> bool {
|
||||
let Ok(metadata) = fs::symlink_metadata(path) else {
|
||||
return false;
|
||||
};
|
||||
metadata.is_dir() && metadata.uid() == owner && metadata.permissions().mode() & 0o022 == 0
|
||||
}
|
||||
|
||||
fn run(cli: &Path, args: &[&str]) -> Option<String> {
|
||||
let output = Command::new(cli)
|
||||
.args(args)
|
||||
.env("LC_ALL", "C")
|
||||
.env_remove("SENTINEL_OUTPUT_JSON")
|
||||
.output()
|
||||
.ok()?;
|
||||
if !output.status.success() {
|
||||
return None;
|
||||
}
|
||||
String::from_utf8(output.stdout).ok()
|
||||
}
|
||||
|
||||
fn parse_version(output: &str) -> Option<String> {
|
||||
let version = value(output, "Agent version:")?;
|
||||
if version.is_empty()
|
||||
|| version.len() > 64
|
||||
|| !version
|
||||
.chars()
|
||||
.all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '.' | '-' | '_'))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
Some(version.to_string())
|
||||
}
|
||||
|
||||
fn parse_enabled(output: &str, label: &str) -> Option<bool> {
|
||||
match value(output, label)? {
|
||||
"Enabled" => Some(true),
|
||||
"Disabled" => Some(false),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn value<'a>(output: &'a str, label: &str) -> Option<&'a str> {
|
||||
output
|
||||
.lines()
|
||||
.find_map(|line| line.trim().strip_prefix(label).map(str::trim))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parses_observed_agent_and_policy_status() {
|
||||
assert_eq!(
|
||||
parse_version("Agent version: 25.2.2.14\nSentinelCTL version: 25.2.2.14\n"),
|
||||
Some("25.2.2.14".into())
|
||||
);
|
||||
assert_eq!(parse_enabled("Agent state Enabled\n", "Agent state"), Some(true));
|
||||
assert_eq!(
|
||||
parse_enabled("On-Write: Enabled\nOn-Execute: Disabled\n", "On-Write:"),
|
||||
Some(true)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_enabled("On-Write: Enabled\nOn-Execute: Disabled\n", "On-Execute:"),
|
||||
Some(false)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_unknown_or_invalid_status() {
|
||||
assert_eq!(parse_version("Agent version: 25.2.2.14\"/>\n"), None);
|
||||
assert_eq!(parse_enabled("Agent state Unknown\n", "Agent state"), None);
|
||||
assert_eq!(parse_enabled("On-Write: Unknown\n", "On-Write:"), None);
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,15 @@
|
||||
{% elif host_info.os_vendor == "Apple" -%}
|
||||
<entry name="anti-malware">
|
||||
<list>
|
||||
{% if let Some(sentinel) = &host_info.sentinel %}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod vendor="SentinelOne" name="Sentinel Agent" version="{{ sentinel.version }}" engver="" datemon="{{ month }}" dateday="{{ day }}" dateyear="{{ year }}" prodType="3" osType="4"/>
|
||||
<real-time-protection>{% if sentinel.real_time_protection %}yes{% else %}no{% endif %}</real-time-protection>
|
||||
<last-full-scan-time>n/a</last-full-scan-time>
|
||||
</ProductInfo>
|
||||
</entry>
|
||||
{% endif -%}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod vendor="Apple Inc." name="Xprotect" version="2167" defver="235000000000000" engver="" datemon="{{ month }}" dateday="{{ day }}" dateyear="{{ year }}" prodType="3" osType="4"/>
|
||||
@@ -190,6 +199,16 @@
|
||||
</entry>
|
||||
<entry name="firewall">
|
||||
<list>
|
||||
{% if let Some(sentinel) = &host_info.sentinel %}
|
||||
{% if let Some(firewall_enabled) = sentinel.firewall_enabled %}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod vendor="SentinelOne" name="Sentinel Agent" version="{{ sentinel.version }}"/>
|
||||
<is-enabled>{% if firewall_enabled %}yes{% else %}no{% endif %}</is-enabled>
|
||||
</ProductInfo>
|
||||
</entry>
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod vendor="Apple Inc." name="Mac OS X Builtin Firewall" version="{{ host_info.software_version }}"/>
|
||||
@@ -218,8 +237,17 @@
|
||||
</entry>
|
||||
{% elif host_info.os_vendor == "Linux" -%}
|
||||
<entry name="anti-malware">
|
||||
{% if let Some(defender) = &host_info.defender -%}
|
||||
<list>
|
||||
{% if let Some(sentinel) = &host_info.sentinel %}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod vendor="SentinelOne" name="Sentinel Agent" version="{{ sentinel.version }}" engver="" datemon="{{ month }}" dateday="{{ day }}" dateyear="{{ year }}" prodType="3" osType="1"/>
|
||||
<real-time-protection>{% if sentinel.real_time_protection %}yes{% else %}no{% endif %}</real-time-protection>
|
||||
<last-full-scan-time>n/a</last-full-scan-time>
|
||||
</ProductInfo>
|
||||
</entry>
|
||||
{% endif -%}
|
||||
{% if let Some(defender) = &host_info.defender %}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod name="Microsoft Defender ATP" version="{{ defender.app_version }}" defver="{{ defender.definitions_version }}" prodType="3" engver="{{ defender.engine_version }}" osType="1" vendor="Microsoft Corporation" dateday="{{ day }}" dateyear="{{ year }}" datemon="{{ month }}">
|
||||
@@ -228,10 +256,17 @@
|
||||
<last-full-scan-time>n/a</last-full-scan-time>
|
||||
</ProductInfo>
|
||||
</entry>
|
||||
</list>
|
||||
{% else -%}
|
||||
<list/>
|
||||
{% endif -%}
|
||||
{% if let Some(clamav) = &host_info.clamav %}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod vendor="Cisco Systems, Inc." name="ClamAV" version="{{ clamav.version }}"{% if let Some(definitions_version) = &clamav.definitions_version %} defver="{{ definitions_version }}"{% endif %} engver="" datemon="{{ month }}" dateday="{{ day }}" dateyear="{{ year }}" prodType="3" osType="1"/>
|
||||
<real-time-protection>{% if clamav.real_time_protection %}yes{% else %}no{% endif %}</real-time-protection>
|
||||
<last-full-scan-time>n/a</last-full-scan-time>
|
||||
</ProductInfo>
|
||||
</entry>
|
||||
{% endif -%}
|
||||
</list>
|
||||
</entry>
|
||||
<entry name="disk-backup">
|
||||
<list/>
|
||||
@@ -254,6 +289,14 @@
|
||||
</entry>
|
||||
<entry name="firewall">
|
||||
<list>
|
||||
{% if let Some(ufw) = &host_info.ufw %}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod vendor="Canonical Ltd." name="UFW" version="{{ ufw.version }}"/>
|
||||
<is-enabled>{% if ufw.is_enabled %}yes{% else %}no{% endif %}</is-enabled>
|
||||
</ProductInfo>
|
||||
</entry>
|
||||
{% endif -%}
|
||||
<entry>
|
||||
<ProductInfo>
|
||||
<Prod name="IPTables" version="1.8.4" vendor="IPTables">
|
||||
@@ -117,10 +117,7 @@ fn build_openconnect(deps_dir: &PathBuf, out_dir: &PathBuf) -> PathBuf {
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
config
|
||||
.disable_static()
|
||||
.enable_shared()
|
||||
.without("gnutls", None);
|
||||
config.disable_static().enable_shared().without("gnutls", None);
|
||||
config.ldflag("-liconv");
|
||||
config.env("LIBS", "-liconv");
|
||||
}
|
||||
|
||||
Submodule crates/openconnect/deps/openconnect updated: 706ca4d6f5...821a8d26d0.
@@ -7,6 +7,7 @@ use std::ffi::{c_char, c_int, c_long, c_void};
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct ConnectOptions {
|
||||
pub user_data: *mut c_void,
|
||||
pub on_hip_report_submitted: Option<extern "C" fn(*mut c_void, *const c_char, usize)>,
|
||||
|
||||
pub server: *const c_char,
|
||||
pub cookie: *const c_char,
|
||||
@@ -53,22 +54,48 @@ pub(crate) struct VpnSessionInfoRaw {
|
||||
|
||||
#[link(name = "vpn")]
|
||||
unsafe extern "C" {
|
||||
fn vpn_write_cancel(fd: c_int) -> c_int;
|
||||
#[link_name = "vpn_connect"]
|
||||
fn vpn_connect(
|
||||
options: *const ConnectOptions,
|
||||
callback: extern "C" fn(i32, *const VpnSessionInfoRaw, *mut c_void),
|
||||
) -> c_int;
|
||||
|
||||
#[link_name = "vpn_disconnect"]
|
||||
fn vpn_disconnect();
|
||||
}
|
||||
|
||||
pub(crate) fn write_cancel(fd: i32) -> std::io::Result<()> {
|
||||
let error = unsafe { vpn_write_cancel(fd) };
|
||||
if error == 0 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(std::io::Error::from_raw_os_error(error))
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn vpn_attach_command_pipe(vpn: *mut c_void, fd: c_int) -> c_int {
|
||||
unsafe { &*(vpn as *const Vpn) }.attach_command_pipe(fd).into()
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn vpn_detach_command_pipe(vpn: *mut c_void) {
|
||||
unsafe { &*(vpn as *const Vpn) }.detach_command_pipe();
|
||||
}
|
||||
|
||||
pub(crate) fn connect(options: &ConnectOptions) -> i32 {
|
||||
unsafe { vpn_connect(options, on_vpn_connected) }
|
||||
}
|
||||
|
||||
pub(crate) fn disconnect() {
|
||||
unsafe { vpn_disconnect() }
|
||||
#[unsafe(no_mangle)]
|
||||
pub(crate) extern "C" fn on_hip_report_submitted(vpn: *mut c_void, report: *const c_char, length: usize) {
|
||||
let vpn = unsafe { &*(vpn as *const Vpn) };
|
||||
if report.is_null() || length > 1024 * 1024 {
|
||||
return;
|
||||
}
|
||||
let bytes = unsafe { std::slice::from_raw_parts(report.cast::<u8>(), length) };
|
||||
if let Ok(report) = std::str::from_utf8(bytes) {
|
||||
vpn.on_hip_report_submitted(report);
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <openconnect.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -7,13 +8,12 @@
|
||||
|
||||
#include "vpn.h"
|
||||
|
||||
void *g_user_data;
|
||||
|
||||
static int g_cmd_pipe_fd;
|
||||
static const char *g_vpnc_script;
|
||||
static const char *g_vpnc_interface;
|
||||
static int g_script_tun;
|
||||
static vpn_connected_callback on_vpn_connected;
|
||||
struct vpn_context {
|
||||
struct openconnect_info *vpninfo;
|
||||
int command_fd;
|
||||
const vpn_options *options;
|
||||
vpn_connected_callback on_connected;
|
||||
};
|
||||
|
||||
/* Validate the peer certificate */
|
||||
static int validate_peer_cert(__attribute__((unused)) void *_vpninfo,
|
||||
@@ -40,14 +40,17 @@ static void print_progress(__attribute__((unused)) void *_vpninfo, int level,
|
||||
}
|
||||
}
|
||||
|
||||
static void setup_tun_handler(void *_vpninfo)
|
||||
static void setup_tun_handler(void *private_data)
|
||||
{
|
||||
struct vpn_context *context = private_data;
|
||||
struct openconnect_info *_vpninfo = context->vpninfo;
|
||||
const vpn_options *options = context->options;
|
||||
int ret;
|
||||
if (g_script_tun) {
|
||||
ret = openconnect_setup_tun_script(_vpninfo, g_vpnc_script);
|
||||
if (options->script_tun) {
|
||||
ret = openconnect_setup_tun_script(_vpninfo, options->script);
|
||||
} else {
|
||||
ret = openconnect_setup_tun_device(_vpninfo, g_vpnc_script,
|
||||
g_vpnc_interface);
|
||||
ret = openconnect_setup_tun_device(_vpninfo, options->script,
|
||||
options->interface);
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
@@ -63,7 +66,7 @@ static void setup_tun_handler(void *_vpninfo)
|
||||
.nlb_connected_gw_ip =
|
||||
openconnect_get_gp_nlb_connected_gw_ip(_vpninfo),
|
||||
};
|
||||
on_vpn_connected(g_cmd_pipe_fd, &session_info, g_user_data);
|
||||
context->on_connected(context->command_fd, &session_info, options->user_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,18 +77,15 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
struct utsname utsbuf;
|
||||
const char *effective_local_hostname = NULL;
|
||||
|
||||
g_user_data = options->user_data;
|
||||
g_vpnc_script = options->script;
|
||||
g_vpnc_interface = options->interface;
|
||||
g_script_tun = options->script_tun;
|
||||
on_vpn_connected = callback;
|
||||
struct vpn_context context = { .options = options, .on_connected = callback };
|
||||
int result = 1;
|
||||
|
||||
INFO("USER_AGENT: %s", options->user_agent);
|
||||
INFO("OS: %s", options->os);
|
||||
INFO("CLIENT_VERSION: %s", options->client_version);
|
||||
INFO("HOST_ID: %s", options->host_id ? options->host_id : "(not set)");
|
||||
INFO("VPNC_SCRIPT: %s", options->script);
|
||||
INFO("SCRIPT_TUN: %d", g_script_tun);
|
||||
INFO("SCRIPT_TUN: %d", options->script_tun);
|
||||
INFO("CSD_USER: %d", options->csd_uid);
|
||||
INFO("CSD_WRAPPER: %s", options->csd_wrapper);
|
||||
INFO("RECONNECT_TIMEOUT: %d", options->reconnect_timeout);
|
||||
@@ -97,13 +97,28 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
|
||||
vpninfo =
|
||||
openconnect_vpninfo_new(options->user_agent, validate_peer_cert,
|
||||
NULL, NULL, print_progress, NULL);
|
||||
NULL, NULL, print_progress, &context);
|
||||
|
||||
if (!vpninfo) {
|
||||
ERROR("openconnect_vpninfo_new failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
context.vpninfo = vpninfo;
|
||||
openconnect_set_gp_hip_report_callback(vpninfo, options->user_data,
|
||||
options->on_hip_report_submitted);
|
||||
context.command_fd = openconnect_setup_cmd_pipe(vpninfo);
|
||||
if (context.command_fd < 0) {
|
||||
ERROR("openconnect_setup_cmd_pipe failed");
|
||||
goto cleanup;
|
||||
}
|
||||
/* An earlier disconnect remains latched on this attempt. */
|
||||
if (vpn_attach_command_pipe(options->user_data, context.command_fd)) {
|
||||
INFO("VPN attempt canceled before startup");
|
||||
result = -EINTR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
openconnect_set_loglevel(vpninfo, PRG_TRACE);
|
||||
openconnect_init_ssl();
|
||||
openconnect_set_protocol(vpninfo, "gp");
|
||||
@@ -170,23 +185,15 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
if (options->dpd_interval > 0) {
|
||||
openconnect_set_dpd(vpninfo, options->dpd_interval);
|
||||
}
|
||||
|
||||
g_cmd_pipe_fd = openconnect_setup_cmd_pipe(vpninfo);
|
||||
if (g_cmd_pipe_fd < 0) {
|
||||
ERROR("openconnect_setup_cmd_pipe failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Essential step
|
||||
if (openconnect_make_cstp_connection(vpninfo) != 0) {
|
||||
ERROR("openconnect_make_cstp_connection failed");
|
||||
return 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (options->no_dtls || openconnect_setup_dtls(vpninfo, 60) != 0) {
|
||||
openconnect_disable_dtls(vpninfo);
|
||||
}
|
||||
|
||||
// Essential step
|
||||
openconnect_set_setup_tun_handler(vpninfo, setup_tun_handler);
|
||||
|
||||
@@ -196,23 +203,25 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
|
||||
|
||||
if (ret) {
|
||||
INFO("openconnect_mainloop returned %d, exiting", ret);
|
||||
openconnect_vpninfo_free(vpninfo);
|
||||
return ret;
|
||||
result = ret;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
INFO("openconnect_mainloop returned 0, reconnecting");
|
||||
}
|
||||
cleanup:
|
||||
vpn_detach_command_pipe(options->user_data);
|
||||
openconnect_vpninfo_free(vpninfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Stop the VPN connection */
|
||||
void vpn_disconnect()
|
||||
/* Called with the attempt cancellation mutex held, never after detach/free. */
|
||||
int vpn_write_cancel(int fd)
|
||||
{
|
||||
char cmd = OC_CMD_CANCEL;
|
||||
|
||||
INFO("Stopping VPN connection: %d", g_cmd_pipe_fd);
|
||||
|
||||
if (write(g_cmd_pipe_fd, &cmd, 1) < 0) {
|
||||
ERROR("Failed to write to command pipe, VPN connection may not "
|
||||
"be stopped");
|
||||
}
|
||||
char command = OC_CMD_CANCEL;
|
||||
ssize_t written;
|
||||
do {
|
||||
written = write(fd, &command, 1);
|
||||
} while (written < 0 && errno == EINTR);
|
||||
return written == 1 ? 0 : (written < 0 ? errno : EIO);
|
||||
}
|
||||
@@ -16,9 +16,12 @@ typedef struct vpn_session_info {
|
||||
typedef void (*vpn_connected_callback)(int cmd_pipe_fd,
|
||||
const vpn_session_info *session_info,
|
||||
void *user_data);
|
||||
typedef void (*vpn_hip_report_callback)(void *user_data, const char *report,
|
||||
size_t length);
|
||||
|
||||
typedef struct vpn_options {
|
||||
void *user_data;
|
||||
vpn_hip_report_callback on_hip_report_submitted;
|
||||
|
||||
const char *server;
|
||||
const char *cookie;
|
||||
@@ -52,7 +55,9 @@ typedef struct vpn_options {
|
||||
} vpn_options;
|
||||
|
||||
int vpn_connect(const vpn_options *options, vpn_connected_callback callback);
|
||||
void vpn_disconnect();
|
||||
|
||||
extern int vpn_attach_command_pipe(void *user_data, int fd);
|
||||
extern void vpn_detach_command_pipe(void *user_data);
|
||||
|
||||
extern void vpn_log(int level, const char *msg);
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
use std::{
|
||||
ffi::{CStr, CString, c_char},
|
||||
fmt,
|
||||
sync::{Arc, RwLock},
|
||||
fmt, io,
|
||||
sync::{Arc, Mutex, RwLock},
|
||||
};
|
||||
|
||||
use log::info;
|
||||
use log::{info, warn};
|
||||
|
||||
use crate::ffi;
|
||||
use crate::vpn_utils::{check_executable, find_csd_wrapper, find_vpnc_script};
|
||||
|
||||
type OnConnectedCallback = Arc<RwLock<Option<Box<dyn FnOnce(VpnSessionInfo) + 'static + Send + Sync>>>>;
|
||||
type OnHipReportCallback = RwLock<Option<Arc<dyn Fn(&str) + Send + Sync>>>;
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub struct VpnSessionInfo {
|
||||
@@ -60,7 +61,45 @@ fn positive_i64_to_u32(value: i64) -> Option<u32> {
|
||||
u32::try_from(value).ok().filter(|value| *value > 0)
|
||||
}
|
||||
|
||||
// The descriptor is borrowed only between attach and detach. Serialize writes
|
||||
// against teardown and retain cancellation before the pipe exists.
|
||||
#[derive(Default)]
|
||||
struct Cancellation {
|
||||
state: Mutex<CancellationState>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct CancellationState {
|
||||
requested: bool,
|
||||
command_fd: Option<i32>,
|
||||
}
|
||||
|
||||
impl Cancellation {
|
||||
fn attach(&self, fd: i32) -> bool {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.command_fd = Some(fd);
|
||||
state.requested
|
||||
}
|
||||
|
||||
fn detach(&self) {
|
||||
self.state.lock().unwrap().command_fd = None;
|
||||
}
|
||||
|
||||
fn cancel(&self) -> io::Result<()> {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
if state.requested {
|
||||
return Ok(());
|
||||
}
|
||||
state.requested = true;
|
||||
if let Some(fd) = state.command_fd {
|
||||
ffi::write_cancel(fd)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Vpn {
|
||||
cancellation: Cancellation,
|
||||
server: CString,
|
||||
cookie: CString,
|
||||
|
||||
@@ -92,6 +131,7 @@ pub struct Vpn {
|
||||
no_xmlpost: bool,
|
||||
|
||||
callback: OnConnectedCallback,
|
||||
hip_report_callback: OnHipReportCallback,
|
||||
}
|
||||
|
||||
impl Vpn {
|
||||
@@ -106,6 +146,19 @@ impl Vpn {
|
||||
ffi::connect(&options)
|
||||
}
|
||||
|
||||
/// Receives a borrowed report after the gateway accepts its HIP submission.
|
||||
/// The callback must copy the XML if it needs to retain it.
|
||||
pub fn set_hip_report_callback(&self, callback: impl Fn(&str) + Send + Sync + 'static) {
|
||||
*self.hip_report_callback.write().unwrap() = Some(Arc::new(callback));
|
||||
}
|
||||
|
||||
pub(crate) fn on_hip_report_submitted(&self, report: &str) {
|
||||
let callback = self.hip_report_callback.read().unwrap().clone();
|
||||
if let Some(callback) = callback {
|
||||
callback(report);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn on_connected(&self, pipe_fd: i32, session_info: VpnSessionInfo) {
|
||||
info!("Connected to VPN, pipe_fd: {}", pipe_fd);
|
||||
|
||||
@@ -114,13 +167,24 @@ impl Vpn {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn attach_command_pipe(&self, fd: i32) -> bool {
|
||||
self.cancellation.attach(fd)
|
||||
}
|
||||
|
||||
pub(crate) fn detach_command_pipe(&self) {
|
||||
self.cancellation.detach();
|
||||
}
|
||||
|
||||
pub fn disconnect(&self) {
|
||||
ffi::disconnect();
|
||||
if let Err(error) = self.cancellation.cancel() {
|
||||
warn!("Failed to signal VPN cancellation: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
fn build_connect_options(&self) -> ffi::ConnectOptions {
|
||||
ffi::ConnectOptions {
|
||||
user_data: self as *const _ as *mut _,
|
||||
on_hip_report_submitted: Some(ffi::on_hip_report_submitted),
|
||||
|
||||
server: self.server.as_ptr(),
|
||||
cookie: self.cookie.as_ptr(),
|
||||
@@ -401,6 +465,7 @@ impl VpnBuilder {
|
||||
let os = self.os.unwrap_or("linux".to_string());
|
||||
|
||||
Ok(Vpn {
|
||||
cancellation: Cancellation::default(),
|
||||
server: Self::to_cstring(&self.server),
|
||||
cookie: Self::to_cstring(&self.cookie),
|
||||
|
||||
@@ -431,6 +496,7 @@ impl VpnBuilder {
|
||||
no_xmlpost: self.no_xmlpost,
|
||||
|
||||
callback: Default::default(),
|
||||
hip_report_callback: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -529,6 +595,7 @@ mod tests {
|
||||
#[test]
|
||||
fn connect_options_include_host_id() {
|
||||
let vpn = Vpn {
|
||||
cancellation: Cancellation::default(),
|
||||
server: CString::new("gateway.example.com").unwrap(),
|
||||
cookie: CString::new("cookie").unwrap(),
|
||||
user_agent: CString::new("agent").unwrap(),
|
||||
@@ -553,6 +620,7 @@ mod tests {
|
||||
dpd_interval: 0,
|
||||
no_xmlpost: false,
|
||||
callback: Default::default(),
|
||||
hip_report_callback: Default::default(),
|
||||
};
|
||||
|
||||
let options = vpn.build_connect_options();
|
||||
@@ -560,4 +628,195 @@ mod tests {
|
||||
let host_id = unsafe { CStr::from_ptr(options.host_id) }.to_str().unwrap();
|
||||
assert_eq!(host_id, "profile-host-id");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hip_report_callback_copies_only_bounded_utf8() {
|
||||
let vpn = Vpn::builder("vpn.example.com", "cookie")
|
||||
.script_path("/bin/sh".to_string())
|
||||
.build()
|
||||
.unwrap();
|
||||
let reports = Arc::new(Mutex::new(Vec::new()));
|
||||
let received = Arc::clone(&reports);
|
||||
vpn.set_hip_report_callback(move |report| received.lock().unwrap().push(report.to_owned()));
|
||||
|
||||
let options = vpn.build_connect_options();
|
||||
let callback = options.on_hip_report_submitted.unwrap();
|
||||
callback(options.user_data, b"<report/>".as_ptr().cast(), 9);
|
||||
callback(options.user_data, b"\xff".as_ptr().cast(), 1);
|
||||
callback(options.user_data, b"x".as_ptr().cast(), 1024 * 1024 + 1);
|
||||
|
||||
assert_eq!(*reports.lock().unwrap(), ["<report/>"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disconnect_before_connect_is_retained_without_contacting_server() {
|
||||
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
listener.set_nonblocking(true).unwrap();
|
||||
let vpn = Vpn::builder(&format!("https://{}", listener.local_addr().unwrap()), "test-cookie")
|
||||
.script_path("/bin/sh".to_string())
|
||||
.build()
|
||||
.unwrap();
|
||||
vpn.disconnect();
|
||||
vpn.disconnect();
|
||||
assert_ne!(vpn.connect(|_| panic!("Canceled attempt connected")), 0);
|
||||
assert_eq!(listener.accept().unwrap_err().kind(), io::ErrorKind::WouldBlock);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn command_pipe_failure_preserves_stdin() {
|
||||
use std::{
|
||||
ffi::{c_int, c_void},
|
||||
fs::File,
|
||||
os::fd::AsFd,
|
||||
process::{Command, Stdio},
|
||||
};
|
||||
|
||||
const CHILD: &str = "OPENCONNECT_TEST_PIPE_FAILURE";
|
||||
if std::env::var_os(CHILD).is_none() {
|
||||
// Limit descriptors only in a subprocess, leaving the test runner untouched.
|
||||
let output = Command::new("sh")
|
||||
.args([
|
||||
"-c",
|
||||
"ulimit -n 64 && exec \"$1\" --exact vpn::tests::command_pipe_failure_preserves_stdin --nocapture",
|
||||
"sh",
|
||||
])
|
||||
.arg(std::env::current_exe().unwrap())
|
||||
.env(CHILD, "1")
|
||||
.stdin(Stdio::null())
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(
|
||||
output.status.success(),
|
||||
"{}\n{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
unsafe extern "C" {
|
||||
fn openconnect_vpninfo_new(
|
||||
agent: *const c_char,
|
||||
validate: Option<unsafe extern "C" fn(*mut c_void, *const c_char) -> c_int>,
|
||||
config: Option<unsafe extern "C" fn(*mut c_void, *const c_char, c_int) -> c_int>,
|
||||
auth: Option<unsafe extern "C" fn(*mut c_void, *mut c_void) -> c_int>,
|
||||
progress: Option<unsafe extern "C" fn(*mut c_void, c_int, *const c_char, ...)>,
|
||||
data: *mut c_void,
|
||||
) -> *mut c_void;
|
||||
fn openconnect_setup_cmd_pipe(info: *mut c_void) -> c_int;
|
||||
fn openconnect_vpninfo_free(info: *mut c_void);
|
||||
}
|
||||
// Construct first so resource exhaustion targets pipe creation specifically.
|
||||
let info = unsafe { openconnect_vpninfo_new(c"test".as_ptr(), None, None, None, None, std::ptr::null_mut()) };
|
||||
assert!(!info.is_null());
|
||||
let mut descriptors = Vec::new();
|
||||
loop {
|
||||
match File::open("/dev/null") {
|
||||
Ok(file) => descriptors.push(file),
|
||||
Err(error) => {
|
||||
assert_eq!(error.raw_os_error(), Some(24)); // EMFILE on supported Unix platforms.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(unsafe { openconnect_setup_cmd_pipe(info) } < 0);
|
||||
unsafe { openconnect_vpninfo_free(info) };
|
||||
// Constructor resource acquisition may also fail before selecting a protocol.
|
||||
let info = unsafe { openconnect_vpninfo_new(c"test".as_ptr(), None, None, None, None, std::ptr::null_mut()) };
|
||||
if !info.is_null() {
|
||||
unsafe { openconnect_vpninfo_free(info) };
|
||||
}
|
||||
drop(descriptors);
|
||||
std::io::stdin()
|
||||
.as_fd()
|
||||
.try_clone_to_owned()
|
||||
.expect("Cleanup closed stdin");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disconnect_interrupts_in_progress_tls_and_cannot_cancel_another_attempt() {
|
||||
use std::{io::Read, sync::mpsc, thread, time::Duration};
|
||||
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
listener.set_nonblocking(true).unwrap();
|
||||
let vpn = Arc::new(
|
||||
Vpn::builder(&format!("https://{}", listener.local_addr().unwrap()), "test-cookie")
|
||||
.script_path("/bin/sh".to_string())
|
||||
.build()
|
||||
.unwrap(),
|
||||
);
|
||||
let (tx, rx) = mpsc::channel();
|
||||
let worker_vpn = vpn.clone();
|
||||
let worker = thread::spawn(move || {
|
||||
tx.send(worker_vpn.connect(|_| panic!("Test peer never completes TLS")))
|
||||
.unwrap();
|
||||
});
|
||||
let deadline = std::time::Instant::now() + Duration::from_secs(3);
|
||||
let peer = loop {
|
||||
match listener.accept() {
|
||||
Ok((peer, _)) => break peer,
|
||||
Err(error) if error.kind() == io::ErrorKind::WouldBlock && std::time::Instant::now() < deadline => {
|
||||
thread::sleep(Duration::from_millis(5));
|
||||
}
|
||||
other => {
|
||||
vpn.disconnect();
|
||||
worker.join().unwrap();
|
||||
panic!("Connection did not reach test peer: {other:?}");
|
||||
}
|
||||
}
|
||||
};
|
||||
vpn.disconnect();
|
||||
let result = rx.recv_timeout(Duration::from_secs(2));
|
||||
drop(peer); // Release the peer even if cancellation regresses.
|
||||
worker.join().unwrap();
|
||||
assert_ne!(result.expect("Cancellation did not interrupt TLS"), 0);
|
||||
use std::os::{fd::AsRawFd, unix::net::UnixStream};
|
||||
let next = Cancellation::default();
|
||||
let (mut reader, writer) = UnixStream::pair().unwrap();
|
||||
reader.set_nonblocking(true).unwrap();
|
||||
assert!(!next.attach(writer.as_raw_fd()));
|
||||
vpn.disconnect(); // A late stop of the old attempt cannot affect the new one.
|
||||
assert_eq!(reader.read(&mut [0]).unwrap_err().kind(), io::ErrorKind::WouldBlock);
|
||||
next.detach();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cancellation_racing_pipe_attachment_is_never_lost() {
|
||||
use std::{
|
||||
io::Read,
|
||||
os::{fd::AsRawFd, unix::net::UnixStream},
|
||||
thread,
|
||||
};
|
||||
for _ in 0..100 {
|
||||
let cancellation = Cancellation::default();
|
||||
let (mut reader, writer) = UnixStream::pair().unwrap();
|
||||
reader.set_nonblocking(true).unwrap();
|
||||
let pending = thread::scope(|scope| {
|
||||
let cancel = scope.spawn(|| cancellation.cancel().unwrap());
|
||||
let pending = cancellation.attach(writer.as_raw_fd());
|
||||
cancel.join().unwrap();
|
||||
pending
|
||||
});
|
||||
if !pending {
|
||||
let mut command = [0];
|
||||
assert_eq!(reader.read(&mut command).unwrap(), 1);
|
||||
assert_eq!(command[0], b'x');
|
||||
}
|
||||
cancellation.detach();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disconnect_after_detach_never_writes_to_the_old_descriptor() {
|
||||
use std::{
|
||||
io::Read,
|
||||
os::{fd::AsRawFd, unix::net::UnixStream},
|
||||
};
|
||||
let cancellation = Cancellation::default();
|
||||
let (mut reader, writer) = UnixStream::pair().unwrap();
|
||||
reader.set_nonblocking(true).unwrap();
|
||||
assert!(!cancellation.attach(writer.as_raw_fd()));
|
||||
cancellation.detach();
|
||||
cancellation.cancel().unwrap();
|
||||
assert_eq!(reader.read(&mut [0]).unwrap_err().kind(), io::ErrorKind::WouldBlock);
|
||||
}
|
||||
}
|
||||
@@ -43,11 +43,16 @@ gpauth --version
|
||||
Install build and runtime dependencies:
|
||||
|
||||
```sh
|
||||
doas pkg_add git rust libiconv gettext-tools autoconf-2.72 automake-1.17 \
|
||||
libtool patch gmake pkgconf libxml gnutls p11-kit nettle gmp \
|
||||
doas pkg_add -u -I
|
||||
doas pkg_add -I git rust libiconv gettext-tools autoconf%2.72 automake%1.17 \
|
||||
libtool gmake libxml gnutls p11-kit gmp lz4 dbus \
|
||||
gnome-keyring polkit webkitgtk41 xdg-utils
|
||||
```
|
||||
|
||||
OpenBSD provides `patch` and `pkg-config` in the base system. GnuTLS installs
|
||||
Nettle as a dependency. The separately built GUI uses a D-Bus StatusNotifier
|
||||
tray backend on OpenBSD and requires a desktop with StatusNotifier support.
|
||||
|
||||
Use the installed Autoconf and Automake versions:
|
||||
|
||||
```sh
|
||||
|
||||
Generated
+3
-3
@@ -63,11 +63,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1766410818,
|
||||
"narHash": "sha256-ruVneSx6wFy5PMw1ow3BE+znl653TJ6+eeNUj4B/9y8=",
|
||||
"lastModified": 1787964612,
|
||||
"narHash": "sha256-0N9nghg3nwzX6b6qc77EzjR9cu/Z+UR66FlfsCqiURs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3a7affa77a5a539afa1c7859e2c31abdb1aeadf3",
|
||||
"rev": "e8be7818e19ada32105a8af937a6a473b38167ca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -20,13 +20,10 @@
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
mkPackageSet =
|
||||
pkgs:
|
||||
let
|
||||
pkgs = (import nixpkgs) {
|
||||
inherit system;
|
||||
overlays = [ (import rust-overlay) ];
|
||||
};
|
||||
inherit (pkgs) lib;
|
||||
|
||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||
@@ -41,39 +38,67 @@
|
||||
rustc = toolchain;
|
||||
};
|
||||
|
||||
src = pkgs.fetchzip {
|
||||
unpackReleaseAsset =
|
||||
{ name, archive }:
|
||||
pkgs.runCommand name { nativeBuildInputs = [ pkgs.libarchive ]; } ''
|
||||
mkdir -p "$out"
|
||||
bsdtar --extract --file ${archive} --directory "$out" --strip-components 1
|
||||
'';
|
||||
|
||||
sourceArchive = pkgs.fetchurl {
|
||||
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect-${version}.tar.gz";
|
||||
hash = "sha256-T4jze6/25YTsfuQdcuDfz3kX/ooDB1T0hnWsEBu4xMQ=";
|
||||
hash = "sha256-VFWbF2BfJ9CtXkjQjkgmBGCZnYgB5ZLctqcqUKuhswg=";
|
||||
};
|
||||
|
||||
src = unpackReleaseAsset {
|
||||
name = "globalprotect-openconnect-${version}-source";
|
||||
archive = sourceArchive;
|
||||
};
|
||||
|
||||
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
||||
|
||||
gpguiHashes = {
|
||||
x86_64 = "sha256-wPLsH/b/ZSo2pA/kU1HUGiQ98k8xSihyxGyf5o6tvyU=";
|
||||
aarch64 = "sha256-WFyPhGD9fLAVYGeMSrMcZhSdfM99uVmWPrH68O+4BfE=";
|
||||
x86_64 = "sha256-uVn3hJkKrjKz3mzRamxFu+0rE7OjLtMlT16d14XPcq4=";
|
||||
aarch64 = "sha256-g4HKQwFAM4YCP+Afew1AhzC1wPrCS8ICw3GeA7KIeFU=";
|
||||
};
|
||||
|
||||
gpgui = pkgs.fetchzip {
|
||||
gpguiArchive = pkgs.fetchurl {
|
||||
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/gpgui_${cpu}.bin.tar.xz";
|
||||
hash = gpguiHashes.${cpu};
|
||||
};
|
||||
|
||||
binaryHashes = {
|
||||
x86_64 = "sha256-spaKxruu15ro5lir14nAfy8MPXNQhaoCXcG4PDZ9lfM=";
|
||||
aarch64 = "sha256-iu/zE4B4gjk1I5PQY0m/59ZoJ/k5focT0CxYYlJi7+A=";
|
||||
gpgui = unpackReleaseAsset {
|
||||
name = "gpgui-${version}-${cpu}";
|
||||
archive = gpguiArchive;
|
||||
};
|
||||
|
||||
binaryPackage = pkgs.fetchzip {
|
||||
binaryHashes = {
|
||||
x86_64 = "sha256-jgHZC00q+2GnO18/aPGONDCz2CeiF/e1DucefSacv2w=";
|
||||
aarch64 = "sha256-FDCZN0bmKWKjPiF9wkRaqMUu0PfSVHDUveJVFts25qg=";
|
||||
};
|
||||
|
||||
binaryArchive = pkgs.fetchurl {
|
||||
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect_${version}_${cpu}.bin.tar.xz";
|
||||
hash = binaryHashes.${cpu};
|
||||
};
|
||||
|
||||
binaryPackage = unpackReleaseAsset {
|
||||
name = "globalprotect-openconnect-${version}-${cpu}-binary";
|
||||
archive = binaryArchive;
|
||||
};
|
||||
|
||||
linuxRuntimeDependencies = with pkgs; [
|
||||
glib-networking
|
||||
libayatana-appindicator
|
||||
xdg-utils
|
||||
];
|
||||
|
||||
rewriteVpncScriptToolPaths = lib.optionalString pkgs.stdenv.isLinux ''
|
||||
substituteInPlace $out/libexec/gpclient/vpnc-script \
|
||||
--replace-fail /usr/bin/resolvectl ${pkgs.systemd}/bin/resolvectl \
|
||||
--replace-fail /usr/bin/busctl ${pkgs.systemd}/bin/busctl
|
||||
'';
|
||||
|
||||
linuxBuildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
@@ -108,6 +133,11 @@
|
||||
--replace-fail /usr/bin/gpservice $out/bin/gpservice \
|
||||
--replace-fail /usr/libexec/gpclient/gp-vpnc-script-installer $out/bin/gp-vpnc-script-installer
|
||||
|
||||
if [ -f $out/libexec/gpclient/gp-hip-script-installer ]; then
|
||||
substituteInPlace $out/share/polkit-1/actions/com.yuezk.gpgui.policy \
|
||||
--replace-fail /usr/libexec/gpclient/gp-hip-script-installer $out/libexec/gpclient/gp-hip-script-installer
|
||||
fi
|
||||
|
||||
if [ -f $out/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down ]; then
|
||||
substituteInPlace $out/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down \
|
||||
--replace-fail /usr/bin/gpclient $out/bin/gpclient
|
||||
@@ -122,6 +152,11 @@
|
||||
--replace-fail /usr/bin/gpservice $out/bin/gpservice \
|
||||
--replace-fail /usr/libexec/gpclient/gp-vpnc-script-installer ${prebuiltFiles}/libexec/gpclient/gp-vpnc-script-installer
|
||||
|
||||
if [ -f ${prebuiltFiles}/libexec/gpclient/gp-hip-script-installer ]; then
|
||||
substituteInPlace $out/share/polkit-1/actions/com.yuezk.gpgui.policy \
|
||||
--replace-fail /usr/libexec/gpclient/gp-hip-script-installer ${prebuiltFiles}/libexec/gpclient/gp-hip-script-installer
|
||||
fi
|
||||
|
||||
if [ -f $out/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down ]; then
|
||||
substituteInPlace $out/lib/NetworkManager/dispatcher.d/pre-down.d/gpclient.down \
|
||||
--replace-fail /usr/bin/gpclient $out/bin/gpclient
|
||||
@@ -200,6 +235,13 @@
|
||||
--replace-fail /usr/bin/gpservice $out/bin/gpservice \
|
||||
--replace-fail /usr/bin/gpgui-helper $out/bin/gpgui-helper \
|
||||
--replace-fail /usr/bin/gpgui $out/bin/gpgui
|
||||
|
||||
if [ -f apps/gpservice/src/hip_source.rs ]; then
|
||||
substituteInPlace crates/common/src/constants.rs \
|
||||
--replace-fail /usr/libexec/gpclient/gp-hip-script-installer $out/libexec/gpclient/gp-hip-script-installer
|
||||
substituteInPlace apps/gpservice/src/hip_source.rs \
|
||||
--replace-fail /usr/libexec/gpclient/gp-hip-runner $out/libexec/gpclient/gp-hip-runner
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -207,6 +249,11 @@
|
||||
cp -r packaging/files/usr/libexec $out/libexec
|
||||
''
|
||||
+ lib.optionalString pkgs.stdenv.isLinux ''
|
||||
if [ -f $out/bin/gp-hip-runner ]; then
|
||||
install -Dm755 $out/bin/gp-hip-runner $out/libexec/gpclient/gp-hip-runner
|
||||
install -Dm755 $out/bin/gp-hip-script-installer $out/libexec/gpclient/gp-hip-script-installer
|
||||
fi
|
||||
|
||||
# Copy the prebuilt gpgui binary to the output bin directory
|
||||
cp ${gpgui}/gpgui $out/bin/gpgui
|
||||
chmod +x $out/bin/gpgui
|
||||
@@ -217,6 +264,7 @@
|
||||
${installNixosPolkitRule}
|
||||
''
|
||||
+ ''
|
||||
${rewriteVpncScriptToolPaths}
|
||||
${rewriteSourceInstallPaths}
|
||||
'';
|
||||
};
|
||||
@@ -249,6 +297,8 @@
|
||||
|
||||
install -Dm755 ${gpgui}/gpgui $out/bin/gpgui
|
||||
|
||||
${rewriteVpncScriptToolPaths}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
@@ -269,19 +319,21 @@
|
||||
--service-type=exec
|
||||
)
|
||||
|
||||
while IFS= read -r env_name; do
|
||||
while IFS= read -r -d "" env_entry; do
|
||||
env_name="''${env_entry%%=*}"
|
||||
case "$env_name" in
|
||||
*[!A-Za-z0-9_]* | [0-9]* | PATH | GP_VPNC_SCRIPT_INSTALLER_BINARY | INVOCATION_ID | JOURNAL_STREAM | LISTEN_* | NOTIFY_SOCKET | SYSTEMD_EXEC_PID)
|
||||
*[!A-Za-z0-9_]* | [0-9]* | PATH | GP_VPNC_SCRIPT_INSTALLER_BINARY | GP_HIP_SCRIPT_INSTALLER_BINARY | INVOCATION_ID | JOURNAL_STREAM | LISTEN_* | NOTIFY_SOCKET | SYSTEMD_EXEC_PID)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
systemd_run_args+=("--setenv=$env_name")
|
||||
done < <(compgen -e)
|
||||
done < <(${pkgs.coreutils}/bin/env --null)
|
||||
|
||||
gui_path="/run/wrappers/bin:''${PATH:-}"
|
||||
systemd_run_args+=(
|
||||
"--setenv=PATH=$gui_path"
|
||||
"--setenv=GP_VPNC_SCRIPT_INSTALLER_BINARY=${prebuiltFiles}/libexec/gpclient/gp-vpnc-script-installer"
|
||||
"--setenv=GP_HIP_SCRIPT_INSTALLER_BINARY=${prebuiltFiles}/libexec/gpclient/gp-hip-script-installer"
|
||||
)
|
||||
|
||||
exec ${pkgs.systemd}/bin/systemd-run \
|
||||
@@ -302,6 +354,7 @@
|
||||
profile = ''
|
||||
export PATH=/run/wrappers/bin:$PATH
|
||||
export GP_VPNC_SCRIPT_INSTALLER_BINARY='${prebuiltFiles}/libexec/gpclient/gp-vpnc-script-installer'
|
||||
export GP_HIP_SCRIPT_INSTALLER_BINARY='${prebuiltFiles}/libexec/gpclient/gp-hip-script-installer'
|
||||
${extraProfile}
|
||||
'';
|
||||
extraBwrapArgs = [
|
||||
@@ -443,6 +496,49 @@
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit fromSource prebuilt;
|
||||
};
|
||||
|
||||
nixosModule =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.globalprotect-openconnect;
|
||||
in
|
||||
{
|
||||
options.programs.globalprotect-openconnect = {
|
||||
enable = lib.mkEnableOption "GlobalProtect-openconnect";
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
# Use the NixOS module's package set so WebKit and graphics
|
||||
# dependencies match the rest of the system.
|
||||
default = (mkPackageSet pkgs).prebuilt;
|
||||
description = "GlobalProtect-openconnect package to install.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
services.ayatana-indicators.enable = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
in
|
||||
(flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = (import nixpkgs) {
|
||||
inherit system;
|
||||
overlays = [ (import rust-overlay) ];
|
||||
};
|
||||
inherit (pkgs) lib;
|
||||
inherit (mkPackageSet pkgs) fromSource prebuilt;
|
||||
in
|
||||
{
|
||||
# For `nix build`
|
||||
packages = {
|
||||
@@ -469,5 +565,8 @@
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
))
|
||||
// {
|
||||
nixosModules.default = nixosModule;
|
||||
};
|
||||
}
|
||||
@@ -3,6 +3,8 @@ install:
|
||||
|
||||
install -Dm755 artifacts/usr/bin/gpclient $(DESTDIR)/usr/bin/gpclient
|
||||
install -Dm755 artifacts/usr/bin/gpservice $(DESTDIR)/usr/bin/gpservice
|
||||
install -Dm755 artifacts/usr/libexec/gpclient/gp-hip-runner $(DESTDIR)/usr/libexec/gpclient/gp-hip-runner
|
||||
install -Dm755 artifacts/usr/libexec/gpclient/gp-hip-script-installer $(DESTDIR)/usr/libexec/gpclient/gp-hip-script-installer
|
||||
install -Dm755 artifacts/usr/bin/gpauth $(DESTDIR)/usr/bin/gpauth
|
||||
install -Dm755 artifacts/usr/bin/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
|
||||
|
||||
@@ -24,6 +26,12 @@ install:
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/256x256/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/gpgui.png
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/256x256@2/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg
|
||||
install -Dm644 artifacts/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
uninstall:
|
||||
@@ -31,6 +39,8 @@ uninstall:
|
||||
|
||||
rm -f $(DESTDIR)/usr/bin/gpclient
|
||||
rm -f $(DESTDIR)/usr/bin/gpservice
|
||||
rm -f $(DESTDIR)/usr/libexec/gpclient/gp-hip-runner
|
||||
rm -f $(DESTDIR)/usr/libexec/gpclient/gp-hip-script-installer
|
||||
rm -f $(DESTDIR)/usr/bin/gpauth
|
||||
rm -f $(DESTDIR)/usr/bin/gpgui-helper
|
||||
rm -f $(DESTDIR)/usr/bin/gpgui
|
||||
@@ -48,6 +58,12 @@ uninstall:
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg
|
||||
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
|
||||
|
||||
@@ -26,4 +26,15 @@
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/local/libexec/gpclient/gp-vpnc-script-installer</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
<action id="com.yuezk.gpgui.manage-root-hip-script">
|
||||
<description>Approve a GP Connect HIP script to run as root</description>
|
||||
<message>Administrator authentication is required to run a HIP script as root</message>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/local/libexec/gpclient/gp-hip-script-installer</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
</policyconfig>
|
||||
@@ -1,7 +1,7 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG ALPINE_VERSION=3.23
|
||||
ARG RUST_VERSION=1.89
|
||||
ARG RUST_VERSION=1.91
|
||||
|
||||
FROM rust:${RUST_VERSION}-alpine AS builder
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Wrapper for gpclient hip
|
||||
LOGFILE="/tmp/gpclient-hipreport.log"
|
||||
|
||||
LINUX_GPCLIENT_BIN="/usr/bin/gpclient"
|
||||
ARM64_HOMEBREW_GPCLIENT_BIN="/opt/homebrew/bin/gpclient"
|
||||
@@ -15,11 +14,8 @@ elif [ -x "$ARM64_HOMEBREW_GPCLIENT_BIN" ]; then
|
||||
elif [ -x "$LOCAL_GPCLIENT_BIN" ]; then
|
||||
GPCLIENT_BIN="$LOCAL_GPCLIENT_BIN"
|
||||
else
|
||||
echo "Error: gpclient binary not found." > "$LOGFILE"
|
||||
echo "Error: gpclient binary not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Redirect the output to a file for debugging then output to stdout
|
||||
HIP_REPORT_OUTPUT=$(exec 2> "$LOGFILE" "$GPCLIENT_BIN" hip -vv "$@")
|
||||
|
||||
echo "$HIP_REPORT_OUTPUT"
|
||||
exec "$GPCLIENT_BIN" hip "$@"
|
||||
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 5 90 90">
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color: #232629; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
.fg { fill: currentColor; }
|
||||
</style>
|
||||
<g class="ColorScheme-Text" fill="currentColor">
|
||||
<path class="fg" fill-rule="evenodd" opacity="1" d="M38.574 73.467L38.574 73.730L38.838 74.170L38.838 74.346L39.980 76.631L40.156 76.807L40.420 77.422L40.596 77.598L40.684 77.861L41.035 78.301L41.123 78.564L41.299 78.740L41.299 78.828L41.475 79.004L41.826 79.619L42.090 79.883L42.090 79.971L42.354 80.234L42.354 80.322L42.617 80.586L42.617 80.674L42.969 81.025L42.969 81.113L43.496 81.641L43.496 81.729L45.254 83.486L45.342 83.486L45.781 83.926L45.869 83.926L46.133 84.189L46.221 84.189L46.484 84.453L46.572 84.453L46.836 84.717L46.924 84.717L47.363 85.068L48.418 85.596L48.594 85.771L49.121 85.859L49.648 85.596L49.824 85.420L50.264 85.244L50.176 84.980L49.473 84.102L49.209 83.574L48.594 82.695L48.418 82.256L48.242 82.080L47.715 81.025L47.715 80.850L47.363 80.234L47.363 80.059L47.188 79.795L47.188 79.619L47.012 79.355L47.012 79.180L46.924 79.092L46.924 78.916L46.836 78.828L46.836 78.652L46.748 78.564L46.748 78.389L46.572 78.037L46.572 77.773L46.396 77.422L46.309 76.807L46.221 76.719L46.221 76.367L46.133 76.279L46.133 75.928L46.045 75.840L46.045 75.488L45.957 75.400L45.957 74.873L45.869 74.785L45.781 73.555L45.693 73.467Z M17.129 73.467L17.129 73.555L17.393 73.818L17.393 73.906L18.799 75.488L18.799 75.576L21.436 78.301L21.523 78.301L22.402 79.180L22.490 79.180L23.018 79.707L23.105 79.707L23.545 80.146L23.633 80.146L23.984 80.498L24.072 80.498L24.336 80.762L24.424 80.762L24.775 81.113L25.127 81.289L25.742 81.816L25.830 81.816L27.588 83.047L27.852 83.135L28.027 83.311L28.291 83.398L28.906 83.838L29.521 84.102L29.697 84.277L32.334 85.596L32.510 85.596L33.125 85.947L33.301 85.947L33.564 86.123L33.740 86.123L34.180 86.387L34.355 86.387L34.883 86.650L35.059 86.650L35.146 86.738L35.850 86.914L36.113 87.090L36.377 87.090L36.465 87.178L36.641 87.178L36.729 87.266L36.904 87.266L36.992 87.354L37.168 87.354L37.520 87.529L37.783 87.529L38.135 87.705L38.398 87.705L38.486 87.793L38.750 87.793L39.102 87.969L39.453 87.969L39.541 88.057L39.805 88.057L39.893 88.145L40.156 88.145L40.244 88.232L40.596 88.232L40.684 88.320L41.035 88.320L41.123 88.408L41.826 88.496L41.562 88.232L41.475 88.232L40.684 87.441L40.596 87.441L38.662 85.420L38.662 85.332L38.223 84.893L38.223 84.805L37.871 84.453L37.871 84.365L36.816 83.047L36.816 82.959L35.938 81.729L35.850 81.465L35.498 81.025L35.059 80.146L34.883 79.971L34.443 79.004L34.268 78.828L33.652 77.598L33.652 77.422L33.125 76.455L33.125 76.279L32.861 75.840L32.861 75.664L32.598 75.225L32.598 75.049L32.422 74.785L32.422 74.609L32.246 74.346L32.246 74.170L31.895 73.467Z M34.092 52.021L34.092 53.428L34.180 53.516L34.180 54.746L34.268 54.834L34.268 55.801L34.355 55.889L34.355 56.680L34.443 56.768L34.443 57.471L34.531 57.559L34.531 58.262L34.619 58.350L34.619 58.877L34.707 58.965L34.795 60.107L34.883 60.195L34.883 60.635L34.971 60.723L34.971 61.162L35.059 61.250L35.059 61.689L35.146 61.777L35.146 62.217L35.234 62.305L35.234 62.656L35.322 62.744L35.322 63.096L35.410 63.184L35.498 63.975L35.586 64.062L35.674 64.766L35.762 64.854L35.762 65.117L35.850 65.205L35.850 65.469L35.938 65.557L35.938 65.820L36.025 65.908L36.025 66.172L36.113 66.260L36.113 66.523L36.201 66.611L36.201 66.875L36.289 66.963L36.289 67.227L36.377 67.402L45.693 67.402L45.693 55.537L45.781 55.449L45.781 55.098L46.045 54.570L46.045 54.395L46.484 53.779L46.484 53.691L47.363 52.812L48.594 52.197L48.857 52.197L48.945 52.109L49.385 52.109L49.473 52.021L49.912 52.021Z M8.867 52.021L8.867 52.285L8.955 52.373L8.955 53.252L9.043 53.340L9.043 53.955L9.131 54.043L9.131 54.658L9.219 54.746L9.219 55.273L9.307 55.361L9.307 55.801L9.395 55.889L9.395 56.240L9.482 56.328L9.482 56.680L9.570 56.768L9.570 57.119L9.658 57.207L9.658 57.559L9.746 57.646L9.746 57.998L9.834 58.086L9.834 58.350L9.922 58.438L9.922 58.701L10.010 58.789L10.098 59.404L10.273 59.756L10.273 60.020L10.449 60.371L10.449 60.635L10.537 60.723L10.537 60.898L10.625 60.986L10.625 61.162L10.713 61.250L10.713 61.426L10.801 61.514L10.801 61.689L10.889 61.777L10.889 61.953L10.977 62.041L11.152 62.744L11.328 63.008L11.416 63.447L11.592 63.711L11.592 63.887L11.768 64.150L11.768 64.326L12.031 64.766L12.031 64.941L12.383 65.557L12.383 65.732L13.262 67.402L30.049 67.402L29.961 66.699L29.873 66.611L29.873 66.348L29.785 66.260L29.785 65.996L29.697 65.908L29.697 65.557L29.609 65.469L29.609 65.205L29.521 65.117L29.521 64.766L29.434 64.678L29.434 64.326L29.346 64.238L29.258 63.447L29.170 63.359L29.170 62.920L29.082 62.832L28.994 61.953L28.906 61.865L28.906 61.338L28.818 61.250L28.818 60.811L28.730 60.723L28.730 60.195L28.643 60.107L28.643 59.580L28.555 59.492L28.467 58.086L28.379 57.998L28.379 57.295L28.291 57.207L28.291 56.416L28.203 56.328L28.203 55.361L28.115 55.273L28.115 54.131L28.027 54.043L28.027 52.461L27.939 52.373L27.939 52.021Z M67.842 30.488L67.842 30.752L67.930 30.840L67.930 31.104L68.018 31.191L68.018 31.455L68.105 31.543L68.105 31.807L68.193 31.895L68.193 32.246L68.281 32.334L68.281 32.598L68.369 32.686L68.369 33.037L68.457 33.125L68.457 33.477L68.545 33.564L68.633 34.355L68.721 34.443L68.7Line truncated
|
||||
<path class="fg" fill-rule="evenodd" opacity="1" d="M70.830 50.352L70.654 50.527L68.193 51.758L68.018 51.758L67.051 52.285L66.875 52.285L66.084 52.725L65.908 52.725L65.469 52.988L65.293 52.988L65.029 53.164L64.854 53.164L64.590 53.340L64.414 53.340L64.150 53.516L63.975 53.516L63.271 53.867L62.832 53.955L62.568 54.131L62.393 54.131L62.305 54.219L62.129 54.219L62.041 54.307L61.865 54.307L61.777 54.395L61.602 54.395L61.514 54.482L61.338 54.482L61.250 54.570L61.074 54.570L60.986 54.658L60.811 54.658L60.723 54.746L60.547 54.746L60.459 54.834L60.283 54.834L60.195 54.922L60.020 54.922L59.668 55.098L59.404 55.098L59.316 55.186L59.141 55.186L58.789 55.361L58.525 55.361L58.174 55.537L57.559 55.625L57.207 55.801L56.943 55.801L56.855 55.889L56.592 55.889L56.504 55.977L56.240 55.977L56.152 56.064L55.801 56.064L55.713 56.152L55.449 56.152L55.361 56.240L55.098 56.240L55.010 56.328L54.219 56.416L54.131 56.504L53.867 56.504L53.779 56.592L53.340 56.592L53.252 56.680L52.900 56.680L52.812 56.768L52.461 56.768L52.373 56.855L51.934 56.855L51.846 56.943L51.406 56.943L51.318 57.031L51.055 57.031L51.055 72.852L51.143 72.939L51.143 73.730L51.230 73.818L51.318 74.873L51.406 74.961L51.406 75.312L51.494 75.400L51.494 75.664L51.582 75.752L51.670 76.367L51.758 76.455L51.758 76.631L51.846 76.719L52.021 77.422L52.197 77.686L52.285 78.125L52.725 78.916L52.725 79.092L52.900 79.268L53.516 80.498L53.691 80.674L53.691 80.762L53.867 80.938L54.219 81.553L54.746 82.168L54.746 82.256L55.713 83.311L55.713 83.398L56.943 84.629L57.031 84.629L57.646 85.244L57.734 85.244L58.613 86.035L58.701 86.035L59.316 86.562L59.404 86.562L60.635 87.441L60.898 87.529L61.514 87.969L61.953 88.145L62.129 88.320L64.590 89.551L64.766 89.551L65.205 89.814L65.381 89.814L65.820 90.078L65.996 90.078L66.260 90.254L66.699 90.342L66.963 90.518L67.139 90.518L67.227 90.605L67.666 90.693L67.930 90.869L68.457 90.957L68.545 91.045L68.721 91.045L68.809 91.133L68.984 91.133L69.336 91.309L71.094 91.484L71.182 91.396L71.885 91.396L71.973 91.309L72.676 91.221L72.764 91.133L72.939 91.133L73.027 91.045L73.203 91.045L73.291 90.957L73.467 90.957L73.555 90.869L73.730 90.869L73.818 90.781L74.521 90.605L74.785 90.430L75.225 90.342L75.488 90.166L75.664 90.166L75.928 89.990L76.104 89.990L76.543 89.727L76.719 89.727L77.158 89.463L77.334 89.463L79.443 88.408L79.619 88.232L80.059 88.057L80.234 87.881L80.938 87.529L81.113 87.354L81.201 87.354L81.377 87.178L81.465 87.178L81.641 87.002L81.729 87.002L81.904 86.826L82.520 86.475L82.783 86.211L82.871 86.211L83.135 85.947L83.223 85.947L83.574 85.596L83.662 85.596L84.102 85.156L84.189 85.156L86.387 82.959L86.387 82.871L86.826 82.432L86.826 82.344L87.441 81.641L87.441 81.553L88.145 80.586L88.232 80.322L88.408 80.146L88.584 79.707L88.760 79.531L89.111 78.828L89.111 78.652L89.375 78.213L89.375 78.037L89.551 77.773L89.551 77.598L89.727 77.334L89.727 77.158L89.814 77.070L89.814 76.895L89.990 76.543L89.990 76.279L90.166 75.928L90.166 75.576L90.254 75.488L90.254 75.225L90.342 75.137L90.430 74.258L90.518 74.170L90.518 73.555L90.605 73.467L90.605 72.236L90.693 72.148L90.693 57.031L90.430 57.031L90.342 56.943L89.902 56.943L89.814 56.855L89.375 56.855L89.287 56.768L88.936 56.768L88.848 56.680L88.496 56.680L88.408 56.592L87.969 56.592L87.881 56.504L87.617 56.504L87.529 56.416L86.738 56.328L86.650 56.240L86.387 56.240L86.299 56.152L85.947 56.152L85.859 56.064L85.596 56.064L85.508 55.977L85.244 55.977L85.156 55.889L84.893 55.889L84.805 55.801L84.189 55.713L83.838 55.537L83.574 55.537L83.223 55.361L82.959 55.361L82.607 55.186L82.344 55.186L82.256 55.098L82.080 55.098L81.992 55.010L81.816 55.010L81.729 54.922L81.553 54.922L81.465 54.834L81.289 54.834L81.201 54.746L81.025 54.746L80.674 54.570L80.410 54.570L80.146 54.395L79.971 54.395L79.883 54.307L79.180 54.131L78.916 53.955L78.740 53.955L78.213 53.691L77.773 53.604L77.510 53.428L77.334 53.428L77.070 53.252L76.895 53.252L76.455 52.988L76.279 52.988L75.840 52.725L75.664 52.725L74.082 51.934L73.906 51.934Z M82.959 65.293L82.959 66.611L82.871 66.699L82.871 66.875L82.607 67.402L82.344 67.666L82.344 67.754L78.652 71.621L78.652 71.709L77.334 73.027L77.334 73.115L76.016 74.434L76.016 74.521L74.697 75.840L74.697 75.928L73.379 77.246L73.379 77.334L72.061 78.652L72.061 78.740L70.742 80.059L70.742 80.146L70.039 80.850L69.248 81.289L68.984 81.289L68.896 81.377L67.842 81.377L67.754 81.289L67.490 81.289L66.787 80.938L58.613 72.852L58.174 71.973L58.174 71.621L58.086 71.533L58.086 71.006L58.174 70.918L58.174 70.566L58.262 70.479L58.262 70.303L58.525 69.775L58.965 69.248L59.053 69.248L59.404 68.896L59.756 68.721L60.195 68.633L60.283 68.545L61.426 68.545L61.514 68.633L61.777 68.633L62.305 68.896L62.568 69.160L62.656 69.160L68.193 74.697L68.281 74.697L69.600 73.379L69.600 73.291L73.467 69.248L73.467 69.160L74.785 67.842L74.785 67.754L76.104 66.436L76.104 66.348L77.422 65.029L77.422 64.941L78.652 63.711L78.740 63.711L78.916 63.535L79.268 63.359L79.443 63.359L79.531 63.271L79.971 63.271L80.059 63.184L80.498 63.184L80.586 63.271L80.938 63.27Line truncated
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 17 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 5 90 90">
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color: #232629; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
.fg { fill: currentColor; }
|
||||
</style>
|
||||
<g class="ColorScheme-Text" fill="currentColor">
|
||||
<path class="fg" fill-rule="evenodd" opacity=".7" d="M38.574 73.467L38.574 73.730L38.838 74.170L38.838 74.346L39.980 76.631L40.156 76.807L40.420 77.422L40.596 77.598L40.684 77.861L41.035 78.301L41.123 78.564L41.299 78.740L41.299 78.828L41.475 79.004L41.826 79.619L42.090 79.883L42.090 79.971L42.354 80.234L42.354 80.322L42.617 80.586L42.617 80.674L42.969 81.025L42.969 81.113L43.496 81.641L43.496 81.729L45.254 83.486L45.342 83.486L45.781 83.926L45.869 83.926L46.133 84.189L46.221 84.189L46.484 84.453L46.572 84.453L46.836 84.717L46.924 84.717L47.363 85.068L48.418 85.596L48.594 85.771L49.121 85.859L49.648 85.596L49.824 85.420L50.264 85.244L50.176 84.980L49.473 84.102L49.209 83.574L48.594 82.695L48.418 82.256L48.242 82.080L47.715 81.025L47.715 80.850L47.363 80.234L47.363 80.059L47.188 79.795L47.188 79.619L47.012 79.355L47.012 79.180L46.924 79.092L46.924 78.916L46.836 78.828L46.836 78.652L46.748 78.564L46.748 78.389L46.572 78.037L46.572 77.773L46.396 77.422L46.309 76.807L46.221 76.719L46.221 76.367L46.133 76.279L46.133 75.928L46.045 75.840L46.045 75.488L45.957 75.400L45.957 74.873L45.869 74.785L45.781 73.555L45.693 73.467Z M17.129 73.467L17.129 73.555L17.393 73.818L17.393 73.906L18.799 75.488L18.799 75.576L21.436 78.301L21.523 78.301L22.402 79.180L22.490 79.180L23.018 79.707L23.105 79.707L23.545 80.146L23.633 80.146L23.984 80.498L24.072 80.498L24.336 80.762L24.424 80.762L24.775 81.113L25.127 81.289L25.742 81.816L25.830 81.816L27.588 83.047L27.852 83.135L28.027 83.311L28.291 83.398L28.906 83.838L29.521 84.102L29.697 84.277L32.334 85.596L32.510 85.596L33.125 85.947L33.301 85.947L33.564 86.123L33.740 86.123L34.180 86.387L34.355 86.387L34.883 86.650L35.059 86.650L35.146 86.738L35.850 86.914L36.113 87.090L36.377 87.090L36.465 87.178L36.641 87.178L36.729 87.266L36.904 87.266L36.992 87.354L37.168 87.354L37.520 87.529L37.783 87.529L38.135 87.705L38.398 87.705L38.486 87.793L38.750 87.793L39.102 87.969L39.453 87.969L39.541 88.057L39.805 88.057L39.893 88.145L40.156 88.145L40.244 88.232L40.596 88.232L40.684 88.320L41.035 88.320L41.123 88.408L41.826 88.496L41.562 88.232L41.475 88.232L40.684 87.441L40.596 87.441L38.662 85.420L38.662 85.332L38.223 84.893L38.223 84.805L37.871 84.453L37.871 84.365L36.816 83.047L36.816 82.959L35.938 81.729L35.850 81.465L35.498 81.025L35.059 80.146L34.883 79.971L34.443 79.004L34.268 78.828L33.652 77.598L33.652 77.422L33.125 76.455L33.125 76.279L32.861 75.840L32.861 75.664L32.598 75.225L32.598 75.049L32.422 74.785L32.422 74.609L32.246 74.346L32.246 74.170L31.895 73.467Z M34.092 52.021L34.092 53.428L34.180 53.516L34.180 54.746L34.268 54.834L34.268 55.801L34.355 55.889L34.355 56.680L34.443 56.768L34.443 57.471L34.531 57.559L34.531 58.262L34.619 58.350L34.619 58.877L34.707 58.965L34.795 60.107L34.883 60.195L34.883 60.635L34.971 60.723L34.971 61.162L35.059 61.250L35.059 61.689L35.146 61.777L35.146 62.217L35.234 62.305L35.234 62.656L35.322 62.744L35.322 63.096L35.410 63.184L35.498 63.975L35.586 64.062L35.674 64.766L35.762 64.854L35.762 65.117L35.850 65.205L35.850 65.469L35.938 65.557L35.938 65.820L36.025 65.908L36.025 66.172L36.113 66.260L36.113 66.523L36.201 66.611L36.201 66.875L36.289 66.963L36.289 67.227L36.377 67.402L45.693 67.402L45.693 55.537L45.781 55.449L45.781 55.098L46.045 54.570L46.045 54.395L46.484 53.779L46.484 53.691L47.363 52.812L48.594 52.197L48.857 52.197L48.945 52.109L49.385 52.109L49.473 52.021L49.912 52.021Z M8.867 52.021L8.867 52.285L8.955 52.373L8.955 53.252L9.043 53.340L9.043 53.955L9.131 54.043L9.131 54.658L9.219 54.746L9.219 55.273L9.307 55.361L9.307 55.801L9.395 55.889L9.395 56.240L9.482 56.328L9.482 56.680L9.570 56.768L9.570 57.119L9.658 57.207L9.658 57.559L9.746 57.646L9.746 57.998L9.834 58.086L9.834 58.350L9.922 58.438L9.922 58.701L10.010 58.789L10.098 59.404L10.273 59.756L10.273 60.020L10.449 60.371L10.449 60.635L10.537 60.723L10.537 60.898L10.625 60.986L10.625 61.162L10.713 61.250L10.713 61.426L10.801 61.514L10.801 61.689L10.889 61.777L10.889 61.953L10.977 62.041L11.152 62.744L11.328 63.008L11.416 63.447L11.592 63.711L11.592 63.887L11.768 64.150L11.768 64.326L12.031 64.766L12.031 64.941L12.383 65.557L12.383 65.732L13.262 67.402L30.049 67.402L29.961 66.699L29.873 66.611L29.873 66.348L29.785 66.260L29.785 65.996L29.697 65.908L29.697 65.557L29.609 65.469L29.609 65.205L29.521 65.117L29.521 64.766L29.434 64.678L29.434 64.326L29.346 64.238L29.258 63.447L29.170 63.359L29.170 62.920L29.082 62.832L28.994 61.953L28.906 61.865L28.906 61.338L28.818 61.250L28.818 60.811L28.730 60.723L28.730 60.195L28.643 60.107L28.643 59.580L28.555 59.492L28.467 58.086L28.379 57.998L28.379 57.295L28.291 57.207L28.291 56.416L28.203 56.328L28.203 55.361L28.115 55.273L28.115 54.131L28.027 54.043L28.027 52.461L27.939 52.373L27.939 52.021Z M67.842 30.488L67.842 30.752L67.930 30.840L67.930 31.104L68.018 31.191L68.018 31.455L68.105 31.543L68.105 31.807L68.193 31.895L68.193 32.246L68.281 32.334L68.281 32.598L68.369 32.686L68.369 33.037L68.457 33.125L68.457 33.477L68.545 33.564L68.633 34.355L68.721 34.443L68.Line truncated
|
||||
<path class="fg" fill-rule="evenodd" opacity=".7" d="M70.830 50.352L70.654 50.527L68.193 51.758L68.018 51.758L67.051 52.285L66.875 52.285L66.084 52.725L65.908 52.725L65.469 52.988L65.293 52.988L65.029 53.164L64.854 53.164L64.590 53.340L64.414 53.340L64.150 53.516L63.975 53.516L63.271 53.867L62.832 53.955L62.568 54.131L62.393 54.131L62.305 54.219L62.129 54.219L62.041 54.307L61.865 54.307L61.777 54.395L61.602 54.395L61.514 54.482L61.338 54.482L61.250 54.570L61.074 54.570L60.986 54.658L60.811 54.658L60.723 54.746L60.547 54.746L60.459 54.834L60.283 54.834L60.195 54.922L60.020 54.922L59.668 55.098L59.404 55.098L59.316 55.186L59.141 55.186L58.789 55.361L58.525 55.361L58.174 55.537L57.559 55.625L57.207 55.801L56.943 55.801L56.855 55.889L56.592 55.889L56.504 55.977L56.240 55.977L56.152 56.064L55.801 56.064L55.713 56.152L55.449 56.152L55.361 56.240L55.098 56.240L55.010 56.328L54.219 56.416L54.131 56.504L53.867 56.504L53.779 56.592L53.340 56.592L53.252 56.680L52.900 56.680L52.812 56.768L52.461 56.768L52.373 56.855L51.934 56.855L51.846 56.943L51.406 56.943L51.318 57.031L51.055 57.031L51.055 72.852L51.143 72.939L51.143 73.730L51.230 73.818L51.318 74.873L51.406 74.961L51.406 75.312L51.494 75.400L51.494 75.664L51.582 75.752L51.670 76.367L51.758 76.455L51.758 76.631L51.846 76.719L52.021 77.422L52.197 77.686L52.285 78.125L52.725 78.916L52.725 79.092L52.900 79.268L53.516 80.498L53.691 80.674L53.691 80.762L53.867 80.938L54.219 81.553L54.746 82.168L54.746 82.256L55.713 83.311L55.713 83.398L56.943 84.629L57.031 84.629L57.646 85.244L57.734 85.244L58.613 86.035L58.701 86.035L59.316 86.562L59.404 86.562L60.635 87.441L60.898 87.529L61.514 87.969L61.953 88.145L62.129 88.320L64.590 89.551L64.766 89.551L65.205 89.814L65.381 89.814L65.820 90.078L65.996 90.078L66.260 90.254L66.699 90.342L66.963 90.518L67.139 90.518L67.227 90.605L67.666 90.693L67.930 90.869L68.457 90.957L68.545 91.045L68.721 91.045L68.809 91.133L68.984 91.133L69.336 91.309L71.094 91.484L71.182 91.396L71.885 91.396L71.973 91.309L72.676 91.221L72.764 91.133L72.939 91.133L73.027 91.045L73.203 91.045L73.291 90.957L73.467 90.957L73.555 90.869L73.730 90.869L73.818 90.781L74.521 90.605L74.785 90.430L75.225 90.342L75.488 90.166L75.664 90.166L75.928 89.990L76.104 89.990L76.543 89.727L76.719 89.727L77.158 89.463L77.334 89.463L79.443 88.408L79.619 88.232L80.059 88.057L80.234 87.881L80.938 87.529L81.113 87.354L81.201 87.354L81.377 87.178L81.465 87.178L81.641 87.002L81.729 87.002L81.904 86.826L82.520 86.475L82.783 86.211L82.871 86.211L83.135 85.947L83.223 85.947L83.574 85.596L83.662 85.596L84.102 85.156L84.189 85.156L86.387 82.959L86.387 82.871L86.826 82.432L86.826 82.344L87.441 81.641L87.441 81.553L88.145 80.586L88.232 80.322L88.408 80.146L88.584 79.707L88.760 79.531L89.111 78.828L89.111 78.652L89.375 78.213L89.375 78.037L89.551 77.773L89.551 77.598L89.727 77.334L89.727 77.158L89.814 77.070L89.814 76.895L89.990 76.543L89.990 76.279L90.166 75.928L90.166 75.576L90.254 75.488L90.254 75.225L90.342 75.137L90.430 74.258L90.518 74.170L90.518 73.555L90.605 73.467L90.605 72.236L90.693 72.148L90.693 57.031L90.430 57.031L90.342 56.943L89.902 56.943L89.814 56.855L89.375 56.855L89.287 56.768L88.936 56.768L88.848 56.680L88.496 56.680L88.408 56.592L87.969 56.592L87.881 56.504L87.617 56.504L87.529 56.416L86.738 56.328L86.650 56.240L86.387 56.240L86.299 56.152L85.947 56.152L85.859 56.064L85.596 56.064L85.508 55.977L85.244 55.977L85.156 55.889L84.893 55.889L84.805 55.801L84.189 55.713L83.838 55.537L83.574 55.537L83.223 55.361L82.959 55.361L82.607 55.186L82.344 55.186L82.256 55.098L82.080 55.098L81.992 55.010L81.816 55.010L81.729 54.922L81.553 54.922L81.465 54.834L81.289 54.834L81.201 54.746L81.025 54.746L80.674 54.570L80.410 54.570L80.146 54.395L79.971 54.395L79.883 54.307L79.180 54.131L78.916 53.955L78.740 53.955L78.213 53.691L77.773 53.604L77.510 53.428L77.334 53.428L77.070 53.252L76.895 53.252L76.455 52.988L76.279 52.988L75.840 52.725L75.664 52.725L74.082 51.934L73.906 51.934Z M79.004 61.250L80.322 62.568L80.322 62.656L80.674 63.008L80.850 63.359L81.113 63.623L81.465 64.326L81.641 64.502L82.080 65.381L82.080 65.557L82.256 65.820L82.256 65.996L82.432 66.260L82.432 66.436L82.607 66.787L82.607 67.051L82.695 67.139L82.695 67.402L82.783 67.490L82.783 67.754L82.871 67.842L82.871 68.193L82.959 68.281L82.959 68.809L83.047 68.896L83.047 69.951L83.135 70.039L83.135 70.742L83.047 70.830L83.047 71.797L82.959 71.885L82.959 72.412L82.871 72.500L82.783 73.291L82.607 73.643L82.607 73.906L82.520 73.994L82.344 74.697L81.289 76.807L81.113 76.982L80.938 77.334L80.674 77.598L80.674 77.686L80.410 77.949L80.410 78.037L79.883 78.564L79.883 78.652L79.180 79.355L79.092 79.355L78.125 80.234L78.037 80.234L77.070 80.938L75.488 81.729L75.312 81.729L74.785 81.992L74.521 81.992L74.170 82.168L73.906 82.168L73.818 82.256L73.203 82.344L73.115 82.432L72.676 82.432L72.588 82.520L71.797 82.520L71.709 82.607L70.039 82.607L69.951 82.520L69.160 82.520L69.072 82.432L68.193 82.344L68.105 82.256L67.842 82.256L67.754 82.168L67.490 82.1Line truncated
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 19 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 5 90 90">
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color: #232629; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
.fg { fill: currentColor; }
|
||||
</style>
|
||||
<g class="ColorScheme-Text" fill="currentColor">
|
||||
<path class="fg" fill-rule="evenodd" opacity=".85" d="M38.574 73.467L38.574 73.730L38.838 74.170L38.838 74.346L39.980 76.631L40.156 76.807L40.420 77.422L40.596 77.598L40.684 77.861L41.035 78.301L41.123 78.564L41.299 78.740L41.299 78.828L41.475 79.004L41.826 79.619L42.090 79.883L42.090 79.971L42.354 80.234L42.354 80.322L42.617 80.586L42.617 80.674L42.969 81.025L42.969 81.113L43.496 81.641L43.496 81.729L45.254 83.486L45.342 83.486L45.781 83.926L45.869 83.926L46.133 84.189L46.221 84.189L46.484 84.453L46.572 84.453L46.836 84.717L46.924 84.717L47.363 85.068L48.418 85.596L48.594 85.771L49.121 85.859L49.648 85.596L49.824 85.420L50.264 85.244L50.176 84.980L49.473 84.102L49.209 83.574L48.594 82.695L48.418 82.256L48.242 82.080L47.715 81.025L47.715 80.850L47.363 80.234L47.363 80.059L47.188 79.795L47.188 79.619L47.012 79.355L47.012 79.180L46.924 79.092L46.924 78.916L46.836 78.828L46.836 78.652L46.748 78.564L46.748 78.389L46.572 78.037L46.572 77.773L46.396 77.422L46.309 76.807L46.221 76.719L46.221 76.367L46.133 76.279L46.133 75.928L46.045 75.840L46.045 75.488L45.957 75.400L45.957 74.873L45.869 74.785L45.781 73.555L45.693 73.467Z M17.129 73.467L17.129 73.555L17.393 73.818L17.393 73.906L18.799 75.488L18.799 75.576L21.436 78.301L21.523 78.301L22.402 79.180L22.490 79.180L23.018 79.707L23.105 79.707L23.545 80.146L23.633 80.146L23.984 80.498L24.072 80.498L24.336 80.762L24.424 80.762L24.775 81.113L25.127 81.289L25.742 81.816L25.830 81.816L27.588 83.047L27.852 83.135L28.027 83.311L28.291 83.398L28.906 83.838L29.521 84.102L29.697 84.277L32.334 85.596L32.510 85.596L33.125 85.947L33.301 85.947L33.564 86.123L33.740 86.123L34.180 86.387L34.355 86.387L34.883 86.650L35.059 86.650L35.146 86.738L35.850 86.914L36.113 87.090L36.377 87.090L36.465 87.178L36.641 87.178L36.729 87.266L36.904 87.266L36.992 87.354L37.168 87.354L37.520 87.529L37.783 87.529L38.135 87.705L38.398 87.705L38.486 87.793L38.750 87.793L39.102 87.969L39.453 87.969L39.541 88.057L39.805 88.057L39.893 88.145L40.156 88.145L40.244 88.232L40.596 88.232L40.684 88.320L41.035 88.320L41.123 88.408L41.826 88.496L41.562 88.232L41.475 88.232L40.684 87.441L40.596 87.441L38.662 85.420L38.662 85.332L38.223 84.893L38.223 84.805L37.871 84.453L37.871 84.365L36.816 83.047L36.816 82.959L35.938 81.729L35.850 81.465L35.498 81.025L35.059 80.146L34.883 79.971L34.443 79.004L34.268 78.828L33.652 77.598L33.652 77.422L33.125 76.455L33.125 76.279L32.861 75.840L32.861 75.664L32.598 75.225L32.598 75.049L32.422 74.785L32.422 74.609L32.246 74.346L32.246 74.170L31.895 73.467Z M34.092 52.021L34.092 53.428L34.180 53.516L34.180 54.746L34.268 54.834L34.268 55.801L34.355 55.889L34.355 56.680L34.443 56.768L34.443 57.471L34.531 57.559L34.531 58.262L34.619 58.350L34.619 58.877L34.707 58.965L34.795 60.107L34.883 60.195L34.883 60.635L34.971 60.723L34.971 61.162L35.059 61.250L35.059 61.689L35.146 61.777L35.146 62.217L35.234 62.305L35.234 62.656L35.322 62.744L35.322 63.096L35.410 63.184L35.498 63.975L35.586 64.062L35.674 64.766L35.762 64.854L35.762 65.117L35.850 65.205L35.850 65.469L35.938 65.557L35.938 65.820L36.025 65.908L36.025 66.172L36.113 66.260L36.113 66.523L36.201 66.611L36.201 66.875L36.289 66.963L36.289 67.227L36.377 67.402L45.693 67.402L45.693 55.537L45.781 55.449L45.781 55.098L46.045 54.570L46.045 54.395L46.484 53.779L46.484 53.691L47.363 52.812L48.594 52.197L48.857 52.197L48.945 52.109L49.385 52.109L49.473 52.021L49.912 52.021Z M8.867 52.021L8.867 52.285L8.955 52.373L8.955 53.252L9.043 53.340L9.043 53.955L9.131 54.043L9.131 54.658L9.219 54.746L9.219 55.273L9.307 55.361L9.307 55.801L9.395 55.889L9.395 56.240L9.482 56.328L9.482 56.680L9.570 56.768L9.570 57.119L9.658 57.207L9.658 57.559L9.746 57.646L9.746 57.998L9.834 58.086L9.834 58.350L9.922 58.438L9.922 58.701L10.010 58.789L10.098 59.404L10.273 59.756L10.273 60.020L10.449 60.371L10.449 60.635L10.537 60.723L10.537 60.898L10.625 60.986L10.625 61.162L10.713 61.250L10.713 61.426L10.801 61.514L10.801 61.689L10.889 61.777L10.889 61.953L10.977 62.041L11.152 62.744L11.328 63.008L11.416 63.447L11.592 63.711L11.592 63.887L11.768 64.150L11.768 64.326L12.031 64.766L12.031 64.941L12.383 65.557L12.383 65.732L13.262 67.402L30.049 67.402L29.961 66.699L29.873 66.611L29.873 66.348L29.785 66.260L29.785 65.996L29.697 65.908L29.697 65.557L29.609 65.469L29.609 65.205L29.521 65.117L29.521 64.766L29.434 64.678L29.434 64.326L29.346 64.238L29.258 63.447L29.170 63.359L29.170 62.920L29.082 62.832L28.994 61.953L28.906 61.865L28.906 61.338L28.818 61.250L28.818 60.811L28.730 60.723L28.730 60.195L28.643 60.107L28.643 59.580L28.555 59.492L28.467 58.086L28.379 57.998L28.379 57.295L28.291 57.207L28.291 56.416L28.203 56.328L28.203 55.361L28.115 55.273L28.115 54.131L28.027 54.043L28.027 52.461L27.939 52.373L27.939 52.021Z M67.842 30.488L67.842 30.752L67.930 30.840L67.930 31.104L68.018 31.191L68.018 31.455L68.105 31.543L68.105 31.807L68.193 31.895L68.193 32.246L68.281 32.334L68.281 32.598L68.369 32.686L68.369 33.037L68.457 33.125L68.457 33.477L68.545 33.564L68.633 34.355L68.721 34.443L68Line truncated
|
||||
<path class="fg" fill-rule="evenodd" opacity=".85" d="M70.830 50.352L70.654 50.527L68.193 51.758L68.018 51.758L67.051 52.285L66.875 52.285L66.084 52.725L65.908 52.725L65.469 52.988L65.293 52.988L65.029 53.164L64.854 53.164L64.590 53.340L64.414 53.340L64.150 53.516L63.975 53.516L63.271 53.867L62.832 53.955L62.568 54.131L62.393 54.131L62.305 54.219L62.129 54.219L62.041 54.307L61.865 54.307L61.777 54.395L61.602 54.395L61.514 54.482L61.338 54.482L61.250 54.570L61.074 54.570L60.986 54.658L60.811 54.658L60.723 54.746L60.547 54.746L60.459 54.834L60.283 54.834L60.195 54.922L60.020 54.922L59.668 55.098L59.404 55.098L59.316 55.186L59.141 55.186L58.789 55.361L58.525 55.361L58.174 55.537L57.559 55.625L57.207 55.801L56.943 55.801L56.855 55.889L56.592 55.889L56.504 55.977L56.240 55.977L56.152 56.064L55.801 56.064L55.713 56.152L55.449 56.152L55.361 56.240L55.098 56.240L55.010 56.328L54.219 56.416L54.131 56.504L53.867 56.504L53.779 56.592L53.340 56.592L53.252 56.680L52.900 56.680L52.812 56.768L52.461 56.768L52.373 56.855L51.934 56.855L51.846 56.943L51.406 56.943L51.318 57.031L51.055 57.031L51.055 72.852L51.143 72.939L51.143 73.730L51.230 73.818L51.318 74.873L51.406 74.961L51.406 75.312L51.494 75.400L51.494 75.664L51.582 75.752L51.670 76.367L51.758 76.455L51.758 76.631L51.846 76.719L52.021 77.422L52.197 77.686L52.285 78.125L52.725 78.916L52.725 79.092L52.900 79.268L53.516 80.498L53.691 80.674L53.691 80.762L53.867 80.938L54.219 81.553L54.746 82.168L54.746 82.256L55.713 83.311L55.713 83.398L56.943 84.629L57.031 84.629L57.646 85.244L57.734 85.244L58.613 86.035L58.701 86.035L59.316 86.562L59.404 86.562L60.635 87.441L60.898 87.529L61.514 87.969L61.953 88.145L62.129 88.320L64.590 89.551L64.766 89.551L65.205 89.814L65.381 89.814L65.820 90.078L65.996 90.078L66.260 90.254L66.699 90.342L66.963 90.518L67.139 90.518L67.227 90.605L67.666 90.693L67.930 90.869L68.457 90.957L68.545 91.045L68.721 91.045L68.809 91.133L68.984 91.133L69.336 91.309L71.094 91.484L71.182 91.396L71.885 91.396L71.973 91.309L72.676 91.221L72.764 91.133L72.939 91.133L73.027 91.045L73.203 91.045L73.291 90.957L73.467 90.957L73.555 90.869L73.730 90.869L73.818 90.781L74.521 90.605L74.785 90.430L75.225 90.342L75.488 90.166L75.664 90.166L75.928 89.990L76.104 89.990L76.543 89.727L76.719 89.727L77.158 89.463L77.334 89.463L79.443 88.408L79.619 88.232L80.059 88.057L80.234 87.881L80.938 87.529L81.113 87.354L81.201 87.354L81.377 87.178L81.465 87.178L81.641 87.002L81.729 87.002L81.904 86.826L82.520 86.475L82.783 86.211L82.871 86.211L83.135 85.947L83.223 85.947L83.574 85.596L83.662 85.596L84.102 85.156L84.189 85.156L86.387 82.959L86.387 82.871L86.826 82.432L86.826 82.344L87.441 81.641L87.441 81.553L88.145 80.586L88.232 80.322L88.408 80.146L88.584 79.707L88.760 79.531L89.111 78.828L89.111 78.652L89.375 78.213L89.375 78.037L89.551 77.773L89.551 77.598L89.727 77.334L89.727 77.158L89.814 77.070L89.814 76.895L89.990 76.543L89.990 76.279L90.166 75.928L90.166 75.576L90.254 75.488L90.254 75.225L90.342 75.137L90.430 74.258L90.518 74.170L90.518 73.555L90.605 73.467L90.605 72.236L90.693 72.148L90.693 57.031L90.430 57.031L90.342 56.943L89.902 56.943L89.814 56.855L89.375 56.855L89.287 56.768L88.936 56.768L88.848 56.680L88.496 56.680L88.408 56.592L87.969 56.592L87.881 56.504L87.617 56.504L87.529 56.416L86.738 56.328L86.650 56.240L86.387 56.240L86.299 56.152L85.947 56.152L85.859 56.064L85.596 56.064L85.508 55.977L85.244 55.977L85.156 55.889L84.893 55.889L84.805 55.801L84.189 55.713L83.838 55.537L83.574 55.537L83.223 55.361L82.959 55.361L82.607 55.186L82.344 55.186L82.256 55.098L82.080 55.098L81.992 55.010L81.816 55.010L81.729 54.922L81.553 54.922L81.465 54.834L81.289 54.834L81.201 54.746L81.025 54.746L80.674 54.570L80.410 54.570L80.146 54.395L79.971 54.395L79.883 54.307L79.180 54.131L78.916 53.955L78.740 53.955L78.213 53.691L77.773 53.604L77.510 53.428L77.334 53.428L77.070 53.252L76.895 53.252L76.455 52.988L76.279 52.988L75.840 52.725L75.664 52.725L74.082 51.934L73.906 51.934Z M70.215 58.086L70.742 58.086L70.830 58.174L71.182 58.174L71.270 58.262L71.709 58.350L72.061 58.613L72.148 58.613L72.764 59.229L73.115 59.844L73.203 60.371L73.291 60.459L73.291 61.250L73.203 61.338L73.203 61.689L72.852 62.393L72.061 63.184L71.533 63.447L71.006 63.535L70.918 63.623L69.951 63.623L69.863 63.711L69.424 63.711L69.336 63.799L69.072 63.799L68.984 63.887L68.281 64.062L67.402 64.502L67.227 64.678L66.875 64.854L66.611 65.117L66.523 65.117L65.645 65.996L65.645 66.084L65.381 66.348L65.381 66.436L65.029 66.875L64.590 67.754L64.590 67.930L64.414 68.193L64.326 68.721L64.238 68.809L64.238 69.160L64.150 69.248L64.150 70.039L64.062 70.127L64.238 71.885L64.326 71.973L64.326 72.236L64.414 72.324L64.502 72.764L64.766 73.203L64.766 73.379L64.941 73.555L65.117 73.994L65.557 74.521L65.557 74.609L66.611 75.664L66.699 75.664L67.227 76.104L68.281 76.631L68.457 76.631L68.721 76.807L69.336 76.895L69.424 76.982L69.775 76.982L69.863 77.070L71.885 77.070L71.973 76.982L72.324 76.982L72.412 76.895L72.676 76.895L72.764 76.807L73.467 76.Line truncated
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 19 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 5 90 90">
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color: #232629; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
.fg { fill: currentColor; }
|
||||
</style>
|
||||
<g class="ColorScheme-Text" fill="currentColor">
|
||||
<path class="fg" fill-rule="evenodd" opacity="1" d="M38.574 73.467L38.574 73.730L38.838 74.170L38.838 74.346L39.980 76.631L40.156 76.807L40.420 77.422L40.596 77.598L40.684 77.861L41.035 78.301L41.123 78.564L41.299 78.740L41.299 78.828L41.475 79.004L41.826 79.619L42.090 79.883L42.090 79.971L42.354 80.234L42.354 80.322L42.617 80.586L42.617 80.674L42.969 81.025L42.969 81.113L43.496 81.641L43.496 81.729L45.254 83.486L45.342 83.486L45.781 83.926L45.869 83.926L46.133 84.189L46.221 84.189L46.484 84.453L46.572 84.453L46.836 84.717L46.924 84.717L47.363 85.068L48.418 85.596L48.594 85.771L49.121 85.859L49.648 85.596L49.824 85.420L50.264 85.244L50.176 84.980L49.473 84.102L49.209 83.574L48.594 82.695L48.418 82.256L48.242 82.080L47.715 81.025L47.715 80.850L47.363 80.234L47.363 80.059L47.188 79.795L47.188 79.619L47.012 79.355L47.012 79.180L46.924 79.092L46.924 78.916L46.836 78.828L46.836 78.652L46.748 78.564L46.748 78.389L46.572 78.037L46.572 77.773L46.396 77.422L46.309 76.807L46.221 76.719L46.221 76.367L46.133 76.279L46.133 75.928L46.045 75.840L46.045 75.488L45.957 75.400L45.957 74.873L45.869 74.785L45.781 73.555L45.693 73.467Z M17.129 73.467L17.129 73.555L17.393 73.818L17.393 73.906L18.799 75.488L18.799 75.576L21.436 78.301L21.523 78.301L22.402 79.180L22.490 79.180L23.018 79.707L23.105 79.707L23.545 80.146L23.633 80.146L23.984 80.498L24.072 80.498L24.336 80.762L24.424 80.762L24.775 81.113L25.127 81.289L25.742 81.816L25.830 81.816L27.588 83.047L27.852 83.135L28.027 83.311L28.291 83.398L28.906 83.838L29.521 84.102L29.697 84.277L32.334 85.596L32.510 85.596L33.125 85.947L33.301 85.947L33.564 86.123L33.740 86.123L34.180 86.387L34.355 86.387L34.883 86.650L35.059 86.650L35.146 86.738L35.850 86.914L36.113 87.090L36.377 87.090L36.465 87.178L36.641 87.178L36.729 87.266L36.904 87.266L36.992 87.354L37.168 87.354L37.520 87.529L37.783 87.529L38.135 87.705L38.398 87.705L38.486 87.793L38.750 87.793L39.102 87.969L39.453 87.969L39.541 88.057L39.805 88.057L39.893 88.145L40.156 88.145L40.244 88.232L40.596 88.232L40.684 88.320L41.035 88.320L41.123 88.408L41.826 88.496L41.562 88.232L41.475 88.232L40.684 87.441L40.596 87.441L38.662 85.420L38.662 85.332L38.223 84.893L38.223 84.805L37.871 84.453L37.871 84.365L36.816 83.047L36.816 82.959L35.938 81.729L35.850 81.465L35.498 81.025L35.059 80.146L34.883 79.971L34.443 79.004L34.268 78.828L33.652 77.598L33.652 77.422L33.125 76.455L33.125 76.279L32.861 75.840L32.861 75.664L32.598 75.225L32.598 75.049L32.422 74.785L32.422 74.609L32.246 74.346L32.246 74.170L31.895 73.467Z M34.092 52.021L34.092 53.428L34.180 53.516L34.180 54.746L34.268 54.834L34.268 55.801L34.355 55.889L34.355 56.680L34.443 56.768L34.443 57.471L34.531 57.559L34.531 58.262L34.619 58.350L34.619 58.877L34.707 58.965L34.795 60.107L34.883 60.195L34.883 60.635L34.971 60.723L34.971 61.162L35.059 61.250L35.059 61.689L35.146 61.777L35.146 62.217L35.234 62.305L35.234 62.656L35.322 62.744L35.322 63.096L35.410 63.184L35.498 63.975L35.586 64.062L35.674 64.766L35.762 64.854L35.762 65.117L35.850 65.205L35.850 65.469L35.938 65.557L35.938 65.820L36.025 65.908L36.025 66.172L36.113 66.260L36.113 66.523L36.201 66.611L36.201 66.875L36.289 66.963L36.289 67.227L36.377 67.402L45.693 67.402L45.693 55.537L45.781 55.449L45.781 55.098L46.045 54.570L46.045 54.395L46.484 53.779L46.484 53.691L47.363 52.812L48.594 52.197L48.857 52.197L48.945 52.109L49.385 52.109L49.473 52.021L49.912 52.021Z M8.867 52.021L8.867 52.285L8.955 52.373L8.955 53.252L9.043 53.340L9.043 53.955L9.131 54.043L9.131 54.658L9.219 54.746L9.219 55.273L9.307 55.361L9.307 55.801L9.395 55.889L9.395 56.240L9.482 56.328L9.482 56.680L9.570 56.768L9.570 57.119L9.658 57.207L9.658 57.559L9.746 57.646L9.746 57.998L9.834 58.086L9.834 58.350L9.922 58.438L9.922 58.701L10.010 58.789L10.098 59.404L10.273 59.756L10.273 60.020L10.449 60.371L10.449 60.635L10.537 60.723L10.537 60.898L10.625 60.986L10.625 61.162L10.713 61.250L10.713 61.426L10.801 61.514L10.801 61.689L10.889 61.777L10.889 61.953L10.977 62.041L11.152 62.744L11.328 63.008L11.416 63.447L11.592 63.711L11.592 63.887L11.768 64.150L11.768 64.326L12.031 64.766L12.031 64.941L12.383 65.557L12.383 65.732L13.262 67.402L30.049 67.402L29.961 66.699L29.873 66.611L29.873 66.348L29.785 66.260L29.785 65.996L29.697 65.908L29.697 65.557L29.609 65.469L29.609 65.205L29.521 65.117L29.521 64.766L29.434 64.678L29.434 64.326L29.346 64.238L29.258 63.447L29.170 63.359L29.170 62.920L29.082 62.832L28.994 61.953L28.906 61.865L28.906 61.338L28.818 61.250L28.818 60.811L28.730 60.723L28.730 60.195L28.643 60.107L28.643 59.580L28.555 59.492L28.467 58.086L28.379 57.998L28.379 57.295L28.291 57.207L28.291 56.416L28.203 56.328L28.203 55.361L28.115 55.273L28.115 54.131L28.027 54.043L28.027 52.461L27.939 52.373L27.939 52.021Z M67.842 30.488L67.842 30.752L67.930 30.840L67.930 31.104L68.018 31.191L68.018 31.455L68.105 31.543L68.105 31.807L68.193 31.895L68.193 32.246L68.281 32.334L68.281 32.598L68.369 32.686L68.369 33.037L68.457 33.125L68.457 33.477L68.545 33.564L68.633 34.355L68.721 34.443L68.7Line truncated
|
||||
<path class="fg" fill-rule="evenodd" opacity="1" d="M70.830 50.352L70.654 50.527L68.193 51.758L68.018 51.758L67.051 52.285L66.875 52.285L66.084 52.725L65.908 52.725L65.469 52.988L65.293 52.988L65.029 53.164L64.854 53.164L64.590 53.340L64.414 53.340L64.150 53.516L63.975 53.516L63.271 53.867L62.832 53.955L62.568 54.131L62.393 54.131L62.305 54.219L62.129 54.219L62.041 54.307L61.865 54.307L61.777 54.395L61.602 54.395L61.514 54.482L61.338 54.482L61.250 54.570L61.074 54.570L60.986 54.658L60.811 54.658L60.723 54.746L60.547 54.746L60.459 54.834L60.283 54.834L60.195 54.922L60.020 54.922L59.668 55.098L59.404 55.098L59.316 55.186L59.141 55.186L58.789 55.361L58.525 55.361L58.174 55.537L57.559 55.625L57.207 55.801L56.943 55.801L56.855 55.889L56.592 55.889L56.504 55.977L56.240 55.977L56.152 56.064L55.801 56.064L55.713 56.152L55.449 56.152L55.361 56.240L55.098 56.240L55.010 56.328L54.219 56.416L54.131 56.504L53.867 56.504L53.779 56.592L53.340 56.592L53.252 56.680L52.900 56.680L52.812 56.768L52.461 56.768L52.373 56.855L51.934 56.855L51.846 56.943L51.406 56.943L51.318 57.031L51.055 57.031L51.055 72.852L51.143 72.939L51.143 73.730L51.230 73.818L51.318 74.873L51.406 74.961L51.406 75.312L51.494 75.400L51.494 75.664L51.582 75.752L51.670 76.367L51.758 76.455L51.758 76.631L51.846 76.719L52.021 77.422L52.197 77.686L52.285 78.125L52.725 78.916L52.725 79.092L52.900 79.268L53.516 80.498L53.691 80.674L53.691 80.762L53.867 80.938L54.219 81.553L54.746 82.168L54.746 82.256L55.713 83.311L55.713 83.398L56.943 84.629L57.031 84.629L57.646 85.244L57.734 85.244L58.613 86.035L58.701 86.035L59.316 86.562L59.404 86.562L60.635 87.441L60.898 87.529L61.514 87.969L61.953 88.145L62.129 88.320L64.590 89.551L64.766 89.551L65.205 89.814L65.381 89.814L65.820 90.078L65.996 90.078L66.260 90.254L66.699 90.342L66.963 90.518L67.139 90.518L67.227 90.605L67.666 90.693L67.930 90.869L68.457 90.957L68.545 91.045L68.721 91.045L68.809 91.133L68.984 91.133L69.336 91.309L71.094 91.484L71.182 91.396L71.885 91.396L71.973 91.309L72.676 91.221L72.764 91.133L72.939 91.133L73.027 91.045L73.203 91.045L73.291 90.957L73.467 90.957L73.555 90.869L73.730 90.869L73.818 90.781L74.521 90.605L74.785 90.430L75.225 90.342L75.488 90.166L75.664 90.166L75.928 89.990L76.104 89.990L76.543 89.727L76.719 89.727L77.158 89.463L77.334 89.463L79.443 88.408L79.619 88.232L80.059 88.057L80.234 87.881L80.938 87.529L81.113 87.354L81.201 87.354L81.377 87.178L81.465 87.178L81.641 87.002L81.729 87.002L81.904 86.826L82.520 86.475L82.783 86.211L82.871 86.211L83.135 85.947L83.223 85.947L83.574 85.596L83.662 85.596L84.102 85.156L84.189 85.156L86.387 82.959L86.387 82.871L86.826 82.432L86.826 82.344L87.441 81.641L87.441 81.553L88.145 80.586L88.232 80.322L88.408 80.146L88.584 79.707L88.760 79.531L89.111 78.828L89.111 78.652L89.375 78.213L89.375 78.037L89.551 77.773L89.551 77.598L89.727 77.334L89.727 77.158L89.814 77.070L89.814 76.895L89.990 76.543L89.990 76.279L90.166 75.928L90.166 75.576L90.254 75.488L90.254 75.225L90.342 75.137L90.430 74.258L90.518 74.170L90.518 73.555L90.605 73.467L90.605 72.236L90.693 72.148L90.693 57.031L90.430 57.031L90.342 56.943L89.902 56.943L89.814 56.855L89.375 56.855L89.287 56.768L88.936 56.768L88.848 56.680L88.496 56.680L88.408 56.592L87.969 56.592L87.881 56.504L87.617 56.504L87.529 56.416L86.738 56.328L86.650 56.240L86.387 56.240L86.299 56.152L85.947 56.152L85.859 56.064L85.596 56.064L85.508 55.977L85.244 55.977L85.156 55.889L84.893 55.889L84.805 55.801L84.189 55.713L83.838 55.537L83.574 55.537L83.223 55.361L82.959 55.361L82.607 55.186L82.344 55.186L82.256 55.098L82.080 55.098L81.992 55.010L81.816 55.010L81.729 54.922L81.553 54.922L81.465 54.834L81.289 54.834L81.201 54.746L81.025 54.746L80.674 54.570L80.410 54.570L80.146 54.395L79.971 54.395L79.883 54.307L79.180 54.131L78.916 53.955L78.740 53.955L78.213 53.691L77.773 53.604L77.510 53.428L77.334 53.428L77.070 53.252L76.895 53.252L76.455 52.988L76.279 52.988L75.840 52.725L75.664 52.725L74.082 51.934L73.906 51.934Z M78.213 60.547L78.564 60.898L78.652 60.898L80.322 62.568L80.322 62.656L80.674 63.008L80.850 63.359L81.113 63.623L81.465 64.326L81.641 64.502L82.080 65.381L82.080 65.557L82.256 65.820L82.256 65.996L82.432 66.260L82.432 66.436L82.607 66.787L82.607 67.051L82.695 67.139L82.695 67.402L82.783 67.490L82.783 67.754L82.871 67.842L82.871 68.193L82.959 68.281L82.959 68.809L83.047 68.896L83.047 69.951L83.135 70.039L83.047 70.127L83.047 70.654L82.959 70.742L82.871 71.182L82.607 71.533L82.607 71.621L81.904 72.324L81.816 72.324L81.465 72.588L81.289 72.588L80.938 72.764L79.795 72.764L79.707 72.676L79.443 72.676L78.916 72.412L78.652 72.148L78.564 72.148L78.213 71.797L78.213 71.709L77.773 71.094L77.686 70.566L77.598 70.479L77.598 69.512L77.510 69.424L77.510 68.984L77.422 68.896L77.422 68.633L77.334 68.545L77.158 67.842L76.631 66.787L76.455 66.611L76.279 66.260L75.576 65.469L75.488 65.469L74.961 64.941L74.873 64.941L74.434 64.590L74.170 64.502L73.994 64.326L73.643 64.238L72.939 63.887L72.676 63.887L72.588 63.799L72.324 63.799L72.236 63.71Line truncated
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 19 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 5 90 90">
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color: #232629; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
.fg { fill: currentColor; }
|
||||
</style>
|
||||
<g class="ColorScheme-Text" fill="currentColor">
|
||||
<path class="fg" fill-rule="evenodd" opacity=".85" d="M38.574 73.467L38.574 73.730L38.838 74.170L38.838 74.346L39.980 76.631L40.156 76.807L40.420 77.422L40.596 77.598L40.684 77.861L41.035 78.301L41.123 78.564L41.299 78.740L41.299 78.828L41.475 79.004L41.826 79.619L42.090 79.883L42.090 79.971L42.354 80.234L42.354 80.322L42.617 80.586L42.617 80.674L42.969 81.025L42.969 81.113L43.496 81.641L43.496 81.729L45.254 83.486L45.342 83.486L45.781 83.926L45.869 83.926L46.133 84.189L46.221 84.189L46.484 84.453L46.572 84.453L46.836 84.717L46.924 84.717L47.363 85.068L48.418 85.596L48.594 85.771L49.121 85.859L49.648 85.596L49.824 85.420L50.264 85.244L50.176 84.980L49.473 84.102L49.209 83.574L48.594 82.695L48.418 82.256L48.242 82.080L47.715 81.025L47.715 80.850L47.363 80.234L47.363 80.059L47.188 79.795L47.188 79.619L47.012 79.355L47.012 79.180L46.924 79.092L46.924 78.916L46.836 78.828L46.836 78.652L46.748 78.564L46.748 78.389L46.572 78.037L46.572 77.773L46.396 77.422L46.309 76.807L46.221 76.719L46.221 76.367L46.133 76.279L46.133 75.928L46.045 75.840L46.045 75.488L45.957 75.400L45.957 74.873L45.869 74.785L45.781 73.555L45.693 73.467Z M17.129 73.467L17.129 73.555L17.393 73.818L17.393 73.906L18.799 75.488L18.799 75.576L21.436 78.301L21.523 78.301L22.402 79.180L22.490 79.180L23.018 79.707L23.105 79.707L23.545 80.146L23.633 80.146L23.984 80.498L24.072 80.498L24.336 80.762L24.424 80.762L24.775 81.113L25.127 81.289L25.742 81.816L25.830 81.816L27.588 83.047L27.852 83.135L28.027 83.311L28.291 83.398L28.906 83.838L29.521 84.102L29.697 84.277L32.334 85.596L32.510 85.596L33.125 85.947L33.301 85.947L33.564 86.123L33.740 86.123L34.180 86.387L34.355 86.387L34.883 86.650L35.059 86.650L35.146 86.738L35.850 86.914L36.113 87.090L36.377 87.090L36.465 87.178L36.641 87.178L36.729 87.266L36.904 87.266L36.992 87.354L37.168 87.354L37.520 87.529L37.783 87.529L38.135 87.705L38.398 87.705L38.486 87.793L38.750 87.793L39.102 87.969L39.453 87.969L39.541 88.057L39.805 88.057L39.893 88.145L40.156 88.145L40.244 88.232L40.596 88.232L40.684 88.320L41.035 88.320L41.123 88.408L41.826 88.496L41.562 88.232L41.475 88.232L40.684 87.441L40.596 87.441L38.662 85.420L38.662 85.332L38.223 84.893L38.223 84.805L37.871 84.453L37.871 84.365L36.816 83.047L36.816 82.959L35.938 81.729L35.850 81.465L35.498 81.025L35.059 80.146L34.883 79.971L34.443 79.004L34.268 78.828L33.652 77.598L33.652 77.422L33.125 76.455L33.125 76.279L32.861 75.840L32.861 75.664L32.598 75.225L32.598 75.049L32.422 74.785L32.422 74.609L32.246 74.346L32.246 74.170L31.895 73.467Z M34.092 52.021L34.092 53.428L34.180 53.516L34.180 54.746L34.268 54.834L34.268 55.801L34.355 55.889L34.355 56.680L34.443 56.768L34.443 57.471L34.531 57.559L34.531 58.262L34.619 58.350L34.619 58.877L34.707 58.965L34.795 60.107L34.883 60.195L34.883 60.635L34.971 60.723L34.971 61.162L35.059 61.250L35.059 61.689L35.146 61.777L35.146 62.217L35.234 62.305L35.234 62.656L35.322 62.744L35.322 63.096L35.410 63.184L35.498 63.975L35.586 64.062L35.674 64.766L35.762 64.854L35.762 65.117L35.850 65.205L35.850 65.469L35.938 65.557L35.938 65.820L36.025 65.908L36.025 66.172L36.113 66.260L36.113 66.523L36.201 66.611L36.201 66.875L36.289 66.963L36.289 67.227L36.377 67.402L45.693 67.402L45.693 55.537L45.781 55.449L45.781 55.098L46.045 54.570L46.045 54.395L46.484 53.779L46.484 53.691L47.363 52.812L48.594 52.197L48.857 52.197L48.945 52.109L49.385 52.109L49.473 52.021L49.912 52.021Z M8.867 52.021L8.867 52.285L8.955 52.373L8.955 53.252L9.043 53.340L9.043 53.955L9.131 54.043L9.131 54.658L9.219 54.746L9.219 55.273L9.307 55.361L9.307 55.801L9.395 55.889L9.395 56.240L9.482 56.328L9.482 56.680L9.570 56.768L9.570 57.119L9.658 57.207L9.658 57.559L9.746 57.646L9.746 57.998L9.834 58.086L9.834 58.350L9.922 58.438L9.922 58.701L10.010 58.789L10.098 59.404L10.273 59.756L10.273 60.020L10.449 60.371L10.449 60.635L10.537 60.723L10.537 60.898L10.625 60.986L10.625 61.162L10.713 61.250L10.713 61.426L10.801 61.514L10.801 61.689L10.889 61.777L10.889 61.953L10.977 62.041L11.152 62.744L11.328 63.008L11.416 63.447L11.592 63.711L11.592 63.887L11.768 64.150L11.768 64.326L12.031 64.766L12.031 64.941L12.383 65.557L12.383 65.732L13.262 67.402L30.049 67.402L29.961 66.699L29.873 66.611L29.873 66.348L29.785 66.260L29.785 65.996L29.697 65.908L29.697 65.557L29.609 65.469L29.609 65.205L29.521 65.117L29.521 64.766L29.434 64.678L29.434 64.326L29.346 64.238L29.258 63.447L29.170 63.359L29.170 62.920L29.082 62.832L28.994 61.953L28.906 61.865L28.906 61.338L28.818 61.250L28.818 60.811L28.730 60.723L28.730 60.195L28.643 60.107L28.643 59.580L28.555 59.492L28.467 58.086L28.379 57.998L28.379 57.295L28.291 57.207L28.291 56.416L28.203 56.328L28.203 55.361L28.115 55.273L28.115 54.131L28.027 54.043L28.027 52.461L27.939 52.373L27.939 52.021Z M67.842 30.488L67.842 30.752L67.930 30.840L67.930 31.104L68.018 31.191L68.018 31.455L68.105 31.543L68.105 31.807L68.193 31.895L68.193 32.246L68.281 32.334L68.281 32.598L68.369 32.686L68.369 33.037L68.457 33.125L68.457 33.477L68.545 33.564L68.633 34.355L68.721 34.443L68Line truncated
|
||||
<path class="fg" fill-rule="evenodd" opacity=".85" d="M70.830 50.352L70.654 50.527L68.193 51.758L68.018 51.758L67.051 52.285L66.875 52.285L66.084 52.725L65.908 52.725L65.469 52.988L65.293 52.988L65.029 53.164L64.854 53.164L64.590 53.340L64.414 53.340L64.150 53.516L63.975 53.516L63.271 53.867L62.832 53.955L62.568 54.131L62.393 54.131L62.305 54.219L62.129 54.219L62.041 54.307L61.865 54.307L61.777 54.395L61.602 54.395L61.514 54.482L61.338 54.482L61.250 54.570L61.074 54.570L60.986 54.658L60.811 54.658L60.723 54.746L60.547 54.746L60.459 54.834L60.283 54.834L60.195 54.922L60.020 54.922L59.668 55.098L59.404 55.098L59.316 55.186L59.141 55.186L58.789 55.361L58.525 55.361L58.174 55.537L57.559 55.625L57.207 55.801L56.943 55.801L56.855 55.889L56.592 55.889L56.504 55.977L56.240 55.977L56.152 56.064L55.801 56.064L55.713 56.152L55.449 56.152L55.361 56.240L55.098 56.240L55.010 56.328L54.219 56.416L54.131 56.504L53.867 56.504L53.779 56.592L53.340 56.592L53.252 56.680L52.900 56.680L52.812 56.768L52.461 56.768L52.373 56.855L51.934 56.855L51.846 56.943L51.406 56.943L51.318 57.031L51.055 57.031L51.055 72.852L51.143 72.939L51.143 73.730L51.230 73.818L51.318 74.873L51.406 74.961L51.406 75.312L51.494 75.400L51.494 75.664L51.582 75.752L51.670 76.367L51.758 76.455L51.758 76.631L51.846 76.719L52.021 77.422L52.197 77.686L52.285 78.125L52.725 78.916L52.725 79.092L52.900 79.268L53.516 80.498L53.691 80.674L53.691 80.762L53.867 80.938L54.219 81.553L54.746 82.168L54.746 82.256L55.713 83.311L55.713 83.398L56.943 84.629L57.031 84.629L57.646 85.244L57.734 85.244L58.613 86.035L58.701 86.035L59.316 86.562L59.404 86.562L60.635 87.441L60.898 87.529L61.514 87.969L61.953 88.145L62.129 88.320L64.590 89.551L64.766 89.551L65.205 89.814L65.381 89.814L65.820 90.078L65.996 90.078L66.260 90.254L66.699 90.342L66.963 90.518L67.139 90.518L67.227 90.605L67.666 90.693L67.930 90.869L68.457 90.957L68.545 91.045L68.721 91.045L68.809 91.133L68.984 91.133L69.336 91.309L71.094 91.484L71.182 91.396L71.885 91.396L71.973 91.309L72.676 91.221L72.764 91.133L72.939 91.133L73.027 91.045L73.203 91.045L73.291 90.957L73.467 90.957L73.555 90.869L73.730 90.869L73.818 90.781L74.521 90.605L74.785 90.430L75.225 90.342L75.488 90.166L75.664 90.166L75.928 89.990L76.104 89.990L76.543 89.727L76.719 89.727L77.158 89.463L77.334 89.463L79.443 88.408L79.619 88.232L80.059 88.057L80.234 87.881L80.938 87.529L81.113 87.354L81.201 87.354L81.377 87.178L81.465 87.178L81.641 87.002L81.729 87.002L81.904 86.826L82.520 86.475L82.783 86.211L82.871 86.211L83.135 85.947L83.223 85.947L83.574 85.596L83.662 85.596L84.102 85.156L84.189 85.156L86.387 82.959L86.387 82.871L86.826 82.432L86.826 82.344L87.441 81.641L87.441 81.553L88.145 80.586L88.232 80.322L88.408 80.146L88.584 79.707L88.760 79.531L89.111 78.828L89.111 78.652L89.375 78.213L89.375 78.037L89.551 77.773L89.551 77.598L89.727 77.334L89.727 77.158L89.814 77.070L89.814 76.895L89.990 76.543L89.990 76.279L90.166 75.928L90.166 75.576L90.254 75.488L90.254 75.225L90.342 75.137L90.430 74.258L90.518 74.170L90.518 73.555L90.605 73.467L90.605 72.236L90.693 72.148L90.693 57.031L90.430 57.031L90.342 56.943L89.902 56.943L89.814 56.855L89.375 56.855L89.287 56.768L88.936 56.768L88.848 56.680L88.496 56.680L88.408 56.592L87.969 56.592L87.881 56.504L87.617 56.504L87.529 56.416L86.738 56.328L86.650 56.240L86.387 56.240L86.299 56.152L85.947 56.152L85.859 56.064L85.596 56.064L85.508 55.977L85.244 55.977L85.156 55.889L84.893 55.889L84.805 55.801L84.189 55.713L83.838 55.537L83.574 55.537L83.223 55.361L82.959 55.361L82.607 55.186L82.344 55.186L82.256 55.098L82.080 55.098L81.992 55.010L81.816 55.010L81.729 54.922L81.553 54.922L81.465 54.834L81.289 54.834L81.201 54.746L81.025 54.746L80.674 54.570L80.410 54.570L80.146 54.395L79.971 54.395L79.883 54.307L79.180 54.131L78.916 53.955L78.740 53.955L78.213 53.691L77.773 53.604L77.510 53.428L77.334 53.428L77.070 53.252L76.895 53.252L76.455 52.988L76.279 52.988L75.840 52.725L75.664 52.725L74.082 51.934L73.906 51.934Z M70.215 58.086L71.445 58.086L71.533 58.174L72.412 58.174L72.500 58.262L73.467 58.350L73.555 58.438L73.818 58.438L74.170 58.613L74.434 58.613L74.521 58.701L75.225 58.877L75.488 59.053L75.664 59.053L76.895 59.668L77.070 59.844L77.334 59.932L77.510 60.107L77.861 60.283L78.564 60.898L78.652 60.898L80.322 62.568L80.322 62.656L80.674 63.008L80.850 63.359L81.113 63.623L81.465 64.326L81.641 64.502L82.080 65.381L82.080 65.557L82.256 65.820L82.256 65.996L82.432 66.260L82.432 66.436L82.607 66.787L82.607 67.051L82.695 67.139L82.695 67.402L82.783 67.490L82.783 67.754L82.871 67.842L82.871 68.193L82.959 68.281L82.959 68.809L83.047 68.896L83.047 69.951L83.135 70.039L83.135 70.742L83.047 70.830L83.047 71.797L82.959 71.885L82.959 72.412L82.871 72.500L82.783 73.291L82.607 73.643L82.607 73.906L82.520 73.994L82.344 74.697L81.289 76.807L81.113 76.982L80.938 77.334L80.674 77.598L80.674 77.686L80.410 77.949L80.410 78.037L79.883 78.564L79.883 78.652L79.180 79.355L79.092 79.355L78.125 80.234L78.037 80.234L77.070 80.938L75.488 81.729L75.312 81.Line truncated
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 19 KiB |
+12
@@ -0,0 +1,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 5 90 90">
|
||||
<style id="current-color-scheme" type="text/css">
|
||||
.ColorScheme-Text { color: #232629; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
.fg { fill: currentColor; }
|
||||
</style>
|
||||
<g class="ColorScheme-Text" fill="currentColor">
|
||||
<path class="fg" fill-rule="evenodd" opacity=".58" d="M38.574 73.467L38.574 73.730L38.838 74.170L38.838 74.346L39.980 76.631L40.156 76.807L40.684 77.861L41.035 78.301L41.123 78.564L41.299 78.740L41.299 78.828L41.475 79.004L41.826 79.619L42.090 79.883L42.090 79.971L42.354 80.234L42.354 80.322L42.617 80.586L42.617 80.674L42.969 81.025L42.969 81.113L43.496 81.641L43.496 81.729L45.254 83.486L45.342 83.486L45.781 83.926L45.869 83.926L46.133 84.189L46.221 84.189L46.484 84.453L46.572 84.453L46.836 84.717L46.924 84.717L47.363 85.068L48.418 85.596L48.594 85.771L49.121 85.859L49.648 85.596L49.824 85.420L50.264 85.244L50.176 84.980L49.473 84.102L49.209 83.574L48.594 82.695L48.418 82.256L48.242 82.080L47.715 81.025L47.715 80.850L47.363 80.234L47.363 80.059L47.188 79.795L47.188 79.619L47.012 79.355L47.012 79.180L46.924 79.092L46.924 78.916L46.836 78.828L46.836 78.652L46.748 78.564L46.748 78.389L46.572 78.037L46.572 77.773L46.396 77.422L46.309 76.807L46.221 76.719L46.221 76.367L46.133 76.279L46.133 75.928L46.045 75.840L46.045 75.488L45.957 75.400L45.957 74.873L45.869 74.785L45.781 73.555L45.693 73.467Z M17.129 73.467L17.129 73.555L17.480 73.906L17.480 73.994L17.832 74.346L17.832 74.434L18.271 74.873L18.271 74.961L18.799 75.488L18.799 75.576L21.436 78.301L21.523 78.301L22.402 79.180L22.490 79.180L23.018 79.707L23.105 79.707L23.545 80.146L23.633 80.146L23.984 80.498L24.072 80.498L24.336 80.762L24.424 80.762L24.775 81.113L25.127 81.289L25.742 81.816L25.830 81.816L27.588 83.047L27.852 83.135L28.027 83.311L28.291 83.398L28.906 83.838L29.521 84.102L29.697 84.277L32.334 85.596L32.510 85.596L33.125 85.947L33.301 85.947L33.564 86.123L33.740 86.123L34.180 86.387L34.355 86.387L34.883 86.650L35.059 86.650L35.146 86.738L35.850 86.914L36.113 87.090L36.377 87.090L36.465 87.178L36.641 87.178L36.729 87.266L36.904 87.266L36.992 87.354L37.168 87.354L37.520 87.529L37.783 87.529L38.135 87.705L38.398 87.705L38.486 87.793L38.750 87.793L39.102 87.969L39.453 87.969L39.541 88.057L39.805 88.057L39.893 88.145L40.156 88.145L40.244 88.232L40.596 88.232L40.684 88.320L41.035 88.320L41.123 88.408L41.826 88.496L41.562 88.232L41.475 88.232L40.684 87.441L40.596 87.441L38.662 85.420L38.662 85.332L38.223 84.893L38.223 84.805L37.871 84.453L37.871 84.365L36.816 83.047L36.816 82.959L35.938 81.729L35.850 81.465L35.498 81.025L35.059 80.146L34.883 79.971L34.443 79.004L34.268 78.828L33.652 77.598L33.652 77.422L33.125 76.455L33.125 76.279L32.861 75.840L32.861 75.664L32.598 75.225L32.598 75.049L32.422 74.785L32.422 74.609L32.246 74.346L32.246 74.170L31.895 73.467Z M34.092 52.021L34.092 53.428L34.180 53.516L34.180 54.746L34.268 54.834L34.268 55.801L34.355 55.889L34.355 56.680L34.443 56.768L34.443 57.471L34.531 57.559L34.531 58.174L34.619 58.262L34.619 58.877L34.707 58.965L34.795 60.107L34.883 60.195L34.883 60.635L34.971 60.723L34.971 61.162L35.059 61.250L35.059 61.689L35.146 61.777L35.146 62.217L35.234 62.305L35.234 62.656L35.322 62.744L35.322 63.096L35.410 63.184L35.498 63.975L35.586 64.062L35.674 64.766L35.762 64.854L35.762 65.117L35.850 65.205L35.850 65.469L35.938 65.557L35.938 65.820L36.025 65.908L36.025 66.172L36.113 66.260L36.113 66.523L36.201 66.611L36.201 66.875L36.289 66.963L36.377 67.402L45.693 67.402L45.693 55.537L45.781 55.449L45.781 55.098L46.045 54.570L46.045 54.395L46.484 53.779L46.484 53.691L47.363 52.812L48.594 52.197L48.857 52.197L48.945 52.109L49.385 52.109L49.473 52.021L49.912 52.021Z M8.867 52.021L8.867 52.285L8.955 52.373L8.955 53.252L9.043 53.340L9.043 53.955L9.131 54.043L9.131 54.658L9.219 54.746L9.219 55.186L9.307 55.273L9.307 55.801L9.395 55.889L9.395 56.240L9.482 56.328L9.482 56.680L9.570 56.768L9.570 57.119L9.658 57.207L9.658 57.559L9.746 57.646L9.746 57.998L9.834 58.086L9.834 58.350L9.922 58.438L9.922 58.701L10.010 58.789L10.098 59.404L10.273 59.756L10.273 60.020L10.449 60.371L10.449 60.635L10.537 60.723L10.537 60.898L10.625 60.986L10.625 61.162L10.713 61.250L10.713 61.426L10.801 61.514L10.801 61.689L10.889 61.777L10.889 61.953L10.977 62.041L11.152 62.744L11.328 63.008L11.416 63.447L11.592 63.711L11.592 63.887L11.768 64.150L11.768 64.326L12.031 64.766L12.031 64.941L12.383 65.557L12.383 65.732L13.262 67.402L30.049 67.402L29.961 66.699L29.873 66.611L29.873 66.348L29.785 66.260L29.785 65.996L29.697 65.908L29.697 65.557L29.609 65.469L29.609 65.205L29.521 65.117L29.521 64.766L29.434 64.678L29.434 64.326L29.346 64.238L29.258 63.447L29.170 63.359L29.170 62.920L29.082 62.832L28.994 61.953L28.906 61.865L28.906 61.338L28.818 61.250L28.818 60.811L28.730 60.723L28.730 60.195L28.643 60.107L28.643 59.580L28.555 59.492L28.467 58.086L28.379 57.998L28.379 57.295L28.291 57.207L28.291 56.416L28.203 56.328L28.203 55.361L28.115 55.273L28.115 54.131L28.027 54.043L28.027 52.461L27.939 52.373L27.939 52.021Z M67.842 30.488L67.842 30.752L67.930 30.840L67.930 31.104L68.018 31.191L68.018 31.455L68.105 31.543L68.105 31.807L68.193 31.895L68.193 32.246L68.281 32.334L68.281 32.598L68.369 32.686L68.369 33.037L68.457 33.125L68.457 33.477L68.545 33.564L68.633 34.355L68Line truncated
|
||||
<path class="fg" fill-rule="evenodd" opacity=".72" d="M70.742 50.439L66.875 52.373L66.699 52.373L65.469 52.988L65.293 52.988L65.029 53.164L64.854 53.164L64.590 53.340L64.414 53.340L64.150 53.516L63.975 53.516L63.271 53.867L62.832 53.955L62.568 54.131L62.393 54.131L62.305 54.219L62.129 54.219L62.041 54.307L61.865 54.307L61.777 54.395L61.602 54.395L61.514 54.482L61.338 54.482L61.250 54.570L61.074 54.570L60.986 54.658L60.811 54.658L60.723 54.746L60.547 54.746L60.459 54.834L60.283 54.834L60.195 54.922L60.020 54.922L59.932 55.010L59.756 55.010L59.404 55.186L59.141 55.186L59.053 55.273L58.525 55.361L58.174 55.537L57.559 55.625L57.207 55.801L56.943 55.801L56.855 55.889L56.592 55.889L56.504 55.977L56.240 55.977L56.152 56.064L55.889 56.064L55.801 56.152L55.449 56.152L55.361 56.240L55.098 56.240L55.010 56.328L54.658 56.328L54.570 56.416L54.307 56.416L54.219 56.504L53.867 56.504L53.779 56.592L53.428 56.592L53.340 56.680L52.900 56.680L52.812 56.768L52.461 56.768L52.373 56.855L51.934 56.855L51.846 56.943L51.406 56.943L51.318 57.031L51.055 57.031L51.055 72.852L51.143 72.939L51.143 73.730L51.230 73.818L51.230 74.346L51.318 74.434L51.406 75.312L51.494 75.400L51.494 75.664L51.582 75.752L51.670 76.367L51.758 76.455L51.758 76.631L51.846 76.719L52.021 77.422L52.197 77.686L52.285 78.125L53.252 80.059L53.428 80.234L53.516 80.498L53.691 80.674L53.691 80.762L53.867 80.938L54.219 81.553L54.482 81.816L54.482 81.904L54.746 82.168L54.746 82.256L55.098 82.607L55.098 82.695L55.713 83.311L55.713 83.398L56.855 84.541L56.943 84.541L57.646 85.244L57.734 85.244L58.613 86.035L58.965 86.211L59.316 86.562L59.404 86.562L60.635 87.441L60.898 87.529L61.514 87.969L61.953 88.145L62.129 88.320L64.590 89.551L64.766 89.551L65.205 89.814L65.381 89.814L65.820 90.078L65.996 90.078L66.260 90.254L66.699 90.342L66.963 90.518L67.139 90.518L67.227 90.605L67.666 90.693L67.930 90.869L68.193 90.869L68.281 90.957L68.457 90.957L68.545 91.045L68.721 91.045L68.809 91.133L68.984 91.133L69.336 91.309L71.094 91.484L71.182 91.396L71.885 91.396L71.973 91.309L72.676 91.221L72.764 91.133L72.939 91.133L73.027 91.045L73.203 91.045L73.291 90.957L73.467 90.957L73.555 90.869L73.730 90.869L73.818 90.781L74.521 90.605L74.785 90.430L75.225 90.342L75.488 90.166L75.664 90.166L75.928 89.990L76.104 89.990L76.543 89.727L76.719 89.727L77.334 89.375L77.510 89.375L79.443 88.408L79.619 88.232L80.059 88.057L80.234 87.881L80.938 87.529L81.113 87.354L81.201 87.354L81.377 87.178L81.465 87.178L81.641 87.002L82.256 86.650L82.520 86.387L82.871 86.211L83.574 85.596L83.662 85.596L84.189 85.068L84.277 85.068L86.387 82.959L86.387 82.871L86.826 82.432L86.826 82.344L87.441 81.641L87.441 81.553L88.145 80.586L88.232 80.322L88.408 80.146L88.584 79.707L88.760 79.531L89.111 78.828L89.111 78.652L89.375 78.213L89.375 78.037L89.551 77.773L89.551 77.598L89.727 77.334L89.727 77.158L89.814 77.070L89.814 76.895L89.990 76.543L89.990 76.279L90.166 75.928L90.166 75.576L90.254 75.488L90.254 75.225L90.342 75.137L90.430 74.258L90.518 74.170L90.518 73.555L90.605 73.467L90.605 72.148L90.693 72.061L90.693 57.031L90.430 57.031L90.342 56.943L89.902 56.943L89.814 56.855L89.375 56.855L89.287 56.768L88.936 56.768L88.848 56.680L88.408 56.680L88.320 56.592L87.529 56.504L87.441 56.416L86.738 56.328L86.650 56.240L86.387 56.240L86.299 56.152L85.947 56.152L85.859 56.064L85.596 56.064L85.508 55.977L85.244 55.977L85.156 55.889L84.893 55.889L84.805 55.801L84.189 55.713L83.838 55.537L83.574 55.537L83.223 55.361L82.959 55.361L82.607 55.186L82.344 55.186L82.256 55.098L82.080 55.098L81.992 55.010L81.816 55.010L81.729 54.922L81.553 54.922L81.201 54.746L80.938 54.746L80.850 54.658L80.410 54.570L80.146 54.395L79.971 54.395L79.883 54.307L79.180 54.131L78.916 53.955L78.477 53.867L78.213 53.691L77.773 53.604L77.070 53.252L76.895 53.252L76.455 52.988L76.279 52.988L75.840 52.725L75.664 52.725L75.225 52.461L75.049 52.461L74.258 52.021L74.082 52.021L71.006 50.439Z M61.689 61.953L62.305 61.602L62.480 61.602L62.832 61.426L63.887 61.426L63.975 61.514L64.150 61.514L64.238 61.602L64.414 61.602L64.766 61.777L64.941 61.953L65.029 61.953L70.830 67.754L70.918 67.754L76.807 61.865L77.510 61.514L77.773 61.514L77.861 61.426L78.828 61.426L78.916 61.514L79.180 61.514L79.268 61.602L79.619 61.689L79.795 61.865L79.883 61.865L80.674 62.656L80.938 63.184L81.025 63.711L81.113 63.799L81.113 64.502L81.025 64.590L81.025 64.941L80.674 65.645L80.410 65.908L80.410 65.996L74.785 71.621L74.785 71.709L80.498 77.422L80.498 77.510L80.850 77.949L80.938 78.301L81.025 78.389L81.025 78.740L81.113 78.828L81.113 79.531L81.025 79.619L81.025 79.883L80.938 79.971L80.938 80.146L80.674 80.674L79.883 81.465L79.355 81.729L78.828 81.816L78.740 81.904L77.949 81.904L77.861 81.816L77.598 81.816L77.510 81.729L77.334 81.729L76.982 81.553L76.807 81.377L76.719 81.377L70.918 75.576L70.830 75.576L65.117 81.289L65.029 81.289L64.590 81.641L64.414 81.641L64.150 81.816L63.887 81.816L63.799 81.904L62.920 81.904L62.832 81.816L62.568 81.816L62.480 81.729L62.129 81.641L61.953 81.465L61.602 81.289L61.250 80.Line truncated
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 18 KiB |
@@ -26,4 +26,15 @@
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/libexec/gpclient/gp-vpnc-script-installer</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
<action id="com.yuezk.gpgui.manage-root-hip-script">
|
||||
<description>Approve a GP Connect HIP script to run as root</description>
|
||||
<message>Administrator authentication is required to run a HIP script as root</message>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/libexec/gpclient/gp-hip-script-installer</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
</policyconfig>
|
||||
@@ -73,6 +73,8 @@ make build
|
||||
%{_bindir}/*
|
||||
%{_libexecdir}/gpclient/vpnc-script
|
||||
%{_libexecdir}/gpclient/hipreport.sh
|
||||
%{_libexecdir}/gpclient/gp-hip-runner
|
||||
%{_libexecdir}/gpclient/gp-hip-script-installer
|
||||
%{_libexecdir}/gpclient/gp-vpnc-script-installer
|
||||
%{_datadir}/applications/gpgui.desktop
|
||||
%{_datadir}/icons/hicolor/32x32/apps/gpgui.png
|
||||
@@ -80,6 +82,12 @@ make build
|
||||
%{_datadir}/icons/hicolor/256x256/apps/gpgui.png
|
||||
%{_datadir}/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
%{_datadir}/icons/hicolor/scalable/apps/gpgui.svg
|
||||
%{_datadir}/icons/hicolor/scalable/status/gpgui-connected-symbolic.svg
|
||||
%{_datadir}/icons/hicolor/scalable/status/gpgui-disconnected-symbolic.svg
|
||||
%{_datadir}/icons/hicolor/scalable/status/gpgui-connecting-1-symbolic.svg
|
||||
%{_datadir}/icons/hicolor/scalable/status/gpgui-connecting-2-symbolic.svg
|
||||
%{_datadir}/icons/hicolor/scalable/status/gpgui-connecting-3-symbolic.svg
|
||||
%{_datadir}/icons/hicolor/scalable/status/gpgui-connecting-4-symbolic.svg
|
||||
%{_datadir}/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
%dir /usr/lib/NetworkManager
|
||||
@@ -102,6 +110,7 @@ make build
|
||||
%dir %{_datadir}/icons/hicolor/256x256@2/apps
|
||||
%dir %{_datadir}/icons/hicolor/scalable
|
||||
%dir %{_datadir}/icons/hicolor/scalable/apps
|
||||
%dir %{_datadir}/icons/hicolor/scalable/status
|
||||
%dir %{_datadir}/polkit-1
|
||||
%dir %{_datadir}/polkit-1/actions
|
||||
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "1.89"
|
||||
channel = "1.91"
|
||||
@@ -5,8 +5,8 @@ set -euo pipefail
|
||||
release_version="${1:-}"
|
||||
release_tag="${2:-}"
|
||||
|
||||
if git diff --quiet -- flake.nix; then
|
||||
echo "flake.nix hashes are already up to date"
|
||||
if git diff --quiet -- flake.nix flake.lock; then
|
||||
echo "flake hashes and lock are already up to date"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -21,12 +21,12 @@ fi
|
||||
|
||||
branch_suffix="v${version}"
|
||||
title="chore: update flake hashes for v${version}"
|
||||
body="Updates the Nix flake fetchzip hashes for v${version} release assets."
|
||||
body="Updates the Nix flake fetchurl hashes for v${version} release assets and refreshes the Nixpkgs lock."
|
||||
|
||||
if [[ "$release_tag" != "v$version" ]]; then
|
||||
branch_suffix="${branch_suffix}-${release_tag}"
|
||||
title="chore: update flake hashes for v${version} from ${release_tag}"
|
||||
body="Updates the Nix flake fetchzip hashes for v${version} using ${release_tag} release assets."
|
||||
body="Updates the Nix flake fetchurl hashes for v${version} using ${release_tag} release assets and refreshes the Nixpkgs lock."
|
||||
fi
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
@@ -37,7 +37,7 @@ if [[ "$release_tag" == "snapshot" ]]; then
|
||||
source_branch_slug="$(printf '%s' "$source_branch" | sed -E 's#[/[:space:]]+#-#g; s#[^A-Za-z0-9._-]##g; s#^-+##; s#-+$##')"
|
||||
branch="chore/flake-${source_branch_slug}"
|
||||
git switch -C "$branch"
|
||||
git add flake.nix
|
||||
git add flake.nix flake.lock
|
||||
git commit -m "$title"
|
||||
git push --force origin "$branch"
|
||||
echo "Updated snapshot flake hashes on branch $branch from $source_branch; skipping PR creation"
|
||||
@@ -47,12 +47,12 @@ fi
|
||||
branch="chore/update-flake-hashes-${branch_suffix}"
|
||||
|
||||
git switch -C "$branch"
|
||||
git add flake.nix
|
||||
git add flake.nix flake.lock
|
||||
git commit -m "$title"
|
||||
git push --force origin "$branch"
|
||||
|
||||
if gh pr view "$branch" --json number > /tmp/flake-pr.json 2> /dev/null; then
|
||||
pr_number="$(jq -r '.number' /tmp/flake-pr.json)"
|
||||
pr_number="$(gh pr list --head "$branch" --state open --json number --jq '.[0].number')"
|
||||
if [[ -n "$pr_number" ]]; then
|
||||
gh pr edit "$pr_number" --title "$title" --body "$body"
|
||||
else
|
||||
gh pr create --title "$title" --body "$body" --base main --head "$branch"
|
||||
|
||||
@@ -11,7 +11,7 @@ FLAKE_FILE="$PROJECT_DIR/flake.nix"
|
||||
usage() {
|
||||
echo "Usage: $0 [version] [release-tag]"
|
||||
echo
|
||||
echo "Updates flake.nix fetchzip hashes from the published GitHub release assets."
|
||||
echo "Updates flake.nix fetchurl hashes from the published GitHub release assets."
|
||||
echo "When version is omitted, the workspace package version from Cargo.toml is used."
|
||||
echo "When release-tag is omitted, v<version> is used. Use snapshot to test snapshot assets."
|
||||
}
|
||||
@@ -22,7 +22,7 @@ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
||||
fi
|
||||
|
||||
if ! command -v nix > /dev/null; then
|
||||
echo "nix is required to calculate unpacked fetchzip hashes" >&2
|
||||
echo "nix is required to calculate release asset hashes" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -61,7 +61,6 @@ prefetch_hash() {
|
||||
store prefetch-file \
|
||||
--hash-type sha256 \
|
||||
--json \
|
||||
--unpack \
|
||||
"$url" \
|
||||
| jq -r '.hash'; then
|
||||
return 0
|
||||
|
||||
@@ -57,6 +57,17 @@ verify_same_file \
|
||||
verify_same_file \
|
||||
"$GPGUI_APP_DIR/src-tauri/icons/icon.svg" \
|
||||
"$GP_DIR/packaging/files/usr/share/icons/hicolor/scalable/apps/gpgui.svg"
|
||||
for icon in \
|
||||
gpgui-connected-symbolic.svg \
|
||||
gpgui-disconnected-symbolic.svg \
|
||||
gpgui-connecting-1-symbolic.svg \
|
||||
gpgui-connecting-2-symbolic.svg \
|
||||
gpgui-connecting-3-symbolic.svg \
|
||||
gpgui-connecting-4-symbolic.svg; do
|
||||
verify_same_file \
|
||||
"$GPGUI_APP_DIR/src-tauri/icons/tray/theme/$icon" \
|
||||
"$GP_DIR/packaging/files/usr/share/icons/hicolor/scalable/status/$icon"
|
||||
done
|
||||
verify_same_file \
|
||||
"$GPGUI_APP_DIR/src-tauri/icons/32x32.png" \
|
||||
"$GP_DIR/apps/gpauth/icons/32x32.png"
|
||||
@@ -115,4 +126,4 @@ verify_absent "$GPGUI_APP_DIR/gpauth.desktop"
|
||||
verify_absent "$GP_DIR/packaging/files/usr/share/applications/gpauth.desktop"
|
||||
verify_absent "$GP_DIR/packaging/bsd/gpauth.desktop"
|
||||
|
||||
echo "Linux desktop assets are synchronized"
|
||||
echo "Linux desktop and tray assets are synchronized"
|
||||
Reference in new issue
Block a user