9
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Amazonlinux2におけるsudoアップデート手順

Last updated at Posted at 2021-01-28

経緯

sudo脆弱性に関する周知があったのでsudoのアップデート対応することとなった

sudoの脆弱性(CVE-2021-3156)に関する注意喚起

対象のOSイメージ

Amazon linux2

バージョン確認方法

sudoedit -s / コマンドを実行する

対応が必要

sudoedit:から始まるエラーが表示されると脆弱性の影響を受ける

対応が不要

usage:から始まるエラーが表示されると影響を受けない

更新手順

# 1. 脆弱性のあるバージョンか確認
sudoedit -s /
 
# 2. yumのアップデート確認
yum check-update | grep sudo
 
# 3. パッケージを指定してアップデート
sudo yum update sudo
 
# 4. 修正後の確認
sudoedit -s /

実際に適用してみる

1.にてバージョン確認をしてみると、事前情報の通り、対応が必要なバージョンということがわかる

sh-4.2$ sudoedit -s /
sudoedit: /: not a regular file

2.sudoバージョン確認で新しいアップデートがきていることがわかる。

sh-4.2$ yum check-update | grep sudo
sudo.x86_64                           1.8.23-4.amzn2.2.1       amzn2-core

3.の手順でインストール

sh-4.2$ yum update sudo
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
You need to be root to perform this command.
sh-4.2$ sudo yum update sudo
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                             | 3.7 kB  00:00:00
amzn2extra-docker                                                                                                                      | 3.0 kB  00:00:00
mysql-connectors-community                                                                                                             | 2.6 kB  00:00:00
mysql-tools-community                                                                                                                  | 2.6 kB  00:00:00
mysql80-community                                                                                                                      | 2.6 kB  00:00:00
39 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package sudo.x86_64 0:1.8.23-4.amzn2.2 will be updated
---> Package sudo.x86_64 0:1.8.23-4.amzn2.2.1 will be an update
--> Finished Dependency Resolution
 
Dependencies Resolved
 
==============================================================================================================================================================
 Package                         Arch                              Version                                        Repository                             Size
==============================================================================================================================================================
Updating:
 sudo                            x86_64                            1.8.23-4.amzn2.2.1                             amzn2-core                            844 k
 
Transaction Summary
==============================================================================================================================================================
Upgrade  1 Package
 
Total download size: 844 k
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
sudo-1.8.23-4.amzn2.2.1.x86_64.rpm                                                                                                     | 844 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : sudo-1.8.23-4.amzn2.2.1.x86_64                                                                                                             1/2
  Cleanup    : sudo-1.8.23-4.amzn2.2.x86_64                                                                                                               2/2
  Verifying  : sudo-1.8.23-4.amzn2.2.1.x86_64                                                                                                             1/2
  Verifying  : sudo-1.8.23-4.amzn2.2.x86_64                                                                                                               2/2
 
Updated:
  sudo.x86_64 0:1.8.23-4.amzn2.2.1
 
Complete!

4.修正されたか確認

 sudoedit -s /
usage: sudoedit [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u user] file ...

バージョンアップ後の挙動となったので、対応完了と判断。

おつかれさまでした。

9
5
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
9
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?