Forum Discussion
John_Masgalas_4
Nimbostratus
Jan 30, 2009iRule modification - rdp
I currently use the below iRule with our Terminal Services pool. It strips everything after the "@" in the username so that the persistence entry is only the username. I would like to modify it so that usernames that are entered in the form "domain\username" are also entered in the table with just the username. In toehr words I weould like the iRule to strip out everything before the "/". How would I do this? Can someone help?
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 "@" } {
if { $len > 5 } {
incr len -1
log local0. "Data Persisting on: [getfield $msrdp "@" 1]"
persist uie [getfield $msrdp "@" 1] 10800
}
} else { persist uie $msrdp 10800}
}
TCP::release
}
17 Replies
Sort By
- hoolio
Cirrostratus
Thanks for that.if { $msrdp contains "@" } { log local0. "Data Persisting on: [getfield $msrdp "@" 1]" persist uie [getfield $msrdp "@" 1] 10800 } elseif { $msrdp contains "\\\\" } { log local0. "Data Persisting on: [getfield $msrdp "\\\\" 2]" persist uie [getfield $msrdp "\\\\" 2] 10800 } elseif { $msrdp contains "\\" } { log local0. "Data Persisting on: [getfield $msrdp "\\" 2]" persist uie [getfield $msrdp "\\" 2] 10800 } else { persist uie $msrdp 10800 log local0. "Data Persisting on: $msrdp" } }
- John_Masgalas_4
Nimbostratus
So how would that incorporate to my entire iRule. Which parts would I keep and which would I change? - hoolio
Cirrostratus
Can you try this?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. "Data Persisting on: [getfield $msrdp "@" 1]" persist uie [getfield $msrdp "@" 1] 10800 } elseif { $msrdp contains "\\\\" } { log local0. "Data Persisting on: [getfield $msrdp "\\\\" 2]" persist uie [getfield $msrdp "\\\\" 2] 10800 } elseif { $msrdp contains "\\" } { log local0. "Data Persisting on: [getfield $msrdp "\\" 2]" persist uie [getfield $msrdp "\\" 2] 10800 } else { persist uie $msrdp 10800 log local0. "Data Persisting on: $msrdp" } } TCP::release }
- John_Masgalas_4
Nimbostratus
It seems that with this rule it persists the value but as seperate entries. Also the stripping everything before \ is not creating a persistence table entry. When I ssh to our F5 here is what the output of b persist show all | grep doctest is: - JRahm
Admin
@Hoolio, if I recall correctly the len variable includes the "=", so it is decremented to remove the additional character that would otherwise be included in the persist string. - John_Masgalas_4
Nimbostratus
Hey guys, - nathe
Cirrocumulus
Hi all, thought I'd add something to the mix here, mainly for information purposes in case anyone else is in my boat - although if anyone does have a nugget of info then that would be great.
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