Douglas Haber :: Blog

Just another WordPress.com weblog

Archive for the ‘Tutorials’ Category

Lighttpd and PHP5 FastCGI

Posted by Douglas Haber on April 6, 2008

First install MySQL on your server with yum:

Run: yum install nano mysql* -y

Now let’s begin the install. Change directory to /root and use “nano -w installer.sh”. Then paste the following in:

#!/bin/bash
echo “Lighttpd Installer”
echo “By Douglas Haber”
echo “http://douglashaber.com”
sleep 5
echo “Cleaning up the system and installing dependencies”
yum remove httpd -y
yum install libjpeg libjpeg-devel zlib zlib-devel libxml2 libxml2-devel libpng* gcc gcc-c++ make flex bison openssl* pcre* -y
yum install mysql* -y
echo “If this fails, press control C to stop the install right now”
echo “That means that your CentOS repositories are not sufficient”
echo “Install more repositories and run again”
echo “Halting for 10 seconds”
sleep 10
echo “Downloading software”
wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.gz
wget http://us3.php.net/get/php-5.2.5.tar.gz/from/this/mirror
sleep 2
echo “Untarring”
tar -xf lighttpd-1.4.18.tar.gz
tar -xf php-5.2.5.tar.gz
echo “Done”
sleep 2
echo “Beginning lighttpd compile”
cd lighttpd-1.4.18
./configure –with-bzip2 –with-pcre –with-mysql=/usr/bin/mysql_config –with-ldap
make
make install
echo “Finished, moving on to PHP”
cd ..
cd php*
./configure –enable-fastcgi –enable-discard-path –enable-force-redirect –with-gettext=/usr –with-exec-dir=/usr/bin –with-zlib –enable-magic-quotes –with-regex=system –with-ttf –with-db –enable-mbstring –enable-mbstr-enc-trans –enable-track-vars –enable-wddx=shared –enable-mm=shared –enable-xml –enable-ftp –disable-debug –with-libdir=/usr/lib
make
make install
echo “Final steps”
cp /root/lighttpd-1.4.18/doc/lighttpd.conf /etc
cd /var/run
mkdir lighttpd
cd ..
cd log
mkdir lighttpd
cd lighttpd
touch access.log
echo “Complete! Now it is up to you to enable PHP. Read on at http://douglashaber.com for further details.”

One this is finished, type:

nano -w /etc/lighttpd.conf

Find: # “mod_fastcgi”,

Replace with: “mod_fastcgi”,

Find:

#fastcgi.server = ( “.php” =>
# ( “localhost” =>
# (
# “socket” => “/tmp/php-fastcgi.socket”,
# “bin-path” => “/usr/local/bin/php-cgi”
# )
# )
# )

Replace with:

fastcgi.server = ( “.php” => ((
“bin-path” => “/usr/local/bin/php-cgi”,
“socket” => “/tmp/php.socket”
)))
Save and quit out of your editor. Now, it is complete. Let’s start lighttpd!

Run: lighttpd -f /etc/lighttpd.conf

Posted in Tutorials | 1 Comment »

Disabling unnecessary and exploitable scripts

Posted by Douglas Haber on April 6, 2008

For cPanel servers, log in as root and run the following:

chmod 0000 /usr/local/cpanel/base/cgi-sys/mchat.cgi
chmod 0000 /usr/local/cpanel/base/cgi-sys/cgiecho
chmod 0000 /usr/local/cpanel/base/cgi-sys/cgiemail
chmod 0000 /usr/local/cpanel/base/cgi-sys/guestbook.cgi
chmod 0000 /usr/local/cpanel/base/cgi-sys/Count.cgi
chmod 0000 /usr/local/cpanel/base/cgi-sys/countedit.cgi
chmod 0000 /usr/local/cpanel/base/cgi-sys/formmail.cgi
chmod 0000 /usr/local/cpanel/base/cgi-sys/FormMail.cgi
chmod 0000 /usr/local/cpanel/base/cgi-sys/FormMail-clone.cgi
chmod 0000 /usr/local/cpanel/base/cgi-sys/formmail.pl
chmod 0000 /usr/local/cpanel/base/cgi-sys/FormMail.pl

It will disable FormMail and other very exploitable scripts.

Posted in Tutorials | Tagged: , , , , , , , | Leave a Comment »