360 Secure SkillHub
360 安全技能中心

Traefik Mantrae Diagnostics

面向 Traefik 反向代理的只读诊断技能:通过 Traefik HTTP API 与仪表盘查看版本、概览、入口点、路由、服务与中间件,借助 Mantrae Connect RPC API 检查动态配置、备份与审计日志,并结合 systemd 日志定位 404、502/503、TLS 与配置重载问题;默认只读,修改配置前需先备份并确认。

naamah75
naamah75
热度 24.36
最近更新 2026-05-23 13:18:58
分类:自动化依赖:代码执行 / 第三方 API应用场景:DevOps / 调试排错 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add traefik-mantrae-diagnostics
Metadata
name
traefik
description
Inspect and troubleshoot Traefik reverse proxies via read-only API, dashboard, logs, and config checks.

Traefik

Use for Traefik reverse proxy diagnostics: API/dashboard state, routers, services, middlewares, entrypoints, TLS/cert resolver hints, logs, and safe config inspection.

Configuration

Set connection details through environment variables rather than hard-coding local infrastructure data:

  • TRAEFIK_BASE_URL: Traefik API/dashboard base URL, for example https://traefik.example.internal.
  • MANTRAE_BASE_URL: Mantrae API base URL, for example https://mantrae.example.internal.
  • MANTRAE_TOKEN: Mantrae bearer token.
  • MANTRAE_USERNAME, MANTRAE_EMAIL, MANTRAE_PASSWORD: optional login credentials when no token is provided.
  • MANTRAE_PROFILE_ID: Mantrae profile id for config/list requests. Defaults to 1.
  • MANTRAE_CONNECT_IP: optional IP override when DNS/SNI host must be preserved but the request should connect to a specific IP.

Safety

  • Read-only by default.
  • Do not enable api.insecure=true on a public interface.
  • Do not restart Traefik, Docker, or the VM without Igor's confirmation.
  • Before editing Traefik config, make/request a backup of the relevant files.
  • Treat /api/rawdata and support dumps as sensitive; they can expose routing details and configuration.

API

Traefik's API is HTTP GET-only for inspection. Useful endpoints:

  • /api/version
  • /api/overview
  • /api/entrypoints
  • /api/http/routers
  • /api/http/services
  • /api/http/middlewares
  • /api/tcp/routers
  • /api/tcp/services
  • /api/udp/routers
  • /api/udp/services
  • /api/rawdata
  • /api/support-dump

The dashboard usually lives at /dashboard/. In secure mode the router must match both /api and /dashboard and point to api@internal.

Mantrae API

Mantrae manages Traefik dynamic configuration through a Connect RPC API. It is not Traefik's runtime dashboard, so use it for config inspection and controlled config changes, not live Traefik health/logs.

  • OpenAPI: ${MANTRAE_BASE_URL}/openapi
  • OpenAPI JSON: ${MANTRAE_BASE_URL}/openapi.json
  • Auth: JWT Bearer from /mantrae.v1.UserService/LoginUser
  • Read-oriented useful methods:
    • /mantrae.v1.RouterService/ListRouters
    • /mantrae.v1.ServiceService/ListServices
    • /mantrae.v1.MiddlewareService/ListMiddlewares
    • /mantrae.v1.EntryPointService/ListEntryPoints
    • /mantrae.v1.UtilService/GetDynamicConfig
    • /mantrae.v1.BackupService/ListBackups
    • /mantrae.v1.AuditLogService/ListAuditLogs

Helper:

MANTRAE_BASE_URL=https://mantrae.example.internal MANTRAE_TOKEN=... python scripts/mantrae_api.py routers
MANTRAE_BASE_URL=https://mantrae.example.internal MANTRAE_USERNAME=... MANTRAE_PASSWORD=... python scripts/mantrae_api.py dynamic-config
MANTRAE_BASE_URL=https://mantrae.example.internal MANTRAE_CONNECT_IP=10.0.0.10 MANTRAE_TOKEN=... python scripts/mantrae_api.py routers --insecure

The helper defaults to MANTRAE_PROFILE_ID=1 and limit=-1 for list methods unless a custom --message JSON overrides those fields.

If DNS does not resolve from the OpenClaw host, test through Traefik IP with curl:

curl -k --resolve mantrae.example.internal:443:10.0.0.10 https://mantrae.example.internal/openapi.json

Do not call create/update/delete/restore endpoints without a fresh backup and Igor's confirmation.

Helper

python scripts/traefik_api.py overview
python scripts/traefik_api.py routers
python scripts/traefik_api.py services
python scripts/traefik_api.py rawdata

With a custom API URL:

TRAEFIK_BASE_URL=https://traefik.example.internal python scripts/traefik_api.py overview

Local VM Checks

If SSH access exists:

ssh -i ~/.ssh/traefik_readonly user@traefik-host 'systemctl status traefik --no-pager'
ssh -i ~/.ssh/traefik_readonly user@traefik-host 'journalctl -u traefik --since "2 hours ago" --no-pager'
ssh -i ~/.ssh/traefik_readonly user@traefik-host 'journalctl -u traefik --since "1 hour ago" --no-pager | grep -E "\" 5[0-9][0-9] "'
ssh -i ~/.ssh/traefik_readonly user@traefik-host 'journalctl -u traefik --since "1 hour ago" --no-pager | grep "router-name@http"'

Use systemd logs first. Docker group access is powerful and should be granted only if Traefik actually runs in Docker and logs are not available elsewhere. Traefik access logs can include long OIDC URLs and state parameters; summarize findings and avoid reposting full sensitive query strings unless Igor explicitly needs them.

Workflow

  1. Check version and overview through the API.
  2. If API is unreachable, check whether dashboard/API is enabled and where it is routed.
  3. Inspect routers/services/middlewares for failing routes.
  4. Use logs for 404, 502/503, TLS, ACME, provider, and config reload errors.
  5. Only propose config changes after identifying the exact failing router/service/middleware.