DRAC for FreeBSD

===============================
A Simplified Installation Guide
===============================

What is DRAC?
===============================

DRAC stands for Dynamic Relay Authorization Control and was written
by Gary Mills as a contender for Pop before SMTP. The premise behind
DRAC is to allow dynamic hosts to temporarily relay through an SMTP
server after they have authenticated via POP3 server.


Scope of this Document
===============================

The scope of this document is to explain how to install and configure
DRAC on FreeBSD to work with both Sendmail and Qpopper, two of the most 
robust and common mail related applications.

Installing and Configuring DRAC
===============================

1. You will most likely want to install DRAC from the ports collection
which will put the files in all the right places.

    a. cd /usr/ports/mail/drac
    b. make
    c. make install
    d. make clean
    e. Edit /usr/local/etc/dracd.host to say:

localhost

    f. Edit /usr/local/etc/dracd.allow to say:

255.255.255.255 127.0.0.1

2. Enable portmap

    a. vi /etc/hosts.allow, add entry portmap : localhost : allow
    b. vi /etc/rc.conf, change portmap_enable to ="YES"

3. Enable rpc

    a. vi /etc/rc.conf, add rpcbind_enable="YES"

Installing Qpopper
==============================

4. Install qpopper from the ports collection
   a. cd /usr/ports/mail/qpopper
   b. make WITH_DRAC=yes install
   c. Optionally, you can include the WITH_Y_OPTION=yes to allow you to specify
	a different logging facility for popper.

Configuring Sendmail
==============================

5. When configuring, this document assumes you are using the sendmail installed
by default.

    a. cd /etc/mail
    b. Edit the .mc file
    c. Add the following at the end of the file and PAY ATTENTION TO THE 3 TABS
	BETWEEN THE *, + AND THE $:!!!

# dynamic relay authorization control map
Kdrac btree -o /usr/local/etc/dracd

LOCAL_RULESETS

SLocal_check_rcpt

# allow recent POP/IMAP mail clients to relay
R$*                             $: $&{client_addr}
R$+                             $: $(drac $1 $: ? $)
R?                              $@ ?
R$+                             $@ $#OK

6. Enable DRAC in your /etc/rc.conf file

   dracd_enable="YES"
   drac_flags="-i -e 10"

7. Reboot


Testing
============================

8. Run a typical test to make sure you can relay after authing to the pop3 server.

Trying 192.168.1.2...
Connected to mail.somehost.com.
Escape character is '^]'.
+OK ready
user user
+OK Password required for user.
pass 
+OK user has 156 visible messages (0 hidden) in 19178456 octets.
quit
+OK Pop server at mail.somehost.com signing off.
Connection closed by foreign host.

Trying 192.168.1.2...
Connected to mail.somehost.com.
Escape character is '^]'.
helo somehost.com
220 mail.somehost.com ESMTP Sendmail 8.12.8p1/3.1.3.3.7av; Thu, 29 Jan 2004 00:09:08 -0600 (CST)

250 mail.somehost.com Hello someone.com [192.168.1.3], pleased to meet you
mail from: user@somehost2.com
250 2.1.0 user@somehost2.com... Sender ok
rcpt to: info@someotherhost.com
250 2.1.5 info@someotherhost.com... Recipient ok
data
354 Enter mail, end with "." on a line by itself
howdee!
..
250 2.0.0 i0T698Uo002867 Message accepted for delivery
quit
221 2.0.0 mail.somehost.com closing connection
Connection closed by foreign host.

9. If something has failed, check the log files and repeat steps.


Credits
===================================

Gary Mills for writing DRAC. More information about DRAC and it's uses
can be found on his website: http://mail.cc.umanitoba.ca/drac/