Back to Wazuh

Configuration

docs/ref/modules/server-api/configuration.md

4.14.42.1 KB
Original Source

Configuration

The Server API and Framework read configuration from multiple sources: YAML files for the API layer, ossec.conf for the manager, and internal constants for runtime limits.


API Configuration

The API reads its configuration from files defined in api/constants.py:

PathDescription
api/configuration/api.yamlMain API configuration
api/configuration/security/Security configuration directory

Security Configuration (JSON Schema validated)

SettingDescriptionValues
auth_token_exp_timeoutJWT token expiration timeDefault: 900 seconds
rbac_modeRBAC enforcement modewhite (deny by default) / black (allow by default)

Manager Configuration

  • ossec.conf is parsed by core/configuration.py
  • Configuration sections are validated per component
  • XML validation uses lxml and defusedxml

Global Constants & Context (core/common.py)

This module centralizes all Wazuh paths, limits, and runtime context.

Key Functions

FunctionDescription
find_wazuh_path()Auto-discovers the Wazuh installation root
wazuh_uid() / wazuh_gid()Gets the wazuh-manager system user/group IDs
get_installation_uid()Returns (or creates) a persistent UUID
reset_context_cache()Decorator for request-scoped caching

Important Limits

ConstantValueDescription
MAX_SOCKET_BUFFER_SIZE64 KBMaximum socket buffer
MAX_GROUPS_PER_MULTIGROUP128Maximum groups per multigroup
AGENT_NAME_LEN_LIMIT128Maximum agent name length
DATABASE_LIMIT500Default query result limit
MAXIMUM_DATABASE_LIMIT100,000Hard cap on query results

Context Variables

Request-scoped state managed via contextvars:

VariableDescription
rbac_modeCurrent RBAC mode (white or black)
current_userAuthenticated user for the current request
cluster_nodesAvailable cluster nodes
origin_moduleCalling module context