Merge remote-tracking branch 'origin/feature/windows-update-2892' into chore/merge-train-windows-depth
# Conflicts: # CHANGELOG.md # README.md # napalm_windows/windows.py # tools/harvest.py
This commit is contained in:
commit
6fbf2f7ef6
13 files changed
+1486
-5
No files matched your search
@@ -49,6 +49,9 @@ handshake once.
|
||||
| `get_host_status` | `Microsoft.Update.SystemInfo`, the registry's restart markers, the Windows Update policy and history, the system drive |
|
||||
| `get_host_events` | `Get-WinEvent -FilterXPath`, three bounded queries over the System and Application logs. See *Host events* |
|
||||
| `get_log_sources` | `Get-WinEvent -ListLog *`: every event channel switched on and holding records, as kind `eventlog` |
|
||||
| `refresh_available_updates` / `get_available_updates` | The Windows Update Agent's search (`Microsoft.Update.Session`), kept in the registry for the poll; the host's update history leaves out what was installed since. See *Windows Update* |
|
||||
| `apply_updates` | A one-shot SYSTEM scheduled task that searches again and installs only the exact updates chosen; never restarts. See *Windows Update* |
|
||||
| `get_update_history` | `IUpdateSearcher.QueryHistory`, the newest 300 entries |
|
||||
| `get_time_sync` / `configure_time_sync` | w32time's registry values (group policy first), `w32tm /query /status`, the registry's `TimeZoneInformation`; writes `NtpServer`/`Type` + `w32tm /config /update`, `Set-TimeZone`. See *Time sync* |
|
||||
| `get_disks` / `get_disk_smart` / `get_disk_pools` / `get_volumes` | `Get-PhysicalDisk`, `Get-StorageReliabilityCounter`, `Get-StoragePool -IsPrimordial $false`, `Get-Volume` + `Get-Partition`; no smartctl. See *Storage* |
|
||||
| `get_login_accounts` | `Get-LocalUser`, `Win32_UserProfile`, `WinNT:` (`BadPasswordAttempts`, `IsAccountLocked`, group members), `secedit /export /areas USER_RIGHTS`, `fDenyTSConnections`. See *Logins* |
|
||||
@@ -243,6 +246,47 @@ Not yet: packages, Windows Update, health metrics, Hyper-V.
|
||||
monthly cumulative update.
|
||||
|
||||
Not yet: Windows Update, health metrics, Hyper-V.
|
||||
### Windows Update
|
||||
|
||||
napalm-device-types' `UpdateMixin`, through the Windows Update Agent's COM API.
|
||||
|
||||
* **The search is the refresh.** `refresh_available_updates` searches the source the
|
||||
host is configured for -- Windows Update, or the WSUS server group policy names --
|
||||
for `IsInstalled=0 and IsHidden=0 and Type='Software'`: no drivers. A search takes
|
||||
minutes, so the poll never runs one. It keeps its reading under
|
||||
`HKLM\SOFTWARE\napalm-windows\WindowsUpdate` (only administrators and SYSTEM may write
|
||||
there), and `get_available_updates` reads that back, leaving out what the host's
|
||||
history shows installed since. Before the first search it raises
|
||||
`PackageIndexMissing`, which a refresh cures.
|
||||
* **Names.** An update is named by what it keeps from month to month: its title without
|
||||
the month, the KB article and the version, as a package name
|
||||
(`Cumulative-Update-for-Microsoft-server-operating-system-version-21H2-for-x64-based-Systems`).
|
||||
Next month's cumulative update takes this one's place under the same name, so the time
|
||||
a host has waited for it is not reset each month. `new_version` and `advisories` are
|
||||
its KB articles, `cves` its `CveIDs`, `vendor_severity` its `MsrcSeverity`, `title`
|
||||
its title. A security update, a definition update or one naming CVEs is `security`;
|
||||
another classified one is not.
|
||||
* **Not pending:** optional updates (`BrowseOnly`: previews Windows does not install by
|
||||
itself) and feature upgrades -- this path installs neither.
|
||||
* **Installing** (`apply_updates`). Windows refuses a download or an install to a
|
||||
network logon (`E_ACCESSDENIED`), so a run is a one-shot task
|
||||
`\napalm-windows\update-run-<id>` running as SYSTEM. Its script and the exact updates
|
||||
chosen (`<UpdateID>:<revision>`, those the last search found under each name) go into
|
||||
the run's registry key; no file is written. The task searches again and refuses, by
|
||||
name, an update no longer offered under that ID and revision, one offered twice, one
|
||||
that asks for input while it installs (`CanRequestUserInput`), and one whose licence
|
||||
terms the host has not accepted; while a restart is pending it installs nothing. It
|
||||
never restarts the host. The driver follows the run's log every 5 seconds and hands each
|
||||
line to `log`, then deletes the task and the key. The tasks and keys of runs whose
|
||||
connection died are deleted by the next run, which refuses to start while one is still
|
||||
installing; a run followed for 25 minutes is left to finish on the host. The task names
|
||||
itself to Windows Update as `napalm-windows`, which the history's `requested_by`
|
||||
shows. `get_scheduled_jobs` reports these tasks as an application's, offering nothing.
|
||||
* **History** (`get_update_history`): `QueryHistory`, newest 300 entries, one transaction
|
||||
each; `requested_by` is the `ClientApplicationID` (`UpdateOrchestrator`,
|
||||
`AutomaticUpdates`, `napalm-windows`), `error` the result and its HRESULT.
|
||||
|
||||
Not yet: packages, health metrics, Hyper-V.
|
||||
See netork#300 for the plan.
|
||||
|
||||
### Repair runs
|
||||
|
||||
Reference in new issue
Block a user