Forum Discussion

MABreton's avatar
MABreton
Icon for Nimbostratus rankNimbostratus
Sep 15, 2019

How to get bundle certificates subcollection using f5-sdk

Hi,

I'm trying to get the content of my certificate bundles using F5-sdk but I cannot find the way to load the subcollection.

certificates = b.tm.sys.file.ssl_certs.get_collection()
for cert in certificates:
    if cert.isBundle == 'true':
        cert_bundle = cert.bundlecertificates_s.get_collection()

I get the following error

AttributeError: '<class 'f5.bigip.tm.sys.file.Ssl_Cert'>' object has no attribute 'bundlecertificates_s'

If I copy the link I get from the attribute bundleCertificatesReference.link of the 'cert' object and access directly the link in a browser, it works.

Not sure what I'm doing wrong and would need help.

Thanks,

Marc

  • Any luck with this ? i'm looking for the same thing

    if this is not supported by the SDK yet, I guess we'll have to use the bundleCertificatesReference link to get it with a REST call.

  • Unfortunately I did not find a way with f5-sdk so I worked around the issue using "requests". In the example below, I excluded ca-bundle.crt.

     if certificate.isBundle == 'true' and certificate.name != 'ca-bundle.crt':
        r = session.get(certificate.bundleCertificatesReference['link'].replace('https://localhost', 'https://' + bigip_ip_address))
        if r.status_code == 200:
            for cert_bundle in r.json()['items']:
                # Cert treatment here