Read settings from a YAML config file, with per-host settings; remove the local backend #23
Loading…
Reference in a new issue
No description provided.
Delete branch "config-file"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Centinela had 52 settings, all env variables. Two of them had outgrown that:
CENTINELA_UPSTREAMSis a 1,268-characterhost=urllist andCENTINELA_WAF_HARD_BLOCK_EXEMPTrepeats the same hosts in 485 more. The nextfeatures (learned missing-path areas, reviewed exceptions, recon action per site) are
all per host, so this adds a config file with a
hosts:section. It also removes thellama.cpp backend, which is no longer deployed.
Config file
CENTINELA_CONFIGnames a YAML file that can hold any existing setting, grouped(
waf.hard_block,shun.after,recon.not_found_after, …).default, so env-only deployments work unchanged.
state_urland the API keys, so theycan't land in a ConfigMap.
hosts:section. Each host gets its ownupstream,hard_block_exempt(allor path patterns) and
bypassprefixes. SettingCENTINELA_UPSTREAMSorCENTINELA_WAF_HARD_BLOCK_EXEMPTstill replaces that part ofhosts:as a whole./ghost/skipped every check on everyhost. Under
hosts:it applies only to the host that serves it.centinela.example.yamlis a complete, production-shaped example.Local backend removed
The
localbackend called a llama.cpp server running Qwen 27B. That server is nolonger deployed (its GPU runs Laya), so the default backend pointed at a service that
doesn't exist.
layais now the default backend.CENTINELA_BACKEND=local,CENTINELA_LOCAL_URL,CENTINELA_LOCAL_MODELand
centinela-eval -backend local.CENTINELA_BACKEND=localfails at startup. Productionalready uses
laya.Docs
centinela.yaml(proxy mode,embedded WAF, the Laya container,
make run), with the responses to expect. I ranthese steps against a real Laya server: a clean request got 200, a SQL injection 403.
hosts:form and no longer mentionlocal.hosts:as the recommended proxy setup, and the ConfigMap +Secret pattern.
measured on a backend centinela no longer ships.
Testing
hosts:section, and env variables replacing it.port, bad exemption, missing file.
Loadreads has a file key and the other wayround. Deleting one on purpose makes it fail.
centinela.example.yamlloads.go vet,go test ./...and-race(config, engine) pass.Rollout
Nothing changes until gitops sets
CENTINELA_CONFIG. The follow-up gitops PR turnsthe centinela ConfigMap's 25
CENTINELA_*keys into oneconfig.yaml, with theValkey password still coming from its Secret.
CENTINELA_CONFIG names a YAML file holding any of the existing settings, grouped (waf.hard_block, shun.after, recon.not_found_after, ...). An environment variable that is set overrides the file, and the file overrides the defaults, so current deployments keep working unchanged. Values go through the same parsing and checks as before, and an error in a file value names its key and the file. A hosts section gives each host its upstream, hard-block exemptions ("all" or path patterns) and bypass prefixes, replacing the long packed strings in CENTINELA_UPSTREAMS and CENTINELA_WAF_HARD_BLOCK_EXEMPT. Setting either variable still replaces that part of the hosts section as a whole. Bypass prefixes can now be per host. A global prefix such as /ghost/ skipped every check on every host; under hosts it only applies to the host that serves it. Secrets stay environment-only: the file refuses state_url and the API keys. Unknown keys are errors, so a typo cannot silently do nothing. A test checks that every environment variable Load reads has a file key, and that centinela.example.yaml loads.🔎 ojo scan results
No findings.