Files
openwaf/dotnet/OpenWaf.Edge/appsettings.json
T
Pavlo Ratushnyi 12a0f49d0c Make the snapshot TTL a setting, and say what it is for
OPEN-12's option (b) — share the block list and shorten the TTL — was not a
deployment decision, it was a rebuild: EdgeStateStore.RefreshTtl was a
property initialised to 30 s with no configuration binding anywhere in the
tree. The measurement in research/2026-10-01-multi-instance/ showed why that
matters: the TTL is not a tuning knob, it is the propagation delay between
edges (23.7 s under ~36 req/s, 1.7 s on an idle one), so an operator who
runs more than one instance is choosing a staleness bound they cannot set
and cannot see.

The key is OpenWaf:State:RefreshTtlSeconds, default 30, and the default is
unchanged so nothing moves for anyone who does not touch it. A value outside
1-300 aborts startup instead of falling back silently, because a typo in the
staleness bound is a security setting failing quietly. /healthz now reports
snapshotTtlSeconds, so an operator can read the TTL they actually got.

Verified on this commit: 49 unit and 23 integration tests pass (13 new unit
cases on the parser; 3 new integration tests that write a ban the way another
instance would — straight into the database, no InvalidateAsync — and show a
1 s TTL closing the window inside 5 s while a 300 s TTL keeps serving a
source the database has already banned); scripts/smoke.sh 19/19;
scripts/compose-smoke.sh 27/27 against the rebuilt image; in a container
RefreshTtlSeconds=5 reports snapshotTtlSeconds:5 on /healthz, and =0 aborts
the process with the key named in the log.

One thing the check taught and the README now says instead of hiding: when
startup aborts inside the image, the container stays Up with nothing
listening until the HEALTHCHECK goes unhealthy. That is how every startup
failure in this image looks, not something this change introduces.
2026-10-01 12:57:24 +02:00

61 lines
1.3 KiB
JSON

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"OpenWaf": "Data Source=openwaf.db"
},
"Database": {
"Provider": "sqlite"
},
"GeoIp": {
"DatabasePath": ""
},
"OpenWaf": {
"Admin": {
"Token": ""
},
"State": {
"RefreshTtlSeconds": 30
},
"Policy": {
"Mode": "Observe",
"StreakThreshold": 10,
"StreakWindow": "00:05:00",
"BanDuration": "01:00:00",
"RefusalRange": "400-499",
"ServerErrorRange": "500-599",
"Geo": "Off",
"TrustProxyHeaders": false,
"MaxTrackedSources": 10000,
"Ipv4KeyPrefixLength": 32,
"Ipv6KeyPrefixLength": 64,
"EngineBlockStatus": 403,
"OperatorBlockStatus": 301,
"DefaultRedirectTargets": [ "https://www.iana.org/help/example-domains" ]
}
},
"ReverseProxy": {
"Routes": {
"all": {
"ClusterId": "upstream",
"Match": { "Path": "{**catch-all}" }
}
},
"Clusters": {
"upstream": {
"Destinations": {
"upstream1": {
"Address": "http://127.0.0.1:9000/"
}
}
}
}
}
}