Wednesday, January 27, 2010

Testing Load Performance of MTA [eg:Sendmail Vs Postfix]

Philosophy : To compare the performance under heavy load on the MTA[Mail Transferring Agent]s.
Test method : Comparing by trying to send 1000 mails at instant by using a script and monitoring the load during the time.
Testing Steps:
1 ) Prepare a script to send out mails at large number,say 1000.

Script[loadtester.sh] :

#!/bin/bash
# script to send simple email
# email subject
SUBJECT="SET-EMAIL-SUBJECT"
# Email To ?
EMAIL="test@scalix.poornam.com"
# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "This is an email message test"> $EMAILMESSAGE
echo "This is email text" >>$EMAILMESSAGE
# send an email using /bin/mail,in this case 1000
for((i=0;i<1000 i="" span="">
do

/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE;
done

Next Step : chmod a+x loadtester
Explanation : This script will send 1000 mails using the MTA in the system.

2) We need to monitor load in the system while sending messages.

Script [loadmonitor.sh] :

#!/bin/bash
while true
do
date >> /tmp/load.txt;
/usr/bin/w >> /tmp/load.txt&
pid=$!
sleep 20
kill -SIGKILL $pid
done

Next Step: chmod a+x loadmonitor
cp -p loadmonitor /usrr/local/bin/
Explanation: Monitor the load in the system using 'w' command and append the result to 'load.txt' for reference.

3) Configure cron to run every seconds so that delay configured at load monitoring script execute load checking at interval of 20 seconds.

Adding cron entry: crontab -e
Append the line below to the file shown in the default editor in the system

* * * * * /usr/local/bin/loadmonitor

You can change the MTAs and run script to find out the load using different agents. Don't forget to attach the Antivirus/Spamassasin/Mailman and other dependent softwares which also affect the performance of MTAs.

Monday, January 25, 2010

Open LDAP and Scalix

LDAP directory services provide a centralized repository for information about users and devices that are authorized to use your network.Scalix stores its information not in the LDAP but in its own special database called"DIRECTORY". Omslapd (Scalix "LDAP" server) is just an interface "translating" LDAP requests to DIRECTORY requests thus providing "standard-based" access to the Scalix directories.The External LDAP and External Active Directory authentication methods attempt to bind to the specified LDAP server, using the supplied user name and password. These method can be used if the email environment uses Microsoft Active Directory directory services for authentication and the Scalix-LDAP directory services for all other Scalix-related transactions. This requires that users exist in both OpenLDAP and in the Active Directory servers.omldapsync utility is to sync scalix directories and your external ldap server.

Some Interesting links on various related topics:
Open LDAP Installation -Common
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.openldap.org/doc/admin22/install.html

Open LDAP User Management
`````````````````````````````````````````````````````````````````````````
http://www.scalix.com/wiki/index.php?title=HowTos/OpenLDAP_User_Management
OpenLDAP Sync
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.scalix.com/wiki/index.php?title=Omldapsync_HowTo_-_One

Open LDAP ---User management via--phpldapadmin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://phpldapadmin.sourceforge.net/wiki/index.php/Main_Page

Configuring Outlook to use LDAP to Connect to Scalix Directory
`````````````````````````````````````````````````````````````````````
http://www.scalix.com/wiki/index.php?title=HowTos/OL2007_LDAP

Saturday, January 23, 2010

How to do that with Yum..

Yum is a software installation package for Redhat/Fedora/Centos. It offers complete solution with option to update/install or remove a software from a linux machine.

Download and Install Yum if it's not there [Its default in Fedora]

Source[gz]
RPM

Adding a new repository to Yum :

Enter the directory : /etc/yum.repos.d
Create the file with the following data customized to match your repository
[foo]
name=Foo for RHEL/ CentOS $releasever - $basearch
baseurl=http://foo.nixcraft.com/centos/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://foo.nixcraft.com/RPM-GPG-KEY.txt

* [foo] : Repository name i.e. The [main] section must exist for yum to do anything.
* name=Foo for RHEL/ CentOS $releasever - $basearch : A human readable string describing the repository name
* baseurl=http://foo.nixcraft.com/centos/$releasever/$basearch/ : Must be a URL to the directory where the yum repository’s ‘repodata’ directory lives
* enabled=1 : Enabled or disabled repo. To disable the repository temporarily, set the enabled to 0
* gpgcheck=1 : Security feature, use GPG key
* gpgkey=http://foo.nixcraft.com/RPM-GPG-KEY.txt : GPL file location

Also you need to import the gpg key for the repository as follows:

rpm --import http://foo.nixcraft.com/RPM-GPG-KEY.txt

Some Yum commands: yum add [software],yum remove [software],yum update,man yum.. :)

Friday, January 22, 2010

Begining Regular Expressions -Part1

A regular expression, usually abbreviated to "regex" or "regexp", describes text patterns. In unix world there are several tools which utilizes the advantage of using in processing text files.
We will begin by using 'grep',which is a pattern matching tool in unlix/linux for regexp operations. We are using POSIX dialect which is different from perl dialect.

Some terms:
Anchors : Anchors are used to specify the position of the pattern in relation to a line of text.[eg:^,$]
Modifiers:Modifiers specify how many times the previous character set is repeated[eg:.,*,#].
------------------------------------------------------------
^A "A" at the beginning of a line
A$ "A" at the end of a line
A^ "A^" anywhere on a line
$A "$A" anywhere on a line
^^ "^" at the beginning of a line
$$ "$" at the end of a line
-------------------------------------------------------------

Some sample outputs are given below:
['#' indicates the executed command and output is shown below]Example file: animals.txt
#cat animals.txt
elephant
tiger
bear
tigress
panda
panther
black panther

# grep panther animals.txt
panther
black panther

# grep -v panther animals.txt
elephant
tiger
bear
tigress
panda

# grep '^e' animals.txt
elephant

#grep 'a$' animals.txt
panda