IBM Verify

IBM Verify

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Preserving session credential attributes across multiple authentications (step-up)

    Posted 27 days ago

    I have a requirement to maintain session credential attribute information across multiple authentication levels.  In my case, the user first authenticates to a cert required webseal instance and hence the first auth level is ssl.  During this authentication, I use the user name mapping module XSLT (could just as easily use LUA) to grab various x509 attributes, such as the cert fingerprint and valid to/from information, and put in various session credential attributes.  These attributes are then passed to backend applications using HTTP headers or other means as they are required to either present information to the backend for authorization decisions or user informational screens.

    When the user changes authentication levels upwards to another level, for example password or EAI, these session credential attributes are not preserved.  I have tried both using the user name mapping module and LUA to try to preserve these attributes with no success.  During the user name mapping module, if stepping up to password, the x509 attributes are not available during the password step-up authentication.  For LUA, the same applies.

    Regarding LUA, I turned on every stage of transformation on a test LUA rule that outputs the entire context.  I then enabled debugging on pdweb.http.transformation (level 9) and collected the output to try to determine during the POST /pkmslogin.form if I could grab the previous session credential attributes before the authentication occurred and then set them back later.  Unfortunately it seems the pkmslogin.form can only be transformed at the request and postauthn:password stage.  At the request stage, there are no session attributes available.  At the postauthn stage, the authentication has already occurred and I've lost the x509 data I need.

    I then had the idea of perhaps I could set actual session attributes, not session credential attributes.  However, if I try to use Session.setSessionAttribute() in the LUA rule at the response stage, I get "service unavailable" from webseal and see DSC issues in the webseal logs.  If I try to set it at the postauthn:ssl stage, there is no session ID and there is a message reported in the debug that notes "Not adding the session attribute: ... (no session)".  Note, I can successfully set session credential attributes using Session.setCredentialAttribute.  I was hoping, however, that perhaps if I set an actual session attribute it would be preserved after the credential changes from ssl to password, and hence in the postauthn:password stage I might be able to retrieve those session attributes from the ssl stage and put them on the session password credential attributes.

    In my case, my requirement is to make the ssl x509 information available after a step-up password authentication has occurred, and to not to make a call to an external dependency (i.e. the runtime) to reduce potential impacts to authentication (latency and reliability).  One of my other thoughts was to try coding a LUA EAI for the password authentication, but this would also mean having to handle password changes, etc. which would be a lot of code to maintain and hence complexity.  In addition, from what I've seen, I still don't think the x509 attributes would be available even to the EAI when the step-up occurs.  The only other thought was to use LUA to make use of some external means to store the x509 information between the authentication levels, meaning, using a database, LDAP, Redis, or something custom to maintain the cert data in between the authentication levels.  However, using an external store introduces a dependency into the authentication flow which is against my initial set of requirements.

    I'm hoping that perhaps someone else has had to preserve x509 attributes from an ssl authentication for a later stage of authentication, such as after additional MFA occurs.  Any thoughts would be greatly appreciated.  Thus far I have hit a dead end on this, yet this is a customer requirement I have to meet.



    ------------------------------
    Matt Jenkins
    ------------------------------


  • 2.  RE: Preserving session credential attributes across multiple authentications (step-up)

    Posted 27 days ago

    Matt,

     

    I would change your configuration to use Lua for the client certificate authentication (an example Lua script is provided at: https://www.ibm.com/docs/en/sva/10.0.8?topic=scenarios-creating-lua-client-certificate-authentication-module), and then set the desired attributes as both credential attributes and session attributes.  I tried storing the session attributes in my own environment, in my postazn authentication Lua script, and everything worked as expected.

     

    During a re-authentication operation you should then be able to use a 'postauthn' Lua script to set the new credential attributes from the saved session attributes.  If you are using an EAI authentication you would also need to ensure that the retain-eai-session configuration entry is enabled.

     

     

    Does this help?

     

     

    Scott Exton

    IBM Verify platform architect

    IBM Master Inventor

     

    1 Corporate Court, Bundall, QLD 4217.

    E-mail: scotte@au1.ibm.com

     






  • 3.  RE: Preserving session credential attributes across multiple authentications (step-up)

    Posted 25 days ago

    Cert EAI auth is not working on v11.0.0.0_IF1 following the example in the knowledge center.  The LUA is never called and it goes into an endless redirect loop (likely due to LRR).

    At first I just tried to use eai-uri = %lua-eai% in the [certificate] stanza and setup the transform.  That didn't work so I moved forward with setting up all the trigger URLs and LRR according to the docs.  Even with a simple LUA it would not invoke the transform rule.  I made sure to disable the user-map-authn and disable all other transform rules to rule anything else out.

    If I could just use the eai-uri in cert things would not be so complicated.  However, messing around with the LRRs is just introducing a whole new complexity into our authN flow where things could go sideways.  In any case, I can't get either to work, simply using just eai-uri or using it in conjunction with all the LRR stuff.

    I assume you used Session.setSessionAttribute() in the postazn and Session.getSessionAttribute() in the postauthn:password stage?  I assume setSessionAttribute must only work during the postazn which from what I recall I could not get to fire on /pkmslogin.form.  I could only get the password authN to fire request, postauthn:password, and response, and I couldn't set the session credential in any place.

    I have an idea/RFE out there for you all to enhance the product to carry the session credential attributes (or x509 attributes) into the next credential attributes when a step-up occurs.  From what I am seeing, it still doesn't look feasible with LUA since I can't get the LUA in this case to be an EAI for cert auth.

    Here is the config I used:

    [http-transformations]
    pkmslogin.lua = cert-eai.lua
    
    [http-transformations:pkmslogin.lua]
    request-match = postazn:GET /pkmslogin.lua*
    
    [certificate]
    accept-client-certs = required
    eai-uri = %lua-eai%
    
    [eai-trigger-urls]
    trigger = /pkmslogin.lua*
    
    [acnt-mgt]
    enable-local-response-redirect = yes
    
    [local-response-redirect]
    local-response-redirect-uri = [login] /pkmslogin.lua
    
    [user-map-authn]
    # rules-file = 
    
    
    In cert-eai.lua:
    Authentication.setUserIdentity(Client.getCertificateField("SubjectDN"), false)
    


    ------------------------------
    Matt Jenkins
    ------------------------------



  • 4.  RE: Preserving session credential attributes across multiple authentications (step-up)

    Posted 24 days ago

    Matt,

     

    I just tried this in my environment – and everything worked fine (admittedly I am running 11.0.0.0 and not 11.0.0.0_IF1 – but I don't imagine that this would make much difference).

     

    In my environment I following the example which is provided in the documentation: https://www.ibm.com/docs/en/sva/11.0.0?topic=scenarios-creating-lua-client-certificate-authentication-module.

    In particular I did the following:

     

    1. Created a self-signed certificate and key, and added the certificate to the pdsrv keyfile
    2. Created a Lua rule to handle the authentication (authenticate.lua):

      -- Set the authentication response data.         

    Authentication.setUserIdentity(Client.getCertificateField("SubjectCN"), true)

    Authentication.setAuthLevel(1)              

                                                    

    Session.setSessionAttribute("attr.name", "attr.value") 

     

    1. Created a Lua rule to display the session attribute (postazn.lua):

      print("Request: ", HTTPRequest.getURL())               

    print("Session: ", Session.getSessionAttribute("attr.name"))

    1. Made the following changes to the WebSEAL configuration file:

      [http-transformations]
      authenticate = authenticate.lua
      postazn = postazn.lua

      [http-transformations:authenticate]
      request-match = postazn:GET /pkmslogin.lua*

      [http-transformations:postazn]
      request-match = postazn:GET *

      [eai]
      eai-auth = https

      [eai-trigger-urls]
      trigger = /pkmslogin.lua*

      [certificate]
      accept-client-certs = optional
      eai-uri = %lua-eai%

      [acnt-mgt]
      enable-local-response-redirect = yes

      [local-response-redirect]
      local-response-redirect-uri = [login] /pkmslogin.lua

    2. Attached an ACL which allowed unauthenticated access to /pkmslogin.lua

     

    After doing this I was able to use the client certificate to authenticate, and could see the saved session attribute displayed in the WebSEAL log file on subsequent requests.  I haven't tested a re-authentication to ensure that the session attributes remain, but providing you set 'retain-eai-sesison' to true, I can't see any reason why this wouldn't work.

    In response to some of the comments made in your last post:

    • I suspect that your endless redirect loop is because an ACL which allows unauthenticated access to the '/pkmslogin.lua' resource hasn't been attached.
    • The local-response-redirect is required so that we can use a single URL for authentication (i.e. /pkmslogin.lua).  Without the LRR you would need another mechanism to force a user to authenticate at '/pkmslogin.lua'.
    • As per the documentation, the Session object is available in all stages other than the 'request' stage.
    • I recall the RFE which was raised for being able to preserve credential attributes across authentication operations, but unfortunately there is not ETA yet on when this might be available.

     

    I hope that this helps.

     

    Scott Exton

    IBM Verify platform architect

    IBM Master Inventor

     

    1 Corporate Court, Bundall, QLD 4217.

    E-mail: scotte@au1.ibm.com