1. Who?
This document is (C) elybis <elybis@gmx.net>.
2. Prerequisites
I assume you have set up your NetBSD operating system correctly (including
internet access and the pkgsrc collection). If not, have a look at
http://www.netbsd.org/Documentation/ and follow the tutorials there.
3. Installing Exim
Execute the following commands as root.
Install Exim from pkgsrc:
cd /usr/pkgsrc/mail/exim
make install clean clean-depends
Backup the default mailer.conf:
cp /etc/mailer.conf /etc/mailer.conf.sendmail
Overwrite the default mailer.conf with the Exim mailer.conf:
cp /usr/pkg/share/examples/exim/mailer.conf /etc
Stop sendmail (if running in daemon mode):
/etc/rc.d/sendmail stop
Deactivate sendmail in rc.conf (if set as daemon):
vi /etc/rc.conf
delete the line 'sendmail=YES' if existant
Activate Exim in rc.conf:
echo "exim=YES" >> /etc/rc.conf
Change the Exim configuration to a basic working one:
vi /usr/pkg/etc/exim/configure
change the following lines according to your host/domain name:
primary_hostname = host.yourdomain.com
domainlist local_domains = yourdomain.com
qualify_domain = yourdomain.com
data = ${lookup{$local_part}lsearch{/etc/mail/aliases}}
(in the system_aliases section)
You should now have a basic working Exim configuration. Start your Exim with
the following command:
/usr/pkg/etc/rc.d/exim start
Exim should start without any problems. Now we have to create an authentication
file to use for smtp auth in Exim. As mentioned before we will create an
htpasswd compatible file:
cd /usr/pkg/etc/exim
htpasswd -c auth yourlocalusername
chown mail auth
chmod 600 auth
Next thing is to enable smtp authentication in Exim:
vi configure
go to the authenticators section (begin authenticators) and add the following
lines:
plain:
driver=plaintext
public_name=PLAIN
server_condition="
${if crypteq{$3}{
${lookup {$2}lsearch{/usr/pkg/etc/exim/auth}{$value}{failed}}}{yes}{no}}"
server_set_id = $2
login:
driver = plaintext
public_name = LOGIN
server_prompts = Username:: : Password::
server_condition="
${if crypteq{$2}{
${lookup {$1}lsearch{/usr/pkg/etc/exim/auth}{$value}{failed}}}{yes}{no}}"
server_set_id = $1
Whilst editing the configuration file, you can also set the local delivery
settings to allow Teapop access to the mail files later:
find the local_delivery section
add/change the following lines:
group = mail
mode = 0660
Restart Exim:
/usr/pkg/etc/rc.d/exim restart
Check if smtp auth is enabled:
telnet localhost 25
ehlo localhost
You should get a response like:
...
250-AUTH PLAIN LOGIN
...
This indicates that smtp authentication is active. Fine.
4. Installing Teapop
Still being su'd to root, execute the following commands.
Install Teapop from the pkgsrc collection:
cd /usr/pkgsrc/mail/teapop
make install clean clean-depends
Enable Teapop in rc.conf:
echo "teapop=YES" >> /etc/rc.conf
Configure Teapop:
vi /usr/pkg/etc/teapop.passwd
comment out ('#') every default line
add the following line to the end of the file:
default:*:htpasswd:/var/mail:Hgei5r36z:8:1002:/usr/pkg/etc/exim/auth:50:
Please note that '8' should be the uid of the 'mail' user and '1002' should be
the gid of the 'mail' group. You may have to change these. Also '50' sets
the maximum amount of entries that are read from the auth file. Change this to
a value higher than the number of users in your /usr/pkg/etc/exim/auth file.
Teapop is now configured as a fully functional POP3 server, authenticating
against /usr/pkg/etc/exim/auth and using /var/mail/username as the mail source
files.
Start Teapop:
/usr/pkg/etc/rc.d/teapop start
Check if Teapop works:
telnet localhost 110
USER yourlocalusername
PASS thepassyouspecifiedwhenusinghtpasswdthefirsttime
Teapop should respond with:
+OK I'm ready to serve you, Master.
after issuing the PASS command.
It seems like everything's working now! Congratulations. If you have any
comments/suggestions/corrections please send me an email to the address
mentioned above. |