The alerting pillar ended at a table. The rows are right — the server-error
streak fires, the dry-run candidate is recorded — and then they wait for an
operator to open a page. That is the posture this project already removed for
blocking ("blocking is usually manual: a human notices abuse and adds an IP.
That never fires at 3am"), applied one level up: an alert nobody is told about
never fires at 3am either.
OpenWaf:Alerts:WebhookUrl (env fallback OPENWAF_ALERT_WEBHOOK_URL) POSTs each
raised alert as JSON — kind, sourceKey, count, lastStatusCode, lastPath,
createdAt, detail — off the request path, from a bounded queue of 1000, and only
after the row is durably written. Three attempts with a short backoff;
OpenWaf:Alerts:WebhookTimeoutSeconds (1-60, default 5) refuses startup outside
that range rather than falling back, as the other startup-parsed bounds do. The
default is empty, which is no push at all: the shipped stack behaves exactly as
it did before.
The endpoint is counted like every other write side pillar, because a webhook
that has been down for a week is otherwise indistinguishable from a quiet night:
alertWebhookFailures, alertWebhookLost, alertWebhookDelivered,
alertWebhookLastError, alertWebhookLastSuccessAt, plus alertWebhookConfigured and
alertWebhookHost — host, never the URL, since a webhook URL carries its secret
in the path and this is rendered on the operator page. The console's alert line
now ends in "pushed to <host>, N delivered" or "not pushed anywhere: each row
waits for someone to open this page", so "no alerts" and "alerts go nowhere" stay
two different sentences.
Two things the tests caught instead of the design assuming:
* the queue was BoundedChannelFullMode.DropWrite, where TryWrite returns true
and the overflow vanishes with no trace — the counter it was written to feed
stayed at zero. The mode is Wait now, chosen for what TryWrite reports when
the queue is full; nothing here awaits a write, so the response path still
cannot block.
* a refused push counted as an entry lost, which conflated a lost delivery with
a lost record. The alert row is in the table either way, so EntriesLost on
this pillar is reserved for the one case where the push is gone for good.
Measured on this tree: build 0 warnings / 0 errors, unit 151/151 (19 new),
integration 194/194 in 28 s (3 new: the push arrives with the alert in it, an
unconfigured edge sends nothing and keeps every row, an endpoint answering 500 is
counted and does not undo the alert), smoke 29/0, console 79 assertions 0 failed,
compose 209/0 against the built image at 261 MB.
68 lines
1.4 KiB
JSON
68 lines
1.4 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
|
|
},
|
|
"Alerts": {
|
|
"WebhookUrl": "",
|
|
"WebhookTimeoutSeconds": 5
|
|
},
|
|
"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,
|
|
"SharedStreaks": false,
|
|
"ObservationRetentionDays": 7,
|
|
"BanRetentionDays": 7,
|
|
"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/"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|