Forum Discussion
mohammed_darwee
Nimbostratus
Mar 14, 2010Irule need to replace FQDN in SMTP traffic EHLO Message
Hi All,
I need an iRule to fix the below issue please,
The issue is:
For the traffic coming from external servers i.e. Foreign MMSC towards the MM3/4 Inbound traffic Virtual Server on the F5 i.e. 10.117.5.80:25, then F5 is configure to route to MM3/4 Inbound pool and the pool members are: (10.117.5.75:10025, & 10.117.5.76:10025), then those two servers will process the traffic and route it to MM3/4 Outbound traffic Virtual Server on the F5 i.e. 10.117.5.81:10025, then F5 is configure to route to MM3/4 Outbound pool and the pool members is 10.99.64.36:25 i.e. final destination.
Use Case_1:
Source Destination Protocol INFO
1. 80.227.14.14 10.117.5.80 SMTP Command: HELO mms.mnc003.mcc424.gpr from external server to the F5
2. 10.117.5.79 10.117.5.75 SMTP Response: HELO mms.mnc003.mcc424.gprs from F5 to the internal server
3. 10.117.5.75 10.117.5.81 SMTP Response: EHLO pfm.etisalat.ae from From Internal Server to F5
4. 10.117.5.79 10.99.64.36 SMTP Command: EHLO pfm.etisalat.ae from From F5 to the destination
Use Case_2:
1. 195.12.14.9 10.117.5.80 SMTP Command: HELO www.xxx.zzz from external server to the F5
2. 10.117.5.79 10.117.5.75 SMTP Response: HELO www.xxx.zzz from F5 to the internal server
3. 10.117.5.75 10.117.5.81 SMTP Response: EHLO pfm.etisalat.ae from From Internal Server to F5
4. 10.117.5.79 10.99.64.36 SMTP Command: EHLO pfm.etisalat.ae from From F5 to the destination
Needed Action:
In Packet 4 need F5 to replace the FQDN from pfm.etisalat.ae to the original domain name i.e.
In Use Case_1: it should be: 10.117.5.79 10.99.64.36 SMTP Command: EHLO mms.mnc003.mcc424.gprs instead of pfm.etisalat.ae.
In Use Case_2: it should be: 10.117.5.79 10.99.64.36 SMTP Command: EHLO www.xxx.zzz instead of pfm.etisalat.ae.
Many thanks
Rgds
Mohamed
- The_Bhattman
Nimbostratus
Hi Mohamed, - Jon_Strabala_46
Nimbostratus
Hello, - Nat_Thirasuttakorn
Employee
Hi Mohamed,when SERVER_CONNECTED { clientside { TCP::collect } } when CLIENT_DATA { set p [string tolower [TCP::payload]] if { $p starts_with "rcpt to:" } { put you condition here, for example, only apply if there is @example if { $p contains "@example>" } { use stream profile or string manipulation or regexp here... } TCP::release } else { something else, let it be released to server TCP::release TCP::collect } }
when CLIENT_ACCEPTED { set chelo "" set cfrom "" set crcpt "" TCP::respond "220\r\n" log local0. "client accepted" TCP::collect } when CLIENT_DATA { log local0. "payload: [TCP::payload]" set cdata [TCP::payload] if { [ string length $cdata ] <= 0 } { TCP::collect return } if { not ( $cdata contains "\r\n" ) } { log local0. "get <$cdata> so far" TCP::collect return } if { $cdata starts_with "HELO" || $cdata starts_with "EHLO" } { set chelo [TCP::payload] log local0. "get helo \[$cdata\]" TCP::respond "250 OK\r\n" TCP::payload replace 0 [string length $chelo] "" TCP::collect return } if { $cdata starts_with "MAIL FROM:" } { set cfrom [TCP::payload] log local0. "get from \[$cfrom\]" TCP::respond "250 OK\r\n" TCP::payload replace 0 [string length $cfrom] "" TCP::collect return } if { $cdata starts_with "RCPT TO:" } { set crcpt "$crcpt[TCP::payload]" log local0. "get rcpt \[$crcpt\]" TCP::respond "250 OK\r\n" TCP::payload replace 0 [string length [TCP::payload]] "" TCP::collect return } if { $cdata starts_with "DATA" } { log local0. "get data \[$cdata\]" TCP::payload replace 0 0 $chelo$cfrom$crcpt } TCP::release TCP::collect } when SERVER_CONNECTED { log "server connected" TCP::collect } when SERVER_DATA { log local0. "payload: [TCP::payload]" set sdata [TCP::payload] if { $sdata contains "\r\n354 " || $sdata starts_with "354 " || $sdata contains "354\r\n" } { log local0. "get resp \[$sdata\]" TCP::payload replace 0 [string length $sdata] "354 go ahead\r\n" TCP::release } else { TCP::collect } } when CLIENT_CLOSED { log local0. "client closed" }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects