OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Wietse Venema (wietseporcupine.org)
Date: Mon Jun 03 2002 - 16:02:34 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    How creative. I'm impressed.

    Thinking about the problem again, if he wants sender-based routing
    for ALL his mail, then it can be done with only a few lines of code
    in the Postfix queue manager.

    Below is an untested patch that turns on sender-based routing
    when you specify "sender_based_routing = yes".

    It's a pretty schizophrenic architecture, and I am not even sure
    it can be made to work.

    For example, sender-based routing breaks message bounces that his
    machine sends back to the internet. In fact, any mail with a local
    sender address will loop back to his machine, even though it has
    a remote recipient address. And he will never be able to receive
    mail from someone in a sender-routed domain, because that mail will
    always be routed to the ISP for that domain.

    In order to make the patch work, you need to set up a transport
    map for all the sender domains that you want to be sender routed.
    Everything else needs to be routed to the local delivery agent
    regardless of origin. Use the new "*" feature to match any domain
    in the transport map.

            Wietse

    *** ./src/global/mail_params.h- Sat Jun 1 10:17:31 2002
    --- ./src/global/mail_params.h Mon Jun 3 16:46:29 2002
    ***************
    *** 1547,1552 ****
    --- 1547,1559 ----
      #define DEF_STRICT_ENCODING 0
      extern bool var_strict_encoding;
      
    + /*
    + * Bizarre.
    + */
    + #define VAR_SENDER_ROUTING "sender_based_routing"
    + #define DEF_SENDER_ROUTING 0
    + extern bool var_sender_routing;
    +
      /* LICENSE
      /* .ad
      /* .fi
    *** ./src/qmgr/qmgr_message.c- Mon May 27 12:54:51 2002
    --- ./src/qmgr/qmgr_message.c Mon Jun 3 16:50:26 2002
    ***************
    *** 518,524 ****
               * Resolve the destination to (transport, nexthop, address). The
               * result address may differ from the one specified by the sender.
               */
    ! resolve_clnt_query(recipient->address, &reply);
              if (message->filter_xport) {
                  vstring_strcpy(reply.transport, message->filter_xport);
                  if ((nexthop = split_at(STR(reply.transport), ':')) == 0
    --- 518,529 ----
               * Resolve the destination to (transport, nexthop, address). The
               * result address may differ from the one specified by the sender.
               */
    ! if (var_sender_routing == 0) {
    ! resolve_clnt_query(recipient->address, &reply);
    ! } else {
    ! resolve_clnt_query(message->sender, &reply);
    ! vstring_strcpy(reply.recipient, recipient->address);
    ! }
              if (message->filter_xport) {
                  vstring_strcpy(reply.transport, message->filter_xport);
                  if ((nexthop = split_at(STR(reply.transport), ':')) == 0
    *** ./src/qmgr/qmgr.c- Tue Mar 26 16:48:43 2002
    --- ./src/qmgr/qmgr.c Mon Jun 3 16:42:41 2002
    ***************
    *** 296,301 ****
    --- 296,302 ----
      int var_local_con_lim; /* XXX */
      int var_proc_limit;
      bool var_verp_bounce_off;
    + bool var_sender_routing;
      
      static QMGR_SCAN *qmgr_incoming;
      static QMGR_SCAN *qmgr_deferred;
    ***************
    *** 518,523 ****
    --- 519,525 ----
          static CONFIG_BOOL_TABLE bool_table[] = {
              VAR_ALLOW_MIN_USER, DEF_ALLOW_MIN_USER, &var_allow_min_user,
              VAR_VERP_BOUNCE_OFF, DEF_VERP_BOUNCE_OFF, &var_verp_bounce_off,
    + VAR_SENDER_ROUTING, DEF_SENDER_ROUTING, &var_sender_routing,
              0,
          };
      

    Bennett Todd:
    -- Start of PGP signed section.
    > I hacked up such a thing in Postfix once.
    >
    > Postfix itself has no native support for doing any routing based on
    > source info; neither source interface, nor source IP address, nor
    > source envelope data (MAIL FROM: in the SMTP dialogue), nor From:
    > header.
    >
    > I got a requirement to do this (along with a noisome collection of
    > other hard requirements). To meet the needs I was already doing
    > content filtering. I actually (for other reasons, different policies
    > required based on different incoming interfaces) ran multiple
    > postfix installs, but the exact same trick would have worked using
    > Postfix's content-filtering hook with an SMTP proxy. What I did for
    > source-based routing was to conditionally rewrite the RCPT TO,
    > depending on what I'd seen in the MAIL FROM. If the MAIL FROM
    > matched a short list of addrs I wanted to handle bizarrely, I
    > rewrote the RCPT TO into XXXXXXother.domain, where XXXXXX was the
    > base64 encoding of the original RCPT TO, and other.domain was a
    > special reserved domain (from RFC 2606[1]). Then I used a transport
    > table entry for that domain to route to a pipe transport, with a
    > script that did the special funky weirdness I needed.
    -
    To unsubscribe, send mail to majordomopostfix.org with content
    (not subject): unsubscribe postfix-users