Skip to main content

Overview

Anubis uses pluggable storage backends to persist client state, challenge tokens, and bot detection metadata. The storage configuration determines which backend to use and its parameters.

Store

Storage backend configuration struct.

Type Definition

Fields

string
required
Storage backend type. Must be a registered store backend.Built-in backends:
  • "memory" - In-memory storage (default, not persistent)
  • "bbolt" - BoltDB embedded database
  • "valkey" - Valkey/Redis compatible server
  • "s3api" - S3-compatible object storage
json.RawMessage
Backend-specific configuration as raw JSON. The structure depends on the selected backend.

Validation Rules

  • Backend must be non-empty
  • Backend must be a registered store implementation
  • Parameters must be valid according to the backend’s validation rules

Errors

Backend-Specific Parameters

Memory Backend

The memory backend requires no parameters. State is stored in-process and lost on restart.

BoltDB Backend

Embedded database stored in a local file.
Parameters:
  • path (string, required): Filesystem path to the database file
  • mode (int, optional): File permissions in octal (default: 0600)

Valkey/Redis Backend

Connect to a Valkey or Redis server.
Parameters:
  • address (string, required): Server address (host:port)
  • password (string, optional): Authentication password
  • db (int, optional): Database number (default: 0)
  • poolSize (int, optional): Connection pool size
  • tls (bool, optional): Enable TLS

S3 Backend

Use S3-compatible object storage (AWS S3, MinIO, etc.).
Parameters:
  • bucket (string, required): S3 bucket name
  • region (string, required): AWS region
  • endpoint (string, optional): Custom S3 endpoint (for S3-compatible services)
  • accessKeyId (string, required): AWS access key ID
  • secretAccessKey (string, required): AWS secret access key
  • sessionToken (string, optional): AWS session token

Default Configuration

When no store is specified, Anubis defaults to in-memory storage:

StatusCodes

HTTP status codes returned for different actions.

Type Definition

Fields

int
default:"200"
HTTP status code to return when presenting a challenge. Valid range: 100-599.Common values:
  • 200 - OK (default, challenge rendered in response body)
  • 403 - Forbidden
  • 429 - Too Many Requests
int
default:"200"
HTTP status code to return when denying a request. Valid range: 100-599.Common values:
  • 200 - OK (default, denial message in response body)
  • 403 - Forbidden
  • 429 - Too Many Requests
  • 503 - Service Unavailable

Validation Rules

  • Both Challenge and Deny must be set
  • Both must be in range 100-599

Errors

Example

DnsTTL

DNS cache TTL settings for reverse DNS lookups.

Type Definition

Fields

int
default:"300"
TTL in seconds for forward DNS lookups (hostname to IP). Must be >= 0.
int
default:"300"
TTL in seconds for reverse DNS lookups (IP to hostname). Must be >= 0.

Example

Logging

Logging configuration for Anubis.

Type Definition

Fields

string
default:"stdio"
Logging output sink. Valid values: "stdio", "file".
*slog.Level
Log level. If set, overrides the level from command-line flags.Valid levels:
  • slog.LevelDebug (-4)
  • slog.LevelInfo (0)
  • slog.LevelWarn (4)
  • slog.LevelError (8)
*LoggingFileConfig
File logging configuration. Required when Sink is "file".

Validation Rules

  • If Sink is "file", Parameters must be set
  • Parameters must pass its own validation

Errors

LoggingFileConfig

File-based logging configuration with log rotation.

Type Definition

Fields

string
required
Path to the log file.
int
default:"3"
Maximum number of old log files to retain. Must be >= 0.
int64
default:"104857600"
Maximum size in bytes before rotating the log file (default: 100 MiB).
int
default:"7"
Maximum number of days to retain old log files. Must be >= 0.
bool
default:"true"
Compress rotated log files using gzip.
bool
default:"false"
Use local time for log file timestamps instead of UTC.

Validation Rules

  • Filename must be set
  • MaxBackups must be >= 0
  • MaxAge must be >= 0

Errors

Example

OpenGraph

OpenGraph metadata configuration for social media previews.

Type Definition

Fields

bool
default:"false"
Enable OpenGraph tag caching and customization.
bool
default:"false"
Include the request hostname when caching OpenGraph tags.
time.Duration
Duration to cache OpenGraph tags (e.g., "5m", "1h", "24h").
map[string]string
Custom OpenGraph tags to inject. Keys are tag names (e.g., "og:title").Required tags when using overrides:
  • "og:title" - Page title

Example

Complete Configuration Example