Roll your own Nginx RPM
Courtenay : September 14th, 2009
Nginx just released a vulnerability fix. It's a nasty one, since it allows remote execution. Since RPMs don't exist yet, here's a quick-and-dirty way to roll your own on Fedora-based systems. I basically followed these guides: http://www.linuxweblog.com/patch-rebuild-rpm and http://perso.b2b2c.ca/sarrazip/dev/rpm-building-crash-course.html
Since on this server I'm running 0.6.3x, I'll be updating to that version. The fixed version is 0.6.39.
While they do the building from their own user account, a commenter suggests setting up an account specifically for building RPMs. The latter is probably preferable, but we're going to ignore that in the interests of expediency.
Assuming you never built an RPM before:
Install RPM build tools and setup your environment
# yum install rpm-buildNow, create
~/.rpmmacroswith this line%topdir /home/youruserid/rpm
And create a bunch of directories
$ mkdir ~/rpm $ cd ~/rpm $ mkdir SOURCES SPECS BUILD SRPMS
Find the most recent nginx source package on rpmfind.net. This will give you a working recent RPM to fix.
Install the .src.rpm package with
rpm -i nginx-0.6.38-1.src.rpmwhich installs the necessary files into~/rpm/SOURCESHere's the hacky part. Download
nginx-0.6.39.tar.gzand copy it to~/rpm/SOURCES. Then, edit the~/rpm/SPECS/nginx.specfile and replace "6.38" with "6.39" wherever it occurs (just once, I believe).Now, build the RPM with
rpmbuild -ba SPECS/nginx.specOn my system, I had to also install (with yum)
pcre,pcre-devel, andperl-ExtUtils-Embedbefore nginx would build.Now, wait while it builds.
You now should have
nginx-0.6.39-1.fc8.x86_64.rpm(or whatever your system is.)# rpm -Uvh nginx-0.6.39-1.fc8.x86_64.rpm# /etc/init.d/nginx restart
Done!
Sorry, comments are closed for this article.