Deployment using 'docker' command

This is an Alpha feature which is not fully supported

Use this option to deploy a single docker image containing CloudGuard WAF with a managed reverse proxy.

It is possible to manage the reverse proxy server by yourself. Read the instructions further in this document to see the changes in deployment instructions.

Prerequisites

  • Linux machine with:

    • Docker installed (or similar, compatible container runtime)

    • Root permissions

Configuration

Note - package file and folder names contain the name appsec - short for "Application Security" provided by CloudGuard WAF.

Step 1: Pull agent container image

As part of your CI, use the checkpoint/cloudguard-appsec-standalone registry to pull the unified NGINX and Nano-Agent image or use the following command:

docker pull checkpoint/cloudguard-appsec-standalone

Step 2: Obtain the registration token

Make sure you obtain the <token> from the Enforcement Profile page, Authentication section. you will need it during agent deployment.

Step 3: Run the agent

Run the agent with this command after replacing <token> with the copied token from previous step and removing unneeded optional parameters:

docker run -d --name=agent-container [-v=<path to persistent location for agent config>:/etc/cp/conf] [-v=<path to persistent location for agent data files>:/etc/cp/data] [-v=<path to persistent location for agent debugs and logs>:/var/log/nano_agent] [-v=<path to persistent location for nginx server conf files>:/etc/nginx/conf.d/] [-v=/appsec/etc/certs:/etc/certs/] [-e https_proxy=<user:password@Proxy address:port>] [-p <host SSL port>:443] [-p <host http port>:80] [-p <host health-check port>:8117] -it checkpoint/cloudguard-appsec-standalone /cloudguard-appsec-standalone --token <token>

Unique Parameters explanation:

ParameterDescriptionRequired?

-v=/appsec/etc/certs:/etc/certs/

Map persistent storage path for certificates to /etc/certs of the container. Note: We recommend using /appsec/etc/certs and refer to it in our documentation for storing certificates.

Yes for managed Reverse Proxy. If the web server uses only HTTP there is no need for this parameter. When managing Reverse Proxy by yourself, map the certificates according to your own deployment design.

-v=<path to persistent location for nginx server conf files>:/etc/nginx/conf.d/

Map persistent storage path for NGINX configuration files.

Yes when using the "unmanaged option". In this option the external persistent path is the means to locally manage the NGINX.

-v=<path to persistent location for agent config>:/etc/cp/conf -v=<path to persistent location for agent data files>:/etc/cp/data -v=<path to persistent location for agent debugs and logs>:/var/log/nano_agent

Map persistent storage path for agent files. Can be useful for debugging purposes if a container is no longer available.

No

-e https_proxy

Configure a proxy server for outbound traffic, if applicable.

No. Needed only in the specific case of outbound traffic through a proxy server.

-p <host health-check port>:8117

Expose an external port for health checks

Yes

-p <host http port>:80

Expose an external port for incoming HTTP traffic

Yes

-p <host SSL port:443]

Expose an external port for incoming HTTPS traffic

Yes If the web server uses only HTTP do not use this parameter.

For debugging purpose it is possible to activate an SSH server within the docker container by using the following parameters when running the docker. For security reasons, it is NOT recommended to use this option in production. --ssh-enable --ssh-user <username> --ssh-hash <hash>

The hash of you password can be calculated like this:

openssl passwd -6 -salt <user-salt> ClearTextPassword

  1. -6 indicates SHA-512

  2. <user-salt> is to randomize the encryption

Step 4: Deploy the container

Deploy the unified container.

To make sure that it is running, run: docker ps.

Step 5: Verify installation

Following the steps above, the agent will install and connect automatically.

Run the following command to check the status:

docker exec -it <CONTAINER_NAME> cpnano -s

CloudGuard AppSec web portal should also display a successful connection message:

Step 6: Certificates deployment (if the traffic is encrypted via HTTP)

pageStore Certificates Locally on Docker

How can I manage NGINX myself?

It is possible to have only security aspects managed centrally and manage nginx.conf and other config files by yourself.

Configuration

  • There is no need to add the upsteam URL for each Web application asset, because you will configure it yourself.

  • When creating a new Docker profile, make sure to select the option "I want to manage NGINX myself not via this management"

Running the agent (Step 3)

Run the agent with this command after replacing <token> with the copied token from previous step and removing unneeded optional parameters:

docker run -d --name=agent-container [-v=<path to persistent location for agent config>:/etc/cp/conf] [-v=<path to persistent location for agent data files>:/etc/cp/data] [-v=<path to persistent location for agent debugs and logs>:/var/log/nano_agent] -v=<path to persistent location for nginx server conf files>:/etc/nginx/conf.d/ [-e https_proxy=<user:password@Proxy address:port>] -it checkpoint/cloudguard-appsec-standalone /cloudguard-appsec-standalone --token <token> --nginx-self-managed

Note the addition of the --nginx-self-managed parameter in the end of the command.

Similar to managed Reverse proxy installation, almost all "-v" parameters and the –e https_proxy parameter are optional, except for the path to persistent location for nginx server conf files.

For more info on each parameter see table above.

Certificate management (Step 6)

To configure SSL certificates follow this guide for NGINX.

Last updated