Documentation
¶
Overview ¶
Package sysinv reads the operating system's own record of what is installed under a root filesystem: the dpkg, apk, pacman and rpm package databases and /etc/os-release. The root is a live system ("/"), a mounted volume, an unpacked image or /proc/<pid>/root — every path is joined under it and none is followed out of it.
It exists so that a distro package is named the way the distro's own security advisories name it. Amazon Linux, RHEL and Debian backport fixes without moving the upstream version, so "openssl 3.0.8" is affected upstream and fixed in 3.0.8-1.amzn2023.0.12. A match is only right when the purl carries the full distro version, the release it was built for (distro=amazon-2023) and, for Debian, the source package the advisory is filed against (upstream=).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Distro ¶
type Distro struct {
ID string // os-release ID: debian, ubuntu, amzn, rhel, alpine, …
IDLike []string // os-release ID_LIKE
VersionID string // os-release VERSION_ID: 12, 2023, 3.19.1, …
PrettyName string
}
Distro is the part of os-release a package match depends on.
func ReadOSRelease ¶
ReadOSRelease parses etc/os-release, falling back to usr/lib/os-release as os-release(5) specifies.
func (Distro) Namespace ¶
Namespace is the purl namespace for this distro's packages, using the vendor names the advisory feeds and other scanners use rather than os-release's abbreviations: amzn is amazon, rhel is redhat, ol is oracle.
type Package ¶
type Package struct {
Name string
// Version is the version the distro's advisories compare against: dpkg's
// Version field as written (epoch included), apk's V:, pacman's %VERSION%,
// and for rpm version-release with the epoch carried separately.
Version string
// Epoch is rpm's epoch when the package declares one; nil otherwise.
Epoch *int
Arch string
// Ecosystem is deb, apk, arch or rpm.
Ecosystem string
// SourceName is the source package the binary package was built from
// (dpkg Source, apk origin, pacman %BASE%, the rpm SRPM's name). Debian
// and Alpine advisories name the source package, not the binary one.
SourceName string
License string
// DB is the package database the entry came from, relative to the root.
DB string
// Files lists the absolute in-root paths the package installed, when the
// database records them (rpm). The dpkg, apk and pacman file lists are
// read by binpkg directly.
Files []string
}
Package is one installed OS package.
type Result ¶
type Result struct {
Distro Distro
Packages []Package
// Warnings name databases that exist but could not be read. A system with
// an unreadable rpmdb is not a system with no packages, and a caller must
// not report it as one.
Warnings []string
// Unsupported says why this system's packages cannot be read at all: a
// distribution whose package manager keeps no database read here. Such a
// host is unchecked, never a host with nothing installed.
Unsupported string
}
Result is everything read from one root.