Wednesday, October 7, 2009

configuring Dovecot using source code

Thanks to Sayan, I got a chance to revise my knowledge on configuring dovecot using source code.

So this to start with, download the dovecot source code from here. Then untar the tar ball in your /usr/src folder.

$ cd /usr/src
$ tar xvfz

Then after you the source code has been untared, execute the configure file along with necessary arguments. I configured dovecot to use pam and passwd for authentication. Hence I used the following command

$ ./configure --with-passwd --with-pam

When I executed this command, configure failed as I got an error: "libpam not found". This was because I had not installed libpam0g-dev package. After I installed it using apt-get and again I tried the above command. It finished with no error.

Then execute the command
$ make

and

$ make install

After make and make install command are successful, Dovecot is installed in /usr/local

Now you need to create a dovecot.conf file in /ust/local/etc which will have all the configuration for the dovecot. For the convienience of users, a sample dovecot-example.conf file is already present in the directory and for testing purpose you can just rename it to dovecot.conf file.

You will have to do some necessary changes in the dovecot.conf file.

First you need to select what protocols should be maintained by dovecot. YOu can select imap,pop3,imaps and pop3s.(However if you want pop3s and imaps protocols, then you will have to configure dovecot with --enable-SSL option).

protocols = imap imaps pop3 pop3s

Adding above line in the conf file will enable all the four protocols.

Then you need to add a log_path which is the path of log file.

log_path = /var/log/dovecot.log

You also need to specify a login_user. Dovecot uses this unprivileged user for internal purposes (for login processes).

login_user = dovecot

Also you need to mention the mail location from where dovecot can fetch mails.

mail_location = maildir:~/Maildir

This should be enough for your donvecot.conf file.

Now try to execute the command

$ dovecot

You might just expect a warning. If you get some error, then you can find check the log file.

Now confirm that all the ports are open by executing nmap localhost command.

$ nmap localhost

Note that imap port no. is 143, pop3 port no. is 110, imaps port no. is 993, pop3s port no. is 995

YOu should be able to see these ports in the output of nmap command.

Thursday, June 25, 2009

Qmail installation, life with qmail

This is one of the most important aspect of the journey. If this is successfully completed, I would have completed atleast 10% of my journey.
This part of journey is made very easy by a detailed description given here. I have followed each and every step given in that link. I will just mention points where I deviated from the link.

1) When creating users for qmail, I created them as system users by adding -r argument to the command. By this, they wont appear as normal users.

2) Since the run file in qmail-send supervise directory was doing nothing except executing the /var/qmail/rc file, I copied the contents of /var/qmail/rc in to the run file.
In it I also changed the line
qmail-start "`cat /var/qmail/control/defaultdelivery`"
to
qmail-start svlogd ./Maildir/ qmail
(???? reasons for this)

Tuesday, June 23, 2009

Using runit with traditional init, my second milestone

I had not done this as I wanted to get to test runit as soon as I activate it. Now since I have socklog installed, I can test runit.
So first to use runit along with init, I followed the instructions given here. I faced two problems, due to my own foolishness.
I had directly jumped to the section of "Using with sysvinit and upstart" as I had used it in my earlier venture. However I could find no event.d directory. After scratching my head for sometime, I found that my earlier venture which was with Ubuntu9.04 used Upstart event-based init daemon. But Debian4.1, with which I am venturing this time, doesnt use Upstart. It uses inittab. Ans so then I followed the instructions given in the section, "using sysvinit and inittab".
In this section I saw that a file /sbin/runsvdir-start is used. I tried to read that file but it was not available in my system. Again after pondering over this for sometime, I found that this file had to be copied from /package directory as was explained at the start of the webpage link that I have given above. So then I followed those instructions also.
Now to test, I first stopped rsyslog that was already running on my system and renamed the file S10rsyslog to K90syslog in different run level directories. and now runit and socklog were running properly. :)

Monday, June 22, 2009

Socklog, to generate keys during my journey

In my earlier attempts to this journey, I have learnt that most important key to this journey is the log files generated during the journey. They give a very good explanation whenever something goes wrong and provide sufficient hint to correct my path. Hence I will try to spend good amount of time explaining and understanding myself about it.

We will be using Socklog instead of the default Syslog. Reasons can be found here. Installation is very simple and it can be found here. After installation, we need to do some configuration as given here.
I will using socklog-unix service as I need to log the standard error that can be obtained by listening on the unix domain socket /dev/log. I am not going to use the default nobody and log as the account names for socklog-unix and socklog services respectively. This is because then I will not come to know what exactly the socklog service is doing. Hence I have created two more system users deepnobody and deeplog using the command adduser (please note that there is a difference between adduser and useradd commands).

After this I executed the command
#socklog-conf unix deepnobody deeplog

Now since I had no /service directory, I created one. Then I created a link in it to /etc/sv/socklog-unix. I have not started using runit yet, so I will not get the socklog into action yet.

Sunday, June 21, 2009

Ipsvd installation, a bridge on the road

Again even for this, the documentation, Ipsvd, given is good and I would suggest everybody to follow it. The only speed-breaker I found while installing Ipsvd was the option of installing Matrixssl library. I found that it does exactly what Tcpsvd does for plain communication where as Matrixssl is for communication with SSL encryption. Hence I have installed it. If i find it useful in future, I will surely mention it. But yes there is a small glitch. The matrixSSL is not a completely opensource product. In their website, they mention that the latest updates are available only in the enterprise version. So thats one thing that doesnt encourage me to use it. Let us see, if it comes to use in future.

Friday, June 19, 2009

Runit- my first milestone

Excellent description of runit and its installation has been given in its website, runit. I will be giving here only any new instructions that i found necessary while installing it.

Since I had a complete new system to work on. When I tried to execute the command "package/install" command, I got an error as make command not found. So then I installed make using apt-get. Even gcc was missing, so had to install it also.

Then finally i could execute package/install and package/install-man without any errors.

Apt-get install guide and software installation in Debian.

First of all, the most basic way of installing a software in Debain is by installing it using *.deb files. Simple way to do it is to use the following command.

$dpkg -i *.deb

This will generally work if the package is small and it doesnt depend much on any other package. However if while installing, you may get a package dependency problem. So the most preferred way to install packages is by using Apt-get.