Monthly Archives: June 2010

Qmail migration on New Server

>Check out the vpopmail database is created with the proper credential on new system where we are migrating
——————————————————————————–
#First created database
#mysql -uroot -p -e ‘CREATE DATABASE vpopmail’
#mysql -uroot -p -e “GRANT ALL PRIVILEGES ON vpopmail.* TO qmailuser@localhost IDENTIFIED BY ‘password'”;
qmailuser/password is credentials for mysql which is stored on/home/vpopmail/vpopmail.mysql

If table structure is not populated, Please copy the following in italic format and save on .sql file.

Restore the following structure on newly created vpopmail database on new system.
————————————————————————————-
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’NO_AUTO_VALUE_ON_ZERO’ */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


— Table structure for table `dir_control`

DROP TABLE IF EXISTS `dir_control`;
CREATE TABLE `dir_control` (
`domain` char(64) NOT NULL default ”,
`cur_users` int(11) default NULL,
`level_cur` int(11) default NULL,
`level_max` int(11) default NULL,
`level_start0` int(11) default NULL,
`level_start1` int(11) default NULL,
`level_start2` int(11) default NULL,
`level_end0` int(11) default NULL,
`level_end1` int(11) default NULL,
`level_end2` int(11) default NULL,
`level_mod0` int(11) default NULL,
`level_mod1` int(11) default NULL,
`level_mod2` int(11) default NULL,
`level_index0` int(11) default NULL,
`level_index1` int(11) default NULL,
`level_index2` int(11) default NULL,
`the_dir` char(160) default NULL,
PRIMARY KEY (`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


— Table structure for table `lastauth`

DROP TABLE IF EXISTS `lastauth`;
CREATE TABLE `lastauth` (
`user` char(32) NOT NULL default ”,
`domain` char(64) NOT NULL default ”,
`remote_ip` char(18) NOT NULL default ”,
`timestamp` bigint(20) NOT NULL default ‘0’,
PRIMARY KEY (`user`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


— Table structure for table `limits`

DROP TABLE IF EXISTS `limits`;
CREATE TABLE `limits` (
`domain` char(64) NOT NULL default ”,
`maxpopaccounts` int(10) NOT NULL default ‘-1’,
`maxaliases` int(10) NOT NULL default ‘-1’,
`maxforwards` int(10) NOT NULL default ‘-1’,
`maxautoresponders` int(10) NOT NULL default ‘-1’,
`maxmailinglists` int(10) NOT NULL default ‘-1’,
`diskquota` int(12) NOT NULL default ‘0’,
`maxmsgcount` int(12) NOT NULL default ‘0’,
`defaultquota` int(12) NOT NULL default ‘0’,
`defaultmaxmsgcount` int(12) NOT NULL default ‘0’,
`disable_pop` tinyint(1) NOT NULL default ‘0’,
`disable_imap` tinyint(1) NOT NULL default ‘0’,
`disable_dialup` tinyint(1) NOT NULL default ‘0’,
`disable_passwordchanging` tinyint(1) NOT NULL default ‘0’,
`disable_webmail` tinyint(1) NOT NULL default ‘0’,
`disable_relay` tinyint(1) NOT NULL default ‘0’,
`disable_smtp` tinyint(1) NOT NULL default ‘0’,
`perm_account` tinyint(2) NOT NULL default ‘0’,
`perm_alias` tinyint(2) NOT NULL default ‘0’,
`perm_forward` tinyint(2) NOT NULL default ‘0’,
`perm_autoresponder` tinyint(2) NOT NULL default ‘0’,
`perm_maillist` tinyint(4) NOT NULL default ‘0’,
`perm_quota` tinyint(2) NOT NULL default ‘0’,
`perm_defaultquota` tinyint(2) NOT NULL default ‘0’,
PRIMARY KEY (`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


— Table structure for table `valias`

DROP TABLE IF EXISTS `valias`;
CREATE TABLE `valias` (
`alias` varchar(32) NOT NULL default ”,
`domain` varchar(64) NOT NULL default ”,
`valias_line` text NOT NULL,
KEY `alias` (`alias`,`domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


— Table structure for table `vlog`

DROP TABLE IF EXISTS `vlog`;
CREATE TABLE `vlog` (
`id` bigint(20) NOT NULL auto_increment,
`user` varchar(32) default NULL,
`passwd` varchar(32) default NULL,
`domain` varchar(64) default NULL,
`logon` varchar(200) default NULL,
`remoteip` varchar(18) default NULL,
`message` varchar(255) default NULL,
`timestamp` bigint(20) NOT NULL default ‘0’,
`error` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `user_idx` (`user`),
KEY `domain_idx` (`domain`),
KEY `remoteip_idx` (`remoteip`),
KEY `error_idx` (`error`),
KEY `message_idx` (`message`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


— Table structure for table `vpopmail`

DROP TABLE IF EXISTS `vpopmail`;
CREATE TABLE `vpopmail` (
`pw_name` char(32) NOT NULL default ”,
`pw_domain` char(64) NOT NULL default ”,
`pw_passwd` char(40) default NULL,
`pw_uid` int(11) default NULL,
`pw_gid` int(11) default NULL,
`pw_gecos` char(48) default NULL,
`pw_dir` char(160) default NULL,
`pw_shell` char(20) default NULL,
`pw_clear_passwd` char(16) default NULL,
PRIMARY KEY (`pw_name`,`pw_domain`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
————————————————————————————-

Install the qmail (Most of the guys know how to install qmail so I am not covering the same on this articles.

Note – Install vpopmail with mysql auth support

Copy the /home/vpopmail backup from existing system to new system. This copies all the virtual domain information and user mail files. Please make sure all the permissions are preserving and translate userid and groupid.

Copy /var/qmail/control/ from the old server to the new server.

Copy /var/qmail/alias/ from the old server to the new server.

Copy /var/qmail/users/ from the old server to the new server.

Delete /var/qmail/users/cdb. Edit /var/qmail/users/assign and change all the userid and groupid numbers to the those that match your new system. They may already be the same, but probably not.

Now I find out the userid and groupid of vpopmail on my new system:
# id -g vpopmail
89
# id -u vpopmail
89

If not matched changed it to 89 on /var/qmail/users/assign file as vpopmail own the same uid and gid on the system

Regenerate the /var/qmail/users/cdb file from the assign file by running qmail-newu:
/var/qmail/bin/qmail-newu
Run qmailctl cdb so that tcpserver can identify /etc/tcp.smtp & /etc/tcp.pop3d
Edit /service/qmail-pop3d/run and replace ‘pop3’ with 110
Edit /service/qmail-pop3d/run and replace hostname like xxx.vmgraduate.com with domain name like vmgraduate.com

Advertisements

Qmailadmin/EZMLS/ Auto Responder/courier-authlib/courier-imap installation & Configuration STEPS

>Qmailadmin/EZMLS/ Auto Responder/courier-authlib/courier-imap installation & Configuration steps.


—————————————————————–
Installing Ezmlm
—————————————————————–

cd /usr/local/src
tar xzf ezmlm-0.53.tar.gz
chown -R root.root ezmlm-0.53
tar xzf ezmlm-idx-0.40.tar.gz
chown -R root.root ezmlm-idx-0.40

cp -R ezmlm-idx-0.40/* ezmlm-0.53/
cd ezmlm-0.53
patch < idx.patch
patch -p1 < ezmlm-idx-0.53.400.unified_41.patch
make
make man
make setup

—————————————-
Installing Auto Responder
—————————————-
cd /usr/local/src
tar xzf autorespond-2.0.4.tar.gz
chown -R root.root autorespond-2.0.4
cd autorespond-2.0.4
make
make install

—————————————
Installing QmailAdmin
—————————————

cd /usr/local/src/qmailadmin

./configure –enable-htmldir=/var/www/html/ –enable-cgibindir=/var/www/html/mail/ –enable-cgipath=/mail/qmailadmin

Note-
/var/www/html is DocumentRoot for Apache

make
make install-strip

————————————————————————
Apache setting (httpd.conf – /etc/httpd/conf.d/qmail.conf)

AddHandler cgi-script .cgi

SriptAlias /mail/ “/home/www/html/mail/”

AllowOverride None
Options +FollowSymLinks
Order allow,deny
Allow from all

Starting TCPserver for listen on Port 25

tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
or
qmailctl cdb
—————————————————-
#login first time on qmailadmin web interface
—————————————————-

./vpasswd postmaster
It will ask password, Provide the password “xxxxx”
Password is – xxxxx

——————————————————–
Adding new virtual domain i.e vmgraduate.com
———————————————————

./vadddomain vmgraduate.com

Note – It will ask for postmaster password . Please provide the password .

——————————————————–
courier-Authlib Installation
——————————————————–

Installation
Download and unpack the authentication library

cd /usr/local/src/qmail/

tar -xf courier-authlib-0.58.tar.bz2
cd /usr/local/src/qmail/courier-authlib-0.58

./configure –prefix=/usr/local/courier-authlib –without-authpam –without-authldap –without-authpwd –without-authmysql –without-authpgsql –without-authshadow –without-authuserdb –without-authcustom –without-authcram –without-authpipe –with-authvchkpw –with-redhat

Note – if you are running Centos/fedora, you may have to add a with ./configure
–with-redhat

Note – 1) Make sure if you get the following Error – configure: error: C++ preprocessor “/lib/cpp” fails sanity check

Solution – Check out if these prerequisite match “gcc gcc-cpp gcc-c++” else install these packages

2) Make sure if you get the following error – configure: error: Cannot find either the gdbm or the db library.

Solution –
yum install gdbm-devel ( GDBM Development tool might not installed)

make
make install
make install-configure

#copy the start script at /etc/init.d/ location

cp courier-authlib.sysvinit /etc/init.d/courier-authlib
chmod 700 /etc/init.d/courier-authlib

chkconfig –add courier-authlib

#Review the settings for the authentication library

vi /usr/local/courier-authlib/etc/authlib/authdaemonrc

authmodulelist=”authvchkpw” —– (vpopmail authenticatation)

—————————————————————
courier-IMAP Installation
—————————————————————

cd /usr/local/src/qmail

tar -xf courier-imap-4.0.6.tar.bz2
cd /usr/local/src/qmail/courier-imap-4.0.6

COURIERAUTHCONFIG=/usr/local/courier-authlib/bin/courierauthconfig CPPFLAGS=-I/usr/local/courier-authlib/include ./configure –prefix=/usr/local/courier-imap –disable-root-check –with-ssl –with-redhat

Note – if you are running Centos/fedora, you may have to add a with ./configure
–with-redhat

make
make install
make install-configure

cp courier-imap.sysvinit /etc/init.d/courier-imap
chmod 744 /etc/rc.d/init.d/courier-imap
chkconfig –add courier-imap

Troubleshooting

Challenge – tcpserver: fatal: unable to figure out port number for pop3

Solution – Modify “/service/qmail-pop3d/run “ & replace pop3 110.

VMware ESX installation with VMware Workstation on Lenova T60 Notebook

>The major concern was that Lenova T60 notebook does not support VT enabled on BIOS. SO it was challenge to installed ESX on Lenova T60 Laptop.

This articles is just a SUDO document.

Here are the steps I have followed

1) I have created a dummy vmware esx machine incorporated with all the configuration files like .vmdk, vmx etc.

Note – Everybody know how to create VM in VMware workstation.

2)
Edit the “Virtual Machine setting” and click on “add” button to “add a hard disk”. Click on Next button to get
“Create a new virtual disk” and again clicked on “next” button to get “Virtual Disk type” IDE is selected.

Note – To avoid “”no valid devices available to create a file system

3) Edit the created esx’s vmx file and incorporated the following attributes

monitor_control.restrict_backdoor = “True”
Monitor_control.vt32 = “True”
ethernet0.virtualDev = “e1000”
Monitor_control.vt32 = “True”

4) Power on the esx virtual machine and it gets installed.


Note
– I know this is slow in boot process but the biggest challenge was to installed ESX on Lenova T60.

Something is better than nothing