mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-30 01:36:14 -05:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88e0b5b9e4 | ||
|
|
89f6364a7b | ||
|
|
69155d04b9 | ||
|
|
2160bd82f8 | ||
|
|
2a4d23f595 | ||
|
|
1e140ca764 |
No files matched your search
@@ -40,7 +40,7 @@ GP Connect is an independent project. It is not affiliated with or endorsed by P
|
|||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
Download the Windows installer for [x64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/GPConnect_3.7.0_windows-x64-setup.exe) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/GPConnect_3.7.0_windows-arm64-setup.exe). Run it and approve the administrator prompt.
|
Download the Windows installer for [x64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/GPConnect_3.7.1_windows-x64-setup.exe) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/GPConnect_3.7.1_windows-arm64-setup.exe). Run it and approve the administrator prompt.
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
@@ -54,11 +54,11 @@ brew install --cask yuezk/gp-connect/gp-connect
|
|||||||
|
|
||||||
#### DMG installer
|
#### DMG installer
|
||||||
|
|
||||||
Open the [Apple silicon DMG](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/GPConnect_3.7.0_arm64.dmg) and drag GP Connect into Applications.
|
Open the [Apple silicon DMG](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/GPConnect_3.7.1_arm64.dmg) and drag GP Connect into Applications.
|
||||||
|
|
||||||
### Alpine Linux
|
### Alpine Linux
|
||||||
|
|
||||||
Download the APK for [x86_64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-r1-x86_64.apk) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-r1-aarch64.apk).
|
Download the APK for [x86_64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect-3.7.1-r1-x86_64.apk) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect-3.7.1-r1-aarch64.apk).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
|
sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
|
||||||
@@ -92,7 +92,7 @@ sudo apt-get install globalprotect-openconnect
|
|||||||
|
|
||||||
#### Debian or Ubuntu release package
|
#### Debian or Ubuntu release package
|
||||||
|
|
||||||
Download the DEB for [amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0-1_amd64.deb) or [arm64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0-1_arm64.deb).
|
Download the DEB for [amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect_3.7.1-1_amd64.deb) or [arm64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect_3.7.1-1_arm64.deb).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install ./globalprotect-openconnect_*.deb
|
sudo apt install ./globalprotect-openconnect_*.deb
|
||||||
@@ -160,17 +160,17 @@ Packages are available on the [openSUSE Build Service](https://build.opensuse.or
|
|||||||
|
|
||||||
### Other Distributions
|
### Other Distributions
|
||||||
|
|
||||||
Download the archive for [x86_64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0_x86_64.bin.tar.xz) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect_3.7.0_aarch64.bin.tar.xz).
|
Download the archive for [x86_64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect_3.7.1_x86_64.bin.tar.xz) or [ARM64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect_3.7.1_aarch64.bin.tar.xz).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tar -xJf globalprotect-openconnect_*.bin.tar.xz
|
tar -xJf globalprotect-openconnect_*.bin.tar.xz
|
||||||
cd globalprotect-openconnect_3.7.0
|
cd globalprotect-openconnect_3.7.1
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
### FreeBSD
|
### FreeBSD
|
||||||
|
|
||||||
Download the [FreeBSD package for amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-freebsd-amd64.pkg).
|
Download the [FreeBSD package for amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect-3.7.1-freebsd-amd64.pkg).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo pkg install ./globalprotect-openconnect-*-freebsd-*.pkg
|
sudo pkg install ./globalprotect-openconnect-*-freebsd-*.pkg
|
||||||
@@ -178,7 +178,7 @@ sudo pkg install ./globalprotect-openconnect-*-freebsd-*.pkg
|
|||||||
|
|
||||||
### OpenBSD
|
### OpenBSD
|
||||||
|
|
||||||
Download the [OpenBSD package for amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.0/globalprotect-openconnect-3.7.0-openbsd-amd64.tgz).
|
Download the [OpenBSD package for amd64](https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v3.7.1/globalprotect-openconnect-3.7.1-openbsd-amd64.tgz).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
doas pkg_add -D unsigned ./globalprotect-openconnect-*-openbsd-*.tgz
|
doas pkg_add -D unsigned ./globalprotect-openconnect-*-openbsd-*.tgz
|
||||||
|
|||||||
@@ -129,6 +129,49 @@ async fn cached_tunnel_authentication_does_not_require_portal_discovery() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn explicit_user_skips_another_users_cached_gateway_and_portal_credentials() {
|
||||||
|
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
|
||||||
|
let origin = format!("http://{}", listener.local_addr().unwrap());
|
||||||
|
let directory = tempfile::tempdir().unwrap();
|
||||||
|
let cache = directory.path().join("cookie.json");
|
||||||
|
let args = TestArgs::parse_from([
|
||||||
|
"test",
|
||||||
|
&origin,
|
||||||
|
"--user",
|
||||||
|
"bob",
|
||||||
|
"--cookie-cache",
|
||||||
|
cache.to_str().unwrap(),
|
||||||
|
])
|
||||||
|
.connect;
|
||||||
|
let lock = directory.path().join("client.pid");
|
||||||
|
let verbose = gpapi::clap::InfoLevelVerbosity::new(0, 0);
|
||||||
|
let shared = SharedArgs {
|
||||||
|
ignore_tls_errors: true,
|
||||||
|
lock_file: &lock,
|
||||||
|
verbose: &verbose,
|
||||||
|
log_format: LogFormat::Text,
|
||||||
|
};
|
||||||
|
let handler = ConnectHandler::new(&args, &shared);
|
||||||
|
cookie_store::save(
|
||||||
|
&cache,
|
||||||
|
&StoredCookie::new(
|
||||||
|
args.server.clone(),
|
||||||
|
"alice".into(),
|
||||||
|
handler.os_profile.borrow().host_identity().host_id().into(),
|
||||||
|
origin,
|
||||||
|
AuthCookieCredential::new("alice", "portal-cookie", ""),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(handler.cached_portal_credential(&args.server).is_none());
|
||||||
|
tokio::select! {
|
||||||
|
result = handler.try_cached_cookie(&args.server) => assert!(result.is_none()),
|
||||||
|
_ = listener.accept() => panic!("a mismatched cache entry must be skipped before contacting the gateway"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn unreachable_gateway_keeps_cached_cookie() {
|
async fn unreachable_gateway_keeps_cached_cookie() {
|
||||||
// Nothing listens here: the cached gateway login gets no answer at all.
|
// Nothing listens here: the cached gateway login gets no answer at all.
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ impl ConnectHandler<'_> {
|
|||||||
pub(super) async fn try_cached_cookie(&self, server: &str) -> Option<anyhow::Result<()>> {
|
pub(super) async fn try_cached_cookie(&self, server: &str) -> Option<anyhow::Result<()>> {
|
||||||
let path = cookie_cache_path(self.args)?;
|
let path = cookie_cache_path(self.args)?;
|
||||||
let host_id = self.os_profile.borrow().host_identity().host_id().to_string();
|
let host_id = self.os_profile.borrow().host_identity().host_id().to_string();
|
||||||
let stored = cookie_store::load(&path, server, &host_id)?;
|
let stored = cookie_store::load(&path, server, &host_id, self.args.user.as_deref())?;
|
||||||
if !stored.auth_cookie.can_authenticate_gateway() {
|
if !stored.auth_cookie.can_authenticate_gateway() {
|
||||||
cookie_store::clear(&path);
|
cookie_store::clear(&path);
|
||||||
return None;
|
return None;
|
||||||
@@ -145,7 +145,7 @@ impl ConnectHandler<'_> {
|
|||||||
}
|
}
|
||||||
let path = cookie_cache_path(self.args)?;
|
let path = cookie_cache_path(self.args)?;
|
||||||
let host_id = self.os_profile.borrow().host_identity().host_id().to_string();
|
let host_id = self.os_profile.borrow().host_identity().host_id().to_string();
|
||||||
let stored = cookie_store::load(&path, server, &host_id)?;
|
let stored = cookie_store::load(&path, server, &host_id, self.args.user.as_deref())?;
|
||||||
if !stored.auth_cookie.can_authenticate_gateway() {
|
if !stored.auth_cookie.can_authenticate_gateway() {
|
||||||
cookie_store::clear(&path);
|
cookie_store::clear(&path);
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
@@ -59,12 +59,15 @@ pub fn cookie_path(custom: Option<&str>) -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(path: &Path, server: &str, host_id: &str) -> Option<StoredCookie> {
|
pub fn load(path: &Path, server: &str, host_id: &str, requested_user: Option<&str>) -> Option<StoredCookie> {
|
||||||
let bytes = zeroize::Zeroizing::new(platform::decode(fs::read(path).ok()?).ok()?);
|
let bytes = zeroize::Zeroizing::new(platform::decode(fs::read(path).ok()?).ok()?);
|
||||||
let stored: StoredCookie = serde_json::from_slice(&bytes).ok()?;
|
let stored: StoredCookie = serde_json::from_slice(&bytes).ok()?;
|
||||||
if stored.version != STORE_VERSION || stored.server != server || stored.host_id != host_id {
|
if stored.version != STORE_VERSION || stored.server != server || stored.host_id != host_id {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
if requested_user.is_some_and(|user| user != stored.auth_cookie.username()) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
Some(stored)
|
Some(stored)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +119,7 @@ mod tests {
|
|||||||
.windows(b"prelogon-auth".len())
|
.windows(b"prelogon-auth".len())
|
||||||
.any(|part| part == b"prelogon-auth")
|
.any(|part| part == b"prelogon-auth")
|
||||||
);
|
);
|
||||||
assert!(load(&path, "vpn.example.com", "host-1").is_some());
|
assert!(load(&path, "vpn.example.com", "host-1", None).is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -132,24 +135,35 @@ mod tests {
|
|||||||
assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600);
|
assert_eq!(fs::metadata(&path).unwrap().permissions().mode() & 0o777, 0o600);
|
||||||
}
|
}
|
||||||
|
|
||||||
let loaded = load(&path, "vpn.example.com", "host-1").unwrap();
|
let loaded = load(&path, "vpn.example.com", "host-1", None).unwrap();
|
||||||
assert_eq!(loaded.username, "alice");
|
assert_eq!(loaded.username, "alice");
|
||||||
assert_eq!(loaded.host_id, "host-1");
|
assert_eq!(loaded.host_id, "host-1");
|
||||||
assert_eq!(loaded.last_gateway, "gw1.example.com");
|
assert_eq!(loaded.last_gateway, "gw1.example.com");
|
||||||
assert_eq!(loaded.auth_cookie.user_auth_cookie(), "user-auth");
|
assert_eq!(loaded.auth_cookie.user_auth_cookie(), "user-auth");
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
load(&path, "other.example.com", "host-1").is_none(),
|
load(&path, "other.example.com", "host-1", None).is_none(),
|
||||||
"must reject mismatched server"
|
"must reject mismatched server"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
load(&path, "vpn.example.com", "host-2").is_none(),
|
load(&path, "vpn.example.com", "host-2", None).is_none(),
|
||||||
"must reject mismatched host id"
|
"must reject mismatched host id"
|
||||||
);
|
);
|
||||||
clear(&path);
|
clear(&path);
|
||||||
assert!(!path.exists());
|
assert!(!path.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn matches_explicit_user_against_cached_credential() {
|
||||||
|
let dir = tempfile::tempdir().unwrap();
|
||||||
|
let path = dir.path().join("cookie.json");
|
||||||
|
let stored = sample();
|
||||||
|
save(&path, &stored).unwrap();
|
||||||
|
|
||||||
|
assert!(load(&path, &stored.server, &stored.host_id, Some("bob")).is_none());
|
||||||
|
assert!(load(&path, &stored.server, &stored.host_id, Some("alice")).is_some());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rejects_version_mismatch() {
|
fn rejects_version_mismatch() {
|
||||||
let dir = tempfile::tempdir().unwrap();
|
let dir = tempfile::tempdir().unwrap();
|
||||||
@@ -157,6 +171,6 @@ mod tests {
|
|||||||
let mut s = sample();
|
let mut s = sample();
|
||||||
s.version = STORE_VERSION + 1;
|
s.version = STORE_VERSION + 1;
|
||||||
save(&path, &s).unwrap();
|
save(&path, &s).unwrap();
|
||||||
assert!(load(&path, "vpn.example.com", "host-1").is_none());
|
assert!(load(&path, "vpn.example.com", "host-1", None).is_none());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,9 @@ pub fn command_path(require_root: bool) -> io::Result<std::ffi::OsString> {
|
|||||||
std::env::join_paths(directories).map_err(|error| io::Error::new(io::ErrorKind::InvalidInput, error))
|
std::env::join_paths(directories).map_err(|error| io::Error::new(io::ErrorKind::InvalidInput, error))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn root_owned_path(path: &Path) -> bool {
|
/// Whether `path` and every ancestor are root-owned, not symlinks, and not
|
||||||
|
/// group/world-writable (unless a root-owned sticky ancestor protects them).
|
||||||
|
pub fn root_owned_path(path: &Path) -> bool {
|
||||||
path.ancestors().all(|part| {
|
path.ancestors().all(|part| {
|
||||||
fs::symlink_metadata(part).is_ok_and(|metadata| {
|
fs::symlink_metadata(part).is_ok_and(|metadata| {
|
||||||
let mode = metadata.permissions().mode();
|
let mode = metadata.permissions().mode();
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
use std::{fs, io, path::Path};
|
||||||
|
|
||||||
|
use gpapi::process::collection::{CollectorCommands, root_owned_path};
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
use super::BitdefenderInfo;
|
||||||
|
|
||||||
|
const BITDEFENDER_DIR: &str = "/opt/bitdefender-security-tools";
|
||||||
|
const MAX_VERSION_LEN: usize = 64;
|
||||||
|
|
||||||
|
pub(super) fn detect(commands: &CollectorCommands<'_>) -> io::Result<Option<BitdefenderInfo>> {
|
||||||
|
let dir = Path::new(BITDEFENDER_DIR);
|
||||||
|
if uzers::get_effective_uid() == 0 {
|
||||||
|
let cli = dir.join("bin/bduitool");
|
||||||
|
let status = commands
|
||||||
|
.run_executable(&cli, &["get", "ps"])?
|
||||||
|
.filter(|output| output.status.success())
|
||||||
|
.and_then(|output| String::from_utf8(output.stdout).ok())
|
||||||
|
.as_deref()
|
||||||
|
.and_then(parse_product_status);
|
||||||
|
if status.is_some() {
|
||||||
|
return Ok(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let Ok(manifest) = dir.join("etc/manifest.json").canonicalize() else {
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
if !manifest.is_file() || !root_owned_path(&manifest) {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
let Ok(contents) = fs::read_to_string(&manifest) else {
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
Ok(parse_manifest(&contents).map(|version| BitdefenderInfo {
|
||||||
|
version,
|
||||||
|
engine_version: None,
|
||||||
|
real_time_protection: None,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parse `bduitool get ps`. All three fields must be present for a full entry.
|
||||||
|
fn parse_product_status(output: &str) -> Option<BitdefenderInfo> {
|
||||||
|
let version = product_version(value(output, "Product version:")?)?;
|
||||||
|
let engine_version = value(output, "Engines version:")
|
||||||
|
.filter(|version| valid_version(version))?
|
||||||
|
.to_string();
|
||||||
|
let real_time_protection = match value(output, "Antimalware status:")? {
|
||||||
|
"On" => true,
|
||||||
|
"Off" => false,
|
||||||
|
_ => return None,
|
||||||
|
};
|
||||||
|
Some(BitdefenderInfo {
|
||||||
|
version,
|
||||||
|
engine_version: Some(engine_version),
|
||||||
|
real_time_protection: Some(real_time_protection),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_manifest(contents: &str) -> Option<String> {
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct Manifest {
|
||||||
|
version: String,
|
||||||
|
}
|
||||||
|
let manifest: Manifest = serde_json::from_str(contents).ok()?;
|
||||||
|
product_version(&manifest.version)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The official client reports only the first three components, e.g. `7.10.0`.
|
||||||
|
fn product_version(version: &str) -> Option<String> {
|
||||||
|
if !valid_version(version) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let short = version.split('.').take(3).collect::<Vec<_>>().join(".");
|
||||||
|
Some(short)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn valid_version(version: &str) -> bool {
|
||||||
|
!version.is_empty()
|
||||||
|
&& version.len() <= MAX_VERSION_LEN
|
||||||
|
&& version.chars().all(|ch| ch.is_ascii_digit() || ch == '.')
|
||||||
|
&& version.split('.').all(|part| !part.is_empty())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn value<'a>(output: &'a str, label: &str) -> Option<&'a str> {
|
||||||
|
output.lines().find_map(|line| {
|
||||||
|
let line = line.trim();
|
||||||
|
let line = line.strip_prefix("- ").unwrap_or(line);
|
||||||
|
line.strip_prefix(label).map(str::trim)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
const OBSERVED: &str = "\nProduct version: 7.10.0.200346\nLast product update: 2026-11-21 at 14:42:06 GMT\n\
|
||||||
|
New product update available: no\nEngines version: 7.101851\nLast security content update: 2026-11-21 at 13:42:12 GMT\n\
|
||||||
|
Features:\n - Antimalware status: On\n - AntiExploit status: On\n - On-Access YARA status: Off\n";
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_observed_product_status() {
|
||||||
|
let info = parse_product_status(OBSERVED).expect("observed output should parse");
|
||||||
|
assert_eq!(info.version, "7.10.0");
|
||||||
|
assert_eq!(info.engine_version.as_deref(), Some("7.101851"));
|
||||||
|
assert_eq!(info.real_time_protection, Some(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn antimalware_off_reports_no_real_time_protection() {
|
||||||
|
let output = OBSERVED.replace("Antimalware status: On", "Antimalware status: Off");
|
||||||
|
assert_eq!(parse_product_status(&output).unwrap().real_time_protection, Some(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn incomplete_product_status_is_rejected() {
|
||||||
|
assert!(parse_product_status(&OBSERVED.replace("Engines version: 7.101851\n", "")).is_none());
|
||||||
|
assert!(parse_product_status(&OBSERVED.replace(" - Antimalware status: On\n", "")).is_none());
|
||||||
|
assert!(parse_product_status(&OBSERVED.replace("Antimalware status: On", "Antimalware status: Unknown")).is_none());
|
||||||
|
assert!(
|
||||||
|
parse_product_status(&OBSERVED.replace("Engines version: 7.101851", "Engines version: 7.101851\"/>")).is_none()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn truncates_product_version_to_three_components() {
|
||||||
|
assert_eq!(product_version("7.10.0.200346").as_deref(), Some("7.10.0"));
|
||||||
|
assert_eq!(product_version("7.10.0").as_deref(), Some("7.10.0"));
|
||||||
|
assert_eq!(product_version("7.10").as_deref(), Some("7.10"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rejects_invalid_versions() {
|
||||||
|
assert_eq!(product_version(""), None);
|
||||||
|
assert_eq!(product_version("7.10.0\"/>"), None);
|
||||||
|
assert_eq!(product_version(&"1".repeat(65)), None);
|
||||||
|
assert_eq!(product_version("7..10"), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_manifest_version() {
|
||||||
|
assert_eq!(
|
||||||
|
parse_manifest(r#"{"version":"7.10.0.200346","changeset":"e95aa9d9"}"#).as_deref(),
|
||||||
|
Some("7.10.0")
|
||||||
|
);
|
||||||
|
assert_eq!(parse_manifest("not json"), None);
|
||||||
|
assert_eq!(parse_manifest(r#"{"changeset":"e95aa9d9"}"#), None);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ use gpapi::collection::{CollectionBudget, CollectionControl};
|
|||||||
use gpapi::process::collection::CollectorCommands;
|
use gpapi::process::collection::CollectorCommands;
|
||||||
use xmltree::Element;
|
use xmltree::Element;
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
mod bitdefender_unix;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
mod domain_macos;
|
mod domain_macos;
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd", test))]
|
||||||
@@ -355,6 +357,15 @@ struct ClamAvInfo {
|
|||||||
real_time_protection: bool,
|
real_time_protection: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Bitdefender Endpoint Security Tools (GravityZone). Engine and real-time
|
||||||
|
/// protection are only available when `bduitool` can run as root.
|
||||||
|
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
|
||||||
|
struct BitdefenderInfo {
|
||||||
|
version: String,
|
||||||
|
engine_version: Option<String>,
|
||||||
|
real_time_protection: Option<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
struct SentinelInfo {
|
struct SentinelInfo {
|
||||||
version: String,
|
version: String,
|
||||||
real_time_protection: bool,
|
real_time_protection: bool,
|
||||||
@@ -378,6 +389,7 @@ struct HostInfo {
|
|||||||
defender: Option<DefenderInfo>,
|
defender: Option<DefenderInfo>,
|
||||||
clamav: Option<ClamAvInfo>,
|
clamav: Option<ClamAvInfo>,
|
||||||
sentinel: Option<SentinelInfo>,
|
sentinel: Option<SentinelInfo>,
|
||||||
|
bitdefender: Option<BitdefenderInfo>,
|
||||||
ufw: Option<UfwInfo>,
|
ufw: Option<UfwInfo>,
|
||||||
windows_categories: Option<String>,
|
windows_categories: Option<String>,
|
||||||
windows_updates: Option<gpapi::hip::WindowsUpdateStatus>,
|
windows_updates: Option<gpapi::hip::WindowsUpdateStatus>,
|
||||||
@@ -503,6 +515,7 @@ impl<'p, 'a> HostInfoCollector<'p, 'a> {
|
|||||||
defender: None,
|
defender: None,
|
||||||
clamav: None,
|
clamav: None,
|
||||||
sentinel: None,
|
sentinel: None,
|
||||||
|
bitdefender: None,
|
||||||
ufw: None,
|
ufw: None,
|
||||||
windows_categories: None,
|
windows_categories: None,
|
||||||
windows_updates: None,
|
windows_updates: None,
|
||||||
@@ -585,6 +598,10 @@ impl<'p, 'a> HostInfoCollector<'p, 'a> {
|
|||||||
if self.profile.client_os() == ClientOs::Linux && self.profile.is_native() {
|
if self.profile.client_os() == ClientOs::Linux && self.profile.is_native() {
|
||||||
info.sentinel = sentinel_unix::detect(&commands)?;
|
info.sentinel = sentinel_unix::detect(&commands)?;
|
||||||
}
|
}
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
if self.profile.client_os() == ClientOs::Linux && self.profile.is_native() {
|
||||||
|
info.bitdefender = bitdefender_unix::detect(&commands)?;
|
||||||
|
}
|
||||||
control.check()?;
|
control.check()?;
|
||||||
Ok(info)
|
Ok(info)
|
||||||
}
|
}
|
||||||
@@ -1225,6 +1242,86 @@ mod tests {
|
|||||||
assert_eq!(report.matches("name=\"Sentinel Agent\"").count(), 1);
|
assert_eq!(report.matches("name=\"Sentinel Agent\"").count(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_linux_report_with_bitdefender(bitdefender: Option<BitdefenderInfo>) -> String {
|
||||||
|
let input = make_input(make_profile(ClientOs::Linux));
|
||||||
|
let cookie_params = HashMap::new();
|
||||||
|
let mut host_info = HostInfoCollector::new(&input.profile, &input, &cookie_params)
|
||||||
|
.collect_identity(&CollectionBudget::new(Duration::from_secs(10)))
|
||||||
|
.unwrap();
|
||||||
|
host_info.bitdefender = bitdefender;
|
||||||
|
let (generate_time, day, month, year) = get_current_time_components();
|
||||||
|
let report = HipReportTemplate {
|
||||||
|
client_version: input.profile.client_version(),
|
||||||
|
generate_time,
|
||||||
|
day,
|
||||||
|
month,
|
||||||
|
year,
|
||||||
|
user_name: "test-user",
|
||||||
|
host_info,
|
||||||
|
md5: "test-digest",
|
||||||
|
}
|
||||||
|
.render()
|
||||||
|
.unwrap();
|
||||||
|
let report = format_xml(&report).unwrap();
|
||||||
|
validate_edited_report(&report).unwrap();
|
||||||
|
report
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bitdefender_product_info(report: &str) -> &str {
|
||||||
|
let start = report
|
||||||
|
.find("name=\"Bitdefender Endpoint Security Tools\"")
|
||||||
|
.expect("Bitdefender entry should render");
|
||||||
|
let end = start + report[start..].find("</ProductInfo>").unwrap();
|
||||||
|
&report[start..end]
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn linux_report_renders_full_bitdefender_entry() {
|
||||||
|
let report = render_linux_report_with_bitdefender(Some(BitdefenderInfo {
|
||||||
|
version: "7.10.0".to_string(),
|
||||||
|
engine_version: Some("7.101851".to_string()),
|
||||||
|
real_time_protection: Some(true),
|
||||||
|
}));
|
||||||
|
assert!(report.contains(
|
||||||
|
"vendor=\"Bitdefender\" name=\"Bitdefender Endpoint Security Tools\" version=\"7.10.0\" defver=\"7.101851\" engver=\"7.101851\""
|
||||||
|
));
|
||||||
|
let entry = bitdefender_product_info(&report);
|
||||||
|
assert!(entry.contains("prodType=\"3\" osType=\"1\""));
|
||||||
|
assert!(entry.contains("<real-time-protection>yes</real-time-protection>"));
|
||||||
|
assert!(entry.contains("<last-full-scan-time>n/a</last-full-scan-time>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn linux_report_renders_bitdefender_real_time_protection_off() {
|
||||||
|
let report = render_linux_report_with_bitdefender(Some(BitdefenderInfo {
|
||||||
|
version: "7.10.0".to_string(),
|
||||||
|
engine_version: Some("7.101851".to_string()),
|
||||||
|
real_time_protection: Some(false),
|
||||||
|
}));
|
||||||
|
assert!(bitdefender_product_info(&report).contains("<real-time-protection>no</real-time-protection>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn linux_report_renders_partial_bitdefender_entry() {
|
||||||
|
let report = render_linux_report_with_bitdefender(Some(BitdefenderInfo {
|
||||||
|
version: "7.10.0".to_string(),
|
||||||
|
engine_version: None,
|
||||||
|
real_time_protection: None,
|
||||||
|
}));
|
||||||
|
let entry = bitdefender_product_info(&report);
|
||||||
|
assert!(entry.contains("version=\"7.10.0\""));
|
||||||
|
assert!(!entry.contains("defver="));
|
||||||
|
assert!(!entry.contains("engver="));
|
||||||
|
assert!(!entry.contains("real-time-protection"));
|
||||||
|
assert!(entry.contains("<last-full-scan-time>n/a</last-full-scan-time>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn linux_report_omits_absent_bitdefender() {
|
||||||
|
let report = render_linux_report_with_bitdefender(None);
|
||||||
|
assert!(!report.contains("Bitdefender"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn preview_uses_explicit_pending_digest() {
|
fn preview_uses_explicit_pending_digest() {
|
||||||
let input = ReportInput {
|
let input = ReportInput {
|
||||||
|
|||||||
@@ -174,6 +174,17 @@
|
|||||||
</ProductInfo>
|
</ProductInfo>
|
||||||
</entry>
|
</entry>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
{% if let Some(bitdefender) = &host_info.bitdefender %}
|
||||||
|
<entry>
|
||||||
|
<ProductInfo>
|
||||||
|
<Prod vendor="Bitdefender" name="Bitdefender Endpoint Security Tools" version="{{ bitdefender.version }}"{% if let Some(engine_version) = &bitdefender.engine_version %} defver="{{ engine_version }}" engver="{{ engine_version }}"{% endif %} datemon="{{ month }}" dateday="{{ day }}" dateyear="{{ year }}" prodType="3" osType="1"/>
|
||||||
|
{% if let Some(real_time_protection) = bitdefender.real_time_protection -%}
|
||||||
|
<real-time-protection>{% if real_time_protection %}yes{% else %}no{% endif %}</real-time-protection>
|
||||||
|
{% endif -%}
|
||||||
|
<last-full-scan-time>n/a</last-full-scan-time>
|
||||||
|
</ProductInfo>
|
||||||
|
</entry>
|
||||||
|
{% endif -%}
|
||||||
</list>
|
</list>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="disk-backup">
|
<entry name="disk-backup">
|
||||||
|
|||||||
Submodule crates/openconnect/deps/openconnect updated: 80b4f80926...d5094312d2.
Generated
+3
-3
@@ -63,11 +63,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1795095985,
|
"lastModified": 1795217999,
|
||||||
"narHash": "sha256-DOTZsOOoEtOY0ysY9L6JzyDHZm4lGBr6P1bt1mFXcRw=",
|
"narHash": "sha256-Z5mAFcY8XTAaWe+RwTchz4Fx1gwaeQ2WD8A8bKX7njY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "19cfded70b91ca0981373973c5b1efffdd4d6647",
|
"rev": "680275f0bb6afce84fbac3e75fc47c5f2272400b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
pname = "globalprotect-openconnect";
|
pname = "globalprotect-openconnect";
|
||||||
version = cargoToml.workspace.package.version;
|
version = cargoToml.workspace.package.version;
|
||||||
releaseTag = "v3.7.0";
|
releaseTag = "v3.7.1";
|
||||||
releaseVersion = "3.7.0";
|
releaseVersion = "3.7.1";
|
||||||
|
|
||||||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@
|
|||||||
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
||||||
|
|
||||||
gpguiHashes = {
|
gpguiHashes = {
|
||||||
x86_64 = "sha256-eIvocMn4j+CiA1FMuib1/BvMEw4kcO5h4zAhbSHXFf0=";
|
x86_64 = "sha256-mY5w91CZp1W70Pjd8lRtxMuON3b6PRLcmWuE4AMd4/s=";
|
||||||
aarch64 = "sha256-pBH7KccAAnxLcCD5+wJxEAwpdu+QRHHncrytwoBgzh4=";
|
aarch64 = "sha256-Xm6QzVFsFJ3JlrHPCiBlJMgpD/5xZT65q/qZVajw4bQ=";
|
||||||
};
|
};
|
||||||
|
|
||||||
gpguiArchive = pkgs.fetchurl {
|
gpguiArchive = pkgs.fetchurl {
|
||||||
@@ -70,8 +70,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
nshHashes = {
|
nshHashes = {
|
||||||
x86_64 = "sha256-STlK1Wtx840a0TtIgxXJDINnVmfiedSNVcapGF154dY=";
|
x86_64 = "sha256-qqOtWnR20tDu0n4wRmsxPqjOVR+o8gf8fGWSwZXg/So=";
|
||||||
aarch64 = "sha256-HekBfUrlRavNzA+1g6EvxN4iiGDevEv0stsVEyL6Ejk=";
|
aarch64 = "sha256-GnVauyUobwocDb6LOzdLDeurttpVB6axHracYorTk+Q=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nshArchive = pkgs.fetchurl {
|
nshArchive = pkgs.fetchurl {
|
||||||
@@ -94,8 +94,8 @@
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
binaryHashes = {
|
binaryHashes = {
|
||||||
x86_64 = "sha256-1YFxjH6+garb/bneZRqVHAOfPQGBEvWaruAk573bZhc=";
|
x86_64 = "sha256-hP6xdkjblFDqfkHgl8u34vo75Vd0vv7L1Ua+hpqJBC4=";
|
||||||
aarch64 = "sha256-RnXdAcS2UWKwhWtlGSLs8fM4u2iRLx0w6SR42sOX9yk=";
|
aarch64 = "sha256-czpKkEs0DPQeghSyCaZ6xayRpLBPcWxAicay4qU8PdE=";
|
||||||
};
|
};
|
||||||
|
|
||||||
binaryArchive = pkgs.fetchurl {
|
binaryArchive = pkgs.fetchurl {
|
||||||
|
|||||||
Reference in new issue
Block a user