Blue Flower

Sunday, 05 July 2015 13:24

Configuring Qmail

Written by
Rate this item
(0 votes)

Getting this part of qmail going is, well, going to be a little rough. We need to download the scripts for qmail-smtpd, qmail-smtpd-ssl and qmail-send. We will start with making all the needed directories and stuff like that so lets get to it!


# cd ~root/qmail

The only change we will need to make in the smtpd_run file is the IP address. Change this to the local address of the server (or just the listening IP). All authentication services are disabled. By the end of this walkthrough you will have 2 secure SSL and TLS services. All mail will be filtered using RBLs, greylistiing and qmail-scanner to help thwart spam.

You will need to edit smtpd_run and change the IP Address:

IP=1.2.3.4

Now lets make the supervise directory and get everything copied over. The qmail.sh below has about 30 commands on copying the appropriate files into the correct folders. Please feel free to take a look at the qmail.sh file to see exactly what it's doing. It is copying all qmail-smtpd, qmail-smtpd-ssl and qmail-send run files for the service and log.


# ./qmail.sh

Now lets setup some qmail aliases. Replace This email address is being protected from spambots. You need JavaScript enabled to view it. in the next three lines with the address you want the emails to go to:


# echo This email address is being protected from spambots. You need JavaScript enabled to view it. > /var/qmail/alias/.qmail-root
# echo This email address is being protected from spambots. You need JavaScript enabled to view it. > /var/qmail/alias/.qmail-postmaster
# echo This email address is being protected from spambots. You need JavaScript enabled to view it. > /var/qmail/alias/.qmail-mailer-daemon

Now we want to setup selective relaying:


# mkdir /etc/tcp/
# cd /etc/tcp
# fetch http://freebsdrocks.net/files/etc-tcp-makefile
# mv etc-tcp-makefile Makefile

Now we need to create the smtp file

At this point it should be ready to go. All you need to do is create the "smtp" file, containing the normal access control list. You may want to add the IP of the server you specified in the /var/qmail/supervise/qmail-smtpd/run file in the /etc/tcp/smtp file. Lets say the IP you used was 192.168.9.1. The line should look like this:


192.168.9.1:allow,RELAYCLIENT=""

This is what a typical smtp file should look like:


# vi /etc/tcp/smtp

Add the following to /etc/tcp/smtp:


192.168.9.:allow,RELAYCLIENT=""
:allow

Now run:


# gmake

and you should get an output saying:


tcprules smtp.cdb smtp.tmp < smtp
chmod 644 smtp.cdb smtp

Now to continue on.

Read 2311 times Last modified on Thursday, 29 September 2016 02:40

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.