メインコンテンツまでスキップ

Installation and Initialization

Overview

BotManager-Cloudflare-Agent is designed to easily apply BotManager's detection capabilities using Cloudflare's Workers feature 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 Cloudflare Workers?

Cloudflare Workers is a serverless computing platform that can execute JavaScript, TypeScript, WebAssembly, etc. on Cloudflare's global network.

Key Features:

  • Global Edge Network-Based Execution - Runs in over 300 cities worldwide, executing code closer to users to provide low latency and fast response speeds.
  • Reduced Origin Server Load - Can process requests directly at the edge or perform tasks such as caching, authentication, and redirection, reducing Origin server load.
  • Fast Deployment and Scalability - Can write code and deploy immediately without complex infrastructure setup, and automatically scales globally.

For more information about Cloudflare, refer to the official documentation:

Installation Methods

1. Create Worker and Set Configuration Values

  1. Navigate to Workers and Pages menu in Cloudflare management console.
  2. Click Create and create Workers as Hello world.
  3. Select the created Workers and Go to Settings.
    • Add Route from Domain and Route.
      • Zone: Select the domain to use from the list of domains registered in Cloudflare.
      • Route: Enter the subdomain or domain where workers will run. Add /* at the end to include sub-paths.
  4. Add the following environment variables to Variables and Secrets.
RequiredTypeNameDefault ValueDescription
YESTextBM_DOMIN{{domain}}Domain registered by user in BotManager
YESTextBM_TENANT_ID{{tenantId}}Customer tenantId
NoTextBM_PROTECTION_SERVER_URLhttps://cdn-botmanager.stclab.comAddress to redirect when determined to be bot
NoTextBM_SERVER_API_URL/api/v1/macroBotManager detection pathname
NoTextBM_SERVER_URLhttps://botmanager.stclab.comBotManager detection server address
NoTextBM_SERVER_TIMEOUT3000Timeout to BotManager detection server
NoTextBM_BYPASSfalseFlag to disable BotManager operation
NoTextBM_LOG_LEVELERRORLog level when integrating BotManager (DEBUG, INFO, WARN, ERROR)
  1. Download the BotManager agent code file botmanager-cloudflare-agent.js from the path below.
  2. Click code edit at the top right of the dashboard to import the BotManager agent code file, modify the worker.js file code, and click Deploy.

worker.js Code:

import bmEvent from './botmanager-cloudflare-agent.js'

export default {
async fetch(request, env, ctx) {
return await bmEvent(request, env, ctx);
},
};
  1. Navigate to Deploy tab and check deployment status.

2. Installation Complete

BotManager-Cloudflare-Agent has been successfully installed. Verify that it operates according to the configured policies.