Thursday, January 05, 2006

Mengelirukan HTTPD Version

Objektif: Mengelirukan versi HTTPD
OS: RHEL 4 (ES)
httpd version: 2.0.52-19 (pakej rasmi dari Red Hat)

Sebelum
[root@kuli i386]# curl -I http://localhost HTTP/1.1 200 OK
Date: Thu, 05 Jan 2006 08:07:36 GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Tue, 20 Dec 2005 08:47:40 GMT
ETag: "114a6e-bc-b85aa300"
Accept-Ranges: bytes
Content-Length: 188
Connection: close
Content-Type: text/html; charset=UTF-8

Selepas
[root@kuli i386]# curl -I http://localhost
HTTP/1.1 200 OK
Date: Thu, 05 Jan 2006 08:47:17 GMT
Server: Magnifix_HTTP_Server/Release 1.0.0 (IRIX 6.5)
Last-Modified: Tue, 20 Dec 2005 08:47:40 GMT
ETag: "114a6e-bc-b85aa300"
Accept-Ranges: bytes
Content-Length: 188
Connection: close
Content-Type: text/html; charset=UTF-8

Modus Operandi
Download httpd-2.0.52-19.ent.src.rpm dari RHN

Install file tadi
rpm -ivh httpd-2.0.52-19.ent.src.rpm


Edit file /usr/src/redhat/SPECS/httpd.spec.
Tukar
baris %define vstring Red Hat kepada %define vstring IRIX 6.5

Extract tarball
[root@kuli SOURCES]# pwd
/usr/src/redhat/SOURCES
[root@kuli SOURCES]# tar xzvf httpd-2.0.52.tar.gz

Edit file /usr/src/redhat/SOURCES/httpd-2.0.52/include/ap_release.h supaya menjadi:
----------8<----------
#define AP_SERVER_BASEVENDOR "Apache Software Foundation"

/* #define AP_SERVER_BASEPRODUCT "Apache"
#define AP_SERVER_MAJORVERSION "2"
#define AP_SERVER_MINORVERSION "0"
#define AP_SERVER_PATCHLEVEL "52" */
#define AP_SERVER_BASEPRODUCT "Magnifix_HTTP_Server"
#define AP_SERVER_MAJORVERSION "Release 1"
#define AP_SERVER_MINORVERSION "0"
#define AP_SERVER_PATCHLEVEL "0"
#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION
#define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL
#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION
#define AP_SERVER_VERSION AP_SERVER_BASEVERSION
----------8<----------

Backup tarball asal & regenerate tarball daripada folder httpd-2.0.52
[root@kuli SOURCES]# pwd
/usr/src/redhat/SOURCES
[root@kuli SOURCES]# mv httpd-2.0.52.tar.gz httpd-2.0.52.tar.gz.bak
[root@kuli SOURCES]# tar czvf httpd-2.0.52.tar.gz httpd-2.0.52/

Compile source dengan utiliti rpmbuild
[root@kuli SPECS]# pwd
/usr/src/redhat/SPECS
[root@kuli SPECS]# rpmbuild -bb --clean /usr/src/redhat/SPECS/httpd.spec

Akan terciptalah beberapa file di dalam folder /usr/src/redhat/RPMS/i386/
[root@kuli i386]# ls

httpd-2.0.52-19.ent.i386.rpm httpd-devel-2.0.52-19.ent.i386.rpm httpd-suexec-2.0.52-19.ent.i386.rpm
httpd-debuginfo-2.0.52-19.ent.i386.rpm httpd-manual-2.0.52-19.ent.i386.rpm mod_ssl-2.0.52-19.ent.i386.rpm

Done! Sekarang bolehlah install apa-apa pakej yang patut :)

0 Comments:

Post a Comment

<< Home