For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Jeff_Bull_42197's avatar
Jeff_Bull_42197
Icon for Nimbostratus rankNimbostratus
Dec 10, 2014

Using an iRule for SMTP Relay and Exchange 2013

Good morning, I'm trying to use the following iRule to enable my LTM (running v11.1) to play SMTP relay for our new Exchange 2013 servers (see below), yet getting an error (also below). I don't have much iRule/Scripting experience, so understanding where the syntax issue is has proved challenging. Any help is greatly appreciated.

 

iRule

 

when CLIENT_ACCEPTED { set accepted_snat "IP Address"

 

if { [ class exists smtp_relay_allowed ] } { if { [class match [IP::client_addr] equals "smtp_relay_allowed"] } { snat $accepted_snat } else { snat automap } } else { snat automap } }

 

Error in Local Traffic log

 

TCL error: /Common/o365-smtp-relay_irule - can't read "::smtp_relay_allowed": no such variable while executing "class match [IP::client_addr] equals $::smtp_relay_allowed"

 

Thanks!

 

Jeff B

 

2 Replies

  • John_Alam_45640's avatar
    John_Alam_45640
    Historic F5 Account

    There is a difference between the irule you posted and what is reported in the TCL error.

    Nonetheless, It appears that smtp_relay_allowed is supposed to be the name of a data-group defined via the GUI. If so, use it without the ''$::' and without surrounding it by quotes.

    when CLIENT_ACCEPTED { set accepted_snat "IP Address"
    
    if { [ class exists smtp_relay_allowed ] } { 
        if { [class match [IP::client_addr] equals smtp_relay_allowed] } { 
           snat $accepted_snat 
        } else { 
           snat automap
        }
    } else { 
        snat automap 
    }
    }
    
  • Thanks John. Sorry about that, must have pasted a slightly different version of the iRule. I'll give your suggestion a try and see how it goes.

     

    Jeff