Monday 17 December 2012

Installing Flvtool2 in Centos 6


You can install the module via ruby setup

cPanel offers a script to install ruby

 /scripts/installruby

          or try

 yum install subversion ruby libcurses-ruby or apt-get install subversion ruby libcurses-ruby

 cd /usr/local/src

 wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz

  tar -xvzf flvtool2-1.0.6.tgz

  cd flvtool2-1.0.6

  ruby setup.rb config

  ruby setup.rb setup

 ruby setup.rb install

  whereis flvtool2

Installing Mp4box in centos 6


Login to the server

 cd /usr/local/src/

Now we need to download the packages and libraries of MP4Box

 wget http://downloads.sourceforge.net/gpac/gpac-0.4.5.tar.gz

 wget http://nchc.dl.sourceforge.net/project/gpac/GPAC%20extra%20libs/GPAC%20extra%20libs%200.4.5/gpac_extra_libs-0.4.5.tar.gz

 tar -zxvf gpac-0.4.5.tar.gz

 tar -zxvf gpac_extra_libs-0.4.5.tar.gz

Now we need to copy the libraries to gpac folder.

 cd gpac_extra_libs

 cp -prf * /usr/local/src/gpac/extra_lib

 cd ..

 cd gpac

Install MP4Box

 chmod 755 configure

 [gpac]# ./configure

[gpac]# make lib

[gpac]# make apps

[gpac]# make install lib

[gpac]# make install

Now copy the gpac.so file from gpac directory to System libraries

[gpac]# cp -prf bin/gcc/libgpac.so /usr/lib64

>> ldconfig

>> which MP4Box

if you get an error like this

/usr/bin/ld: cannot find -lglutcollect2: ld returned 1 exit status

To fix this create a symbolic link of /usr/lib64/libglut.so.3 to /usr/lib64/libglut.so

[gpac]# ls /usr/lib64 |grep glutlibglut.so.3

[gpac]# ln -s /usr/lib64/libglut.so.3 /usr/lib64/libglut.so


Thursday 13 December 2012

Google Apps MX records in WHM


Log in to your WHM account.

Click on DNS Functions.

Click Edit DNS Zone.
In the box on the right, select the domain you want to edit, and then click Edit.

Delete the existing MX record entry.

In the first box, enter your domain name (e.g. example.com).

Don't change the second box.

Select MX from the drop-down menu.

In the box to the right of the drop-down menu, enter 10 as the priority value.

In the next box, enter enter ASPMX.L.GOOGLE.COM.

Repeat steps six through eight for the rest of the MX record entries listed below.

Add new entries in the Add New Entries Below this Line section.

NOTE: Make sure each entry is entered exactly as it appears in the following table. Each record must have the trailing dot.

Priority     Mail Server
10         ASPMX.L.GOOGLE.COM.
20         ALT1.ASPMX.L.GOOGLE.COM.
30         ALT2.ASPMX.L.GOOGLE.COM.
40         ASPMX2.GOOGLEMAIL.COM.
50         ASPMX3.GOOGLEMAIL.COM.

Select the option Remote mail Exchanger

Then Click save.

Your MX records are now configured to point to Google. Keep in mind that changes to MX records may take up to 48 hours to propagate throughout the Internet.

You can check if it is correctly configured by the command :

dig +trace domainname mx

The result will display the respected Mx value listed above.

Saturday 8 December 2012

Addon domain V/S Parked domain


An Addon domain is a new, unique website hosted in a new folder on your account.
 
When you create an Addon domain, 3 things happen:

    a folder is created in the 'public_html' directory
    a subdomain is created for the main domain and attached to the new folder
    the new domain name is associated with the subdomain

As such, if your main domain was 'abc.com' and you assign the Addon Domain '123.com'     the folder '123', the following routes (URLs) would be true:

abc.com/123
123.abc.com
123.com

They would all access the same directory and, thus, the same website. However, the functionality of 123.com holds true such that when a visitor goes to 123.com, all they know is 123.com -- there is no evidence that they are being routed through 123.abc.com behind the scenes, and everything functions normally.

This all happens automatically when an Addon domain is attached to an account -- no 'fix' required

 An Addon Domain is a domain name which points to its own folder within public_html and appears as a separate website from your primary domain.

    This allows you to have two separate Web sites on your account. You can have a cars.com and then a candy.com as an add-on domain. The candy.com would be a completely separate Web site and visitors would not know that it is part of your cars.com account.

A Parked Domain is a domain name that points to your main Web site on your account

    For example, if cars.com is your main Web site, you can purchase the cars.net and assign it as a parked domain so that if a visitor were to type cars.net they would see the same Web site as if they had typed cars.com
 

Unable to Acesss WHM

The main reason for the inaccessibility is that the Main IP address get blocked in IP tables and Csf.

Check if IP is blocked:
# iptables -L -n --line | grep [IP Address]

If IP appear as DROP or REJECT, the IP has been blocked 
Unblock the IP Address:
# iptables -I INPUT -s [IP Address] -j ACCEPT

Blocking back an IP Address:
# iptables -A INPUT -d [IP Address] -j DROP

 service iptables save

In CSF :
Check the file :
vi /etc/csf/csf.deny
If you find the Entry of thr respected IP Address, Comment it and restart it using :
csf -r

In CpHulk brute Force detection :
Try this command :
ps aux | grep -i cphulk
kill -9 PID#
Where PID# is the process ID number of that process.

Then disable it:

/usr/local/cpanel/bin/cphulk_pam_ctl --disable

At that point, if you can log into the machine, check WHM > Cphulk Brute Force Protection to see if your IP is whitelisted. If it isn't, whitelist your local IP address that you use to log into WHM to ensure you cannot be locked out when root user is brute forced and root logins to WHM are disabled.








PHP Handlers


PHP handlers are the programs that interpret the PHP code in your web application and process it to be sent as HTML (or another static format) by your web server. Out of the box none of the major web servers can handle PHP by themselves so they need another program to do it for them. This program, known as a PHP handler takes all of your PHP code and generates the output which is then sent to the web server which forwards it on to the user.
Currently there are 4 major PHP handlers available on Apache. These include mod_php (AKA DSO), CGI, FastCGI, and suPHP. If you’re using another web server your options may be different (for example, nginx requires FastCGI). Each of these handle memory, CPU, and file permissions in a different way which can then manifest itself in your web app in everything from performance to important features of your application. Here’s a breakdown of each of the options

mod_php (DSO)


DSO (which is short for Dynamic Shared Object) or mod_php is the oldest and, some would say, the fastest PHP handler available. It essentially makes PHP a part of Apache by having the Apache server interpret the PHP code itself through use of an Apache module known as mod_php. This is the default handler typically installed when installing a web server package on your server.
On the plus side mod_php is fast, in fact very fast as it runs directly in the same process as your Apache server. Running it together with Apache also means that it has a very low CPU and memory requirement which may be beneficial in situations where computing resources are limited.
The major drawback of mod_php is that it runs as part of Apache which means that it runs as the same user that your Apache process runs as (if you’re on Ubuntu this would www-data). This means that all work on files will be done as the Apache user which therefore must have permissions to all of your files. In most cases when you upload files to your server you do so as a different user that has login rights to the machine. This means that all the files and folders you upload are “owned” by the user that you used to upload them. If you don’t give permissions to them to the Apache user the web server will not be able to read or write to the files, but if you do give access to them to the Apache user and your machine is compromised by an attacker that attacker could have access to much more than just the files in the website they used to get in to your system potentially creating problems for every site hosted on your machine.
The file permission issue is also the biggest source of headache for users of content management systems such as WordPress or Drupal. Because the files of your site are often owned by an account other than that which they are running as, users of mod_php are often unable to upload or modify files from within their CMS without substantial work arounds. Not only could this prevent an administrator from adding pictures and other media to their site easily, but it could also lead to security patches not being installed due to the added complexity of doing so which causes another security hole in your site.

CGI

CGI is the fallback in most servers when mod_php is not available. Instead of running the PHP code within Apache it is now run as it’s own CGI process, that is, in a program outside of your Apache server.
By default CGI will be called by the Apache server meaning that it will run as the Apache user with all the problems of doing so that mod_php encountered. Unlike mod_php however CGI has the ability to see the PHP as another user (presumably the user that owns the files) using another Apache module known as suexec.
For performance CGI is not nearly as fast as mod_php and requires more CPU time. It is however still soft on memory usage which may be a benefit to some users.

suPHP

suPHP runs PHP outside of the Apache script as CGI. Unlike CGI however it will run the scripts as a user other than the Apache user (presumably the user that owns the files). This means that if you are using a CMS you will be able to upload files from within your web application using suPHP. In addition, because your PHP is being run as a different user any vulnerability in your site can be restricted to only the files of your website thereby providing substantial security benefits particularly on servers that run multiple websites.
The cost of the upload ability and security of suPHP is not cheap. suPHP is slow and requires quite a bit of CPU to process all the files. In addition, as it must process the file each and every time it is called, suPHP cannot use any OPCode caching such as APC or memcached resulting in even higher CPU usage by your application. If you are running on a low-end VPS or other server with an application such as WordPress this configuration can easily push you passed any CPU limits you might have whenever traffic starts to climb.

FastCGI

FastCGI is the last major PHP handler. It offers the security benefits of suPHP by executing files as the owner of the file. Unlike suPHP however it keeps open a session for the file when the processing is done resulting in significant memory use but also allowing for the use of OPCode caching such as APC or memcached.


                                  mod_php CGI suPHP FastCGI
Memory usage             Low         Low    Low     High
CPU Usage                 Low          High    High Low
Security                       Low          Low    High High
Run as file owner         No            No     Yes      Yes
Overall Performance     Fast         Slow   Slow Fast


To determine the PHP Handler used in Cpanel servers :

/usr/local/cpanel/bin/rebuild_phpconfig --current

To determine the PHP version :

php -v

To determine the PHP modules currently enabled :

php -m

To create a phpinfo file, open a plain text file, add the following lines and save :

<?php // Show all information, defaults to INFO_ALL phpinfo(); ?>