Forum Discussion

cathy_123's avatar
cathy_123
Icon for Cirrus rankCirrus
Aug 30, 2024

Python script to get the SSL profile of a VIP

Hello guys I am creating an SSL automation and I am trying to get the ssl profile from inputted VIP..  I am using F5 rest api and I am not seeing much differences on the contents when I use this url 

url = f"https://{f5_hostname}/mgmt/tm/ltm/virtual/~Common~{vip_name}"

and filter using  profilesReference it  gave me all profiles sample below. From below contents, I dont know how to filter further to get the sslprofile as you see almost all of them has the same content, I cannot differentiate the ssl profile from others. any other way how to get the sslprofile from a VIP using python script?

 


        {
            "kind": "tm:ltm:virtual:profiles:profilesstate",
            "name": "myssslprofile.com",    ->>>> this is the ssl profile
            "partition": "Common",
            "fullPath": "/Common/myssslprofile.com",
            "generation": 1,
            "selfLink": "https://localhost/mgmt/tm/ltm/virtual/exampleVIP.com/profiles/~Common~myssslprofile.com?ver=16.x.x.x",
            "context": "clientside"
        },
        {
            "kind": "tm:ltm:virtual:profiles:profilesstate",
            "name": "tcp-lan-optimized",
            "partition": "Common",
            "fullPath": "/Common/tcp-lan-optimized",
            "generation": 1,
            "selfLink": "https://localhost/mgmt/tm/ltm/virtual/exampleVIP.com/profiles/~Common~tcp-lan-optimized?ver=16.x.x.x",
            "context": "serverside"
        },
        {
            "kind": "tm:ltm:virtual:profiles:profilesstate",
            "name": "tcp-wan-optimized",
            "partition": "Common",
            "fullPath": "/Common/tcp-wan-optimized",
            "generation": 1,
            "selfLink": "https://localhost/mgmt/tm/ltm/virtual/exampleVIP.com/profiles/~Common~tcp-wan-optimized?ver=16.x.x.x",
            "context": "clientside"
        },
        {
            "kind": "tm:ltm:virtual:profiles:profilesstate",
            "name": "anotheprofile",
            "partition": "Common",
            "fullPath": "/Common/anotheprofile",
            "generation": 1,
            "selfLink": "https://localhost/mgmt/tm/ltm/virtual/exampleVIP.com/profiles/~Common~anotheprofile?ver=16.x.x.x",
            "context": "serverside"
        },

  • To retrieve the SSL profile of a VIP (Virtual IP) using Python, you can use the requests library to make an HTTP GET request to the relevant API endpoint provided by your load balancer or myolsd firewall system. For example, if you're using a system like F5 BIG-IP, you would use its REST API.

  • Hi alexjames I am using REST API to get the virtual IP details https://{f5_hostname}/mgmt/tm/ltm/virtual/~Common~{vip_name} then further filter it using profilesReference. the result was above.. the problem is the content all looks the same..