Sunday, May 27, 2012

Block root shell access in SSH


  vi /etc/ssh/sshd_config

 Locate the parameter -- PermitRootLogin yes

  Change this to PermitRootLogin no

  Save and exit

 Restart your sshd by typing /etc/init.d/sshd restart

Sunday, May 20, 2012

To find open port, list port, port, port allow access in Linux

SELinux is a feature that may be turned on certain servers to restrict the access for certain ports. In order to  access, you need to open those ports.

You can check the status of SELinux using the following command.

 [root@tester ~]# sestatus
SELinux status:                 disabled


To list all the tcp/udp open ports you can use the semanage command.

semanage port -l


To check the specific port is opened

semanage port -l | grep 7080


To open the specific port 


semanage port -a -t http_port_t -p tcp 8085

Saturday, May 19, 2012

Echo command

The Echo command is also used for checking whether the previous command is executed correctly or not.

root@tester ~]# touch test.txt
[root@tester ~]# echo $?
0
It display zero when it is executed correctly, If the command is not correctly executed it will show some numbers like below.

[root@tester ~]# tuch test1.txt
-bash: tuch: command not found
[root@tester ~]# echo $?
127

Echo command is also used to check the current working shell of the users.

[root@tester ~]# echo $SHELL
/bin/bash

echo *? to know the numbe of arguments passed.

You can also check the version with the below command.

[root@tester ~]# /bin/bash --version
GNU bash, version 3.00.15(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.

Tuesday, May 8, 2012

Change the Run level with out rebooting in linux.

To view the current run level below commands are used.

[root@baby ~]# runlevel
N 3


To also view the last run level

 [root@tester ~]# who -r
         run-level 3  2010-08-09 00:16                   last=S



To change the run level with out rebooting and making it as default run level is done with the telinit command.

Change the run level in the configuration file /etc/inittab - id:3:initdefault:

switch to single usermode by 

telinit S

run level 5 

telinit 5

change in to the default runlevel 

telinit q



  telinit can also tell init how long it should wait between sending pro-
cesses the SIGTERM and SIGKILL signals.  The default is 5 seconds,  but 
this can be changed with the -t sec option.

Saturday, May 5, 2012

Install mod_evasive(DDOS protection tool) on 64 bit linux machine

Mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection tool, and can be easily configured to talk to ipchains, firewalls, routers.


 [root@tester] updatedb; locate apxs | grep bin

/usr/local/apache/bin/apxs

cd /usr/local/src
wget http://www.sfr-fresh.com/unix/privat/mod_evasive_1.10.1.tar.gz
tar -zxvf mod_evasive_1.10.1.tar.gz
cd mod_evasive

[root@tester mod_evasive]# httpd -v
Server version: Apache/2.2.22 (Unix)
Server built:   Mar 22 2012 11:58:57

or apache 2.0.x :

/usr/sbin/apxs -cia mod_evasive20.c //integrating with apache.

Then add these in httpd.conf :
DOSHashTableSize 3097
DOSPageCount 6
DOSSiteCount 100
DOSPageInterval 2
DOSSiteInterval 2
DOSBlockingPeriod 600

 For apache 1.3.x :

/usr/local/apache/bin/apxs -cia mod_evasive.c //integrating with apache.

Then add this too httpd.conf
DOSHashTableSize 3097
DOSPageCount 6
DOSSiteCount 100
DOSPageInterval 2
DOSSiteInterval 2
DOSBlockingPeriod 600

[root@tester mod_evasive]# /usr/sbin/apxs -cia mod_evasive20.c


[root@tester mod_evasive]# chmod 755 /usr/lib/apache/mod_evasive20.so

[root@tester mod_evasive]#  grep -i evasive /etc/httpd/conf/httpd.conf
LoadModule evasive20_module   /usr/lib/apache/mod_evasive20.so

[root@tester mod_evasive]#  php -r 'phpinfo();' | grep -i evasive
PWD => /usr/local/src/mod_evasive
_SERVER["PWD"] => /usr/local/src/mod_evasive
_ENV["PWD"] => /usr/local/src/mod_evasive

vi /etc/httpd/conf/httpd.conf

<IfModule mod_dosevasive20.c>
DOSHashTableSize    3097
DOSPageCount        1
DOSSiteCount        50
DOSPageInterval     1
DOSSiteInterval     1
DOSBlockingPeriod   10
DOSEmailNotify      root
#  DOSSystemCommand    “su – someuser -c ‘/sbin/… %s …’”
#  DOSLogDir           “/var/tmp/doslog”
#Leave this commented while testing, then un comment once you are sure the module works
# DOSWhitelist    127.0.0.1
</IfModule>


Restart apache
 /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                             [  OK  ]

Fields details are below:

DOSHashTableSize:

The hash table size defines the number of top-level nodes for each child’s hash table. Increasing this number will provide faster performance by decreasing the number of iterations required to get to the record, but consume more memory for table space

DOSPageCount:

This is the threshold for the number of requests for the same page (or URI) per page interval. Once the threshold for that interval has been exceeded, the IP address of the client will be added to the blocking list.

DOSSiteCount:

This is the threshold for the total number of requests for any object by the same client on the same listener per site interval.

DOSPageInterval

The interval for the page count threshold; defaults to 1 second intervals.

DOSSiteInterval
The interval for the site count threshold; defaults to 1 second intervals.

DOSBlockingPeriod
The blocking period is the amount of time (in seconds) that a client will be blocked for if they are added to the blocking list. During this time, all subsequent requests from the client will result in a 403 (Forbidden) and the timer being reset (e.g. another 10 seconds).

DOSEmailNotify
  If this value is set, an email will be sent to the address specified whenever an IP address becomes blacklisted. A locking mechanism using /tmp prevents continuous emails from being sent.

DOSSystemCommand
If this value is set, the system command specified will be executed whenever an IP address becomes blacklisted. This is designed to enable system calls to ip filter or other tools.

DOSLogDir
Choose an alternative temp directory, default is /tmp.







Thursday, May 3, 2012

SPRI (System Priority)

SPRI (System Priority) is a utility designed to que different processes with
different priority levels based on 3 class levels of importance (high,med,low).
 
The problem? Linux has priority levels to thread all tasks at, these prio's
are ranged from -20 to +19 with 0 as the default for all processes. So this
being the fact, with everything operating at prio 0 you got fights between
services as to who gets what resources first.

Solution? Very simply, que different processes at different priority levels
to effectively discipline the system on who gets what resource access first.

The average load level of a server can be substantialy decreased by using spri,
by as much as 5-20%, of course results may vary.
 
To install SPRI, execute the following commands (as root):

wget http://www.r-fx.ca/downloads/spri-current.tar.gz
md5sum spri-current.tar.gz | cut -d ‘ ‘ -f1

 
The md5sum should be like ef3e4c82b7473bf921e7a470ece037ff  
If not, then delete the file and download again.
tar -zxvf spri-current.tar.gz

cd spri-0.5

./installer.sh

cd ..

rm -rf spri*
 
The changes we need to make are as follows (done as root):
Edit /usr/local/spri/prios/med and ensure that it contains the processes qmail, MailScanner and spamd
Edit /usr/local/spri/prios/med-high and ensure that it contains the processes mysqld and mysqld-max 
Edit /usr/local/spri/prios/low and ensure that it contains the processes awffull, clamav, clamdscan, freshclam and python2.2
Edit /usr/local/spri/prios/low-med and ensure that it contains the processes php, php-script and proftpd
 
Run SPRI by executing the command: /usr/local/sbin/spri -v.
SPRI will set the priorities of the processes defined and ensure they 
are run at their set priorities.

EG: It will display like below. 

[root@tester]# /usr/local/sbin/spri -v
SPRI 0.5 [spri@r-fx.org]
========================
list file '/usr/local/spri/prios/rt' appears empty, nothing done for PRIO -2.

Setting httpd to priority 4:
5406: old priority 0, new priority 4
5409: old priority 0, new priority 4
5410: old priority 0, new priority 4
5411: old priority 0, new priority 4
5412: old priority 0, new priority 4
5413: old priority 0, new priority 4
9612: old priority 0, new priority 4

Setting mysqld to priority 6:
4551: old priority 0, new priority 6

Setting mysqld-max to priority 6:
No processes for mysqld-max running.

Setting squid to priority 6:
No processes for squid running.

Setting sendmail to priority 8:
No processes for sendmail running.

Setting MailScanner to priority 8:
No processes for MailScanner running.

Setting spamd to priority 8:
No processes for spamd running.

Setting ocwhttpd to priority 8:
No processes for ocwhttpd running.

Setting cppop to priority 8:
No processes for cppop running.

Setting cpanel to priority 8:
No processes for cpanel running.

Setting webmaild to priority 8:
No processes for webmaild running.

Setting php to priority 10:
No processes for php running.

Setting php-script to priority 10:
No processes for php-script running.

Setting proftpd to priority 10:
25358: old priority 0, new priority 10

Setting pure-ftpd to priority 10:
No processes for pure-ftpd running.

Setting urchinwebd to priority 12:
No processes for urchinwebd running.

Setting java to priority 12:
No processes for java running.

Setting tomcat to priority 12:
No processes for tomcat running.

Setting clamav to priority 12:
No processes for clamav running.

Setting clamscan to priority 12:
No processes for clamscan running.

Setting freshclam to priority 12:
No processes for freshclam running.

Setting rsync to priority 12:
No processes for rsync running.

Setting python2.2 to priority 12:
No processes for python2.2 running.

Setting ensim-python to priority 12:
No processes for ensim-python running.

Setting eximstats to priority 12:
No processes for eximstats running.

Wednesday, May 2, 2012

hdparm - get/set hard disk parameters


You need to run the below commands by login as root,  specifying the wrong settings can cause data loss or your maching to hang.

Find the setting for your driver supports

root@tester [~]# hdparm -i /dev/sda

/dev/sda:

 Model=WDC, FwRev=01.01V02, SerialNo=WD-WCAW33126764
 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

Using hdparm - Speed Test

Before any of your drive's settings are changed a speed test should be done, so we can refer to it later to make sure that the drive's speed has been increased and we are not just wasting our time.

To do this hdparm can perform two benchmarks:

The speed of reading directly from the Linux buffer cache without disk access. (-t option)
The speed of reading through the buffer cache to the disk without any prior caching of data. (-T option)
The first shows us an indication of the throughput of the processor, cache, and memory of the system under test. The second measures how fast the drive can sustain sequential data reads, without any filesystem overhead.It is best to run these tests together as the second results are corrected for the first. It is also as usual to run these a couple of times to get accurate results. Here is the command you need to use:

root@tester [~]# hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   24846 MB in  2.00 seconds = 12442.48 MB/sec
 Timing buffered disk reads:  340 MB in  3.00 seconds = 113.22 MB/sec


To list the current settings being used for your drive use the command:

root@tester [~]# hdparm /dev/sda

/dev/sda:
 multcount     =  0 (off)
 IO_support    =  1 (32-bit)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 121601/255/63, sectors = 1953525168, start = 0

You can change the settings by view the man page of hdparm

eg:  hdparm -X66 -d1 -u1 -m16 -c3 /dev/sda

After each settings made you need to run the speed and performace test for it and the new settings will be activated after every boot.

the -a flag you can get readahead information from the drive:

hdparm -a /dev/sda

/dev/sda:
 readahead     = 256 (on)

hdparm -C /dev/sda

/dev/sda:
 drive state is:  active/idle

You can also check the hard disk size using the hdparm command

syntax:  hdparm -I /dev/sda |grep and hit enter key

root@tester [~]# hdparm -I /dev/sda | grep "device size"
        device size with M = 1024*1024:      953869 MBytes
        device size with M = 1000*1000:     1000204 MBytes (1000 GB)

You can also check the model number and serial number of a hard drive using the hdparm command

root@tester [~]# hdparm -I /dev/sd?|grep -E "Number|/dev"
/dev/sda:
        Model Number:       WDC WD1003FBYX-18Y7B0
        Serial Number:      WD-WCAW33126764
/dev/sdb:
        Model Number:       WDC WD1003FBYX-18Y7B0
        Serial Number:      WD-WCAW33123668





S.M.A.R.T ctl


Shows I/O errors in /var/log/messages, dmesg indicates that something is wrong with the hard disk and it may be failing.

You can check hard disk errors using smartctl command, which is control and monitor utility for SMART disks under Linux / UNIX like operating systems.

Some Device does not support SMART, you can check S.M.A.R.T has enabled or not using the following syntax.

root@tester [~]# smartctl -i /dev/sda
smartctl version 5.38 [x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: IBM ServeRAID M5015 Version: 2.12
Serial number: 0060519a15558e94160054a603b00506
Device type: disk
Local Time is: Thu May  3 06:11:30 2012 CEST
Device does not support SMART

You need to enable the smart in the BIOS to monitor with it.

root@tester [~]# smartctl -s on /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

Smartctl open device: /dev/sda0 failed: No such device
root@tester [~]# smartctl -s on /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

 The command example below show another example of smartctl command that can be use to enable SMART monitoring tool on the disk device.

[root@tester ~]# smartctl --smart=on --offlineauto=on --saveauto=on /dev/sda


root@tester [~]# smartctl -t short /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Thu May  3 11:37:28 2012

Use smartctl -X to abort test.

root@tester [~]# smartctl -t long /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Extended self-test routine immediately in off-line mode".
Drive command "Execute SMART Extended self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 111 minutes for test to complete.
Test will complete after Thu May  3 13:28:08 2012

Use smartctl -X to abort test.

Check the health status of the hard drive using the following command.

root@tester [~]#  smartctl -H /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
Please note the following marginal Attributes:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
190 Airflow_Temperature_Cel 0x0022   046   041   045    Old_age   Always   In_the_past 54 (4 241 54 53)

The following will provide even more information about failing hard disk:

root@tester [~]#  smartctl --attributes --log=selftest /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_                                                                             FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   120   100   006    Pre-fail  Always       -                                                                                    239201408
  3 Spin_Up_Time            0x0003   098   098   000    Pre-fail  Always       -                                                                                    0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -                                                                                    7
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -                                                                                    0
  7 Seek_Error_Rate         0x000f   069   060   030    Pre-fail  Always       -                                                                                    7727839
  9 Power_On_Hours          0x0032   099   099   000    Old_age   Always       -                                                                                    1068
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -                                                                                    0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -                                                                                    11
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -                                                                                    0
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -                                                                                    0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -                                                                                    0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -                                                                                    0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -                                                                                    0
190 Airflow_Temperature_Cel 0x0022   046   041   045    Old_age   Always   In_th                                                                             e_past 54 (4 241 54 53)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -                                                                                    0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -                                                                                    7
193 Load_Cycle_Count        0x0032   094   094   000    Old_age   Always       -                                                                                    13964
194 Temperature_Celsius     0x0022   054   059   000    Old_age   Always       -                                                                                    54 (0 24 0 0)
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -                                                                                    0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -                                                                                    0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -                                                                                    0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -                                                                                    81651623264916
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -                                                                                    174738791963
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -                                                                                    8629080254

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA                                                                             _of_first_error
# 1  Extended offline    Self-test routine in progress 90%      1068         -
# 2  Short offline       Aborted by host               30%      1068         -

You can disable the smart using the following command.

root@tester [~]# smartctl -s off /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Disabled. Use option -s with argument 'on' to enable it.


Smart ctl on 3 ware hardware RAID card.


SMART disk monitoring tool that provide us with the information of overall hard disk health status.  The SMART it self stand for Self Monitoring Analysis and Reporting Tool and on Linux .

root@tester [~]# rpm -qa smartmontools
smartmontools-5.38-3.el5

On centos or Redhat  you can use yum install smartmontools   to install
syntax:
smartctl -a -d 3ware,N /dev/tweY
smartctl -a -d 3ware,N /dev/twaY

Devices /dev/sda and /dev/twe0 is used with 3ware series 6000, 7000, and 8000 controllers that use the 3x-xxxx driver.
/dev/sda form is deprecated starting with the Linux 2.6 kernel.
/dev/twa0 is used with 3ware 9000 series controllers, which use the 3w-9xxx driver.
You can also check on the series with the below command:
root@tester [~]# lspci |grep 3ware
0a:00.0 RAID bus controller: 3ware Inc 9650SE SATA-II RAID PCIe (rev 01)
N is the disk number ie. 3ware port number. You can check it with  


root@tester [~]# ./tw_cli info

Ctl   Model        (V)Ports  Drives   Units   NotOpt  RRate   VRate  BBU
------------------------------------------------------------------------
c0    9650SE-8LPML 8         6        2       0       1       1      OK

root@tester [~]# ./tw_cli info c0

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    VERIFYING      -       55%     64K     2095.44   ON     ON
u1    RAID-0    OK             -       -       64K     1862.62   ON     OFF

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     698.63 GB   1465149168    WD-WCAPT0861355
p1     OK               u0     698.63 GB   1465149168    WD-WCAPT0902164
p2     OK               u0     698.63 GB   1465149168    WD-WCAPT0900512
p3     OK               u0     698.63 GB   1465149168    WD-WCAPT0861173
p4     OK               u1     931.51 GB   1953525168    WD-WCASJ1648096
p5     OK               u1     931.51 GB   1953525168    WD-WCASJ1648042
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

Name  OnlineState  BBUReady  Status    Volt     Temp     Hours  LastCapTest
---------------------------------------------------------------------------
bbu   On           Yes       OK        OK       OK       0      xx-xxx-xxxx


bbu - battery backup unit.


You can check the health of the disk with the following syntax. For more details you can check with the smartctl man page.


root@tester [~]# smartctl -H -d 3ware,1 /dev/twa0
smartctl version 5.38 [i686-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED


Command to check the smart info 

# smartctl -a -d 3ware,0 /dev/twa0
# smartctl -a -d 3ware,1 /dev/twa0 



root@tester [~]# smartctl -a -d 3ware,0 /dev/twa0
smartctl version 5.38 [i686-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Caviar RE Serial ATA family
Device Model:     WDC WD7500AYYS-01RCA0
Serial Number:    WD-WCAPT0861355
Firmware Version: 30.04G30
User Capacity:    750,156,374,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   7
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Wed May  2 22:25:49 2012 CDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x84) Offline data collection activity
                                        was suspended by an interrupting command                                                                              from host.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                 (15960) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off supp                                                                             ort.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        ( 198) minutes.
Conveyance self-test routine
recommended polling time:        (   6) minutes.
SCT capabilities:              (0x303f) SCT Status supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_                                                                             FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   200   200   051    Pre-fail  Always       -                                                                                    0
  3 Spin_Up_Time            0x0003   191   187   021    Pre-fail  Always       -                                                                                    7433
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -                                                                                    82
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -                                                                                    0
  7 Seek_Error_Rate         0x000e   200   200   051    Old_age   Always       -                                                                                    0
  9 Power_On_Hours          0x0032   055   055   000    Old_age   Always       -                                                                                    32896
 10 Spin_Retry_Count        0x0012   100   253   051    Old_age   Always       -                                                                                    0
 11 Calibration_Retry_Count 0x0012   100   253   051    Old_age   Always       -                                                                                    0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -                                                                                    79
192 Power-Off_Retract_Count 0x0032   192   192   000    Old_age   Always       -                                                                                    6053
193 Load_Cycle_Count        0x0032   198   198   000    Old_age   Always       -                                                                                    6055
194 Temperature_Celsius     0x0022   124   109   000    Old_age   Always       -                                                                                    28
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -                                                                                    0
197 Current_Pending_Sector  0x0012   200   200   000    Old_age   Always       -                                                                                    0
198 Offline_Uncorrectable   0x0010   200   200   000    Old_age   Offline      -                                                                                    0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -                                                                                    0
200 Multi_Zone_Error_Rate   0x0008   200   200   051    Old_age   Offline      -                                                                                    0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]


SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

Tuesday, May 1, 2012

Wildcard DNS

Wildcard subdomains are useful when you wish to redirect all visitors to your main website regardless of what subdomain they access your website through.

 This is also useful when someone mistypes www for example and writes ww.yourdomain.com.

edit the DNS file or db file of domain and add the line as

vi /var/named/domainname.db

*.domain.com. 14400 IN A IP of server
www.*.domain.com. 14400 IN A IP of server

Edit the httpd.conf and add the line in virtual host of domain.
ServerAlias *.domain.com www.*.domain.com

/etc/init.d/httpd restart
/etc/init.d/named restart