Forum Discussion
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
}
1 Reply
Sort By
- Hi John,
when CLIENT_ACCEPTED { Save the name of the default pool on the virtual server set default_pool [LB::server pool] Collect the TCP payload to parse the username 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 if {$finalusername eq "jmasgalas"}{ node 10.0.0.10 } else { pool $default_pool } } TCP::release }
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