Policy File Structure
A complete policy file includes:Loading Policy Files
Anubis loads policy files using the--policy-fname flag or POLICY_FNAME environment variable:
data/botPolicies.yaml.
Import Statements
Policy files support importing other YAML files:(data)/ prefix references embedded policy files shipped with Anubis.
Configuration Validation
Anubis validates all configuration at startup using theValid() method pattern. Common validation errors:
Required Fields
- At least one bot rule must be defined (
ErrNoBotRulesDefined) - Each bot rule must have a
namefield (ErrBotMustHaveName) - Bots must match on at least one field:
user_agent_regex,path_regex,headers_regex,remote_addresses, orexpression(ErrBotMustHaveUserAgentOrPath)
Rule Actions
Valid actions are:ALLOW- Bypass all checks and forward to backendDENY- Block the request with a fake success pageCHALLENGE- Present a proof-of-work challengeWEIGH- Adjust request suspicion weightDEBUG_BENCHMARK- Development only
Regular Expression Validation
Regular expressions are compiled at config load time. Common issues:- Regex ending with newline (
ErrRegexEndsWithNewline) - use>-instead of>in YAML:
CIDR Validation
IP address ranges inremote_addresses must be valid CIDR notation:
Configuration Defaults
If not specified in the policy file, Anubis uses these defaults:Environment-Specific Configuration
Policy files can reference environment variables through standard Go flag environment variable support:Configuration Reloading
Anubis does not currently support hot-reloading of policy files. Configuration changes require a service restart:Next Steps
- Bot Rules - Define detection rules
- Challenge Configuration - Configure proof-of-work settings
- Storage Backends - Choose a storage backend
- Security - Key generation and JWT signing