diff --git a/README.md b/README.md index 721281e..499941c 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ A modern GlobalProtect VPN client for Linux, built on OpenConnect with full supp - [Other Distributions](#other-distributions) - [Building from Source](#building-from-source) - [Frequently Asked Questions](#frequently-asked-questions) +- [NetworkManager Integration](#networkmanager-integration) - [License](#license) ## Features @@ -284,7 +285,7 @@ gnome-extensions enable appindicatorsupport@rgcjonas.gmail.com ### Official Docker Image -The official Docker image provides the CLI tools on Alpine Linux: +The [official Docker image](https://hub.docker.com/r/yuezk/globalprotect-openconnect) provides the CLI tools on Alpine Linux: ```bash docker pull yuezk/globalprotect-openconnect: @@ -468,6 +469,11 @@ sudo -E gpclient connect See related issue: [#316](https://github.com/yuezk/GlobalProtect-openconnect/issues/316) +## NetworkManager Integration + +- [WMP/GlobalProtect-SAML-NetworkManager](https://github.com/WMP/GlobalProtect-SAML-NetworkManager) – NetworkManager VPN plugin with SAML/SSO support for GNOME and KDE Plasma +- [jdpipe/networkmanager-gpclient](https://github.com/jdpipe/networkmanager-gpclient) – NetworkManager VPN plugin that uses `gpclient` + ## Licensing ### Trial and Pricing diff --git a/crates/gpapi/src/os_profile/host_identity.rs b/crates/gpapi/src/os_profile/host_identity.rs index f14a3f4..1f4fcd9 100644 --- a/crates/gpapi/src/os_profile/host_identity.rs +++ b/crates/gpapi/src/os_profile/host_identity.rs @@ -362,6 +362,7 @@ mod platform { mod platform { use super::{ ClientOs, NativeHostIdentitySnapshot, derive_uuid_from_seed, fallback_hostname, primary_mac_colon, resolve_host_id, + serial_number, }; use log::debug; @@ -429,9 +430,17 @@ mod platform { } fn collect_linux_serial_number() -> Option { - ["/sys/class/dmi/id/product_serial", "/sys/class/dmi/id/product_uuid"] - .iter() - .find_map(|path| read_linux_identity_file(path)) + resolve_linux_serial_number( + read_linux_identity_file("/sys/class/dmi/id/product_serial"), + collect_linux_product_uuid, + ) + } + + fn resolve_linux_serial_number( + product_serial: Option, + product_uuid: impl FnOnce() -> Option, + ) -> Option { + product_serial.or_else(|| product_uuid().and_then(|uuid| serial_number::vmware_from_uuid(&uuid))) } #[cfg(test)] @@ -446,6 +455,20 @@ mod platform { ); assert_eq!(normalize_uuid("not-a-uuid"), None); } + + #[test] + fn linux_serial_number_preserves_product_serial_and_formats_uuid_fallback() { + let uuid = Some("5a784d56-6461-19ac-9ea9-d36a3b9c6cef".to_string()); + + assert_eq!( + resolve_linux_serial_number(Some("product-serial".to_string()), || uuid.clone()), + Some("product-serial".to_string()) + ); + assert_eq!( + resolve_linux_serial_number(None, || uuid), + Some("VMware-56 4d 78 5a 61 64 ac 19-9e a9 d3 6a 3b 9c 6c ef".to_string()) + ); + } } }