Forum Discussion

Asif_Thobhani_7's avatar
Asif_Thobhani_7
Icon for Nimbostratus rankNimbostratus
Jun 12, 2008

How can I read the persistence profile settings using PROFILE::persist

Can someone please help with how to use the PROFILE::persist command?

 

 

From within my iRule, I want to find out what's the name of the cookie that's been used for persistence (cookie insert).

 

 

Here is what I have so far:

 

 

profile persist my_cookie_profile {

 

defaults from cookie

 

mode cookie

 

cookie mode insert

 

cookie name my_cookie

 

}

 

 

when CLIENT_ACCEPTED {

 

if { [PROFILE::exists clientssl] == 1} {

 

log local0. "client SSL profile enabled on virtual server"

 

}

 

if { [PROFILE::exists persist cookie] == 1} {

 

log local0. "persist cookie profile enabled on virtual server"

 

set perCookie [PROFILE::persist cookie ?] ===> What's the right command syntax here?

 

}

 

}

5 Replies

  • Thanks Aaron for your reply...

     

     

    We do have a custom cookie name and I need to read the name from within iRule, so that I can encrypt/decrypt the cookie....Since we have a generic rule, used by different projects (each having their own cookie name), we would like to read it from the PROFILE command.

     

     

    Anyone knows the right syntax for PROFILE:: commands? Any examples on how to use it would be really appreciate it. Wiki documentation is really incomplete.

     

     

    Thanks,

     

    -Asif

     

  • I think I finally figured out how to use the PROFILE::persist commands (after some trial and error)...

     

     

    Here is what I have along with the output

     

     

    profile persist my_cookie_profile {

     

    defaults from cookie

     

    mode cookie

     

    cookie mode insert

     

    cookie name MY_PERSIST_COOKIE

     

    cookie expiration 0d 00:10:00

     

    }

     

     

    when CLIENT_ACCEPTED {

     

    if { [PROFILE::exists clientssl] == 1} {

     

    log local0. "client SSL profile enabled on virtual server"

     

    set cert [PROFILE::clientssl cert]

     

    log local0. "clientssl certificate is: $cert"

     

    set key [PROFILE::clientssl key]

     

    log local0. "clientssl key is: $key"

     

    }

     

     

    if { [PROFILE::exists persist cookie] == 1} {

     

    log local0. "persist cookie profile enabled on virtual server"

     

    set cookie_profile_name [PROFILE::persist mode cookie name]

     

    log local0. "persist cookie profile name is: $cookie_profile_name"

     

    set persist_cookie_name [PROFILE::persist mode cookie cookie_name]

     

    log local0. "Name of the cookie used for persistence is: $persist_cookie_name"

     

    set cookie_expiration [PROFILE::persist mode cookie cookie_expiration]

     

    log local0. "Cookie expiration is set for: $cookie_expiration"

     

    }

     

    }

     

     

     

    ***********output**************

     

     

    Jun 18 00:30:34 tmm tmm[28049]: Rule read_PROFILE_Commands : client SSL profile enabled on virtual server

     

    Jun 18 00:30:34 tmm tmm[28049]: Rule read_PROFILE_Commands : clientssl certificate is: dev-crm.crt

     

    Jun 18 00:30:34 tmm tmm[28049]: Rule read_PROFILE_Commands : clientssl key is: dev-crm.key

     

    Jun 18 00:30:34 tmm tmm[28049]: Rule read_PROFILE_Commands : persist cookie profile enabled on virtual server

     

    Jun 18 00:30:34 tmm tmm[28049]: Rule read_PROFILE_Commands : persist cookie profile name is: my_cookie_profile

     

    Jun 18 00:30:34 tmm tmm[28049]: Rule read_PROFILE_Commands : Name of the cookie used for persistence is: MY_PERSIST_COOKIE

     

    Jun 18 00:30:34 tmm tmm[28049]: Rule read_PROFILE_Commands : Cookie expiration is set for: 600
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    I'm glad to hear things are working better for you now. Let us know if you've got any more questions to work through.

     

     

    Colin
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    I talked to PD about getting some details to update the PROFILE:: command pages, and they have agreed to work on it with us in the near term.

     

     

    I can't promise anything today, but stay tuned for updates. I will blog about it when we start getting it filled in.

     

     

    /deb
  • Hi iRuleYou,

     

     

    Is there something in particular you're looking for? If so and no one here can help, you might try opening a case with F5 Support asking them to provide details an update the wiki page. I got a good response for the PROFILE::http options from them.

     

     

    Aaron