Vigiles API

The LinuxLink API uses HMAC authentication to verify each request made by a user. Timesys [provides a Python module] with pre-built functions to interact with the LinuxLink site. There is also a driver.py
available that allows command-line usage of the LLAPI module. There are examples of using the driver below, but running

 $ ./driver.py -h
will also provide you with the options available.

Vigiles API Manual

Documentation on each route is available in the Vigiles API Manual.

Initializing LLAPI

Download llapi.py

To use the module, you must first import the LLAPI object, and initialize it. If you are using the driver, just make sure the files and environment variables specified in the initialization below are correct.

from llapi import LLAPI

home_dir = os.path.expanduser('~')

# The default API Keyfile path is ~/timesys/linuxlink_key
# Use the KEY_FILE environment variable to set your own path.
key_file = os.getenv('KEY_FILE', '%s/timesys/linuxlink_key' % home_dir)
if not os.path.exists(key_file):
    print('Error: No key file.')
    sys.exit(0)

llapi_kwargs = {}

# The default Dashboard Config path is ~/timesys/dashboard_config
# Use the DASHBOARD_CONFIG environment variable to set your own path.
dashboard_config = os.getenv('DASHBOARD_CONFIG', '%s/timesys/dashboard_config' % home_dir)
if os.path.exists(dashboard_config):
    llapi_kwargs["dashboard_config_path"] = dashboard_config

# The default URL is https://linuxlink.timesys.com
# Use the LINUXLINK_SERVER environment variable to set your own URL.
server_url = os.getenv('LINUXLINK_SERVER')
if server_url:
    llapi_kwargs["url"] = server_url

# Create LLAPI object with provided context
llapi = LLAPI(key_file, **llapi_kwargs)

This will provide you with an LLAPI object that contains your API key, and optionally set the product you would like to interact with, as well as the URL for the LinuxLink server. In the future, we will be offering an on-site LinuxLink solution, but for now the default is fine.

Using the LLAPI object

Once your LLAPI object is initialized, you can use it to call the following functions.

Get Heartbeat

This function makes a simple GET request to the LinuxLink server, to ensure that the server is available, and that HMAC authentication is working properly.

Example Module Usage:

llapi.get_heartbeat()

Example Driver Usage:

 $ ./driver.py get_heartbeat

Example Response:

{ 'ok': True }

Upload Manifest

This function uploads a manifest, scans it, and returns the generated CVE Report. If the manifest already exists in the target product, it will simply be re-scanned.

Example Module Usage:

with open(manifest_path, 'r') as manifest:
    llapi.upload_manifest(manifest.read())

Example Driver Usage:

 $ ./driver.py upload_manifest <path to manifest> -k <optional, path to kernel config> -u <optional, path to uboot config> -n <optional, manifest name>

Example Response:

{ 'arch_cves': [],
  'counts': { ... },
  'cves': { .. },
  'date': 'date/time the report was generated',
  'report_path': 'resource for the online version of the CVE Report',
}