Showing posts with label Kloxo. Show all posts
Showing posts with label Kloxo. Show all posts

Kloxo - upgrade PHP version to 5.3


Upgrade PHP version to 5.3


You can follow the steps shown below to upgrade your php version to 5.3 in Kloxo.

Download and install repository of PHP 5.3

# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-10.ius.el5.noarch.rpm
# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -i epel-release-5-4.noarch.rpm
# rpm -i ius-release-1.0-10.ius.el5.noarch.rpm

Remove current PHP version from server.

# yum -y remove php php-common

Install New PHP version

# yum -y install php53u php53u-cli php53u-devel php53u-gd php53u-imap php53u-mbstring php53u-mysql php53u-pdo php53u-pear php53u-xml

Create a php.ini template for php5.3

# cp /usr/local/lxlabs/kloxo/file/phpini/php.ini.template-5.2 /usr/local/lxlabs/kloxo/file/phpini/php.ini.template-5.3
# chown -R lxlabs:lxlabs /usr/local/lxlabs/kloxo/file/phpini/php.ini.template-5.3


Then you  have to edit some Kloxo code to detects PHP's version.

Open the file '/usr/local/lxlabs/kloxo/httpdocs/htmllib/lib/lib.php' in any editor like nano or vi,

then change the following code from,

==========================================
function find_php_version()
{
        global $global_dontlogshell;
        $global_dontlogshell = true;
        $ret = lxshell_output("rpm", "-q", "php");
        $ver =  substr($ret, strlen("php-"), 3);
        $global_dontlogshell = false;
        return $ver;
}

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

to

===========================================
function find_php_version()
{
        global $global_dontlogshell;
        $global_dontlogshell = true;
        //Can't use lxshell_output because of the STDERR
        $ret = shell_exec('php -r \'echo phpversion();\' 2>nul');
        $ver =  substr($ret, 0, 3);
        $global_dontlogshell = false;
        return $ver;
}

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

Verify the new PHP version.

[root@mserver ~]# php -v
Cannot load Zend Extension Manager - it was built with configuration 1.2.0, whereas running engine is API220090626,NTS
PHP 5.3.23 (cli) (built: Mar 15 2013 10:46:06)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with the ionCube PHP Loader v4.0.14, Copyright (c) 2002-2011, by ionCube Ltd.


That's it....

FTP service is not working/listening in Kloxo Server


In Kloxo ftp is running in xinetd. So first of all check this service is listening in port 21.

[root@server ~]# netstat -plant | grep xinetd      
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      3941/xinetd


Make sure the xinetd service is running in startup
[root@server ~]# chkconfig --list | grep xinetd
xinetd         0:off 1:off 2:off 3:off 4:off 5:off 6:off


If it is not running in startup, issue the following command.

[root@server ~]# chkconfig xinetd on
[root@server ~]# chkconfig --list | grep xinetd
xinetd         0:off 1:off 2:on 3:on 4:on 5:on 6:off


Restarting xinetd service will not help to restart ftp service. You have to follow the steps shown below to fix the ftp problems.

1. Login to Kloxo as Admin user.
2. Web - Mail - Database >> FTP Config


3. Just click the 'Update' button and check again.

[root@server ~]# netstat -plant | grep xinetd
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      3941/xinetd        
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      3941/xinetd

Thats it..

Kloxo - Change umask of Directories/Files Created via FTP


Change umask of Directories/Files Created via FTP 



As per the default umask settings all the directories created have 755 permission, umask:022.
As per the default umask settings all the files created have 644 permission, umask:133.


If you really want to change the umask of Directories/Files Created via FTP, you have to follow the steps shown below.

By default Kloxo is using pureftp as ftp  server and xinetd as daemon to start the ftp  service.

In kloxo pureftp service configuration file is located in /etc/xinetd.d/

==============================================================================================
# cat /etc/xinetd.d/pureftp

service ftp                                                                        
{                                                                                  
disable = no                                                                
socket_type     = stream                                                    
wait            = no                                                        
user            = root                                                      
server          = /usr/sbin/pure-ftpd                                
server_args     = -A -c5000 -C8 -D -fftp  -H -I15 -lpuredb:/etc/pure-ftpd/pureftpd.pdb -lunix -L2000:8 -m4 -s -p30000:50000 -U133:022 -u100 -Oclf:/var/log/kloxo/pureftpd.log -g/var/run/pure-ftpd.pid -k99 -Z -Y 1
groups          = yes                                                      
flags           = REUSE                                                    
}                                    

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

You have to change the values in the following line of the configuration.

server_args     = -A -c5000 -C8 -D -fftp  -H -I15 -lpuredb:/etc/pure-ftpd/pureftpd.pdb -lunix -L2000:8 -m4 -s -p30000:50000 -U133:022 -u100 -Oclf:/var/log/kloxo/pureftpd.log -g/var/run/pure-ftpd.pid -k99 -Z -Y 1

UMASK ---> -U133:022
              |   |
              |   |---->Directory's UMASK
              |--------> Files's UMASK


If you want to set direcory's permission to 777 and files's permssion to 666, the chnages will be as like follows.

server_args     = -A -c5000 -C8 -D -fftp  -H -I15 -lpuredb:/etc/pure-ftpd/pureftpd.pdb -lunix -L2000:8 -m4 -s -p30000:50000 -U111:000 -u100 -Oclf:/var/log/kloxo/pureftpd.log -g/var/run/pure-ftpd.pid -k99 -Z -Y 1


Verify the result by creating a directory using FTP.

Note:

If there isn't any changes in permissions after you doing the above steps, you may need the following too.

Change the following line in /etc/pure-ftpd/pure-ftpd.conf file.


Umask                       133:022

That's it...

OpenVZ - Operation not permitted on changing date



Error:

When you try to set date in a OpenVZ container, it may show Operation not permitted error.


Reason:

The capability for setting time is not given for the container.
sys_time capability mustbe enabled for the container to set the date and time.


Solution:

1. Login to OpenVZ Hardware Node as root user.

2. [root@HN ~] # vzlist -a | grep <IP of VPS>
                  <VPSID>         59  running   <IP>  server.example.com

3. [root@HN ~] # vzctl stop <VPSID>

4. [root@HN ~] # vzctl set <VPSID> --capability sys_time:on --save

5. [root@HN ~] # vzctl start <VPSID>


Now the capability parameter for changing time is given for the container.
Try again changing the date. This time it will permit you to change the date and time.

Reference:
http://wiki.openvz.org/Man/vzctl.8#Capability_option

Kloxo Installation


Kloxo Installation:

A dedicated or virtual server running CentOS or Red Hat EL 5.x. CentOS 6.x is not currently supported.
Also, make sure the ports 7778/tcp and 7777/tcp are open in your server firewall or you won't be able to connect to Kloxo web panel when the install completes.


If you have enabled SELinux, you must disable it before installation.

1. Login as root user in the server.

2. root@server [~]# setenforce 0

Kloxo installation consists of downloading kloxo-installer.sh from download.lxcenter.org and executing it as root. The script will present you with a few questions and sometimes ask for a password (enter your root password).

If you don't have MySQL server already installed,

3. root@server [~]# wget http://download.lxcenter.org/download/kloxo/production/kloxo-installer.sh

4. root@server [~]# sh ./kloxo-installer.sh --type=master


If you already have MySQL installed and set a root password,

3. root@server [~]# wget http://download.lxcenter.org/download/kloxo/production/kloxo-installer.sh

4. root@server [~]# sh ./kloxo-installer.sh --type=master --db-rootpassword=PASSWORD


You can use the URL given below to access Kloxo.

http://<Server IP or Domain>:7778
username: admin
password: admin

Reference:-


Kloxo - How to Open an Additional Port For Mail (587)



Check Whether a Server Listen on a Port


 # telnet <IP or Domain> 587
     Trying xxx.xxx.xxx.xxx...
     telnet: Unable to connect to remote host: Connection refused


If you are getting the above response, that particular port is not listening in the server.

To Open Port For Sending Mail

Kloxo by default has Qmail as mail service..
There will not be any affect when you open a port using Iptables.

You have to open a port as like follows in a Kloxo-Qmail server.


1. Login to Kloxo as Admin user.
2. Web - Mail -Database >> Server Mail Settings
3. You can see "Additional Smtp Port" under Server Mail Settings.
4. Enter the new port number there and click 'Update' button.


You can verify whether the port is open or not by the following command.

root@localhost [~]# telnet example.com 587
                  Trying xxx.xxx.xxx.xxx...
                  Connected to example.com.
                  Escape character is '^]'.
                  220-server.example.com ESMTP Exim 4.80 #2 Fri, 12 Oct 2012 08:55:12 -0700
                  220-We do not authorize the use of this system to transport unsolicited,
                  220 and/or bulk e-mail.




You can use the following command to check all the LISTEN ports in the server.
Login to the server, then issue the following command

root@server [~]# netstat -ntul
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address        Foreign Address   State    
tcp        0      0 0.0.0.0:22                    0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:7778                0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:995                  0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:2087                0.0.0.0:*                   LISTEN  
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:587                  0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:110                  0.0.0.0:*                   LISTEN    
tcp        0      0 127.0.0.1:783              0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:143                  0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:1167                0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:2095                0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:80                    0.0.0.0:*                   LISTEN    
tcp        0      0 0.0.0.0:21                    0.0.0.0:*                   LISTEN    


root@server [~]# netstat -ntul | grep 587
tcp        0      0 0.0.0.0:587             0.0.0.0:*           LISTEN    
tcp        0      0 :::587                      :::*                    LISTEN



Kloxo Brute Force Protection




As like cPHulk Brute Force Protection in cPanel, Kloxo has also a Brute Force Protection named Lxguard.


Error Log of FTP access at the time of Block

libwrap refused connection to ftp (libwrap=pure-ftpd) from xx.xx.xx.xx
FAIL: ftp libwrap from=xx.xx.xx.xx


You can check the IP block as follows.

1.  Login as admin user in Kloxo.

2. Security >> Lxguard >> Connections >>

3. You can see a search bar there. You can search for the IP xx.xx.xx.xx  there.

4. You can select the IP by marking it and you can enter the button Remove to remove the IP block.

There is also an option for a whitelist the IP.

How to change main domain name of KLOXO?



There is no direct option to change main domain in KLOXO.

But you can change main domain, if you can add more than one domain (not parked domain) in a user account. ie,the quota limit of domain in the user account must be more than one.

Let, you have to change your main domain from 'maindomain.com' to 'newmaindomain.com'

1.Login to the user account, then select
   >>Home>>Resources>>Add Domain 

2. Add the domain 'newmaindomain.com'
    You can't add a new domain if the domain quota of the user is 1.

3.Goto,
   >>Home>Resources>> Default Domain
    You can change your default domain from maindomain.com to newmaindomain.com

4.Now you have to login to backend of the server and copy all the contents of  maindomain.com directory to newmaindomain.com directory. Don't forget to check the domain's document root before copying files. If the document root is pointing to the same directory, no need to copy the files.

OpenVZ - Change Disk Quota

To check if your VE ran out of its disk quota, use the following commands (inside a VPS).

# df
   -To show disk space usage

# df -i
   -To show the inodes usage

If one of the commands give you usage of 100%, that means you hit one of the disk quota limit. You can increase the limit from the host system (Hardware Node) only.

To change the current Disk Quota,

1.Login to Hardware Node,

# vzquota stat <VPSID>
   -To  get the current values for disk quota. The result will be as shown in the figure.


2. To increase the disk space quota, use vzctl set --diskspace

# vzctl set <VPSID> --diskspace  $(( 1048576*3 )):$(( 1153434*3 )) --save
   -To increase quota by a factor 3

3. To increase the disk inodes quota, use vzctl set --diskinodes.


# vzctl set <VPSID> --diskinodes $(( 200000*4 )):$(( 220000*4 )) --save 
   -To increase quota by a factor 4

# vzctl exec <VPSID> df -i
   -To check whether the changes affected or not.

OpenVZ- UBC Parameters

UBC Parameters:

                     UBC, or User BeanCounters is a set of limits and guarantees controlled per Virtual Environment. UBC is the major component of OpenVZ resource management.


 The figure shows the UBC parameters of a VPS.
Enter in to VPS and run the following command.

# cat /proc/user_beancounters
   -To show the UBC parameters of a VPS.

                   You can see if you hit the limits for some UBC parameters by analyzing the last column (named failcnt). It shows a number of fails for this counter, i.e. a number of times a parameter hit the limit. Usually what you need to do is to increase the parameter. But you need to do it carefully.


If you want to increase kmemsize,

1. Get the current values for the parameter's barrier and limit
    Let, kmemsize barrier is 'x', and its limit is 'y'.

2. Increase the values. Say, we want to increase kmemsize by 2 times.

   # vzctl set <VPSID> --kmemsize $((x*2)):$((y*2)) --save 
    The above command doubled the parameter using bash arithmetic.

By using --save flag, we denote we want to both apply the new settings to the running VE, and save them in the configuration file (from which they will be taken during next VE start).

3. Check the new configuration.

# vzcfgvalidate /etc/vz/conf/<VPSID>.conf 


Note:-You can change the other parameters as like 'kmemsize'.
 

OpenVZ- Create a Container

To create a container, you have to
-Choose the container ID
-Choose the OS template to use for the Container

Choose a container id greater than 100. CTID 0-100 are reserver.

# vzlist -a
    -To list all the containers in the Hardware Node. You can choose a ID other than in the list.

# ls /vz/template/cache/
   centos-5-x86_64.tar.gz
   fedora-7-x86_64.tar.gz
   suse-10.3-x86_64.tar.gz
  
   -To list all the OS templates in the Hardware Node.

               After the Container ID and the installed OS template have been chosen, you can create the Container private area with the vzctl create command. The private area is the directory containing the actual files of the given Container; it is usually residing in /vz/private/CTID/. The private area is mounted to the /vz/root/CTID directory on the Hardware Node and provides Container users with a complete Linux file system tree.

              The vzctl create command requires only the Container ID and the name of the OS template as arguments; however, in order to avoid setting all the Container resource control parameters after creating the private area, you can specify a sample configuration to be used for your new Container. The sample configuration files are residing in the /etc/vz/conf directory and have names with the following mask: ve-configname.conf-sample. The most commonly used sample is the ve-basic.conf-sample file; this sample file has resource control parameters suitable for most Containers.


# vzctl create <CTID>  --ostemplate centos-5-x86 -–config basic

            If you specify neither an OS template nor a sample configuration, vzctl will try to take the corresponding values from the global OpenVZ configuration file (/etc/vz/vz.conf).

Now the VPS is created. We can now configure the VPS with the start-up and network parameters.

OpenVZ- Concept of Container, Hardware Node and CT0

Container:-

    A container (otherwise known as CT, Virtual Environment (VE), Virtual Private Server (VPS) etc.) is one of the main concepts of OpenVZ.
    Container is an isolated entity which performs and executes exactly like a stand-alone server. Container can be rebooted independently and have root access, users/groups, IP address(es), memory, processes, files, applications, system libraries and configuration files.

    OpenVZ allows to have multiple CTs on a single Hardware Node. Every container has a ConTainer's IDentifer (CTID) which is used to manage the container.
     The OpenVZ software reserves the IDs ranging from 0 to 100. Though OpenVZ uses only ID 0, future versions might use additional Container IDs for internal needs. Do not create Containers with IDs below 101.

Hardware Node:-

    Hardware Node (otherwise known as host system) is a term used in OpenVZ. Basically it means the physical server on which OpenVZ is installed and running. Sometimes Hardware Node is abbreviated as HW or HN.

CT0:-

    In OpenVZ, you have multiple CTs, as well as the host system  itself, which is otherwise known as CT0 or VE0. In other words, CT0 means the server itself. From CT0, we can use vzctl and other tools to manage containers. From CT0, all the containers' processes, files, etc. are accessible. From CT0, we manage the hardware, install a new kernel, etc.
CT0 - Container Zero
Container ID Zero is given to the Hardware Node itself.

What is OpenVZ?

OpenVZ
     
     OpenVZ (Open VirtualiZation) is an operating system-level virtualization technology based on the Linux kernel and operating system. OpenVZ allows a physical server to run multiple isolated operating system instances, known as containers, Virtual Private Servers (VPSs).OpenVZ is limited in that it requires both the host and guest OS to be Linux.

    OpenVZ is a virtualisation technology that was developed by Parallels, and is the basis for their Virtuozzo platform. OpenVZ consists of the open sourced parts of Virtuozzo.

    OpenVZ works somewhat like Solaris Zones or FreeBSD jails, in the aspect that it utilizes a single operating system kernel and creates various user-environments within the single operating system space. The various user-environments are called Virtual Environments, of VE.

    Users in a VE will have their own view on the available resources in the system. They are only able to see and interact with processes running in the same VE, they only have access to files and diskspace assigned to the VE and can only see network-traffic destined to the IP address assigned to the VE.

Advantages
    Due to the fact that OpenVZ uses a single operating system kernel to provide various Virtual Environments the overhead of OpenVZ is very low. No memory is wasted by loading copies of the kernel for every VE, no translation is needed for I/O going to the storage or network.This allows for very lightweight VE’s, with some environments taking less then 8MB of memory and only a few megabytes of diskspace.

    Another advantage of OpenVZ is that it doesn’t require any hardware-assisted virtualisation on the system and it doesn’t need to ‘emulate’ any cpu or I/O instructions, which would put a large strain on the resources.
     Your files and processes are visible on the host-system, but hidden from other users of the system. Only the root-user on the host can access your resources. This access is also used to make backups of all your files, so System Administers can help you with a restore in case you accidentally erase some files.

     It is possible to mount iso images and use sshfs systems using fuse, but kernel-mode mounting is not available.

DisAdvantages
    A disadvantage of the OpenVZ VE’s is that only Linux environments are possible, since the kernel is shared between all environments it’s not possible for a VE to make modifications to the kernel. It’s also not allowed for the VE’s to change their IP-configuration, to act as NFS servers or to mount filesystems, as this would have an impact on the host’s security system.

Note:- You can refer the following links to know more about OpenVZ
http://sudosu.in/search?q=openvz#!/2012/07/openvz-concept-of-container-hardware.html
http://sudosu.in/search?q=openvz#!/2012/07/openvz-create-container.html
http://sudosu.in/search?q=openvz#!/2012/07/openvz-frequently-used-commands.html
http://sudosu.in/search?q=openvz#!/2012/07/openvz-ubc.html
http://sudosu.in/search?q=openvz#!/2012/07/openvz-change-disk-quota.html