Delivering to user@domain versus user@host.domain

Christian Schulte cs at schulte.it
Sat May 24 07:03:46 EDT 2003


Don Doumakes wrote:

>
> On 2003.05.23 20:27:36 -0500 Christian Schulte wrote:
>
>> Don Doumakes wrote:
>>
>>>
>>> On 2003.05.22 23:50:43 -0500 Christian Schulte wrote:
>>>
>>>> How does sendmail get its local name ? What happens if you put
>>>>
>>>> LOCAL_CONFIG
>>>> Cwcannibals.org
>>>>
>>>> in your sendmail.mc file ? Does that change anything ?
>>>
>>>
>>>
>>> My sendmail gets the local name from /etc/mail/local-host-names, 
>>> which contains "donner.cannibals.org" and "cannibals.org."  I get 
>>> the same result if I delete the "donner.cannibals.org" line from 
>>> local-host-names, and if I use "Cwcannibals.org."
>>>
>>> So I rebuilt sendmail.cf from scratch.  My sendmail.mc file is:
>>>
>>>
>>> # $Id: cyrusv2.mc,v 1.4 2001/08/23 23:26:56 leg Exp $
>>>
>>> divert(0)dnl
>>> VERSIONID(`cyrus v2 sample configuartion')
>>>
>>> OSTYPE(linux)
>>> define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')
>>> define(`confTO_IDENT',`0')
>>>
>>> dnl setting cyrus as the trusted user will make it easier to pass
>>> dnl Sendmail's safefile checks.  however, it means that someone with 
>>> the
>>> dnl "cyrus" password could easily become root.
>>> dnl define(`confTRUSTED_USER', `cyrus')
>>>
>>> define(`confLOCAL_MAILER', `cyrusv2')
>>>
>>> dnl if you aren't using Sendmail 8.12, you might need to remove
>>> dnl the following feature.
>>> FEATURE(`preserve_local_plus_detail')
>>> FEATURE(`nocanonify')
>>> FEATURE(`always_add_domain')
>>> MAILER(`cyrusv2')
>>> MAILER(`local')
>>> MAILER(`smtp')
>>>
>>> MAILER_DEFINITIONS
>>> Mcyrusv2,    P=[IPC], F=lsDFMnqA@/:|SmXz, E=\r\n,
>>>     S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, 
>>> T=DNS/RFC822/X-Unix,      A=FILE /var/imap/socket/lmtp
>>>
>>> LOCAL_RULE_0
>>> Rbb + $+ < @ $=w . >    $#cyrusv2 $: + $1
>>>
>>>
>>> Among the several variations of the above that also don't work, was 
>>> one in which I used FEATURE(`use_cw_file').
>>>
>>> After sending email to testuser at cannibals.org, /var/log/maillog says:
>>>
>>> May 23 18:49:42 donner sendmail[4424]: h4NNngTj004424: from=root, 
>>> size=97, class=0, nrcpts=1, 
>>> msgid=<200305232349.h4NNngTj004424 at donner.cannibals.org>, 
>>> relay=root at localhost
>>> May 23 18:49:43 donner sendmail[4426]: h4NNnhrI004426: 
>>> from=<root at donner.cannibals.org>, size=330, class=0, nrcpts=1, 
>>> msgid=<200305232349.h4NNngTj004424 at donner.cannibals.org>, 
>>> proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
>>> May 23 18:49:43 donner sendmail[4424]: h4NNngTj004424: 
>>> to=testuser at cannibals.org, ctladdr=root (0/0), delay=00:00:01, 
>>> xdelay=00:00:01, mailer=relay, pri=30069, relay=[127.0.0.1] 
>>> [127.0.0.1], dsn=2.0.0, stat=Sent (h4NNnhrI004426 Message accepted 
>>> for delivery)
>>> May 23 18:49:43 donner sendmail[4428]: h4NNnhrI004426: 
>>> to=<testuser at cannibals.org>, delay=00:00:00, xdelay=00:00:00, 
>>> mailer=cyrusv2, pri=30302, relay=localhost, dsn=5.1.1, stat=User 
>>> unknown
>>> May 23 18:49:43 donner sendmail[4428]: h4NNnhrI004426: 
>>> h4NNnhrI004428: DSN: User unknown
>>> May 23 18:49:43 donner sendmail[4428]: h4NNnhrI004428: 
>>> to=<root at donner.cannibals.org>, delay=00:00:00, xdelay=00:00:00, 
>>> mailer=cyrusv2, pri=31354, relay=localhost [[UNIX: 
>>> /var/imap/socket/lmtp]], dsn=5.1.1, stat=User unknown
>>> May 23 18:49:43 donner sendmail[4428]: h4NNnhrI004428: 
>>> h4NNnhrJ004428: return to sender: User unknown
>>> May 23 18:49:43 donner sendmail[4428]: h4NNnhrJ004428: to=root, 
>>> delay=00:00:00, xdelay=00:00:00, mailer=cyrusv2, pri=32378, 
>>> relay=localhost [[UNIX: /var/imap/socket/lmtp]], dsn=5.1.1, 
>>> stat=User unknown
>>> May 23 18:49:43 donner sendmail[4428]: h4NNnhrI004428: Losing 
>>> ./qfh4NNnhrI004428: savemail panic
>>> May 23 18:49:43 donner sendmail[4428]: h4NNnhrI004428: SYSERR(root): 
>>> savemail: cannot save rejected email anywhere
>>>
>>>
>>> ...and /var/log/imapd.log says:
>>>
>>> May 23 18:49:43 donner lmtpunix[4429]: lmtp connection preauth'd as 
>>> postman
>>> May 23 18:49:43 donner lmtpunix[4429]: append_check() of 
>>> 'donner.cannibals.org!user.testuser' failed May 23 18:49:43 donner 
>>> lmtpunix[4429]: append_check() of 'donner.cannibals.org!user.root' 
>>> failed May 23 18:49:43 donner lmtpunix[4429]: append_check() of 
>>> 'donner.cannibals.org!user.root' failed
>>
>>
>> So the problem is sendmail appending donner.cannibals.org to all 
>> local names instead of just cannibals.org. The behaviour sendmail 
>> appending the fqdn of the host which it is running on is normal!  
>> There are different solutions for your problem depending on your 
>> needs.  What setup are you planning exactly ? Do you want to have 
>> user logins like user at cannibals.org and cannibals.org be your _only_ 
>> domain or are you planning to setup user logins like 
>> user at cannibals.org,user at other-domain.org, user at just-another-domain.org ?
>
>
> Definitely want to have user1 at domain1.org, user1 at domain2.org, etc., 
> i.e. virtual domains.  I'm currently hosting web sites for multiple 
> domains, and without virtual domain support I have to hand-sort email 
> to webmaster at thisdomain from email to webmaster at thatdomain.
>
>> I have sendmail-8.12.9 running with cyrus-2.2 and do local delivery 
>> by confLOCAL_MAILER(cyrusv2) and everything works but that was only 
>> possible by patching cf/m4/proto.m4 to make sendmail recognize 
>> user at domain as regular local name. [snip]
>
>
> Sounds like exactly what I need.  Would you share the patched version 
> of proto.m4?
>
>> >With this configuration, I'm able to create a mailbox named 
>> user.don at donner.cannibals.org.  I can log in to that account, and 
>> deliver to the mailbox.
>>
>> That is because sendmail appends  donner.cannibals.org to all 
>> unqualified local names
>>
>> >I then modify /etc/imapd.conf so the "admins" and "loginrealms" 
>> entries are no longer donner.cannibals.org but rather cannibals.org.  
>> (Of course I clean up from the first experiment, restart imapd and 
>> all that.)
>> >Now I can create a mailbox named user.don at cannibals.org.
>>
>> Can you setup a global admin (that is an admin without @domain in the 
>> imapd.conf admins line) and create both mailboxes ?
>
>
> Nope.  Tried this several ways, but can't do it.  Which isn't 
> necessarily a problem:  I can live with the inconvenience of having 
> several domain-level admin accounts.
>
>> >I can log in, but if I attempt to deliver mail to don at cannibals.org 
>> I get a "User unknown" error.
>>
>> You deleted the @donner.cannbials.org mailbox before ? So delivery 
>> did not stop working and would work correctly if you would create the 
>> mailbox @donner.cannibals.org ?
>
>
> Precisely.
>
>> Another guess I cannot try here myself  but which should work:
>>
>> Set defaultdomain in imapd.conf to cannibals.org. Now every user who 
>> logs in @cannibals.org gets to the mailbox on the defaultdomain and 
>> sendmail does not need to append @cannibals.org while talking LMTP to 
>> cyrus to deliver to that domain. (That only works if you do not need 
>> more than one domain supported of course)
>> [snip]
>
>

Here is the patch to proto.m4! Added one line and changed two. I got
this from someone on this list here a few months ago and it solved all
my problems but be warned that this heavily influences sendmail and may
leed to trouble. I am using it since months without any problems though....
In order to make this work be sure that your cyrusv2 mailer definition
contains S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL because local names now
have @domain in them and local mailer can use the rewriting rules
EnvToL/HdrToL
If you plan to use virtusertable feature this also has a huge influence.
You definetely want to

define(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_', `true')dnl

and do routing in virtusertable like

account at domain   account at domain
anotherone at domain   anotherone at domain
@domain   thirdone at domain

with account at domain,anotherone at domain,thirdone at domain all beeing
mailboxes with theire logins.

If you get the error map macro not found or something like that you also
have to

define(`_NEED_MACRO_MAP_',`1')dnl

to get onelevel-recursion working!

This is all I needed to get it up and running! Hope this helps....

--Christian


*** /root/sendmail-8.12.9/cf/m4/proto.m4 Fri Mar 28 18:20:53 2003

--- /home/schulte/sendmail-8.12.9/cf/m4/proto.m4	Fri Apr 25 22:00:03 2003
***************
*** 1098,1105 ****
  dnl $H empty (but @$=w.)
  R< > $+ + $* < $+ >	$#_LOCAL_ $: $1 + $2		plussed name?
  R< > $+ < $+ >		$#_LOCAL_ $: @ $1			nope, local address',
! `R$=L < @ $=w . >	$#_LOCAL_ $: @ $1			special local names
! R$+ < @ $=w . >		$#_LOCAL_ $: $1			regular local name')

  ifdef(`_MAILER_TABLE_', `dnl
  # not local -- try mailer table lookup
--- 1098,1107 ----
  dnl $H empty (but @$=w.)
  R< > $+ + $* < $+ >	$#_LOCAL_ $: $1 + $2		plussed name?
  R< > $+ < $+ >		$#_LOCAL_ $: @ $1			nope, local address',
! `R$=L < @ $=w . >	$#_LOCAL_ $: @ $1`@'$2			secial local names
! R$+ < @ $j . >		$#_LOCAL_ $: $1				leave untouched if @$j
! R$+ < @ $=w . >		$#_LOCAL_ $: $1`@'$2			regular local name')
!

  ifdef(`_MAILER_TABLE_', `dnl
  # not local -- try mailer table lookup








More information about the Info-cyrus mailing list