Forum Discussion
st0n3_87491
Nimbostratus
Aug 13, 2009Persistence based on IMAP-User
Hi there,
as topic say I would like to have a persistence to a node based on his IMAP-Userlogin.
I managed to find out this using a stream Profile and wrote this iRule so far:
whe...
hoolio
Cirrostratus
Aug 26, 2009Sorry, I'm confusing myself and you... the rule as it is is adding a persistence record based on the LOGIN in the request payload. The latest update I added tries to look that persistence record up using the client IP address. That won't exist as it wasn't added with the client IP as the persistence key.
Can you try this? I'd test it myself but I'm short on time at the moment.
Aaron
when CLIENT_ACCEPTED {
Time in seconds to maintain the persistence record in LTM's session table
set timeout 1800
Define STREAM expression and enable STREAM filter to check for the login
STREAM::expression {@LOGIN\.*@}
STREAM::enable
}
when STREAM_MATCHED {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched: [STREAM::match]"
Save the matched value
set imap_login [getfield [STREAM::match] " " 2]
Check if $imap_login isn't empty
if { $imap_login != "" }{
$imap_login isn't empty...so let's continue
log local0. "IMAP Login Information found...continuing"
The iRule parser doesn't allow the persist command in STREAM_MATCHED.
It works though, so hide the command from the parser
set persist_cmd "persist uie $imap_login $timeout"
log local0. "[IP::client_addr]:[TCP::client_port]: Parsed: $imap_login \$persist_cmd: $persist_cmd"
eval $persist_cmd
persist uie $imap_login
log local0. "[IP::client_addr]:[TCP::client_port]: Added persistence record for $imap_login on server [IP::server_addr]:[TCP::server_port]. Exiting event for this response."
event STREAM_MATCHED disable
} else {
$imap_login is empty...let's stop this here
log local0. "no IMAP Login Information found...aborting"
}
}
when LB_SELECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Selected server [LB::server]"
}
when SERVER_CONNECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Connected server [IP::server_addr]"
}
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