bashの脆弱性問題で、Debianで既にアップデートされないバージョンであるところの、woody (3.0), sarge (3.1), etch (4.0), lenny (5.0)に対して、簡単に対応する手法があるのか?というのを調べてみた。
Seewebというクラウドとホスティングをやっている会社にお勤めのDebianメンテナのMarco d’Itriさんが、会社の後援を受けて古いバージョン用の非公式debianパッケージを公開してくれています。
「CVE-2014-6271 fix for Debian woody, sarge, etch and lenny」
配布場所については、上記からたどってください。
(http://ftp.linux.it/pub/People/md/bash/ なんですが、Seeweb社の後援を受けて公開されていますので、敬意を表してここから配布場所への直リンクはしないでおきます)
どのバージョンのbashをダウンロードすればいいのかは、現在インストールされているパッケージのバージョンを調べてください。
olddebian:~# dpkg -l|grep bash
ii bash 3.2-4 The GNU Bourne Again SHell
ii bash-completion 20080705 programmable completion for the bash shell
olddebian:~#
上記であれば、「bash」の「3.2-4」です。
配布場所のファイル一覧から「bash_3.2-4.???_amd64.deb」や「bash_3.2-4.???_i386.deb」のうち、数字が一番新しいものを探します。
2014/09/30 20:00現在だと「bash_3.2-4.2_amd64.deb」が最新でした。
これをwgetコマンドなどでダウンロードし、dpkg -iでインストールします。
手順としては、まずは、https://github.com/hannob/bashcheck/からbash脆弱性確認スクリプトを入手します。
olddebian:~# wget --no-check-certificate https://github.com/hannob/bashcheck/raw/master/bashcheck
<略>
olddebian:~# chmod a+x bashcheck
olddebian:~# ./bashcheck
Vulnerable to CVE-2014-6271 (original shellshock)
Vulnerable to CVE-2014-7169 (taviso bug)
./bashcheck: line 18: 20675 Segmentation fault bash -c "true $(printf '<<EOF %.0s' {1..79})" 2> /dev/null
Vulnerable to CVE-2014-7186 (redir_stack bug)
Test for CVE-2014-7187 not reliable without address sanitizer
Variable function parser still active, likely vulnerable to yet unknown parser bugs like CVE-2014-6277 (lcamtuf bug)
olddebian:~#
脆弱性があることを確認したら、配布元のページから、debパッケージをダウンロードします。
「wget http://ftp.linux.it/pub/People/md/bash/bash_~.deb」という感じでダウンロードします。
ダウンロード後は、debパッケージを「dpkg -i」でインストールします。
olddebian:~# dpkg -i bash_3.2-4.2_i386.deb
(Reading database ... 19825 files and directories currently installed.)
Preparing to replace bash 3.2-4 (using bash_3.2-4.2_i386.deb) ...
Unpacking replacement bash ...
Setting up bash (3.2-4.2) ...
Processing triggers for man-db ...
olddebian:~#
インストール後、パッケージバージョンの確認と、脆弱性確認を行います。
olddebian:~# dpkg -l|grep bash
ii bash 3.2-4.2 The GNU Bourne Again SHell
ii bash-completion 20080705 programmable completion for the bash shell
olddebian:~# ./bashcheck
Not vulnerable to CVE-2014-6271 (original shellshock)
Not vulnerable to CVE-2014-7169 (taviso bug)
Not vulnerable to CVE-2014-7186 (redir_stack bug)
Test for CVE-2014-7187 not reliable without address sanitizer
Variable function parser inactive, likely safe from unknown parser bugs
olddebian:~#
これで、現段階では、問題がなくなりました。
おまけ
squeeze(6.0)の場合、squeeze-ltsに切り替えることで対応できます。
「/etc/apt/sources.list」に以下を追加します。
deb http://http.debian.net/debian squeeze-lts main contrib non-free
deb-src http://http.debian.net/debian squeeze-lts main contrib non-free
そして、bashだけをアップデートしたいのであれば、以下を実行します。
root@olddebian:~# apt-get update
<略>
root@olddebian:~# apt-get install -t squeeze-lts --only-upgrade bash
<略>
root@olddebian:~#
ネタ元:「How to only install security updates on debian」「bash vulnerability CVE-2014-6271 (Shellshock) fix on debian squeeze [duplicate]」