Forum Discussion

Terje_Gravvold's avatar
Terje_Gravvold
Icon for Nimbostratus rankNimbostratus
Jun 13, 2006

SMTP_proxy

For some reasons, not mentioned here :-), we have decided to do loadbalancing on BigIP based on recipient e-mail address.

 

 

The case is like this:

 

- E-mail reaches BigIP.

 

- SMTP_proxy iRule triggers.

 

- E-mails containing recipient a@mydomain.com gets directed to pool_a all others go to a default pool.

 

 

I've copied the SMTPproxy iRule from the download area and re-written it for our use. I now got something that works (at least when I'm using telnet :-)).

 

 

What I request is for you clever guys to have a look at it and comment whats good and whats bad. I'm new to iRulse and have just recently finished the BigIP course track. I'm specialy interessed in any comments regarding better regexps and SMTP standard related stuff. It would be nice to not break to many RFCs while trying to achive what we want. Also I'm interessed in any security related things you may notice.

 

 

This is not a producion version so please do not use it for your own use without re-writing it for your use and test it properly. If you find use for this iRule yourself thats fine, but please give me a hint if you get some clever ideas on the way.

 

 

The iRule is attached to this post.

 

 

Best regards

 

Terje Gravvold

6 Replies

  • I'll take that as a complement, but the guy(s) who created the SMTPproxy iRule in the download area is the one(s) that realy deserves the credits. I've just "stolen" their work.

     

     

    Thanx anyway ;-)

     

     

    - Terje -
  • Sure! That would be a honor. I'll try to complete the todo list and post a better more stabel version. I've just worked with iRuls for two months and I'm not a programmer so it could be quite a few bugs hided in there ;-).

     

     

    - Terje -
  • Time for a new release.

     

     

    WARNING: In the previous version it could seem like the iRule supported smtp PIPELINING, IT DOES NOT! You are herby warned. To solve the problem for now the new version does not advertise PIPELINING as a supported service. This might or might not work depending on wether the client is RFC compliant or not.

     

     

    The problem with SMTP pipelining is that it must be treated in totaly different way. What it does is something like this:

     

    - The client sends a bunch of SMTP commands down the pipe and does not require an answer to each command.

     

    - The server bufferes the answers untill all commands are recived.

     

    - The server sends replies on the client requests in one bunch. The answers are sorted exactly the same way as they where recived.

     

    - Multiple SMTP commands are recived in the same TCP::payload from the client, separated by carriage return.

     

     

    This scenario must be implemented in quite a different manner than it is in the existing iRule. We have to do some kind om loops with split commands to parse the incoming payload for commands/lines.

     

     

    I'm working on a new version and I'm thankfull for any good advices.
  • Please note that we've never got to run this iRule in production due to the lack of ESMTP support and the lack of time to develop this support.

     

     

    It's good to know that someone likes the code though :-). Use it as you want but take care...