geojs: a visitor's wait no longer cuts off the request to GeoJS (closes #404)
check / check (push) Failing after 2m16s
check / check (push) Failing after 2m16s
The GeoJS lookup and its cache move from internal/lookup to internal/geojs, which imports no other package of this repository. waf hands it functions to count requests, report failures and count lookups that went without an answer; waf keeps the log line, the source_failure alert and the metrics. The caller now passes its wait to each lookup. waf passes SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS. A request to GeoJS has its own fixed limit of 10 seconds, and only passing it or an error from GeoJS is a failure. An answer that comes after the caller stopped waiting is kept. internal/lookup keeps the lookup database and returns geojs.Answer. Model: opus-5-5
This commit was merged in pull request #407.
This commit is contained in:
1 parent
a2fcc00ded
commit
caa3079847
21 files changed
+645
-484
No files matched your search
@@ -87,8 +87,10 @@ never as a time.
|
||||
change, and tells which rules a request matches.
|
||||
- `internal/coreruleset`: the Core Rule Set, with the five changes and the
|
||||
apps' fixes listed under "Attack detection", as Coraza directives.
|
||||
- `internal/lookup`: looks clients up through GeoJS or in the lookup
|
||||
database.
|
||||
- `internal/geojs`: looks clients up through GeoJS and keeps the answers. It
|
||||
imports no other package of this repository: `waf` gives it what it needs
|
||||
to count and report failures.
|
||||
- `internal/lookup`: looks clients up in the lookup database.
|
||||
- `internal/reputation`: fetches the lists, asks the DNS blocklists and
|
||||
AbuseIPDB in the background, and keeps their answers.
|
||||
- `internal/routewatch`: asks a routewatch instance about clients in the
|
||||
@@ -507,19 +509,25 @@ service that keeps its visitors' addresses on its own host.
|
||||
dropped from that table. The answer reaches the client's history and ban notes
|
||||
when it comes.
|
||||
- `SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS` is how long a visitor's request
|
||||
waits for its client's first answer, when a setting needs it (see step 6). It
|
||||
also bounds each request to GeoJS. A client whose answer has not come in time
|
||||
counts as unknown until it comes, and its later requests do not wait. Its
|
||||
address is asked about again in the background.
|
||||
waits for its client's first answer, when a setting needs it (see step 6). A
|
||||
client whose answer has not come in time counts as unknown until it comes, and
|
||||
its later requests do not wait.
|
||||
- A request to GeoJS may take up to 10 seconds, however long visitors wait. It
|
||||
goes on after the visitor's request ends, and its answer is kept. Say GeoJS
|
||||
answers after 5 seconds. The visitor's request is decided after 800
|
||||
milliseconds, without a country. A request from the same client 6 seconds
|
||||
later gets the answer.
|
||||
- Requests from one client that come together share one request to GeoJS.
|
||||
- A client the lookup cannot place has an unknown country and AS number, which
|
||||
the country list and the biased thresholds treat as described there. Nothing
|
||||
else treats it differently.
|
||||
- GeoJS publishes no rate limit, but its terms forbid "an excessive amount of
|
||||
API requests", judged by GeoJS alone, and let it block a caller. While GeoJS
|
||||
is slow, down or refusing `waf`, new clients count as unknown. GeoJS is then
|
||||
left alone for a second, and twice as long after each further failure, up to
|
||||
five minutes. Each failure raises a `source_failure` alert (see "Alerting"). A
|
||||
service that cannot accept this uses the file.
|
||||
API requests", judged by GeoJS alone, and let it block a caller. A request to
|
||||
GeoJS fails when it takes over 10 seconds or GeoJS answers with an error.
|
||||
While GeoJS is slow, down or refusing `waf`, new clients count as unknown.
|
||||
After a failure GeoJS is left alone for a second, and twice as long after each
|
||||
further failure, up to five minutes. Each failure raises a `source_failure`
|
||||
alert (see "Alerting"). A service that cannot accept this uses the file.
|
||||
- The file is the free IPinfo Lite database (`ipinfo_lite.mmdb`), whose `asn`,
|
||||
`as_name` and `country_code` fields are read. The operator downloads it with a
|
||||
free IPinfo account and mounts it read-only; `waf` never fetches it and holds
|
||||
@@ -2411,8 +2419,9 @@ within that time.
|
||||
GeoJS is the only outside source a question can wait on. A question waits only
|
||||
when step 6 says so, and for at most
|
||||
`SWW_WAF_ASN_AND_COUNTRY_LOOKUP_TIMEOUT_MS`, by default 800 milliseconds. A
|
||||
client without an answer by then counts as unknown. No question waits on these,
|
||||
which run in the background:
|
||||
client without an answer by then counts as unknown. The setting bounds only the
|
||||
question's wait: the request to GeoJS goes on, and its answer is kept for later
|
||||
questions. No question waits on these, which run in the background:
|
||||
|
||||
- the DNS blocklists and AbuseIPDB;
|
||||
- fetching the blocklists, the tag lists and the file
|
||||
|
||||
Reference in new issue
Block a user