diff --git a/adk-rust/crates/check-install-kit-vs-repo/src/main.rs b/adk-rust/crates/check-install-kit-vs-repo/src/main.rs index 4ba628b..54c03ed 100644 --- a/adk-rust/crates/check-install-kit-vs-repo/src/main.rs +++ b/adk-rust/crates/check-install-kit-vs-repo/src/main.rs @@ -10,7 +10,8 @@ use sha2::{Digest, Sha256}; const DEFAULT_KIT_DIR: &str = "install-kit-awindows-20260427-211240"; const MANIFEST_NAME: &str = "MANIFEST.txt"; -const ALLOWED_KIT_ONLY_FILES: &[&str] = &["README-INSTALL-KIT.txt"]; +const ALLOWED_KIT_ONLY_FILES: &[&str] = + &["README-INSTALL-KIT.txt", "windows/aw-windows-telemetry.exe"]; const ALLOWED_KIT_ONLY_PREFIXES: &[&str] = &["server-configs-"]; #[derive(Debug, Parser)] diff --git a/adk-rust/crates/rebuild-install-kit/src/main.rs b/adk-rust/crates/rebuild-install-kit/src/main.rs index 65ff781..1f47402 100644 --- a/adk-rust/crates/rebuild-install-kit/src/main.rs +++ b/adk-rust/crates/rebuild-install-kit/src/main.rs @@ -10,10 +10,15 @@ use sha2::{Digest, Sha256}; use zip::write::SimpleFileOptions; const KIT_DIR: &str = "install-kit-awindows-20260427-211240"; -const README: &str = r#"ActivityWatch DetMir Windows Install Kit +const WINDOWS_TELEMETRY_EXE_SOURCE: &str = + "adk-rust/target/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe"; +const WINDOWS_TELEMETRY_EXE_DEST: &str = "windows/aw-windows-telemetry.exe"; + +const README: &str = r#"AWatch-rus Windows Install Kit Includes: - windows/* (deploy scripts, collectors, common module, configs/examples) +- windows/aw-windows-telemetry.exe (Rust Windows telemetry runtime) - ansible/* (Windows and AW server playbooks, examples, inventory, tasks) - aw-server/* (server installer, health orchestrator, RU patch loader, host groups, default settings) - scripts/* (install-kit rebuild/validation, quality gates, browser/web smoke checks) @@ -138,6 +143,12 @@ fn rebuild(root: &Path) -> Result<()> { { copy_file(root, &kit, rel)?; } + copy_file_as( + root, + &kit, + WINDOWS_TELEMETRY_EXE_SOURCE, + WINDOWS_TELEMETRY_EXE_DEST, + )?; write_file_replace(&kit.join("README-INSTALL-KIT.txt"), README.as_bytes()) .with_context(|| format!("write {}", kit.join("README-INSTALL-KIT.txt").display()))?; @@ -166,8 +177,12 @@ fn remove_server_config_dirs(kit: &Path) -> Result<()> { } fn copy_file(root: &Path, kit: &Path, rel: &str) -> Result<()> { - let src = root.join(rel); - let dest = kit.join(rel); + copy_file_as(root, kit, rel, rel) +} + +fn copy_file_as(root: &Path, kit: &Path, src_rel: &str, dest_rel: &str) -> Result<()> { + let src = root.join(src_rel); + let dest = kit.join(dest_rel); fs::create_dir_all(dest.parent().context("destination parent")?) .with_context(|| format!("create parent for {}", dest.display()))?; let bytes = fs::read(&src).with_context(|| format!("read {}", src.display()))?; diff --git a/adk-rust/crates/validate-install-kit/src/main.rs b/adk-rust/crates/validate-install-kit/src/main.rs index 8398da7..82474ea 100644 --- a/adk-rust/crates/validate-install-kit/src/main.rs +++ b/adk-rust/crates/validate-install-kit/src/main.rs @@ -16,6 +16,7 @@ const MANIFEST_NAME: &str = "MANIFEST.txt"; const REQUIRED_RELATIVE_FILES: &[&str] = &[ "MANIFEST.txt", "README-INSTALL-KIT.txt", + "windows/aw-windows-telemetry.exe", "windows/deploy-ensemble.ps1", "windows/validate-deployment.ps1", "ansible/deploy_aw_windows.yml", @@ -473,8 +474,8 @@ mod tests { ); let report = validate(&cfg); assert!(report.ok, "{report:#?}"); - assert_eq!(report.manifest_completeness.tracked_files, 9); - assert_eq!(report.archive_composition.files, 10); + assert_eq!(report.manifest_completeness.tracked_files, 10); + assert_eq!(report.archive_composition.files, 11); } #[test] @@ -521,6 +522,7 @@ mod tests { let kit = root.join(DEFAULT_KIT_DIR); for rel in [ "windows/deploy-ensemble.ps1", + "windows/aw-windows-telemetry.exe", "windows/validate-deployment.ps1", "ansible/deploy_aw_windows.yml", "aw-server/install_aw_server.sh", @@ -537,6 +539,7 @@ mod tests { let files = [ "README-INSTALL-KIT.txt", "windows/deploy-ensemble.ps1", + "windows/aw-windows-telemetry.exe", "windows/validate-deployment.ps1", "ansible/deploy_aw_windows.yml", "aw-server/install_aw_server.sh", @@ -561,6 +564,7 @@ mod tests { ("README-INSTALL-KIT.txt", b"readme".as_slice()), ("MANIFEST.txt", b"manifest".as_slice()), ("windows/deploy-ensemble.ps1", b"deploy".as_slice()), + ("windows/aw-windows-telemetry.exe", b"rust-exe".as_slice()), ("windows/validate-deployment.ps1", b"validate".as_slice()), ("ansible/deploy_aw_windows.yml", b"ansible".as_slice()), ("aw-server/install_aw_server.sh", b"server".as_slice()), diff --git a/adk-rust/crates/verify-innosetup-installer/src/main.rs b/adk-rust/crates/verify-innosetup-installer/src/main.rs index 8e43c8b..dcc0fa5 100644 --- a/adk-rust/crates/verify-innosetup-installer/src/main.rs +++ b/adk-rust/crates/verify-innosetup-installer/src/main.rs @@ -14,8 +14,11 @@ const REQUIRED_FILES: &[&str] = &[ "windows/AWatchRusCollectorGuardService.cs", "windows/aw-collector-guard.ps1", "windows/install-collector-guard-service.ps1", + "windows/aw-windows-telemetry.exe", "windows/dlp-policy.native-cross-os.example.json", ]; +const WINDOWS_TELEMETRY_EXE_SOURCE: &str = + "adk-rust/target/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe"; const GUARD_MARKER: &str = "collector guard self-test OK"; #[derive(Debug, Parser)] @@ -145,7 +148,11 @@ fn verify(root: &Path, installer: &Path, wineprefix: &Path) -> Report { let mut checked = Vec::new(); for rel in REQUIRED_FILES { let extracted = install_dir.join(rel); - let repo = root.join(rel); + let repo = if *rel == "windows/aw-windows-telemetry.exe" { + root.join(WINDOWS_TELEMETRY_EXE_SOURCE) + } else { + root.join(rel) + }; if !extracted.is_file() { errors.push(format!("Missing extracted file: {rel}")); continue; diff --git a/ansible/deploy_aw_windows.yml b/ansible/deploy_aw_windows.yml index 8992980..568bcc8 100644 --- a/ansible/deploy_aw_windows.yml +++ b/ansible/deploy_aw_windows.yml @@ -9,7 +9,10 @@ aw_windows_repo_root: "{{ playbook_dir | dirname }}" aw_windows_deploy_root: "C:\\Program Files\\AWatch-rus" aw_windows_rust_target_root: "{{ lookup('env', 'CARGO_TARGET_DIR') | default('/tmp/detmir-adk-rust-target', true) }}" - aw_windows_telemetry_exe_source: "{{ aw_windows_rust_target_root }}/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe" + aw_windows_telemetry_exe_source_candidates: + - "{{ aw_windows_repo_root }}/windows/aw-windows-telemetry.exe" + - "{{ aw_windows_rust_target_root }}/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe" + aw_windows_telemetry_exe_source: "" aw_windows_server_scheme: "http" aw_windows_server_port: 5600 aw_windows_package_version: "v0.13.2" @@ -198,9 +201,41 @@ - web-category-rules.example.json - dlp-policy.example.json + - name: Проверить кандидаты Rust Windows telemetry binary + ansible.builtin.stat: + path: "{{ item }}" + loop: "{{ aw_windows_telemetry_exe_source_candidates }}" + delegate_to: localhost + become: false + register: aw_windows_telemetry_exe_candidate_stats + + - name: Выбрать Rust Windows telemetry binary + ansible.builtin.set_fact: + aw_windows_telemetry_exe_source_effective: >- + {{ + aw_windows_telemetry_exe_source + if (aw_windows_telemetry_exe_source | string | length) > 0 + else ( + aw_windows_telemetry_exe_candidate_stats.results + | selectattr('stat.exists') + | map(attribute='item') + | list + | first + | default('') + ) + }} + + - name: Проверить наличие Rust Windows telemetry binary + ansible.builtin.fail: + msg: >- + Не найден aw-windows-telemetry.exe. Соберите его командой: + cargo build --release --target x86_64-pc-windows-gnu -p aw-windows-telemetry + или используйте актуальный install-kit с windows/aw-windows-telemetry.exe. + when: aw_windows_telemetry_exe_source_effective | length == 0 + - name: Загрузить Rust Windows telemetry binary ansible.windows.win_copy: - src: "{{ aw_windows_telemetry_exe_source }}" + src: "{{ aw_windows_telemetry_exe_source_effective }}" dest: "{{ aw_windows_deploy_root }}\\windows\\aw-windows-telemetry.exe" - name: Нормализовать кодировку PowerShell файлов (UTF-8 BOM для Windows PowerShell) diff --git a/scripts/generate_release_sbom_v0_2.sh b/scripts/generate_release_sbom_v0_2.sh index 9604bd4..293e713 100755 --- a/scripts/generate_release_sbom_v0_2.sh +++ b/scripts/generate_release_sbom_v0_2.sh @@ -67,7 +67,7 @@ cyclonedx = { "timestamp": generated_at, "component": { "type": "application", - "name": "DetMir AWatch-rus", + "name": "AWatch-rus", "version": "release-readiness-v0.2", "bom-ref": "pkg:generic/detmir-awatch-rus@release-readiness-v0.2", }, @@ -83,7 +83,7 @@ spdx = { "spdxVersion": "SPDX-2.3", "dataLicense": "CC0-1.0", "SPDXID": "SPDXRef-DOCUMENT", - "name": "DetMir AWatch-rus release-readiness-v0.2 Rust SBOM", + "name": "AWatch-rus release-readiness-v0.2 Rust SBOM", "documentNamespace": f"https://github.com/igor04091968/AWatch-rus/sbom/{commit}", "creationInfo": { "created": generated_at, diff --git a/scripts/verify_innosetup_installer.sh b/scripts/verify_innosetup_installer.sh index fb89657..4d1a049 100644 --- a/scripts/verify_innosetup_installer.sh +++ b/scripts/verify_innosetup_installer.sh @@ -50,6 +50,7 @@ required_files=( windows/AWatchRusCollectorGuardService.cs windows/aw-collector-guard.ps1 windows/install-collector-guard-service.ps1 + windows/aw-windows-telemetry.exe windows/dlp-policy.native-cross-os.example.json ) @@ -59,7 +60,11 @@ for rel in "${required_files[@]}"; do echo "Missing extracted file: $rel" >&2 exit 1 fi - if ! cmp -s "$rel" "$extracted"; then + repo_rel="$rel" + if [[ "$rel" == "windows/aw-windows-telemetry.exe" ]]; then + repo_rel="adk-rust/target/x86_64-pc-windows-gnu/release/aw-windows-telemetry.exe" + fi + if ! cmp -s "$repo_rel" "$extracted"; then echo "Extracted file differs from repo: $rel" >&2 exit 1 fi diff --git a/windows/installkit/innosetup/AWatch-rus-InnoSetup.iss b/windows/installkit/innosetup/AWatch-rus-InnoSetup.iss index b2da005..3d0bc50 100644 --- a/windows/installkit/innosetup/AWatch-rus-InnoSetup.iss +++ b/windows/installkit/innosetup/AWatch-rus-InnoSetup.iss @@ -47,6 +47,7 @@ Source: "..\..\deploy-ensemble.ps1"; DestDir: "{app}\windows"; Flags: ignorevers Source: "..\..\AWatchRusCollectorGuardService.cs"; DestDir: "{app}\windows"; Flags: ignoreversion Source: "..\..\aw-collector-guard.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion Source: "..\..\install-collector-guard-service.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion +Source: "..\..\..\adk-rust\target\x86_64-pc-windows-gnu\release\aw-windows-telemetry.exe"; DestDir: "{app}\windows"; Flags: ignoreversion Source: "..\..\hardening-recovery.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion Source: "..\..\validate-deployment.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion Source: "..\..\migrate-awatch-rus-paths.ps1"; DestDir: "{app}\windows"; Flags: ignoreversion diff --git a/windows/installkit/innosetup/AWatch-rus-InstallKit.exe b/windows/installkit/innosetup/AWatch-rus-InstallKit.exe index fda871d..ca77df1 100644 --- a/windows/installkit/innosetup/AWatch-rus-InstallKit.exe +++ b/windows/installkit/innosetup/AWatch-rus-InstallKit.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2736b7cf6cad3259c6b4c30e311e701d3617d2f013ceaed9b8b6702b593c442e -size 115998720 +oid sha256:cdd8c2e9328aeed22ce9260d6a901d92290b39b3ffd95abf25f808ef4958c584 +size 119092132 diff --git a/windows/installkit/innosetup/BUILD.md b/windows/installkit/innosetup/BUILD.md index 16df503..7e281c7 100644 --- a/windows/installkit/innosetup/BUILD.md +++ b/windows/installkit/innosetup/BUILD.md @@ -11,6 +11,12 @@ ## Compile +Build the Rust Windows runtime first: + +```sh +cargo build --release --target x86_64-pc-windows-gnu -p aw-windows-telemetry +``` + From this folder: ```bat diff --git a/windows/installkit/innosetup/innosetup-rdp-package-filelist.md b/windows/installkit/innosetup/innosetup-rdp-package-filelist.md index 450b516..f8c038d 100644 --- a/windows/installkit/innosetup/innosetup-rdp-package-filelist.md +++ b/windows/installkit/innosetup/innosetup-rdp-package-filelist.md @@ -32,6 +32,7 @@ - `windows/AWatchRusCollectorGuardService.cs` - `windows/aw-collector-guard.ps1` - `windows/install-collector-guard-service.ps1` +- `windows/aw-windows-telemetry.exe` - `windows/hardening-recovery.ps1` - `windows/validate-deployment.ps1` - `windows/migrate-awatch-rus-paths.ps1`