Syed Alam

Google and Web Performance

Well, we should accept that Google is working hard to improve user experience on web. They have proved with their search engine, soon then launch Gmail as super fast web mail that allowed more storage for users and so many other initiatives that includes spdy alternative http protocol.

Few months back they launched Public DNS Service which claimed to be Super FAST dns server publicly available.

Google DNS Servers : 8.8.8.8 & 8.8.4.4

[Keep Reading…]

{ 0 comments }

Most of the Linux flavors use BASH as default shell. But as per requirements or interest people tend to use other shells. In our case, we saw server had CSH set as default SHELL.

Now, there is a utility called chsh is used for changing your default shell without requiring manual modifications in /etc/passwd

How to use chsh to change your default shell?

First of all look at available shells
cat /etc/shells

# /etc/shells: valid login shells
/bin/csh
/bin/sh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen

[Keep Reading…]

{ 0 comments }

In this article we will discuss how can you build a high availability storage solution to store your static data.

Case :
Client is running a business portal that have approx. 300-500 MB data uploads per day. There was NFS Storage server which had 500 GB drive which was running out of space. This Server was also running lighttpd web server to provide access for users to view these files.

Problems :
No Failover. (Except offline backup)
When ever server gets done, Users are unable to upload data.
Users are unable to access their data because lighttpd was also running on same server.

[Keep Reading…]

{ 1 comment }

What is PScan?

PScan is a multi-threaded port scanner that can scan 65535 port numbers. It is very efficient, super fast compare to Nmap but provide a limited set of features.

Features :

  • Perform SYN scan
  • Define port ranges to scan (by default attempt to scan all)
  • Resolves port number to known services.

How to install PScan?

There isn’t any binary available for PScan so we have to compile it from the source code. Before compiling it, you need to make sure you have libpcap library installed at your system.
This HowTo can be followed for any linux distro e.g CentOS, BackTrack, LinuxMint etc.
Dependency
aptitude install libpcap-dev

cd /tmp/
wget http://www.secpoint.com/freetools/threaded-syn-port-scanner-2.0.zip
unzip threaded-syn-port-scanner-2.0.zip
cd threaded-syn-port-scanner-2.0/
make
cp -a pscan /bin/

It is cooked.

Now simple run;
pscan

How to use PScan?

PScan can be use with following options;

Example :
pscan 10.0.54.23 -p 1-65535 -n 20 -w 2000 -r -M

-p : Define port ranges
-n : Number of threads that runs ports scan
-w : Max time to wait for next port scan
-r : If you want to resolve port number to known service name e.g 53 # DNS
-M : Lookup for Mac Address.

Note : You must provide IP address to scan it. You can use nslookup or dig command line utility.

If you have any question or suggestion feel free to comment.

{ 0 comments }

Scenario :
Our client required mod_proxy module for their application. Apache is already installed on WHM/CPanel CentOS Linux Server that run few websites. We thought recompiling Apache is not a good option that will require a down time for maintenance window and a small error can put our contract at risk and lost for our client.

What is ModProxy?

Mod_proxy is an Apache module that implements a proxy for your Apache web server. It is divided into further modules for different purposes. For example mod_proxy_http, mod_proxy_connect, mod_proxy_ftp, mod_proxy_ajp, mod_proxy_balancer. In our case we will compile few of them that are required for our application.

Installation :

Check Apache current version :

/usr/local/apache/bin/httpd -v

Output :
Server version: Apache/2.2.19 (Unix)
Server built: Jul 4 2011 06:24:27

Go to http://archive.apache.org/dist/httpd/ and pick your matched apache version. In our case it is Apache 2.2.19

cd /tmp/
wget http://archive.apache.org/dist/httpd/httpd-2.2.19.tar.bz2
tar -jxvf httpd-2.2.19.tar.bz2
cd httpd-2.2.19
./configure --enable-mods-shared="proxy proxy_http proxy_connect"

Note : You can add additional mod_proxy modules inside inverted commas.
In our case "proxy proxy_http proxy_connect"

cd modules/proxy/
/usr/local/apache/bin/apxs -i -a -o mod_proxy.so -c mod_proxy.c proxy_util.c
/usr/local/apache/bin/apxs -i -a -o mod_proxy_http.so -c mod_proxy_http.c proxy_util.c
/usr/local/apache/bin/apxs -i -a -o mod_proxy_connect.so -c mod_proxy_connect.c proxy_util.c
/etc/init.d/httpd restart

Installation is completed.

You can verify modules under Apache modules directory.

ls -l /usr/local/apache/modules/mod_proxy*

Output :
/usr/local/apache/modules/mod_proxy_connect.so
/usr/local/apache/modules/mod_proxy_http.so
/usr/local/apache/modules/mod_proxy.so

If you have any question, feel free to comment below.

{ 0 comments }

Overview :
Installing a single php extension without recompiling PHP is never been a difficult job but most of the people doesn’t know it which leads to re-compile whole php.. In this article i will explain how can you add new php extension without recompiling whole php.

In our example, i will tell you how can you add iconv php extension without recompiling PHP.

A sample error for iconv php extension which was not installed
Fatal error: Call to undefined function iconv() in /some/path/file.php line 12

iconv php extension necessary configuration & compilation :
View current php version
php -v

Output :
PHP 5.2.13 (cli) (built: Jun 23 2010 04:49:30)
Copyright (c) 1997-2010 The PHP Group

Downloading the same php version source code from php.net
cd /tmp/
wget http://museum.php.net/php5/php-5.2.13.tar.bz2
tar -jxf php-5.2.13.tar.bz2
cd php-5.2.13/ext/iconv

Prepare php extension to compile it.
phpize

Output :
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

aclocal
./configure
make
make install

You can can see iconv php extension is installed under php extensions directory:
ls /usr/local/lib/php/extensions/no-debug-non-zts-20060613/iconv.so

Enable iconv PHP extension in php.ini
echo "extension=iconv.so" >> /usr/local/lib/php.ini

Verify iconv :
php -i | grep -i "iconv support"

Output:
iconv support => enabled

{ 0 comments }