Saturday, November 28, 2009

Enable Quota in VPS ( openvz )

If you are experiencing an issue with OpenVZ VPS disk quota, please make sure that the following values are set in the VPS conf.


VPS conf Location : /etc/vz/conf/VEId.conf


In the main node, do the following steps.


1) #grep DISK_QUOTA /etc/vz/conf/VEId.conf


If no disk quota value has found ot it is disabled, change the value to


DISK_QUOTA=yes


2) Check that disk quota is enabled in the main server itself.


grep DISK_QUOTA /etc/sysconfig/vz


If not enable the value to yes in the conf.


DISK_QUOTA=yes


3) Check for the value quotaugidlimit .


#grep -i quotaugidlimit /etc/vz/conf/veid.conf




4) Check the quota module "vzdquota" is loaded or notin main node.


# lsmod |grep -i vzdquota


5) You can set the value quotaugidlimit from the main node using the below command.


vzctl set veid –quotaugidlimit 500 –save


6) Make sure to reboot the mentioned node from the main node.


vzctl restart veid


7) Enter the the node for which you are experiencing the problem.


vzctl enter veid


Type the command 'mount'. It should give a similar output.


# mount
/dev/simfs on / type reiserfs (rw,usrquota,grpquota)
/proc on /proc type proc (rw)
/sys on /sys type sysfs (rw)
none on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)


Also make sure that symbolic links are existing from aquota.group and aquota.user to their respectve physical locations.




# ll
total 64
lrwxrwxrwx 1 root root 39 Oct 19 11:41 aquota.group -> /proc/vz/vzaquota/00000030/aquota.group
lrwxrwxrwx 1 root root 38 Oct 19 11:41 aquota.user -> /proc/vz/vzaquota/00000030/aquota.user

Sunday, November 22, 2009

Create VPS nodes in OpenVZ

Steps for creating nodes in OpenVZ.

1. First of all check if the templates are available. Go to the vz cache directory

[root@server ~]# cd /vz/template/cache

[root@server cache]# pwd
/vz/template/cache
[root@server cache]# ll
total 1356612
-rw-r--r-- 1 root  root  158160318 Jul 10  2010 centos-4-x86.tar.gz
-rw-r--r-- 1 root  root  158609159 Sep 14 16:11 centos-4-x86.tar.gz.1
-rw-r--r-- 1 root  root  130092151 May 13  2008 centos-5-i386-default.tar.gz
-rw-r--r-- 1 root  root  191595463 Sep 14 16:16 centos-5-x86_64.tar.gz
-rw-r--r-- 1 root  root  180022352 Apr 26  2010 centos-5-x86.tar.gz
-rw-r--r-- 1 root  root  212917989 Sep 14 16:25 centos-6-x86_64.tar.gz
-rw-r--r-- 1 root  root  117087334 Nov 12  2010 debian-4.0-x86.tar.gz
[root@server cache]#
[root@server cache]#

if you do not have any templates you can download the precreated templates from the openvz website

http://wiki.openvz.org/Download/template/precreated

Once downloaded follow the steps below to create the nodes.


[root@server ~]# vzctl create 101 --ostemplate centos-5-i386-default --config vps.basic
[root@server ~]# vzctl set 101 --onboot yes --save
[root@server ~]# vzctl set 101 --hostname training.server.com --save
[root@server ~]# vzctl set 101 --ipadd 192.168.0.101 --save
[root@server ~]# vzctl set 101 --nameserver 4.2.2.2 --save
[root@server ~]# vzctl start 101
[root@server ~]# vzctl exec 101 /etc/init.d/sshd start
[root@server ~]# vzctl exec 101 passwd

Hope this helps!

cpDav service failed : Solution

There have been a number of tickets (and a few forum posts), regarding emails for the perl modules Net::DAV::Server and XML::LibXML not being installed properly.

It turns out this is an issue with the libxml2 package (not the perl module) on 64-bit CentOS systems.

Anyone encountering this, here is the fix (from the cPanel 11 release notes):

CODE
Issue: Conflicting libxml installs cause cpdavd (Web Disk Server) to fail. 64 bit linux only
Symptoms: cpdavd won’t start, running /usr/local/cpanel/bin/checkperlmodules shows that XML::libXML will not install and Net::DAV::Server will not install

Solution: Run https://your.IP.here:2087/scripts2/autofixer and enter libxml64fix.


This fix downloads the libxml2 source code and compiles the newest versions. The yum package manage apparently doens't have the latest version for CentOS in their repository, I guess.

Here's a relevent Cpanel forums topic:
http://forums.cpanel...ead.php?t=67047

cPanel Logs

Applications can log the system activity in two ways, one being according to their autonomous logic & the other through the system’s log daemon, well know as syslog..

The syslog daemon’s configuration file /etc/syslog.conf contains all the necessary paths/locations as to where the logs are stored.

Usually the directory /var/log/ is used for the system logs but other applications use the applications specified directories to store their log files…
Many distributions provide tools to manage and analyze the system logs.

Logrotate is a well known log rotation tool which usually is configured in the /etc/logrotate.conf file.
It may also have additional package-defined configurations in the /etc/logrotate.d/ directory..
In order to understand what’s happening on the system a brief analysis of /etc/syslog.conf is mandatory for checking the main logs positions.

Here are some basic log files, their locations & a brief description which can be found in Linux distros [mostly in cPanel ]:
General:

Quote:
cPanel/WHM Initial Installation Errors:
Location : /var/log/cpanel*install*
Description : These log files contain cPanel installation logs & should be referenced first for any issues resulting from new cPanel installations..
Quote:
Cpanel/WHM Service Status Logs:
Location : /var/log/chkservd.log
Description :The service monitoring demon (chkservd) logs all service checks here. Failed service are represented with a [-] and active services are represented by [+].
Quote:
Cpanel/WHM Accounting Logs:
Location : /var/cpanel/accounting.log
Description : Contains a list of accounting functions performed through WHM, including account removal and creation..

cPanel/WHM Specific Requests and Errors:

Quote:
cPanel error logs:
Location : /usr/local/cpanel/logs/error_log
Description : cPanel logs any error it incurs here. This should be checked when you encounter errors or strange behavior in cPanel/WHM…
Quote:
cPanel License Error Logs:
Location : /usr/local/cpanel/logs/license_log
Description : All license update attempts are logged here. If you run into any errors related to license when logging in, check here.
Quote:
Stats Daemon Logs:
Location : /usr/local/cpanel/logs/stats_log
Description : The stats daemon (cpanellogd) logs the output from all stats generators (Awstats, Webalizer, Analog) here.
Quote:
Client Information, Requested URL Logs:
Location : /usr/local/cpanel/logs/access_log
Description : General information related to access cPanel requests is logged here.
Quote:
cPanel/WHM Update Logs:
Location : /var/cpanel/updatelogs/update-[TIMESTAMP].log
Description : Contains all output from each cPanel update [upcp]. It’s named with the timestamp at which the upcp process was initiated..
Quote:
Bandwidth Logs:
Location : /var/cpanel/bandwidth
Description : Files contain a list of the bandwidth history for each account. Each named after their respective user.
Quote:
Tailwatchd [New]:
Location : /usr/local/cpanel/logs/tailwatchd_log
Description : Logs for daemon configuired under tailwatchd ie. cPBandwd, Eximstats, Antirelayd.

Apache Logs:

Quote:
General Error and Auditing Logs:
Location : /usr/local/apache/logs/error_log
Description : All exceptions caught by httpd along with standard error output from CGI applications are logged here..
The first place you should look when httpd crashes or you incur errors when accessing website.
Quote:
Apache SuExec Logs:
Location : /usr/local/apache/logs/suexec_log
Description : Auditing information reported by suexec each time a CGI application is executed. Useful for debugging internal server errors, with no relevant information being reported to the Apache error_log, check here for potential suexec policy violations…
Quote:
Domain Access Logs:
Location : /usr/local/apache/domlogs/domain.com
Description : General access log file for each domain configured with cPanel.
Quote:
Apache Access Logs:
Location : /usr/local/apache/logs/access_log
Description : Complete web server access log records all requests processed by the server.
Exim :

Quote:
Message Reception and Delivery:
Location : /var/log/exim_mainlog or /var/log/exim/mainlog
Description : Receives an entry every time a message is received or delivered.
Quote:
Exim ACLs/Policies based RejectLog :
Location : /var/log/exim_rejectlog
Description : An entry is written to this log every time a message is rejected based on either ACLs or other policies eg: aliases configured to :fail
Quote:
Unexpected or Fatal Errors:
Location : /var/log/exim_paniclog
Description : Logs any entries exim doesn’t know how to handle. It’s generally a really bad thing when log entries are being written here, and they should be properly investigated..
Quote:
IMAP/POP/SpamAssassin General Logging and Errors:
Location : /var/log/maillog & /var/log/messages
Description : The IMAP, POP, and SpamAssassin services all log here. This includes all general logging information (login attempts, transactions, spam scoring), along with fatal errors.

FTP:

Quote:
FTP Logins and General Errors:
Location : /var/log/messages
Description : General information and login attempts are logged here..
Quote:
FTP Transactions logging:
Location : /var/log/xferlog or /var/log/messages
Description : Is a symbolic link in most cases to /usr/local/apache/domlogs/ftpxferlog, which contains a history of the transactions made by FTP users…

MySQL:

Quote:
MySQL General Information and Errors :
Location : /var/lib/mysql/$(hostname).err
Description : This path could vary, but is generally located in /var/lib/mysql. Could also be located at /var/log/mysqld.log

Security:

Quote:
Authentication attempts:
Location : /var/log/secure
Description : Logs all daemons which requires PAM Authentication.
Quote:
Tracking all Bad Logins and Logouts:
Location : /var/log/btmp
Description : Log of all attempted bad logins to the system. Accessed via the lastb command..
Quote:
Tracking all Logins and Logouts:
Location : /var/log/wtmp
Description : The wtmp file records all logins and logouts.
Quote:
Last Logins:
Location : /var/log/lastlog
Description : Database times of previous user logins. The lastlog file is a database which contains info on the last login of each user.
Quote:
WebDav or WebDisk Log :
Location : /usr/local/cpanel/logs/cpdavd_error_log
Description : The cpdavd daemon is “WebDav” (better known as “WebDisk”) which was introduced in cPanel 11 to allow users to mount their home directory on their personal computer, always having access to the files and content…
Quote:
Cphulkd Logs:
Location : /usr/local/cpanel/logs/cphulkd_errors.log
Description : cPHulk Brute Force Protection prevents malicious forces from trying to access your server’s services by guessing the login password for that service….
It blacklists IPs that it thinks are trying to run a brute force attack.
Quote:
Failure Logging:
Location : /var/log/faillog
Description : Faillog formats the contents of the failure log from /var/log/faillog database. It also can be used for maintains failure counters and limits. Run faillog without arguments display only list of user faillog records who have ever had a login failure.
Quote:
Startup/Boot, Kernel & Hardware error messages :
Location : /var/log/dmesg
Description : dmesg is a “window” into the kernels ring-buffer. It’s a message buffer of the kernel. The content of this file is referred to by the dmesg command. It shows bootlog and the hardware errors..

Saturday, November 7, 2009

How to change your Exim outgoing mail IP, A Quick setup



1. Open the file /etc/mailips


[root@server ~]# vi /etc/mailips


enter the following and save the file

*: IP 

example:  *: 192.168.0.10

assuming 192.168.0.10 is your secondary IP.

IP - the IP you wish to send emails from. The * symbol specifies all domains to send emails from this IP

2. Now edit /etc/mail_reverse_dns

Enter the reverse DNS aka rDNS for the above IP and save the file

IP rdns

Example: 192.168.0.10 server.mail.com

3. Now change the attributes to immutable

[root@server ~]#  chattr +i  /etc/mail_reverse_dns
[root@server ~]#  chattr +i  /etc/mailips


4. Restart exim and thats it!


[root@server ~]# /etc/init.d/exim restart


Send a test email as root and check the headers to confirm.




Hope this helps :)