Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions services/bin/leadsec-tam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env node

import { fileURLToPath } from "node:url";
import { runServiceMain } from "@chaitin-ai/octobus-sdk";

import { service } from "../leadsec__tam/src/service.js";

runServiceMain(service, {
entryFile: fileURLToPath(new URL("../leadsec__tam/bin/leadsec-tam.js", import.meta.url)),
});
4 changes: 4 additions & 0 deletions services/bin/octobus-tentacles.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ const services = {
entryFile: "../venus__ads_v3-6/bin/venus-ads-v3-6.js",
serviceModule: "../venus__ads_v3-6/src/service.js",
},
"leadsec-tam": {
entryFile: "../leadsec__tam/bin/leadsec-tam.js",
serviceModule: "../leadsec__tam/src/service.js",
},
"volcengine-cloud-firewall": {
entryFile: "../volcengine__cloud-firewall/bin/volcengine-cloud-firewall.js",
serviceModule: "../volcengine__cloud-firewall/src/service.js",
Expand Down
31 changes: 31 additions & 0 deletions services/leadsec__tam/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# leadsec-TAM

OctoBus service adapter for Leadsec TAM anti-DDoS static IP blacklist and whitelist management.

## Capabilities

- `Leadsec_TAM.LeadsecTAMService/AddBlacklist`: add one or more IP addresses to the static blacklist.
- `Leadsec_TAM.LeadsecTAMService/AddWhitelist`: add one or more IP addresses to the static whitelist.

## Configuration

```json
{
"baseUrl": "https://10.11.9.107:2018",
"skipTlsVerify": true,
"timeoutMs": 8000,
"language": "zh-cn",
"remark": "OctoBus"
}
```

## Secret

```json
{
"username": "admin",
"password": "********"
}
```

The adapter logs in through `/cnddos/v2.0/api/web_login/ddos`, submits static IP list entries through `/cnddos/v2.0/api/ip_bwlist/info`, and verifies the result through `/cnddos/v2.0/api/ip_bwlist/page_list`.
10 changes: 10 additions & 0 deletions services/leadsec__tam/bin/leadsec-tam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env node

import { fileURLToPath } from 'node:url';
import { runServiceMain } from '@chaitin-ai/octobus-sdk';

import { service } from '../src/service.js';

await runServiceMain(service, {
entryFile: fileURLToPath(import.meta.url),
});
32 changes: 32 additions & 0 deletions services/leadsec__tam/config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"baseUrl": {
"type": "string",
"description": "Leadsec TAM base URL, for example https://10.11.9.107:2018."
},
"timeoutMs": {
"type": "integer",
"minimum": 1000,
"default": 8000
},
"skipTlsVerify": {
"type": "boolean",
"default": false,
"description": "Set true for self-signed certificates in test environments."
},
"language": {
"type": "string",
"default": "zh-cn"
},
"remark": {
"type": "string",
"default": "OctoBus"
}
},
"required": [
"baseUrl"
]
}
12 changes: 12 additions & 0 deletions services/leadsec__tam/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "leadsec-tam",
"version": "0.0.0",
"private": true,
"type": "module",
"bin": {
"leadsec-tam": "bin/leadsec-tam.js"
},
"dependencies": {
"@chaitin-ai/octobus-sdk": "^0.5.0"
}
}
34 changes: 34 additions & 0 deletions services/leadsec__tam/proto/leadsec_tam.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
syntax = "proto3";

package Leadsec_TAM;

option go_package = "miner/grpc-service/Leadsec_TAM";

service LeadsecTAMService {
rpc AddBlacklist(AddIPListRequest) returns (AddIPListResponse) {}
rpc AddWhitelist(AddIPListRequest) returns (AddIPListResponse) {}
}

message AddIPListRequest {
repeated string ip_list = 1;
string remark = 2;
string request_id = 3;
}

enum OperationStatus {
OPERATION_STATUS_UNSPECIFIED = 0;
OPERATION_STATUS_SUCCESS = 1;
OPERATION_STATUS_FAILED = 2;
}

message AddIPListResponse {
OperationStatus status = 1;
int32 requested_ip_count = 2;
int32 verified_ip_count = 3;
string upstream_result = 4;
string upstream_message = 5;
repeated string verified_ips = 6;
string request_id = 7;
string raw_add_response = 8;
string raw_verify_response = 9;
}
17 changes: 17 additions & 0 deletions services/leadsec__tam/secret.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"username",
"password"
]
}
33 changes: 33 additions & 0 deletions services/leadsec__tam/service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"schema": "chaitin.octobus.service.v1",
"name": "leadsec-tam",
"displayName": "leadsec-TAM",
"description": "Leadsec TAM anti-DDoS IP blacklist and whitelist management.",
"runtime": {
"mode": "long-running"
},
"proto": {
"roots": [
"proto"
],
"files": [
"proto/leadsec_tam.proto"
]
},
"configSchema": "config.schema.json",
"secretSchema": "secret.schema.json",
"sdk": {
"cli": {
"commands": {
"Leadsec_TAM.LeadsecTAMService/AddBlacklist": {
"name": "add-blacklist",
"description": "Add IP addresses to the Leadsec TAM static blacklist."
},
"Leadsec_TAM.LeadsecTAMService/AddWhitelist": {
"name": "add-whitelist",
"description": "Add IP addresses to the Leadsec TAM static whitelist."
}
}
}
}
}
Loading