Skip to content

Install updates from the Vulnerabilities extension: Linux, Windows and whole resources - #172

Closed
mbomb67 wants to merge 6 commits into
mainfrom
vulnerabilities-install-updates
Closed

mbomb67 wants to merge 6 commits into
mainfrom
vulnerabilities-install-updates

Conversation

@mbomb67

@mbomb67 mbomb67 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

What changes

The Vulnerabilities extension (extensions/XUI-wqrj0e3p) can now fix what it finds. A new setting, off by default, adds two actions:

  • Install Updates on a server: installs every update the server's own source offers, restarts it when that is needed and allowed, removes old kernels, rescans, and shows the counts before and after on the Vulnerabilities tab.
  • Install Updates on All Servers on a resource: the same, one server at a time, stopping at the first failure.

Both are ordinary CloudBolt actions that the extension creates, so role permissions, Requires approval, bulk runs and MCP apply. The tab buttons open the actions' own dialogs. Nothing runs while the setting is off, and never on a server in an Unassigned group.

System How updates are installed
RHEL, Oracle Linux 8-10 dnf -y --refresh upgrade
Amazon Linux 2023 the same with --releasever=latest (its repositories are locked to the image's release)
Ubuntu 22.04, 24.04 apt-get update, then a non-interactive dist-upgrade
Windows Server 2022, 2025 the built-in Windows Update Agent, from WSUS when policy sets one, otherwise Windows Update

How it works:

  • Detached in the guest. The install runs as a transient systemd unit (Linux) or a SYSTEM scheduled task (Windows) and the job polls it, so a restarted SSH service or a transport timeout does not end it. The Windows Update Agent refuses download and install from a remote session, which is why the task runs as SYSTEM.
  • Restart from inside the guest, then wait for a new boot identifier. CloudBolt has no wait-for-SSH or wait-for-WinRM helper.
  • Old kernels are removed once the server runs its newest kernel. On Ubuntu this is by package name, because apt protects the previous kernel and its vulnerabilities would stay listed. A setting turns it off.
  • Refused before any change: a Configuration Manager client, a Windows workstation, another Windows version, another Linux distribution.

New settings: Offer Install updates (off), Remove old kernels after a restart (on), minutes to wait for a restarted server (60), minutes allowed for installing (90). vuln_api.py gives plug-ins scan_and_wait, install_updates and install_updates_on_resource.

Testing

967 unit tests pass (python -B -m unittest discover -s extensions/XUI-wqrj0e3p/tests -p "test_*.py"). Each step was reviewed independently before it was tested live.

Live on a development appliance:

Server Run Known vulnerabilities With a fix
Windows Server 2025, over WinRM 3 updates, restarted, 31 min, build 26100.33650 to 33822 631 → 0 631 → 0
Ubuntu 22.04, fresh 218 packages, restarted, 6 old kernel packages removed, 9.5 min 9,509 → 3,242 7,493 → 101
Amazon Linux 2023, two months old 242 packages, restarted, 1 old kernel removed, 5 min 2,637 → 335 2,637 → 335
Amazon Linux 2023, current image no updates were available 28 → 28 28 → 28
Two patched servers, one bulk job no updates were available on both unchanged unchanged
Resource with three RHEL 9 VMs first VM failed in dnf (the lab's repository mix); the other two were not attempted unchanged unchanged

Also seen live: the setting creates both actions and the dialogs show the restart option; the action is not offered on a server in an Unassigned group; Scan all servers is refused while a resource update runs, and so is a second resource run; the tab shows the running step and the result line.

What remains after updating is software the package manager does not own (libraries bundled inside agents and tools). It stays listed with a fix version.

Not verified

  • A resource-wide run that completes across several servers. The only resource with servers in the lab is three unregistered RHEL VMs on CentOS Stream repositories, which fail dnf's transaction test. Its refusals, stop-at-first-failure and result line are verified live; the per-server engine it calls is verified on Ubuntu, Amazon Linux and Windows.
  • Requires approval, and a non-admin role granted the actions.
  • WSUS, a real Configuration Manager client, Windows Server 2022.
  • RHEL and Oracle Linux upgrades, Ubuntu 24.04.
  • AWS Systems Manager and Azure Run Command (the lab servers use SSH and WinRM).
  • Cancelling a job mid-update.

After merge

Sync extensions/XUI-wqrj0e3p from main and recycle the web workers. The actions do not exist until an administrator turns on Offer Install updates in Vulnerability Settings.

🤖 Generated with Claude Code

mbomb67 and others added 6 commits November 24, 2026 16:15
A new setting, off by default, creates an Install Updates server action.
The Vulnerabilities tab's button opens that action, so CloudBolt's role
permissions, the Requires approval flag, bulk runs and MCP all apply.

The job installs every update the server's repositories offer (RHEL and
Oracle Linux 8-10, Amazon Linux 2023, Ubuntu 22.04 and 24.04), restarts
the server when that is needed and allowed, removes old kernels after a
confirmed restart, rescans, and records the counts before and after.

- The install runs detached in the guest and the job polls it, so a
  restarted SSH service or a transport timeout does not end it.
- The restart is issued from inside the guest; the job waits for a new
  boot identifier.
- Never a server in an Unassigned group, never when the setting is off
  (the engine refuses, not only the button), one run per server.
- vuln_api.py gives plug-ins scan_and_wait and install_updates.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…est found

Windows Server 2022 and 2025 now get the same Install Updates action.
The worker uses the built-in Windows Update Agent from the server's
configured source (WSUS by policy, otherwise Windows Update) and runs as
a SYSTEM scheduled task, because the agent refuses download and install
from a remote session. A server with the Configuration Manager client,
a workstation, or another Windows version is refused before any change.

Found by the first live run on Ubuntu 22.04 and Amazon Linux 2023:

- The package count came from apt's console output and read 0 after 190
  upgrades; it now comes from a package snapshot before and after.
- Ubuntu's old kernel stayed installed, and the scan kept listing about
  6,600 vulnerabilities for it: apt protects the previous kernel. The
  cleanup now removes the older kernel's packages by name, only when the
  server runs its newest kernel and a simulation removes nothing else,
  and no longer depends on this run having done the restart. A new
  setting, on by default, turns the cleanup off.
- Amazon Linux 2023 names its kernel package kernel6.x, so the newest
  kernel was not found.
- A run with nothing to install now says "No updates were available".

Also: the restart delay is 20 seconds on both systems, the wait for a
restarted server defaults to 60 minutes, a restart that could not be
started fails early, and a clock change is not read as a restart.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The same setting now also creates a resource action that updates a
resource's own servers one at a time with the per-server engine. The
resource Vulnerabilities tab opens it, shows progress (server n of m),
and keeps a result line for the last run.

- A failed server ends the job as a failure and the remaining servers
  are not attempted. Servers the requester may not act on, or that are
  not eligible, are skipped and the run continues. A pending restart is
  not a failure.
- Scan all servers and Install updates on all servers exclude each
  other on one resource.
- Any failed server now makes a bulk server-action run a failure too.
- Servers the requester cannot view are named "Server <id>" in the job
  output. A resource action an admin switched off does not run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…age manager's error

On Ubuntu the job reported 0 packages after a full upgrade. The counting
is right; the likely cause is needrestart, run in automatic mode by apt,
restarting our own transient unit once libc6 was upgraded, so the worker
ran twice. The worker now excludes its unit from needrestart for the run
(a conf.d file removed afterwards), starts its unit with
RefuseManualStop, keeps the first package snapshot, and a second start
of a run never begins a second upgrade. Other services are still
restarted automatically. Not yet proven on a live server.

When the package manager fails, up to 12 lines of its error now reach
the job output; dnf's "Transaction test error" used to arrive alone.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…wording

The tab's failure line carried only dnf's first line, "Error: Transaction
test error:", while the cause was in the job output. The record message
now adds the first detail line, and repeated lines are dropped. "1 old
kernel package was removed" and the minute counts use the singular.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mbomb67

mbomb67 commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Replaced by #173: the same change as one commit. This branch's history had a lab hostname in two code comments, which the Secret scan check rejects; the new branch has it removed from the files and from history.

@mbomb67 mbomb67 closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant