Customize terminal output
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 and Kubernetes access control rules).
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.
- Open Console.
- Go toDefend > Access > Docker, then clickNew Docker rule.
- In the new rule dialog, enter the following information:
- InRule name, enter a name.
- SetEffecttoDeny.
- InShow, uncheckAllto deselect all actions.
- InActions, checkcontainer_create.
- Click on theAdvancedtab.
- InCustom message for blocked requests, enterContact admin@example.com to get additional privileges.
- ClickSave.
- Test your setup by running a command that violates your access control rule.
- Install your client certs.For more information, see Configure Docker client variables.
- 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.
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.
- Open Console.
- Create a new vulnerability rule (Defend > Vulnerabilities > Policy) or compliance rule (Defend > Compliance > Policy).
- In the new rule dialog, enter the following information:
- Enter a rule name.
- Specify conditions that trigger a block action.For example, for theImage contains vulnerable OS packagescondition in a vulnerability rule, set theActiontoBlockand set theSeveritythreshold toLow.
- SetTerminal output verbosity for blocked requeststoDetailed.
- ClickSave.
- 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 . . .