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

SMTP gateway and multiple delivery hosts. Am I crazy?

Expand Messages
  • Mark Krenz
    Hi. I m working on a new e-mail architecture for suso.org that will allow us to scale a bit easier by allowing us to break up which server different users on
    Message 1 of 9 , Dec 16, 2007
      Hi. I'm working on a new e-mail architecture for suso.org that will
      allow us to scale a bit easier by allowing us to break up which server
      different users on the same domain are hosted on. I made this image to
      kinda demonstrate what I'm after.

      http://suso.suso.org/mediafiles/new-email-architecture.png

      There is more to it than is shown here. Mail will be delivered
      through maildrop (which also can look in the delivery database for
      virtual accounts). Also, I've left remote mail sending out of this.
      There will eventually be a seperate host that users use to send mail
      from their off-server clients.

      Am I crazy to want to be able to have an SMTP gateway and be able to
      divide up the delivery of individual addresses within a domain? Most of
      the docs I'm reading talk about sending the mail for everything on a
      domain to a specific host, but not on an address by address basis.

      I wish I could find someone else who is doing exactly what I'm trying
      to do. I keep finding documents that talk about forwarding a whole
      domain to a delivery host, but that's not what I want to do. I want to
      be able to say info@... goes to delivery host 1 and
      fred@... goes to delivery host 2. Plus I need to make sure that
      when someone on host 1 sends mail to fred@... that it goes to
      host 2 and doesn't try to be delivered to host 1.

      Is this even possible? Any suggestions or documents that you can
      point me too? I have this mostly configured and working but I'm running
      into issues sending between host 1 and 2. It tries to deliver it
      locally.

      Thanks for any help,
      Mark

      --
      Mark S. Krenz
      IT Director
      Suso Technology Services, Inc.
      http://suso.org/
    • Sandy Drobic
      ... man 5 transport Postfix can route user-specific. /etc/postfix/transport: user1@example.com smtp:[host1.example.com] user2@example.com
      Message 2 of 9 , Dec 17, 2007
        Mark Krenz wrote:

        > domain to a delivery host, but that's not what I want to do. I want to
        > be able to say info@... goes to delivery host 1 and
        > fred@... goes to delivery host 2. Plus I need to make sure that
        > when someone on host 1 sends mail to fred@... that it goes to
        > host 2 and doesn't try to be delivered to host 1.
        >
        > Is this even possible? Any suggestions or documents that you can
        > point me too? I have this mostly configured and working but I'm running
        > into issues sending between host 1 and 2. It tries to deliver it
        > locally.

        man 5 transport

        Postfix can route user-specific.

        /etc/postfix/transport:
        user1@... smtp:[host1.example.com]
        user2@... smtp:[host2.example.com]
        example.com smtp:[host3.example.com]

        Please be aware that the transport table is very sensitive to delays and
        MUST be available for Postfix to work. If you decide to use a database to
        store the transport information make sure the database is responsive and
        stable.


        --
        Sandy

        List replies only please!
        Please address PMs to: news-reply2 (@) japantest (.) homelinux (.) com
      • mouss
        ... This has come multiple times on the list. There are at least two ways to implement it: 1- use virtual_alias_maps to rewrite foo@example.com to
        Message 3 of 9 , Dec 17, 2007
          Mark Krenz wrote:
          > Hi. I'm working on a new e-mail architecture for suso.org that will
          > allow us to scale a bit easier by allowing us to break up which server
          > different users on the same domain are hosted on. I made this image to
          > kinda demonstrate what I'm after.
          >
          > http://suso.suso.org/mediafiles/new-email-architecture.png
          >
          > There is more to it than is shown here. Mail will be delivered
          > through maildrop (which also can look in the delivery database for
          > virtual accounts). Also, I've left remote mail sending out of this.
          > There will eventually be a seperate host that users use to send mail
          > from their off-server clients.
          >
          > Am I crazy to want to be able to have an SMTP gateway and be able to
          > divide up the delivery of individual addresses within a domain? Most of
          > the docs I'm reading talk about sending the mail for everything on a
          > domain to a specific host, but not on an address by address basis.
          >
          > I wish I could find someone else who is doing exactly what I'm trying
          > to do. I keep finding documents that talk about forwarding a whole
          > domain to a delivery host, but that's not what I want to do. I want to
          > be able to say info@... goes to delivery host 1 and
          > fred@... goes to delivery host 2. Plus I need to make sure that
          > when someone on host 1 sends mail to fred@... that it goes to
          > host 2 and doesn't try to be delivered to host 1.
          >
          > Is this even possible? Any suggestions or documents that you can
          > point me too? I have this mostly configured and working but I'm running
          > into issues sending between host 1 and 2. It tries to deliver it
          > locally.
          >

          This has come multiple times on the list. There are at least two ways to
          implement it:

          1- use virtual_alias_maps to rewrite foo@... to
          foo@.... If using multiple domains with possibly the same
          user-parts, then rewrite to foo=example.com@.... you can
          then use smtp_generic_maps to rewrite
          /^(.*)=(example\.com)@host\d+\.example\.org$/ $1@$2

          2- use per-user transports
          foo@... relay:[host3.example.com]

          Note that transport maps are "latency sensitive". If you have
          performance issues, use the virtual alias method.
        • Listaccount
          ... If you need more performance you should use virtual alias maps to rewrite every e-mail address to some machine specific user account like this :
          Message 4 of 9 , Dec 17, 2007
            Zitat von Sandy Drobic <postfix-users@...>:

            > Mark Krenz wrote:
            >
            >> domain to a delivery host, but that's not what I want to do. I want to
            >> be able to say info@... goes to delivery host 1 and
            >> fred@... goes to delivery host 2. Plus I need to make sure that
            >> when someone on host 1 sends mail to fred@... that it goes to
            >> host 2 and doesn't try to be delivered to host 1.
            >>
            >> Is this even possible? Any suggestions or documents that you can
            >> point me too? I have this mostly configured and working but I'm running
            >> into issues sending between host 1 and 2. It tries to deliver it
            >> locally.
            >
            > man 5 transport
            >
            > Postfix can route user-specific.
            >
            > /etc/postfix/transport:
            > user1@... smtp:[host1.example.com]
            > user2@... smtp:[host2.example.com]
            > example.com smtp:[host3.example.com]
            >
            > Please be aware that the transport table is very sensitive to delays and
            > MUST be available for Postfix to work. If you decide to use a database to
            > store the transport information make sure the database is responsive and
            > stable.

            If you need more performance you should use virtual alias maps to
            rewrite every e-mail address to some machine specific user account
            like this :

            /etc/postfix/virtual-alias

            address1@domain1 user1@...
            address1@domain2 user2@...


            /etc/postfix/transport
            machine1.internal.domain smtp:[machine1.name]
            machine2.internal.domain smtp:[machine2.name]

            This has the advantage that you can use a seldom updated local file
            for transport and use LDAP/SQL whatever only for the virtual alias maps.

            Regards

            Andreas
          • Mark Krenz
            ... Thanks to everyone who responded. Well, the above setup is what I am doing on the gateway host and that works fine. What I m unsure about is how to setup
            Message 5 of 9 , Dec 17, 2007
              On Mon, Dec 17, 2007 at 11:31:12AM GMT, mouss [mlist.only@...] said the following:
              >
              > 1- use virtual_alias_maps to rewrite foo@... to
              > foo@.... If using multiple domains with possibly the same
              > user-parts, then rewrite to foo=example.com@.... you can
              > then use smtp_generic_maps to rewrite
              > /^(.*)=(example\.com)@host\d+\.example\.org$/ $1@$2

              Thanks to everyone who responded.

              Well, the above setup is what I am doing on the gateway host and that
              works fine. What I'm unsure about is how to setup the lookup tables for
              local delivery on the delivery hosts.

              How should I setup the delivery hosts so that they check if the
              recipient is on that machine or if it needs to be sent to the gateway
              mail server and then to one of the other delivery hosts or out to the
              internet?

              Again, in a situation where both delivery hosts could be accepting
              mail for the same domain (example.com), just different users, I'm not
              sure how I can prevent the local delivery host from trying to deliver
              the message locally before it on to the gateway server. Or perhaps I am
              thinking of the way it works in the wrong way? Its possible, its late
              and I'm tired. Every night. ;-)

              Mark


              --
              Mark S. Krenz
              IT Director
              Suso Technology Services, Inc.
              http://suso.org/
            • mouss
              ... you can configure all hosts to use the same rewrite maps. if you don t want top copy these, use *sql, ... etc. an sql config would have a delivery host
              Message 6 of 9 , Dec 18, 2007
                Mark Krenz wrote:
                > On Mon, Dec 17, 2007 at 11:31:12AM GMT, mouss [mlist.only@...] said the following:
                >> 1- use virtual_alias_maps to rewrite foo@... to
                >> foo@.... If using multiple domains with possibly the same
                >> user-parts, then rewrite to foo=example.com@.... you can
                >> then use smtp_generic_maps to rewrite
                >> /^(.*)=(example\.com)@host\d+\.example\.org$/ $1@$2
                >
                > Thanks to everyone who responded.
                >
                > Well, the above setup is what I am doing on the gateway host and that
                > works fine. What I'm unsure about is how to setup the lookup tables for
                > local delivery on the delivery hosts.
                >
                > How should I setup the delivery hosts so that they check if the
                > recipient is on that machine or if it needs to be sent to the gateway
                > mail server and then to one of the other delivery hosts or out to the
                > internet?
                >
                > Again, in a situation where both delivery hosts could be accepting
                > mail for the same domain (example.com), just different users, I'm not
                > sure how I can prevent the local delivery host from trying to deliver
                > the message locally before it on to the gateway server. Or perhaps I am
                > thinking of the way it works in the wrong way? Its possible, its late
                > and I'm tired. Every night. ;-)

                you can configure all hosts to use the same rewrite maps. if you don't
                want top copy these, use *sql, ... etc. an sql config would have a
                "delivery host" for each recipient. then you can generate a virtual
                alias or a transport entry using this field. Even if not using sql, you
                can do the same with a text file and use this to generate the rewrite
                maps. rsync or the like can help propagate these.

                alternatively, let each delivery host know of its recipients, and
                forward others to the gateway.

                In any case, make sure to avoid infinite loops.
              • Mark Krenz
                ... Ok, I m just getting back to this, sorry. My problem is though, is that I m trying to do this: address1domain1 user1machine1.internal.domain
                Message 7 of 9 , Dec 29, 2007
                  > If you need more performance you should use virtual alias maps to
                  > rewrite every e-mail address to some machine specific user account
                  > like this :
                  >
                  > /etc/postfix/virtual-alias
                  >
                  > address1domain1 user1machine1.internal.domain
                  > address1domain2 user2machine2.internal.domain
                  >
                  > /etc/postfix/transport
                  > machine1.internal.domain smtp:[machine1.name]
                  > machine2.internal.domain smtp:[machine2.name]
                  >
                  > This has the advantage that you can use a seldom updated local file
                  > for transport and use LDAP/SQL whatever only for the virtual alias maps.
                  >
                  > Regards
                  >
                  > Andreas


                  Ok, I'm just getting back to this, sorry.

                  My problem is though, is that I'm trying to do this:

                  address1domain1 user1machine1.internal.domain
                  address2domain1 user2machine2.internal.domain

                  Note that that is two different users on the same domain going to two
                  different machines. I know that it is possible to do in the virtual
                  alias maps, but I'm having trouble when I try to send from
                  address1domain1 to address2domain1 on one of the delivery hosts because
                  it tries to deliver the message to user1machine2, which doesn't exist on
                  that machine.

                  So how do I need to configure machine1 and machine2 so that they only
                  deliver for the accounts that are pointing at it and forward other
                  e-mails on other hosted domains back to the router or to the other
                  delivery host?


                  --
                  Mark S. Krenz
                  IT Director
                  Suso Technology Services, Inc.
                  http://suso.org/
                • Mark Krenz
                  Ok, I m not crazy (phew!), it turns out that I needed to have the virtual_alias_maps setup on the delivery machines as well and have it point to the same
                  Message 8 of 9 , Jan 1, 2008
                    Ok, I'm not crazy (phew!), it turns out that I needed to have the
                    virtual_alias_maps setup on the delivery machines as well and have it
                    point to the same database that was used on the gateway machine. Either
                    I didn't understand that from someone's instructions, or its not really
                    mentioned anywhere. I thought about that at one point but I thought it
                    would cause a loop.

                    So now I can send mail from one delivery host to another unix user on
                    another delivery host and it does its thing properly.

                    But now I'm having trouble getting virtual mailboxes to delivery
                    right. Before I turned on virtual_alias_maps on the delivery hosts, I
                    was able to send e-mail to the virtual mailboxes through the gateway or
                    on the delivery host that it would go to, but now with
                    virtual_alias_maps turned on in the delivery host, I get the following
                    error when I try to send to a virtual mailbox.

                    <virtualuser%domain.com@...>): User unknown in virtual alias table


                    I've replaced the actual values in this e-mail to keep them private.

                    Can virtual_alias_maps and virtual_mailbox_maps work on the same
                    machine?

                    Thanks,
                    Mark

                    On Tue, Dec 18, 2007 at 05:38:49AM GMT, Mark Krenz [mark@...] said the following:
                    > On Mon, Dec 17, 2007 at 11:31:12AM GMT, mouss [mlist.only@...] said the following:
                    > >
                    > > 1- use virtual_alias_maps to rewrite foo@... to
                    > > foo@.... If using multiple domains with possibly the same
                    > > user-parts, then rewrite to foo=example.com@.... you can
                    > > then use smtp_generic_maps to rewrite
                    > > /^(.*)=(example\.com)@host\d+\.example\.org$/ $1@$2
                    >
                    > Thanks to everyone who responded.
                    >
                    > Well, the above setup is what I am doing on the gateway host and that
                    > works fine. What I'm unsure about is how to setup the lookup tables for
                    > local delivery on the delivery hosts.
                    >
                    > How should I setup the delivery hosts so that they check if the
                    > recipient is on that machine or if it needs to be sent to the gateway
                    > mail server and then to one of the other delivery hosts or out to the
                    > internet?
                    >
                    > Again, in a situation where both delivery hosts could be accepting
                    > mail for the same domain (example.com), just different users, I'm not
                    > sure how I can prevent the local delivery host from trying to deliver
                    > the message locally before it on to the gateway server. Or perhaps I am
                    > thinking of the way it works in the wrong way? Its possible, its late
                    > and I'm tired. Every night. ;-)
                    >
                    > Mark
                    >
                    >
                    > --
                    > Mark S. Krenz
                    > IT Director
                    > Suso Technology Services, Inc.
                    > http://suso.org/
                    >


                    --
                    Mark S. Krenz
                    IT Director
                    Suso Technology Services, Inc.
                    http://suso.org/
                  • mouss
                    ... I said: you can configure all hosts to use the same rewrite maps. maybe you were confused by rewrite ... ... why is deliveryhost.suso.org configured as a
                    Message 9 of 9 , Jan 1, 2008
                      Mark Krenz wrote:
                      > Ok, I'm not crazy (phew!), it turns out that I needed to have the
                      > virtual_alias_maps setup on the delivery machines as well and have it
                      > point to the same database that was used on the gateway machine. Either
                      > I didn't understand that from someone's instructions, or its not really
                      > mentioned anywhere.

                      I said:
                      you can configure all hosts to use the same rewrite maps.

                      maybe you were confused by "rewrite"...

                      > I thought about that at one point but I thought it
                      > would cause a loop.
                      >
                      > So now I can send mail from one delivery host to another unix user on
                      > another delivery host and it does its thing properly.
                      >
                      > But now I'm having trouble getting virtual mailboxes to delivery
                      > right. Before I turned on virtual_alias_maps on the delivery hosts, I
                      > was able to send e-mail to the virtual mailboxes through the gateway or
                      > on the delivery host that it would go to, but now with
                      > virtual_alias_maps turned on in the delivery host, I get the following
                      > error when I try to send to a virtual mailbox.
                      >
                      > <virtualuser%domain.com@...>): User unknown in virtual alias table
                      >

                      why is deliveryhost.suso.org configured as a virtual alias domain?

                      make sure virtual_alias_domains only contains virtual alias domains or
                      is empty. if you have no virtual alias domains, then set
                      virtual_alias_domains =


                      >
                      > I've replaced the actual values in this e-mail to keep them private.
                      >
                      > Can virtual_alias_maps and virtual_mailbox_maps work on the same
                      > machine?

                      virtual_alias_maps work for any domain.
                    Your message has been successfully submitted and would be delivered to recipients shortly.