LoginSignup
2

More than 5 years have passed since last update.

CentOS7で手動でkernelバージョンアップ

Last updated at Posted at 2016-11-11

備忘録です。

手順

とりあえず手動では以下のような感じに。packerとjenkinsで定期自動ビルドしててyum update勝手にされるからBGデプロイすればオッケーみたいなことでは済まない挿げ替えられない場合に。

$ wget https://access.redhat.com/sites/default/files/rh-cve-2016-5195_2.sh
$ bash rh-cve-2016-5195_2.sh
Your kernel is 3.10.0-327.10.1.el7.x86_64 which IS vulnerable.

$ sudo yum update kernel
インストール:
  kernel.x86_64 0:3.10.0-327.36.3.el7                                                                                                                                                         
依存性関連をインストールしました:
  linux-firmware.noarch 0:20150904-43.git6ebf5d5.el7                                                                                                                                          
完了しました!
$ sudo awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
CentOS Linux (3.10.0-327.36.3.el7.x86_64) 7 (Core)
CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-f32e0af35637b5dfcbedcb0a1de8dca1) 7 (Core)
$ uname -r
3.10.0-327.10.1.el7.x86_64
$ sudo grub2-set-default 0
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.36.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.36.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.10.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.10.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-f32e0af35637b5dfcbedcb0a1de8dca1
Found initrd image: /boot/initramfs-0-rescue-f32e0af35637b5dfcbedcb0a1de8dca1.img
done
$ uname -r
3.10.0-327.10.1.el7.x86_64
$ sudo reboot
$ ssh -i .ssh/eshop-test.pem user@host
$ uname -r
3.10.0-327.36.3.el7.x86_64
$ bash rh-cve-2016-5195_2.sh
Your kernel is 3.10.0-327.36.3.el7.x86_64 which is NOT vulnerable.

7は/etc/grub.conf手動編集とか要らないようで楽でいいなと思いました。
(centos6は/etc/grub.confがあればそのdefaultの番号を、ない場合は/boot/grub/menu.lstを手で編集だった)
あとrpmコマンドでchangelogみてもあんまり何も書いて無くてopensslとはちょっと違うんだなあと思ったかな。
elrepoというyumリポジトリを使うと最新のkernelを使えるらしいけどOSのメジャーバージョンがあがるとかの場合にうっとおしいかもしれないらしいと先輩に聞いた気が。メジャーバージョンってレベルだとどちらにせよ移行な気はするけどまあ最新でいろいろしたいという話でもなくてパッチが出てたのでそれでいいかなという。
Dirtyなんとか的な対応としては、ローカルに入れているような状態でないとアレらしいので対応はするけど隙をみてだんだんとという。
以上。

参考サイト

http://soymsk.hatenablog.com/entry/2015/11/20/003401
http://jvn.jp/vu/JVNVU91983575/
https://nazx.jp/x/CentOS_TIPS_021
http://blog.suz-lab.com/2013/06/centos6suz-lab-ami.html
http://www.agilegroup.co.jp/technote/dirty-cow.html

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
2