Security

 View Only
Expand all | Collapse all

clearpass active session restriction

This thread has been viewed 102 times
  • 1.  clearpass active session restriction

    Posted Nov 05, 2024 12:21 PM

    hi Airheads,

    just wondered what the recommended way for restricting access to guest users to one device is?

    i have a guest portal backed off to AD and when the user logs on with username\password i'm writing the user account to the endpoint repository

    and i'd like to block access if another device tries to use the same account details

    i'd like to use an enforcement profile that denies access when one more than one device is being used (one account\one device)

    Do you have to use Insight or is there a simpler way?

    cheers

    Pete



  • 2.  RE: clearpass active session restriction

    Posted Nov 05, 2024 12:58 PM

    Insight is required as you'll want to count the number of current sessions and then disallow new connections based on that value.  I should write this all up some day as a full solution, but here are the queries I use.  Note, you'll have to enable interim accounting on the NAS with an interval of 10 minutes or less.

    ******
    [Insight Repository]
    +++++++++++++
    ARUBA VERSION
    New filter "Custom-ConcurrentSessions-PreAuth-User" to find concurrent sessions currently active through interim accounting updates
    To be used in role mappings for Application/WebAuth where %{Authentication:Username} will exist
    SELECT count(distinct calling_station_id) as active_sessions
    FROM radius_acct
    WHERE end_time IS null
    AND username = '%{Authentication:Username}'
    AND LEFT(ssid,LENGTH('%{Application:WebLoginURL:essid}')) = '%{Application:WebLoginURL:essid}'
    AND updated_at > now() - interval '12 minutes'
    - active_sessions: ActiveSessions-PreAuth-User, Integer
    ******
    [Insight Repository]
    +++++++++++++
    ARUBA VERSION
    New filter "Custom-ConcurrentSessions-User" to find concurrent sessions currently active through interim accounting updates
    To be used in role mappings where %{Authentication:Username} will exist
    SELECT count(distinct calling_station_id) as active_sessions
    FROM radius_acct
    WHERE end_time IS null
    AND username = '%{Authentication:Username}'
    AND ssid = '%{Connection:SSID}'
    AND calling_station_id != '%{Connection:Client-Mac-Address-NoDelim}'
    AND updated_at > now() - interval '12 minutes'
    - active_sessions: ActiveSessions-User, Integer
    ******
    [Insight Repository]
    +++++++++++++
    ARUBA VERSION
    New filter "Custom-ConcurrentSessions-Endpoint" to find concurrent sessions currently active through interim accounting updates
    To be used in role mappings where %{Endpoint:Username} will exist
    SELECT count(distinct calling_station_id) as active_sessions
    FROM radius_acct
    WHERE end_time IS null
    AND username = '%{Endpoint:Username}'
    AND ssid = '%{Connection:SSID}'
    AND calling_station_id != '%{Connection:Client-Mac-Address-NoDelim}'
    AND updated_at > now() - interval '12 minutes'
    - active_sessions: ActiveSessions-Endpoint, Integer

    Bonus pieces: grab the simultaneous_use field from the relevant user account and figure out the remaining session time based on guest account expiration.

    ******
    [Guest User Repository]
    New filter "Custom-SimultaneousUse-User" to return the simultaneous_use attribute based on Authentication:Username
    SELECT tgu.attributes ->>'simultaneous_use' AS simultaneous_use_user
    FROM tips_guest_users as tgu 
    WHERE ((tgu.guest_type = 'USER')
    AND (tgu.user_id = '%{Authentication:Username}')
    AND (app_name != 'Onboard'))
    - simultaneous_use_user: SimultaneousUse-User, Integer
    ******
    [Guest User Repository]
    New filter "Custom-SimultaneousUse-Endpoint" to return the simultaneous_use attribute based on Endpoint:Username
    SELECT tgu.attributes ->>'simultaneous_use' AS simultaneous_use_endpoint
    FROM tips_guest_users as tgu 
    WHERE ((tgu.guest_type = 'USER')
    AND (tgu.user_id = '%{Endpoint:Username}')
    AND (app_name != 'Onboard'))
    - simultaneous_use_endpoint: SimultaneousUse-Endpoint, Integer

    ******
    [Guest User Repository]
    New filter "Custom-RemainingExpiration-User" to return the account expiration timestamp and time remaining until expiration for a guest account.
    This accounts for Account Lifetime (expire_postlogin) when calculating the account expiration time and remaining time,
    rather than reading the current value and returning blindly.
    SELECT
    CASE
    WHEN (expire_time > CURRENT_TIMESTAMP(0)) AND ((attributes->>'expire_postlogin')::int != 0)
    THEN (CURRENT_TIMESTAMP(0) + ((attributes->>'expire_postlogin')::text||' minutes')::interval) 
    ELSE expire_time::timestamp
    END AS guest_account_expiry,
    CASE
    WHEN (expire_time > CURRENT_TIMESTAMP(0)) AND ((attributes->>'expire_postlogin')::int = 0)
    THEN extract(epoch FROM (expire_time - CURRENT_TIMESTAMP(0)))::int
    WHEN (expire_time > CURRENT_TIMESTAMP(0)) AND ((attributes->>'expire_postlogin')::int != 0)
    THEN extract(epoch FROM ((CURRENT_TIMESTAMP(0) + ((attributes->>'expire_postlogin')::text||' minutes')::interval) - CURRENT_TIMESTAMP(0)))::int
    ELSE 0
    END AS guest_remaining_expiration
    FROM tips_guest_users
    WHERE ((guest_type = 'USER') AND (user_id = '%{Authentication:Username}') AND (app_name != 'Onboard'));
    - guest_account_expiry: GuestAccountExpiry, Date-Time
    - guest_remaining_expiration: RemainingExpiration-User, Integer
    ******
    [Guest User Repository]
    New filter "Custom-RemainingExpiration-Endpoint" to return the time remaining until expiration for a guest account based on Endpoint:Username
    SELECT 
           CASE WHEN expire_time > now() THEN CAST(EXTRACT(epoch FROM (expire_time - NOW())) AS INTEGER) 
                ELSE 0
           END AS remaining_expiration, expire_time::timestamp AS expire_time_endpoint
    FROM tips_guest_users           
    WHERE ((guest_type = 'USER')
    AND (user_id = '%{Endpoint:Username}')
    AND (app_name != 'Onboard'))
    - remaining_expiration: RemainingExpiration-Endpoint, Integer
    - expire_time_endpoint: ExpireTime-Endpoint, Date-Time


    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 3.  RE: clearpass active session restriction

    Posted Nov 05, 2024 01:59 PM

    thanks for getting back Carson,

    quick question.

    As this process relies on RADIUS accounting and Interim accounting.

    1. what if the concurrent user (someone using the same account details on another device) is not active ? cheers Pete



  • 4.  RE: clearpass active session restriction

    Posted Nov 05, 2024 02:07 PM

    What about it?  If your concurrent session limit is 2, that account is allowed two sessions (two devices connected).  If they attempt a third, that will be denied.  If they disconnect a device and the session is marked as stopped, then they can connect a different device.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 5.  RE: clearpass active session restriction

    Posted Nov 05, 2024 02:37 PM

    hi Carson,

    i'm afriad i explained the problem incorrectly.

    i'll start agin.

    we have a customer who is giving students access via their AD credentials.

    so we set up a guest portal backed off to AD. (the customer said they didn't want them to use PEAP MSCHAPv2)

    The customer has said they don't want the students sharing their account name credentials with other students.

    so what i want to do is ensure that only one device per account.

    cheers

    peter




  • 6.  RE: clearpass active session restriction

    Posted Nov 05, 2024 02:46 PM

    Ah.  Yeah, that's not going to go very well considering randomized MAC address implementations.  If they used the unique device count, part of the base implementation when you use the wizard to create the services, then they would be resetting things daily as the MAC addresses changed.

    They can restrict access to a single concurrent device, let everyone know that a single device is all they are allowed, and go from there.

    Or they can go with a managed solution like Onboard.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 7.  RE: clearpass active session restriction

    Posted Nov 05, 2024 03:10 PM

    we've been through Onboard with the customer but they wanted something a bit simpler to implement.

    good point about randomized MAC and i have told the customer that as a pre-requisite the students MUST turn this off.

    So on that basis how would my enforcement profile look ?

    do i still use Insight?




  • 8.  RE: clearpass active session restriction

    Posted Nov 05, 2024 03:40 PM

    Assuming you're talking about the concurrent sessions:

    • Use a role mapping.  You could do the test in the enforcement policy, but that gets messy.
    • You test current number of sessions against whatever limit is set, dynamic or static.
    • The query is against the Insight database, so yes, Insight is required.

    Students won't turn off MAC randomization.  Take that as a given.  Depending on where you are, mandating that is probably a violation of privacy requirements.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 9.  RE: clearpass active session restriction

    Posted Apr 21, 2025 05:08 AM

    Dear @chulcher,

    sorry to ask, are you add or edit this script on insight repository with your script sir ?

    and are you write your rule enforcement like this one ?



    ------------------------------
    Regards,

    Hudaya

    ACCP, ATP, ACP-CA
    ------------------------------



  • 10.  RE: clearpass active session restriction

    Posted Apr 21, 2025 09:26 AM

    Those queries get added as new filters for the Insight repository.  I prefer to write a role assignment that determines too many sessions are being used and then have an enforcement rule that denies access based on that role.  That way I have a known and specific reason for the session to be denied rather than having to interpret what is missing from the session.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 11.  RE: clearpass active session restriction

    Posted Apr 21, 2025 11:21 PM
    Edited by hudaya1991 Apr 22, 2025 12:27 AM

    Dear @chulcher,

    thanks for your response,

    is this how you do it sir ?

    and after i'm apply it as rule, i got rejected, and got message like this one

    thankyou



    ------------------------------
    Regards,

    Hudaya

    ACCP, ATP, ACP-CA
    ------------------------------



  • 12.  RE: clearpass active session restriction

    Posted Apr 22, 2025 02:03 AM

    Are you attempting that check for an Application or WebLogin service?  That query is meant primarily to be used with a pre-auth service for validating session count during a captive portal flow.  If you're attempting the check against a RADIUS auth then you'll want to use one of the other queries, either User (username is provided) or Endpoint (MAC auth for captive portal caching) depending on what stage you are in.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 13.  RE: clearpass active session restriction

    Posted Apr 22, 2025 03:49 AM
    Edited by hudaya1991 Apr 22, 2025 05:23 AM

    Dear @chulcher

    sorry, i mean I need it for radius authentication,

    for now, i could login with these new filter, thanks,

    i'm restrict just 2 device that could connect to network, and when i try to connect the third device, its successfully blocked,

    but when i try to log out 1st device and waiting for 10 minutes, with 2nd device still connected, i could connect with 3rd and 1st device again to network, while 2nd device still connected to network, so for now, active session count 1st and 2nd device have same status count,

    any suggestions sir ?



    ------------------------------
    Regards,

    Hudaya

    ACCP, ATP, ACP-CA
    ------------------------------



  • 14.  RE: clearpass active session restriction

    Posted Apr 22, 2025 09:03 AM

    You'll need to share more of the information from the access tracker for the first device reconnecting to have an idea of what happened, along with the logic configured to determine the number of allowed devices.  The query is dependent on the accounting information being correct, you can definitely manage to get multiple devices online if you attempt to connect them all at the same time and the query is working with data that is stale.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 15.  RE: clearpass active session restriction

    Posted Apr 23, 2025 03:57 AM

    Dear @chulcher,

    this is noted, thanks a lot for your help



    ------------------------------
    Regards,

    Hudaya

    ACCP, ATP, ACP-CA
    ------------------------------



  • 16.  RE: clearpass active session restriction

    Posted 9 days ago

    when iam adding the same sql Query i am getting the error can you explain what is the issue clear pass is running 6.11.1 version trail license 

    -------------------------------------------



  • 17.  RE: clearpass active session restriction

    Posted 9 days ago

    You should not change default sources/policies/profiles, which you can recognize because they are [between square brackets].

    If it shows the SQL syntax is incorrect, it may be incorrect indeed, or it may be related to security checks against the SQL that you try to add, but hard to say as you didn't share what you tried to add. If you literally copied the SQL, it may be related to that you don't have a t in active-session in the Attribute Name.



    ------------------------------
    Herman Robers
    ------------------------
    If you have urgent issues, always contact your HPE Aruba Networking partner, distributor, or Aruba TAC Support. Check https://www.arubanetworks.com/support-services/contact-support/ for how to contact HPE Aruba Networking TAC. Any opinions expressed here are solely my own and not necessarily that of Hewlett Packard Enterprise or HPE Aruba Networking.

    In case your problem is solved, please invest the time to post a follow-up with the information on how you solved it. Others can benefit from that.
    ------------------------------



  • 18.  RE: clearpass active session restriction

    Posted 8 days ago

    Carson Hulcher,

     

    Thank you for reaching out me



    I tried as you mentioned query please check image

     

    image002.png@01DC8151.39901430

     

    services I mapped the rule I am not seeing the session counts in access tracker and I tried default  Active-count  attribute

     

     

    image003.png@01DC8151.39901430

     

     

    image004.png@01DC8151.39901430

     

    Receiving  alerts

     

    image001.png@01DC8151.5543E800

     

     

    receiving  when I am changing the insight source local

    Recving  alerts

     

    image006.png@01DC8151.CFD6B0C0

     

    If removing not coming any alerts

     

     

    Regards,

    D.Kartheek

    Network Engineer

     

     






  • 19.  RE: clearpass active session restriction

    Posted 8 days ago

    Carson Hulcher,

    Thank you for reaching out me



    I tried as you mentioned query please check image

    services I mapped the rule I am not seeing the session counts in access tracker and I tried default  Active-count  attribute

    Receiving  alerts

    receiving  when I am changing the insight source local

    Recving  alerts

    If removing not coming any alerts




  • 20.  RE: clearpass active session restriction

    Posted 8 days ago

    Carson Hulcher,

    Thank you for reaching out me



    I tried as you mentioned query please check image

    services I mapped the rule I am not seeing the session counts in access tracker and I tried default  Active-count  attribute

    Receiving  alerts

    receiving  when I am changing the insight source local

    Recving  alerts

    If removing not coming any alerts




  • 21.  RE: clearpass active session restriction

    Posted 9 days ago

    If you're testing out ClearPass for the first time, then you might want to stick with default workflows until you get a better understanding of how things are working and how to customize your setup.

    Adding the query to the existing authentication source shouldn't be an issue, just be sure not to modify any of the actual default configuration that is already in place.  Share what you attempted to save as the query, the error message by itself isn't helpful.  I'm going to guess that you copied more than just the query and pasted that in.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 22.  RE: clearpass active session restriction

    Posted 8 days ago

    Carson Hulcher,

     

    Thank you for reaching out me

     

    I tried as you mentioned query please check image

    In my same local sever running db  services I mapped the rule but I am not seeing the session counts in access tracker and I tried default  Active-count  attribute also but alerts receiving  when I am changing the insight source local

    Revving error

    Policy server

    Session failed for Host=localhost, Reason=[Failed to connect to datasource: FATAL: database "tipsdb" does not exist
    SQLState=08001 ErrorCode=101]

     

     

    Summary https://192.168.128.171/tips/dojo/dojo/resources/blank.gif

    Input https://192.168.128.171/tips/dojo/dojo/resources/blank.gif

    Output https://192.168.128.171/tips/dojo/dojo/resources/blank.gif

    Alerts https://192.168.128.171/tips/dojo/dojo/resources/blank.gif

    Error Code:

    -

    Error Category:

    Success

    Error Message:

    Success

     Alerts for this Request 

    Policy server

    Session failed for Host=192.168.128.171, Reason=[Failed to connect to datasource: FATAL: password authentication failed for user "appuser"
    FATAL: no pg_hba.conf entry for host "192.168.128.171", user "appuser", database "tipsdb", SSL off
    SQLState=08001 ErrorCode=101]

     

     

     

      

     

     

     

     

     

     

     

     

     






  • 23.  RE: clearpass active session restriction

    Posted 8 days ago

    You appear to have overwritten/changed the password for the auth source, which is probably the most important thing to not do when dealing with a default authentication source.

    Since you are already on a trial license my recommendation would be to re-deploy the ClearPass appliance as I'm not sure you could get that back to a working state any longer.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 24.  RE: clearpass active session restriction

    Posted 8 days ago

    Is It any possibilities there deploy same infra 




  • 25.  RE: clearpass active session restriction

    Posted 8 days ago

    I'm not clear on what your ask is.



    ------------------------------
    Carson Hulcher, ACEX#110
    ------------------------------



  • 26.  RE: clearpass active session restriction

    Posted 8 days ago

    Please check the Qery once again now query is saving with same error i have removed the port 

    After connecting a wireless user session, the Access Tracker alerts are showing the different issue as before. Currently, the ClearPass version running is 6.11, and I am unable to re‑deploy the ClearPass appliance, which is why I am requesting your assistance again.