John_Masgalas_4
Feb 14, 2011Nimbostratus
ReMSRDP Redirect based on username
We have the below iRule. It basically examines the rdp username performs some cleanup, sets the persistence and then sends them to the pool. How could I add a step that says if the username is "jmasgalas" send to node halo12, else go to the msrdp_pool? Many thanks!
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
TCP::collect 25
binary scan [TCP::payload] x11a* msrdp
log local0. "Contents after binary scan: $msrdp"
if { [string equal -nocase -length 17 $msrdp "cookie: mstshash="] } {
set msrdp [string range $msrdp 17 end]
set len [string first "\n" $msrdp]
if { $len == -1 } {
TCP::collect
return
}
if { $msrdp contains "@" } {
log local0. "Setting data to: [getfield $msrdp "@" 1]"
set username [getfield $msrdp "@" 1]
} elseif { $msrdp contains "\\" } {
log local0. "Setting data to: [getfield $msrdp "\\" 3]"
set username [getfield $msrdp "\\" 3]
} else {
set username $msrdp
log local0. "Setting data to: $msrdp"
}
set finalusername [string tolower $username]
set finalusername [string trim $finalusername]
set finalusername [string range $finalusername 0 8]
log local0. "User Being Persisted is: |$finalusername|"
persist uie $finalusername 7200
}
TCP::release
}