Add -VerifyWatchdog to report watchdog health - #48
Merged
Merged
Conversation
The hardened watchdog fails closed: if its payload no longer matches the hash recorded at install, it refuses to run and only writes a line to its log. That is the right behaviour but it is silent, so a tampered or half-installed watchdog looks the same as a healthy one from outside. Add a read-only -VerifyWatchdog mode that reports whether the task is registered, whether the payload still matches its recorded hash, whether the directory is still locked down, and when it last ran. Exits 0 when healthy and 2 when degraded or not installed, matching the -Verify codes, so it fits a scheduled check. Get-WinnowWatchdogHealth returns the state object and Show-WinnowWatchdogHealth prints it. Extended Test-UpdateWatchdog.ps1 with healthy, hash-mismatch, and not-installed cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The hardened watchdog (#47) fails closed: a payload that no longer matches its recorded hash refuses to run and only writes to its log. Correct, but silent, so a tampered or half-installed watchdog is indistinguishable from a healthy one without inspecting the box.
Adds a read-only
-VerifyWatchdogmode:Get-WinnowWatchdogHealthreturns a state object: task registered, payload present, integrity OK (current SHA256 vs the hash recorded in the admin-onlyHKLMkey), directory still locked down (ACL protected + no user write), schema version, install time, and last run time/result.Show-WinnowWatchdogHealthprints it.Winnow.ps1 -VerifyWatchdogexits0when healthy and2when degraded or not installed, matching the existing-Verifycodes, so it drops into a scheduled check or monitoring script.Read-only: touches no state, needs no mutation.
Validation
Tests\Invoke-StaticValidation.ps1 -RequirePSScriptAnalyzerclean (120 files).Tests/Unit/Test-UpdateWatchdog.ps1(Pester 5.7.1): 14/14 pass (adds healthy, hash-mismatch, not-installed cases with mocked scheduler/registry/ACL cmdlets).Show-WinnowWatchdogHealthon a machine with no watchdog installed: prints the NotInstalled path and returns Healthy=False.Docs: README verification section,
docs/Telemetry-And-Privacy.md, and CHANGELOG[Unreleased]updated.