Forum Discussion
JG
May 18, 2014Cumulonimbus
iRule for SMTP: Passing Client IP Addr to backend mail servers
When SNATs are used for a virtual server, the backend SMTP servers cannot get the client IP address. This irule is intended to replace the string after "EHLO" or "HELO" in mail client initiation with...
JG
May 18, 2014Cumulonimbus
Thanks so much, John! Here's a new version of it based on your advice:
when CLIENT_ACCEPTED {
set c-addr [IP::client_addr]
log local0. "Client addr: $c-addr"
STREAM::expression {@^EHLO.*\r\n@@ @^HELO.*\r\n@@}
STREAM::enable
}
when STREAM_MATCHED {
set mstring [STREAM::match]
log local0. "STREAM_MATCHED: string: $mstring"
set replacment [string range $mstring 0 1]
append replacment "LO $c-addr\r\n"
log local0. "STREAM_MATCHED: replacement string: $replacement"
STREAM::replace "$mstring/$replacment"
event STREAM_MATCHED disable
}
when SERVER_CONNECTED {
STREAM::disable
}
I can't test this (it compiled alright) yet because my devices are all firewall'ed off at the moment.
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