Automating F5 Licensing - without direct internet access

Hello DevCentral Community!

I'm excited to share a project I've been working on recently: **Automating F5 BIG-IP VE Licensing** without needing direct internet access!

The project covers:

  • Retrieving a Dossier automatically via iControl REST API.
  • Interacting with F5 licensing servers through proxies or offline.
  • Re-activating licenses post-upgrade using custom scripts.
  • Full Python 3 support (moving away from BigSuds/Python 2 limitations).

âś… The idea is to help users who need to automate the licensing process, especially for secure or offline environments.

I'll be sharing:

  • Scripts
  • Use cases
  • Lessons learned
  • Tips for real-world deployments

If you're interested in automating your BIG-IP licensing process, feel free to follow along! Feedback, ideas, or collaboration is most welcome! 🚀

import requests
import json
import urllib3

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

class BigIPLicenseManager:
    def __init__(self, host, username, password, registration_key):
        self.host = host
        self.username = username
        self.password = password
        self.registration_key = registration_key
        self.base_url = f"https://{self.host}/mgmt/tm/sys/license"
        self.headers = {'Content-Type': 'application/json'}

    def get_dossier(self):
        payload = {
            "command": "install",
            "registrationKey": self.registration_key
        }
        response = requests.post(
            self.base_url,
            auth=(self.username, self.password),
            headers=self.headers,
            json=payload,
            verify=False
        )
        if response.status_code == 200:
            data = response.json()
            dossier = data.get('dossier')
            if dossier:
                print("[+] Dossier retrieved successfully.")
                return dossier
            else:
                print("[-] No dossier found in response.")
                return None
        else:
            print(f"[-] Failed to retrieve dossier: {response.text}")
            return None

    def install_license(self, license_text):
        payload = {
            "command": "install",
            "licenseText": license_text
        }
        response = requests.post(
            self.base_url,
            auth=(self.username, self.password),
            headers=self.headers,
            json=payload,
            verify=False
        )
        if response.status_code == 200:
            print("[+] License installed successfully.")
        else:
            print(f"[-] Failed to install license: {response.text}")

if __name__ == "__main__":
    # Define your BIG-IP credentials and registration key here
    bigip_host = "192.168.1.245"
    bigip_username = "admin"
    bigip_password = "admin"
    registration_key = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE"

    manager = BigIPLicenseManager(
        bigip_host,
        bigip_username,
        bigip_password,
        registration_key
    )

    dossier = manager.get_dossier()
    if dossier:
        # Print the dossier to manually activate it via activate.f5.com
        print("\n[!] Submit the following dossier to F5 activation server:")
        print(dossier)

        # After getting the license text (offline or from a licensing server)
        license_text = input("\nPaste the license text here:\n")

        manager.install_license(license_text.strip())
Updated Apr 30, 2025
Version 2.0