patch

Render an Ansible role that bumps exactly the packages a cve-scan found still vulnerable to their vendor-fixed version, staying on the same release — no cross-distro translation. It reuses the scan/narrow path directly, then groups findings by package: when one package has several CVEs with different fixed versions, it is bumped to the highest one so a single task clears them all. With --apply it also executes the role over SSH against the same host and re-scans to confirm.

Needs credentials — the advisory lookup and any --sign go to the API. Like cve-scan, the underlying scan is license-gated and never metered; patch itself adds no billable charge. rpm/dpkg only — Portage has no reliable exact-version pin via ansible.builtin.package, so patch refuses rather than emit a task that might not pin the version it claims.

vrtmv patch --root /mnt/snap/web01 --all-fixable --sign -o patch/
vrtmv patch --root /mnt/snap/web01 --cve CVE-2026-1234 --cve CVE-2026-5678 -o patch/
vrtmv patch --ssh deploy@web01.corp --all-fixable --apply -o patch/
FlagPurpose
--root / --image / --sshExactly one source (see Sources). --apply requires --ssh.
--ssh-port, --ssh-key, --jump, --sudoSSH collection options.
--cve <id>Patch only this CVE (repeatable). Mutually exclusive with --all-fixable.
--all-fixablePatch every CVE the scan finds still unfixed.
--arch <arch>Scope arch-specific advisories (e.g. x86_64).
--signAsk the API to Ed25519-sign the patch plan. Needs credentials. A plan that cannot be signed is written unsigned, with unsigned_because in vrtmv-patch.json, and the run exits 6. --apply still runs; a failed apply exits 1.
--allow-unsignedWith --sign: a plan that cannot be signed is a warning, and not exit 6.
--applyExecute the role over SSH against the same host, then re-scan to confirm. Requires --ssh.
-o, --out <path>Output directory for the role + report (default vrtmv-patch).
--jsonEmit the plan as JSON instead of a text summary. With --apply, one document after the apply: {"plan": …, "apply": …}.

A requested --cve that matches no current finding — not applicable to the release, not installed, or already fixed — is reported in unmatched_cves, never silently dropped.

--apply

Runs the patch immediately over SSH against the exact host it was scanned from (the same ansible-playbook invocation run uses), then re-scans fresh and diffs against what was targeted. It never claims a fix worked because ansible-playbook exited 0 — it re-checks, and its exit code reflects the confirmed outcome: it fails if the playbook reported failures or if the re-scan still finds any targeted CVE.

Three things --apply does that render-only does not:

  • Requires --ssh. A mounted --root/--image is a static filesystem, not a running system to execute against, and refuses --apply.
  • Excludes epoch-ambiguous packages from what it auto-applies (a non-zero-epoch rpm's pinned spec is a documented best-effort gap). These are named in excluded_epoch_ambiguous and left for manual patching.
  • Always renders a rollback role alongside (roles/vrtmv_patch_rollback/), targeting the pre-patch version. It is not run automatically — it is there so a bad patch has an immediate undo. Rolling back reintroduces the CVEs the forward patch fixed; it is not itself a security action.

The executed role also appends a non-blocking, reported restart-recommendation check (needs-restarting -r on rpm, /var/run/reboot-required on Debian/Ubuntu): a package can be upgraded on disk while the running process keeps the old code loaded, and the package database cannot see that.

Kernels on an rpm host

A kernel update installs the new kernel beside the old one. On an rpm host patch judges only the newest installed version of each kernel package, both for its plan and for the re-scan after --apply, so a kernel CVE is confirmed fixed once the newest installed kernel is fixed. Both reports name the versions judged and the older ones left out. dnf's own list of packages it installs side by side decides what a kernel package is: kernel, and whatever provides installonlypkg(kernel) or installonlypkg(kernel-module), such as kernel-core and kernel-modules-core, and on Oracle Linux the UEK packages (kernel-uek, kernel-uek-core, kernel-uek-modules-core and the rest).

The host runs the newest kernel after a reboot, unless its boot default is pinned to an older one, which vrtmv does not read. cve-scan still reports every installed kernel, since an older one can still be booted.

Module streams

On EL 8 and later a fix that the vendor's OVAL scopes to an AppStream module stream is matched only to a package on that stream, as cve-scan matches it. A host on stock redis 6.2 gets the 6.2 fix and a 6.2 target, not the redis:7 build, which dnf does not offer a host where that stream is not enabled. The step before each package that enables its module stream does nothing for a kernel package installed at two versions.


New to vrtmv? Sign up free for 10 migrations, or get a free assessment: run it on one hard host and we review the parity report with you.