Forum Discussion
iRule check multiple logon in APM
Hi everyone. I am trying to write the irule to check username in APM. Requirement is user cannot logon account at the sametime on multiple device. My iRule is below
when ACCESS_POLICY_AGENT_EVENT {
set logonuser [ACCESS::session data get "session.ad.last.attr.name"]
log "$logonuser now logon"
if { [table lookup $logonuser] equals "1" } {
log "$logonuser already logon"
drop
return
}
table set $logonuser "1"
}
when ACCESS_SESSION_CLOSED {
log "Access session closed"
table delete $logonuser
}
Now user cannot logon at the sametime. But after user logoff then irule does not remove that user from the table. The error show in /var/log/ltm after running is
01220002:6: Rule : Access session closed
01220001:3: TCL error: no connection established table needs an established connection! (line 1) invoked from within "table delete $logonuser"
Can anyone give me any suggest or help me to correct the irule? Thank you very much
6 Replies
- APM can already do this:
- Alongkorn_Siril
Nimbostratus
Hi Chris. Thank you for your suggestion. I already test your suggestion. Max Sessions Per User is global policy then I cannot specific to each group of user. The requirement is
1. Using only 1 logon page
2. User group A can logon multiple device sametime
3. User group B can logon only single device sametime
4. If user group B logon second time on other device then cannot logon. But connection in first device still working.
- Are you saying that you have multiple APM device, perhaps in different locations? And you want a user to only be able to logon via one location at a time?
- spark_86682Historic F5 AccountI can't help you with your APM problem, but the reason that you're getting that error message is because ACCESS_SESSION_CLOSED is a global event (meaning, not associated with a connection), and the table command does not yet work in global events.
- KarimBenyelloul
Cirrostratus
Hi Spark,
Could you please give me a link to the documentation where you found this information ?
I'm having an issue using the "table" command inside the ACCESS_SESSION_CLOSED too
Many thanks,
Karim
- Kevin_Stewart
Employee
I think I may have something.when RULE_INIT { set static::policy_debug 1 } when ACCESS_POLICY_AGENT_EVENT { if { [ACCESS::policy agent_id] equals "GROUPCHECK" } { if { [ACCESS::session data get session.ldap.last.attr.comment] equals "GROUPB" } { if { [expr [llength [ACCESS::uuid getsid "[ACCESS::session data get session.access.profile].[ACCESS::session data get session.logon.last.username]"]] > 0] } { if { $static::policy_debug } { log local0. "[ACCESS::session data get session.logon.last.username] in GROUP B attempted multiple sessions" } ACCESS::session remove } } } }
Recent Discussions
Related Content
* 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