RHEL系Linuxでセキュリティパッチを適用する方法|dnf update --advisory=<advisory-id>

目次

スポンサードリンク

RHEL系のLinuxでは dnf コマンド(または yum)でパッケージを管理します。パッケージにセキュリティ上の問題がある場合、問題を修正したバージョンのパッケージが提供されます。この記事では、特定のパッケージに対し、セキュリティパッチの有無を調べる方法と、セキュリティパッチを適用する方法を解説します。

セキュリティパッチが提供されているか調査する方法

セキュリティパッチが提供されているか、dnf updateinfo コマンドで確認することができます。以下例では unbound パッケージでセキュリティアップデートが提供されていることが分かります。Type: で始まる行にアップデートの理由が書かれていますが、今回のケースは「security」となっており、セキュリティ関連のアップデートだとここから判断できます。他にも「bugfix」などがあります。

# dnf updateinfo info unbound
Last metadata expiration check: 0:52:17 ago on Thu 29 May 2025 10:08:31 AM JST.
===============================================================================
Important: unbound security update
===============================================================================
Update ID: RHSA-2025:0837
    Type: security
    Updated: 2025-01-30 21:37:49
    Bugs: 2264183 - CVE-2024-1488 unbound: unrestricted reconfiguration enabled to anyone that may lead to local privilege escalation
        : 2316321 - CVE-2024-8508 unbound: Unbounded name compression could lead to Denial of Service
    CVEs: CVE-2024-1488
        : CVE-2024-8508
Description: The unbound packages provide a validating, recursive, and caching DNS or DNSSEC resolver.
       :
       : Security Fix(es):
       :
       : * unbound: unrestricted reconfiguration enabled to anyone that may lead to local privilege escalation (CVE-2024-1488)
       :
       : * unbound: Unbounded name compression could lead to Denial of Service (CVE-2024-8508)
       :
       : For more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section.
Severity: Important

関連記事
RHEL系Linuxで特定パッケージの更新情報を確認する方法|dnf updateinfo

このセキュリティパッチのみを反映したい場合、下記コマンドで、パッチのID を指定してパッチを適用します。advisory-id と記載がある箇所は、Update IDを指定します。上記 unbound の例であれば、RHSA-2025:0837 が該当します。

# dnf update --advisory=<advisory-id>

RHEL や CentOS の場合、セキュリティアドバイザリIDには RHSA (Red Hat Security Advisory) というプレフィックスが付き、その後に年と一意の番号が続きます。

例: RHSA-2025:0837

アドバイザリIDを指定してパッケージを更新する例

下記コマンドは アドバイザリIDを指定してパッケージを更新する際の実行例です。先程とりあげた unbound を例に試した結果です。unbound と 依存関係があるパッケージが更新対象になっていることを確認できます。

# dnf update --advisory=RHSA-2025:0837
Last metadata expiration check: 0:59:06 ago on Thu 29 May 2025 10:08:31 AM JST.
Dependencies resolved.
====================================================================================================================================================================================================================
Package                                           Architecture                             Version                                              Repository                                                    Size
====================================================================================================================================================================================================================
Upgrading:
python3-unbound                                   x86_64                                   1.16.2-5.8.el8_10                                    rhel-8-appstream-rhui-rpms                                   130 k
unbound                                           x86_64                                   1.16.2-5.8.el8_10                                    rhel-8-appstream-rhui-rpms                                   1.0 M
unbound-libs                                      x86_64                                   1.16.2-5.8.el8_10                                    rhel-8-appstream-rhui-rpms                                   577 k

Transaction Summary
====================================================================================================================================================================================================================
Upgrade  3 Packages

Total download size: 1.7 M
Is this ok [y/N]:



Linuxコマンドについて学べるおすすめ書籍
Linuxコマンドの知識は、プログラマにとって長く役立つ知識です。 私はこちらの書籍で一通り知識を抑えました。基本から丁寧に解説されています。

Linux教科書 図解でパッとわかる LPIC/LinuC
はじめてLPICを受ける方向け、手を動かしながらLinuxについて学びたい方におすすめ。30日間の無料体験もできる『Kindle Unlimited』でも読むことができます。