On 03/03/16 08:58, wilfried.es...@essignetz.de wrote:
>> I was guessing that this would have to be aliased but didn't see it in the 
>> documentation for
>> canonical. Is it the correct way to set up full.name mapping to local users? 
>> Also I'm more used to
>> sendmail and qmail. This is my first time configuring postfix.
> 
> Correct is probably the wrong word.
> 
> If you need mailadresses, that aren't the same as loginnames or
> mailboxnames, you have to define aliases. For me, using aliases, instead
> of internal usernames, is the usual way. But, usually, i don't use
> canonical for that. Maybe it makes sense, when changing from mailaddress
> scheme "firstname" to, e.g.,  "first.lastname".
> 
> You can define aliases also in virtual table.
> 

Still wading through the doco. From what I can determine /etc/postfix/canonical 
is used to rewrite
the envelope and headers. From the doco 
http://www.postfix.org/ADDRESS_REWRITING_README.html:

---8<---
Canonical address mapping

The cleanup(8) daemon uses the canonical(5) tables to rewrite addresses in 
message envelopes and in
message headers. By default all header and envelope addresses are rewritten; 
this is controlled with
the canonical_classes configuration parameter.

---8<---
Local alias database

When mail is to be delivered locally, the local(8) delivery agent runs each 
local recipient name
through the aliases(5) database. The mapping does not affect addresses in 
message headers. Local
aliases are typically used to implement distribution lists, or to direct mail 
for standard aliases
such as postmaster to real people. The table can also be used to map 
"Firstname.Lastname" addresses
to login names.
---8<---

My apologies that I didn't read _all_ the doco before attempting the mapping. 
So my understanding is
now that the /etc/postfix/canonical file allows envelope and header rewrites to 
the final delivered
email but /etc/aliases is used to create the actual mapping for 
firsname.lastname to a local user
and that is necessary for successful delivery of email.

So, if out of two users, shaun and tom and I have only canonicalised tom as 
follows:
/etc/aliases:
shaun.fielder: shaun
tom.robinson: tom

/etc/postfix/canonical:
tom tom.robinson

Using sendmail to generate a report helps explain what happens:

/usr/sbin/sendmail -bv tom

in the report I can see the mail is deliverable to the local user 
(t...@motec.com.au) but the To: is
rewritten to tom.robin...@motec.com.au:

---8<---
                   The mail system

<t...@motec.com.au> (expanded from <tom>): delivery via local: delivers to
    maildir

---8<---

Final-Recipient: rfc822; t...@motec.com.au
Original-Recipient: rfc822; tom
Action: deliverable
Status: 2.0.0
Diagnostic-Code: X-Postfix; delivery via local: delivers to maildir

--66BDF295D.1456957031/camber.motec.com.au
Content-Description: Message Headers
Content-Type: text/rfc822-headers

Return-Path: <r...@motec.com.au>
Received: by camber.motec.com.au (Postfix, from userid 0)
        id 66BDF295D; Thu,  3 Mar 2016 09:17:11 +1100 (AEDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 camber.motec.com.au 66BDF295D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motec.com.au;
        s=mail.motec.com.au; t=1456957031;
        bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
        h=From:Subject:To:Date:From;
        b=dWhEOD1NdRiFqTz/bHCytLEWfZiuQiqi1nSY058RhH3oZsZ44SWvPe3ihAUfHlOA3
         fNK39lnH5+dejADrx++k03VXgyjfNLL54+lyiQuCU2OnJrRQoJP8ll1KShgm7AvPlv
         +cMeDrR1mXrzHC8nEDsQch3cjzD9+STDmph6Ko+E=
From: r...@motec.com.au
Subject: probe
To: tom.robin...@motec.com.au
Message-Id: <20160302221711.66bdf2...@camber.motec.com.au>
Date: Thu,  3 Mar 2016 09:17:11 +1100 (AEDT)

--66BDF295D.1456957031/camber.motec.com.au--
---8<---

Using sendmail again for user shaun (who has _no_ canonicalisation to 
firstname.lastname):

/usr/sbin/sendmail -bv shaun

in the report I can see the mail is deliverable to the local user 
(sh...@motec.com.au) but the To:
is unchanged:

---8<---
                   The mail system

<sh...@motec.com.au> (expanded from <shaun>): delivery via local: delivers to
    maildir

---8<---

Final-Recipient: rfc822; sh...@motec.com.au
Original-Recipient: rfc822; shaun
Action: deliverable
Status: 2.0.0
Diagnostic-Code: X-Postfix; delivery via local: delivers to maildir

--D8F30295D.1456957257/camber.motec.com.au
Content-Description: Message Headers
Content-Type: text/rfc822-headers

Return-Path: <r...@motec.com.au>
Received: by camber.motec.com.au (Postfix, from userid 0)
        id D8F30295D; Thu,  3 Mar 2016 09:20:56 +1100 (AEDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 camber.motec.com.au D8F30295D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=motec.com.au;
        s=mail.motec.com.au; t=1456957256;
        bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
        h=From:Subject:To:Date:From;
        b=VZaX2Z1dmJy+X6qXe28KFco8blbjQ6kNJM5XyQR+Y1Q7mHlTqvbrHAfEETF6rHp+A
         3TmA1fPc3Cb0V7MAJzi2It76CkNvB6ODciiuxNThl/AnV/5yr724zco1MoHGF6/xsH
         vMNOYc6UAGdfVrZ67mK7orGu4XlBY7jUQXEXTlU8=
From: r...@motec.com.au
Subject: probe
To: sh...@motec.com.au
Message-Id: <20160302222056.d8f302...@camber.motec.com.au>
Date: Thu,  3 Mar 2016 09:20:56 +1100 (AEDT)

--D8F30295D.1456957257/camber.motec.com.au--
---8<---

There's more control to be gained through the canonical_classes which defaults 
to envelope_sender,
envelope_recipient, header_sender, header_recipient rewrites. Also you can 
specifically canonicalise
just sender or recipient classes through 
/etc/postfix/{sender,recipient}_canonical.

Finally, from the doco http://www.postfix.org/ADDRESS_REWRITING_README.html 
Virtual aliases can be
used to transform Firstname.Lastname to local users but confirms that local 
aliases may be more
appropriate:

---8<---
Virtual aliasing

Before writing the recipients to the queue file, the cleanup(8) daemon uses the 
optional virtual(5)
alias tables to redirect mail for recipients. The mapping affects only envelope 
recipient addresses;
it has no effect on message headers or envelope sender addresses. Virtual alias 
lookups are useful
to redirect mail for virtual alias domains to real user mailboxes, and to 
redirect mail for domains
that no longer exist. Virtual alias lookups can also be used to transform " 
Firstname.Lastname "
back into UNIX login names, although it seems that local aliases may be a more 
appropriate vehicle.
---8<---

Thanks Willi for keeping me sane and providing the key to unlocking this. 
Hopefully I've understood
it now. Any comments are welcome.

Kind regards,
Tom

-- 

Tom Robinson
IT Manager/System Administrator

MoTeC Pty Ltd

121 Merrindale Drive
Croydon South
3136 Victoria
Australia

T: +61 3 9761 5050
F: +61 3 9761 5051
E: tom.robin...@motec.com.au

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to