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

forward mail & deliver it locally

Expand Messages
  • Aaron Bennett
    Hi, I need to be able to BOTH forward email and, optionally, deliver it locally as well. I think I ve gone about this wrong but it s easy to change...
    Message 1 of 5 , Aug 4, 2008
    • 0 Attachment
      Hi,

      I need to be able to BOTH forward email and, optionally, deliver it
      locally as well. I think I've gone about this wrong but it's easy to
      change...

      Everything is in ldap. I've been using virtual_alias_maps to hold the
      forwarding information. What happens there though is that if it hits
      there it never tries to store the mail locally. What I want is to
      figure out how to get this behavior:

      1. If user has forwarding set, forward the mail
      2. if user wants local deliver, deliver it locally

      These are independent of each other and are easily determined from ldap.

      I know I'm missing out on some easy way to do this.

      Thanks,

      Aaron Bennett
    • Magnus Bäck
      On Monday, August 04, 2008 at 15:56 CEST, ... Set up an alias on the following form: user@example.com user@example.com,user@example.net In your
      Message 2 of 5 , Aug 4, 2008
      • 0 Attachment
        On Monday, August 04, 2008 at 15:56 CEST,
        Aaron Bennett <abennett@...> wrote:

        > I need to be able to BOTH forward email and, optionally, deliver it
        > locally as well. I think I've gone about this wrong but it's easy to
        > change...
        >
        > Everything is in ldap. I've been using virtual_alias_maps to hold the
        > forwarding information. What happens there though is that if it hits
        > there it never tries to store the mail locally. What I want is to
        > figure out how to get this behavior:
        >
        > 1. If user has forwarding set, forward the mail
        > 2. if user wants local deliver, deliver it locally
        >
        > These are independent of each other and are easily determined from
        > ldap.

        Set up an alias on the following form:

        user@... user@...,user@...

        In your LDAP map configuration this could translate to something like:

        query_filter = mail=%s
        result_attribute = mail, mailForwardingAddress

        Obviously depending on your LDAP schema.

        --
        Magnus Bäck
        magnus@...
      • Aaron Bennett
        ... Does that go in $alias_maps or $virtual_alias_maps? I have three ldap maps working: ldap-localonly.cf ldap-forwardonly.cf ldap-forwardkeep.cf When I query
        Message 3 of 5 , Aug 4, 2008
        • 0 Attachment
          Magnus Bäck wrote:
          >
          > Set up an alias on the following form:
          >
          > user@... user@...,user@...
          >
          > In your LDAP map configuration this could translate to something like:
          >
          > query_filter = mail=%s
          > result_attribute = mail, mailForwardingAddress
          >


          Does that go in $alias_maps or $virtual_alias_maps?

          I have three ldap maps working:

          ldap-localonly.cf
          ldap-forwardonly.cf
          ldap-forwardkeep.cf

          When I query them with postmap -q email@..., I get the right thing:

          if the user is set up just to get their local mail, I get:
          user@... as a result from ldap-localonly.cf and nothing from the
          other
          if they are set to forward their mail and keep it locally, I get:
          user@...,user@...
          if they are set to just forward and not keep it, I get: user@...

          however, it's not forwarding, it's just doing local delivery


          [root@maildrop postfix]# postconf -n
          alias_database = hash:/etc/aliases
          alias_maps = hash:/etc/aliases,
          proxy:ldap:/etc/postfix/ldap-forwardonly.cf,
          proxy:ldap:/etc/postfix/ldap-forwardkeep.cf,
          proxy:ldap:/etc/postfix/ldap-localonly.cf
          broken_sasl_auth_clients = yes
          command_directory = /usr/sbin
          config_directory = /etc/postfix
          daemon_directory = /usr/libexec/postfix
          debug_peer_level = 1
          default_destination_concurrency_limit = 50
          default_process_limit = 500
          home_mailbox =
          html_directory = no
          inet_interfaces = all
          local_recipient_maps = $alias_maps
          mail_owner = postfix
          mail_spool_directory = /export/maildirs/
          mailq_path = /usr/bin/mailq.postfix
          manpage_directory = /usr/share/man
          mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
          depot.bwh.harvard.edu, maildrop.bwh.harvard.edu, bwh.harvard.edu,
          spl.harvard.edu
          mynetworks = 134.174.8.0/24, 134.174.9.0/24, 134.174.54.0/24,
          170.223.221.0/24, 155.52.0.0/16
          mynetworks_style = host
          newaliases_path = /usr/bin/newaliases.postfix
          queue_directory = /var/spool/postfix
          readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
          sample_directory = /usr/share/doc/postfix-2.3.3/samples
          sendmail_path = /usr/sbin/sendmail.postfix
          setgid_group = postdrop
          smtp_tls_note_starttls_offer = yes
          smtp_use_tls = yes
          smtpd_client_connection_count_limit = 500
          smtpd_recipient_restrictions = permit_sasl_authenticated,
          permit_mynetworks, reject
          smtpd_sasl_auth_enable = yes
          smtpd_sasl_local_domain =
          smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks
          smtpd_tls_CAfile = /etc/pki/smtp.bwh.harvard.edu.pem
          smtpd_tls_auth_only = yes
          smtpd_tls_cert_file = /etc/pki/smtp.bwh.harvard.edu.pem
          smtpd_tls_key_file = /etc/pki/smtp.bwh.harvard.edu.pem
          smtpd_tls_loglevel = 1
          smtpd_tls_received_header = yes
          smtpd_tls_session_cache_timeout = 3600s
          smtpd_use_tls = yes
          unknown_local_recipient_reject_code = 550
        • Magnus Bäck
          On Monday, August 04, 2008 at 20:49 CEST, ... This particular example is meant for virtual aliases, but if you adjust it so that it expects the lookup key to
          Message 4 of 5 , Aug 4, 2008
          • 0 Attachment
            On Monday, August 04, 2008 at 20:49 CEST,
            Aaron Bennett <abennett@...> wrote:

            > Magnus Bäck wrote:
            >
            > > Set up an alias on the following form:
            > >
            > > user@... user@...,user@...
            > >
            > > In your LDAP map configuration this could translate to something like:
            > >
            > > query_filter = mail=%s
            > > result_attribute = mail, mailForwardingAddress
            >
            > Does that go in $alias_maps or $virtual_alias_maps?

            This particular example is meant for virtual aliases, but if you adjust
            it so that it expects the lookup key to be the bare username it'll work
            with local aliases as well.

            query_filter = uid=%s
            result_attribute = mail, mailForwardingAddress

            > I have three ldap maps working:
            >
            > ldap-localonly.cf
            > ldap-forwardonly.cf
            > ldap-forwardkeep.cf
            >
            > When I query them with postmap -q email@..., I get the right
            > thing:
            >
            > if the user is set up just to get their local mail, I get:
            > user@... as a result from ldap-localonly.cf and nothing from
            > the other
            > if they are set to forward their mail and keep it locally, I get:
            > user@...,user@...
            > if they are set to just forward and not keep it, I get: user@...
            >
            > however, it's not forwarding, it's just doing local delivery
            >
            >
            > [root@maildrop postfix]# postconf -n
            > alias_database = hash:/etc/aliases
            > alias_maps = hash:/etc/aliases,
            > proxy:ldap:/etc/postfix/ldap-forwardonly.cf,
            > proxy:ldap:/etc/postfix/ldap-forwardkeep.cf,
            > proxy:ldap:/etc/postfix/ldap-localonly.cf

            That's because you've set these up as local aliases, but then the lookup
            key is the bare username.

            [...]

            --
            Magnus Bäck
            magnus@...
          • Aaron Bennett
            ... Thank you, that works.
            Message 5 of 5 , Aug 4, 2008
            • 0 Attachment
              Magnus Bäck wrote:
              >
              >> Does that go in $alias_maps or $virtual_alias_maps?
              >>
              >
              > This particular example is meant for virtual aliases, but if you adjust
              > it so that it expects the lookup key to be the bare username it'll work
              > with local aliases as well.
              >
              >
              >
              Thank you, that works.
            Your message has been successfully submitted and would be delivered to recipients shortly.