Haraka Configuration: Receiving Mail in Queue
Server - CentOS

 

Once you set up your DNS for the mail server and then start Haraka you should be able to receive mail via the test_queue. This is really the first step in configuration as we will also look at setting up additional options.

In this example Haraka has been installed in /opt/haraka. Inside that directory are several additional and important directories and files.

config docs package.json plugins queue README

The config directory contains the configuration files that are used to implement the plugins that are needed for a configuration. There are a number of files that will be located here when you install Haraka.

The docs directory provides limited information on how to work with Haraka.

The plugins directory contains Javascript files that can be used to facilitate any number of plugins. For example if you wanted to use the test_queue plugin you would place a file in the plugins directory with the following content and name it test_queue.js Note in this example that the path created for mail delivery is /opt/mail so modify that to your needs.


var fs = require('fs');

 

exports.hook_queue = function(next, connection) {

var lines = connection.transaction.data_lines;

if (lines.length === 0) {

return next(DENY);

}

 

fs.writeFile('/opt/mail/mail.eml', lines.join(''), function(err) {

if (err) {

return next(DENY, "Saving failed");

}

 

return next(OK);

});

};

 

You should now be able to send mail to the domain and see it land in the test_queue in a file called mail.eml.

 

Configuration Files

Inside the config directory there are a number of files that can easily be edited to provide settings to tune the mail server.

 

databytes

This sets the maximum size of email that can be received, default is 500000.

 

dnsbl.zones

The one thing that is important to understand when using blackholes is that these DNS blacklists require Haraka to do a DNS lookup which will take resources from your server and create latency. However, this can be a significant reduction in SPAM.

 

zen.spamhaus.org

This list contains three separate lists.

“The SBL is a realtime database of IP addresses of verified spam sources and spam operations (including spammers, spam gangs and spam support services), maintained by the Spamhaus Project team and supplied as a free service to help email administrators better manage incoming email streams.

 

The Spamhaus Exploits Block List (XBL) is a realtime database of IP addresses of hijacked PCs infected by illegal 3rd party exploits, including open proxies (HTTP, socks, AnalogX, wingate, etc), worms/viruses with built-in spam engines, and other types of trojan-horse exploits.

 

The Spamhaus PBL is a DNSBL database of end-user IP address ranges which should not be delivering unauthenticated SMTP email to any Internet mail server except those provided for specifically by an ISP for that customer’s use. The PBL helps networks enforce their Acceptable Use Policy for dynamic and non-MTA customer IP ranges.”

 

bl.spamcop.net

SpamCop Block List

This list contains IP Addresses which have sent Spam as reported by users themselves. This provides the advantage of a list that is finely tuned and very up to date as users respond to add IPs to this list. However, it is an aggressive list as they state.

 

“The SCBL is aggressive and often errs on the side of blocking mail.”

 

The other disadvantage is that any user can add an IP to the list thus creating a serious problem for an organization whether it is justified or not. Your enemies or competitors could use this list against you.

 

cbl.abuseat.org

The CBL takes its source data from very large spamtraps/mail infrastructures, and only lists IPs exhibiting characteristics which are specific to open proxies of various sorts (HTTP, socks, AnalogX, wingate etc) and dedicated Spam BOTs which have been abused to send spam, worms/viruses that do their own direct mail transmission, or some types of trojan-horse or “stealth” spamware, dictionary mail harvesters etc.

 

The default is to use spamhaus.org.

zen.spamhaus.org

 

 

plugins

These are the default plugins that are used and modifications needed to get the test queue working correctly.

 

# block mails from known bad hosts (see config/dnsbl.zones for the DNS zones queried)

dnsbl

# allow bad mail signatures from the config/data.signatures file.

data.signatures

# block mail from some known bad HELOs - see config/helo.checks.ini for configuration

helo.checks

# block mail from known bad email addresses you put in config/mail_from.blocklist

mail_from.blocklist

# Only accept mail where the MAIL FROM domain is resolvable to an MX record

mail_from.is_resolvable

# Only accept mail for your personal list of hosts

rcpt_to.in_host_list

# Queue mail via smtp

test_queue

 

me

This is the name of the server, the default is the hostname.

 

host_list

These are the domains and hosts that haraka will receive mail for. Be sure to enter your domain that you will be sending mail to here.

haraka

localnet

example.com

 

 

127.0.0.1 localhost.localdomain localhost

# Auto-generated hostname. Please do not remove this comment.

192.168.5.157 haraka

192.168.5.103 mk

 

That should allow you to send mail to the domain and haraka deliver it into the mail queue.