Installation
- Install the dependencies:
-
Copy
libvmod_px.so
file to Varnish VMODS directory (this directory depends on Linux distribution:/usr/lib/varnish/vmods/
or/usr/lib64/varnish/vmods/
). -
In your configuration
.vcl
file:- At the top of the file, add these two lines that will import the Enforcer:
import px;
import std;
- At the top of the file, add these two lines that will import the Enforcer:
-
Add the following lines to the
sub vcl_init
block to enable the Enforcer and provide the required parameters:- px_enabled - Set to
true
to enable the Enforcer. - px_appId - Enter the HUMAN application ID.
To retrieve the ID:- Open the HUMAN Console.
- Go to Platform Settings > Applications.
- Copy the ID from the Application ID field.
- px_cookie_secret - Enter a risk cookie key used by the cookie signing page.
To generate a risk cookie key:- Open the HUMAN Console.
- Go to Product Settings > Security Policy > Policy Information.
- Click Generate new.
- px_auth_token - Enter a JWT authentication token for REST API.
To retrieve the authentication token:- Open the HUMAN Console.
- Go to Platform Settings > Applications > Tokens > Server Tokens.
- Click Copy token.
- px_enabled - Set to
-
Add the following section to the existing
sub vcl_recv
block. This section enables the Enforcer to process requests. -
Add a new block named
vcl_synth
. This block displays a CAPTCHA if a request is blocked. -
Add a new (or edit an existing) block named
vcl_deliver
. This block is executed when a response is sent back to a client.