Available as of v2.4.0

This section contains the legacy documentation for the CIS Scan tool that was released in Rancher v2.4, and was available under the Tools menu in the top navigation bar of the cluster manager.

As of Rancher v2.5, it is deprecated and replaced with the rancher-cis-benchmark application.

Prerequisites

To run security scans on a cluster and access the generated reports, you must be an Administrator or Cluster Owner.

Rancher can only run security scans on clusters that were created with RKE, which includes custom clusters and clusters that Rancher created in an infrastructure provider such as Amazon EC2 or GCE. Imported clusters and clusters in hosted Kubernetes providers can’t be scanned by Rancher.

The security scan cannot run in a cluster that has Windows nodes.

You will only be able to see the CIS scan reports for clusters that you have access to.

Running a Scan

  1. From the cluster view in Rancher, click Tools > CIS Scans.
  2. Click Run Scan.
  3. Choose a CIS scan profile.

Result: A report is generated and displayed in the CIS Scans page. To see details of the report, click the report’s name.

Scheduling Recurring Scans

Recurring scans can be scheduled to run on any RKE Kubernetes cluster.

To enable recurring scans, edit the advanced options in the cluster configuration during cluster creation or after the cluster has been created.

To schedule scans for an existing cluster:

  1. Go to the cluster view in Rancher.
  2. Click Tools > CIS Scans.
  3. Click Add Schedule. This takes you to the section of the cluster editing page that is applicable to configuring a schedule for CIS scans. (This section can also be reached by going to the cluster view, clicking ⋮ > Edit, and going to the Advanced Options.)
  4. In the CIS Scan Enabled field, click Yes.
  5. In the CIS Scan Profile field, choose a Permissive or Hardened profile. The corresponding CIS Benchmark version is included in the profile name. Note: Any skipped tests defined in a separate ConfigMap will be skipped regardless of whether a Permissive or Hardened profile is selected. When selecting the the permissive profile, you should see which tests were skipped by Rancher (tests that are skipped by default for RKE clusters) and which tests were skipped by a Rancher user. In the hardened test profile, the only skipped tests will be skipped by users.
  6. In the CIS Scan Interval (cron) job, enter a cron expression to define how often the cluster will be scanned.
  7. In the CIS Scan Report Retention field, enter the number of past reports that should be kept.

Result: The security scan will run and generate reports at the scheduled intervals.

The test schedule can be configured in the cluster.yml:

  1. scheduled_cluster_scan:
  2. enabled: true
  3. scan_config:
  4. cis_scan_config:
  5. override_benchmark_version: rke-cis-1.4
  6. profile: permissive
  7. schedule_config:
  8. cron_schedule: 0 0 * * *
  9. retention: 24

Skipping Tests

You can define a set of tests that will be skipped by the CIS scan when the next report is generated.

These tests will be skipped for subsequent CIS scans, including both manually triggered and scheduled scans, and the tests will be skipped with any profile.

The skipped tests will be listed alongside the test profile name in the cluster configuration options when a test profile is selected for a recurring cluster scan. The skipped tests will also be shown every time a scan is triggered manually from the Rancher UI by clicking Run Scan. The display of skipped tests allows you to know ahead of time which tests will be run in each scan.

To skip tests, you will need to define them in a Kubernetes ConfigMap resource. Each skipped CIS scan test is listed in the ConfigMap alongside the version of the CIS benchmark that the test belongs to.

To skip tests by editing a ConfigMap resource,

  1. Create a security-scan namespace.
  2. Create a ConfigMap named security-scan-cfg.
  3. Enter the skip information under the key config.json in the following format:

    1. {
    2. "skip": {
    3. "rke-cis-1.4": [
    4. "1.1.1",
    5. "1.2.2"
    6. ]
    7. }
    8. }

    In the example above, the CIS benchmark version is specified alongside the tests to be skipped for that version.

Result: These tests will be skipped on subsequent scans that use the defined CIS Benchmark version.

Setting Alerts

Rancher provides a set of alerts for cluster scans. which are not configured to have notifiers by default:

  • A manual cluster scan was completed
  • A manual cluster scan has failures
  • A scheduled cluster scan was completed
  • A scheduled cluster scan has failures

Prerequisite: You need to configure a notifier before configuring, sending, or receiving alerts.

To activate an existing alert for a CIS scan result,

  1. From the cluster view in Rancher, click Tools > Alerts.
  2. Go to the section called A set of alerts for cluster scans.
  3. Go to the alert you want to activate and click ⋮ > Activate.
  4. Go to the alert rule group A set of alerts for cluster scans and click ⋮ > Edit.
  5. Scroll down to the Alert section. In the To field, select the notifier that you would like to use for sending alert notifications.
  6. Optional: To limit the frequency of the notifications, click on Show advanced options and configure the time interval of the alerts.
  7. Click Save.

Result: The notifications will be triggered when the a scan is run on a cluster and the active alerts have satisfied conditions.

To create a new alert,

  1. Go to the cluster view and click Tools > CIS Scans.
  2. Click Add Alert.
  3. Fill out the form.
  4. Enter a name for the alert.
  5. In the Is field, set the alert to be triggered when a scan is completed or when a scan has a failure.
  6. In the Send a field, set the alert as a Critical, Warning, or Info alert level.
  7. Choose a notifier for the alert.

Result: The alert is created and activated. The notifications will be triggered when the a scan is run on a cluster and the active alerts have satisfied conditions.

For more information about alerts, refer to this page.

Deleting a Report

  1. From the cluster view in Rancher, click Tools > CIS Scans.
  2. Go to the report that should be deleted.
  3. Click the ⋮ > Delete.
  4. Click Delete.

Downloading a Report

  1. From the cluster view in Rancher, click Tools > CIS Scans.
  2. Go to the report that you want to download. Click ⋮ > Download.

Result: The report is downloaded in CSV format. For more information on each columns, refer to the section about the generated report.

List of Skipped and Not Applicable Tests

For a list of skipped and not applicable tests, refer to this page.