Modify Apache webserver to show something else on Netcraft

I guess I was wrong. I guess the other reason might be just to look cool for geeks. So here are the steps: 1) download the source rpm for my distro.
2) install it.
rpm -ivh apache-2.0.55-3tr.src.rpm
3) make a patch. Here’s how:
cd /usr/src/trustix/sources
tar jxvf httpd-2.0.55.tar.bz2
cp -pr httpd-2.0.55 httpd-2.0.55-orig
vi httpd-2.0.55/include/ap_release.h
— then change the AP_SERVER_BASEPRODUCT to whatever you want. In my case, I used ShocKNetworK.
4) create a patch.
diff -urN httpd-2.0.55-orig/include/ap_release.h httpd-2.0.55/include/ap_release.h > shock.patch
5) add the patch to the spec file list
vi /usr/src/trustix/specs/apache.spec
added to where it lists the patches (your numbers may vary):
Patch6: shock.patch
and where it does the prep:
%patch6 -p1
(Just do a search for patches and you’ll find it)
6) build the rpm:
rpmbuild -ba /usr/src/trustix/specs/apache.spec In my case, I ran into a dependencies problem:
root@chunli /usr/src/trustix/specs# rpmbuild -ba apache.spec
error: failed build dependencies:
expat-devel is needed by apache-2.0.55-3tr
gdbm-devel is needed by apache-2.0.55-3tr So I just downloaded installed them:
swup –install expat-devel gdbm-devel
Trustix (http://www.trustix.org) has a pretty cool tool called “swup” which is similar to yum (that Fedora http://fedora.redhat.com includes or some others. If you don’t have either of these, you could easily just download the rpms from your mirrors and install them manually. So, after all of the stuff’s built and done, I found my rpms in /usr/src/trustix/rpms/i586 So, I just reinstalled it.
root@chunli /usr/src/trustix/specs# rpm -e –nodeps apache
warning: /etc/httpd/conf/httpd.conf saved as /etc/httpd/conf/httpd.conf.rpmsave
root@chunli /usr/src/trustix/specs# rpm –nodeps –force -Uvh /usr/src/trustix/rpms/i586/apache-2.0.55-3tr.i586.rpm
Preparing… ########################################### [100%]
1:apache ########################################### [100%]
root@chunli /usr/src/trustix/specs# cp /etc/httpd/conf/httpd.conf.rpmsave /etc/httpd/conf/httpd.conf
root@chunli /usr/src/trustix/specs# /etc/init.d/httpd restart It’s pretty simple stuff – definitely not rocket science. Something to do when you’re bored I guess. Another thing is, if you go to Netcraft and you see something like this:
ShocKNetworK/2.0.55 (Trustix Secure Linux/Linux) You can hide the version and stuff by opening the httpd.conf and adding to the Section 1: Global Environment:
ServerTokens Prod I also set
ServerSignature Off
just so that it doesn’t show up where I have some directory file listings when there’s no index file. Fun stuff, huh?]]>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.