Amazon InspectorでRed Hat Application Streamsからインストールしたパッケージは検出できるのか確認してみた

AppStreamからインストールしたパッケージはInspectorで検出できる
2024.05.21

Red Hat Application Streamsからインストールしたパッケージは検出できる?

こんにちは、のんピ(@non____97)です。

皆さんはAmazon InspectorでRed Hat Application Streams(以降AppStream)からインストールしたパッケージは検出できるなと思ったことはありますか? 私はあります。

InspectorのAWS公式ドキュメントを確認すると、オプションリポジトリは検出対象外であり、その例としてAppStreamが挙げられています。

サポートされているオペレーティングシステム: Amazon EC2スキャン

次の表は、Amazon Elastic Compute Cloud (Amazon EC2) インスタンスのスキャンにおいて Amazon Inspector が現在サポートしているオペレーティングシステムと、各ベンダーのセキュリティアドバイザリのソースを示しています。

注記

Linux オペレーティングシステムの検出は、デフォルトのパッケージマネージャーリポジトリでのみサポートされており、Red Hat Application Streams などのオプションリポジトリは含まれていません。

Amazon Inspector でサポートされているオペレーティングシステムとプログラミング言語 - Amazon Inspector

英語で表示してもAppStreamが検出対象外の例として挙げられています。

Supported operating systems: Amazon EC2 scanning

The following table lists the operating systems that Amazon Inspector supports for the scanning of Amazon EC2 instances. It lists the source of the vendor security advisories for each operating system. It also helps you determine whether any of the supported operating systems can be scanned using agent-based scanning or agentless scanning.

When using the agent-based scanning method, you configure the SSM agent to perform continuous scans on all eligible instances. Amazon Inspector recommends that you configure a version of the SSM agent that's greater than 3.2.2086.0. For more information, see Working with the SSM Agent in the Amazon EC2 Systems Manager User Guide.

Note

Linux operating system detections are supported only for the default package manager repository (rpm and dpkg) and don't include third-party applications, extended support repositories (BYOS RHEL, PAYG RHEL, and RHEL for SAP), and optional repositories (Red Hat Application Streams).

Operating systems and programming languages supported by Amazon Inspector - Amazon Inspector

これは本当なのでしょうか。

Red Hat Enterprise Linux(以降RHEL) 8からデフォルトでリポジトリはBaseOSとAppStreamの2つが設定されています。そのため、AppStreamをオプションリポジトリとして扱うかどうかは個人的には微妙なような気がしています。オプションリポジトリというのはRHELのHigh AvailabilityリポジトリやResilient Storageリポジトリなどデフォルトで設定されていないリポジトリを指すイメージです。

AppStreamにはhttpdやNginx、PythonなどOSのライフサイクルと同じ期間サポートするものもあり、重要度の高いものも多く存在するためInspectorによる検出対象外だと困ります。AppStreamで管理されているパッケージ一覧は以下をご覧ください。

もしかして、「検出対象外にはAppStreamは除く」ということを表現したかったのでしょうか。

本当にAppStreamのリポジトリからインストールしたパッケージは検出できないか確認します。

いきなりまとめ

  • AppStreamからインストールしたパッケージはInspectorで検出できる
    • サポート期限がOSと同じであるかどうか関わらず可能

やってみた

RHEL 9起動直後のInspectorの検出結果の確認

実際に試してみます。

RHEL 9のEC2インスタンスを使用します。使用したAMIは以下のとおりです。

  • RHEL-9.3.0_HVM-20240117-x86_64-49-Hourly2-GP3 (ami-0fe630eb857a6ec83)

起動完了後リポジトリ一覧を確認します。

$ sudo dnf repolist
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

repo id                                   repo name
rhel-9-appstream-rhui-rpms                Red Hat Enterprise Linux 9 for x86_64 - AppStream from RHUI (RPMs)
rhel-9-baseos-rhui-rpms                   Red Hat Enterprise Linux 9 for x86_64 - BaseOS from RHUI (RPMs)
rhui-client-config-server-9               Red Hat Enterprise Linux 9 Client Configuration

AppStreamが設定されていますね。

インストールされているパッケージの使用元リポジトリを確認します。

$ sudo dnf repoquery --querytags
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

name, arch, epoch, version, release, reponame (repoid), from_repo, evr,
debug_name, source_name, source_debug_name,
installtime, buildtime, size, downloadsize, installsize,
provides, requires, obsoletes, conflicts, sourcerpm,
description, summary, license, url, reason

$ sudo dnf repoquery \
  --installed \
  --qf '%{name}|%{version}|%{release}|%{repoid}|%{from_repo}\n' \
  | grep '|' \
  | column -ts '|'
NetworkManager-cloud-setup              1.44.0              4.el9_3               @System
NetworkManager-libnm                    1.44.0              4.el9_3               @System
NetworkManager-team                     1.44.0              4.el9_3               @System
NetworkManager-tui                      1.44.0              4.el9_3               @System
NetworkManager                          1.44.0              4.el9_3               @System
acl                                     2.3.1               3.el9                 @System
alternatives                            1.24                1.el9                 @System
amazon-libdnf-plugin                    1.0.1               1.el9                 @System
amazon-ssm-agent                        3.3.418.0           1                     @System  @commandline
audit-libs                              3.0.7               104.el9               @System
audit                                   3.0.7               104.el9               @System
authselect-compat                       1.2.6               2.el9                 @System
authselect-libs                         1.2.6               2.el9                 @System
authselect                              1.2.6               2.el9                 @System
basesystem                              11                  13.el9                @System
bash                                    5.1.8               6.el9_1               @System
binutils-gold                           2.35.2              42.el9                @System
binutils                                2.35.2              42.el9                @System
bzip2-libs                              1.0.8               8.el9                 @System
c-ares                                  1.19.1              1.el9                 @System
ca-certificates                         2023.2.60_v7.0.306  90.1.el9_2            @System
checkpolicy                             3.5                 1.el9                 @System
chkconfig                               1.24                1.el9                 @System
chrony                                  4.3                 1.el9                 @System
cloud-init                              23.1.1              12.el9_3              @System
cloud-utils-growpart                    0.33                1.el9                 @System
coreutils-common                        8.32                34.el9                @System
coreutils                               8.32                34.el9                @System
cpio                                    2.13                16.el9                @System
cracklib-dicts                          2.9.6               27.el9                @System
cracklib                                2.9.6               27.el9                @System
cronie-anacron                          1.5.7               8.el9                 @System
cronie                                  1.5.7               8.el9                 @System
crontabs                                1.11                27.20190603git.el9_0  @System
crypto-policies-scripts                 20230731            1.git94f0e2c.el9_3.1  @System
crypto-policies                         20230731            1.git94f0e2c.el9_3.1  @System
cryptsetup-libs                         2.6.0               3.el9                 @System
curl                                    7.76.1              26.el9_3.2            @System
cyrus-sasl-lib                          2.1.27              21.el9                @System
dbus-broker                             28                  7.el9                 @System
dbus-common                             1.12.20             8.el9                 @System
dbus-libs                               1.12.20             8.el9                 @System
dbus-tools                              1.12.20             8.el9                 @System
dbus                                    1.12.20             8.el9                 @System
dejavu-sans-fonts                       2.37                18.el9                @System
device-mapper-libs                      1.02.195            3.el9                 @System
device-mapper                           1.02.195            3.el9                 @System
dhcp-client                             4.4.2               19.b1.el9             @System
dhcp-common                             4.4.2               19.b1.el9             @System
diffutils                               3.7                 12.el9                @System
dmidecode                               3.5                 1.el9                 @System
dnf-data                                4.14.0              8.el9                 @System
dnf-plugins-core                        4.3.0               11.el9_3              @System
dnf                                     4.14.0              8.el9                 @System
dosfstools                              4.2                 3.el9                 @System
dracut-config-generic                   057                 44.git20230822.el9    @System
dracut-network                          057                 44.git20230822.el9    @System
dracut-squash                           057                 44.git20230822.el9    @System
dracut                                  057                 44.git20230822.el9    @System
e2fsprogs-libs                          1.46.5              3.el9                 @System
e2fsprogs                               1.46.5              3.el9                 @System
efi-filesystem                          6                   2.el9_0               @System
efibootmgr                              16                  12.el9                @System
efivar-libs                             38                  3.el9                 @System
elfutils-debuginfod-client              0.189               3.el9                 @System
elfutils-default-yama-scope             0.189               3.el9                 @System
elfutils-libelf                         0.189               3.el9                 @System
elfutils-libs                           0.189               3.el9                 @System
ethtool                                 6.2                 1.el9                 @System
expat                                   2.5.0               1.el9                 @System
file-libs                               5.39                14.el9                @System
filesystem                              3.16                2.el9                 @System
file                                    5.39                14.el9                @System
findutils                               4.8.0               6.el9                 @System
flashrom                                1.2                 10.el9                @System
fonts-filesystem                        2.0.5               7.el9.1               @System
fuse-libs                               2.9.9               15.el9                @System
fwupd-plugin-flashrom                   1.8.16              1.el9                 @System
fwupd                                   1.8.16              1.el9                 @System
gawk-all-langpacks                      5.1.0               6.el9                 @System
gawk                                    5.1.0               6.el9                 @System
gdbm-libs                               1.19                4.el9                 @System
gdisk                                   1.0.7               5.el9                 @System
geolite2-city                           20191217            6.el9                 @System
geolite2-country                        20191217            6.el9                 @System
gettext-libs                            0.21                8.el9                 @System
gettext                                 0.21                8.el9                 @System
glib2                                   2.68.4              11.el9                @System
glibc-common                            2.34                83.el9_3.7            @System
glibc-gconv-extra                       2.34                83.el9_3.7            @System
glibc-langpack-en                       2.34                83.el9_3.7            @System
glibc                                   2.34                83.el9_3.7            @System
gmp                                     6.2.0               13.el9                @System
gnupg2                                  2.3.3               4.el9                 @System
gnutls                                  3.7.6               23.el9                @System
gobject-introspection                   1.68.0              11.el9                @System
gpgme                                   1.15.1              6.el9                 @System
grep                                    3.6                 5.el9                 @System
groff-base                              1.22.4              10.el9                @System
grub2-common                            2.06                70.el9_3.2            @System
grub2-efi-x64                           2.06                70.el9_3.2            @System
grub2-pc-modules                        2.06                70.el9_3.2            @System
grub2-pc                                2.06                70.el9_3.2            @System
grub2-tools-minimal                     2.06                70.el9_3.2            @System
grub2-tools                             2.06                70.el9_3.2            @System
grubby                                  8.40                63.el9                @System
gzip                                    1.12                1.el9                 @System
hdparm                                  9.62                2.el9                 @System
hostname                                3.23                6.el9                 @System
hwdata                                  0.348               9.11.el9              @System
ima-evm-utils                           1.4                 4.el9                 @System
inih                                    49                  6.el9                 @System
initscripts-rename-device               10.11.5             1.el9                 @System
initscripts-service                     10.11.5             1.el9                 @System
initscripts                             10.11.5             1.el9                 @System
insights-client                         3.2.2               1.el9_3               @System
inspectorssmplugin                      1.0.199             1                     @System
ipcalc                                  1.0.0               5.el9                 @System
iproute-tc                              6.2.0               5.el9                 @System
iproute                                 6.2.0               5.el9                 @System
iptables-libs                           1.8.8               6.el9_1               @System
iputils                                 20210202            9.el9                 @System
irqbalance                              1.9.2               3.el9                 @System
jansson                                 2.14                1.el9                 @System
json-c                                  0.14                11.el9                @System
json-glib                               1.6.6               1.el9                 @System
kbd-legacy                              2.4.0               9.el9                 @System
kbd-misc                                2.4.0               9.el9                 @System
kbd                                     2.4.0               9.el9                 @System
kernel-core                             5.14.0              362.18.1.el9_3        @System
kernel-modules-core                     5.14.0              362.18.1.el9_3        @System
kernel-modules                          5.14.0              362.18.1.el9_3        @System
kernel-tools-libs                       5.14.0              362.18.1.el9_3        @System
kernel-tools                            5.14.0              362.18.1.el9_3        @System
kernel                                  5.14.0              362.18.1.el9_3        @System
kexec-tools                             2.0.26              8.el9                 @System
keyutils-libs                           1.6.3               1.el9                 @System
kmod-libs                               28                  9.el9                 @System
kmod                                    28                  9.el9                 @System
kpartx                                  0.8.7               22.el9                @System
krb5-libs                               1.21.1              1.el9                 @System
langpacks-core-en                       3.0                 16.el9                @System
langpacks-core-font-en                  3.0                 16.el9                @System
langpacks-en                            3.0                 16.el9                @System
less                                    590                 2.el9_2               @System
libacl                                  2.3.1               3.el9                 @System
libarchive                              3.5.3               4.el9                 @System
libassuan                               2.5.5               3.el9                 @System
libatasmart                             0.19                22.el9                @System
libattr                                 2.5.1               3.el9                 @System
libbasicobjects                         0.1.1               53.el9                @System
libblkid                                2.37.4              15.el9                @System
libblockdev-crypto                      2.28                7.el9                 @System
libblockdev-fs                          2.28                7.el9                 @System
libblockdev-loop                        2.28                7.el9                 @System
libblockdev-mdraid                      2.28                7.el9                 @System
libblockdev-part                        2.28                7.el9                 @System
libblockdev-swap                        2.28                7.el9                 @System
libblockdev-utils                       2.28                7.el9                 @System
libblockdev                             2.28                7.el9                 @System
libbpf                                  1.2.0               1.el9                 @System
libbrotli                               1.0.9               6.el9                 @System
libbytesize                             2.5                 3.el9                 @System
libcap-ng                               0.8.2               7.el9                 @System
libcap                                  2.48                9.el9_2               @System
libcbor                                 0.7.0               5.el9                 @System
libcollection                           0.7.0               53.el9                @System
libcom_err                              1.46.5              3.el9                 @System
libcomps                                0.1.18              1.el9                 @System
libcurl                                 7.76.1              26.el9_3.2            @System
libdaemon                               0.14                23.el9                @System
libdb                                   5.3.28              53.el9                @System
libdhash                                0.5.0               53.el9                @System
libdnf-plugin-subscription-manager      1.29.38             1.el9_3               @System
libdnf                                  0.69.0              6.el9_3               @System
libeconf                                0.4.1               3.el9_2               @System
libedit                                 3.1                 38.20210216cvs.el9    @System
libestr                                 0.1.11              4.el9                 @System
libevent                                2.1.12              6.el9                 @System
libfastjson                             0.99.9              5.el9                 @System
libfdisk                                2.37.4              15.el9                @System
libffi                                  3.4.2               8.el9                 @System
libfido2                                1.13.0              1.el9                 @System
libgcab1                                1.4                 6.el9                 @System
libgcc                                  11.4.1              2.1.el9               @System
libgcrypt                               1.10.0              10.el9_2              @System
libgomp                                 11.4.1              2.1.el9               @System
libgpg-error                            1.42                5.el9                 @System
libgudev                                237                 1.el9                 @System
libgusb                                 0.3.8               2.el9                 @System
libibverbs                              46.0                1.el9                 @System
libidn2                                 2.3.0               7.el9                 @System
libini_config                           1.3.1               53.el9                @System
libjcat                                 0.1.6               3.el9                 @System
libkcapi-hmaccalc                       1.3.1               3.el9                 @System
libkcapi                                1.3.1               3.el9                 @System
libksba                                 1.5.1               6.el9_1               @System
libldb                                  2.7.2               2.el9                 @System
libmaxminddb                            1.5.2               3.el9                 @System
libmnl                                  1.0.4               15.el9                @System
libmodulemd                             2.13.0              2.el9                 @System
libmount                                2.37.4              15.el9                @System
libndp                                  1.8                 4.el9                 @System
libnetfilter_conntrack                  1.0.9               1.el9                 @System
libnfnetlink                            1.0.1               21.el9                @System
libnghttp2                              1.43.0              5.el9_3.1             @System
libnl3-cli                              3.7.0               1.el9                 @System
libnl3                                  3.7.0               1.el9                 @System
libpath_utils                           0.2.1               53.el9                @System
libpcap                                 1.10.0              4.el9                 @System
libpipeline                             1.5.3               4.el9                 @System
libpsl                                  0.21.1              5.el9                 @System
libpwquality                            1.4.4               8.el9                 @System
libref_array                            0.1.5               53.el9                @System
libreport-filesystem                    2.15.2              6.el9                 @System
librepo                                 1.14.5              1.el9                 @System
librhsm                                 0.0.3               7.el9_3.1             @System
libseccomp                              2.5.2               2.el9                 @System
libselinux-utils                        3.5                 1.el9                 @System
libselinux                              3.5                 1.el9                 @System
libsemanage                             3.5                 2.el9                 @System
libsepol                                3.5                 1.el9                 @System
libsigsegv                              2.13                4.el9                 @System
libsmartcols                            2.37.4              15.el9                @System
libsmbios                               2.4.3               4.el9                 @System
libsolv                                 0.7.24              2.el9                 @System
libssh-config                           0.10.4              11.el9                @System
libssh                                  0.10.4              11.el9                @System
libsss_certmap                          2.9.1               4.el9_3.5             @System
libsss_idmap                            2.9.1               4.el9_3.5             @System
libsss_nss_idmap                        2.9.1               4.el9_3.5             @System
libsss_sudo                             2.9.1               4.el9_3.5             @System
libss                                   1.46.5              3.el9                 @System
libstdc++                               11.4.1              2.1.el9               @System
libsysfs                                2.1.1               10.el9                @System
libtalloc                               2.4.0               2.el9                 @System
libtasn1                                4.16.0              8.el9_1               @System
libtdb                                  1.4.8               2.el9                 @System
libteam                                 1.31                16.el9_1              @System
libtevent                               0.14.1              2.el9                 @System
libtraceevent                           1.5.3               3.el9                 @System
libudisks2                              2.9.4               9.el9                 @System
libunistring                            0.9.10              15.el9                @System
libusbx                                 1.0.26              1.el9                 @System
libuser                                 0.63                13.el9                @System
libutempter                             1.2.1               6.el9                 @System
libuuid                                 2.37.4              15.el9                @System
libverto                                0.3.2               3.el9                 @System
libxcrypt-compat                        4.4.18              3.el9                 @System
libxcrypt                               4.4.18              3.el9                 @System
libxml2                                 2.9.13              5.el9_3               @System
libxmlb                                 0.3.10              1.el9                 @System
libyaml                                 0.2.5               7.el9                 @System
libzstd                                 1.5.1               2.el9                 @System
linux-firmware-whence                   20230814            140.el9_3             @System
linux-firmware                          20230814            140.el9_3             @System
lmdb-libs                               0.9.29              3.el9                 @System
logrotate                               3.18.0              8.el9                 @System
lshw                                    B.02.19.2           10.el9                @System
lsscsi                                  0.32                6.el9                 @System
lua-libs                                5.4.4               4.el9                 @System
lz4-libs                                1.9.3               5.el9                 @System
lzo                                     2.10                7.el9                 @System
man-db                                  2.9.3               7.el9                 @System
mdadm                                   4.2                 9.el9                 @System
microcode_ctl                           20230808            2.20231009.1.el9_3    @System
mokutil                                 0.6.0               4.el9                 @System
mpfr                                    4.1.0               7.el9                 @System
ncurses-base                            6.2                 10.20210508.el9       @System
ncurses-libs                            6.2                 10.20210508.el9       @System
ncurses                                 6.2                 10.20210508.el9       @System
nettle                                  3.8                 3.el9_0               @System
newt                                    0.52.21             11.el9                @System
npth                                    1.6                 8.el9                 @System
nspr                                    4.35.0              4.el9_3               @System
nss-softokn-freebl                      3.90.0              4.el9_3               @System
nss-softokn                             3.90.0              4.el9_3               @System
nss-sysinit                             3.90.0              4.el9_3               @System
nss-util                                3.90.0              4.el9_3               @System
nss                                     3.90.0              4.el9_3               @System
numactl-libs                            2.0.16              1.el9                 @System
oddjob-mkhomedir                        0.34.7              7.el9                 @System
oddjob                                  0.34.7              7.el9                 @System
openldap                                2.6.3               1.el9                 @System
openssh-clients                         8.7p1               34.el9                @System
openssh-server                          8.7p1               34.el9                @System
openssh                                 8.7p1               34.el9                @System
openssl-libs                            3.0.7               24.el9                @System
openssl                                 3.0.7               24.el9                @System
os-prober                               1.77                10.el9                @System
p11-kit-trust                           0.24.1              2.el9                 @System
p11-kit                                 0.24.1              2.el9                 @System
pam                                     1.5.1               15.el9                @System
parted                                  3.5                 2.el9                 @System
passwd                                  0.80                12.el9                @System
pciutils-libs                           3.7.0               5.el9                 @System
pciutils                                3.7.0               5.el9                 @System
pcre2-syntax                            10.40               2.el9                 @System
pcre2                                   10.40               2.el9                 @System
pcre                                    8.44                3.el9.3               @System
pigz                                    2.5                 4.el9                 @System
policycoreutils-python-utils            3.5                 3.el9_3               @System
policycoreutils                         3.5                 3.el9_3               @System
polkit-libs                             0.117               11.el9                @System
polkit-pkla-compat                      0.1                 21.el9                @System
polkit                                  0.117               11.el9                @System
popt                                    1.18                8.el9                 @System
prefixdevname                           0.1.0               8.el9                 @System
procps-ng                               3.3.17              13.el9                @System
psmisc                                  23.4                3.el9                 @System
publicsuffix-list-dafsa                 20210518            3.el9                 @System
python-unversioned-command              3.9.18              1.el9_3.1             @System
python3-attrs                           20.3.0              7.el9                 @System
python3-audit                           3.0.7               104.el9               @System
python3-babel                           2.9.1               2.el9                 @System
python3-chardet                         4.0.0               5.el9                 @System
python3-cloud-what                      1.29.38             1.el9_3               @System
python3-configobj                       5.0.6               25.el9                @System
python3-dateutil                        2.8.1               7.el9                 @System
python3-dbus                            1.2.18              2.el9                 @System
python3-decorator                       4.4.2               6.el9                 @System
python3-distro                          1.5.0               7.el9                 @System
python3-dnf-plugins-core                4.3.0               11.el9_3              @System
python3-dnf                             4.14.0              8.el9                 @System
python3-file-magic                      5.39                14.el9                @System
python3-gobject-base-noarch             3.40.1              6.el9                 @System
python3-gobject-base                    3.40.1              6.el9                 @System
python3-gpg                             1.15.1              6.el9                 @System
python3-hawkey                          0.69.0              6.el9_3               @System
python3-idna                            2.10                7.el9                 @System
python3-iniparse                        0.4                 45.el9                @System
python3-inotify                         0.9.6               25.el9                @System
python3-jinja2                          2.11.3              4.el9                 @System
python3-jsonpatch                       1.21                16.el9                @System
python3-jsonpointer                     2.0                 4.el9                 @System
python3-jsonschema                      3.2.0               13.el9                @System
python3-libcomps                        0.1.18              1.el9                 @System
python3-libdnf                          0.69.0              6.el9_3               @System
python3-librepo                         1.14.5              1.el9                 @System
python3-libselinux                      3.5                 1.el9                 @System
python3-libsemanage                     3.5                 2.el9                 @System
python3-libs                            3.9.18              1.el9_3.1             @System
python3-linux-procfs                    0.7.1               1.el9                 @System
python3-markupsafe                      1.1.1               12.el9                @System
python3-netifaces                       0.10.6              15.el9                @System
python3-oauthlib                        3.1.1               5.el9                 @System
python3-perf                            5.14.0              362.18.1.el9_3        @System
python3-pip-wheel                       21.2.3              7.el9                 @System
python3-policycoreutils                 3.5                 3.el9_3               @System
python3-prettytable                     0.7.2               27.el9                @System
python3-pyrsistent                      0.17.3              8.el9                 @System
python3-pyserial                        3.4                 12.el9                @System
python3-pysocks                         1.7.1               12.el9                @System
python3-pytz                            2021.1              5.el9                 @System
python3-pyudev                          0.22.0              6.el9                 @System
python3-pyyaml                          5.4.1               6.el9                 @System
python3-requests                        2.25.1              7.el9_2               @System
python3-rpm                             4.16.1.3            27.el9_3              @System
python3-setools                         4.4.3               1.el9                 @System
python3-setuptools-wheel                53.0.0              12.el9                @System
python3-setuptools                      53.0.0              12.el9                @System
python3-six                             1.15.0              9.el9                 @System
python3-subscription-manager-rhsm       1.29.38             1.el9_3               @System
python3-systemd                         234                 18.el9                @System
python3-urllib3                         1.26.5              3.el9_3.1             @System
python3                                 3.9.18              1.el9_3.1             @System
readline                                8.1                 4.el9                 @System
redhat-cloud-client-configuration       1                   11.el9                @System
redhat-release-eula                     9.3                 0.5.el9               @System
redhat-release                          9.3                 0.5.el9               @System
rh-amazon-rhui-client                   4.0.13              1.el9                 @System
rhc                                     0.2.4               3.el9_3               @System
rootfiles                               8.1                 31.el9                @System
rpm-build-libs                          4.16.1.3            27.el9_3              @System
rpm-libs                                4.16.1.3            27.el9_3              @System
rpm-plugin-audit                        4.16.1.3            27.el9_3              @System
rpm-plugin-selinux                      4.16.1.3            27.el9_3              @System
rpm-plugin-systemd-inhibit              4.16.1.3            27.el9_3              @System
rpm-sign-libs                           4.16.1.3            27.el9_3              @System
rpm                                     4.16.1.3            27.el9_3              @System
rsync                                   3.2.3               19.el9                @System
rsyslog-logrotate                       8.2102.0            117.el9               @System
rsyslog                                 8.2102.0            117.el9               @System
sed                                     4.8                 9.el9                 @System
selinux-policy-targeted                 38.1.23             1.el9_3.1             @System
selinux-policy                          38.1.23             1.el9_3.1             @System
setup                                   2.13.7              9.el9                 @System
sg3_utils-libs                          1.47                9.el9                 @System
sg3_utils                               1.47                9.el9                 @System
shadow-utils                            4.9                 8.el9                 @System
shared-mime-info                        2.1                 5.el9                 @System
shim-x64                                15.6                1.el9                 @System
slang                                   2.3.2               11.el9                @System
snappy                                  1.1.8               8.el9                 @System
sqlite-libs                             3.34.1              7.el9_3               @System
squashfs-tools                          4.4                 8.git1.el9            @System
sssd-client                             2.9.1               4.el9_3.5             @System
sssd-common                             2.9.1               4.el9_3.5             @System
sssd-kcm                                2.9.1               4.el9_3.5             @System
subscription-manager-rhsm-certificates  20220623            1.el9                 @System
subscription-manager                    1.29.38             1.el9_3               @System
sudo                                    1.9.5p2             9.el9                 @System
systemd-libs                            252                 18.el9                @System
systemd-pam                             252                 18.el9                @System
systemd-rpm-macros                      252                 18.el9                @System
systemd-udev                            252                 18.el9                @System
systemd                                 252                 18.el9                @System
tar                                     1.34                6.el9_1               @System
teamd                                   1.31                16.el9_1              @System
tpm2-tss                                3.2.2               2.el9                 @System
tuned                                   2.21.0              1.el9_3               @System
tzdata                                  2023d               1.el9                 @System
udisks2                                 2.9.4               9.el9                 @System
usermode                                1.114               4.el9                 @System
userspace-rcu                           0.12.1              6.el9                 @System
util-linux-core                         2.37.4              15.el9                @System
util-linux                              2.37.4              15.el9                @System
vim-minimal                             8.2.2637            20.el9_1              @System
virt-what                               1.25                5.el9                 @System
volume_key-libs                         0.3.12              15.el9                @System
which                                   2.21                29.el9                @System
xfsprogs                                5.19.0              4.el9                 @System
xz-libs                                 5.2.5               8.el9_0               @System
xz                                      5.2.5               8.el9_0               @System
yum-utils                               4.3.0               11.el9_3              @System
yum                                     4.14.0              8.el9                 @System
zlib                                    1.2.11              40.el9                @System

repoidは全て@Systemとして認識されており、from_repoは手動でインストールされたSSM Agent以外は表記されていませんね。

EC2インスタンス起動直後のInspectorの検出結果は以下のとおりです。

Inspector初回スキャン結果

諸々のパッケージが検出されていますね。

httpd インストール後のInspectorの検出結果の確認

それでは、httpdをインストールしてみます。

httpdはAppStreamの中でもOSのサポート期限と同じ期間サポートされるソフトウェアです。

Inspectorで検出してくれるように、少し古めのhttpdをインストールします。

$ sudo dnf list httpd --showduplicates
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:01:16 ago on Tue 21 May 2024 01:27:16 AM UTC.
Available Packages
httpd.x86_64                                               2.4.51-7.el9_0                                                   rhel-9-appstream-rhui-rpms
httpd.x86_64                                               2.4.53-7.el9                                                     rhel-9-appstream-rhui-rpms
httpd.x86_64                                               2.4.53-7.el9_1.1                                                 rhel-9-appstream-rhui-rpms
httpd.x86_64                                               2.4.53-7.el9_1.5                                                 rhel-9-appstream-rhui-rpms
httpd.x86_64                                               2.4.53-11.el9_2.4                                                rhel-9-appstream-rhui-rpms
httpd.x86_64                                               2.4.53-11.el9_2.5                                                rhel-9-appstream-rhui-rpms
httpd.x86_64                                               2.4.57-5.el9                                                     rhel-9-appstream-rhui-rpms
httpd.x86_64                                               2.4.57-8.el9                                                     rhel-9-appstream-rhui-rpms

$ sudo dnf install httpd-2.4.53-11.el9_2.4
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:02:32 ago on Tue 21 May 2024 01:27:16 AM UTC.
Dependencies resolved.
======================================================================================================================================================
 Package                              Architecture             Version                             Repository                                    Size
======================================================================================================================================================
Installing:
 httpd                                x86_64                   2.4.53-11.el9_2.4                   rhel-9-appstream-rhui-rpms                    54 k
Installing dependencies:
 apr                                  x86_64                   1.7.0-12.el9_3                      rhel-9-appstream-rhui-rpms                   126 k
 apr-util                             x86_64                   1.6.1-23.el9                        rhel-9-appstream-rhui-rpms                    97 k
 apr-util-bdb                         x86_64                   1.6.1-23.el9                        rhel-9-appstream-rhui-rpms                    14 k
 httpd-core                           x86_64                   2.4.53-11.el9_2.4                   rhel-9-appstream-rhui-rpms                   1.5 M
 httpd-filesystem                     noarch                   2.4.53-11.el9_2.4                   rhel-9-appstream-rhui-rpms                    17 k
 httpd-tools                          x86_64                   2.4.53-11.el9_2.4                   rhel-9-appstream-rhui-rpms                    88 k
 mailcap                              noarch                   2.1.49-5.el9                        rhel-9-baseos-rhui-rpms                       35 k
 redhat-logos-httpd                   noarch                   90.4-2.el9                          rhel-9-appstream-rhui-rpms                    18 k
Installing weak dependencies:
 apr-util-openssl                     x86_64                   1.6.1-23.el9                        rhel-9-appstream-rhui-rpms                    17 k
 mod_http2                            x86_64                   1.15.19-4.el9_2.4                   rhel-9-appstream-rhui-rpms                   153 k
 mod_lua                              x86_64                   2.4.53-11.el9_2.4                   rhel-9-appstream-rhui-rpms                    63 k

Transaction Summary
======================================================================================================================================================
Install  12 Packages

Total download size: 2.2 M
Installed size: 6.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): httpd-filesystem-2.4.53-11.el9_2.4.noarch.rpm                                                                 274 kB/s |  17 kB     00:00
(2/12): httpd-2.4.53-11.el9_2.4.x86_64.rpm                                                                            782 kB/s |  54 kB     00:00
.
.
(中略)
.
.
Installed:
  apr-1.7.0-12.el9_3.x86_64      apr-util-1.6.1-23.el9.x86_64        apr-util-bdb-1.6.1-23.el9.x86_64          apr-util-openssl-1.6.1-23.el9.x86_64
  httpd-2.4.53-11.el9_2.4.x86_64 httpd-core-2.4.53-11.el9_2.4.x86_64 httpd-filesystem-2.4.53-11.el9_2.4.noarch httpd-tools-2.4.53-11.el9_2.4.x86_64
  mailcap-2.1.49-5.el9.noarch    mod_http2-1.15.19-4.el9_2.4.x86_64  mod_lua-2.4.53-11.el9_2.4.x86_64          redhat-logos-httpd-90.4-2.el9.noarch

Complete!

インストール完了後、インストール元のリポジトリ名を確認します。

$ sudo dnf repoquery \
  --installed \
  --qf '%{name}|%{version}|%{release}|%{repoid}|%{from_repo}\n' \
  | grep 'httpd' \
  | column -ts '|'
httpd-core          2.4.53  11.el9_2.4  @System  rhel-9-appstream-rhui-rpms
httpd-filesystem    2.4.53  11.el9_2.4  @System  rhel-9-appstream-rhui-rpms
httpd-tools         2.4.53  11.el9_2.4  @System  rhel-9-appstream-rhui-rpms
httpd               2.4.53  11.el9_2.4  @System  rhel-9-appstream-rhui-rpms
redhat-logos-httpd  90.4    2.el9       @System  rhel-9-appstream-rhui-rpms

AppStreamであることが分かりますね。

インストールしたhttpd関連のパッケージについてのRHSAを確認します。

$ sudo dnf updateinfo list \
  | grep RHSA \
  | grep httpd
RHSA-2023:6403 Moderate/Sec.  httpd-2.4.57-5.el9.x86_64
RHSA-2024:2278 Moderate/Sec.  httpd-2.4.57-8.el9.x86_64
RHSA-2023:6403 Moderate/Sec.  httpd-core-2.4.57-5.el9.x86_64
RHSA-2024:2278 Moderate/Sec.  httpd-core-2.4.57-8.el9.x86_64
RHSA-2023:6403 Moderate/Sec.  httpd-filesystem-2.4.57-5.el9.noarch
RHSA-2024:2278 Moderate/Sec.  httpd-filesystem-2.4.57-8.el9.noarch
RHSA-2023:6403 Moderate/Sec.  httpd-tools-2.4.57-5.el9.x86_64
RHSA-2024:2278 Moderate/Sec.  httpd-tools-2.4.57-8.el9.x86_64

それなりにRHSAがありますね。これならInspectorで検出してくれそうです。

SSM State ManagerでInspectorInventoryCollection-do-not-deleteを実行し、手動でInspectorのスキャンを行います。

すると、httpdのパッケージを検出することができました。

httpは検出できることを確認

詳細を確認すると、確かにインストールしたパッケージのバージョンが表示されている値と一致しています。

CVEの詳細も確認できる

OSのフルライフサイクルサポートのAppStreamのパッケージは問題なくInspectorで検出できることが分かりました。

PostgreSQL 15 インストール後のInspectorの検出結果の確認

次にPostgreSQL 15で試します。

PostgreSQL 15はOSのフルライフサイクルサポートではありません。また、インストール時にモジュールを指定するタイプのものです。

PostgreSQL 15のモジュールを有効化してインストールします。

$ sudo dnf module list
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:07:08 ago on Tue 21 May 2024 01:18:59 AM UTC.
Red Hat Enterprise Linux 9 for x86_64 - AppStream from RHUI (RPMs)
Name                 Stream           Profiles                                        Summary
mariadb              10.11            client, galera, server [d]                      MariaDB Module
maven                3.8              common [d]                                      Java project management and project comprehension tool
nginx                1.22             common [d]                                      nginx webserver
nginx                1.24             common [d]                                      nginx webserver
nodejs               18               common [d], development, minimal, s2i           Javascript runtime
nodejs               20               common [d], development, minimal, s2i           Javascript runtime
php                  8.1              common [d], devel, minimal                      PHP scripting language
php                  8.2              common [d], devel, minimal                      PHP scripting language
postgresql           15               client, server [d]                              PostgreSQL server and client module
postgresql           16               client, server [d]                              PostgreSQL server and client module
redis                7                common [d]                                      Redis persistent key-value database
ruby                 3.1              common [d]                                      An interpreter of object-oriented scripting language
ruby                 3.3              common [d]                                      An interpreter of object-oriented scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

$ sudo dnf module list postgresql
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:26:26 ago on Tue 21 May 2024 01:27:16 AM UTC.
Red Hat Enterprise Linux 9 for x86_64 - AppStream from RHUI (RPMs)
Name                           Stream                     Profiles                              Summary
postgresql                     15                         client, server [d]                    PostgreSQL server and client module
postgresql                     16                         client, server [d]                    PostgreSQL server and client module

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

$ sudo dnf module enable postgresql:15
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:26:38 ago on Tue 21 May 2024 01:27:16 AM UTC.
Dependencies resolved.
======================================================================================================================================================
 Package                             Architecture                       Version                             Repository                           Size
======================================================================================================================================================
Enabling module streams:
 postgresql                                                             15

Transaction Summary
======================================================================================================================================================

Is this ok [y/N]: y
Complete!

$ sudo dnf module list postgresql
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:26:43 ago on Tue 21 May 2024 01:27:16 AM UTC.
Red Hat Enterprise Linux 9 for x86_64 - AppStream from RHUI (RPMs)
Name                           Stream                     Profiles                              Summary
postgresql                     15 [e]                     client, server [d]                    PostgreSQL server and client module
postgresql                     16                         client, server [d]                    PostgreSQL server and client module

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

$ sudo dnf list postgresql --showduplicates
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:27:19 ago on Tue 21 May 2024 01:27:16 AM UTC.
Available Packages
postgresql.x86_64                                  15.2-1.module+el9.2.0+18159+266a3926                                     rhel-9-appstream-rhui-rpms
postgresql.x86_64                                  15.3-1.module+el9.2.0.z+19113+6f5d9d63                                   rhel-9-appstream-rhui-rpms
postgresql.x86_64                                  15.5-1.module+el9.2.0.z+20667+a2d2a8a9                                   rhel-9-appstream-rhui-rpms
postgresql.x86_64                                  15.6-1.module+el9.3.0+21283+b0ea34b6                                     rhel-9-appstream-rhui-rpms

$ sudo dnf install postgresql-15.2
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:29:39 ago on Tue 21 May 2024 01:27:16 AM UTC.
Dependencies resolved.
======================================================================================================================================================
 Package                             Architecture       Version                                          Repository                              Size
======================================================================================================================================================
Installing:
 postgresql                          x86_64             15.2-1.module+el9.2.0+18159+266a3926             rhel-9-appstream-rhui-rpms             1.7 M
Installing dependencies:
 postgresql-private-libs             x86_64             15.6-1.module+el9.3.0+21283+b0ea34b6             rhel-9-appstream-rhui-rpms             140 k

Transaction Summary
======================================================================================================================================================
Install  2 Packages

Total download size: 1.8 M
Installed size: 6.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): postgresql-private-libs-15.6-1.module+el9.3.0+21283+b0ea34b6.x86_64.rpm                                        1.6 MB/s | 140 kB     00:00
.
.
(中略)
.
.
Installed:
  postgresql-15.2-1.module+el9.2.0+18159+266a3926.x86_64              postgresql-private-libs-15.6-1.module+el9.3.0+21283+b0ea34b6.x86_64

Complete!

AppStreamリポジトリからインストールされていそうです。

インストール完了後、インストール元のリポジトリ名からでも分かります。

$ sudo dnf repoquery \
  --installed \
  --qf '%{name}|%{version}|%{release}|%{repoid}|%{from_repo}\n' \
  | grep 'postgresql' \
  | column -ts '|'
postgresql-private-libs  15.6  1.module+el9.3.0+21283+b0ea34b6  @System  rhel-9-appstream-rhui-rpms
postgresql               15.2  1.module+el9.2.0+18159+266a3926  @System  rhel-9-appstream-rhui-rpms

インストールしたバージョンに対するRHSAも確認できました。

$ sudo dnf updateinfo list | grep postgresql
RHSA-2023:4327 Moderate/Sec.  postgresql-15.3-1.module+el9.2.0.z+19113+6f5d9d63.x86_64
RHSA-2023:7785 Important/Sec. postgresql-15.5-1.module+el9.2.0.z+20667+a2d2a8a9.x86_64
RHSA-2024:0950 Important/Sec. postgresql-15.6-1.module+el9.3.0+21283+b0ea34b6.x86_64

SSM State ManagerでInspectorInventoryCollection-do-not-deleteを実行し、手動でInspectorのスキャンを行います。

すると、PostgreSQLのパッケージを検出することができました。

PostgreSQLも検出できることを確認

詳細を確認すると、確かに先ほどインストールしたPostgreSQL 15であることが分かります。

CVE-2024-0985 - postgresql

RHSAに記載されているCVEとも一致しています。

ということで、サポート期限がOSと同じであるかどうか関わらずAppStreamからインストールしたパッケージはInspectorで検出できることが分かりました。

AppStreamからインストールしたパッケージはInspectorで検出できる

Amazon InspectorでRed Hat Application Streamsからインストールしたパッケージは検出できるのか確認してみました。

結論、できます。

ドキュメントに書いてあっても疑問に思ったことは試してみるのは重要ですね。

この記事が誰かの助けになれば幸いです。

以上、AWS事業本部 コンサルティング部の のんピ(@non____97)でした!