Tuesday, April 8, 2008

Install Chkrootkit

cd /root

wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz

tar xvzf chkrootkit.tar.gz

mv chkrootkit-* chkrootkit

cd chkrootkit

make sense

SIM (System Integrity Monitor)

How to Install SIM

Login to your server via SSH as root.

wget http://www.r-fx.org/downloads/sim-current.tar.gz

tar xvfz sim-3*.gz

cd sim-3.0

./install.sh -i

Type

sim -j

If ifconfig is not eth0 (eg eth1, or venet0)

nano -w /etc/conf.sim

Installation of APF

cd /usr/local/src
wget http://rfxnetworks.com/downloads/apf-current.tar.gz
tar -zxf apf-current.tar.gz
cd apf-0.*
./install.sh

Now edit config file
vi /etc/apf/conf.apf
Scroll down to the “Common ingress (inbound) TCP ports section. At this point you need to find the correct configuration for your control panel.

IG_TCP_CPORTS=”20,21,22,25,26,53,80,110,143,443,465,993,995,2082,2083,2086,2087,2095,2096″
IG_UDP_CPORTS=”21,53,873″

EGF=”1″
EG_TCP_CPORTS=”21,22,25,26,27,37,43,53,80,110,113,443,465,873,2089″
EG_UDP_CPORTS=”20,21,37,53,873″

save the file
start apf
apf -s
If everything still works then edit the config file and turn dev mode off. Make sure you can start a new ssh session before changing dev mode off. If you are kicked out you need to go back and look at what caused the problem!
DEVEL_MODE=”0″

restart APF
apf -r

Open DNS Servers

vi /etc/named.conf

Before the line that says “directory /var/named”; (it could be /var, /var/named, etc)
Put:
recursion no;

service named restart

Make sure you can ping yahoo.com and google.com afterwards.

Lame Server Resolve

service named stop

vi /etc/named.conf

add the three lines at the top

logging {

category lame-servers { null; };

};

service named restart

Installation of Eaccelerator

cd /usr/local/src
mkdir ea
cd ea
wget http://kent.dl.sourceforge.net/sourc…r-0.9.5.tar.gz

tar zxvf eaccelerator-0.9.5.tar

cd eaccelerator-0.9.5

export PHP_PREFIX=”/usr”
$PHP_PREFIX/bin/phpize
./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
make
make install

For PLESK: vi /etc/php.ini

For CPANEL: vi /usr/local/lib/php.ini

If Zend is already installed, vi /usr/local/Zend/etc/php.ini

Find this:

;Windows Extensions

Above this, comment out the PHPA or ZEND lines if you have them. Replace them with this:

zend_extension=”/usr/local/src/ea/eaccelerator-0.9.5/modules/eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

mkdir /tmp/eaccelerator

chmod 0777 /tmp/eaccelerator

service httpd restart

How to install Zend Optimizer

For i386


wget http://downloads.zend.com/optimizer/3.0.2/ZendOptimizer-3.0.2-linux-glibc21-i386.tar.gz
tar xvfz ZendOptimizer-3.0.2-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.2-linux-glibc21-i386
./install.sh

For x86_64
wget http://downloads.zend.com/optimizer/3.0.1/ZendOptimizer-3.0.1-linux-glibc23-x86_64.tar.gz
tar xvfz ZendOptimizer-3.0.1-linux-glibc23-x86_64.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc23-x86_64
./install.sh

To view Stats without login to cpanel

You can view webalizer stats without login to your cpanel.

cd /home/user/www
mkdir stats
cd stats
ln -s /home/user/tmp/webalizer webalizer
cd ../
chown -R user:user stats
cd ../
chmod -R 0775 tmp

You can access it as http://domain/stats/

How to Install Mod_evasive

cd /root

wget http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz

tar xvfz mod_ev*

cd mod_evasive*

CPANEL & Apache 1

/usr/local/apache/bin/apxs -i -a -c mod_evasive.c

/etc/init.d/httpd restart

CPANEL & Apache 2

/usr/local/apache/bin/apxs -i -a -c mod_evasive20.c

/etc/init.d/httpd restart

PLESK & Apache 1

/usr/sbin/apxs -i -a -c mod_evasive.c

/etc/init.d/httpd restart

PLESK & Apache 2

/usr/sbin/apxs -i -a -c mod_evasive20.c

/etc/rc.d/init.d/httpd restart

Using RPM

Installing software (rpm -i)
rpm -ivh package.rpm

Uninstalling software (rpm -e)
rpm -e software name

Updating packages (rpm -U)

Note :: This will uninstall and install the new package avoiding this annoying messages. It is also usual to install packages with –U flag in this way:

rpm -Uvh software.rpm

How do you password protect your pages?

Using a password protected folder. With this method, you create the passwords ans usernames, and let users (members) have them. This method is used when a limited number of users will use the site.

Go the cpanel >> Password protection >> Select the name of the directory that you wish to protect >> Check the folder requires a password to access via http:// give a name such as Members now go back and create a user and password. Now when visitors will create this directory they will be prompted for username and password.

Lost Mysql root password ?

Few Simple steps to change your mysql root password.

service mysql stop

wait until MySQL shuts down. Then run

mysqld_safe –skip-grant-tables &

then you will be able to login as root with no password.

mysql -uroot mysql

In MySQL command line prompt issue the following command:

UPDATE user SET password=PASSWORD(”abcd”) WHERE user=”root”;
FLUSH PRIVILEGES;

At this time your root password is reset to “abcd” and MySQL will now
know the privileges and you’ll be able to login with your new password:

mysql -uroot -pabcd mysql

Steps for Kernel Upgrade

Following are steps to upgrade kernel on live servers.

1. Check current version of kernel on server using command uname -a, if
its 2.4 then download latest release for 2.4 please do not download 2.6
kernel.
You can download kernel from
http://www.kernel.org/pub/linux/kernel/v2.6/
if its 2.4 then http://www.kernel.org/pub/linux/kernel/v2.4/, you can
check latest stable release from http://www.kernel.org

2. wget kernel in /usr/local/src
3. untar it using tar -zxvf linux-2.x-xxxx
4. cd linux-2.x-x
5. make clean
6. make mrproper
7. If kernel is 2.4 then copy current version of config file from
/boot/config-’uname-r’ as .config in /usr/local/src/linux-2.x-xx, if
kernel is 2.6 then you do not need to make .config in current directory
8. make menuconfig, select and check if all required modules are
selected,
also make sure that your kernel supports multiple cpu
you can check it and select from processor type, if it displays support
for more then 2 kernel then you do not need to modify anything there.
9. save configuration and exit
10. make modules if kernel is 2.4 then need to run make dep before
running
make modules
11. make modules_install
12. make
13. if 2.4 kernel then need to run make bzImage and then make install,
you can directly run make install if kernel is 2.6
15. now make sure bootloader and modify default kernel accordingly
grubby –bootloader-probe if it displays grub then edit /etc/grub.conf
and
if its lilo then edit lilo.conf and make compiled kernel as default
kernel
16. If your boot loader is lilo then you need to run one more command
/sbin/lilo which will update lilo
17. now its time to reboot server

How to enable/disable PING

To Enable PING on the server

echo “0″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all

To Disable PING on the server

echo “1″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all

How to Install RvSkin

Installation

Create a account from whm called rvskin.com

1. SSH as root to server that was registered while purchasing the license and run:

mkdir /root/rvadmin

cd /root/rvadmin

wget http://download.rvglobalsoft.com/download.php/download/rvskin-auto/saveto/rvauto.tar.bz2; bunzip2 -d rvauto.tar.bz2; tar -xvf rvauto.tar; perl /root/rvadmin/auto_rvskin.pl

Answer a couple of questions on your shell, and wait until it finishes. First installation will take 2- 5 minutes to install. Installer will create a new hosting account ‘rvadmin’. Don’t terminate it. It will be used for internal RVSkin configuration management.

2. Log in to RVSkin Manager. Both root and reseller are able to access RVSkin Manager in WHM / Add-ons (at the bottom left menu). If you cannot find the RVSkin Manager menu, please close WHM and open it again.

If there is no messages display on the skin, please run this command on your SSH.

rm -f /usr/local/cpanel/Cpanel/rvversion
perl /root/rvadmin/auto_rvskin.pl

3. In RVSkin Manager:

* Set global configuration
* Set default language
* Create defaul feature list for user and for reseller
* Set tweak setting, reseller feature control, body links, top links, help, tutorial links, and etc.
* Test configuration setting in 2 hosting accounts.
* rvadmin: this account can consider to be account belong to root
*reseller’s client: this account will reflect setting from reseller skin manager. If it is not configued, it will remain anonymous.

4. Change user cPanel to RVSkin themes
5. Change cPanel language to the new language

How to Update stats on Plesk server

Run the following command to update stats on plesk server.

/usr/local/psa/admin/sbin/statistics

How to disable mod_security for an individual account ?

If you are receiving the error for mod_security, access denied with error code 403 when you check the error logs for any account. You can disable the mod_security for that account by adding a simple code in his .htaccess

==================

SecFilterEngine Off
SecFilterScanPOST Off

==================


Synchronize time on Cpanel servers

Command to Synchronize time on Cpanel servers

rdate -s rdate.cpanel.net

Enabling FP extensions for an addon domain

HowTo enable FP extensions for an addon domain
——————————————————————-
A) We won’t be able to install FP extensions on addon domain basically for
two reasons.

1) There won’t be a ServerName entry for the addon domain in the Apache config file and hence the install program will show an error like
the “domain” is not a valid virtual server.

2) FrontPage extension install program won’t install extensions in a directory which comes under another domains web root having FP extensions already installed.

To overcome these hurdles you can do the following.

1) Comment out the existing ServerName entry for the subdomain.

2) Create a new ServerName entry for in the corresponding subdomain’s VirtualHost entry.

3) Create a temporary folder in the document root of main domain and MOVE all .htaccess* and _* files from public_html in to the new directory.

4) Remove the _* and .htaccess files(created by FP) from the addon domain’s folder.

5) Verify the access.conf file in apache config directory and ensure that the AllowOverride directive is set to ‘All’. Some times this will not be enough for us to continue, hence, you have to make sure that the AllowOverride is set to ‘All’(by default it will
be ‘None’) in Apache config file.
Change only the directive inside entry.

6) Restart Apache and run the install program from back end.

#/usr/local/frontpage/version5.0/bin/owsadm.exe -o install -u $USERNAME -xuser $USERNAME -xgroup $USERNAME -p 80 -m $DOMAIN -pw $PASSWORD -s /usr/local/apache/conf/httpd.conf
where
$USERNAME give control panel login name
$DOMAIN give addon domain use www.addon.com
$PASSWORD choose a password

7) Restore the changes you made in the Apache config file.

Cool Move the .htaccess* and _* files from the backup directory (main domain web root).

If you are still having problems with connecting to the server using
FrontPage please make sure that the server name is http://www.addondomainname and you may also want to close the FP program and
start again to clear cache.

Not able to view JSP pages

If you are getting code instead of JSP page then you need to install servlets.

To install servlet go to the WHM >> Account Functions >> Install Servlets. Select domain and install.

After doing this you need to restart tomcat.

Now you will be able to view JSP pages.

Accounts missing from WHM

There are a lot of causes if the accounts in the server are missing from WHM-->list accounts.

Any of the following will cause the issue.

1) The account is missing from httpd.conf

2) The account has no cpanel user file.

3) The account is not there in the following files.
/etc/localdomains, /etc/userdomains, /etc/trueuserdomains and /etc/trueuserowners

/etc/trueuserowners file specifies the owner of each accounts in the following manner.

user: owner

4) If the account's DNS conflicts. ie if the domain has 2 DNS entries such as domainname and www.domainname. It may cause the account not listed in WHM-->list accounts.

You can run the following script if the account is missing.

/scripts/updateuserdomains (It won't add the account in httpd.conf, that
you have to add manually)

WHM not updating quotas

The binary /usr/sbin/repquota must be missing onthe server which is used by the Cpanel script /usr/local/cpanel/bin/cachedrepquota to write to the file
/var/cpanel/repquota.cache.

After copying this binary and executing this script and restarting Cpaneld ,
the issue should be resolved.

Missing DNS zone ?

If you are facing issue related to missing DNS zone with cpanel update do the following:

/scripts/perlinstaller Compress::Raw::Zlib
/scripts/perlinstaller –force Scalar::Util

This should fix the issue.

How to Set wildcard DNS

Edit the httpd.conf and add the line in virtual host of domain.

ServerAlias *.domain.com www.*.domain.com

restart httpd/apache service.

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

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

restart named service

To turn off register globals for a particular user

Put the code in .htaccess
php_flag register_globals off

To view the .html first instead of .php

Add the code in .htaceess as DirectoryIndex index.html

Postfix + ClamAV + MailScanner in OpenSuse 10.2

1) Install the anti virus software (Clamav) –> (here) http://rpm.pbone.net/
rpm -ivh clamav-db-0.88.2-1.i386.rpm
rpm -ivh clamav-devel-0.88.2-1.i386.rpm
rpm -ivh clamav-server-0.88.2-1.i386.rpm
rpm -ivh clamav-0.88.2-1.i386.rpm

/etc/init.d/clamd start

2. Once the anti-virus is install then we need to install the MailScanner software the RPM along with the source files can be found at
http://www.sng.ecs.soton.ac.uk/mailscanner/downloads.shtml

Now get ready to install the mailscanner, this is going to take a long time.

gzip -d MailScanner-4.46.2-2.rpm.tar.gz
tar -xvf MailScanner-4.46.2-2.rpm.tar
cd MailScanner-4.46.2-2
./install.sh

3. In your MailScanner.conf file in /etc/MailScanner, there are 5 settings you need to change. The settings are:

Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix

4. You will need to ensure that the user “postfix” can write to

/var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine

chown postfix:postfix /var/spool/MailScanner/incoming
chown postfix:postfix /var/spool/MailScanner/quarantine

5. Edit file MailScanner.conf
Virus Scanners = clamav

6. Edit virus.scanners.conf
clamav /usr/lib/MailScanner/clamav-wrapper /var/lib/clamav

7. Now we need to edit the postfix main.cf file, go all the way to the bottom of the file and add the following
header_checks = regexp:/etc/postfix/header_checks

8. In the file /etc/postfix/header_checks add this line:
/^Received:/ HOLD

9. Set the servers to run on startup and then start them

chkconfig MailScanner on
chkconfig postfix on
chkconfig clamd on

/etc/init.d/Mailscanner start
/etc/init.d/postfix start
/etc/init.d/clamd start

How To use Yum

  • To seach for a application

Yum will search all your enabled repos and tell you where you can obtain the package from

yum search application_name
  • Yum can list all available packages from your enabled repos and tell you where you can obtain the package from:
yum list available
  • To find out more info about some package
yum info application_name
  • Installing applications

Inastalling is as easy as

yum install application_name
  • Listing rpms

yum can list installed rpms for you from the repos you have enabled

yum list extras
  • Removing rpms

Yum can remove a application and the dependenciesit installed with tat application. it will not remove depenencies if another application installed needs them.

yum remove application_name
  • Updating the system

Yum can update the system for you with out user interact if you want it to.

yum update
  • Not sure if you have upates?
yum check-update
  • Local install

downloaded a rpm and cannot install it with rpm because of dependencies?

yum localinstall /path/to/the/rpm