Loading ...
Sorry, an error occurred while loading the content.

using alias_maps and virtual_alias_maps hand-in-hand

Expand Messages
  • LEVAI Daniel
    Hi! I thought I could combine (chain together) my alias_{database,maps} tables with my virtual_alias_maps table. I figured that if I specify in my aliases
    Message 1 of 2 , Dec 13, 2012
    • 0 Attachment
      Hi!

      I thought I could combine (chain together) my alias_{database,maps}
      tables with my virtual_alias_maps table.
      I figured that if I specify in my aliases table:
      root: daniell
      and in my virtual table:
      daniell daniell@email_address
      then mails for root from localhost would end up in the specified
      daniell@email_address mailbox (on another machine, using relayhost).

      Unfortunatelly sending mail to root ends up in the local mailbox of the
      daniell user, altough sending mail to the daniell user ends up in the
      daniell@email_address mailbox.

      Now I know that I could simply change the alias table to forward mails
      for root to the daniell@email_address address, but I can't help but to
      remain curious about how could I make the above chaining work.

      # postconf -n
      alias_database = hash:/etc/aliases
      alias_maps = hash:/etc/aliases
      append_dot_mydomain = no
      biff = no
      config_directory = /etc/postfix
      inet_interfaces = loopback-only
      inet_protocols = ipv4
      mailbox_size_limit = 0
      mydestination = <hostname>, localhost.localdomain, localhost
      myhostname = <hostname>
      mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
      readme_directory = no
      recipient_delimiter = +
      relayhost = [<relayhost>]
      smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
      smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
      smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
      smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
      smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
      smtpd_use_tls = yes
      virtual_alias_maps = hash:/etc/postfix/virtual


      Thanks,
      Daniel

      --
      LÉVAI Dániel
      PGP key ID = 0x83B63A8F
      Key fingerprint = DBEC C66B A47A DFA2 792D 650C C69B BE4C 83B6 3A8F
    • Viktor Dukhovni
      ... The local(8) delivery agent does not recurse into virtual(5) alias expansion when expanding local aliases(5). If an address on the right side of an alias
      Message 2 of 2 , Dec 13, 2012
      • 0 Attachment
        On Thu, Dec 13, 2012 at 10:55:35AM +0100, LEVAI Daniel wrote:

        > I thought I could combine (chain together) my alias_{database,maps}
        > tables with my virtual_alias_maps table.
        > I figured that if I specify in my aliases table:
        > root: daniell
        > and in my virtual table:
        > daniell daniell@email_address
        > then mails for root from localhost would end up in the specified
        > daniell@email_address mailbox (on another machine, using relayhost).

        The local(8) delivery agent does not recurse into virtual(5) alias
        expansion when expanding local aliases(5). If an address on the
        right side of an alias resolves to a domain in $mydestination (after
        append_at_myorigin or append_to_mydomain as required) it is delivered
        in by the same delivery agent after additional aliases(5) expansion,
        and is not reprocessed as a new message via cleanup(8).

        This is for compatibility with legacy Sendmail behaviour with
        respect to loop-detection, ...

        My approach is to handle all mail forwarding in virtual_alias_maps,
        and to ensure that the domain behind "$myorigin" is NOT listed in
        "$mydestination". Rather "mydestination = localhost.$mydomain" or
        perhaps even "mydestination = localhost.invalid", and mail only
        ends up in the local mailer's clutches when explicitly forced there
        via a rewrite:

        mailbox@domain local-mailbox@...

        When local-mailbox is expanded via aliases(5), the only addresses
        on the right side of aliases that end up in mailboxes rather than
        forwarded back into the queue for reprocessing are those that
        explicitly resolve to the local domain:

        local-mailbox: foo, bar@...

        The "foo@$myorigin" recipient will be forwarded back into the
        queue for processing via cleanup(8), (thus virtual(5), ...),
        while bar@... will be delivered directly.

        The local(8) delivery agent is legacy Sendmail compatibility, use
        it sparingly. Its most useful feature is ":include:" support for
        integration with mailing-list managers.

        Very few people still read email out of mbox files in /var/spool/mail,
        an MTA typically delivers email into a mail-store (Dovecot, Cyrus, ...)
        and the legacy support in local(8) should be used exclusively for any
        pipe targets that can't easily be supported by other means and for
        ":include:" lists. Don't use aliases(5) for mail forwarding to rfc822
        addresses, that's what virtual(5) is for.

        --
        Viktor.
      Your message has been successfully submitted and would be delivered to recipients shortly.