sendmail and virtual domains and catchalls?

Andrzej Filip anfi at priv.onet.pl
Sat Mar 20 09:50:23 EST 2004


Carl Brewer wrote:
> 
> Hello Andrzej,
> 
> Andrzej Filip wrote:
> 
>     [chomp]
> 
>> My recommendation:
>> Implement http://anfi.webhop.org/sendmail/rtcyrus2.html solution in 
>> its mailertable version [it rejects messages to non existing cyrus 
>> mailboxes], I can easily modify it to make it support "per domain 
>> catch remaining".

I have uploaded new modified FEATURE(`mrs_cyrus')
http://anfi.homeunix.net/sendmail/rtcyrus2.html
RTCyrus2 uses socket map to ask cyrus smmapd daemon if given mailbox is 
serviced by cyrus. RTCyrus2 requires cyrus 2.2.3 and patched sendmail-8.12 (to 
get socketmap support). Socket map support is available in unpatched 
sendmail-8.13.0.Alpha0.

You can use the following mailertable entries with new version of RTCyrus2:

foo.com.au        mrs_cyrus_mailertable:local:catchall_foo
bl.echidna.id.au  mrs_cyrus_mailertable:local:catchall_echidna

and define catchall_foo and catchall_echidna in aliases file.

> I have now tried most of your suggestions, as well as numerous
> other things, and I now have the following setup :
> 
> I'm using your cyrsv2d mailer copied over the top of the sendmail
> cyrusv2.mc file
> 
> My sendmail.mc file is :
> VERSIONID(`$Id: generic-bsd4.4.mc,v 8.10 1999/02/07 07:26:02 gshapiro 
> Exp $')
> FEATURE(always_add_domain)dnl
> FEATURE(mailertable, hash /etc/mail/mailertable)dnl
> FEATURE(virtusertable, hash /etc/mail/virtusertable)dnl
> FEATURE(access_db, hash -T<TMPF> /etc/mail/access)dnl
> DAEMON_OPTIONS(`Name=MTA-v4, Family=inet')
> DAEMON_OPTIONS(`Name=MTA-v6, Family=inet6')
> define(`confME_TOO', True)dnl
> define(`confTRUSTED_USERS', majordom)dnl
> 
> OSTYPE(bsd4.4)dnl
> DOMAIN(generic)dnl
> MAILER(local)
> MAILER(smtp)
> MAILER(cyrusv2)
> 
> 
> My mailertable :
> foo.com.au             cyrusv2d:/var/imap/socket/lmtp
> bl.echidna.id.au        cyrusv2d:/var/imap/socket/lmtp
> 
> My virtusertable :
> 
> bar at foo.com.au         carl at foo.com.au
> @foo.com.au            carl at bl.echidna.id.au
> 
> My aliases file :
> 
> postmaster: carl at foo.com.au
> root:           carl at foo.com.au
> carl:           carl at bl.echidna.id.au
> 
> local-host-names :
> rollcage2.bl.echidna.id.au
> 
> The relevant bits of imapd.conf :
> 
> unixhierarchysep: yes
> virtdomains: userid
> defaultdomain: bl.echidna.id.au
> 
> 
> Everything works, except the virtusertables.  Ie: I can send mail to
> carl at foo.com.au and it works fine, the aliases entries send local
> mail to carl at foo.com.au or carl at bl.echidna.id.au as per the aliases
> file.
> I couldn't find anything on your site that seemed to offer the
> same functionality as virtusertables.  Googling around seems to
> suggest that sendmail does mailertables first, and doesn't look
> at the virtusertables with the above setup.  

* virtusertable is consulted before mailertable
* virtusertable works for local email domains ($=w) and domains listed in 
$={VirHost}
* mailertable *DOES NOT* work for local email domains ($=w)
* sendmail adds some names to $=w "automagically"
* you have not added any domains to $={VirHost}

Unless you define _VIRTUSER_STOP_ONE_LEVEL_RECURSION_ virtusertable "output" 
is passed again via virtusertable rewriting. Without it the following "chain 
of remappings" occurs:
bar at foo.com.au -> carl at foo.com.au -> carl at bl.echidna.id.au

_VIRTUSER_STOP_ONE_LEVEL_RECURSION_ is not documented, its short description 
is present in cf/m4/proto.m4 file.

http://www.sendmail.org/m4/features.html#virtusertable
http://www.sendmail.org/m4/features.html#mailertable
http://www.sendmail.org/m4/tweaking_config.html#confDONT_PROBE_INTERFACES

> I don't know if I
> completely understood your localtable setup, but it appeared to
> me to be more of an aliases workalike than a virtusertable workalike,
> and I wasn't sure if it worked with or clashed with virtual hosting?

I created localtable "long time" before RTCyrus2. localtable works only for 
local email domains ($=w), its support is located in rule set 5 where only 
user part of recipient address is available. localtable *DOES NOT* support 
cyrus virtual domains.

http://anfi.homeunix.net/sendmail/localtab.html

> The only other info I've been able to find is someone else
> trying to do the same thing as me (I think!) :
> 
> http://www.mail-archive.com/gentoo-user@gentoo.org/msg36862.html
> 
> So ... I *think* what I need to be able to do is get
> sendmail to run the virtusertable, then the mailertable (and
> thus pass the mail to cyrusv2d via the mailertable).  Is
> this possible?  Does cyrus imapd offer any form of aliasing
> within itself instead of using a virtusertable through sendmail?

With RTCyrus2 you can
* use virtusertable first
* use mailertable mrs_cyrus_mailertable:*  entry for
    * delivering to existing cyrus address (user at domain) via cyrusv2d mailer
    * defining relay for "remaining addresses" e.g.

sample mailertable entries:
# reject addresses cyrus does not know about
foo.com.au   mrs_cyrus_mailertable:error:5.1.1:550 User unknown
# deliver addresses cyrus does not know about to catchall_echidna alias
bl.echidna.id.au    mrs_cyrus_mailertable:local:catchall_echidna

Do not forget to add the domains to $={VirtHost}. *.mc file:
LOCAL_CONFIG
C{VirtHost}foo.com.au bl.echidna.id.au

Read carefully about side effect of using VIRTUSER_DOMAIN or 
VIRTUSER_DOMAIN_FILE before applying them.

http://anfi.homeunix.net/sendmail/rtcyrus2.html
*RTCyrus2 supports cyrus virtual domains.*

> Thanks again for your time!


-- 
Andrzej [en:Andrew] Adam Filip anfi at priv.onet.pl anfi at xl.wp.pl
http://anfi.homeunix.net/ http://slashdot.org/~anfi
---
Home Page: http://asg.web.cmu.edu/cyrus
Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list