mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-30 17:56:13 -05:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d24800db4b | ||
|
|
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
|
||||||
|
|||||||
@@ -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">
|
||||||
|
|||||||
@@ -19,9 +19,49 @@ struct Snapshot {
|
|||||||
domain: String,
|
domain: String,
|
||||||
search: String,
|
search: String,
|
||||||
}
|
}
|
||||||
|
struct AdapterServers {
|
||||||
|
ipv6: bool,
|
||||||
|
addresses: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AdapterServers {
|
||||||
|
fn capture(guid: GUID, ipv6: bool) -> io::Result<Self> {
|
||||||
|
// Save the static override only. Restoring an effective DHCP resolver as a
|
||||||
|
// static address would leave the adapter in manual mode after disconnect.
|
||||||
|
let service = if ipv6 { "Tcpip6" } else { "Tcpip" };
|
||||||
|
let id = uuid::Uuid::from_fields(guid.data1, guid.data2, guid.data3, &guid.data4);
|
||||||
|
let path = format!(
|
||||||
|
r"SYSTEM\CurrentControlSet\Services\{service}\Parameters\Interfaces\{}",
|
||||||
|
id.braced()
|
||||||
|
);
|
||||||
|
let addresses = winreg::RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE)
|
||||||
|
.open_subkey(path)
|
||||||
|
.and_then(|key| key.get_value("NameServer"));
|
||||||
|
let addresses = match addresses {
|
||||||
|
Ok(value) => value,
|
||||||
|
Err(error) if error.kind() == io::ErrorKind::NotFound => String::new(),
|
||||||
|
Err(error) => return Err(error),
|
||||||
|
};
|
||||||
|
Ok(Self { ipv6, addresses })
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&self, guid: GUID) -> io::Result<()> {
|
||||||
|
let mut servers = wide(&self.addresses);
|
||||||
|
let family = if self.ipv6 { DNS_SETTING_IPV6 } else { 0 };
|
||||||
|
let settings = DNS_INTERFACE_SETTINGS {
|
||||||
|
Version: DNS_INTERFACE_SETTINGS_VERSION1,
|
||||||
|
Flags: (DNS_SETTING_NAMESERVER | family) as u64,
|
||||||
|
NameServer: servers.as_mut_ptr(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
check(unsafe { SetInterfaceDnsSettings(guid, &settings) })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) struct Installed {
|
pub(super) struct Installed {
|
||||||
guid: GUID,
|
guid: GUID,
|
||||||
snapshot: Option<Snapshot>,
|
snapshot: Option<Snapshot>,
|
||||||
|
previous_servers: Vec<AdapterServers>,
|
||||||
tag: Option<String>,
|
tag: Option<String>,
|
||||||
tunnel: Option<SystemTunnel>,
|
tunnel: Option<SystemTunnel>,
|
||||||
}
|
}
|
||||||
@@ -86,6 +126,7 @@ impl Installed {
|
|||||||
let mut installed = Self {
|
let mut installed = Self {
|
||||||
guid,
|
guid,
|
||||||
snapshot: Some(Snapshot::capture(guid)?),
|
snapshot: Some(Snapshot::capture(guid)?),
|
||||||
|
previous_servers: Vec::new(),
|
||||||
tag: None,
|
tag: None,
|
||||||
tunnel: tunnel.cloned(),
|
tunnel: tunnel.cloned(),
|
||||||
};
|
};
|
||||||
@@ -94,9 +135,28 @@ impl Installed {
|
|||||||
search: configuration.domains.join(","),
|
search: configuration.domains.join(","),
|
||||||
}
|
}
|
||||||
.write(guid)?;
|
.write(guid)?;
|
||||||
// NRPT selects both IPv4 and IPv6 VPN resolvers. Split namespaces leave
|
// With no split namespaces the VPN resolvers also belong on the adapter.
|
||||||
// unrelated DNS on the physical network; "." covers full-tunnel DNS.
|
// Windows may accept the local NRPT rule without making it effective.
|
||||||
// Existing static/DHCP adapter nameserver configuration stays untouched.
|
if configuration.split_dns.is_empty() {
|
||||||
|
for ipv6 in [false, true] {
|
||||||
|
let servers: Vec<_> = configuration
|
||||||
|
.servers
|
||||||
|
.iter()
|
||||||
|
.filter(|ip| ip.is_ipv6() == ipv6)
|
||||||
|
.map(ToString::to_string)
|
||||||
|
.collect();
|
||||||
|
if servers.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let previous = AdapterServers::capture(guid, ipv6)?;
|
||||||
|
AdapterServers {
|
||||||
|
ipv6,
|
||||||
|
addresses: servers.join(","),
|
||||||
|
}
|
||||||
|
.write(guid)?;
|
||||||
|
installed.previous_servers.push(previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
if !configuration.servers.is_empty() {
|
if !configuration.servers.is_empty() {
|
||||||
let namespaces: Vec<String> = if configuration.split_dns.is_empty() {
|
let namespaces: Vec<String> = if configuration.split_dns.is_empty() {
|
||||||
vec![".".into()]
|
vec![".".into()]
|
||||||
@@ -127,6 +187,12 @@ impl Installed {
|
|||||||
failure = Some(error);
|
failure = Some(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for previous in self.previous_servers.drain(..) {
|
||||||
|
if let Err(error) = previous.write(self.guid) {
|
||||||
|
log::warn!("Could not restore VPN adapter DNS servers: {error}");
|
||||||
|
failure.get_or_insert(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(snapshot) = self.snapshot.take() {
|
if let Some(snapshot) = self.snapshot.take() {
|
||||||
if let Err(error) = snapshot.write(self.guid) {
|
if let Err(error) = snapshot.write(self.guid) {
|
||||||
log::warn!("Could not restore VPN adapter DNS: {error}");
|
log::warn!("Could not restore VPN adapter DNS: {error}");
|
||||||
|
|||||||
@@ -275,6 +275,47 @@ fn global_search_list() -> Vec<u8> {
|
|||||||
output.stdout
|
output.stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check what DNS clients see for this adapter independently of the NRPT rule.
|
||||||
|
fn adapter_servers(index: u32) -> Vec<String> {
|
||||||
|
let command = format!("(Get-DnsClientServerAddress -InterfaceIndex {index} -ErrorAction Stop).ServerAddresses");
|
||||||
|
let output = std::process::Command::new("powershell.exe")
|
||||||
|
.args(["-NoProfile", "-NonInteractive", "-Command", &command])
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
|
||||||
|
String::from_utf8(output.stdout)
|
||||||
|
.unwrap()
|
||||||
|
.lines()
|
||||||
|
.map(str::to_owned)
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check_adapter_resolvers(index: u32, key: &str) -> io::Result<()> {
|
||||||
|
let split = environment(index);
|
||||||
|
let mut full = split.clone();
|
||||||
|
full.retain(|(key, _)| key != "CISCO_SPLIT_DNS");
|
||||||
|
let initial = adapter_servers(index);
|
||||||
|
let mut network = NetworkConfigurator::new(key)?;
|
||||||
|
network.configure("connect", &full)?;
|
||||||
|
let servers = adapter_servers(index);
|
||||||
|
assert!(servers.iter().any(|address| address == "198.18.0.53"));
|
||||||
|
assert!(servers.iter().any(|address| address == "fd42:1235::53"));
|
||||||
|
network.configure("reconnect", &split)?;
|
||||||
|
assert_eq!(
|
||||||
|
adapter_servers(index),
|
||||||
|
initial,
|
||||||
|
"split DNS must be scoped to its namespaces"
|
||||||
|
);
|
||||||
|
network.configure("reconnect", &full)?;
|
||||||
|
network.configure("disconnect", &[])?;
|
||||||
|
assert_eq!(
|
||||||
|
adapter_servers(index),
|
||||||
|
initial,
|
||||||
|
"disconnect must restore the adapter DNS settings"
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "requires administrator privileges and GP_TEST_WINTUN_DLL"]
|
#[ignore = "requires administrator privileges and GP_TEST_WINTUN_DLL"]
|
||||||
fn installs_and_restores_native_network_configuration() -> Result<(), Box<dyn std::error::Error>> {
|
fn installs_and_restores_native_network_configuration() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -355,6 +396,7 @@ fn installs_and_restores_native_network_configuration() -> Result<(), Box<dyn st
|
|||||||
);
|
);
|
||||||
assert_eq!(before, state(index), "Failed connection left a physical gateway route");
|
assert_eq!(before, state(index), "Failed connection left a physical gateway route");
|
||||||
println!("PASS: partial setup failure rolled back its physical gateway route");
|
println!("PASS: partial setup failure rolled back its physical gateway route");
|
||||||
|
check_adapter_resolvers(index, &recovery_key)?;
|
||||||
drop(adapter);
|
drop(adapter);
|
||||||
assert_crash_recovery(&recovery_key)?;
|
assert_crash_recovery(&recovery_key)?;
|
||||||
assert_eq!(global_search_list(), original_search_list);
|
assert_eq!(global_search_list(), original_search_list);
|
||||||
|
|||||||
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