Skip to main content

Paclair is a Python3 Cli tool to interact with Coreos’s Clair.

Features:

  • Now compatible with Clair V3 (delete is not available)

  • No need to have docker installed since Paclair interacts directly with the registries.

  • Compatible with all registries.

  • Simple to use.

  • Easy integration in a CI job thanks to a lightweight output mode.

Installation

To install Paclair, simply use pip (or pipenv):

$ pip install paclair
✨🍰✨

Voilà!

Configuration

Example

An example configuration file is available in the conf directory

General:
  clair_url: 'https://localhost:6060'
  # clair_api_version: 3
  # Whitelist known CVE's not to shown in html report
  # cve_whitelist:
  #   - CVE-2016-9843
  #   - CVE-2016-9840
  #   - CVE-2016-6313
Plugins:
  Docker:
    class: paclair.plugins.docker_plugin.DockerPlugin
    registries:
      artifactory.registry.com:
        token_url: "https://artifactory.registry.com/api/docker/{image.repository}/v2/token?service=artifactory.registry.com"
        protocol: 'http'
        api_prefix: '/api/docker/{image.repository}'
      registry.gitlab.domain.com:
        auth:
          - "*****"
          - "*****"
      # Example for a private gitlab server
      gitlab.example.com:4567:
        # If using https with an internal CA, ensure verify is pointing to it
        protocol: 'https'
        verify: "/etc/ssl/certs/ca-certificates.crt"
        auth:
          - "*****"
          - "*****"
      # Example for ECR Docker Repository
      xxxxxxxxxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com:
        token: "" # Execute this command to get token aws ecr get-authorization-token --output text --query 'authorizationData[].authorizationToken'
        protocol: 'https'
        token_type: Basic

Plugins are dynamically loaded during execution. That’s why you have to specify the class of the plugins you want to use.

We have various plugins to interact with different sources (ex: docker registry, Elasticsearch) because we use a custom variant of Clair which can analyse more than Docker images.

If you want to use Paclair only to analyse docker images, don’t bother with others plugins.

Options

Config Option

Description

General::clair_url

url of the Clair Server.

General::verify

Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use.

General::clair_api_version

Clair Api Version. If different from 3, will be set to default. Default to 1.

General::html_template

Html template. You can use a custom html template when using html output.

General::cve_whitelist

CVE vulnerability list not to be included in the report post analysis (stats or html).

Plugins

List of plugins to use. If you only want to analyse docker images, keep the default configuration.

Plugins::Docker::class

Class for the docker plugin

Plugins::Docker::registries

You can specify configuration for registries (authentification, …) if needed.

Plugins::Docker::registries::regi stry1::auth

login/password

Plugins::Docker::registries::regi stry1::verify

Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use.

Plugins::Docker::registries::regi stry1::protocol

Protocol to use (http or https). Default to https.

Plugins::Docker::registries::token

You can specify an authentication token (use with token_type). Default to None.

Plugins::Docker::registries::token _type

Specify the token type. Default to Bearer.

Running the tests

Launch tox.

$ tox

Usage

usage: paclair [-h] [--debug] [--syslog] [--conf CONF]
               plugin hosts [hosts ...] {push,delete,analyse} ...

positional arguments:
  plugin                Plugin to launch
  hosts                 Image/hostname to analyse
  {push,delete,analyse}
                        Command to launch
    push                Push images/hosts to Clair
    delete              Delete images/hosts from Clair
    analyse             Analyse images/hosts already pushed to Clair

optional arguments:
  -h, --help            show this help message and exit
  --debug               Debug mode
  --syslog              Log to syslog
  --conf CONF           Conf file

Analyse command usage

usage: paclair plugin hosts [hosts ...] analyse [-h]
                                            [--output-format {stats,html}]
                                            [--output-report {file,term}]
                                            [--output-dir OUTPUT_DIR]
                                            [--delete]

optional arguments:
  -h, --help            show this help message and exit
  --output-format {stats,html}
                        Change default output format (default: json)
  --output-report {file,term}
                        Change report location (default: logger)
  --output-dir OUTPUT_DIR
                        Change output directory (default: current)
  --delete              Delete after analyse

Examples

Push ubuntu image to Clair

$ paclair --conf conf/conf.yml Docker ubuntu push
Pushed ubuntu to Clair.

Analyse ubuntu image (stats only show fixable CVE)

$ paclair --conf conf/conf.yml Docker ubuntu analyse --output-format stats
Medium: 3

You can have the full json if you don’t specify –output-format stats.

Analyse ubuntu image and get a html report in directory /tmp

$ paclair --conf conf/conf.yml Docker ubuntu analyse --output-format html --output-dir /tmp

Delete ubuntu image

$ paclair --conf conf/conf.yml Docker ubuntu delete
ubuntu was deleted from Clair.

Contributing

Feel free to contribute.

Authors

Metadata

Release files for paclair 3.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paclair 3.2.1
File Size Uploaded
paclair-3.2.1.tar.gz 31.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for paclair 3.2.1
File Interpreter ABI Platform
paclair-3.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 62.5 kB

Release files / paclair-3.2.1.tar.gz

Download URL paclair-3.2.1.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ee4348961936f5ec1d784a6b30ec8a5cc66b5a41c68e1d86bee78ebeb66a99ba
BLAKE2b-256 checksum
How to use checksums
0d21f630c6b973bb117531f40d4a4cd9a1e0c21ee76c7d9890320d06262e4933
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / paclair-3.2.1-py3-none-any.whl

Download URL paclair-3.2.1-py3-none-any.whl
Size 30.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d29b33b3c3a35e7ad95a3cbc9d619edc362e3febcd668cbfaf74486248bda72
BLAKE2b-256 checksum
How to use checksums
189407b25316a80381c1833d5eb63caa569556fab6f17fb39d6b64e1226685b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release history Release notifications | RSS feed

This release

3.2.1 This release

2 release files

3.2.0

2 release files

3.1.1

2 release files

3.1.0

3 release files

3.0.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page