Install the Cloudflare Enforcer

If your organization uses Cloudflare, you can use HUMAN’s Cloudflare Enforcer to protect against malicious behavior. The Cloudflare Enforcer is installed using a Cloudflare Worker, or a snippet of code, and is deployed to your content delivery network (CDN). The Enforcer dictates how traffic should be handled per your organization’s standards.

You can learn how to install the Cloudflare Enforcer with this article.

This process uses the Deploy Tool, HUMAN’s recommended method for installing and updating the Enforcer. If you prefer a manual method, see our manual installation article.

Prerequisites

  • A Cloudflare account with permissions to create API tokens
  • Docker or Script, depending on your preferred method to run the deploy tool.
  • An Enforcer configuration file, enforcerConfig.json, which you can download from the Platform Settings > Enforcers, clicking on the appropriate Enforcer, and clicking Download configuration file . This file has the basic information for Enforcer functionality, such as your Application ID and remote authorization token, already filled in. Be sure to save it in a directory you’ll remember, like /deploy.
1

Create a Cloudflare API token

  1. Log in to your Cloudflare account.
  2. Navigate to My Profile > API Tokens > Create Token.
  3. Under Create custom token, click Get started.
  4. Enter a name for your token. Then, fill out the remaining fields according to the following:
Permissions groupResourcesAccess
AccountWorkers KV StorageEdit
AccountWorkers ScriptsEdit
AccountAccounts SettingsRead
AccountAccess: Apps and PoliciesRead
ZoneWorkers RoutesEdit
  1. Click Continue to summary.
  2. Click Create token.
  3. Copy and save the token in a secure location.

This will be the only time you’ll see your token, so be sure to save it before closing the page!

2

Run the Deploy Tool

First, download and run the Deploy Tool. You can do this by either pulling a Docker image or running a script.

Additional setup for Windows users

If you’re using Windows, you also need to complete additional steps to set up Docker:

  1. In your Windows search bar, search for and open Turn Windows features on or off.
  2. Find the Windows Hypervisor Platform feature and click its checkbox to enable it.
  3. Click OK to save your changes.
  4. Open Windows PowerShell as an Administrator.
  5. Copy and paste in C:\Windows\System32\wsl.exe --update --web-download, then hit Enter.
  1. Pull the Docker image by running:
$docker pull us-docker.pkg.dev/hmn-registry/docker-public/cdn-enforcer-deploy-tool
  1. Navigate to the directory where you saved enforcerConfig.json.
  2. Run the Deploy Tool with the following:
$docker run --rm -v $PWD:/app/local -it us-docker.pkg.dev/hmn-registry/docker-public/cdn-enforcer-deploy-tool
3

Deploy the Enforcer

After you run the Deploy Tool, you’ll be prompted with steps to deploy the Enforcer.

  1. When prompted, select Cloudflare Workers and hit Enter.
$🚀 HUMAN CDN Enforcer Deploy Tool 🚀
$? Which platform do you want to deploy to? (Use arrow keys)
$ ...
$ Cloudflare Workers
$ ...
  1. Follow the prompts that appear to complete the setup process.
  2. After you complete the setup, confirm that the displayed details are correct, then enter y to deploy the Enforcer.