TMSH/Bash command to check which SAML: BIG-IP as IdP profile is using a specific SSL certificate

I have multiple IdP profiles using the same SSL certificate. Is there a command I can run to list the IdP profiles associated to specific certificate.

This would be similar to running ‘tmsh list ltm virtual all one-line | grep [ssl-profile-name]’ to find what VS a SSL Profile is bound to…

Cheers,

tmsh -q -c "cd /; list /apm sso saml idp-certificate | grep cert

Or something like this.

[Edited]

Thanks for above but this does’t seem to do what I require..

The above shows which LTM SSL profile the certificate is bound to but doesn’t specify the APM Access Policy  ››  SAML : BIG-IP as IdP profile/s related to the certificate name.

Anymore ideas?

Edited answer above.

Thanks for prompt reply… I’m probably doing something wrong but the above is not giving me any results even though I know there are IdP profiles associated to the certificate.

In your above command I’m guessing I exchange ‘cert’ for the certificate name I’m querying but when I hit enter it just prompts to a new line ‘>’

Even if I switch ‘idp-certificate’ with the certificate name I receive the same result; new line ‘>’ like it’s waiting for input?

Trying to fit my query into your command I’d be trying to: list the apm sso saml idp-profiles that contain ‘specific certificate name’ as the ‘Signing Certificate’ located in the ‘IdP Service’ ‘Security Settings’.

I hope I’m explaining this correctly. Sorry for any confusion.

What do you get with just this:

tmsh -q -c "cd /; list /apm sso saml idp-certificate"

?

[Edited]

[username_admin@F5Name:Active:In Sync] ~ # tmsh -q -c "cd /; list /apm sso saml idp-certificate

>

Sorry, there was a typo.

Yeah okay so now seems to run although I receive no results..

Trying your original command with the added " I get the below. Have tried without .crt with same result.

[username_admin@F5:Active:In Sync] ~ # tmsh -q -c "cd /; list /apm sso saml idp-certificate | grep CertificateName.crt"
 Syntax Error: unexpected argument "|"

Thanks for your time on this.. I have a fair few certs that are used against multiple IdP profiles and I don’t want to manually go into each profile to confirm ‘Security Settings’ of the IdP profile.

tmsh -q -c "cd /; list /apm sso saml idp-certificate" | grep CertificateName.crt

OK we’re getting somewhere now… that runs but nothing written to screen and no results look to be written to the device. Again tried with/without .crt and I’m positive that the certificate is used in the ‘Security Settings’ for multiple IdP profiles…

JG, just responding to your last reply I got via email (not sure why didn’t show in this forum chain?). You asked does the below show all objects related to SAML

tmsh -q -c "cd /; list /apm sso saml recursive"

I’ve run the above and it does list all the APM SSO SAML profiles and the profile settings which includes the certificate used.

I guess I can export this to file and massage the data to list only my requirements or I might be able to hack the query a bit to only show the required data.

I’m pretty happy with this unless you can help further without too much hassle. Your time/effort is very much appreciated.

You can limit the output of the display to the idp-certificate attribute only, with:

tmsh -q -c list apm sso saml idp-certificate

but only if you are already in the partition /Common, for “recursive” is not available to this syntax.

You could also use “grep” on the output of:

tmsh -q -c "cd /; list /apm sso saml recursive"

If you could share the output of this command, we can work out the exact syntax of grep for your use.

Hello JG, please find below a ‘sanitized’ version of the output I received for 2 IdP profiles which use the same certificate. Ideally what i want to be able to do is either just list all the ‘apm sso saml’ profiles and the ‘idp-certificate’ associated with them (which we have although including the surrounding data) not a huge issue for me.

Or somehow search a specific certificate name and list the ‘apm sso saml’ profiles associated with the specific certificate.

[UserName_admin@F5-Name:Active:In Sync] ~ # tmsh -q -c "cd /; list /apm sso saml recursive"
apm sso saml Common/iDP-ProfileName-1 {
    description "IdP Service-1"
    entity-id https://idp-1.domain.com
    idp-certificate Common/idp.domain.com.crt
    idp-signkey Common/idp.domain.com.key
    saml-profiles { web-browser-sso }
    sp-connectors {
        Common/sp_ext_domain
    }
    subject-type transient
    subject-value "%{session.logon.last.logonname}"
}
apm sso saml Common/iDP_ProfileName-2 {
    description "IdP Service-2"
    entity-id https://idp-2.domain.com
    idp-certificate Common/idp.domain.com.crt
    idp-signkey Common/idp.domain.com.key
    saml-profiles { web-browser-sso }
    sp-connectors {
        Common/sp_ext_domain
    }
    subject-type transient
    subject-value "%{session.logon.last.logonname}"
}

Again thanks for you time.

Would the following work for you:

tmsh -q -c "cd /; list /apm sso saml recursive" | grep -E '(idp-certificate|saml-profiles)'

?

Def looking better. The above retrieves me a list of ‘entity-ids’ that use the specified ‘idp-certificate’.

I can pretty easily match these to the IdP profiles. I’m pretty happy with this result and am happy to continue to use the above to search the profiles moving forward. Your help with this is appreciated.

Cheers.