Forum Discussion
Scott_Albrech_8
Nimbostratus
Feb 03, 2005regexp looking for email addresses in iRule
Toying with some stuff and thought I'd like to scan TCP payload for email addresses, preferably in the "MAIL FROM", but I'm starting much bigger for sake of easing into this. Anyhoo, not having much ...
Scott_Albrech_8
Nimbostratus
Feb 07, 2005I figured out my issue. My understanding of what was vaguely written in the manual led me to the following, which got past the hanging of the SMTP session on first connect (waiting for the 220 on client_accepted):
when CLIENT_ACCEPTED {
TCP::collect
TCP::release
}
when CLIENT_DATA {
if { [regexp -nocase {mail from:} [TCP::payload]] } {
TCP::respond "554 Message Rejected\r\n"
reject
} else {
Release the current payload onto the server
TCP::release
But still collect the next data from the client
TCP::collect
}
}
If my logic is correct (oh, and I have doubt!), I added in the TCP release in the CLIENT_ACCEPTED because I don't really care to collect any data at that point in the very initial SMTP connection (I just want a 220 to begin sending) but from reading parts of the manual you need to start a collect in that area in order to process more CLIENT_DATA in other areas (rcpt to, mail from). So, that cured the hang and allows the session to move on.
Anyway, works quite well. Thanks for all the pointers.
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