feat(lib/policy/expressions): add system load average to bot expression inputs

This lets Anubis dynamically react to system load in order to
increase and decrease the required level of scrutiny. High load? More
scrutiny required. Low load? Less scrutiny required.
This commit is contained in:
Xe Iaso
2025-07-06 18:38:41 +00:00
parent 94db16c0df
commit 9b67cedff2
8 changed files with 185 additions and 31 deletions

View File

@@ -74,6 +74,21 @@ bots:
weight:
adjust: 10
## System load based checks.
# If the system is under high load, add weight.
- name: high-load-average
action: WEIGH
expression: load_1m >= 10.0 # make sure to end the load comparison in a .0
weight:
adjust: 20
# If it is not, remove weight.
- name: low-load-average
action: WEIGH
expression: load_15m <= 4.0 # make sure to end the load comparison in a .0
weight:
adjust: -10
# Generic catchall rule
- name: generic-browser
user_agent_regex: >-