IPFireでパッケージのインストールやアップデートができない


ESXiの上で、ネットワークを2つ作り、それぞれをVPN接続する、というテスト環境を作ろうとした。

VPNルータをどうするか悩んだのだが、Linuxベースの「IPFire」というので構築することにした。
(Endian FirewallのComminity Editionだとうまく構成が作れなかった)

決め手の1つに、vmware-toolsを容易にインストールすることができる、ということがあった。
が、「手順」の通りにやろうとしても、エラーとなる。

状況としては、「pakfire update problem」と全く同じモノ。
(上記のURLよりエラーを引用)

Sep  7 21:15:34 serwer1 pakfire: PAKFIRE INFO: IPFire Pakfire 2.15 started!
Sep  7 21:15:34 serwer1 pakfire: CRYPTO INFO: Checking GnuPG Database
Sep  7 21:15:34 serwer1 pakfire: CRYPTO WARN: The GnuPG isn't configured corectly. Trying now to fix this.
Sep  7 21:15:34 serwer1 pakfire: CRYPTO WARN: It's normal to see this on first execution.
Sep  7 21:17:34 serwer1 pakfire: Sending my uuid: 168d3c61-ae2a-454f-81a1-48a817470c37
Sep  7 21:17:34 serwer1 pakfire: DOWNLOAD STARTED: counter.py?ver=2.15&uuid=168d3c61-ae2a-454f-81a1-48a817470c37
Sep  7 21:17:34 serwer1 pakfire: DOWNLOAD INFO: Host: pakfire.ipfire.org (HTTP) - File: counter.py?ver=2.15&uuid=168d3c61-ae2a-454f-81a1-48a817470c37
Sep  7 21:17:34 serwer1 pakfire: DOWNLOAD INFO: HTTP-Status-Code: 200 - 200 OK
Sep  7 21:17:34 serwer1 pakfire: DOWNLOAD STARTED: 2.15/lists/server-list.db
Sep  7 21:17:34 serwer1 pakfire: DOWNLOAD INFO: Host: pakfire.ipfire.org (HTTP) - File: 2.15/lists/server-list.db
Sep  7 21:17:35 serwer1 pakfire: DOWNLOAD INFO: 2.15/lists/server-list.db has size of 907 bytes
Sep  7 21:17:35 serwer1 pakfire: DOWNLOAD INFO: HTTP-Status-Code: 200 - 200 OK
Sep  7 21:17:35 serwer1 pakfire: DOWNLOAD INFO: File received. Start checking signature...
Sep  7 21:17:35 serwer1 pakfire: DOWNLOAD ERROR: The downloaded file (2.15/lists/server-list.db) wasn't verified by IPFire.org. Sorry - Exiting...
Sep  7 21:18:06 serwer1 pakfire: TIME INFO: Time Server 217.153.128.243 has 0.010834 sec offset to localtime.

解決方法として、外部の11371ポートに対する通信を許可すること、と書かれている。
PakfireのAdditional Note

IPFireの設定をいじってみても解決しない。
なぜ?と考えて見ると、今回作成したテスト環境は、別のFirewallの中にある、というのがポイントだった。
つまり、別のFirewall側に設定を追加する必要があったということ。

そちらの設定変更権限はないので、別の方策がないか捜索したところ、発見。

Pakfire wont update on new install The GnuPG isn’t configured corectly. solved!

「/opt/pakfire/lib/functions.pl」内で
「my $command = “gpg –keyserver pgp.ipfire.org –always-trust –status-fd 2”;」
と書かれているところ、下記のようにポート80でアクセスできるサーバに書き直す。
「my $command = “gpg –keyserver hkp://keyserver.ubuntu.com:80 –always-trust –status-fd 2”;」
というもの。

これを実施したところ、正常に動作するようになった。

ちなみに、上記URLだと、「Core 82で直った」とか書かれてますが、Core82で試して同じ現象でした。

Debianのwoody (3.0), sarge (3.1), etch (4.0), lenny (5.0)でbashの脆弱性問題に対応する手法


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]

RHEL6/CentOS6をOracle Linuxにしてみる


2020/09/28追記

Oracle公式のCentOSからの移行手順「Switch your CentOS systems to Oracle Linux」とRHELからサポートありのOracleLinuxへの移行手順「Switching from Red Hat Network (RHN) to Oracle Unbreakable Linux Network (ULN)

また、逆にRedHat公式によるCentOS/Oracle LinuxからRHELへの移行手順「How to convert from CentOS or Oracle Linux to RHEL

また、レポジトリによっては下記の様なメッセージが出るようになったようです。

IMPORTANT: A legacy Oracle Linux yum server repo file was found. Oracle Linux yum server repository configurations have changed which means public-yum-ol7.repo will no longer be updated. New repository configuration files have been installed but are disabled. To complete the transition, run this script as the root user:

/usr/bin/ol_yum_configure.sh

See https://yum.oracle.com/faq.html for more information.


Oracle Linux用にOpenStackがリリースされた、ということなので、Oracle Linuxの環境を用意してみようと思った。
つい先ほど、RHEL4/CentOS4でOralce Linuxにしてみたので、同じようにできるかな、と思ったらちょっと工夫が必要でした。
(注:手法としては、既知のディストリビューション乗り換え手法なんですけどね)

1. GPG Keyの入手

[root@centos6 ~]# wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
--2014-09-26 16:40:22--  http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
public-yum.oracle.com をDNSに問いあわせています... 203.179.83.11, 203.179.83.19
public-yum.oracle.com|203.179.83.11|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 1011 [text/plain]
`/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle' に保存中

100%[===================================================&amp;gt;] 1,011       --.-K/s 時間 0s

2014-09-26 16:40:22 (4.83 MB/s) - `/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle' へ保存完了 [1011/1011]

[root@centos6 ~]# 

2. yumレポジトリの編集
Oracle Linux用レポジトリの追加と、CentOS用レポジトリの削除

[root@centos6 ~]# cd /etc/yum.repos.d
[root@centos6 yum.repos.d]# wget http://public-yum.oracle.com/public-yum-ol6.repo
--2014-09-26 16:40:45--  http://public-yum.oracle.com/public-yum-ol6.repo
public-yum.oracle.com をDNSに問いあわせています... 203.179.83.11, 203.179.83.19
public-yum.oracle.com|203.179.83.11|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 4233 (4.1K) [text/plain]
`public-yum-ol6.repo' に保存中

100%[===================================================&amp;gt;] 4,233       --.-K/s 時間 0s

2014-09-26 16:40:46 (323 MB/s) - `public-yum-ol6.repo' へ保存完了 [4233/4233]

[root@centos6 yum.repos.d]# ls
CentOS-Base.repo       CentOS-Media.repo  public-yum-ol6.repo
CentOS-Debuginfo.repo  CentOS-Vault.repo
[root@centos6 yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.disable
[root@centos6 yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.disable
[root@centos6 yum.repos.d]# mv CentOS-Media.repo CentOS-Media.repo.disable
[root@centos6 yum.repos.d]# mv CentOS-Vault.repo CentOS-Vault.repo.disable
[root@centos6 yum.repos.d]#

で、アップデート実施

[root@centos6 yum.repos.d]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Update Process
Resolving Dependencies
--&amp;gt; Running transaction check
---&amp;gt; Package audit.x86_64 0:2.2-2.el6 will be updated
<略>
Transaction Check Error:
  file /etc/issue from install of oraclelinux-release-6:6Server-5.0.2.x86_64 conflicts with file from package centos-release-6-4.el6.centos.10.x86_64
  file /etc/issue.net from install of oraclelinux-release-6:6Server-5.0.2.x86_64 conflicts with file from package centos-release-6-4.el6.centos.10.x86_64
  file /etc/redhat-release from install of oraclelinux-release-6:6Server-5.0.2.x86_64 conflicts with file from package centos-release-6-4.el6.centos.10.x86_64
  file /etc/rpm/macros.dist from install of oraclelinux-release-6:6Server-5.0.2.x86_64 conflicts with file from package centos-release-6-4.el6.centos.10.x86_64
  file /etc/system-release from install of oraclelinux-release-6:6Server-5.0.2.x86_64 conflicts with file from package centos-release-6-4.el6.centos.10.x86_64
  file /etc/system-release-cpe from install of oraclelinux-release-6:6Server-5.0.2.x86_64 conflicts with file from package centos-release-6-4.el6.centos.10.x86_64

Error Summary
-------------

[root@centos6 yum.repos.d]#

oraclelinux-releaseパッケージと、centos-releaseパッケージが競合するというもの。

/var/cache/yum/x86_64/6/ol6_latest/packages/に、oraclelinux-releaseパッケージがダウンロードされているので、rpmコマンドを使って強制的にインストールする。

[root@centos6 yum.repos.d]# rpm -Uvh --force /var/cache/yum/x86_64/6/ol6_latest/packages/oraclelinux-release-6Server-5.0.2.x86_64.rpm /var/cache/yum/x86_64/6/ol6_latest/packages/redhat-release-server-6Server-6.5.0.1.0.1.el6.x86_64.rpm
準備中...                ########################################### [100%]
   1:redhat-release-server  ########################################### [ 50%]
   2:oraclelinux-release    ########################################### [100%]
[root@centos6 yum.repos.d]#

これで「yum update」が可能になりました。

再起動後は以下の様な状態となりました。

[root@centos6 ~]# uname -a
Linux centos6.adosakana.net 2.6.32-431.29.2.el6.x86_64 #1 SMP Tue Sep 9 11:28:47 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@centos6 ~]# rpm -qa|grep release
redhat-release-server-6Server-6.5.0.1.0.1.el6.x86_64
centos-release-6-4.el6.centos.10.x86_64
oraclelinux-release-6Server-5.0.2.x86_64
[root@centos6 ~]# cat /etc/motd
[root@centos6 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@centos6 ~]#

ちなみに、Oracle Linux 6では、以下の追加レポジトリがある。
・MySQL 5.5 (ol6_MySQL)
・MySQL 5.6 (ol6_MySQL56)
・Unbrakable Enterprise kernel 2.6.39 (ol6_UEK_latest)
・Unbrakable Enterprise kernel 3.8.13 (ol6_UEKR3_latest)
・常に最新kernel。 (ol6_playground_latest)

詳細については、以前書いた「Oracle Linux用の公開レポジトリについて」を参照のこと。

RHEL4/CentOS4をOracle Linux4に!


今回の件を検証するため、CentOS4をセットアップした。

が・・・yum updateとかすると、エラー。
原因はCentOS4のレポジトリがアーカイブ化されてしまい、ミラーされなくなったため。

[root@centos4 ~]# yum update
Setting up Update Process
Setting up repositories
not using ftp, http[s], or file for repos, skipping - 4 is not a valid release or hasnt been released yet
Cannot find a valid baseurl for repo: update
Error: Cannot find a valid baseurl for repo: update
[root@centos4 ~]#

/etc/yum.repos.d/CentOS-Base.repo内にある「http://mirror.centos.org/centos/$releasever/」を「http://vault.centos.org/4.9/」、「http://mirror.centos.org/centos/RPM-GPG-KEY-centos4」を「http://vault.centos.org/RPM-GPG-KEY-centos4」に書き換え、また、「mirrorlist=~」をコメントにし、逆に「#baseurl=~」のコメントを外すことでアップデートはできるようになる。

が・・・、面倒なので、Oracle LinuxのPublic Yum Serverを使用するように切り替えてみる。
つまりは、Oracle Linuxへの乗り換え、ということになる。

切り替え手順は簡単。
How can I convert an RHEL or RHEL-compatible system to Oracle Linux using public-yum?」と「Getting Started」を行う。

具体的には、「OracleのGPGキーを登録」してから、「Yumレポジトリを追加」、ということになる。

[root@centos4 ~]# wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el4 -O /usr/share/rhn/RPM-GPG-KEY-oracle
--01:57:00--  http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el4
           => `/usr/share/rhn/RPM-GPG-KEY-oracle'
public-yum.oracle.com をDNSに問いあわせています... 203.179.83.11, 203.179.83.19
public-yum.oracle.com|203.179.83.11|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 1,744 (1.7K) 

100%[====================================>] 1,744         --.--K/s

01:57:01 (87.54 MB/s) - `/usr/share/rhn/RPM-GPG-KEY-oracle' を保存しました [1744/1744]

[root@centos4 ~]# gpg --quiet --with-fingerprint /usr/share/rhn/RPM-GPG-KEY-oracle
gpg: failed to create temporary file `/root/.gnupg/.#lk0x552ac57280.centos4.adosakana.net.4053': そのようなファイルやディレクトリはありません
gpg: 新しい構成ファイル`/root/.gnupg/gpg.conf'ができました
gpg: 警告: 「/root/.gnupg/gpg.conf」のオプションは起動している間、有効になりません
pub  1024D/B38A8516 2006-09-05 Oracle OSS group (Open Source Software group) <build@oss.oracle.com>
                指紋 = 1122 A29A B257 825F 322C  234E 2E2B CDBC B38A 8516
sub  2048g/0042D4F4 2006-09-05 [有効期限: 2011-09-04]
[root@centos4 ~]# cd /etc/yum.repos.d
[root@centos4 yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.disabled
[root@centos4 yum.repos.d]# wget http://public-yum.oracle.com/public-yum-el4.repo
--01:58:33--  http://public-yum.oracle.com/public-yum-el4.repo
           => `public-yum-el4.repo'
public-yum.oracle.com をDNSに問いあわせています... 203.179.83.19, 203.179.83.11
public-yum.oracle.com|203.179.83.19|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 1,191 (1.2K) 

100%[====================================>] 1,191         --.--K/s

01:58:33 (70.99 MB/s) - `public-yum-el4.repo' を保存しました [1191/1191]

[root@centos4 yum.repos.d]#

この後、「yum update」を実行すれば完了です。

ちなみに、この手法でアップデートした場合、release関連情報は以下のようになります。

[root@centos4 ~]# rpm -qa|grep release
enterprise-release-4-3.7.18
[root@centos4 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 9)
[root@centos4 ~]#  rpm -qa|grep logo
oracle-logos-1.1.1-3
[root@centos4 ~]#

また、/etc/yum.repos.d/ULN-Base.repo が追加されますが、こいつが問題児で、2014年9月現在、これは使用できません。
無効にしてしまいましょう。

[root@centos4 ~]# mv /etc/yum.repos.d/ULN-Base.repo /etc/yum.repos.d/ULN-Base.repo.disabled
[root@centos4 ~]#

ついでに、vmware-toolsをyumレポジトリとして追加するには、/etc/yum.repos.d/vmwaretools.repoとして、以下の内容を記載しましょう。

[root@centos4 ~]# cat /etc/yum.repos.d/vmwaretools.repo
[vmwaretools]
name=vmwaretools
baseurl=http://packages.vmware.com/tools/esx/latest/rhel4/x86_64/
gpgcheck=0
[root@centos4 ~]#

X-Windowsがあるシステムの場合「yum install vmware-tools-esx」、X-Windowsがないシステムなら「yum install vmware-tools-esx-nox」でvmware-toolsをインストールできます。

RHEL4/CentOS4向けのbash RPM(10/07 12:00修正)



bash脆弱性について、いろいろ状況が変わりつつあるので書き直し。

RHEL4/CentOS4サーバが生き残っている場合に、簡単に対処する方法があるのか探してみる。

まず、RedHatで情報を探すと、RHEL4については、延長サポート内では以下の脆弱性が該当するようだ。
RHSA-2014:1294-1 Critical: bash security update(CVE-2014-6271)
RHSA-2014:1311-1 Important: bash security update(CVE-2014-7169)

両方のページから情報を見ていくと、以下のページに着く。
Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271, CVE-2014-7169)

さらに、検証や、パッチを提供できない場合に状況を緩和するための方策が掲載されている、以下のページがある。
Mitigating the shellshock vulnerability (CVE-2014-6271 and CVE-2014-7169)

で・・・9/27 7時頃に「Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271, CVE-2014-7169)」を始め、各ページの情報が更新されていた。
Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271, CVE-2014-7169)」の「Products Affected:」の「Red Hat Enterprise Linux 4」欄が「bash-3.0-27.el4.4」に書き換わった。
Important: bash security update」の「Updated packages」が「bash-3.0-27.el4.4.src.rpm」に書き換わった。

というわけで、「bash-3.0-27.el4.4」が出たようだ。

RedHatの延長サポートが提供するSource RPMを入手するのは面倒なので、Oracle LinuxのSource RPMを確認。
https://oss.oracle.com/el4/SRPMS-updates/を見ると、「bash-3.0-27.0.3.el4.src.rpm」が登場している。
Changelogを確認すると、以下の様になっている。

* Fri Sep 26 2014 Todd Vierling &lt;todd.vierling@oracle.com&gt; - 3.0-27.0.3
- Rework env function definition for safety (Florian Weimer) [CVE-2014-7169]

* Thu Sep 25 2014 Todd Vierling &lt;todd.vierling@oracle.com&gt; - 3.0-27.0.2
- Preliminary fix for CVE-2014-7169

* Wed Sep 24 2014 Guangyu Sun &lt;guangyu.sun@oracle.com&gt; - 3.0-27.0.1
- Check for fishy environment (Ondrej Oprala) [CVE-2014-6271]
Resolves: #1141644

RHEL4の「bash-3.0-27.el4.4」での修正内容が分からないので、同等品なのかが判断できないが、不足していたCVE-2014-7169対策の一環である、ということは分かった。

とりあえず、https://oss.oracle.com/el4/SRPMS-updates/bash-3.0-27.0.3.el4.src.rpmを入手して、「rpmbuild –rebuild bash-3.0-27.0.3.el4.src.rpm」でバイナリRPMを作って、インストール・・・・

という風にやってたのですが、しばらく修正が続きそうな感じもあります。
なので、これを機会にOracle Linux 4のPublic yum repositoryを使用してしまおう、という考えもあると思います。
その場合は、「RHEL4/CentOS4をOracle Linux4に!」という別記事の方を参照してください。
この切り替えを行ってしまうと、Oracle Linuxに乗り換える、という話になるのですが、Oracle Linux 4は、それ以降のバージョンと違って、ほとんど差がないですし、元のサポートが切れたRHEL/CentOSの方に戻る、ってことも無いでしょうから、あまり問題はないのではないでしょうか?


2014/09/29 11:00追記
https://github.com/hannob/bashcheckという脆弱性チェックスクリプト

bash-3.0-27.0.3.el4での実行結果は以下の様になった。

./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
#

ちなみに、bash-3.0-27.0.2.el4だと以下だった。

./bashcheck
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'
Not vulnerable to CVE-2014-6271 (original shellshock)
Not vulnerable to CVE-2014-7169 (taviso bug)
./bashcheck: line 18: 3528 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 inactive, likely safe from unknown parser bugs
#

2014/10/07 12:00追記

上記のbashcheckがバージョンアップし、下記の脆弱性に関するチェック項目が増えました。
CVE-2014-6278

bash-3.0-27.0.3.el4での実行結果は以下の様になった。

# ./bashcheck
Testing /bin/bash ...
GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu)

Variable function parser pre/suffixed [(), redhat], bugs not exploitable
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
Found non-exploitable CVE-2014-6277 (lcamtuf bug #1)
Not vulnerable to CVE-2014-6278 (lcamtuf bug #2)
#

CVE-2014-6277の判定は以下で行われていた。

bash -c "f(){ x(){ _;};x(){ _;}<<a;}"

で、これを直接実行すると、以下の結果になる。

# bash -c "f(){ x(){ _;};x(){ _;}<<a;}"
セグメンテーション違反です
# echo $?
139
#

正常終了できてないから問題あり、ということですね。


以下は古い情報です。
アーカイブとして残しておきます。


昨日から、bashの脆弱性に関して騒がしい。

RHEL4/CentOS4サーバが生き残ってる場合、簡単に対処できる方法があるのか探してみる。
まず公式情報を確認。

RHSA-2014:1294-1 Critical: bash security update(CVE-2014-6271)
ここに、「Red Hat Enterprise Linux ELS (v. 4)」「bash-3.0-27.el4.2.src.rpm」があるので、RHEL4の延長サポートであれば修正が出ているようだ。

ただ、延長サポート中のRHEL Souce RPMを探すのはめんどいので、前回と同じく、Oracle LinuxのSource RPM配布場所「https://oss.oracle.com/el4/SRPMS-updates/」をチェックしてみる。

とりあえず、2014年の更新分としては、以下があった。

2014/09/24 bash-3.0-27.0.1.el4.src.rpm
2014/09/25 bash-3.0-27.0.2.el4.src.rpm
2014/06/10 openssl-0.9.7a-43.18.0.2.el4.src.rpm
2014/09/16 tzdata-2014g-1.0.1.el4.src.rpm

bash-3.0-27.0.1.el4.src.rpmなら修正済みのバージョンなんですかね?

ということで・・・「rpmbuild –rebuild bash-3.0-27.0.1.el4.src.rpm」という感じでRPMパッケージを作成してインストールっと。
下記に追加したように修正が完全ではないようでした。

注意: 上記のURLは、source RPMです。コンパイル済みのバイナリRPMは、各自が作成してください。


2014/09/26 9:30追記

bash-3.0-27.0.1.el4.src.rpmの修正内容を確認すると、下記の様に書かれている。

* Wed Sep 24 2014 Guangyu Sun &lt;guangyu.sun@oracle.com&gt; - 3.0-27.0.1
- Check for fishy environment (Ondrej Oprala)
Resolves: #1141644

Oracleの#1141644とは何かを探すと「Oracle alert ELSA-2014-1293 (bash)」で、これは、「RedHat Critical: bash security update RHSA-2014-1293 / CVE-2014-6271」に該当する。

で、「Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271, CVE-2014-7169)」を確認すると、「影響を受けるバージョン」として「Red Hat Enterprise Linux 4 bash-3.0-27.el4.2」が書かれている。

つうわけで、Oracle Linuxのbash 3.0-27.0.1はCVE-2014-7169で、RHELのbash 3.0-27.el4.2はCVE-2014-7169+CVE-2014-6271ということで、パッチが足りていない。
なおかつ、RHELのbash 3.0-27.el4.2、であっても完全な修正は行われていないので、完全な修正のためには次のバージョンを待つ必要がある、と。

じゃぁ、一時的に対処する方法はあるのか?と「Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271, CVE-2014-7169)」に記載されているworkaroundを確認
・「mod_security」を使用
・「iptablesのstringモジュール」を使用

どっちも、RHEL4には存在しないじゃないですかー


2014/09/26 13:30+18:30修正

Oracle public yum の方にbash-3.0-27.0.2.el4.src.rpmが登場
2014/09/25 bash-3.0-27.0.2.el4.src.rpm

といっても、まだ、脆弱性が残ってるバージョンになりますけどね。
とりあえず、「env x='() { :;}; echo vulnerable’ bash -c “echo this is a test”」で確認できる脆弱性については、コレで解決してますね。
ただ、bashの脆弱性は続々発見されているので、どこまでが該当してて、対応しなければならないのかよく分からない・・・


2014/09/26 17:00おまけ

iptablesのstringモジュールって、iptables-1.3.8を持ってくれば使えるのかな?と思って、足りないヘッダファイルをRHEL5から持ってきて、RHEL4環境に入れてみたんですが、RHEL4 kernel側が対応していないので無意味でした。


2014/09/26 20:00追記

RHEL4/CentOS4をOracle Linux4に!」という別記事も書いてたりします。

上記で上げたOracle LinuxのSource RPMを元にしているYUM レポジトリを使用する、という話です。
まぁ、RHEL/CentOSではなく、Oracle Linuxに乗り換える、という話ではありますが、Oracle Linux 4は、それ以降のバージョンと違って、ほとんど差がないですから、気軽に乗り換えることができます。