Cpanel Hosting

Saturday 23 March 2013

Unsuspending Bandwidth Limit Exceeded user/domain


Hello,

If domain is giving the error of "Bandwidth Limit Exceeded" you can unsuspend it from WHM or terminal as well.

From WHM :

To bring the website back online or un-suspend the bandwidth exceed-er, use the option
WHM >> Account Functions >> Unsuspend Bandwidth Exceeders >> click “Proceed”.

This will reset the bandwidth usage to zero for the account. To increase the bandwidth limit for the account, use the option

WHM >> Account Information >> “View Bandwidth Usage”

From Shell :

vi /var/cpanel/users/USERNAME
change BWLIMIT (Increase the value)
/scripts/updateuserdomains
cd /var/cpanel/bwlimited/

remove the files related to that user or domain 
OR
rename the fies with suffix _bk
e.g.; 
user_bk
domainname.com_bk
www.domainname.com_bk

This will bring the website back online..

How to reset bandwidth for a domain in WHM/CPANEL using Shell !!!


You can follow below steps to reset bandwidth of a Domain in cpanel server through Shell :

************************************************

    ssh to your server
    cd /var/cpanel/bandwidth.cache/
    vi domainname.com and/or vi username
    replace contents with 0
    save and quit

************************************************

Tuesday 12 March 2013

How insecure is SNMP protocol !!


SNMP itself does not define which information (which variables) a managed system should offer. Rather, SNMP uses an extensible design, where the available information is defined by management information bases (MIBs). MIBs describe the structure of the management data of a device subsystem; they use a hierarchical namespace containing object identifiers (OID).
SNMP is based on the manager/agent model consisting of an SNMP manager, an SNMP agent, a database of management information, managed SNMP devices and the network protocol.SNMP was derived from its predecessor SGMP (Simple Gateway Management Protocol) and was intended to be replaced by a solution based on the CMIS/CMIP (Common Management Information Service/Protocol) architecture. This long-term solution, however, never received the widespread acceptance of SNMP.
SNMP traps obviously contain information specific to the SNMP protocol such as Enterprise ID, Generic Trap and Specific Trap. Since SNMP is a UDP-based protocol and messages can therefore be lost, SNMP traps should be avoided where events can be received through other mechanisms such as log file encapsulation.
Summary:
  • Not very secure
  • SNMP version 2 is addressing this
  • Extended security is possible with current protocol (example: DES and MD5)
  • Does not reduce its power for monitoring




How insecure is SNMP protocol !!


SNMP itself does not define which information (which variables) a managed system should offer. Rather, SNMP uses an extensible design, where the available information is defined by management information bases (MIBs). MIBs describe the structure of the management data of a device subsystem; they use a hierarchical namespace containing object identifiers (OID).
SNMP is based on the manager/agent model consisting of an SNMP manager, an SNMP agent, a database of management information, managed SNMP devices and the network protocol.SNMP was derived from its predecessor SGMP (Simple Gateway Management Protocol) and was intended to be replaced by a solution based on the CMIS/CMIP (Common Management Information Service/Protocol) architecture. This long-term solution, however, never received the widespread acceptance of SNMP.
SNMP traps obviously contain information specific to the SNMP protocol such as Enterprise ID, Generic Trap and Specific Trap. Since SNMP is a UDP-based protocol and messages can therefore be lost, SNMP traps should be avoided where events can be received through other mechanisms such as log file encapsulation.
Summary:
  • Not very secure
  • SNMP version 2 is addressing this
  • Extended security is possible with current protocol (example: DES and MD5)
  • Does not reduce its power for monitoring




Saturday 9 March 2013

To display the default Apache page how do I set the primary IP address for my cPanel environment !!!


To display the default Apache page how do I set the primary IP address for my cPanel environment .

Log into your cPanel web server via Secure Shell (SSH).

Located the httpd.conf file using the following command:

located httpd.conf
Open the httpd config file found in step 2 using the following command:

pico /usr/local/apache/conf/httpd.conf
Find the first VirtualHost container in the file. It will look similar to the following: (xx.xx.xx.xx will be the primary IP address of your server)

BytesLog domlogs/cptemp.safesecureweb.com-bytes_log ServerName cptemp.safesecureweb.com DocumentRoot /usr/local/apache/htdocs
Above this section, add the following:

ServerAlias xx.xx.xx.xx ServerAdmin admin@domain.com DocumentRoot /usr/local/cpanel/htdocs ServerName xx.xx.xx.xx
Save and exit the file.

Test the config file to ensure the text you entered is properly formatted using the following command:

/etc/init.d/httpd configtest
Assuming the test returns the message Syntax OK, restart Apache using the following command:

/etc/init.d/httpd restart
The restart of Apache will make your websites unavailable for a few seconds.

How to configure cPanel !!!


Open a web browser and connect to your cPanel Control Panel located at https://ip address:2087.
Login as the Administrator using the information sent to you in your setup email.
Under the Welcome message click Next.
Read the cPanel license agreement and click I Agree.
Enter the requested information:

Main Shared Virtual Host IP: enter the IP of your VPS Hostname: enter your domain name. If you do not currently have a domain name, you can ignore this field Primary Nameserver: enter the primary name server for your domain name; if you are using HostMySite's nameserver, enter ns1.lnhi.net Secondary Nameserver: enter the secondary name server for your domain name; if you are using HostMySite's nameserver, enter ns2.lnhi.net Tertiary Nameserver: enter the tertiary name server for your domain name; if you are using HostMySite's nameserver, enter ns3.lnhi.net
Click Save.
Click Next Step to begin the Initial Quota Scan.
Click Next Step to continue past the Setup Nameserver screen.
Click Next Step to continue past the Setup Resolver Config screen.
For Step 6, enter a root MySQL password and click Change Password.
Click Finish.

How to install BIND .


[Root @ example ~] # yum -y install BIND BIND-utils
It is set assuming that the global address [192.16.0.80/29], private address [10.0.0.0/24], the following settings in the domain name, and [server.world]: Setting BIND. Please replace to suit your environment. (192.16.0.80/29 is actually the address for private)

[Root @ example ~] # echo 'OPTIONS = "-4"' >> / etc / sysconfig / named # If you do not want to use the IPv6 (you will not be set if used) set [Root @ example ~] # vi / etc / named.conf / / / / Named.conf / / / / Provided by Red Hat bind package to configure the ISC BIND named (8) DNS / / Server as a caching only nameserver (as a localhost DNS resolver only). / / / / See / usr / share / doc / bind * / sample / for example named configuration files. / /

options { # (Listens to port 53 on all interfaces of the server) Comment # listen-on port 53 {127.0.0.1;}; # (If you do not want to use the IPv6) change listen-on-v6 {None;}; directory "/ Var / named"; dump-file "/ Var / named / data / cache_dump.db"; statistics-file "/ Var / named / data / named_stats.txt"; memstatistics-file "/ Var / named / data / named_mem_stats.txt"; # (Where the internal network, etc.) to allow range queries allow-query {Localhost; 10.0.0.0/24; }; # (Range / the place if there is a secondary DNS) range to allow the transfer of information zone allow-transfer {localhost; 10.0.0.0/24;}; recursion yes; dnssec-enable yes; dnssec-validation yes; dnssec-lookaside auto; / * Path to ISC DLV key * / bindkeys-file "/ etc / named.iscdlv.key"; }; logging { channel default_debug { file "data / named.run"; severity dynamic; }; };

# Change the following line from all view "internal" { match-clients { localhost; 10.0.0.0/24; }; zone "." IN { type hint; file "named.ca"; }; zone "server.world" IN { type master; file "server.world.lan"; allow-update {none;}; }; zone "0.0.10.in-addr.arpa" IN { type master; file "0.0.10.db"; allow-update {none;}; }; include "/ etc/named.rfc1912.zones"; }; view "external" { match-clients {any;}; allow-query {any;}; recursion no; zone "server.world" IN { type master; file "server.world.wan"; allow-update {none;}; }; zone "80.0.16.172.in-addr.arpa" IN { type master; file "80.0.16.172.db"; allow-update {none;}; }; };

# Allow-query ⇒ (specify the internal network, etc.) to allow range queries # Allow-transfer ⇒ (range / the place if there is a secondary DNS) range to allow the transfer of information zone # Recursion ⇒ Whether you are allowed to retrieve comeback # View "internal" {~}; ⇒ describes the definition for internal # View "external" {~}; ⇒ describes the definition for the external
# *. *. *. *. Place of in-addr.arpa is about to enter what was to reverse the network address # If the 10.0.0.0/24 # Network Address ⇒ 10.0.0.0 # Range of network ⇒ 10.0.0.0 - 10.0.0.255 # How to specify ⇒ 0.0.10.in-addr.arpa

# If 192.16.0.80/29 # Network Address ⇒ 192.16.0.80 # Range of network ⇒ 192.16.0.80 - 192.16.0.87 # How to specify ⇒ 80.0.16.172.in-addr.arpa

Thursday 7 March 2013

Script to kill Roundcube stuck process !!



Create the new file roundcube.sh and insert the following code.

#!/bin/sh
for ROUNDCUBE in `ps aux | grep roundcube | awk -F ” ” ‘{print $10}’ | awk -F “:” ‘{print $1}’`;
do
if [ $ROUNDCUBE -ge 20 ]; then
pkill -u cpanelroundcube
echo “kill roundcube process roundcube”;
fi
done
You can add the cron job to run the above script after a specific time period, if you are facing the roundcube cpu usage issue continuously.Add following line under the crontab by using the crontab -e, it will run the cron after every 10 minutes.
*/10 * * * * sh /root/roundcube.sh;

How to use cgi script to check the Server uptime .

The following script you can use to check the Server uptime?
root@admin[/usr/local/apache/cgi-bin]# nano loads
#!/bin/bash

echo Content-type: text/plain
echo

echo $(hostname)
echo “=>”
echo $(uptime)