Skip to Content
Providers

About cnspec Providers

Learn about cnspec providers and special considerations for containers and air-gapped or limited access assets

cnspec can scan and query dozens of different platforms, from AWS accounts to Windows hosts. Providers are the components of cnspec that allow it to work with specific platforms.

When you run a cnspec command, cnspec automatically downloads and installs the provider(s) you need. This saves download time, memory, and disk space, and ensures you always have the latest version. (New to cnspec? The Quickstart walks you through your first scan, where cnspec installs a provider for you behind the scenes.)

This page explains the provider concept and the few situations where you might need to manage providers yourself. When you're ready to act:

For example, suppose you download cnspec and install it on a Linux workstation. When you run a local scan, cnspec automatically downloads the operating systems (os) provider and runs the scan. The os provider remains on your workstation for next time.

If you then run cnspec shell aws, cnspec downloads the aws provider and opens the shell. The aws provider also remains on your workstation for future use.

Most users don't need to think about providers. cnspec manages them for you. However, there are some situations where you might want to manage providers yourself:

  • Containers
  • Read-only mode
  • Air-gapped environments

Containers

By default, when you spin up a container with cnspec installed and run any cnspec command, cnspec retrieves the latest version of the providers it needs. When the container is destroyed, the providers are destroyed. The next time you spin up a container based on the same image, the download and installation repeat.

To avoid this, you can:

Read-only mode

Some security situations dictate that cnspec must not be allowed to write to the machine on which it's installed. cnspec does operate in read-only mode; however, it can't download and install the providers it needs. Therefore, when you install cnspec on a machine on which cnspec won't have write access, you must also install the provider. To learn how, read Install a provider. To learn which directory cnspec loads providers from, read Where cnspec installs providers.

If you install cnspec in an environment where it can't automatically update providers, you're responsible for installing provider updates.

To prevent error messages when you run commands in read-only mode, disable provider auto-update. To learn how, read Disable automatic provider updates.

Air-gapped environments

In an air-gapped environment, cnspec can't download the providers needed to scan or test the system. Therefore, when you install cnspec on an air-gapped machine, you must also install the provider. To learn how, read Install a provider. To learn which directory cnspec loads providers from, read Where cnspec installs providers. If you run an internal mirror, you can instead point the updates_url setting at it.

If you install cnspec in an air-gapped environment, you're responsible for installing provider updates.

To prevent error messages when you run commands, disable provider auto-update. To learn how, read Disable automatic provider updates.

Where cnspec installs providers

cnspec installs providers into a directory that depends on the operating system and on the user that runs cnspec:

cnspec runsProvider directory
As root on Linux/opt/mondoo/providers
As root on macOS/Library/Mondoo/providers
As any other user on Linux or macOS~/.config/mondoo/providers
On Windows%USERPROFILE%\.config\mondoo\providers

When cnspec runs on Windows, or as a user other than root on Linux or macOS, it also loads the providers in the system directory (/opt/mondoo/providers, /Library/Mondoo/providers, or C:\ProgramData\Mondoo\providers). Providers installed there are available to every user on the machine.

To see the directories cnspec reads and the providers in each, run:

cnspec providers

Use a custom provider directory

To keep providers in a different directory, set the PROVIDERS_PATH environment variable to that directory. cnspec then installs, updates, and loads providers only from that directory and ignores the default directories. It creates the directory when it installs the first provider.

To set the directory for a single command:

PROVIDERS_PATH=/srv/mondoo/providers cnspec providers install os

Set PROVIDERS_PATH the same way for every cnspec command that should use those providers, for example in your shell profile, in the environment of the cnspec service, or in a container image.

Last updated on

On this page