mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
Merge remote-tracking branch 'origin/main' into feat/auth-callback-handler
This commit is contained in:
12 files changed
+460
-49
No files matched your search
@@ -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
|
||||||
@@ -24,6 +24,11 @@ jobs:
|
|||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v31
|
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
|
- name: Update flake hashes
|
||||||
env:
|
env:
|
||||||
RELEASE_VERSION: ${{ inputs.version }}
|
RELEASE_VERSION: ${{ inputs.version }}
|
||||||
@@ -39,7 +44,9 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: updated-flake
|
name: updated-flake
|
||||||
path: flake.nix
|
path: |
|
||||||
|
flake.nix
|
||||||
|
flake.lock
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
validate-nix-prebuilt:
|
validate-nix-prebuilt:
|
||||||
@@ -48,22 +55,22 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
runner:
|
||||||
- runner: ubuntu-latest
|
- ubuntu-latest
|
||||||
nixpkgs: nixos-25.11
|
- ubuntu-24.04-arm
|
||||||
- runner: ubuntu-latest
|
nixpkgs:
|
||||||
nixpkgs: nixos-26.05
|
- locked
|
||||||
|
- nixos-25.11
|
||||||
|
- nixos-26.05
|
||||||
|
- nixpkgs-unstable
|
||||||
|
exclude:
|
||||||
- runner: ubuntu-24.04-arm
|
- runner: ubuntu-24.04-arm
|
||||||
nixpkgs: nixos-25.11
|
nixpkgs: locked
|
||||||
- runner: ubuntu-24.04-arm
|
|
||||||
nixpkgs: nixos-26.05
|
|
||||||
name: validate-nix-prebuilt (${{ matrix.nixpkgs }}, ${{ matrix.runner }})
|
name: validate-nix-prebuilt (${{ matrix.nixpkgs }}, ${{ matrix.runner }})
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout GlobalProtect-openconnect
|
- name: Checkout GlobalProtect-openconnect
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Download updated flake
|
- name: Download updated flake
|
||||||
uses: actions/download-artifact@v8
|
uses: actions/download-artifact@v8
|
||||||
@@ -75,11 +82,19 @@ jobs:
|
|||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
|
|
||||||
- name: Build prebuilt Nix package
|
- name: Build prebuilt Nix package
|
||||||
|
env:
|
||||||
|
NIXPKGS: ${{ matrix.nixpkgs }}
|
||||||
run: |
|
run: |
|
||||||
|
if [[ "$NIXPKGS" == "locked" ]]; then
|
||||||
nix build .#prebuilt \
|
nix build .#prebuilt \
|
||||||
--override-input nixpkgs "github:NixOS/nixpkgs/${{ matrix.nixpkgs }}" \
|
|
||||||
--extra-experimental-features "nix-command flakes" \
|
--extra-experimental-features "nix-command flakes" \
|
||||||
--print-build-logs
|
--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
|
- name: Inspect prebuilt Nix package
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.idea
|
.idea
|
||||||
|
.DS_Store
|
||||||
/target
|
/target
|
||||||
.pnpm-store
|
.pnpm-store
|
||||||
.env
|
.env
|
||||||
|
|||||||
Generated
+1
@@ -1924,6 +1924,7 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
"uuid",
|
"uuid",
|
||||||
|
"uzers",
|
||||||
"whoami",
|
"whoami",
|
||||||
"xmltree",
|
"xmltree",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -241,7 +241,10 @@ This repository includes a flake for NixOS integration.
|
|||||||
|
|
||||||
#### Installation Steps
|
#### 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
|
```nix
|
||||||
{
|
{
|
||||||
@@ -260,11 +263,11 @@ Add the flake input and package to your `flake.nix`:
|
|||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
|
globalprotect-openconnect.nixosModules.default
|
||||||
{
|
{
|
||||||
services.ayatana-indicators.enable = true;
|
programs.globalprotect-openconnect.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
globalprotect-openconnect.packages.${system}.default
|
|
||||||
nixpkgs.legacyPackages.${system}.gnomeExtensions.appindicator
|
nixpkgs.legacyPackages.${system}.gnomeExtensions.appindicator
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ compile-time.workspace = true
|
|||||||
netdev.workspace = true
|
netdev.workspace = true
|
||||||
xmltree.workspace = true
|
xmltree.workspace = true
|
||||||
uuid = { workspace = true, features = ["v5"] }
|
uuid = { workspace = true, features = ["v5"] }
|
||||||
|
uzers.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["webview-auth"]
|
default = ["webview-auth"]
|
||||||
|
|||||||
@@ -40,6 +40,19 @@ struct RealTimeProtection {
|
|||||||
value: bool,
|
value: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
struct UfwInfo {
|
||||||
|
version: String,
|
||||||
|
is_enabled: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
struct ClamAvInfo {
|
||||||
|
version: String,
|
||||||
|
definitions_version: Option<String>,
|
||||||
|
real_time_protection: bool,
|
||||||
|
}
|
||||||
|
|
||||||
/// Host information for HIP reporting
|
/// Host information for HIP reporting
|
||||||
struct HostInfo {
|
struct HostInfo {
|
||||||
/// Common for all OSes, e.g., "Apple", "Microsoft", "Linux"
|
/// Common for all OSes, e.g., "Apple", "Microsoft", "Linux"
|
||||||
@@ -55,6 +68,8 @@ struct HostInfo {
|
|||||||
domain: String,
|
domain: String,
|
||||||
network_interfaces: Vec<NetworkInterface>,
|
network_interfaces: Vec<NetworkInterface>,
|
||||||
defender: Option<DefenderInfo>,
|
defender: Option<DefenderInfo>,
|
||||||
|
clamav: Option<ClamAvInfo>,
|
||||||
|
ufw: Option<UfwInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HostInfo {
|
impl HostInfo {
|
||||||
@@ -286,6 +301,8 @@ impl<'p, 'a> HostInfoCollector<'p, 'a> {
|
|||||||
domain: self.domain_for_profile(),
|
domain: self.domain_for_profile(),
|
||||||
network_interfaces: interfaces,
|
network_interfaces: interfaces,
|
||||||
defender: self.defender_for_profile(),
|
defender: self.defender_for_profile(),
|
||||||
|
clamav: self.clamav_for_profile(),
|
||||||
|
ufw: self.ufw_for_profile(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +356,126 @@ impl<'p, 'a> HostInfoCollector<'p, 'a> {
|
|||||||
ClientOs::Mac | ClientOs::Windows => None,
|
ClientOs::Mac | ClientOs::Windows => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clamav_for_profile(&self) -> Option<ClamAvInfo> {
|
||||||
|
match self.profile.client_os() {
|
||||||
|
ClientOs::Linux => detect_clamav(),
|
||||||
|
ClientOs::Mac | ClientOs::Windows => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ufw_for_profile(&self) -> Option<UfwInfo> {
|
||||||
|
match self.profile.client_os() {
|
||||||
|
ClientOs::Linux => detect_ufw(),
|
||||||
|
ClientOs::Mac | ClientOs::Windows => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn detect_clamav() -> Option<ClamAvInfo> {
|
||||||
|
let version_out = Command::new("clamscan").arg("--version").output().ok()?;
|
||||||
|
if !version_out.status.success() {
|
||||||
|
debug!("clamscan not found or failed");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let version_str = String::from_utf8(version_out.stdout).ok()?;
|
||||||
|
let (version, definitions_version) = parse_clamav_version(&version_str)?;
|
||||||
|
|
||||||
|
let rtp_out = Command::new("systemctl")
|
||||||
|
.args(["is-active", "clamav-onaccess.service"])
|
||||||
|
.output()
|
||||||
|
.ok()?;
|
||||||
|
|
||||||
|
let real_time_protection = rtp_out.status.success();
|
||||||
|
|
||||||
|
Some(ClamAvInfo {
|
||||||
|
version,
|
||||||
|
definitions_version,
|
||||||
|
real_time_protection,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn detect_ufw() -> Option<UfwInfo> {
|
||||||
|
let version_out = Command::new("ufw").arg("version").output().ok()?;
|
||||||
|
if !version_out.status.success() {
|
||||||
|
debug!("ufw not found or failed");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let version_str = String::from_utf8(version_out.stdout).ok()?;
|
||||||
|
let version = parse_ufw_version(&version_str)?;
|
||||||
|
|
||||||
|
let is_root = uzers::get_effective_uid() == 0;
|
||||||
|
let status_out = ufw_status_command(is_root).output().ok()?;
|
||||||
|
if !status_out.status.success() {
|
||||||
|
if is_root {
|
||||||
|
log::warn!("ufw status failed while running as root");
|
||||||
|
} else {
|
||||||
|
log::warn!("sudo -n ufw status failed. You may need to configure sudoers to allow execution without a password.");
|
||||||
|
}
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let status_str = String::from_utf8(status_out.stdout).ok()?;
|
||||||
|
let is_enabled = parse_ufw_status(&status_str)?;
|
||||||
|
|
||||||
|
Some(UfwInfo { version, is_enabled })
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ufw_status_command(is_root: bool) -> Command {
|
||||||
|
let mut command = if is_root {
|
||||||
|
Command::new("ufw")
|
||||||
|
} else {
|
||||||
|
let mut command = Command::new("sudo");
|
||||||
|
command.args(["-n", "ufw"]);
|
||||||
|
command
|
||||||
|
};
|
||||||
|
|
||||||
|
command.arg("status").env("LC_ALL", "C");
|
||||||
|
command
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_clamav_version(output: &str) -> Option<(String, Option<String>)> {
|
||||||
|
let mut output_parts = output.split_whitespace();
|
||||||
|
if output_parts.next()? != "ClamAV" {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut version_parts = output_parts.next()?.split('/');
|
||||||
|
let version = version_parts.next()?;
|
||||||
|
if version.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let definitions_version = version_parts
|
||||||
|
.next()
|
||||||
|
.filter(|definitions_version| !definitions_version.is_empty())
|
||||||
|
.map(str::to_string);
|
||||||
|
|
||||||
|
Some((version.to_string(), definitions_version))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_ufw_version(output: &str) -> Option<String> {
|
||||||
|
let mut output_parts = output.split_whitespace();
|
||||||
|
if output_parts.next()? != "ufw" {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
output_parts.next().map(str::to_string)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_ufw_status(output: &str) -> Option<bool> {
|
||||||
|
let status = output
|
||||||
|
.lines()
|
||||||
|
.find_map(|line| line.trim().strip_prefix("Status:"))?
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
match status {
|
||||||
|
"active" => Some(true),
|
||||||
|
"inactive" => Some(false),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn detect_microsoft_defender_blocking() -> Option<DefenderInfo> {
|
fn detect_microsoft_defender_blocking() -> Option<DefenderInfo> {
|
||||||
@@ -438,6 +575,7 @@ fn derive_windows_network_name(host_id: &str, iface: &NetworkInterface) -> Strin
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use gpapi::os_profile::runtime_client_os;
|
use gpapi::os_profile::runtime_client_os;
|
||||||
|
use std::ffi::OsStr;
|
||||||
|
|
||||||
fn make_hip_args(client_os: Os) -> HipArgs {
|
fn make_hip_args(client_os: Os) -> HipArgs {
|
||||||
HipArgs {
|
HipArgs {
|
||||||
@@ -577,4 +715,50 @@ mod tests {
|
|||||||
fn rejects_invalid_microsoft_defender_health_json() {
|
fn rejects_invalid_microsoft_defender_health_json() {
|
||||||
assert!(parse_defender_info("{}").is_none());
|
assert!(parse_defender_info("{}").is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_clamav_version() {
|
||||||
|
let version =
|
||||||
|
parse_clamav_version("ClamAV 1.4.3/27562/Sun Aug 31 10:23:42 2026").expect("ClamAV version should parse");
|
||||||
|
|
||||||
|
assert_eq!(version, ("1.4.3".to_string(), Some("27562".to_string())));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_clamav_version_without_definitions_version() {
|
||||||
|
assert_eq!(parse_clamav_version("ClamAV 1.4.3"), Some(("1.4.3".to_string(), None)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_ufw_version() {
|
||||||
|
assert_eq!(parse_ufw_version("ufw 0.36.2\n"), Some("0.36.2".to_string()));
|
||||||
|
assert_eq!(parse_ufw_version("unexpected output\n"), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parses_ufw_status() {
|
||||||
|
assert_eq!(parse_ufw_status("Status: active\n"), Some(true));
|
||||||
|
assert_eq!(parse_ufw_status("Status: inactive\n"), Some(false));
|
||||||
|
assert_eq!(parse_ufw_status("Status: unknown\n"), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn runs_ufw_status_directly_as_root() {
|
||||||
|
let command = ufw_status_command(true);
|
||||||
|
|
||||||
|
assert_eq!(command.get_program(), OsStr::new("ufw"));
|
||||||
|
assert!(command.get_args().eq(["status"].into_iter().map(OsStr::new)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn runs_ufw_status_through_non_interactive_sudo_as_non_root() {
|
||||||
|
let command = ufw_status_command(false);
|
||||||
|
|
||||||
|
assert_eq!(command.get_program(), OsStr::new("sudo"));
|
||||||
|
assert!(
|
||||||
|
command
|
||||||
|
.get_args()
|
||||||
|
.eq(["-n", "ufw", "status"].into_iter().map(OsStr::new))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -218,8 +218,8 @@
|
|||||||
</entry>
|
</entry>
|
||||||
{% elif host_info.os_vendor == "Linux" -%}
|
{% elif host_info.os_vendor == "Linux" -%}
|
||||||
<entry name="anti-malware">
|
<entry name="anti-malware">
|
||||||
{% if let Some(defender) = &host_info.defender -%}
|
|
||||||
<list>
|
<list>
|
||||||
|
{% if let Some(defender) = &host_info.defender %}
|
||||||
<entry>
|
<entry>
|
||||||
<ProductInfo>
|
<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 }}">
|
<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 +228,17 @@
|
|||||||
<last-full-scan-time>n/a</last-full-scan-time>
|
<last-full-scan-time>n/a</last-full-scan-time>
|
||||||
</ProductInfo>
|
</ProductInfo>
|
||||||
</entry>
|
</entry>
|
||||||
</list>
|
|
||||||
{% else -%}
|
|
||||||
<list/>
|
|
||||||
{% endif -%}
|
{% 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>
|
||||||
<entry name="disk-backup">
|
<entry name="disk-backup">
|
||||||
<list/>
|
<list/>
|
||||||
@@ -254,6 +261,14 @@
|
|||||||
</entry>
|
</entry>
|
||||||
<entry name="firewall">
|
<entry name="firewall">
|
||||||
<list>
|
<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>
|
<entry>
|
||||||
<ProductInfo>
|
<ProductInfo>
|
||||||
<Prod name="IPTables" version="1.8.4" vendor="IPTables">
|
<Prod name="IPTables" version="1.8.4" vendor="IPTables">
|
||||||
|
|||||||
Generated
+3
-3
@@ -63,11 +63,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1766410818,
|
"lastModified": 1787964612,
|
||||||
"narHash": "sha256-ruVneSx6wFy5PMw1ow3BE+znl653TJ6+eeNUj4B/9y8=",
|
"narHash": "sha256-0N9nghg3nwzX6b6qc77EzjR9cu/Z+UR66FlfsCqiURs=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "3a7affa77a5a539afa1c7859e2c31abdb1aeadf3",
|
"rev": "e8be7818e19ada32105a8af937a6a473b38167ca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -20,13 +20,10 @@
|
|||||||
nixpkgs,
|
nixpkgs,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
|
||||||
system:
|
|
||||||
let
|
let
|
||||||
pkgs = (import nixpkgs) {
|
mkPackageSet =
|
||||||
inherit system;
|
pkgs:
|
||||||
overlays = [ (import rust-overlay) ];
|
let
|
||||||
};
|
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
|
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
@@ -41,39 +38,67 @@
|
|||||||
rustc = toolchain;
|
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";
|
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;
|
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
||||||
|
|
||||||
gpguiHashes = {
|
gpguiHashes = {
|
||||||
x86_64 = "sha256-wPLsH/b/ZSo2pA/kU1HUGiQ98k8xSihyxGyf5o6tvyU=";
|
x86_64 = "sha256-uVn3hJkKrjKz3mzRamxFu+0rE7OjLtMlT16d14XPcq4=";
|
||||||
aarch64 = "sha256-WFyPhGD9fLAVYGeMSrMcZhSdfM99uVmWPrH68O+4BfE=";
|
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";
|
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/gpgui_${cpu}.bin.tar.xz";
|
||||||
hash = gpguiHashes.${cpu};
|
hash = gpguiHashes.${cpu};
|
||||||
};
|
};
|
||||||
|
|
||||||
binaryHashes = {
|
gpgui = unpackReleaseAsset {
|
||||||
x86_64 = "sha256-spaKxruu15ro5lir14nAfy8MPXNQhaoCXcG4PDZ9lfM=";
|
name = "gpgui-${version}-${cpu}";
|
||||||
aarch64 = "sha256-iu/zE4B4gjk1I5PQY0m/59ZoJ/k5focT0CxYYlJi7+A=";
|
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";
|
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect_${version}_${cpu}.bin.tar.xz";
|
||||||
hash = binaryHashes.${cpu};
|
hash = binaryHashes.${cpu};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
binaryPackage = unpackReleaseAsset {
|
||||||
|
name = "globalprotect-openconnect-${version}-${cpu}-binary";
|
||||||
|
archive = binaryArchive;
|
||||||
|
};
|
||||||
|
|
||||||
linuxRuntimeDependencies = with pkgs; [
|
linuxRuntimeDependencies = with pkgs; [
|
||||||
glib-networking
|
glib-networking
|
||||||
libayatana-appindicator
|
libayatana-appindicator
|
||||||
xdg-utils
|
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 =
|
linuxBuildInputs =
|
||||||
with pkgs;
|
with pkgs;
|
||||||
[
|
[
|
||||||
@@ -217,6 +242,7 @@
|
|||||||
${installNixosPolkitRule}
|
${installNixosPolkitRule}
|
||||||
''
|
''
|
||||||
+ ''
|
+ ''
|
||||||
|
${rewriteVpncScriptToolPaths}
|
||||||
${rewriteSourceInstallPaths}
|
${rewriteSourceInstallPaths}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@@ -249,6 +275,8 @@
|
|||||||
|
|
||||||
install -Dm755 ${gpgui}/gpgui $out/bin/gpgui
|
install -Dm755 ${gpgui}/gpgui $out/bin/gpgui
|
||||||
|
|
||||||
|
${rewriteVpncScriptToolPaths}
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@@ -443,6 +471,49 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
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`
|
# For `nix build`
|
||||||
packages = {
|
packages = {
|
||||||
@@ -469,5 +540,8 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
))
|
||||||
|
// {
|
||||||
|
nixosModules.default = nixosModule;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,8 @@ set -euo pipefail
|
|||||||
release_version="${1:-}"
|
release_version="${1:-}"
|
||||||
release_tag="${2:-}"
|
release_tag="${2:-}"
|
||||||
|
|
||||||
if git diff --quiet -- flake.nix; then
|
if git diff --quiet -- flake.nix flake.lock; then
|
||||||
echo "flake.nix hashes are already up to date"
|
echo "flake hashes and lock are already up to date"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -21,12 +21,12 @@ fi
|
|||||||
|
|
||||||
branch_suffix="v${version}"
|
branch_suffix="v${version}"
|
||||||
title="chore: update flake hashes for 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
|
if [[ "$release_tag" != "v$version" ]]; then
|
||||||
branch_suffix="${branch_suffix}-${release_tag}"
|
branch_suffix="${branch_suffix}-${release_tag}"
|
||||||
title="chore: update flake hashes for v${version} from ${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
|
fi
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
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#-+$##')"
|
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}"
|
branch="chore/flake-${source_branch_slug}"
|
||||||
git switch -C "$branch"
|
git switch -C "$branch"
|
||||||
git add flake.nix
|
git add flake.nix flake.lock
|
||||||
git commit -m "$title"
|
git commit -m "$title"
|
||||||
git push --force origin "$branch"
|
git push --force origin "$branch"
|
||||||
echo "Updated snapshot flake hashes on branch $branch from $source_branch; skipping PR creation"
|
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}"
|
branch="chore/update-flake-hashes-${branch_suffix}"
|
||||||
|
|
||||||
git switch -C "$branch"
|
git switch -C "$branch"
|
||||||
git add flake.nix
|
git add flake.nix flake.lock
|
||||||
git commit -m "$title"
|
git commit -m "$title"
|
||||||
git push --force origin "$branch"
|
git push --force origin "$branch"
|
||||||
|
|
||||||
if gh pr view "$branch" --json number > /tmp/flake-pr.json 2> /dev/null; then
|
pr_number="$(gh pr list --head "$branch" --state open --json number --jq '.[0].number')"
|
||||||
pr_number="$(jq -r '.number' /tmp/flake-pr.json)"
|
if [[ -n "$pr_number" ]]; then
|
||||||
gh pr edit "$pr_number" --title "$title" --body "$body"
|
gh pr edit "$pr_number" --title "$title" --body "$body"
|
||||||
else
|
else
|
||||||
gh pr create --title "$title" --body "$body" --base main --head "$branch"
|
gh pr create --title "$title" --body "$body" --base main --head "$branch"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ FLAKE_FILE="$PROJECT_DIR/flake.nix"
|
|||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 [version] [release-tag]"
|
echo "Usage: $0 [version] [release-tag]"
|
||||||
echo
|
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 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."
|
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
|
fi
|
||||||
|
|
||||||
if ! command -v nix > /dev/null; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -61,7 +61,6 @@ prefetch_hash() {
|
|||||||
store prefetch-file \
|
store prefetch-file \
|
||||||
--hash-type sha256 \
|
--hash-type sha256 \
|
||||||
--json \
|
--json \
|
||||||
--unpack \
|
|
||||||
"$url" \
|
"$url" \
|
||||||
| jq -r '.hash'; then
|
| jq -r '.hash'; then
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in new issue
Block a user