Configuration & Security
Full config.yaml reference
server:
listen: ":9080"
base_url: "" # reserved (snapshot/deep-link assembly)
auth:
password_hash: "" # bcrypt; generated by mibee-bell hash-password
# empty = admin API/UI disabled (ingest unaffected)
storage:
driver: sqlite # the only implementation; postgres reserved (fail-fast if set)
path: ./mibee-bell.db
retention:
events: 30d
notifications: 90d
deliveries: 30d
ingest:
mqtt: # list: subscribe to multiple brokers
- broker: "tcp://192.0.2.20:1883"
topic_prefix: "mibee"
username: ""
password: "enc:..."
webhook_tokens: # per-source long random tokens
- token: "steward-xxxxxx"
default_source: mibee-steward
- token: "nvr-xxxxxx"
default_source: mibee-nvr
alertmanager: true # POST /api/ingest/alertmanager
pagerduty: true # POST /api/ingest/pagerduty
simple: true # POST /api/ingest/simple (ntfy/Gotify shape)
grafana: true # POST /api/ingest/grafana
bark_compat: true # GET/POST /{key}/... → routed to bark-type channels or the default group
crypto:
key: "" # base64 32-byte master key; MIBEEBELL_KEY env overrides
render:
default_lang: en-US # fallback language (zh-CN / en-US)
timezone: Asia/Shanghai
mesh: # empty = single-node mode (first-class citizen)
node_name: "bell-a"
bind_port: 7946
join: ["192.0.2.11:7946"]
enrich: # http_enrich processors (external tagging microservices, no compile)
- name: cmdb
url: http://192.0.2.30:8080/api/enrich
headers:
Authorization: "Bearer ..."
timeout_seconds: 5 # default 10, max 30
stage: pre_dispatch # default; pre_route / post_route optional
ai:
daily_budget: 100 # shared L1/L2 daily budget (0 = all AI off; exhaustion emits an internal event)
providers: # L2 openai_compat (OpenAI-compatible endpoints, config-only)
- name: deepseek
base_url: "https://api.deepseek.com"
api_key: "enc:..."
model: "deepseek-chat"
decision: # L1 local decision model (off by default)
enabled: false
base_url: "http://192.0.2.30:8000"
model: multilingual
timeout_seconds: 2
min_confidence: 0.7
# first-boot seed (imported once when the DB is empty; DB wins afterwards)
rules: [...]
channels:
wecom-ops: { type: wecom_robot, key: "enc:..." }
Loading order: built-in defaults → config.yaml → DB runtime state (rules/channels) merged on top; full validation at startup (duration formats / channel types / rule→channel references) — invalid config refuses to start (fail-fast).
Subcommands
| Command | Purpose |
|---|---|
mibee-bell -config config.yaml |
start |
mibee-bell hash-password |
generate the bcrypt admin hash |
mibee-bell encrypt-config |
generate/migrate credential encryption (AES-256-GCM, self-describing enc: prefix; idempotent) |
mibee-bell export |
reverse-export rules/channels as YAML (backup/migration) |
mibee-bell -version |
version |
Security model
Admin plane
- Single
adminuser + bcryptauth.password_hash; login issues a 12-hour JWT; all/api/v1/*requireAuthorization: Bearer. - Login rate limiting and lockout (anti-brute-force).
Ingest plane
- The generic webhook uses per-source long random tokens carried in the path — fully separated from the JWT system: a leaked token grants exactly "submit events", nothing else.
- Compatibility entries (Alertmanager / PagerDuty / simple / Grafana / Bark) are designed as LAN-facing surfaces: enable on demand, never expose them directly to the internet; for public intake use the token-carrying generic webhook.
SSE
- EventSource can't send headers → login returns a 5-minute
stream_token(GET /api/stream?token=), refreshable — no unauthenticated LAN mode.
Credential encryption
- Channel secrets/tokens are AES-256-GCM encrypted at rest (
enc:<base64(nonce+ct)>); master key incrypto.keyor theMIBEEBELL_KEYenv var. - No key = plaintext passthrough (backward compatible); an encrypted store with a missing/wrong key fails fast at startup.
- Logs and API responses always mask credentials as
***.
Threat model
Offline, vendor-domain-dead, or vendor-gone — every feature keeps working; no code path depends on an operator-run service. That is the definition of "truly self-hosted" (iron law 1).