我必须修补旧的CentOS 4.9服务器,因此我从Red Hat FTP中获取了最新的源RPM,并从GNU FTP中添加了上游补丁。步骤如下:
首先,按照http://bradthemad.org/tech/notes/patching_rpms.php中的“设置”过程进行操作:
echo "%_topdir /home/$(whoami)/src/rpm" > ~/.rpmmacros
mkdir -p ~/src/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS
mkdir -p ~/src/rpm/RPMS/{i386,i486,i586,i686,noarch,athlon}
然后从您的%_topdir运行以下命令:
cd ~/src/rpm
wget http://ftp.redhat.com/redhat/linux/updates/enterprise/4ES/en/os/SRPMS/bash-3.0-27.el4.src.rpm
rpm -ivh bash-3.0-27.el4.src.rpm
cd SOURCES
wget http://ftp.gnu.org/gnu/bash/bash-3.0-patches/bash30-017
cd ..
使用此差异修补SPECS / bash.spec:
4c4
< Release: 27%{?dist}
---
> Release: 27.2%{?dist}
28a29
> Patch17: bash30-017
110c111,112
< #%patch16 -p0 -b .016
---
> %patch16 -p0 -b .016
> %patch17 -p0 -b .017
然后完成以下命令:
rpmbuild -ba SPECS/bash.spec
sudo rpm -Uvh RPMS/i386/bash-3.0-27.2.i386.rpm
编辑: Red Hat Bugzilla中的最新评论说补丁不完整。新的ID为CVE-2014-7169。
编辑: gnu.org提供了两个其他补丁,因此也将它们下载到相同的SOURCES目录中:
wget http://ftp.gnu.org/gnu/bash/bash-3.0-patches/bash30-018
wget http://ftp.gnu.org/gnu/bash/bash-3.0-patches/bash30-019
然后还如下编辑SPECS / bash.spec(“ Release”编号可选):
4c4
< Release: 27%{?dist}
---
> Release: 27.2.019%{?dist}
28a29,31
> Patch17: bash30-017
> Patch18: bash30-018
> Patch19: bash30-019
110c113,116
< #%patch16 -p0 -b .016
---
> %patch16 -p0 -b .016
> %patch17 -p0 -b .017
> %patch18 -p0 -b .018
> %patch19 -p0 -b .019