Installation and Initialization
Overview
BotManager-Akamai-Agent is designed to easily apply BotManager's detection capabilities using Akamai's EdgeWorker platform without modifying the Origin server.
BotManager is a solution that detects bots and macro users through various analysis techniques (header analysis, behavior analysis, foreign IP blocking, access statistics, etc.). This protects web services and safely manages data from threats of malicious users and automated bots.
What is Akamai EdgeWorker?
Akamai EdgeWorker is a serverless computing platform that can execute JavaScript on Akamai CDN.
Key Features:
- Supports fast response speed and large-scale traffic processing.
- Can process directly at CDN, reducing Origin server load.
- Provides high stability and scalability through global network.
For more information about Akamai EdgeWorker, refer to Akamai Official Documentation.
Installation Methods
1. Create EdgeWorker
- Navigate to EdgeWorkers menu in Akamai management console.
- Click Create EdgeWorker ID and select Dynamic Compute.
- EdgeWorker is created, so click the ID of the created worker.
- Click Create Version to create an EdgeWorker version.
- Download and upload the latest version of BotManager-Akamai-Agent.
- Return to EdgeWorker details screen and click Activate Version.
- Activate in Staging and Production environments to deploy.
- Check deployment status.
2. Configure Property Variables
Akamai Property is required to run EdgeWorkers. If you don't have an Akamai Property yet, you must create one by referring to Property Creation Guide.
- Navigate to Properties menu in Akamai management console.
- Select the Property in service.
- Select the currently applied Version and click Edit New Version.
- Click +Variables and add required variables according to the table below.
Select a domain and check the values to get the correct Value in the table below.
| Variable | Required | Value | Description |
|---|---|---|---|
PMUSER_DEFAULT_HOST (hidden) | Yes | %(AK_HOST) | Host to send when EdgeWorker status is Failure |
PMUSER_TRUE_CLIENT_IP | Yes | (no value) | Used to identify client IP |
PMUSER_BM_SERVER_HOSTNAME | Yes | https://botmanager.stclab.com | BotManager detection server address |
PMUSER_BM_SERVERURL | Yes | /api/v1/macro | BotManager detection pathname |
PMUSER_BM_TENANTID | Yes | {tenantId} | Customer tenantId |
PMUSER_BM_DOMAINNAME | Yes | {domainName} | Selected customer domainName |
PMUSER_BM_PROTECTION_SERVERURL | Yes | https://cdn-botmanager.stclab.com | Address to redirect when determined to be bot |
PMUSER_BM_SERVER_TIMEOUT | No | 3000 | Timeout to BotManager detection server |
PMUSER_BM_BYPASS | No | false | Flag to disable BotManager EW operation |
3. Configure Rules
Properties must be added to run EdgeWorker. Create 3 Rules for BotManager-Akamai-Agent:
- BotManager EdgeWorker
- BotManager Verify Origin
- EdgeWorker Retry
BotManager EdgeWorker Rule
BotManager EdgeWorker processes detection requests for specific paths.
Rules:
- Select +Rules from Property Configuration Settings.
- Select Blank Rule Template and save as BotManager EdgeWorker.
Path Application:
Partial Application:
- Select +Match from Criteria.
- IF: Path matches one of
/login. - If additional paths are needed for detection, select +Match
- Change Match All in Criteria to Match Any
- IF: Path matches one of
/logout.
Full Application:
- Select +Match from Criteria.
- IF: Path matches one of
/*. - Select +Match to add file extensions to exclude
- Change Match All in Criteria to Match All
- IF: File Extension is not one of static resource select.
Behaviors:
- Select +Behavior from Behaviors
- Select Standard property behavior
- In Add a Behavior for this Rule modal, select Set Variable then select Insert Behavior
- Set Variable:
- Variable:
PMUSER_TRUE_CLIENT_IP. - Expression:
{{builtin.AK_CLIENT_REAL_IP}}.
- Variable:
- Select +Behavior from Behaviors
- Select Standard property behavior
- In Add a Behavior for this Rule modal, select EdgeWorkers then select Insert Behavior
- EdgeWorkers:
- Enable: On.
- Identifier: Select the created EdgeWorker ID.
BotManager Verify Origin Rule
This Rule sends data to the detection server. EdgeWorkers cannot make third-party HTTP requests, so some rules must be configured to allow external requests.
Rules:
- Select +Rules from Property Configuration Settings.
- Select Blank Rule Template and save as BotManager Verify Origin.
Criteria:
- Select +Match from Criteria.
- IF: Path matches one of
/api/v1/macro/detect.
Behaviors:
- Select +Behavior from Behaviors
- Select Standard property behavior
- In Add a Behavior for this Rule modal, select Origin Server then select Insert Behavior
- Origin Server:
- Origin Type: Your Origin.
- Origin Server Hostname:
botmanager.stclab.com. - True Client IP Header: Yes (
True-Client-IP).
EdgeWorker Retry Rule
Processes requests through an alternate path when EdgeWorkers execution fails.
Rules:
- Select +Rules from Property Configuration Settings.
- Select Blank Rule Template and save as EdgeWorker Retry.
Criteria:
- Select +Match from Criteria.
- IF: EdgeWorkers Execution Status is Failure.
Behaviors:
- Select +Behavior from Behaviors
- Select Standard property behavior
- In Add a Behavior for this Rule modal, select Site Failover then select Insert Behavior
- Site Failover:
- Alternate Hostname:
{{user.PMUSER_DEFAULT_HOST}}.
- Alternate Hostname:
4. Activate
- Activate in Staging environment:
- Click Activate v1 on Staging and confirm.
- Activate in Production environment:
- Click Activate v1 on Production and confirm.
Installation Complete!
BotManager-Akamai-Agent has been successfully installed. Check deployment status and settings in the console.