Virtual Domains

David Lang david.lang at digitalinsight.com
Fri Aug 3 12:14:08 EDT 2007


I had all sorts of problems getting this to work.

I have my firewall running sendmail sending the messages to an internal server 
via lmtp, and then authenticating against postgres. the biggest problems were 
getting the lmtp connection to include the domain of the destination and makeing 
the authentication pass through the domain the user typed in.

David Lang

my cyrus.conf is

asgard dlang # cat /etc/cyrus.conf
# $Header: /var/cvsroot/gentoo-x86/net-mail/cyrus-imapd/files/cyrus.conf,v 1.4 
2004/07/18 04:02:23 dragonheart Exp $

# Standard standalone server configuration.

START {
   # Do not delete this entry!
   recover       cmd="ctl_cyrusdb -r"

   # This is only necessary if using idled for IMAP IDLE.
   idled         cmd="idled"
}

# UNIX sockets start with a slash and are put into /var/imap/socket.
SERVICES {
   # Add or remove based on preferences.
   imap          cmd="imapd" listen="imap2" prefork=0
   pop3          cmd="pop3d" listen="pop-3" prefork=0

   # Don't forget to generate the needed keys for SSL or TLS
   # (see doc/html/install-configure.html).
   imaps         cmd="imapd -s" listen="imaps" prefork=0
   pop3s         cmd="pop3d -s" listen="pop3s" prefork=0

   sieve         cmd="timsieved" listen="sieve" prefork=0

   # at least one LMTP is required for delivery
   lmtp          cmd="lmtpd -a" listen="lmtp" prefork=0
   lmtpunix      cmd="lmtpd" listen="/var/imap/socket/lmtp" prefork=0

   # this is only necessary if using notifications
   #notify       cmd="notifyd" listen="/var/imap/socket/notify" proto="udp" 
prefork=1
}

EVENTS {
   # This is required.
   checkpoint    cmd="ctl_cyrusdb -c" period=30

   # This is only necessary if using duplicate delivery suppression.
   delprune      cmd="ctl_deliver -E 3" period=1440

   # This is only necessary if caching TLS sessions.
   tlsprune      cmd="tls_prune" period=1440
}

my imapd.conf
asgard dlang # cat /etc/imapd.conf
# $Header: /var/cvsroot/gentoo-x86/net-mail/cyrus-imapd/files/imapd.conf,v 1.5 
2004/08/27 06:02:45 langthang Exp $

# Don't forget to use chattr +S (if you are using ext[23])
# when you change these directories (read the docs).
configdirectory:        /var/imap
partition-default:      /movies/imap
sievedir:               /var/imap/sieve
virtdomains:            yes
#defaultdomain          lang.hm

#tls_ca_path:            /etc/ssl/certs
#tls_cert_file:         /etc/ssl/cyrus/server.crt
#tls_key_file:          /etc/ssl/cyrus/server.key

# Don't use an everyday user as admin.
admins:                 cyrus

hashimapspool:          yes
allowanonymouslogin:    no
allowplaintext:         yes

# Allow renaming of top-level mailboxes.
#allowusermoves:         yes

# Use this if sieve-scripts could be in ~user/.sieve.
#sieveusehomedir:       yes

# Use saslauthd if you want to use pam for imap.
# But be warned: login with DIGEST-MD5 or CRAM-MD5
# is not possible using pam.
#sasl_pwcheck_method:   saslauthd

####################################################
## This is a recommended authentication method if you
## emerge cyrus-sasl with 'postgres' or 'mysql'
## To use with mysql database uncomment those lines below.

sasl_pwcheck_method: auxprop
sasl_auxprop_plugin: sql

## possible values for sasl_auxprop_plugin 'mysql', 'pgsql', 'sqlite'.
sasl_sql_engine: pgsql

## all possible values.
sasl_mech_list: LOGIN PLAIN CRAM-MD5 DIGEST-MD5
## or limit to CRAM-MD5 only
#sasl_mech_list: CRAM-MD5

## change below to suit your setup.
sasl_sql_user: mailuser
sasl_sql_passwd: password
sasl_sql_database: maildb
sasl_sql_hostnames: localhost
sasl_sql_select: SELECT clear FROM users WHERE email = '%u@%r'


my sendmail.mc

bifrost:/etc/mail# cat sendmail.mc
define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`DI Basebuild 3.1 07-20-05')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
undefine(`confHOST_STATUS_DIRECTORY')dnl                #DAEMON_HOSTSTATS
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
FEATURE(`virtusertable',`hash /etc/mail/virtusertable')
VIRTUSER_DOMAIN_FILE(`/etc/mail/virtdomaintable')
FEATURE(`mailertable',`hash /etc/mail/mailertable')
FEATURE(`use_cw_file')
FEATURE(`preserve_local_plus_detail')
FEATURE(always_add_domain)
FEATURE(nouucp,`reject')
define(`confLOCAL_MAILER',`cyrusv2')
define(`CYRUSV2_MAILER_ARGS',`TCP asgard lmtp')
dnl MAILER(`smtp')
MAILER(`cyrusv2')
MAILER(`smtp')
MAILER_DEFINITIONS
Mlmtp,          P=[IPC], F=lsDFMnqA@/:|SmXz, E=\r\n,
                 S=EnvFromL, R=EnvToL/HdrToL, T=DNS/RFC822/X-Unix,
                 A=FILE $h



On Fri, 3 Aug 2007, Jarod Watkins wrote:

> Date: Fri, 03 Aug 2007 03:06:51 -0400
> From: Jarod Watkins <jarod at jxxtech.net>
> To: info-cyrus at lists.andrew.cmu.edu
> Subject: Virtual Domains
> 
> I have been searching google for the past 2 days trying to figure out
> how to finish setting up my Cyrus email system. I am almost there,
> however I cannot deliver emails from postfix to the virtual users in
> cyrus. After looking through the logs, its as if postfix isn't supplying
> the whole email address to Cyrus, or Cyrus is just stripping out it. Can
> anyone tell me what I have configured wrong?
>
> Mail.info log:
> Aug  3 02:52:40 debian cyrus/lmtpunix[13477]: lmtp connection preauth'd
> as postman
> Aug  3 02:52:40 debian cyrus/lmtpunix[13477]: verify_user(user.test)
> failed: Mailbox does not exist
> The true user here was test at domain.tld.
>
> Main.cf:
> virtual_transport = lmtp:unix:/var/run/cyrus/socket/lmtp
>
> Cyrus.conf
> lmtpunix        cmd="lmtpd" listen="/var/run/cyrus/socket/lmtp"
> prefork=0 maxchild=20
>
> I also tried using the cyrus delivery method in Master.cf, however i
> just got connection refused errors in my Mail.info log.
>
> Mail.info log:
> Aug  2 11:33:18 debian postfix/pipe[12205]: A76BC1807AC9D:
> to=<test at domain.tld>, relay=cyrus, delay=1646, delays=1646/0.05/0/0.01,
> dsn=4.3.0, status=deferred (temporary failure. Command output: couldn't
> connect to lmtpd: Connection refused_ 421 4.3.0 deliver: couldn't
> connect to lmtpd_ )
>
>
> My config files for that were:
>
> Main.cf:
> virtual_transport = cyrus
>
> Master.cf:
> cyrus     unix  -       n       n       -       -       pipe
> flags=R user=cyrus argv=/usr/sbin/cyrdeliver -r ${sender} -m
> ${extension} ${user}
> note: I have tried this one various ways as well, as I have seen posts
> with the R flag there and some with out it, and also with the different
> options after the directory.
>
> For both files I even added them to a new group I created call "lmtp"
> and then added the postfix user to this group, that didn't work either.
> Thanks for any help someone can provide!
> ----
> Cyrus Home Page: http://cyrusimap.web.cmu.edu/
> Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
> List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
>


More information about the Info-cyrus mailing list