pilif.ch - a cuwps

[home]
stuff
some worldwide unique stuff
  • Daily Strips
  • PersistentHandler
  • Denis' Birthday
  • DVD-Region (1)
  • DVD-Region (2)
  • Defeating Miguel
  • Neuronal Interface ;-)
  • Swiss ADSL Check
  • Autodestructing Email
  • Fun with bounces

  • Introduction
  • Theory
  • Solution
  • The MTA
  • Code
  • Conclusion
  • backstage
    backstage-reports of some of my paid projects
  • bookexchange.ch
  • info
    valuable information for my visitors
  • RasInTask
  •  
    configuring exim
    I had to deal with some very strange mail-architecture here that was caused by my paranoia when working with M$ Exchange: For our corporate Email, we were using Exchange Server (mainly because of the groupware-functions the server has), but I did not want it to be able to directly communicate with the internet: Who knows what security holes where implemented...

    So I had a configuration where my Exim on Linux would receive all Mails for our Domain (the linux-Machine was listed as the public MX for our Domain) and pass it on to the exchange-server.

    This lead me to some internal routing-problem: I've seen no way to explain the used exim "domainlist" router not to send addressed to some "special" local-user, to the Exchange-Server. So I had to do some Address-Rewriting (I've added this to the rewrite-section of my exim.conf):

     ^webreply-(.*)@domain.com$	$1@domain.internal	Tt
    
    This would rewrite all incoming mail in the form webreply-{{something}}@domain.com to {{something}}@domain.internal

    Now I have to tell exim, what to do with the mails to this special internal domain. First, I added a router (where "app" stands for "application"):

    app_bounces_router:
      driver = domainlist
      transport = app_bounces_transport
      route_list = "domain.internal"
    

    In this example, I used a router since the machine was not MX host for mails to domain.internal. Exim distinguishes between mails to itself (a director must be used) and mail it has to forward to another domain (the routers are for this). Both router and director use a transport to finally deliver/forward the message.

    Finally, here is the transport:

    app_bounces_transport:
        driver = pipe
        command = "/home/domain/scripts/bounce.php \
          ${local_part}"
        user = domain
        group = mail
        return_output
        log_output
        prefix =
        suffix =
    
    Please note the prefix= and the suffix=-Lines: They are important as we do not want any strange From-Lines or other strange modofications of our mail. I've set the user that exim changes to when delivering to the username the webapplication was run under.

    The script receives the local-part (the {{something}}) as a command-line parameter. The mail is passed via STDIN (but my solution takes no use of the mail at all)

    what do we have now?
    We are quite finished: The hard part is already done: Our MTA is now capable of receiving Mails in the form webreply-{{something}}@domain.com and direct it to some Application on our local system. Now I only have to explain, what that {{something}} is and what the script does.


    © 2003 by pilif. cuwps stands for completely useless webpage and is a non-registered non-trademark by pilif - Last Modification: 04/03/01 at 14:11:00