Using The Haraka Mail Server
Server - CentOS

Haraka Mail ServerHaraka, a lightweight SMTP server focused on performance, simplicity and modularity. The Haraka mail server uses plugins built from Javascript to facilitate speed and modularity. The concept of plugins (modules) allows an administrator to implement only those plugins which are needed.

Haraka is an interesting project which yields a lightweight fast mail server with some limitations, especially in terms of queuing. The installation is simple enough though several other dependencies must be installed. One of the biggest liabilities is that Haraka does not have adequate documentation. Getting simple plugins to work means guessing on how to make some aspects work as there is no information. And, since few people are using Haraka, the second big liability, it is tough finding answers and difficult estimating the real value of Haraka as a production option. On other hand, Haraka is a simple program that one can basically guess what the correct answers to problems are.

Here is the web site for Haraka: https://github.com/baudehlo/Haraka

Haraka can be implemented either as an incoming mail server with plugins that meet important standards for performance, Spam detection and virus protection. Or, it can be implemented as an outgoing server. This means that typically Haraka is the frontend to a setup which also includes a mail serve like Postfix, so the queues from Postfix can be used while the performance and simplicity of Haraka are the frontend.

Resource Usage Comparison

When comparing the resources that Haraka uses with that of a typical Postfix server running plugins, the two areas to compare are the use of amavisd and Haraka. On a typical installation, amavisd (perl script) is used to connect to spamassassin and clamav and use a reinjection port to provide the necessary scanning and then send mail to the queue on a different port.


ps axo pid,ppid,pcpu,size,etime,priority,cmd

PID PPID %CPU SZ ELAPSED PRI CMD

9540 7857 0.0 48296 32:47 18 node /usr/local/bin/haraka -c /opt/haraka

 

Resources used while processing 500 messages of a size of 5140 KB done in 1 second.

11330 9761 1.1 52864 02:56 15 node /usr/local/bin/haraka -c /opt/haraka

 

Here are the resources taken up by amavis on a working mail server. As you can see depending upon how many child processes you have amavis has similar needs in terms of resources.

ps axo pid,ppid,pcpu,size,etime,priority,cmd<.

PID PPID %CPU SZ ELAPSED PRI CMD

19769 1 0.0 50996 7-22:43:18 18 amavisd (master)

19773 19769 0.0 52264 7-22:42:42 17 amavisd (ch12-avail)

19774 19769 0.0 52224 7-22:42:42 15 amavisd (ch11-avail)

Haraka was faster on managing email as it came in and getting it to a queue vs. amavis. This is probably due to the overall structural differences and the perl script verses the Javascript differences. I did not record time differences as my set up was just an initial testing situation.

 

Installation

There are a number of dependencies that must be installed for Haraka. This example will demonstrate how to install on a CentOS machine.


yum install -y openssl openssl-devel

 

wget http://nodejs.org/dist/node-v0.4.12.tar.gz

tar zxvf node-v0.4.12.tar.gz

cd node-v0.4.12

yum install -y gcc-c++


./configure

make

make install

cd ..


curl http://npmjs.org/install.sh | sh


npm install -g Haraka

npm WARN Haraka@1.0.0 package.json: bugs['web'] should probably be bugs['url']

/usr/local/bin/haraka -> /usr/local/lib/node_modules/Haraka/bin/haraka

abbrev@1.0.3 /usr/local/lib/node_modules/Haraka/node_modules/nopt/node_modules/abbrev

This e-mail address is being protected from spambots. You need JavaScript enabled to view it /usr/local/lib/node_modules/Haraka/node_modules/nopt

log@1.2.0 /usr/local/lib/node_modules/Haraka/node_modules/cluster/node_modules/log

mkdirp@0.0.7 /usr/local/lib/node_modules/Haraka/node_modules/cluster/node_modules/mkdirp

cluster@0.7.7 /usr/local/lib/node_modules/Haraka/node_modules/cluster

Haraka@1.0.0 /usr/local/lib/node_modules/Haraka

 

 

 

 

 

Start the daemon

haraka -i /opt/haraka_test


netstat -aunt

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN


That should provide a basic working version of haraka. However, before you go too far you will want to make modifications that will ensure a stable mail server that performs the tasks that are necessary.