1. Overview

Prisma Cloud lets you create rules that block access to resources or block the deployment of non-compliant containers.

For example, you might create a rule that blocks the deployment of any image that has critical severity vulnerabilities. By default, when you try to run non-compliant image, Prisma Cloud returns a terse response:

# docker -H :9998 --tls run -ti morello/docker-whale
docker: Error response from daemon: [Prisma Cloud] operation blocked by policy: (test-compliance), host has 19 compliance issues.

To help the operator better understand how to handle a blocked action, you can enhance Prisma Cloud’s default response by

  • Appending a custom message to the default message. For example, you could tell operators where to go to open a ticket.

  • Configuring Prisma Cloud to return an itemized list of compliance issues rather than just a summary. This way, the operator does not need to contact the security team to determine which issues are preventing deployment. They are explicitly listed in the response.

Enhanced terminal output is available for rules created under:

  • Defend > Vulnerabilities > Policy

  • Defend > Compliance > Policy

  • Defend > Access (Docker Engine, Docker Swarm, and Kubernetes access control rules).

2. Specifying a custom message

This procedure shows you how to create an access control rule that blocks all users from running the container_create operation. You will configure the rule to emit the following custom message when an action is blocked:

Contact admin@example.com to get additional privileges

Although this procedure is specific to access control rules, the process for configuring custom messages for vulnerability and compliance rules is the same.

  1. Open Console.

  2. Go to Defend > Access > Docker, then click New Docker rule.

  3. In the new rule dialog, enter the following information:

    1. In Rule name, enter a name.

    2. Set Effect to Deny.

    3. In Show, uncheck All to deselect all actions.

    4. In Actions, check container_create.

      customize terminal output 765462
    5. Click on the Advanced tab.

    6. In Custom message for blocked requests, enter Contact admin@example.com to get additional privileges.

    7. Click Save.

  4. Test your setup by running a command that violates your access control rule.

    1. Install your client certs.

      For more information, see Configure Docker client variables.

    2. Try to run a container on a host protected by Prisma Cloud:

      $ docker --tlsverify -H  <HOST>:9998 run ubuntu:latest
      docker: Error response from daemon: [Prisma Cloud] The command container_create denied for user aqsa by rule Block create. Contact admin@example.com to get additional privileges.
      See 'docker run --help'.

      Where <HOST> is the hostname or IP address for a host running Defender.

3. Output itemized list of compliance issues

You can configure vulnerability and compliance rules to return a detailed list of issues when Prisma Cloud blocks a deployment.

In this procedure, you create a vulnerability rule that prevents the deployment of any image that contains any type of vulnerable package.

Although this procedure is specific to vulnerability rules, the process for compliance rules is the same.

  1. Open Console.

  2. Create a new vulnerability rule (Defend > Vulnerabilities > Policy) or compliance rule (Defend > Compliance > Policy).

  3. In the new rule dialog, enter the following information:

    1. Enter a rule name.

    2. Specify conditions that trigger a block action.

      For example, for the Image contains vulnerable OS packages condition in a vulnerability rule, set the Action to Block and set the Severity threshold to Low.

    3. Set Terminal output verbosity for blocked requests to Detailed.

    4. Click Save.

  4. Test your setup by deploying an image with vulnerabilities.

    On a host protected by Prisma Cloud, run an image with vulnerabilities.

    $ docker run --rm -it ubuntu:14.04 sh
    docker: Error response from daemon: [Prisma Cloud] Image operation blocked by policy: (sdf), has 44 vulnerabilities, [low:25 medium:19].
    Image          ID       CVE             Package   Version             Severity   Status
    ====          ==       ===             =======   =======             ========   ======
    ubuntu:14.04   4333f1   CVE-2017-2518   sqlite3   3.8.2-1ubuntu2.1    medium     deferred
    ubuntu:14.04   4333f1   CVE-2017-6512   perl      5.18.2-2ubuntu1.1   medium     needed
      .
      .
      .