Re: [Exim] courier imap, exim & userdb

Top Page
Delete this message
Reply to this message
Author: Marc Haber
Date:  
To: exim-users
Subject: Re: [Exim] courier imap, exim & userdb
On Sun, 15 Apr 2001 10:49:12 +0300, Ben-Nes Michael
<miki@???> wrote:
>Any one using exim with courier imap and userdb.dat ?


Yes.

>Can any one tell me what driver should i use ? ( smartuser, appenfile )


This depends on how you determine the user account. I have two setups
for that.

(1) Local system users with UNIX account, mail spool in home dir:
Director:
|systemuser_maildir:
|# This director matches local user mailboxes. This is needed at least
|# for local root mail which is delivered to admin. Local delivery is
|# not done if SYSTEM_MAILDIR doesn't exist in the user's home dir, so
|# users can control delivery.
|  debug_print                   = "D: systemuser_maildir for $local_part@$domain."
|  driver                        = localuser
|  transport                     = system_maildir_delivery
|  require_files                 = $local_part:+SYSTEM_MAILDIR


SYSTEM_MAILDIR=$home/.mail

Transport:
|system_maildir_delivery:
|  debug_print                   = "T: system_maildir_delivery for $local_part@$domain (SYSTEM_MAILDIR)."
|  driver                        = appendfile
|  directory                     = SYSTEM_MAILDIR
|  directory_mode                = 0700
|  mode                          = 0600
|  maildir_format                = yes
|  create_directory              = yes
|  create_file                   = "belowhome"
|  escape_string                 = ""
|  check_string                  = ""
|  prefix                        = ""
|  suffix                        = ""
|  delivery_date_add             = yes
|  envelope_to_add               = yes
|  return_path_add               = yes


You could authenticate these users against their UNIX accounts via
PAM, but I generally refrain from doing so to prevent a sniffed POP3
session from giving out a shell account, and authenticate local UNIX
users via userdb with a different password.

If users don't have local UNIX accounts, you'd have to use the
smartuser director:
Director:
|domain_maildir:
|# This director matches maildirs in delivery tables.
|  debug_print                   = "D: domain_maildir for $local_part@$domain."
|  driver                        = smartuser
|  transport                     = domain_maildir_delivery
|  domains                       = partial-lsearch;DELITABLEDIR/map


Transport:
|domain_maildir_delivery:
|  debug_print                   = "T: domain_maildir_delivery for $local_part@$domain \
|                                   (VIRTUAL_MAILDIR/${lookup{$domain}partial-lsearch{DELITABLEDIR/map}{$value}}/$local_part)."
|  driver                        = appendfile
|  directory                     = "DOMAIN_MAILDIR/${lc:${lookup{$domain}partial-lsearch{DELITABLEDIR/map}{$value}}}/${lc:$local_part}"
|  maildir_format                = yes
|  user                          = mail
|  group                         = mail
|  directory_mode                = 0700
|  mode                          = 0600
|  create_directory              = yes
|  create_file                   = "belowhome"
|  escape_string                 = ""
|  check_string                  = ""
|  prefix                        = ""
|  suffix                        = ""
|  delivery_date_add             = yes
|  envelope_to_add               = yes
|  return_path_add               = yes


In DELITABLEDIR, text files that I call delivery tables are stored.
There is a map file, too, that maps domains to delivery tables. The
delivery tables are generated from the courier userdb sources with a
shell script:
|#!/bin/bash
|# generates exim deliverytables from the courier userdb
|
|COURIERDIR="/etc/courier"
|USERDBDIR="$COURIERDIR/userdb"
|EXIMDIR="/etc/exim"
|DELITABLEDIR="$EXIMDIR/delitables"
|
|cd $USERDBDIR
|for domain in *; do
| FILE="$DELITABLEDIR/$domain"
| echo > $FILE "# exim delivery table"
| echo >> $FILE "# generated by $0" >> $FILE
| echo >> $FILE -n "# from $USERDBDIR/$domain on "
| date >> $FILE +"%Y-%m-%d %k:%M:%S"
| echo >> $FILE "# do not edit"
| echo >> $FILE
| < $domain sed 's/\([^@]*\).*/\1: \1/' >> $FILE

|done

Maybe it is possible to use the userdb db file directly, but with
Debian, this causes problems with different db libs used by the exim
and courier packages, so I decided to take this additional level of
indirection.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29