Saturday 13 September 2014

vi Find And Replace Text Command


How do I find and replace (substitute) test using vi or vim text editor under UNIX / Linux / BSD or Apple OS X operating systems?


Both vi and vim text editor comes with substitute command for finding and replacing text.


Syntax


The syntax is as follows:
:%s/WORD-To-Find-HERE/Replace-Word-Here/g
OR
:%s/FindMe/ReplaceME/g


Examples


The substitute command can be used as per your requirements.


Task: VI / Vim Basic Find and Replace


To find each occurrence of 'UNIX', and replace it with 'Linux', enter (press ESC, type : and following command):
:%s/UNIX/Linux/g


Task: Find and Replace with Confirmation


Find a word called 'UNIX' and replace with 'Linux', but ask for confirmation first, enter:
:%s/UNIX/Linux/gc


Task: Find and Replace Whole Word Only


Find whole words exactly matching 'UNIX' to 'Linux'; and ask for confirmation too:
:%s/<UNIX>/Linux/gc


Task: Case Insensitive Find and Replace


Find 'UNIX' (match UNIX, unix, UnIx, Unix and so on) and replace with 'Linux':
:%s/unix/Linux/gi
Same command with confirmation:
:%s/unix/Linux/gic


Task: Case sensitive Find and Replace


Find each 'UNIX' and replace with 'bar':
:%s/UNIX/bar/gI
Same command with confirmation:
:%s/UNIX/bar/gIc


How Do I Replace In the Current Line Only?


Find 'UNIX' and replace with 'Linux' in the current line only (note % is removed from substitute command):
:s/UNIX/Linux/g
NOTE: You need to prefix % the substitute command to make changes on all lines:
:%s/UNIX/Linux/g


How Do I Replace All Lines Between line 100 and line 250?


:{START-n},{END-n}s/word1/word2/g
Find 'UNIX' and replace with 'Linux' all lines between line 100 and line 250, enter:
:100,200s/UNIX/Linux/g
OR
:100,200s/UNIX/Linux/gc

ffmpeg installer

Enabling mbstring Library in PHP.ini

cPanel to cPanel migration via SSH - Multiple domains

Know more about localdomains and remotedomains

Services for one domain do not need to be on one server. The site host and email server for a domain do not need to be on the same physical server.


DNS is used to direct the traffic to the correct place, but DNS alone will not get all the bits to where they are supposed to be. Exim, cPanel’s SMTP service needs a little help beyond DNS in order to know how to handle mail that is generated locally.


This is where /etc/localdomains and /etc/remotedomains come into play.





  • How do it works




Email sent out from a cPanel server, exim has to checks /etc/localdomains and /etc/remotedomains in order to send the email to the correct location.


If the domain is in /etc/localdomains, the mail is routed locally to the machine. If the domain is in /etc/remotedomains, the email is routed out to the Internet.


This is useful if the domain has some software installed that sends email notifications, such as a content management system like WordPress. This ensures that mail will get sent to the correct location.


If domain uses a third party mail server for email and the domain is not in remotedomains, notifcations from the CMS will not be delivered.





  • Setting email option during account creation




At the bottom of the account creation page in the Webhost Manager.


If Local Mail Exchanger is set, cPanel places the domain in localdomains. If Remote Mail Exchanger is selected, it places the domain in remotedomains. If Backup Mail Exchanger is selected, the domain will be added to localdomains but will only accept mail if there are no other mail servers available.


Automatically Detect Configuration will check the DNS Mail Exchanger records to see where the DNS is pointed, and make the configuration based off of that. Most of the time, this is the best option to select. However, if DNS has not been setup for the domain yet, you may wish to set the Exchanger manually.


Automatically Detect Configuration will check the DNS Mail Exchanger records to see where the DNS is pointed, and make the configuration based off of that. Most of the time, this is the best option to select. However, if DNS has not been setup for the domain yet, you may wish to set the Exchanger manually.



How to modify my hosts file?

Modifying your hosts file will allow you to override the DNS for a domain, on that particular machine. This can be used to test your site without the test link, prior to going live with SSL, verify an alias site works prior to DNS changes, or for other DNS related reasons. This causes your local machine only to look directly at the IP specified.


Your hosts file will need to have two entries added that will contain the IP address you want the site to resolve to and the address. Adding the below two lines for example will point www.domain.com and domain.com to our current PHP5-ITK ("Refreshed" PHP5) cluster:


1.2.3.4 www.domain.com
1.2.3.4 domain.com


Below is how to locate and edit the hosts file on several OS platforms. Once the proper domain information is added you will save the file and your system will begin resolving to the specified IP. Once testing is finished these entries should be removed.


Contents:-   
Windows Vista and Windows 7
Windows NT/2000/XP
Linux
Mac OSX 10.0 - 10.1.5
Mac OSX 10.6 - 10.8


 


 

Mail queue alert script for cPanel server via email

We need to monitor our server mail queue for cPanel servers, Possible outgoing spam as well as to maintain the server performance. Often large mail queue causes server overloading issues. It is very easy to get an alert if your server mail queue contains more than X  numbers of mails. You can use the following script to monitor your server mail queue for your cPanel servers:




#!/bin/bash
# use: Bash Shell script to monitor or Check Mail queue


EMAIL=”your email address”

MQUEUE=`find /var/spool/exim/input -name ‘*-H’ | wc -l | sed -e “s/ //g”`

if [ $MQUEUE -gt XXX ]; then
echo “Mail queue at `hostname` has $MQUEUE messages!!!” | mail -s “MAIL QUEUE ALERT: Mail queue for `hostname`” $EMAIL
fi

Better WP Security

Easiest and most effective way to secure your WordPress to Improve security of any your wordpress site's in minutes.


#1 WORDPRESS SECURITY PLUGIN


Better WP Security now by iThemes


Get ready for Better WP Security to get even better! It's now being maintained and developed full-time by Chris Wiegman for iThemes. Not only will this take Better WP Security to the next level but it will bring a new level of security to the best ecommerce solution on the market, iThemes Exchange as well as all of iThemes excellent plugins and themes.


Better WP Security takes the best WordPress security features and techniques and combines them in a single plugin thereby ensuring that as many security holes as possible are patched without having to worry about conflicting features or the possibility of missing anything on your site.


With one-click activation for most features as well as advanced features for experienced users Better WP Security can help protect any site.


Professional Installation and Support Now Available


Need help or want to make sure your setup is as secure as possible? Professional support is now available! Purchase support or installation today through our partner FooPlugins


Obscure


As most WordPress attacks are a result of plugin vulnerabilities, weak passwords, and obsolete software. Better WP Security will hide the places those vulnerabilities live keeping an attacker from learning too much about your site and keeping them away from sensitive areas like login, admin, etc.



  • Remove the meta "Generator" tag

  • Change the urls for WordPress dashboard including login, admin, and more

  • Completely turn off the ability to login for a given time period (away mode)

  • Remove theme, plugin, and core update notifications from users who do not have permission to update them

  • Remove Windows Live Write header information

  • Remove RSD header information

  • Rename "admin" account

  • Change the ID on the user with ID 1

  • Change the WordPress database table prefix

  • Change wp-content path

  • Removes login error messages

  • Display a random version number to non administrative users anywhere version is used


Protect


Just hiding parts of your site is helpful but won't stop everything. After we hide sensitive areas of the sites we'll protect it by blocking users that shouldn't be there and increasing the security of passwords and other vital information.



  • Scan your site to instantly tell where vulnerabilities are and fix them in seconds

  • Ban troublesome bots and other hosts

  • Ban troublesome user agents

  • Prevent brute force attacks by banning hosts and users with too many invalid login attempts

  • Strengthen server security

  • Enforce strong passwords for all accounts of a configurable minimum role

  • Force SSL for admin pages (on supporting servers)

  • Force SSL for any page or post (on supporting servers)

  • Turn off file editing from within WordPress admin area

  • Detect and block numerous attacks to your filesystem and database


Detect


Should all the protection fail Better WP Security will still monitor your site and report attempts to scan it (automatically blocking suspicious users) as well as any changes to the filesystem that might indicate a compromise.



  • Detect bots and other attempts to search for vulnerabilities

  • Monitor filesystem for unauthorized changes


Recover


Finally, should the worst happen Better WP Security will make regular backups of your WordPress database (should you choose to do so) allowing you to get back online quickly in the event someone should compromise your site.



  • Create and email database backups on a customizable schedule


Other Benefits



  • Make it easier for users to log into a site by giving them login and admin URLs that make more sense to someone not accustomed to WordPress

  • Detect hidden 404 errors on your site that can affect your SEO such as bad links, missing images, etc.


Compatibility



  • Works on multi-site (network) and single site installations

  • Works with Apache, LiteSpeed or NGINX (NGINX will require you to manually edit your virtual host configuration)

  • Some features can be problematic if you don't have enough RAM to support them. All my testing servers allocate 128MB to WordPress and usually don't have any other plugins installed. I have seen issues with file check and database backups failing on servers with 64MB or less of RAM, particularly if there are many other plugins being used.


Translations



  • Brazilian Portuguese by Rafael Funchal

  • Bulgarian by Nikolay Kolev of Gymnastics and Bodyweight Tutorials and Martin Halachev

  • Chinese (Traditional) by Toine Cheung

  • French by SCUDELLER Eric

  • German by Rene Wolf

  • Hindi by Outshine Solutions

  • Lithuanian by Vincent G

  • Persian by Ibrahim Jafari

  • Russian

  • Simplified Chinese by ??

  • Slovak by Erich Szabó

  • Spanish by Pablo Romero

  • Tagalog by Hanne

  • Turkish by Hakan Er


Please let us know if you would like to contribute a translation.


Warning


Please read the installation instructions and FAQ before installing this plugin. It makes some significant changes to your database and other site files which, without a proper backup, can cause problems if something goes wrong. While problems are rare, most (not all) support requests I get for this plugin involve the users failure to make a proper backup before installing.


Setup a CentOS IPSEC VPN Server

Install the Nikoforge Repository


rpm -ivH http://repo.nikoforge.org/redhat/el6/nikoforge-release-latest


Install EPEL Repo


yum -y install http://vesta.informatik.rwth-aachen.de/ftp/pub/Linux/fedora-epel/6/i386/epel-release-6-8.noarch.rpm


Install IPSEC Tools


yum -y install ipsec-tools


The ipsec-tools package from the nikoforge repo is a patched version that allow the use of a wildcard ‘’ as the IPSec identifier [1]. Not needed for Android, but iOS.*


Install Layer 2 Tunneling Protocol Daemon


yum -y install xl2tpd


Create script ”/etc/racoon/init.sh”


Insert the following:


    #!/bin/sh
# set security policies
echo -e “flush;n
spdflush;n
spdadd 0.0.0.0/0[0] 0.0.0.0/0[1701] udp -P in ipsec esp/transport//require;n
spdadd 0.0.0.0/0[1701] 0.0.0.0/0[0] udp -P out ipsec esp/transport//require;n”
| setkey -c
# enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward


Then set the correct permissions


chmod 750 /etc/racoon/init.sh


Add a call of the script to rc.local


sed –in-place ‘//etc/racoon/init.sh/d’ /etc/rc.d/rc.local
echo /etc/racoon/init.sh >> /etc/rc.d/rc.local


IPSEC CONFIGURATION


Racoon Config ”/etc/racoon/racoon.conf” (If there is one already there, bcack it up to .old)


path include “/etc/racoon”;
path pre_shared_key “/etc/racoon/psk.txt”;
path certificate “/etc/racoon/certs”;
path script “/etc/racoon/scripts”;
remote anonymous
{
exchange_mode aggressive,main;
passive on;
proposal_check obey;
support_proxy on;
nat_traversal on;
ike_frag on;
dpd_delay 20;
proposal
{
encryption_algorithm aes;
hash_algorithm sha1;
authentication_method pre_shared_key;
dh_group modp1024;
}
proposal
{
encryption_algorithm 3des;
hash_algorithm sha1;
authentication_method pre_shared_key;
dh_group modp1024;
}
}
sainfo anonymous
{
encryption_algorithm aes,3des;
authentication_algorithm hmac_sha1;
compression_algorithm deflate;
pfs_group modp1024;
}


Set the relevant permissions


chmod 600 /etc/racoon/racoon.conf


Racoon Pre shared Keys


Create the pre-shared keys file for IKE authentication. The 1st column the IPSec Identifier, the 2nd column is the IPSec preshared key.


”/etc/racoon/psk.txt”


ANDROID


myhomelan d41d8cd98f00b204e980


IOS



* d41d8cd98f00b204e980




Set the correct permissions



chmod 600 /etc/racoon/psk.txt



CONFIGURING L2TP DAEMON


Create file ”/etc/xl2tpd/xl2tpd.conf




[global]
ipsec saref = yes
force userspace = yes
[lns default]
local ip = 10.203.123.200
ip range = 10.203.123.201-10.203.123.210
refuse pap = yes
require authentication = yes
ppp debug = yes
length bit = yes
pppoptfile = /etc/ppp/options.xl2tpd



CONFIGURING PPP


Create PPP option file ”/etc/ppp/options.xl2tpd



    ms-dns 10.203.120.41
ms-dns 8.8.8.8
require-mschap-v2
asyncmap 0
auth
crtscts
lock
hide-password
modem
debug
name l2tpd
proxyarp
lcp-echo-interval 10
lcp-echo-failure 100



Create the CHAP Secrets file ”/etc/ppp/chap-secrets”



    # client server secret IP addresses
janedoe * jd480227 *



Set the Correct permissions


 


chmod 600 /etc/ppp/chap-secrets


START THE SERVICES


    chkconfig racoon on
chkconfig xl2tpd on
service racoon start
service xl2tpd start
/etc/racoon/init.sh


ANDROID CLIENT SETUP


    NAME – ANYTHING
TYPE – L2TP/IPSec PSK
SERVER ADDRESS – IP or hostname of server
L2TP SECRET – NOT USED
IPSec IDENTIFIER – what was set in first colum of racoon psk file
PRE-SHARED KEY – What was in the second column of racoon psk file


For my VPS to pass traffic through i had to execute the following


iptables –table nat –append POSTROUTING –jump MASQUERADE


echo “net.ipv4.ip_forward = 1? | tee -a /etc/sysctl.conf
echo “net.ipv4.conf.all.accept_redirects = 0? | tee -a /etc/sysctl.conf
echo “net.ipv4.conf.all.send_redirects = 0? | tee -a /etc/sysctl.conf
for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 > $vpn/accept_redirects; echo 0 > $vpn/send_redirects; done
sysctl -p


for vpn in /proc/sys/net/ipv4/conf/*; do echo 0 > $vpn/accept_redirects; echo 0 > $vpn/send_redirects; done
iptables –table nat –append POSTROUTING –jump MASQUERADE


 

What is PHP Composer?

If you have ever written anything in PHP before, you have probably found that it feels like you have to keep re-inventing the wheel anytime you want to do a common task such as User Authentication, Database Management or Request Routing. PHP now has a handful of mature frameworks that have already solved all of these problems, so wouldn’t it be easier to cherry pick the bits that you needed from each framework?


If you were to start manually picking the bits you wanted from Zend, or Laravel or Symfony, then it would become very difficult to manage. Each library might also have dependencies, and so you would end up in a mess, particularly if you required other people to work on your project.


This is where Composer comes in. Composer is a dependency manager for PHP. Composer will manage the dependencies you require on a project by project basis. This means that Composer will pull in all the required libraries, dependencies and manage them all in one place.


This kind of management for dependencies in a project is not a new concept, and in fact, much of Composer is actually inspired from npm from Node.js and Bundler from Ruby.


You might also be aware of PEAR. PEAR is an established PHP package manager that has been around for years. PEAR however, has been abandoned by many PHP developers for a number of reasons. Firstly, much of the code in PEAR is out-of-date. Secondly, PEAR forces you to install packages system wide, rather than on a project-by-project basis. This means that if you already have a project that relies on a slightly older package, you are screwed. For an excellent history of PHP packages, read Packages: The Way Forward for PHP by Phil Sturgeon.


Installing Composer


Installing Composer is really easy as it can all be done through the command line. I’m using OS X, but the following should be the same for any *nix operating system.


So fire up Terminal and run the following commands:


$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer


The first command downloads the composer.phar file to your computer. The second line moves the composer.phar file in to your bin so that is accessible globally on your computer.


Now run the following command:


$ composer


If you have installed Composer successfully, you should be given a list of available commands and descriptions.
Installing on Windows?


If you are looking to install Composer on a Windows machine, take a look at the guide on the Composer website.
Using Composer


Now that you have Composer installed, you can use it to require some packages into your project. To make a Composer configuration file, we just need to make a JSON file in the root of the project.


For example, if you wanted to use Slim Framework you could create the following composer.json file.


{
"require": {
"slim/slim": "2.*"
}
}


To install Slim via Composer, you can simply run the following command through Terminal.


$ composer install


This will automatically download Slim into your project under the directory vendor/slim/slim.


See, how easy was that?
Autoloading


Now that you have all of these different packages, you need the ability to autoload them into your project. Fortunately Composer also comes with an autoload file, which is capable of autoloading any of the files in the projects that you download.


To use the Composer autoloader, simply include the following line in your project’s index or bootstrap file.


require 'vendor/autoload.php';


Now you can start using the new libraries without having to worry about loading them up.


For example:


// Autoload
require 'vendor/autoload.php';


// Instantiate a Slim application
$app = new SlimSlim();


// Define a HTTP GET route
$app->get('/hello/:name', function ($name) {
echo "Hello, $name";
});


// Run the Slim application
$app->run();
Conclusion


Package management is clearly the right route forward for PHP. Languages such as Ruby have shown how incredibly easy it is to use packages within projects so common problems can be solved once, and you can stop wasting time as a developer by constantly reinventing the wheel.


Many of the most popular frameworks have already positioned themselves to use Composer, and many more individual developers are releasing code that is Composer ready from the get go.


As a PHP developer, Composer will become your best friend, and as it’s usage increases, it will become an essential part of writing PHP on a day-to-day basis.


By following conventions, PHP can become a much better language to use. Composer has already solved a big problem in the PHP community, so there’s really no reason why you shouldn’t start using it today.

How to install htop

To install htop with yum, the EPEL repository must be installed.

Redhat / CentOS 5 (most likely version in use)


32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Redhat / CentOS 6


32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Now that the repository is installed to the server, we can install htop
yum install htop

 

Tuesday 9 September 2014

Install NixTree PHP Selector in CloudLinux cPanel server

NixTree PHP Selector plugin allows a domain user to select preferred PHP version per directory on the same domain.
Note :This plugin requires SuPHP on the system; it will not work with any other PHP handlers for now.

To install ntPHPselector, run the following commands:

cd /usr/local/src
wget -N http://nixtree.com/download/free/ntphpselector_manage.sh
sh ntphpselector_manage.sh install


To recompile php in ntPHPselector, run the following command:

sh ntphpselector_manage.sh recompile <option>


– option
2 for 5.2
3 for 5.3
4 for 5.4
5 for 5.5

eg: recompile php5.2

sh ntphpselector_manage.sh recompile 2


For uninstalling the plugin:

sh ntphpselector_manage.sh uninstall

Tuesday 19 August 2014

Block an Email in Plesk

Although Plesk has a built-in spam filter that blocks most spam messages from reaching your email account, some unwanted messages may slip past it unhindered. To rectify this issue, you must make use of the spam filter’s blacklist function to stop receiving messages from a particular email address in the future. In addition to blocking email addresses individually, you can also configure the Plesk spam filter to block all email addresses related to a particular domain.



1 ). Sign in to your Plesk Control Panel.



2). Click the “Mail” tab, and then select an email account from the list under “Email Address.”



3). Click the “Spam Filter” tab. If unchecked, check the box next to “Switch on Spam Filtering for This Email Address,” and then click the “Show Advanced Settings” option below.



4). Enter the email address that you want blocked into the vacant text box next to “Black List.” To block multiple email addresses, press “Enter” after inserting each address into the text box. To block all incoming email from addresses related to a particular domain, enter "*@domain_name.com” (without quotes), replacing "domain_name.com" with the name of the domain.



5). Click “OK” to save the changes.

Monday 30 June 2014

How to Install htop

To install htop with yum, the EPEL repository must be installed.

Redhat / CentOS 5 (most likely version in use)



32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm


Redhat / CentOS 6



32bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
64bit: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


Now that the repository is installed to the server, we can install htop

yum install htop


 

Thursday 26 June 2014

How to Disable magic quotes Joomla on Linux Server

Error while accessing modsec control from WHM :Software error

Can’t locate JSON/XS.pm in @INC (@INC contains: /usr/local/cpanel /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/local/cpanel/Cpanel/JSON.pm line 15.


You can disable magic quotes in joomla by adding the following line to the php.ini file.

magic_quotes_gpc = Off


If it did’t solver the issue you need to add the following lines to the php5.ini in the document-root.

magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
extension=pdo.so
extension=pdo_mysql.so


If the file php5.ini is not there in the document root, then you can rename the php.ini as php.ini.

Also after adding this you need to add the following lines on the .htaccess file. If there is no .htaccess then you can create a new file and add the following codes to it,

SetEnv PHPRC /home/$username/public_html/

Note : Replace the path “/home/$username/public_html/” properly with your path.

Commands

Command to find the no of process running by each user

ps aux |awk '{$1} {++P[$1]} END {for(a in P) if (a !="USER") print a,P[a]}' | sort -k 2


Command to find total no of php process running be each user

ps aux | grep php  |awk '{$1} {++P[$1]} END {for(a in P) if (a !="USER") print a,P[a]}' | sort -n -k 2


Command to find total no of dovecot process running be each user

ps aux | grep dovecot  |awk '{$1} {++P[$1]} END {for(a in P) if (a !="USER") print a,P[a]}' | sort -n -k 2


Command to kill all the Dovecot process

ps -aux | grep dovecot | awk '{print $2}' | xargs kill -9


Find Plesk admin password from commandline

/usr/local/psa/bin/admin --show-password


Command to kill all process running on Port 80

ps -aux | grep dovecot | awk '{print $2}' | xargs kill -9

Wednesday 25 June 2014

Update Clamav to Latest Version on cPanel Server

Recently received a clam update in logwatch and seen the duplicate database error and went in to take a look at what was going on.

--------------------- clam-update Begin ------------------------
The ClamAV update process was started 3 time(s)
Last ClamAV update process started at Fri May 18 01:44:12 2012
Last Status:
main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven)
Downloading daily-14929.cdiff [100%]
Downloading daily-14930.cdiff [100%]
Downloading daily-14931.cdiff [100%]
daily.cld updated (version: 14931, sigs: 174042, f-level: 63, builder: guitar)
bytecode.cld is up to date (version: 178, sigs: 40, f-level: 63, builder: neo)
[LibClamAV] Detected duplicate databases /var/clamav/main.cvd and /var/clamav/main.cld, please manually remove one of them
Database updated (1218469 signatures) from db.us.clamav.net (IP: xxx.xxx.xxx.xx)
Clamd successfully notified about the update.
---------------------- clam-update End -------------------------



After I repaired that issue, (basically just removed “aka rm’d” the older /var/clamav/main.cvd database) and I came across a slightly less important issue which was clamav was reporting an old version from the command line.

[root@serverT.com]  freshclam
ClamAV update process started at Tue May 20 11:00:07 2014
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.98.3 Recommended version: 0.98.4
DON'T PANIC! Read http://www.clamav.net/support/faq
main.cvd is up to date (version: 55, sigs: 2424225, f-level: 60, builder: neo)
daily.cld is up to date (version: 19005, sigs: 958471, f-level: 63, builder: neo)
bytecode.cld is up to date (version: 237, sigs: 44, f-level: 63, builder: dgoddard)



Well, I read the FAQ which was somewhat ambiguous and started looking for other options to update this apart from cpanel – WHM 11.44.0 (build 18)



I was able to locate this set of instructions from an older version of clamav which worked very well.

cd /usr/local/cpanel/modules-install/clamavconnector-Linux-x86_64


wget http://kaz.dl.sourceforge.net/project/clamav/clamav/0.98.4/clamav-0.98.4.tar.gz


vim the 'install' file


AVV=0.98.4


Find the line AVVOLD=0.97.1 and make it AVVOLD=0.98.3

AVVOLD=0.98.3
:wq


The values in those lines will depend upon the version of your ClamAV. Save the ‘install’ file after making the changes.

Then edit the file ‘progversion’ and put the latest version of ClamAV there. You can do this with a simple command.

echo "0.98.4" > progversion


then run

./install
freshclam

Sunday 22 June 2014

Script to Change Password of all cPanel Accounts

Bash script to update password of all cPanel Accounts

#! /bin/bash
rm New-Password.txt
echo " " >> New-Password.txt
echo " " >> New-Password.txt
echo "======================================" >> New-Password.txt
echo "Thank you for using iServerSupport.com" >> New-Password.txt
echo "======================================" >> New-Password.txt
echo " " >> New-Password.txt
echo "Passwords of all your cPanel account has changed below are the new passwords" >> New-Password.txt
echo " " >> New-Password.txt
cat /etc/domainusers|awk -F: '{print $1}' | while read user; do
pass=`</dev/urandom tr -dc A-Za-z0-9 | head -c 20`
echo $user $pass >> New-Password.txt
/scripts/realchpass $user $pass > /dev/null
/scripts/ftpupdate > /dev/null
done
echo " " >> New-Password.txt
echo " " >> New-Password.txt
cat New-Password.txt


Create a file called change password.sh and copy above contents into it



vi changepassword.sh


Give execution permission for the file



chmod +x changepassword.sh


Run the script



sh  changepassword.sh


Friday 20 June 2014

List installed perl modules

You can list installed perl modules using the below command


 


instmodsh

Available commands are:

l - List all installed modules

m <module> - Select a module

q - Quit the program

cmd? l



 


Installed modules are:





Acme::Spork
AppConfig
Archive::Tar
Archive::Tar::Streamed
Archive::Zip
Authen::Libwrap
BSD::Resource
Business::OnlinePayment
Business::OnlinePayment::AuthorizeNet
Business::UPS
CDB_File
CPAN
CPAN::DistnameInfo
CPAN::SQLite
Carp
Class::Accessor
Class::ErrorHandler
Class::Inner
Class::Inspector
Class::Load
Class::Singleton
Class::Std
Class::Std::Utils
Clone
Compress::Bzip2
Compress::Raw::Bzip2
Compress::Raw::Zlib
Convert::ASN1
Crypt::GPG
Crypt::OpenSSL::RSA
Crypt::OpenSSL::Random
Crypt::Passwd::XS
Crypt::PasswdMD5
Crypt::RC4
Crypt::SSLeay
Curses
Curses::UI
Cwd
DBD::SQLite2
DBD::mysql
DBI
DBIx::MyParsePP
Data::Dump
Data::Dumper
Data::MessagePack
Data::OptList
Date::Parse
DateTime
DateTime::Locale
DateTime::TimeZone
Devel::Symdump
Digest::HMAC
Digest::MD5
Digest::MD5::File
Digest::Perl::MD5
Digest::SHA
Digest::SHA1
Dist::CheckConflicts
Email::Address
Email::Date::Format
Email::MIME
Email::MIME::ContentType
Email::MIME::Encodings
Email::MessageID
Email::Simple
Email::Valid
Encode::Detect
Encode::Locale
Error
Expect
ExtUtils::CBuilder
ExtUtils::MakeMaker
File::Find::Rule
File::Find::Rule::Filesys::Virtual
File::HomeDir
File::Listing
File::MMagic::XS
File::NFSLock
File::Path::Tiny
File::Slurp
File::Tail
File::Temp
File::Touch
File::Which
Filesys::Df
Filesys::Statvfs
Filesys::Virtual
Filesys::Virtual::Plain
GD
GD::Graph
GD::Text
Geo::IPfree
Geography::Countries
Getopt::Param::Tiny
GnuPG
Graph::Easy
Graph::Flowchart
HTML::StripTags
HTML::Template
HTTP::Cookies
HTTP::Daemon
HTTP::Daemon::App
HTTP::Daemon::SSL
HTTP::Date
HTTP::Message
HTTP::Negotiate
IO::Compress
IO::HTML
IO::Interactive::Tiny
IO::SessionData
IO::Socket::ByteCounter
IO::Socket::INET6
IO::Socket::SSL
IO::Stringy
IO::Tty
IO::Zlib
IP::Country
IPC::Pipeline
IPC::Run
IPC::Run3
Image::Size
JSON::XS
LWP
LWP::MediaTypes
LWP::Protocol::https
Lchown
Linux::Inotify2
List::Cycle
List::MoreUtils
Locale-Maketext
Locale::Maketext::Utils
Locales
Log::Log4perl
MD5
MIME::Lite
MIME::Types
MLDBM
Mail
Mail::Alias::Reader
Mail::DKIM
Mail::DomainKeys
Mail::SPF
Mail::SRS
Mail::SpamAssassin
Math::Base85
Math::BigInt
Math::Fibonacci
Math::Fibonacci::Phi
Module::Build
Module::Implementation
Module::Metadata
Module::Runtime
Module::Want
Mozilla::CA
MySQL::Diff
Net
Net::AIM
Net::DAV::Server
Net::DNS
Net::DNS::Resolver::Programmable
Net::Daemon
Net::Daemon::SSL
Net::FTPSSL
Net::HTTP
Net::HTTPS::Any
Net::HTTPTunnel
Net::IDN::Encode
Net::IP::Match::Regexp
Net::IPv4Addr
Net::LDAP
Net::LDAP::Server
Net::LibIDN
Net::OSCAR
Net::SNMP
Net::SOCKS
Net::SSLeay
Net::Server
NetAddr::IP
Number::Compare
OLE::Storage_Lite
Package::Stash
Package::Stash::XS
Params::Util
Params::Validate
Parse::CPAN::Meta
Parse::RecDescent
Perl
Perl::OSType
Probe::Perl
Proc::Daemon
Quota
Regexp::Assemble
SOAP::Lite
SQL::Statement
SVG::TT::Graph
Safe::Hole
Set::Crontab
Socket6
Spreadsheet::ParseExcel
Spreadsheet::WriteExcel
String::CRC32
Sub::Install
Sub::Uplevel
Sys::Hostname::Long
Sys::Mmap
Task::Cpanel::Core
Task::Weaken
Template
Term::ReadKey
Term::ReadLine
Test::Carp
Test::Deep
Test::Exception
Test::Fatal
Test::Harness
Test::NoWarnings
Test::Requires
Test::Script
Test::Simple
Test::Tester
Test::Unit
Test::Warn
Text::CSV
Text::CSV_XS
Text::Glob
Tie::DBI
Tie::IxHash
Tie::ShadowHash
Tree::DAG_Node
Tree::MultiNode
Try::Tiny
Types::Serialiser
URI
Unix::PID
Unix::PID::Tiny
WWW::RobotRules
Web::Detect
XML::LibXML
XML::NamespaceSupport
XML::Parser
XML::SAX
XML::SAX::Base
XML::SAX::Expat
XML::Simple
XML::Writer
YAML
YAML::Syck
cPanel::MemTest
common::sense
lib::restrict
local::lib
version
cmd?


Internal Server Error User "username" is over quota

When you try to login to Webmail you will get the below error even if your quota is not reached.

Internal Server Error User ‘username’ is over quota

The following step will fix the issue.

cd /var/cpanel/overquota
[/var/cpanel/overquota]# rm -f username

Thursday 19 June 2014

How to Setup Google as mail server

You can setup Gmail as your primary email provider for your website. For this you need to get registered with Google Apps.

Once you get registered then you can change the MX records of your websites to use Gmail for communication.

In cPanel server’s you can find the option “MX Entry” in your cPanel itself. You can clear all the MX record entries there and add them with the Google Apps Mail MX.

For achieving this follow the simple steps mentioned below,

Step 1.

login to cPanel

Step 2.

Choose the option “MX Entry” from cpanel.

Step 3.

Then select the option “Remote Mail Exchanger” and click on change button

Step 4.

In the “Add New Record” area you need to add the following MX entries according to the priority as shown below,

MX Records Priority


ASPMX.L.GOOGLE.COM 1


ALT1.ASPMX.L.GOOGLE.COM 2


ALT2.ASPMX.L.GOOGLE.COM 3


ASPMX2.GOOGLEMAIL.COM 4


ASPMX3.GOOGLEMAIL.COM 5


ASPMX4.GOOGLEMAIL.COM 6


ASPMX5.GOOGLEMAIL.COM 7


It may take 24-48 hours for the propagation.

550 “REJECTED – Bad HELO exim error

This error may cause for some domains those MX record pointed to different domain.

In this case first check the MX record of the domain and see if it is in the same server.

If not remove the entry for the particular domain from the file,


/etc/localdomains



Then add the entry that you removed from the above file to the following file,


/etc/remotedomains



After this restart the exim service, It should be fine now.

Friday 13 June 2014

Monitoring Load & Memory using SAR

sar for load & memory.


sysstat - daemon 


Using sar we can monitor performance of server(load, memory etc…)in real time.




 


sar -q


report load average. (fetch data from /var/log/sa(sysstat)/sa*, where sa* represent the date like sa10,sa11,sa12etc.).


Examples,


sar -q  (List current day’s load averages starting from 12:00:00, with 10 minute interval).


sar -q 1 5 (List load averages 5 times from when we enter this with an interval of 1 sec).


sar -q -f /var/log/sa/sa23  (Fetch data from /var/log/sa/sa23).





sar -r 


report memory details.


Examples,


sar -r (List current days memory usage from 12:00:00)


sar -r 1 5 (List memory usage 5 times from when we enter this with an interval of 1 sec).


sar -r -f /var/log/sa/sa23  (Fetch data from /var/log/sa/sa23).


Examples,
1. sar -q


sar

2. sar -q 1 5


sar

3. sar -q -f /var/log/sysstat/sa06


sar


4.
sar -r


sar

5. sar -r 1 5


sar

6. sar -r -f /var/log/sysstat/sa06


sar

-r and -q are the commonly using SAR switches, Please refer other switches too (-u, -v, -P, -d, -b etc…)

How to Install ipsec-tools

IPsec



For IPsec to work inside a container:


  • Kernel 042stab084.8 or later

  • The following kernel modules must be loaded before container start:



af_key esp4 esp6 xfrm4_mode_tunnel xfrm6_mode_tunnel



  • Capability net_admin must be granted to a container



modprobe af_key
modprobe esp4
modprobe esp6
modprobe xfrm4_mode_tunnel
modprobe xfrm6_mode_tunnel


Steps to install ipsec-tools



Create file /etc/yum.repos.d/CentOS-Base.repo with contents as below


# CentOS-Base.repo## This file uses a new mirrorlist system developed by Lance Davis for CentOS.# The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client.  You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the# remarked out baseurl= line instead.##[base]
name
=CentOS-5-Base#mirrorlist=http://sg2plmirror01.shr.prod.sin2.secureserver.net/vph/2/download/mirrors/cos-5.i386
failovermethod
=priority
baseurl
=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck
=1
gpgkey
=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos5#released updates[update]
name
=CentOS-5-Updates
mirrorlist
=http://sg2plmirror01.shr.prod.sin2.secureserver.net/vph/2/download/mirrors/cos-5-updates.i386
failovermethod
=priority
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck
=1
gpgkey
=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos5#packages used/produced in the build but not released[addons]
name
=CentOS-5-Addons
mirrorlist
=http://sg2plmirror01.shr.prod.sin2.secureserver.net/vph/2/download/mirrors/cos-5-addons.i386
failovermethod
=priority
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck
=1
gpgkey
=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos5#additional packages that may be useful[extras]
name
=CentOS-5-Extras
mirrorlist
=http://sg2plmirror01.shr.prod.sin2.secureserver.net/vph/2/download/mirrors/cos-5-extras.i386
failovermethod
=priority
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck
=1
gpgkey
=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos5#additional packages that extend functionality of existing packages[centosplus]
name
=CentOS-5-Plus
mirrorlist
=http://sg2plmirror01.shr.prod.sin2.secureserver.net/vph/2/download/mirrors/cos-5-centosplus.i386
failovermethod
=priority
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck
=1
enabled
=0
gpgkey
=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos5#contrib - packages by Centos Users[contrib]
name
=CentOS-5-Contrib
mirrorlist
=http://sg2plmirror01.shr.prod.sin2.secureserver.net/vph/2/download/mirrors/cos-5-contrib.i386
failovermethod
=priority
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck
=1
enabled
=0
gpgkey
=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos5




OR



Create file /etc/yum.repos.d/public-yum-el5.repo with contents as below


[el5_latest]
name
=OracleLinux $releasever Latest($basearch)
baseurl
=http://public-yum.oracle.com/repo/OracleLinux/OL5/latest/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=1[el5_ga_base]
name
=OracleLinux $releasever GA installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/0/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_u1_base]
name
=EnterpriseLinux $releasever Update1 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/1/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_u2_base]
name
=EnterpriseLinux $releasever Update2 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/2/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_u3_base]
name
=EnterpriseLinux $releasever Update3 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/3/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_u4_base]
name
=EnterpriseLinux $releasever Update4 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/4/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_u5_base]
name
=EnterpriseLinux $releasever Update5 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/5/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[ol5_u5_base]
name
=OracleLinux $releasever Update5 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/OracleLinux/OL5/5/base/x86_64/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[ol5_u6_base]
name
=OracleLinux $releasever Update6 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/OracleLinux/OL5/6/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[ol5_u7_base]
name
=OracleLinux $releasever Update7 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/OracleLinux/OL5/7/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[ol5_u8_base]
name
=OracleLinux $releasever Update8 installation media copy ($basearch)
baseurl
=http://public-yum.oracle.com/repo/OracleLinux/OL5/8/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_addons]
name
=EnterpriseLinux $releasever Add ons ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/addons/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_oracle_addons]
name
=OracleSoftware addons forEnterpriseLinux $releasever ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/oracle_addons/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[ol5_UEK_latest]
name
=LatestUnbreakableEnterpriseKernelforOracleLinux $releasever ($basearch)
baseurl
=http://public-yum.oracle.com/repo/OracleLinux/OL5/UEK/latest/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[ol5_UEK_base]
name
=UnbreakableEnterpriseKernelforOracleLinux $releasever ($basearch)
baseurl
=http://public-yum.oracle.com/repo/OracleLinux/OL5/UEK/base/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0[el5_unsupported]
name
=ProductivityApplicationsforEnterpriseLinux $releasever ($basearch)
baseurl
=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/unsupported/$basearch/
gpgkey
=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck
=1
enabled
=0



  Install the package:




yum install ipsec-tools


Thursday 12 June 2014

Solved "Missing owner for domain X, force lookup to root"

On recent cPanel versions, rebuilding the Apache conf returns the following non-fatal error:

root@servertechs [~]# /scripts/rebuildhttpdconf

info [rebuildhttpdconf] Missing owner for domain servertechs.serversolutions.com, force lookup to root
Built /usr/local/apache/conf/httpd.conf OK

The error does not adversely effect the way the httpd.conf file is built, but the presence of the unnecessary info message can be annoying.  And by “can be annoying”, I mean “is annoying”.

To fix this, you will need to edit the main vhost template for the ‘nobody’ user, which owns the primary hostname of your server.  Edit /var/cpanel/userdata/nobody/$hostname and add this line to the bottom of the file:

owner: 'nobody'

Then run /scripts/rebuildhttpdconf again and the “error” should be gone.

Wednesday 11 June 2014

ffmpeg installer

ffmpeginstaller is a free software completely written in bash shell script. The purpose of this script is to build a video streaming platform in your Gnu/Linux server. So you can start video streaming websites and avoid the cost of installations. This script not only install FFmpeg but also all its friends packages. You can chose this script for building platform for most of the youtube clone software like clip-shre, sharemixer,shareigniter,etc,.




What packages ffmpeginstaller install in your server?


Please see the complete list of packages below.




  • FFmpeg : FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video



  • MPlayer and MEncoder : MPlayer is a movie player.It plays most MPEG/VOB, AVI, Ogg/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia, Matroska, NUT, NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files, supported by many native, XAnim, and Win32 DLL codecs.



  • A52 Decoder : Are you a hosting company and you like to sell PCI DSS compliance servers to your clients with support ? If so this is your plan



  • AMR-NB and AMR-WB : The Adaptive Multi-Rate (AMR) audio codec is a patented audio data compression scheme optimized for speech coding



  • Latest Codecs : Install latest codecs libs



  • FAAD2 : FAAD2 is an open source MPEG-4 and MPEG-2 AAC decoder



  • FAAC : FAAC is an MPEG-4 and MPEG-2 AAC encoder.



  • FLVtool2 : FLVTool2 is a manipulation tool for Macromedia Flash Video files (FLV )



  • LAME MP3 Encoder : LAME is a high quality MPEG Audio Layer III (MP3) encoder



  • Liba52 : Liba52 is a free library for decoding ATSC A/52 streams



  • Libogg : Ogg Lib collections



  • Opencore-AMR : Library of OpenCORE Framework implementation of Adaptive Multi Rate Narrowband and Wideband speech codec



  • Theora : Theora is a free and open video compression format



  • Vorbis-tools : Vorbis is a completely open, patent-free, professional audio encoding and streaming technology with all the benefits of Open Source



  • Libwmf : libwmf is a library for reading vector images in Microsoft's native Windows Metafile Format (WMF)



  • MP4Box : MP4Box is a MP4 multiplexer



  • x264 : x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC format



  • Xvid : Open-source compression codec based on MPEG-4 ISO format


Saturday 7 June 2014

ZOOM Framework - Failed: Filesystem preventing downloads. (ftpext)

Failed: Filesystem preventing downloads. (ftpext)


error occurs sometimes on specific servers when you try to update the ZOOM Framework.

We can Solve the issue in 4 Ways. I'll help you to get it resolved.


  • Re-download your theme again from Members Area and install it again on your website, or




  • Update the ZOOM Framework from your theme manually. You can find the latest version of the framework in the ZIP file of your theme under the functions / wpzoom folder. After that replace this folder with the one from your theme via FTP.




  • Download just the ZOOM Framework from this address: http://framework.wpzoom.com/wpzoom-framework.zip and update it manually. The framework is the functions/wpzoom/ folder from your theme, so you’ll have to replace entire folder.



The changelog of the framework can be found here: http://framework.wpzoom.com/changelog/




  • Just add this line in the wp-config.php file of your WordPress install.




define('FS_METHOD', 'direct');

Friday 6 June 2014

mod_reveseproxy Extract Client IP from reverse proxy

If you setup Apache 2.4 With mod_remoteip, the apache extended status always gives you the proxy IP, instead of client IP, actually this is due to that the mod_status set client IP very early when there is a TCP connection but no headers, Apache 2.4 allows per-request notion of overriding the client address, but not at this early stage. To overcome this issue, I would suggest you to use mod_reveseproxy apache module, the modules is completely based on mod_cloudflare and mod_remoteip.



To install, follow the instructions on:

wget https://raw.github.com/Prajithp/mod_reverseproxy/master/mod_reverseproxy.c
apxs -i -c -n mod_reverseproxy.so mod_reverseproxy.c


Configuration Directives

ReverseProxyEnable           (On|Off)          - Enable reverse proxy

ReverseProxyRemoteIPHeader X-Real-IP - The header to use for the real IP
address.
ReverseProxyRemoteIPTrusted 127.0.0.1 - What IPs to adjust requests for


Example Configuration


LoadModule reverseproxy_module modules/mod_reverseproxy.so

<IfModule reverseproxy_module>
ReverseProxyEnable  On
ReverseProxyRemoteIPHeader X-Real-IP
ReverseProxyRemoteIPTrusted 127.0.0.1
ReverseProxyRemoteIPTrusted 46.105.160.192
</IfModule>

NOTES:

  • If mod_cloudflare or mod_remoteip are already loaded on the same web server, the web server will crash because both modules try to set the remote IP to a different value.


https://github.com/Prajithp/mod_reverseproxy



Wednesday 4 June 2014

cPanel To DirectAdmin Migration Conversion Tool

Its now quite easy to migrate accounts from cPanel to DirectAdmin using conversion tool



Before proceed,  First we will need to download conversion tool  and you can download it from here ::



DOWNLOAD HERE



STEPS TO FOLLOW ::



1) Download and extract the version URL (from above) that you wish to use. (wget and tar xzf)



2) Create import and export directories for the tool to use. (mkdir import export)



3) Copy your cPanel user backups into the import directory.



4) Edit defaults.conf to match the DA server you will be restoring to. The only fields you must change are the IP and name server fields. The tool will not work if you fail to do this!



5) Execute perl da.cpanel.import.pl and follow the on-screen instructions (which will duplicate the steps here to a degree).



6) After the tool is finished converting (or as it completes each individual user), move your new DA user backups from the export directory to any DA /home/RESELLER/user_backups directory*



7) Restore the DA user backups in DA’s reseller-level Manage User Backups tool.

Monday 2 June 2014

cPHulk Status via command line

A client recently asked how to check the status of cphulk via the command line… This got me thinking; beside actually logging into WHM to check “Home »Security Center » cPHulk Brute Force Protection” to see whether cPHulk is currently Disabled/Enabled, I was unaware of a way to do this. After a little digging, I was able to find


/usr/local/cpanel/scripts/restartsrv_cphulkd --status



Which gives the current status of cPHulk from the command line



cphulkd is disabled



and scene.

Sunday 1 June 2014

How to Install Mod_Pagespeed in WHM/cPanel using easyapache

The mod_pagespeed  custom module for CPanel WHM using CPanel Easy Framework. which can be install using /scripts/easyapache on command line or easyapache from WHM choice whether to install it or not.

Steps to install Mod_Pagespeed.

#  cd /usr/local/

# wget http://r6host.com/scripts/mod_pagespeed-cust-opts.tar.gz

# tar -C /var/cpanel/easy/apache/custom_opt_mods  -xzf mod_pagespeed-cust-opts.tar.gz

Thats it, now you can run

# /scripts/easyapache

Login into WHM and go to EasyApache Update

It will show you the Mod_Pagespeed included in it and you can install it by checking the box.

Tuesday 27 May 2014

DNS zone - domain alias cannot be edited because the domain alias is turned off

Sometimes activating the DNS zone of a domain can give the error “DNS zone of a domain alias cannot be edited because the domain alias is turned off”. To correct this, open up command prompt in Remote Desktop and type the command

cd %plesk_bin%


Next, enter the command below (in one line) replacing xxyyzz.com with the affected domain

dbclient.exe --direct-sql --sql="update dns_zone set status=0 where name='xxyyzz.com';


You can then switch off and on the DNS and it should resolving fine.

Thursday 22 May 2014

Error : Requested action not taken: mailbox unavailable or not local

Error :

"550 Requested action not taken: mailbox unavailable" only form some of the mail server.
and  "Requested action not taken: mailbox unavailable or not local"

To resolve this issue i search a lot on internet but not able to find any propper solution, after investigation i found the solution and working fine without any problem,

Resolution :

configure Gateway firewall for SMTP Traffic or disable Email scan for Mail server.

Monday 19 May 2014

Find Spammer on exim server - cPanel

Top 5 users sending maximum emails

grep "<=.*P=local" /var/log/exim_mainlog | awk '{print $6}' | sort | uniq -c | sort -nr | head -5
eximstats /var/log/exim_mainlog | grep -A7 "Top 50 local senders by message count" | tail -5 | awk '{print $1,$NF}'

Top 5 mail receivers:

egrep "(=>.T=virtual_userdelivery|=>.T=local_delivery)" /var/log/exim_mainlog | awk '{print $7}' | sort | uniq -c | sort -nr | head -5
eximstats /var/log/exim_mainlog | grep -A7 "Top 50 local destinations by message count" | tail -5 | awk '{print $1,$NF}'

Script to check path for the script used for spamming

awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $3} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1
awk '{ if ($0 ~ "cwd" && $0 ~ "home") {print $4} }' /var/log/exim_mainlog | sort | uniq -c | sort -nk 1

If there is large number of hits from an IP,block the IP

tail -n1000 /var/log/exim_mainlog |grep SMTP|cut -d[ -f2|cut -d] -f1|sort -n |uniq -c

Following command will show you the maximum no of email currently in the mail queue have from or to the email address in the mail queue with exact figure.

exim -bpr | grep "<@>" | awk '{print $4}'|grep -v "<>" | sort | uniq -c | sort -n

That will show you the maximum no of email currently in the mail queue have for the domain or from the domain with number.

exim -bpr | grep "<@>" | awk '{print $4}'|grep -v "<>" |awk -F "@" '{ print $2}' | sort | uniq -c | sort -n

Following command will show path to the script being utilized to send mail

ps -C exim -fH eww
ps -C exim -fH eww | grep home
cd /var/spool/exim/input/
egrep "X-PHP-Script" * -R

Command to delete frozen mails

exim -bp | awk '$6~"frozen" {print $3 }' | xargs exim -Mrm

If anyone is spamming from /tmp

tail -f /var/log/exim_mainlog | grep /tmp

To display the IP and no of tries done the IP to send mail but rejected by the server.

tail -3000 /var/log/exim_mainlog |grep 'rejected RCPT' |awk '{print$4}'|awk -F[ '{print $2} '|awk -F] '{print $1} '|sort | uniq -c | sort -k 1 -nr | head -n 5

Shows the  connections from a certain ip to the   SMTP server

netstat -plan|grep :25|awk {‘print $5?}|cut -d: -f 1|sort|uniq -c|sort -nk 1

To shows the domain name and the no of emails in queue

exim -bp | exiqsumm | more

If  spamming from outside domain then you can block that domain or email id on the server

pico /etc/antivirus.exim

Add the following lines:

if $header_from: contains “name@domain.com” then seen finish endif

Catching spammer

Check mail stats

exim -bp | exiqsumm | more

Check if any php script is causing the mass mailing with

cd /var/spool/exim/inputegrep “X-PHP-Script” * -R

Just cat the ID that you get and you will be able to check which script is here causing problem for you.  To Remove particular email account email

exim -bpr |grep “test.org”|awk {‘print $3?}|xargs exim -Mrm

Friday 16 May 2014

IP Address - What is IP Address?

Internet Protocol Address (or IP Address) is a unique address that computing devices use to identify and communicate with other devices in the network. Device connected to the IP network must have a unique IP address within its network. An IP address is alike to a street address or telephone number in that it is used to uniquely identify a network device to deliver mail message, or view a website.



IP addresses consist of four numbers separated by periods (also called a ‘dotted-quad’) and look something like 127.0.0.1.



Wikipedia defines it as follows:



An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. An IP address serves two principal functions: host or network interface identification and location addressing. Its role has been characterized as follows: “A name indicates what we seek. An address indicates where it is. A route indicates how to get there.”



The designers of the Internet Protocol defined an IP address as a 32-bit number and this system, known as Internet Protocol Version 4 (IPv4), is still in use today. However, due to the enormous growth of the Internet and the predicted depletion of available addresses, a new addressing system (IPv6), using 128 bits for the address, was developed in 1995, standardized as RFC 2460 in 1998, and is being deployed worldwide since the mid-2000s.



IP addresses are binary numbers, but they are usually stored in text files and displayed in human-readable notations, such as 172.16.254.1 (for IPv4), and 2001:db8:0:1234:0:567:8:1 (for IPv6).



The Internet Assigned Numbers Authority (IANA) manages the IP address space allocations globally and delegates five regional Internet registries (RIRs) to allocate IP address blocks to local Internet registries (Internet Service Providers) and other entities.



IP addresses consist of a series of four numbers separated by decimal points. There are two types of IP addresses: STATIC and DYNAMIC.



Static IP addresses remain the same and are unchanging. They are permanent and are used as easy identifiers. Most ISP’s can offer to assign a single static IP or a block of static IP’s for a few extra bucks a month and may require you upgrading to a business account.



Dynamic IP addresses are temporary and changeable. Such type is issued to customers from a pool of addresses allocated by the ISP or DHCP Server. It is for a large number of customers that do not require the same address all the time for a variety of reasons. Computer will automatically get this number as it logs on to the network and saves one from the trouble of having to know the details regarding the specific network configurations. Those numbers can be assigned to anyone using a dial-up connection, Wireless and High Speed Internet connections.



To maintain uniqueness within global namespace, the IP addresses are publicly registered with the NIC (Network Information Center) to avoid IP address conflicts. Devices which need to be publicly identified such as web / mail servers must have a Globally Unique IP address, and they are assigned a Public IP address. Devices which do not require public access may be assigned a Private IP address, and make it uniquely identifiable within the organization. Example, to prevent the world from printing from it, that network printer may be assigned with a Private IP address.



What is IPv4?



Internet Protocol Version 4 (IPv4), a system of addresses used to identify devices on a network. Originally described in 1981 in RFC791, IPv4, the most widely used Internet layer protocol, at this point it is used by vast majority of users to connect to Internet. More details…



What is IPv6?



Internet Protocol Version 6 (IPv6), an Internet layer protocol developed in the 1990’s (described in RFC2460) as an alternative to IPv4. Rather than using a 32-bit system, IPv6 is based on 128-bit addresses. More details…

SSL Certificate - What is SSL Certificate?

SSL – Secure Sockets Layer,an encryption technology created by Netscape. SSL creates encrypted connection between Web Server and Visitor’s Web Browser allowing Private Information to be transmitted without the problems of data tampering or message forgery. It is designed to enable applications transmit information back and forth securely.

SSL Certificates are small data file that digitally bind a cryptographic key to an organization’s details. When installed on a web server, it activates the padlock, https (over port 443) and allows secure connections from a web server to a browser. Typically SSL is used to secure credit card transactions, data transfer, logins and more recently is becoming the norm when securing browsing of social media sites.

SSL Certificate makes the use of Certificate Authority (CA) as a third party in order to identify both ends of the transactions which clearly happen when one browse the internet, hence opening a web page, an SSL Certificate enables encryption to protect online transaction. This encryption is actually responsible for securing the private data whenever online private transactions are made and this way it protects data from linking to other users or sources on web. SSL Certificate is unique to each other in order to identify the user. At last, the CA will authenticate the identity of the certificate owner before passing out any information.

How SSL Certificate Work? Below is the procedure:

1)       When any user browses the internet, immediately the browser requests for a secure page which starts with https:// , letters before domain name sayhttp://something.com/with SSL it will be browsed as : https://something.com

2)       Using certificate, web server sends the Public Key with the certificate.

3)       Browser then verifies whether the issued certificate is from trusted party or not and also makes sure that it is valid or not expired.

4)       Using Private Key, the web server decrypts the encryption key, the URL, and the http data.

5)       Later web server sends back the requested data.

6)       Then the browser decrypts the http data and displaying complete web page information on the computer screen.

Secure Web Site Connection:

SSL Certificate plays an important role in connecting to a Secure Web Site. Below are the advantages:

Online Secured Messaging: takes place through encryption. Web Server works with SSL Certificate in order to create encrypted channel uniquely. Basically, channel consists of Private Key and Public Key to protect the information or Private Data from other users.



Online Credentials for Established Identity: SSL Certificate allows highly secured browsing of online credentials which basically contains the identity of a person for instance, driver’s license, passport and company badge.



Generating Trustworthy Credentials: While Certificates pass through lot of authentication, credentials are rest assured to be reliable and strict. For instance, VeriSign is one of the leading certificate authorities for its punctilious identification methods.



Complete Protection on HTTPS: Basically, SSL Certificate secures https data. Such tight security allows one to achieve the success of online business.

Need of SSL Certificate:

Anyone transmitting sensitive information through web site, such as personal information as credit card details, need to secure those with SSL encryption. Unless it is secured by SSL Certificate, it is possible that every piece of data could be seen by others. Customers won’t trust the web site without an SSL Certificate. On research it is found that about 60 / 65 percent of online shoppers have terminated the online order due to lack of “trust” during transaction. In short, “SSL Certificate is necessary to gain customers trust”.