Delivering to user@domain versus user@host.domain
Christian Schulte
cs at schulte.it
Fri May 23 21:27:36 EDT 2003
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 ?
If you only need one domain cannibals.org you do not need virtual domain
support at all because everything can be kept in the servers' default
domain but if you do plan to use more than one domain things get more
difficult. 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. For me that was needed because I have
plenty of domains and need to spearate user1 at domain1.org and
user1 at domain2.org and need full routing possibilities for all domains.
All things you will not need if you do not need user1 at domain and
user1 at otherdomain !
>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 ?
>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 ?
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) To make sendmail stop
appending the domain you will have to change your cyrusv2.mc definition
back to its original: S=EnvFromSMTP/HdrFromL, R=EnvToL/HdrToL
After making these changes sendmail should do local delivery to
"user at cannibals.org" with the cyrusv2 mailer which does a lmtp-delivery
to just "user" without @domain and cyrus will store the mail in
"users.user.inbox" which can be accessed by user at cannibals.org login
because @cannibals.org gets stripped if set as defaultdomain!
--Christian
More information about the Info-cyrus
mailing list