This howto is for exim4 setup on Debian Sarge and is likely a bit dated by now.
It was a big process getting exim4 working on debian. The main problem is because most of the howto’s out there are for those wanting to use exim4 as a relay to send mail to their ISP, but I wanted by own mail server. So here is how I did it:
Install Exim4
Install exim4 and the heavy daemon, needed for authentication against system passwords.
apt-get install exim4 exim4-daemon-heavy
Then answer the following questions:
Split configuration: Yes #seems like the logical thing to do
General type of mail configuration: internet site #I can deliver mail myself
System Mail Name: northfolk.ca #what should be after @ in e-mails
IP addresses to listen on: #leave blank to listen for all addresses
Other destinations for which mais is accepted: northfolk.ca #probaly not necessary if /etc/hosts is correctly configured, but I’ll be safe
Domains to relay for: #leave blank
Machines to relay for: 192.168.0.0/24 #I’ll relay for my local network without requiring authentication
Keep number of DNS-queries minimal: No #I’ve no idea what this means![]()
Use Maildirs
Set exim to use maildirs (because I will also use Courier for imap access)
edit /etc/exim4/update-exim4.conf.conf
add the following line at the bottom:
dc_localdelivery=’maildir_home’
Setup Authentication
I had the most difficulty here. /usr/share/doc/exim4-base/README.SMTP-AUTH has most of the necessary information:
Install sasl2 and add Debian-exim to the sasl group.
apt-get install sasl2-bin
adduser Debian-exim sasl
Then edit /etc/exim4/conf.d/auth/30_exim4-config_examples. Mine looks like this:
plain_saslauthd_server:
driver = plaintext
public_name = PLAIN
server_condition = ${if saslauthd{{$2}{$3}}{1}{0}}
server_set_id = $2
server_prompts = :
.ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}
.endif
#
login_saslauthd_server:
driver = plaintext
public_name = LOGIN
server_prompts = “Username:: : Password::”
# don’t send system passwords over unencrypted connections
# server_advertise_condition = ${if eq{$tls_cipher}{}{0}{1}}
server_condition = ${if saslauthd{{$1}{$2}}{1}{0}}
server_set_id = $1
.ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}
.endif
Generate a certifacate by running
/usr/share/doc/exim4-base/examples/exim-gencert
Okay. That’s all fine, but here is what the document didn’t tell me:
edit /etc/default/saslauthd
# This needs to be uncommented before saslauthd will be run automatically
START=yes# You must specify the authentication mechanisms you wish to use.
# This defaults to “pam” for PAM support, but may also include
# “shadow” or “sasldb”, like this:
# MECHANISMS=”pam shadow”MECHANISMS=”shadow”
The defaults for this file were to not run saslauthd automatically, and authentication mechanism was set to pam. We need shadow, so either set to shadow or add to pam.
The other thing I need to do was enable TLS (which is not enabled by default). The following will enable TLS and will only allow secure connections.
Create a new file /etc/exim4/conf.d/main/00_local
with the line:
MAIN_TLS_ENABLE = true
Restart Services
/etc/init.d/saslauthd restart
/etc/init.d/exim4 restart
You’re Done!!!
And that’s it. It took me over a week to put all the pieces together (I hope I haven’t forgotten anything with this howto), but now you can do it in 10 minutes.
Hi Chris, your exim4 tutorial is nice. I was wondering if you could give me advice on a problem I am having? I have the domain coffshire.com and I wanted my server to get mail sent to @coffshire.com addresses. I setup everything like you did in your blog, but when I go to send mail to a user @coffshire.com from my school account, it tells me “553 sorry, relaying denied from your location”. I can send mail from my server, though, and it says I am root@coffshire.com (when logged in as root).
Do you have any ideas? Thanks!!
Chris, you don´t know me but I´d like to thank you for the tutorial posted above.
It helped me a lot!
I used some information posted here for making one of my own, giving the credits, of coure!
Thanks again! God Bless You!
Was setting this up for myself tonight… nearly all the details can be found in the official docs, but knowing the exact steps, and knowing to uncomment those two stanzas in /etc/exim4/conf.d/auth/30_exim4-config_examples would not have been my first guesses.
Thanks for the mini-howto, and being found for me via Google.
Nice howto, thanks for sharing. Note that for better security one could set up different passwords for mail and system users.
I noticed that on debian etch that your warning about the two lines to be added to enable the saslauthd daemon get mentioned when you apt-get install it now.
* To enable saslauthd, edit /etc/default/saslauthd and set START=yes
so maybe they listened, or picked it up somewhere else