Sunday, January 11, 2009

Linux: Installing Groundwork Open source Monitor

Groundwork is open source software which integrates some fine tools like Nagios to monitor systems.

We are considering CentOS 5 as a platform to install groundwork here.

While installation also select Databases and web services and disable SeLinux and Firewall.


Groundwork requires various packages to work properly, and the best method to get the packages is from Centos repositories.

We can enable the [CentOSPlus] repo so that MySQL 5 is available.

vi /etc/yum.repos.d/CentOS-Base.repo

find the following lines and change "enabled=0" to "enabled=1".

[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


Now lets have a look how we can install other required softwares.

Execute following commands.

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

yum install fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils ncftp gcc gcc-c++ bison flex byacc nano mysql mysql-devel mysql-server php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel

If you do not find any rpm or package, try to find it on other centos sources or at DAG’s repository.

Do not set Mysql password.

Setup Apache webserver.
chkconfig httpd on
/etc/init.d/httpd start

Setup Mysql DB server.

chkconfig mysqld on
/etc/init.d/mysqld start

Then add .php and .cgi support to Apache.

vi /etc/httpd/conf/httpd.conf

Find the DirectoryIndex directive and change it from:

“DirectoryIndex index.html index.html.var”

To “DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl”

Now, restart Apache to make the changes take effect.

/etc/init.d/httpd restart



Then download the Java JDK from internet


Considering that the jdk-1_5_0_15-linux-i586-rpm.bin file is in /tmp directory, execute following commands.

cd /tmp/
chmod 755 jdk-1_5_0_15-linux-i586-rpm.bin
./jdk-1_5_0_15-linux-i586-rpm.bin

Type “yes” if you are prompted to agree to the license agreement and hit the Enter key.
However you will need to remove older java version to use this new Java.

You can remove it by issuing a command similar to this:

rpm -e java-1.4.2-gcj-compat

Then reboot the system

shutdown -r now

Then integrate java into the default profile of the users.

vi /etc/profile

Add these lines at the bottom of the /etc/profile:

export JAVA_HOME=/usr/java/jdk1.5.0_15

export PATH=$PATH:$JAVA_HOME/bin

Then update the profile by executing.

source /etc/profile

To ensure that Java is working, execute command:

which java

The output should be

/usr/java/jdk1.5.0_15/bin/java
Then create shortcuts for new java.

ln -sf $JAVA_HOME/bin/java /etc/alternatives/java
ln -sf /etc/alternatives/java /usr/bin/java

Now, on execution of "which java", the output should be:

/usr/bin/java


Installing Groundwork Open Source :

Execute following commands to download and install the Groundwork.

mkdir /usr/local/groundwork
cd /usr/local/groundwork
wget http://superb-east.dl.sourceforge.net/sourceforge/gwmos/groundwork-monitor-os-5.1.3-3.rhel5.i386.tar.gz
tar -xvzf groundwork-monitor-os-5.1.3-3.rhel5.i386.tar.gz
rpm -Uvh groundwork-foundation-pro-1.6.1-67.noarch.rpm
rpm -Uvh groundwork-monitor-core-5.1.3-8.rhel5.i386.rpm

If there are no errors, it’s fine. But if you get an error like
“Couldn't connect to localhost:4913: IO::Socket::INET: connect: Connection refused”

Then check the /etc/hosts file and make sure that it is set up properly. This error is there because Apache can’t resolve your host name and not starting up.

If you had to reconfigure your host file, then you will need to issue the following commands before proceeding:

After reconfiguring hosts file issue following commands.

/etc/init.d/httpd restart
rpm -e groundwork-monitor-core-5.1.3-8.rhel5
rpm -Uvh groundwork-monitor-core-5.1.3-8.rhel5.i386.rpm


You can access groundwork using following URL.

http://"IP ADDR of system where Groundwork is installed"


Default user and password is:

Username: admin
Password: admin

Linux: Setting up Multi domain Mail server with Postfix and Dovecot

This article describes how to setup Dovecot pop3/imap server to get the mails from virtual mailboxes to your mail client.


Among the various methods of pop/imap authentication, we will be using text files method. Read the manpagesof dovecot to better understand it.

Following is a sample dovecot.conf file , we’ll not use SSL.

base_dir = /var/run/dovecot/
protocols = imap pop3 imaps pop3s
ssl_disable = yes
log_path = /var/log/dovecot
info_log_path = /var/log/dovecot.info
login_dir = /var/run/dovecot/login
login_chroot = yes
login = imap
login_executable = /usr/lib/dovecot/imap-login
login_user = dovecot
login = pop3
login_executable = /usr/lib/dovecot/pop3-login
verbose_ssl = no
valid_chroot_dirs = /var/spool/vmail
default_mail_env = maildir:/var/spool/vmail/%d/%n
imap_executable = /usr/lib/dovecot/imap
pop3_executable = /usr/lib/dovecot/pop3
auth = default
auth_mechanisms = plain digest-md5
auth_userdb = passwd-file /etc/dovecot/users
auth_passdb = passwd-file /etc/dovecot/passwd
auth_executable = /usr/lib/dovecot/dovecot-auth
auth_user = root
auth_verbose = yes

We are using Dovecot to support imap and pop3.

The default_mail_env line describes the path of the mailbox. Here “%d” means domain and “%n” means username.
Thus maildir for jay@mydomain.com becomes “/var/spool/vmail/mydomain1.com/jay”

Now let’s have a look at how we can authenticate the users.

“auth_mechanisms = plain digest-md5” states that two methods plain and digest-md5 are allowed to use.
“auth_userdb = passwd-file /etc/dovecot/users” stores the username portion while “auth_passdb = passwd-file /etc/dovecot/passwd” stores password for them.

Following is an example format of these files.
Users:

jay@mydomain1.com::900:900::/var/spool/vmail/domain1.com/:/bin/false::


Passwd:

jay@mydomain1.com:put encrypted password here

We are using MD5 hash encrypted password here. You can use “mkpasswd” command to generate the MD5 password.


This finishes the Virtual Domain setup using postfix and Dovecot.

Friday, January 9, 2009

Misc: GAJINI ........ some questions..

While Aamir Khan's "Gajini" seems to be good as far as technology related to cinema, it has too many flaws in the story.

Some questions arise in mind are..

1) If he has a 15 minutes memory limit, how do he remember the procedures to use the camera? i guess, one with this kind of short term memory, will have to read manual every time before using the camera.

2) Similarly he'll have to learn to operate his cellphone every 15 minutes.

3) How a person with short term memory can live alone ?

4) Why do his manager ignores the mess in his Flat? how the words written on wall remains hidden from his office men?

5) How can police leave him so easily just by referring his medical history? I don't think Mumbai policemen are so ignorant.

still have many questions....

Linux: Setting up Multi domain Mail server with Postfix and Dovecot

Among the different ways to host virtual domains with Postfix, we'll be looking at the one which supports separate domains and virtual accounts. This server will support mail delivery to multiple domains.

First, mention all domains as virtual hosts.

Change the myhostname line in main.cf :

myhostname = localhost

Then add the following virtual domains to main.cf :

virtual_mailbox_domains = /etc/postfix/vhosts.cfg
virtual_mailbox_base = /var/spool/vmail
virtual_mailbox_maps = hash:/etc/postfix/vmaps.cfg
virtual_uid_maps = static:900
virtual_gid_maps = static:900
virtual_alias_maps = hash:/etc/postfix/valias.cfg

First line states a config file called vhosts.cfg. This config file will contain simple list of all the domains. Like:

mydomain1.com
mydomain2.com
myvirtual.net

Second line states a base directory where mails will be stored.

Third line states a file called vmaps.cfg. This is a two column config file. First column tells a virtual email address. Second column tells a mailbox location. On specifying “/” at the end of the location, it becomes Maildir format. Otherwise, it is mbox format by default.

Then build the hash file using following command:

postmap vmaps.cfg

This creates a file “vmaps.cfg.db”. Postfix reads information in hashes faster than a normal config file.

The contents of vmaps.cfg looks like this:

jay@mydomain1.com mydomain1.com/jay/
jay@mydomain2.com mydomain2.com/jay/
vijay@myvirtual.net virtual.net/vijay/


The absolute path of the virtual mailbox for jay@mydomain1.com is /var/spool/vmail/mydomain1.com/jay/. But, first you should make the directories mydomain1.com and jay. As the mailbox is in maildir format, it needs 3 subdirectories under this mailbox: new, cur, tmp. Just execute following command inside “/var/spool/vmail/mydomain1.com/jay/“

mkdir new cur tmp
chmod 700 new cur tmp

Fourth and Fifth lines define an account to be set up that will posses permissions to access all the mailboxes. The username for this account is ‘virtual’ and it's uid and gid should be “900”.

Sixth line specifies a config file where aliases for virtual accounts can be set.
Add lines like following in this config file:

jay@mydomain1.com jay@indiatimes.co.in

Then execute “postmap valias.cfg” to build a hash file.

At the end, an ownership to the mailboxes should be granted to the ‘virtual’ user. Running this will take care of it:

chown virtual:virtual /var/spool/vmail -Rf

Then execute the command "postfix reload".

In the Next section, we will see how we can configure a Pop3 / Imap server for above virtual domains.

Thursday, January 8, 2009

Tech: Release of New Windows 7 and people started finding annoyances

While Microsoft is happy releasing their new kid “Windows 7″ (story on CNN) , people found annoyances in the latest version.

As stated on Znet technology news, the author have found six annoyances…………… below is the link

http://blogs.zdnet.com/hardware/?p=3261

Misc: UK’s ‘UFO strike’ Mystery

As stated on CNN, dozens of people saw strange lights in the sky, mysterious flashes and then a missing wind turbine blade and a tabloid splash featuring the pun.

As per CNN, Britain’s tabloid Sun newspaper Thursday proclaimed from its front page that a wind turbine was ruined after a UFO hit one of its 20 meter-long blades in Conisholme, Lincolnshire.

Here is a link

Why don’t we see a single UFO in India, where millions of people seeing the sky every moment…….