BincIMAP Darwin/MacOSX 10.3 README
Author: Robert Shaw <rshaw@opendarwin.org>

For standard xinetd usage, just build and install using:

  sudo port install bincimap

If you prefer D.J.Bernstein's daemontools/tcpserver, just build
and install using:

  sudo port install bincimap +djb

It is recommended that you read the following documents installed by the
BincIMAP port that came from the distribution:

  @prefix@/share/doc/bincimap/README
  @prefix@/share/doc/bincimap/README.SSL

They contain general installation and setup information that is
useful for any platform. More specific MacOSX/Darwin setup steps are
listed here.

First we need to enable proper PAM suport for checkpassword-pam to work
with BincIMAP, all you need to do is copy the following file in place:

  sudo cp @prefix@/etc/bincimap/pam/bincimap.sample /etc/pam.d/bincimap

You can adjust the PAM configuration if you choose, but the sample
should be sufficient for most.

Next, we setup either xinetd or daemontools/tcpserver depending on
which method you choose. Using xinetd is the easiest since it's already
setup and running on MacOSX/Darwin.

For xinetd setup, you need to copy (or symlink) the following files:

  sudo cp @prefix@/etc/bincimap/xinetd/imap.sample /etc/xinetd.d/imap
  sudo cp @prefix@/etc/bincimap/xinetd/imaps.sample /etc/xinetd.d/imaps
OR
  sudo cp @prefix@/etc/bincimap/xinetd/imap.sample \
          @prefix@/etc/bincimap/xinetd/imap
  sudo ln -s @prefix@/etc/bincimap/xinetd/imap /etc/xinetd.d/imap
  sudo cp @prefix@/etc/bincimap/xinetd/imaps.sample \
          @prefix@/etc/bincimap/xinetd/imaps
  sudo ln -s @prefix@/etc/bincimap/xinetd/imaps /etc/xinetd.d/imaps

Now, we need to tell xinetd to re-read the available services by sending
it a HUP signal:

  sudo kill -HUP `cat /var/run/xinetd.pid`

For the daemontools/tcpserver setup, you need to copy (or symlink) the
following directories:

  sudo cp -r @prefix@/etc/bincimap/service/imap.sample /service/imap
  sudo cp -r @prefix@/etc/bincimap/service/imaps.sample /service/imaps
OR
  sudo cp -r @prefix@/etc/bincimap/service/imap.sample \
             @prefix@/etc/bincimap/service/imap
  sudo ln -s @prefix@/etc/bincimap/service/imap /service/imap
  sudo cp -r @prefix@/etc/bincimap/service/imaps.sample \
             @prefix@/etc/bincimap/service/imaps
  sudo ln -s @prefix@/etc/bincimap/service/imaps /service/imaps

Now, we need a BincIMAP configuration file, which can be copied
from the sample provided:

  sudo cp @prefix@/etc/bincimap/bincimap.conf.sample \
          @prefix@/etc/bincimap/bincimap.conf

Personally, I recommend you modify the bincimap.conf settings to the
following for MacOSX. This works out better for use with Apple's Mail
application:

  depot = "IMAPdir",                           /* Use IMAPdir style
                                                * depot. */

  path = "Library/Maildir",                    /* default path */

Note: To aid in converting existing mbox format mailboxes to
Maildir/IMAPdir format for access by BincIMAP, you can install and use
the "mb2md" port (sudo port install mb2md). Use the special "-i" option
for IMAPdir style conversion.

Finally, if you built with SSL support (default), you need generate a
self-signed test certificate to test the SSL connection:

  openssl req -newkey rsa:1024 -keyout bincimap.key -x509 -nodes \
              -days 365 -out bincimap.crt

Now, copy the contents of the generated bincimap.key and bincimap.crt
files into a file called "bincimap.pem" and copy this file to the
location specified in the bincimap.conf configuration file and make sure
it's read-only for the bincimap-up process (typically root):

  cat bincimap.key bincimap.crt > bincimap.pem
  sudo cp bincimap.pem @prefix@/etc/bincimap/bincimap.pem
  sudo chmod 0400 @prefix@/etc/bincimap/bincimap.pem

If you did NOT build with SSL support, you will need to modify the
bincimap.conf setting to enable authentication without an SSL
connection:

  allow plain auth in non ssl = "yes",           /* allow login or
                                                    authenticate
                                                    when not in
                                                    SSL/TLS mode */

You can edit the settings as desired for your implementation.  Refer to
the man pages and other BincIMAP documentation for further details.

