LoginSignup
3
1

More than 3 years have passed since last update.

CentOS Linux では dnf コマンドで --security オプションが使えない

Last updated at Posted at 2020-04-26

dnf コマンドの --security オプション

dnf コマンドには dnf upgrade などでパッケージを更新する際に、セキュリティ修正があるパッケージのみを対象とする --security オプションが存在する。

DNF Command Reference — dnf latest documentation

dnf [options] upgrade
Updates each package to the latest version that is both available and resolvable.

DNF Command Reference — dnf latest documentation

--security
Includes packages that provide a fix for a security issue. Applicable for the upgrade command.

ただし、このオプションは Red Hat Enterprise Linux では利用可能だが CentOS では使えない。CentOS ではセキュリティのメタデータを持っていないため使えないとのこと。

CentOS errata : bug and security fixes - CentOS

There is no security metadata in the CentOS yum repos which means that running yum --security update does nothing useful. However, just running yum update applies all outstanding patches including those released for security purposes.

So the answer is: just run yum update

yum list-security vs yum yum --security list updates - CentOS

I'm surprised that either of them work - security information is provided by Redhat only and there is no equivalent CentOS feed for it so the yum-security plugin is a no-op on CentOS.

No see packages informations - Page 2 - CentOS

We do not supply security metadata for ANY CentOS version. Not CentOS 8 or 7 or 6 or 5...

Reminder: CentOS automatic security updates DO NOT WORK | AWS Consulting | Casey Labs

Why doesn’t it work on CentOS? The updateinfo.xml in the CentOS repositories do not include classifications for security patches. So when you run yum upgrade –security on a CentOS box, CentOS can’t find any security-only updates, and hence thinks everything is up to date.

実例

実際に --security オプションを指定してみると、セキュリティ修正のあるパッケージ更新があっても「セキュリティー更新は必要ありませんが」と表示されてしまう。

$ sudo dnf check-update --security
メタデータの期限切れの最終確認: 0:35:24 時間前の 2020年04月26日 22時25分21秒 に実施しました。
セキュリティー更新は必要ありませんが、8 更新が利用可能です
$ sudo dnf --security upgrade
メタデータの期限切れの最終確認: 0:35:31 時間前の 2020年04月26日 22時25分21秒 に実施しました。
セキュリティー更新は必要ありませんが、8 更新が利用可能です
依存関係が解決しました。
行うべきことはありません。
完了しました!

実際にはセキュリティ修正のあるパッケージが更新されている可能性があるので --security オプションを指定せずに更新をする必要がある (状況によってはパッケージ全てではなく個別に更新をする必要があるかもしれない)。

$ sudo dnf check-update
メタデータの期限切れの最終確認: 0:35:46 時間前の 2020年04月26日 22時25分21秒 に実施しました。

git.x86_64                                                   2.18.2-2.el8_1                                    AppStream
git-core.x86_64                                              2.18.2-2.el8_1                                    AppStream
git-core-doc.noarch                                          2.18.2-2.el8_1                                    AppStream
java-1.8.0-openjdk.x86_64                                    1:1.8.0.252.b09-2.el8_1                           AppStream
java-1.8.0-openjdk-headless.x86_64                           1:1.8.0.252.b09-2.el8_1                           AppStream
java-11-openjdk.x86_64                                       1:11.0.7.10-1.el8_1                               AppStream
java-11-openjdk-headless.x86_64                              1:11.0.7.10-1.el8_1                               AppStream
perl-Git.noarch                                              2.18.2-2.el8_1                                    AppStream
$ sudo dnf upgrade
メタデータの期限切れの最終確認: 0:35:56 時間前の 2020年04月26日 22時25分21秒 に実施しました。
依存関係が解決しました。
========================================================================================================================
 パッケージ                             アーキテクチャー  バージョン                         リポジトリー         サイズ
========================================================================================================================
アップグレード:
 git                                    x86_64            2.18.2-2.el8_1                     AppStream            186 k
 git-core                               x86_64            2.18.2-2.el8_1                     AppStream            5.0 M
 git-core-doc                           noarch            2.18.2-2.el8_1                     AppStream            2.3 M
 java-1.8.0-openjdk                     x86_64            1:1.8.0.252.b09-2.el8_1            AppStream            320 k
 java-1.8.0-openjdk-headless            x86_64            1:1.8.0.252.b09-2.el8_1            AppStream             33 M
 java-11-openjdk                        x86_64            1:11.0.7.10-1.el8_1                AppStream            247 k
 java-11-openjdk-headless               x86_64            1:11.0.7.10-1.el8_1                AppStream             40 M
 perl-Git                               noarch            2.18.2-2.el8_1                     AppStream             77 k

トランザクションの概要
========================================================================================================================
アップグレード  8 パッケージ

ダウンロードサイズの合計: 81 M
これでよろしいですか? [y/N]: y

この例では java-1.8.0-openjdk パッケージの 1.8.0.252.b09-2.el8_1 バージョンがセキュリティ修正のパッケージ更新となっているのに --security オプションを付けても更新対象ではなくなってしまっている。

このパッケージがセキュリティ修正対象であるという情報は RedHat の Security Advisory サイトに載っている。

RHSA-2020:1515 - Security Advisory - Red Hat カスタマーポータル

Important: java-1.8.0-openjdk security update

java-1.8.0-openjdk-1.8.0.252.b09-2.el8_1.x86_64.rpm

今回の動作確認環境

$ cat /etc/centos-release
CentOS Linux release 8.1.1911 (Core) 
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1