Forum Discussion
APM session table - find key based on value workaround?
Hi
Trying to build the following logic:
On the VS/AP with Network Access resource:
-
User authenticates on the APM
table set [ACCESS::session data get "session.user.sessionid"] "" (in event ACCESS_POLICY_COMPLETED)
-
User connects with Network Access, I add the assigned IP to the table
table append -mustexist [ACCESS::session data get "session.user.sessionid"] [ACCESS::session data get session.assigned.clientip] (event HTTP_REQUEST , if URI starts with "/myvpn?sess=")
-
User logs out or session times out
table delete [ACCESS::session data get "session.user.sessionid"] (in event ACCESS_SESSION_CLOSED)
The user then connects to VS/AP on the same cluster but I should bypass authentication for him ("usability" argued) because he comes from NA and already authenticated. Access should be logged.
On other VS/AP I would like to call an iRule (through the VPE), if client source IP is in the NA_pool range, I verify the sessionID of his NA session based on his client_ip and log it.
Issue: no way to lookup table's key based on the value.
Table will remain small with max 500 rows.
Glad for any input.
1 Reply
Hi Amolari,
I guess a layered
and[table]
approach would be the best choice.[table -subtable]1.) User authenticates on the APM
table set "ID_[ACCESS::session sid]" "" indefinite 846002.) User connects with Network Access, I add the assigned IP to the table
table append -mustexist "ID_[ACCESS::session sid]" "[ACCESS::session data get session.assigned.clientip]" table set -subtable "IP_[ACCESS::session data get session.assigned.clientip]" "[ACCESS::session sid]" "" indefinite 846003.) User logs out or session times out
table delete -subtable "IP_[ACCESS::session data get session.assigned.clientip]" [ACCESS::session sid] table delete "ID_[ACCESS::session sid]"4.) Check for allowed client IPs
if { [table -keys -count -subtable "IP_[IP::client_addr]"] > 0 } then { Allow the request }Note: I've added the scenario that a single source IP would initiate multiple APM sessions. (in cause of Proxy/NAT)
Note: I've added a maximum lifetime for the table records to make sure they would getting flushed if something goes wrong...
*Note: What is the purpose of differentiating 1.) and 2.)? After my changes, I don't get the point of the "ID_[ACCESS::session sid]" table, at all?
Note: I'm certain unsure if 4.) covers your use case? But you may elaborate additional requirements on this...
Cheers, Kai
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