MyTrueHost launched Web Hosting for Indian clients just in Rs 60/Month with various payment options(netbanking, debit card, credit card,cash card or paypal).
Please Visit at https://www.mytruehost.in

How to cluster the DNS.

How to cluster the DNS?

A DNS cluster is a number of nameservers that share records.

This allows you to physically separate your nameservers so that in the event of, for instance, a power outage, you still have DNS functionality. This way, visitors can reach websites on your server more quickly after the web server comes back online. The cPanel DNS cluster feature only provides redundancy for DNS. It does not place Apache or any other services in a cluster configuration.

To optimally configure your DNS cluster, you will need 2 spare servers, both preferably running cPanel DNS ONLY. You will also need at least 1 web server with cPanel/WHM installed.

1. Login to WHM
2. Go to Cluster/Remote Access >> Configure Cluster
3. Click Enable Dns Clustering.
4. Click Change
5. Click Return to check Cluster Status.

DNS clustering is now enabled. Next, you will need to specify which server(s) you wish to cluster, or share DNS information with
On your web server’s WHM interface, take the following steps:

On the Configure Cluster screen, under Servers in your DNS Cluster, locate the Add a new server to the cluster box.
Enter the nameserver’s IP address in the Server Ip Address box.
Click Configure.
On the Create Trust Relationship screen, enter the nameserver’s remote access key.
To retrieve the key from the nameserver, click the link at the bottom of the screen. You will need to enter the root password for the nameserver.
Once the key appears, cut and paste it into the Server Remote Access Key box.
Click Submit.
Repeat these steps, adding each additional nameserver to the cluster.

 

How to add Domainkeys for a domain on a cPanel server?

How to add Domainkeys for a domain on a cPanel server?

Introduction:

“DomainKeys” is an anti-spam software application that uses a public key, cryptography to authenticate the sender’s domain. cPanel offers a installer script “domain_keys_installer” using which the DomainKeys can be created and added automatically for a domain.

Steps:

By default the DomainKeys is not added when the account is created on the server, it has to be added manually. SSH to your server and execute:

/usr/local/cpanel/bin/domain_keys_installer <username>

where, <username> is the username of the domain.

The DomainKey is automatically added in the DNS zone file of the domain located at /var/named/domainname.db file. To add DomainKeys for the existing domains, use the following script

for i in `cat /etc/trueuserdomains | awk ‘{print $2}’`
do
/usr/local/cpanel/bin/domain_keys_installer $i;
done;
NOTE: If you are using a 3rd party name servers for your domain, you will have to add the DomainKeys in the DNS zone of your domain created on their servers.



How to connect MySql Database from remote machine?

How to connect MySql Database from remote machine

Introduction:

Some time clients or their web developer/designer need to connect to MySql database server hosted on remote cPanel server to be accessed from their desktop.

Following are the steps to connect to MySql Database from remote Machine.

A. How to enable Connection to Remote Host

1. Login to cPanel of the domain
2. Go to ‘Remote MySql’
3. At ‘Remote Database Access Hosts’
4. Add access host IP (i.e. IP of the machine from which database has to
be accessed)
5. Click on ‘Add Host’ to finish.

B. Database configuration should me as follows:

Database Server = Server IP address
Database = cpanelusername_databasename
Database User = cpanelusername_databaseuser
Database Password = (what ever is set)
MySql Serverice Port no. = 3306

C. What if local machine has dynamic IP?

1. Simply put ‘%'(percentage mark) in Add Access Host to allow access from
any remote IP.
2. Allow subnet only 215.26.%.% (This may be useful if machines having
remote access to Database belongs to same Subnet/ISP).
3. It is recommended to have Static IP if remote connection to database
is permanent OR keep updating IP, if dynamic, into the access host list whenever it changes. This is secure way for remote connection and to avoid access to unwanted IPs.
4. Your IP may need to be allowed the access to 3306 port in the firewall
of the server.

 

Hardening PHP for Security

Hardening PHP for Security

PHP is the most popular scripting language for apache and mysql. You will need to disable system level functions in the php configuration file.

Suhosin

Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself.

You can enable suhosin using /script/easyapache

1. Login as root and fire the following cmds
2. Run: /script/easyapache
3. search for option Suhosin
4. Save and build it.
5. php -m : To verify it.

Disable Dangerous PHP Functions

PHP has a lot of potential to mess up your server and hack user accounts and even get root. I’ve seen many times where users use an insecure PHP script as an entry point to a server to start unleashing dangerous commands and taking control.

Steps:

1. Search the php.ini file for: using command:
php -i | grep php.ini

2. Vi /usr/local/lib/php.ini

disable_functions =Look for the lines and make sure you have the lines as below..
disable_functions = dl, shell_exec, system, passthru, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, pfsockopen, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid

Turn off Register Globals

Register_globals will inject your scripts with all sorts of variables, like request variables from HTML forms. This coupled with the fact that PHP doesn’t require variable initialization means writing insecure code is that much easier.

register_globals = Off

magic_quotes_gpc = On

It is best to keep magic_quotes to on as otherwise you forms using POST may be used for SQL injection attacks.
Run PHP through PHPsuexec/suphp Preventing Nobody Access

The biggest problem with PHP is that on cPanel servers is that PHP will run as nobody. When someone sets a script to 777 access that means the nobody user has write access to that file. So if someone on the same shared server wrote a script to search the system for 777 files they could inject anything they wanted, compromising the unsuspecting users account.

PHPsuexec makes PHP run as the user so 777 permissions are not allowed. There are a few downfalls to PHPsuexec but I think it’s required on a shared environment for the security of everyone. Safe_mode doesn’t prevent you from compromising other users files. This is where PHPsuexec comes in, it stops the user from being able to read another users files. It also makes it easier for you, the administrator, to track PHP mail function spamming and lots of other issues caused by PHP scripts because now you can easily track it ot the users account responsible.

The following settings are all useful ways of adjusting the resources your PHP scripts can consume:

; Maximum execution time of each script, in seconds
max_execution_time = 30

; Maximum amount of time each script may spend parsing request data
max_input_time = 60

; Maximum amount of memory a script may consume (8MB)
memory_limit = 8M

; Maximum size of POST data that PHP will accept.
post_max_size = 8M

 

; Whether to allow HTTP file uploads.
file_uploads = Off

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Avoid Opening Remote Files

One of the useful abilities of PHP is the ability to open files remotely without any complex processing.

Many simple scripts use this ability, for example a comic viewer might open up images from a remote server just using the fopen function – which is ordinarily used to open files.

It is an ability has often been abused in insecure scripts though.

If you have a script which tries to open a file and the filename is controllable by a remote user two things can happen:
Any file on the local system which the web server can read can be viewed by the remote attacker.
Arbitrary commands can be executed upon your server if the user can cause a remote PHP file to be opened.

Hardening PHP for Security

PHP is the most popular scripting language for apache and mysql. You will need to disable system level functions in the php configuration file.

Suhosin

Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself.

You can enable suhosin using /script/easyapache

1. Login as root and fire the following cmds
2. Run: /script/easyapache
3. search for option Suhosin
4. Save and build it.
5. php -m : To verify it.

Disable Dangerous PHP Functions

PHP has a lot of potential to mess up your server and hack user accounts and even get root. I’ve seen many times where users use an insecure PHP script as an entry point to a server to start unleashing dangerous commands and taking control.

Steps:

1. Search the php.ini file for: using command:
php -i | grep php.ini

2. Vi /usr/local/lib/php.ini

disable_functions =Look for the lines and make sure you have the lines as below..
disable_functions = dl, shell_exec, system, passthru, popen, pclose, proc_open, proc_nice, proc_terminate, proc_get_status, proc_close, pfsockopen, leak, apache_child_terminate, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid

Turn off Register Globals

Register_globals will inject your scripts with all sorts of variables, like request variables from HTML forms. This coupled with the fact that PHP doesn’t require variable initialization means writing insecure code is that much easier.

register_globals = Off

magic_quotes_gpc = On

It is best to keep magic_quotes to on as otherwise you forms using POST may be used for SQL injection attacks.
Run PHP through PHPsuexec/suphp Preventing Nobody Access

The biggest problem with PHP is that on cPanel servers is that PHP will run as nobody. When someone sets a script to 777 access that means the nobody user has write access to that file. So if someone on the same shared server wrote a script to search the system for 777 files they could inject anything they wanted, compromising the unsuspecting users account.

PHPsuexec makes PHP run as the user so 777 permissions are not allowed. There are a few downfalls to PHPsuexec but I think it’s required on a shared environment for the security of everyone. Safe_mode doesn’t prevent you from compromising other users files. This is where PHPsuexec comes in, it stops the user from being able to read another users files. It also makes it easier for you, the administrator, to track PHP mail function spamming and lots of other issues caused by PHP scripts because now you can easily track it ot the users account responsible.

The following settings are all useful ways of adjusting the resources your PHP scripts can consume:

; Maximum execution time of each script, in seconds
max_execution_time = 30

; Maximum amount of time each script may spend parsing request data
max_input_time = 60

; Maximum amount of memory a script may consume (8MB)
memory_limit = 8M

; Maximum size of POST data that PHP will accept.
post_max_size = 8M

 

; Whether to allow HTTP file uploads.
file_uploads = Off

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Avoid Opening Remote Files

One of the useful abilities of PHP is the ability to open files remotely without any complex processing.

Many simple scripts use this ability, for example a comic viewer might open up images from a remote server just using the fopen function – which is ordinarily used to open files.

It is an ability has often been abused in insecure scripts though.

If you have a script which tries to open a file and the filename is controllable by a remote user two things can happen:
Any file on the local system which the web server can read can be viewed by the remote attacker.
Arbitrary commands can be executed upon your server if the user can cause a remote PHP file to be opened.

 

MySQL dbs and users dissapered from Cpanel

MySQL dbs and users dissapered from Cpanel

Solution :

You need to login to server as root and just run below command.

/usr/local/cpanel/bin/setupdbmap

Thats all.

 

 

database size not updated in cpanel

In cPanel >> mysql database , it shows database size as ” zero” even if it is not.

Solution :

You just need to make the below changes to fix it :

root@server [#] vi var/cpanel/cpanel.config

and search for following line.

disk_usage_include_sqldbs=0 ( set it to 1 instead of 0 )

then just run the command

root@sever[#] /scripts/update_db_cache

Done.



How to install php module without running EASYAPACHE?

Install php module without running EASYAPACHE

1. Login to server as root

2. cd /home/cpeasyapache/src/php-5.2.9/ext/XXXXX — >>> extension which you want to install

3. phpize

4. ./configure

5. make

6. make install

7. After that you can see extension dir path. ll extension dir path.

8. vi /usr/local/lib/php.ini

9. add extension=extension.so

10. then restart apache

11. That’s it.



How to remove blocked ip address from the Brute Force Protection by using SSH ?

How to remove blocked ip address from the Brute Force Protection by using SSH ?

Solution :–

When WHM locks out an user account, especially “root”, the best way is to wait for 10 minutes to see if the account will be unlocked. If the locks persists, webmaster and administrator who still can remote login via SSH to the server as root can manually remove the lockouts via following steps:

mysql> use cphulkd;
mysql> BACKUP TABLE `brutes` TO ‘/var/lib/mysql/cphulkd-bak’;
mysql> BACKUP TABLE `logins` TO ‘/var/lib/mysql/cphulkd-bak’;

Above command will backup the brutes table, the main table used by cPHulk to record locked accounts and denied IP addresses.

mysql> DELETE FROM `brutes`;
mysql> DELETE FROM `logins`;

Above commands will remove all blocked IP addresses and locked accounts from the system, enabling full access again

mysql> quit;

Done

 

How to install phpSHIELD?

phpSHIELD Installation :

Introduction: phpSHIELD protects your PHP Source Code with a powerful, easy to use encoder, which creates a native bytecode version of the script and then encrypts it. It’s needed to video script enabled sites.
——

STEPS:

Login to server as root:

1. Check the architecture of your machine. like :

root@j [~]# arch
x86_64
root@j [~]#
It’s 64bit

or :

root@juggernaut [~]# which ps
/bin/ps

root@j [~]# file /bin/ps |grep bit
/bin/ps: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
root@j [~]#

2. Make sure following parameters has appropriate value in php.ini file like :

# Thread Safety is disabled
# enable_dl is set to on
# The path to your extension_dir
# Path to your php.ini file

php.ini file path :

root@j [~]# php –ini
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File: /usr/local/lib/php.ini
Scan for additional .ini files in: /usr/local/lib/php.ini.d
Additional .ini files parsed: (none)
root@j [~]#

3. Execute following CMD via ssh:
#
# cd /root/download

4. Download the phpSHIELD loaders:

# wget http://phpshield.com/loaders/phpshield.loaders.linux.zip //for 32bit
# wget http://phpshield.com/loaders/phpshield.loaders.linux-64.zip //for 64 bit

5. #unzip phpshield.loaders.linux.zip
6. #cp phpshield.5.2.lin /usr/lib/php/extensions/no-debug-non-zts-20060613/
7. Add following line in php.ini file and restart webserver :

extension=”phpshield.5.2.lin”
echo “extension=”phpshield.5.2.lin”” >> /usr/local/lib/php.ini

or

extension=”phpshield.5.2ts.lin”
——-

That’s it. try 🙂



Domain masking code

Domain masking code :

—–
<frameset rows=”100%”>
<frameset cols=”100%”>
<frame src=”http://example.com/page.html” frameborder=”0″ scrolling=”no”>
</frameset>
</frameset>
—–