Forum Discussion

Kapil_49148's avatar
Kapil_49148
Icon for Nimbostratus rankNimbostratus
Jan 10, 2014

APM verify Active User Session and do not allow second session

I am trying to setup APM where I want to restrict the users to have only one session per ID. The configuration on APM access policy page helps me to achieve this. But the problem is, if someone with same user id logs in then existing logged in session disconnects and the new one establishes.

 

I need to find a way to restrict the new session to login till the time old session of same id is terminated. Is there any checkbox via which we can achieve this? or iRule is required to achieve this.

 

My Policy page starts with logon + auth + auth-quey (group id) + route domain and Snat + full resource.

 

Any help to meet the objective is appreciated. - APM Ver - 11.4 HF3.

 

2 Replies

  • John_Alam_45640's avatar
    John_Alam_45640
    Historic F5 Account

    This may require an iRule. It would certainly need to use the VPE "iRule Event" agent because this event fires before the policy concludes and you have a chance to end it with an "allow" or "deny".

     

    The iRule Event Agent Raises the iRule ACCESS_POLICY_AGENT_EVENT event for use with custom iRules. The iRule would look up the username in an iRule "Table" using the "table" commands. If the user exists, the iRule sets a session variable to "0", if the username is not in the table, a new table record is created and variable is set to "1". Only challenge here is the record cleanup. When a user session ends for any reason, you will have to remove the record. This means that you have to remove the record when the ACCESS_SESSION_CLOSED event fires for any reason, this includes user logout as well as session timeout.

     

    ACCESS_SESSION_CLOSED - This event is triggered when a user session is removed due to a user logging out explicitly. timeout or if terminated explicitly by admin.

     

    I would recommend that you store the session id in the table record indexed (keyed) by the username. This way, if a username is found, you verify that a session is valid before denying the logon.

     

    When a username is found, the iRule event sets a session variable to "0". In the VPE, after the iRule Event, you can check the variable and if it is "0" you deny.

     

    You may want to consider raising the iRule event after the Authentication. This ensures that not anyone can snoop in to find out whether or not a particular user is logged in. In other words, you run irule event after user "john" is authenticated, only user "john" can find out if a session already exists.

     

    There are examples here on DC that cover most of what I mentioned here. If you have problems finding them POST back here and we can include examples.

     

    HTH.

     

    • John_Alam_45640's avatar
      John_Alam_45640
      Historic F5 Account
      Another idea is to simply display a message informing the user that a new logon will delete their existing session. The user will then decide if they are OK with that, if not, they will cancel. This may achieve an acceptable result.