How to Backup Wazuh RBAC Configurations

Role-Based Access Control (RBAC) is a critical part of securing a Wazuh deployment. Instead of giving every Wazuh user unrestricted administrative access, RBAC allows administrators to define what users can view, modify, or manage based on their assigned roles and policies.Wazuh’s RBAC implementation uses users, roles, rules, and policies to control access to Wazuh Server API resources. That makes RBAC configuration security-sensitive data. For this reason, organizations should treat Wazuh RBAC backups as part of their broader configuration and disaster recovery strategy.

A lost or corrupted role definition can prevent analysts from accessing required resources, while a missing role mapping can leave users without the permissions they need, or potentially cause an administrator to lose access to critical functionality.

How to Configure Wazuh RBAC — Use this guide for the initial creation and management of Wazuh roles, policies, users, and role mappings.

What Is Wazuh RBAC?

Wazuh RBAC controls access to Wazuh resources according to the privileges assigned to a user.

At the Wazuh Server API level, RBAC is organized around four primary components:

  • Users — identities that make requests to Wazuh resources.
  • Roles — collections of permissions, rules, and policies.
  • Rules — conditions that determine when permissions apply.
  • Policies — definitions of which actions users are allowed or denied to perform.

For example, an organization could create a read-only role for security analysts while giving security engineers additional permissions to modify rules, policies, or configurations.

Wazuh also uses security controls at the Indexer and Dashboard layers.

Internal users, Indexer roles, role mappings, tenants, and external identity-provider mappings can all affect what a person can access after authentication.

Therefore, when you backup Wazuh RBAC, you should not assume that copying a single RBAC-related file captures the entire access-control configuration.

Why Backing Up RBAC Configurations Is Important

RBAC configurations often represent months or years of security administration work.

An enterprise deployment may contain custom analyst roles, incident-response permissions, administrator mappings, read-only accounts, tenant assignments, and integrations with external identity providers.

Recreating this configuration manually after a failure can be time-consuming and error-prone.

A proper backup gives administrators a known-good reference that can be used to:

  • Recover accidentally deleted roles.
  • Restore role-to-user mappings.
  • Recover custom permissions and policies.
  • Rebuild security configuration after a server failure.
  • Reproduce an RBAC configuration during a migration.
  • Roll back unsuccessful security changes.
  • Recover access after a configuration mistake.
  • Maintain consistency across Wazuh nodes.
  • Support disaster recovery and business continuity procedures.

Wazuh itself recommends backing up relevant Indexer security configuration files before making certain authorization changes.

For example, its LDAP integration documentation specifically recommends backing up the Indexer security configuration before modifying roles_mapping.yml.

This is an important distinction: RBAC should be backed up before significant access-control changes, not only after something goes wrong.

Risks of Losing Roles, Permissions, and Role Mappings

The impact of losing RBAC data depends on which component is affected.

If Wazuh Server API roles or policies are lost, users may no longer be able to perform required API operations.

Wazuh’s RBAC model can control actions such as reading agents, restarting agents, modifying rules, and managing security resources.

If Indexer roles or mappings are lost, users may authenticate successfully but receive insufficient permissions when accessing Dashboard data.

Role mappings are particularly important because they establish the relationship between an identity and its permissions.

A role defines what a user can do; the mapping determines which users or groups receive that role.

Losing either side can therefore produce an incomplete authorization system.

External authentication makes the situation more complicated.

Wazuh supports integrations with SAML, LDAP, Active Directory, and several identity providers for SSO.

These systems can supply identities or backend roles that are subsequently mapped to Wazuh permissions.

Consequently, a backup that contains only local users may be insufficient for an environment that relies on external authentication.

When Should You Perform a Wazuh RBAC Backup?

A Backup Wazuh RBAC procedure should be performed before and after significant security-management changes.

Good backup points include:

  • Before creating or modifying custom roles.
  • Before changing role permissions or policies.
  • Before modifying role mappings.
  • Before changing internal users.
  • Before configuring SAML, OIDC, LDAP, or another authentication provider.
  • Before modifying tenant or multi-tenancy settings.
  • Before upgrading Wazuh.
  • Before migrating Wazuh components to new servers.
  • Before changing Indexer security configuration.
  • Before modifying Dashboard security settings.
  • After completing a major RBAC change.
  • As part of a scheduled disaster recovery backup.

For production environments, scheduled backups are preferable to relying exclusively on manual backups.

A configuration backup should also be retained independently of the Wazuh servers so that a server failure does not destroy both the original configuration and its backup.

Backup vs. Full Wazuh Configuration Backup

A Wazuh RBAC backup is not necessarily the same thing as a full Wazuh configuration backup.

A full Wazuh backup may include manager configuration, custom rules and decoders, agent configuration, certificates, Filebeat configuration, Dashboard configuration, Indexer configuration, and other deployment-specific files.

An RBAC-focused backup instead concentrates on the authentication and authorization components required to reproduce access control.

For example, an RBAC backup may need to preserve:

  • Wazuh Server API RBAC policies.
  • Wazuh Server API roles.
  • Wazuh Server API rules.
  • User-to-role assignments.
  • Indexer security roles.
  • Indexer role mappings.
  • Internal users.
  • Tenant-related permissions.
  • Authentication configuration.
  • External identity-provider mappings.
  • Relevant Dashboard security configuration.

See our How to Backup Wazuh Manager Configuration guide to understand how an RBAC backup fits into a complete disaster recovery strategy.

The safest approach is to maintain both: a targeted RBAC backup for quick access-control recovery and a comprehensive Wazuh configuration backup for full-system recovery.


Understanding What Wazuh RBAC Configuration Contains

Before creating a backup, you need to understand what actually constitutes the Wazuh access-control configuration.

There is no single universal file that represents every authorization decision in a Wazuh deployment.

Wazuh Server API RBAC, Wazuh Indexer security, Dashboard configuration, internal users, and external identity providers can each contribute to the final authorization model.

Wazuh’s documentation describes Server API RBAC in terms of users, roles, rules, and policies, while its user-administration functionality also supports internal users, SSO, and LDAP-based authentication and authorization.

Wazuh Security Roles

Roles are one of the most important objects to preserve.

At the Wazuh Server API level, a role groups rules and policies together.

A role can therefore represent a complete permission profile such as:

  • Security analyst.
  • Incident responder.
  • SOC manager.
  • Wazuh administrator.
  • Auditor.
  • Read-only user.
  • Custom operational role.

For example, Wazuh provides default roles such as readonly, cluster_readonly, cluster_admin, and users_admin, while administrators can create custom roles for specific requirements.

A backup should preserve custom role definitions rather than relying solely on Wazuh’s default roles.

Default roles can generally be recreated from the appropriate Wazuh version’s documentation, but custom roles represent configuration decisions specific to your environment.

Role Permissions and Privileges

Roles alone are not enough.

You also need to preserve the permissions associated with them.

Wazuh policies define permissions using concepts such as:

  • Actions: what the user can do.
  • Resources: what the action applies to.
  • Effect: whether the action is allowed or denied.

For example, a policy could permit agent:read against a particular agent or group while preventing users from performing administrative operations.

When backing up RBAC, preserve the relationship between:

Users → Roles → Policies → Rules → Resources

Breaking one of these relationships can produce a backup that looks complete but does not actually reproduce the original access model.

Role Mappings

Role mappings connect users or groups to roles.

This is particularly important because restoring a role without restoring its mappings may create a technically valid role that nobody can use.

Wazuh’s Dashboard security interface allows administrators to create role mappings and associate users with Wazuh roles.

A backup should therefore capture:

  • Mapping names.
  • Assigned roles.
  • Internal users.
  • Backend roles or groups.
  • External identity attributes where applicable.
  • Relevant tenant permissions.

Internal Users and Authentication Configuration

Wazuh can maintain an internal user database for authentication.

These internal users can subsequently be assigned appropriate roles and mappings.

Wazuh also supports using internal users alongside external authentication systems.

The backup strategy therefore needs to account for both the identity and authorization portions of the configuration.

However, avoid treating passwords and other authentication secrets as ordinary configuration files.

Sensitive credentials should be handled separately, encrypted at rest, and protected with appropriately restrictive permissions.

Wazuh’s password-management documentation also distinguishes Wazuh Indexer internal users from Wazuh Server API users, which reinforces why an RBAC backup should identify which authentication subsystem each configuration belongs to.

Tenant and Multi-Tenancy Settings

Multi-tenancy introduces another layer to the backup.

A role may grant a user access to specific tenants, while the tenant itself determines which Dashboard data and saved objects the user can access.

If tenant-related security configuration is omitted from a backup, users may successfully authenticate and receive their expected roles but still encounter missing dashboards, restricted data, or unexpected access boundaries.

When documenting your backup, record:

  • Tenant names.
  • Roles associated with each tenant.
  • Users or groups mapped to those roles.
  • Read/write permissions.
  • Any organization-specific tenant structure.

SAML, OIDC, and LDAP-Related Mappings

External identity providers can significantly change the RBAC backup requirements.

For example, an organization may authenticate users through an identity provider and then use attributes, groups, or backend roles to determine their Wazuh permissions.

Wazuh supports SSO integrations with providers such as Okta, Microsoft Entra ID, Google Workspace, Keycloak, and others.

It also supports LDAP and Active Directory authentication and authorization.

The backup should therefore document or preserve:

  • Identity-provider configuration.
  • Group-to-role mappings.
  • Backend roles.
  • SAML attributes.
  • OIDC claims.
  • LDAP group mappings.
  • Relevant certificates.
  • Redirect or callback configuration.
  • Wazuh-side role mappings.

Related Guides:

For security reasons, do not expose client secrets, private keys, or other credentials in a publicly accessible backup repository.

Wazuh Dashboard Security Configuration

The Wazuh Dashboard is the interface through which administrators and analysts interact with the platform, but its authorization behavior depends on the underlying Wazuh and Indexer security configuration.

For example, Wazuh documentation shows that role mappings can be configured through Server management → Security → Roles mapping, while Indexer roles and internal users are managed through the Indexer security interface.

Relevant Dashboard-side configuration can include:

  • Authentication settings.
  • RBAC-related settings.
  • SSO configuration.
  • Tenant configuration.
  • Security-related YAML configuration.
  • Certificate configuration.
  • Identity-provider integration settings.

One example is the run_as setting in the Dashboard’s wazuh.yml, which Wazuh documents as relevant to applying user role mappings.

See our How to Configure Wazuh SSO guide to learn more about  dashboard authentication and external identity providers.

Wazuh Indexer Security Configuration

The Wazuh Indexer represents another major component of the access-control model.

Indexer security can include:

  • Internal users.
  • Roles.
  • Role mappings.
  • Permissions.
  • Tenant permissions.
  • Authentication settings.
  • Backend roles.
  • Security plugin configuration.
  • Certificates required for secure communication.

Wazuh’s LDAP documentation specifically identifies /etc/wazuh-indexer/opensearch-security/roles_mapping.yml as an important configuration file and recommends backing up the Indexer security configuration before modifying LDAP role mappings.

Wazuh also provides the indexer-security-init.sh utility for backing up the Indexer security configuration, making it particularly useful when creating a structured backup of the Indexer security layer.

Furthermore, Wazuh’s official RBAC documentation covers internal users and role mappings.

Wazuh Server API RBAC documentation — Official documentation for Wazuh API roles, policies, rules, users, and authorization behavior.

Wazuh LDAP integration documentation — Particularly useful because Wazuh explicitly demonstrates backing up Indexer security configuration before changing LDAP role mappings.


Prerequisites for Backing Up Wazuh RBAC

Before beginning a Wazuh RBAC backup, identify exactly which Wazuh components participate in authentication and authorization within your deployment.

The required steps will vary between a single-node installation, a distributed Wazuh deployment, a multi-node Indexer cluster, and an environment integrated with an external identity provider.

Supported Wazuh Version

First, document the Wazuh version you are running.

This matters because RBAC capabilities, configuration structures, security components, and file locations can change between Wazuh releases.

Record at least:

  • Wazuh version.
  • Wazuh Server version.
  • Wazuh Indexer version.
  • Wazuh Dashboard version.
  • Deployment method.
  • Operating system.
  • Number of Wazuh Server nodes.
  • Number of Wazuh Indexer nodes.

When restoring an RBAC configuration, ideally use the same Wazuh version, or verify compatibility before importing configuration from another release.

Wazuh Administrator Privileges

You need sufficient privileges to access and export the security configuration.

Depending on the backup method, this may require:

  • Wazuh administrator permissions.
  • Wazuh Indexer administrative privileges.
  • root or equivalent operating-system access.
  • Access to the Wazuh Dashboard Security interface.
  • Permission to read protected configuration directories.

Do not assume that a normal Wazuh analyst account is sufficient.

Wazuh deliberately uses RBAC to restrict administrative operations, so a read-only role may not be able to inspect or modify all security configuration.

Access to the Wazuh Dashboard

Dashboard access is useful for inventorying the current authorization model before taking the backup.

Review:

  • Server roles.
  • Server role mappings.
  • Indexer roles.
  • Indexer role mappings.
  • Internal users.
  • Tenants.
  • Authentication settings.

Wazuh’s current documentation provides separate interfaces for server security and Indexer security, so reviewing both layers helps prevent an incomplete backup.

SSH or Terminal Access to Wazuh Servers

Terminal access is strongly recommended even when most RBAC administration is performed through the Dashboard.

Command-line access allows you to:

  • Locate configuration files.
  • Create filesystem-level copies.
  • Inspect file ownership and permissions.
  • Run Wazuh security backup utilities.
  • Calculate checksums.
  • Compress backup files.
  • Encrypt backup archives.
  • Transfer backups to a secure repository.
  • Verify that backup files can actually be read.

This is especially important for Indexer security configuration, where Wazuh documents a dedicated security initialization utility for creating a backup of the security configuration.

Identifying the Wazuh Indexer Nodes

In a clustered deployment, identify every Wazuh Indexer node that participates in the security configuration.

Do not automatically assume that backing up one Indexer node is sufficient for every deployment.

Record:

  • Hostnames.
  • IP addresses or DNS names.
  • Node roles.
  • Wazuh Indexer versions.
  • Security configuration locations.
  • Cluster membership.
  • Backup status.

Wazuh supports both single-node and multi-node Indexer deployments, with data distributed across cluster nodes.

For a production cluster, your backup procedure should explicitly define how Indexer security configuration is captured and synchronized across the environment.

Identifying Relevant Configuration and Security Files

Before creating the backup, build an inventory of the files and security objects that apply to your installation.

Depending on the Wazuh version and architecture, this can include:

  • Wazuh Server API RBAC configuration.
  • Wazuh Indexer security configuration.
  • roles_mapping.yml.
  • Indexer role definitions.
  • Internal-user configuration.
  • Dashboard wazuh.yml.
  • SSO configuration.
  • LDAP configuration.
  • SAML configuration.
  • OIDC configuration.
  • Certificate files.
  • Relevant authentication-provider configuration.

Do not blindly copy every file under /etc or /usr/share.

Instead, identify the files that actually participate in your authentication and authorization architecture.

Wazuh’s own LDAP documentation provides a useful example: it identifies the Indexer security directory and specifically recommends backing up its contents before changing role mappings.

Creating a Secure Backup Location

The backup destination should be at least as carefully protected as the original RBAC configuration.

RBAC backups can contain information about:

  • Administrative users.
  • Roles and privileges.
  • Internal users.
  • Identity-provider mappings.
  • Tenant permissions.
  • Security configuration.
  • Certificates or references to authentication infrastructure.

Store backups in a location with restrictive permissions and appropriate encryption.

A production backup strategy should ideally include:

  • Encryption at rest.
  • Restricted administrative access.
  • Separate backup credentials.
  • Off-server storage.
  • Versioned backups.
  • Retention policies.
  • Integrity verification.
  • Audit logging.
  • Protection against accidental deletion.

Never place an RBAC backup in a publicly accessible web directory, source-code repository, or unrestricted shared folder.

The backup itself is a security-sensitive artifact: protecting the backup is part of protecting the RBAC system.

See our How to Configure Wazuh Field Level Security guide to learn more about sensitivity of authorization-related configuration and the principle of restricting access to security data.

Before you create a Wazuh RBAC backup, first identify where your deployment stores and manages authentication and authorization data.

This step is important because Wazuh RBAC is distributed across multiple components rather than being represented by one universal configuration file.

Wazuh Server API RBAC is based on users, roles, rules, and policies, while the Wazuh Indexer maintains its own security configuration for internal users, roles, and role mappings.

The Dashboard connects these components and can also be configured for SSO.

Related Guide: How to Configure Wazuh RBAC

Locate Wazuh Security Configuration Files

Start by identifying the configuration directories on each Wazuh component.

On a typical deployment, pay particular attention to:

  • Wazuh Server/API configuration.
  • Wazuh Indexer security configuration.
  • Wazuh Dashboard configuration.
  • Identity-provider configuration.
  • TLS certificates used by authentication components.

The exact paths can vary by Wazuh version and installation method, so do not assume that every deployment uses identical filesystem locations.

For the Wazuh Dashboard, for example, the wazuh.yml configuration is relevant to Dashboard integration with Wazuh RBAC.

Current Wazuh documentation shows the Dashboard configuration at:

/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml

The run_as setting in this configuration determines whether the Dashboard applies the Wazuh role mappings associated with the authenticated user.

For the Indexer, investigate the security configuration directory, including files such as:

/etc/wazuh-indexer/opensearch-security/

A particularly important file is:

roles_mapping.yml

Wazuh explicitly references this file when configuring LDAP role mappings and recommends backing up the Indexer security configuration before making changes.

Do not modify these files simply to test whether they contain your RBAC configuration.

At this stage, the objective is to inventory the configuration and determine which files and services are authoritative.

Identify Custom Security Roles

Next, identify the custom roles configured in your environment.

Wazuh provides several default API roles, including:

  • administrator
  • agents_admin
  • agents_readonly
  • cluster_admin
  • cluster_readonly
  • readonly
  • users_admin

Administrators can also create custom roles containing organization-specific policies and rules.

Custom roles are especially important to preserve because they represent configuration that may not be reproducible simply by reinstalling Wazuh.

Create an inventory containing information such as:

RolePurposeAssigned Users/GroupsCustom?
administratorFull administrationSOC administratorsNo
readonlyRead-only monitoringSOC analystsNo
incident_responderIncident responseIR teamYes
soc_managerSOC managementSOC managersYes

The exact roles will depend on your environment.

You should also record the policies and rules associated with each custom role.

Wazuh’s RBAC model assigns roles to users, while roles group the policies and rules that determine what those users can do.

Identify Role Mappings

After identifying the roles, determine how users and groups are mapped to them.

Role mappings are critical because restoring a role without restoring its mapping can leave the role unused.

In the Wazuh Dashboard, Wazuh role mappings can be managed through:

Server management → Security → Roles mapping

Wazuh’s documentation shows that a role mapping can associate Wazuh roles with internal users, and that mappings can also be used with external authentication systems.

Record:

  • Role mapping name.
  • Wazuh roles.
  • Internal users.
  • Backend roles.
  • External groups.
  • Tenant assignments.
  • Identity-provider attributes.

For example:

SOC-Analysts
    └── Wazuh role: readonly
    └── IdP group: SOC-Analysts

SOC-Responders
    └── Wazuh role: incident_responder
    └── IdP group: SOC-Incident-Response

SOC-Admins
    └── Wazuh role: administrator
    └── IdP group: SOC-Administrators

This inventory makes it considerably easier to validate the backup later.

See our guide Troubleshooting Wazuh RBAC to see why role mappings must be backed up alongside roles.

Identify Internal Users

Determine whether your deployment uses Wazuh Indexer internal users.

Wazuh includes an internal user database that can be used for authentication independently or alongside external authentication systems such as SAML, LDAP, and Active Directory.

In the Dashboard, internal users can be reviewed through:

Indexer management → Security → Internal users

Inventory the usernames and their associated roles or backend roles.

For example:

admin
    Backend role: admin

soc-analyst
    Backend role: soc_analysts

incident-responder
    Backend role: soc_responders

Do not treat passwords as ordinary backup data.

Password hashes and authentication secrets are sensitive and should be protected with the same or greater security controls as the original configuration.

The goal is to preserve the configuration necessary to reconstruct the authorization model, not to create an unsecured copy of credentials.

Identify Tenant Configurations

If your Wazuh deployment uses multi-tenancy, identify the tenants and determine which roles have access to each one.

Record:

  • Tenant names.
  • Users assigned to each tenant.
  • Groups associated with each tenant.
  • Indexer roles associated with each tenant.
  • Read/write permissions.
  • Custom Dashboard objects associated with each tenant.

This is important because a user can have a valid authentication identity and Wazuh role while still having different visibility depending on their tenant permissions.

Determine Whether RBAC Is Managed Locally or Through SSO

Determine how users authenticate before deciding what your backup must contain.

There are two broad scenarios.

Local authentication

Users authenticate using Wazuh’s internal user database.

In this case, your backup needs to account for internal users, roles, role mappings, and associated Indexer security configuration.

External authentication

Users authenticate through an identity provider such as:

  • LDAP/Active Directory.
  • SAML.
  • OIDC.
  • Microsoft Entra ID.
  • Okta.
  • Google Workspace.
  • Keycloak.

Wazuh supports internal users alongside external authentication systems, so a deployment can also use a hybrid model.

For SSO environments, preserve both sides of the relationship:

Identity Provider
       ↓
User / Group / Claim
       ↓
Wazuh Role Mapping
       ↓
Wazuh Role
       ↓
Policies / Rules
       ↓
Permitted Resources

If you back up only the Wazuh role but not the external group-to-role mapping, the resulting backup may not restore the original access model.

Related Guides:

Distinguish Wazuh Manager Configuration From Indexer Security Configuration

One of the most important steps is understanding that Wazuh Server API RBAC and Wazuh Indexer security are not the same configuration layer.

The Wazuh Server API provides RBAC for Wazuh API endpoints and resources.

Its RBAC model consists of users, roles, rules, and policies.

The Wazuh Indexer, meanwhile, has its own security system containing concepts such as:

  • Internal users.
  • Indexer roles.
  • Role mappings.
  • Backend roles.
  • Index permissions.
  • Cluster permissions.
  • Tenant permissions.

Wazuh’s Dashboard documentation demonstrates this separation: administrators can manage Indexer internal users through Indexer management → Security, while Wazuh role mappings are managed through Server management → Security.

Your backup inventory should therefore explicitly separate the two:

ComponentPrimary purposeBackup separately?
Wazuh Server APIAPI authorizationYes
Wazuh IndexerData and security authorizationYes
Wazuh DashboardUI and authentication integrationYes
Identity ProviderExternal identity and group membershipDocument/configure separately

This distinction prevents one of the most common RBAC backup mistakes: assuming that an Indexer security backup alone represents the complete Wazuh authorization configuration.


Backup Wazuh RBAC Configuration Files

Once you have identified the configuration, you can begin creating the actual backup.

A good backup should preserve both the configuration contents and enough metadata to restore them safely.

That includes ownership, permissions, timestamps where relevant, version information, and the source system.

Back Up Wazuh Indexer Security Configuration

The Wazuh Indexer is one of the most important components to back up because it stores security information such as internal users, roles, and role mappings.

Start by identifying the Indexer security directory:

sudo ls -la /etc/wazuh-indexer/opensearch-security/

You may see files such as:

config.yml
internal_users.yml
roles.yml
roles_mapping.yml
action_groups.yml
tenants.yml
nodes_dn.yml

The exact files present can vary by Wazuh/OpenSearch version and configuration.

Wazuh documentation specifically identifies roles_mapping.yml as part of the Indexer security configuration and recommends backing up the security configuration before changing LDAP mappings.

Create a protected staging directory:

sudo mkdir -p /root/wazuh-rbac-backup/indexer
sudo chmod 700 /root/wazuh-rbac-backup

Then copy the security configuration:

sudo cp -a /etc/wazuh-indexer/opensearch-security/. \
    /root/wazuh-rbac-backup/indexer/

The -a option helps preserve filesystem metadata such as permissions, ownership, timestamps, and symbolic links.

For clustered environments, document which node produced the backup and whether the security configuration is identical across the cluster.

Back Up Custom Roles

Custom roles deserve special attention because they contain organization-specific authorization decisions.

At the Wazuh Server API layer, roles group policies and rules. Wazuh’s API documentation provides endpoints for retrieving and managing roles, policies, rules, and their associations.

At the Indexer layer, custom roles can contain cluster permissions, index permissions, and tenant permissions.

When backing up custom roles, preserve:

  • Role names.
  • Role IDs where applicable.
  • Associated policies.
  • Associated rules.
  • Index permissions.
  • Cluster permissions.
  • Tenant permissions.
  • Mapped users.
  • Mapped backend roles.

Do not assume that a list of role names is sufficient.

The actual permissions assigned to those roles are what determine their security impact.

Back Up Role Mappings

Role mappings should be backed up immediately after roles because they establish which identities receive those roles.

For the Indexer, this commonly includes:

roles_mapping.yml

For Wazuh Server API RBAC, capture the user-role associations exposed through the security API as well.

A useful backup should allow you to answer:

Which user or group receives which role, and why?

For example:

SOC-Analysts
    → readonly
    → global_tenant

SOC-Responders
    → incident_responder
    → soc_incident_tenant

SOC-Administrators
    → administrator
    → global_tenant

This becomes especially important when role mappings are generated from SSO groups rather than local users.

Back Up Internal Users

If internal authentication is enabled, preserve the Indexer internal-user configuration.

Wazuh documents internal users as part of its user-administration system and provides Dashboard functionality for creating and managing them.

The relevant security configuration commonly includes:

internal_users.yml

Back up the file using metadata-preserving copying:

sudo cp -a \
    /etc/wazuh-indexer/opensearch-security/internal_users.yml \
    /root/wazuh-rbac-backup/indexer/

Treat this file as highly sensitive.

Even when it contains password hashes rather than plaintext passwords, it should never be uploaded to a public repository or stored in an unrestricted backup location.

Back Up Wazuh Dashboard Security-Related Configuration

The Dashboard also needs to be included when its configuration participates in authentication and authorization.

One relevant configuration file is:

/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml

Wazuh documents the run_as setting in this file as relevant to applying Wazuh role mappings.

Back it up with:

sudo cp -a \
    /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml \
    /root/wazuh-rbac-backup/

Depending on your deployment, also identify other Dashboard configuration associated with:

  • SAML.
  • OIDC.
  • LDAP.
  • TLS.
  • Authentication.
  • Tenant configuration.

Do not blindly include every Dashboard file in an RBAC backup.

Separate RBAC/security configuration from unrelated Dashboard application data wherever practical.

Preserve File Ownership and Permissions

A backup is more useful when it preserves the original filesystem metadata.

Use:

cp -a

or an equivalent metadata-preserving backup method.

You can inspect the resulting permissions with:

sudo ls -la /root/wazuh-rbac-backup/indexer/

For more detailed metadata:

sudo stat /root/wazuh-rbac-backup/indexer/*

Do not make backup files world-readable.

For example:

sudo chmod -R go-rwx /root/wazuh-rbac-backup

This is particularly important for files containing internal-user information, authentication settings, certificates, or other security-sensitive configuration.

Create a Timestamped Backup Archive

Once the required files have been collected, create a timestamped archive.

For example:

BACKUP_DATE=$(date +%Y%m%d-%H%M%S)

sudo tar -czpf \
    "/root/wazuh-rbac-${BACKUP_DATE}.tar.gz" \
    /root/wazuh-rbac-backup

This produces a backup such as:

wazuh-rbac-20260810-011500.tar.gz

Timestamped archives make it easier to identify which configuration existed at a particular point in time.

For production environments, consider adding:

  • Wazuh version.
  • Hostname.
  • Cluster name.
  • Backup operator.
  • Backup reason.
  • Change ticket.
  • SHA-256 checksum.

For example:

sha256sum /root/wazuh-rbac-${BACKUP_DATE}.tar.gz \
    | sudo tee /root/wazuh-rbac-${BACKUP_DATE}.sha256

Verify That the Backup Contains All Required Files

Never assume that a successfully created archive is a complete backup.

First inspect it:

tar -tzpf /root/wazuh-rbac-20260810-011500.tar.gz

Check that the expected security configuration exists.

For example:

wazuh-rbac-backup/
wazuh-rbac-backup/indexer/
wazuh-rbac-backup/indexer/internal_users.yml
wazuh-rbac-backup/indexer/roles.yml
wazuh-rbac-backup/indexer/roles_mapping.yml
...

You should also verify:

  • Custom roles exist.
  • Role mappings exist.
  • Internal users are represented.
  • Tenant configuration is present where applicable.
  • Dashboard security configuration is included.
  • External authentication configuration is documented.
  • The Wazuh Server API RBAC configuration has been captured.
  • The backup archive can be opened successfully.
  • The checksum matches after transferring the archive.

A stronger validation method is to restore the backup into an isolated test environment and verify authentication and authorization behavior.


Export Wazuh RBAC Settings Using the Security API

Filesystem backups are valuable, but they are not the only way to capture Wazuh RBAC configuration.

The Wazuh Server API provides programmatic access to security configuration and RBAC resources.

Wazuh describes the Server API as a REST API that can be accessed through the Dashboard API console, cURL, scripts, or other HTTP clients.

This makes an API-based export useful for creating a logical representation of your RBAC configuration.

It should generally complement, rather than automatically replace, your filesystem-level security backup.

Overview of the Wazuh Security API

The Wazuh Server API exposes security endpoints for managing:

  • Users.
  • Roles.
  • Policies.
  • Rules.
  • Role assignments.
  • Security configuration.

The current API documentation includes endpoints such as:

GET /security/config
GET /security/roles
GET /security/users
GET /security/policies
GET /security/rules

The security configuration endpoint returns the current Wazuh Server API security configuration, including settings such as rbac_mode and token expiration behavior.

Wazuh’s RBAC reference also documents the relationships between roles, policies, rules, and users.

Authenticate With an Administrative Account

Wazuh API requests require authentication.

The API documentation specifies that clients can authenticate through:

POST /security/user/authenticate

and receive a JSON Web Token (JWT), which is then supplied with subsequent requests.

A basic example using cURL is:

curl -k -u 'USERNAME:PASSWORD' \
  -X POST \
  'https://WAZUH_MANAGER:55000/security/user/authenticate?raw=true'

The response contains an authentication token.

Do not place the production password directly into shell history.

A safer implementation retrieves credentials from a protected secret store or prompts for them interactively.

For example:

read -rsp "Wazuh API password: " WAZUH_PASSWORD
echo

Then use the credential without hard-coding it into a script or committing it to source control.

Wazuh documents JWT authentication for its API and notes that authentication tokens expire according to the configured auth_token_exp_timeout value.

Retrieve Configured Roles

After authentication, retrieve the configured roles.

Conceptually, the request is:

curl -k \
  -H "Authorization: Bearer $TOKEN" \
  'https://WAZUH_MANAGER:55000/security/roles?pretty=true'

Save the response:

curl -k \
  -H "Authorization: Bearer $TOKEN" \
  'https://WAZUH_MANAGER:55000/security/roles?pretty=true' \
  > wazuh-rbac-roles.json

The resulting JSON provides a machine-readable representation of the Wazuh Server API roles.

This is particularly useful for identifying custom roles and their associated policies and rules.

Retrieve Role Mappings

Next, export the user-role relationships.

The exact API endpoint and query parameters should be checked against the API reference for the Wazuh version you are running.

The important objective is to capture the associations between:

User → Role
Role → Policies
Role → Rules

This API representation complements the Indexer-side roles_mapping.yml backup.

Do not confuse these two layers. An Indexer role mapping and a Wazuh Server API role assignment can both influence access, but they belong to different security subsystems.

Retrieve Users and Security Configuration

Export the Wazuh Server API users:

curl -k \
  -H "Authorization: Bearer $TOKEN" \
  'https://WAZUH_MANAGER:55000/security/users?pretty=true' \
  > wazuh-rbac-users.json

Then export the Server API security configuration:

curl -k \
  -H "Authorization: Bearer $TOKEN" \
  'https://WAZUH_MANAGER:55000/security/config?pretty=true' \
  > wazuh-rbac-security-config.json

The latter is particularly useful because Wazuh documents /security/config as the endpoint for viewing the API security configuration, including the rbac_mode setting.

You can also export policies and rules:

curl -k \
  -H "Authorization: Bearer $TOKEN" \
  'https://WAZUH_MANAGER:55000/security/policies?pretty=true' \
  > wazuh-rbac-policies.json
curl -k \
  -H "Authorization: Bearer $TOKEN" \
  'https://WAZUH_MANAGER:55000/security/rules?pretty=true' \
  > wazuh-rbac-rules.json

These exports provide a much more complete representation of the Server API RBAC model than exporting roles alone.

Save API Responses as Backup Files

A practical API export directory might look like:

wazuh-rbac-api-backup/
├── roles.json
├── users.json
├── policies.json
├── rules.json
├── security-config.json
└── metadata.txt

The metadata.txt file can contain:

Wazuh version:
Wazuh Manager hostname:
Backup timestamp:
API endpoint:
Backup operator:
Deployment type:

Avoid including the authentication token in this metadata file.

You can create a compressed archive after completing the export:

tar -czpf \
    wazuh-rbac-api-$(date +%Y%m%d-%H%M%S).tar.gz \
    wazuh-rbac-api-backup/

Then calculate its checksum:

sha256sum wazuh-rbac-api-*.tar.gz

Compare API-Based Backups With Filesystem Backups

The strongest approach is to use both backup methods because they answer different questions.

Backup methodPrimary benefit
Filesystem backupPreserves configuration files and filesystem metadata
API exportProvides a structured representation of active Wazuh RBAC objects
Indexer security backupCaptures Indexer users, roles, mappings, and related security configuration
Dashboard configuration backupPreserves Dashboard-side authentication and RBAC integration settings

For example, the API export might show:

Role: incident_responder
Policies: incident_response_*
Users: ir-team

while the filesystem backup preserves the underlying configuration required to reconstruct the deployment.

Comparing the two can reveal discrepancies.

If a custom role exists in the API response but is absent from your filesystem backup, your backup procedure is incomplete.

Likewise, if roles_mapping.yml contains an Indexer mapping that does not appear in your Wazuh Server API export, that does not necessarily indicate an error, it may simply belong to the Indexer security layer rather than Server API RBAC.

This distinction is why a layered backup strategy is preferable.

Protect Exported Credentials and Sensitive Data

API exports can contain sensitive information and should be handled as confidential security artifacts.

At minimum:

chmod 700 wazuh-rbac-api-backup
chmod 600 wazuh-rbac-api-backup/*

Do not:

  • Commit API exports to Git.
  • Upload them to public cloud storage.
  • Store them in a publicly accessible web directory.
  • Email them without appropriate protection.
  • Include API passwords in scripts.
  • Store authentication tokens alongside the exported configuration.

Also remember that an API export is not necessarily a complete disaster-recovery backup.

It captures the logical Server API RBAC state, while the Indexer and Dashboard have their own security configuration.

The best production strategy is therefore:

                 Wazuh RBAC Backup
                         │
          ┌──────────────┼──────────────┐
          │              │              │
       API Export    Indexer Backup   Dashboard
          │              │              │
       Roles          Users/Roles      Security
       Policies       Mappings         Config
       Rules           Tenants          SSO
       Users           Security Files   Integration
          │              │              │
          └──────────────┼──────────────┘
                         │
                  Encrypted Archive
                         │
                  Secure Off-Host
                      Storage

This gives you both a logical API representation and a configuration-level backup, making it substantially easier to audit, compare, and recover your Wazuh RBAC configuration.

Wazuh Server API documentation — Use the official API documentation as the authoritative reference when adapting the export commands to your installed Wazuh version.

Wazuh API reference — The versioned API reference documents authentication and the available security endpoints for users, roles, policies, rules, and security configuration.


Backup Wazuh RBAC in a Multi-Node Cluster

Backing up Wazuh RBAC in a multi-node environment requires more planning than backing up a standalone installation.

A production deployment may contain multiple Wazuh Manager nodes, multiple Wazuh Indexer nodes, and one or more Wazuh Dashboard instances.

The key objective is to determine which security configuration is authoritative for each component, capture it consistently, and avoid treating every cluster node as an independent RBAC system.

For the Indexer, Wazuh uses OpenSearch security components to manage internal users, roles, role mappings, and related authorization settings.

The Wazuh Manager cluster, meanwhile, provides high availability and synchronization for Manager configuration and operational state.

See our The Complete Wazuh Cluster Architecture Guide for a deeper explanation of Wazuh Manager and Indexer cluster topology.

Identify the Wazuh Indexer Cluster Topology

Start by documenting the Indexer cluster.

Identify:

  • Every Wazuh Indexer node.
  • The cluster name.
  • Node names.
  • Node roles.
  • Which node is used for administrative security operations.
  • Wazuh Indexer versions.
  • Security plugin configuration.
  • Certificate configuration.
  • Cluster health.

For example:

Wazuh Indexer Cluster
│
├── indexer-01
│   └── Cluster manager
│
├── indexer-02
│   └── Data node
│
└── indexer-03
    └── Data node

The exact topology will depend on the deployment.

Before backing up RBAC, determine how security configuration is managed within that cluster.

Do not simply SSH into an arbitrary node and assume that its local files represent the complete current security state.

Determine Which RBAC Configuration Is Cluster-Wide

The Wazuh Indexer security layer contains configuration that logically applies to the Indexer cluster rather than representing an independent authorization system on each node.

This can include:

  • Security roles.
  • Role mappings.
  • Internal users.
  • Tenant definitions.
  • Permissions.
  • Security plugin configuration.

For example, roles_mapping.yml describes mappings between identities and roles.

Wazuh’s LDAP documentation specifically uses this file when configuring Indexer authorization and recommends backing up the security configuration before making changes.

This means your backup procedure should distinguish between:

Cluster-level security configuration

and

Node-specific configuration

Do not create multiple independent “master” versions of the same RBAC configuration and later attempt to merge them manually.

Back Up Security Configuration From the Appropriate Node

Determine which Indexer node should be used to perform your security backup.

Wazuh’s documentation provides procedures for backing up the Indexer security configuration using the security administration tooling.

This is preferable to arbitrarily copying configuration from an unknown node because the security configuration may have been changed through the security plugin rather than exclusively through local files.

For file-level backups, preserve the security configuration directory with metadata:

sudo cp -a /etc/wazuh-indexer/opensearch-security \
    /root/wazuh-rbac-backup/

For production environments, follow the Wazuh-supported security backup procedure for your installed version rather than relying exclusively on a manual file copy.

Maintain Consistent RBAC Backups Across Nodes

A clustered deployment should maintain a clear backup policy.

For example:

Indexer cluster
    ↓
Select authoritative security backup source
    ↓
Export security configuration
    ↓
Record cluster/node/version metadata
    ↓
Store backup centrally

Do not allow every administrator to create an independent backup archive with an ambiguous filename such as:

backup.tar.gz

Instead, use descriptive names:

wazuh-rbac-indexer-prod-20260810-013000.tar.gz

Include metadata such as:

  • Cluster name.
  • Source node.
  • Wazuh version.
  • Indexer version.
  • Backup timestamp.
  • Backup operator.
  • Change ticket or reason.

This makes it much easier to determine which backup should be restored during an incident.

Account for Wazuh Manager Clusters

The Wazuh Manager cluster is separate from the Indexer cluster.

A deployment might therefore look like:

                 Wazuh Dashboard
                        │
             ┌──────────┴──────────┐
             │                     │
       Wazuh Manager          Wazuh Manager
          Master                 Worker
             │                     │
             └──────────┬──────────┘
                        │
                Wazuh Indexer
                     Cluster

Do not confuse Manager clustering with Indexer clustering.

Manager configuration can include Wazuh API RBAC-related configuration, while the Indexer maintains its own security configuration.

Related Guides:

When creating an RBAC backup, document which configuration belongs to the Manager cluster and which belongs to the Indexer cluster.

Validate RBAC Synchronization

After making an RBAC change, verify that the expected behavior is visible across the cluster.

For example, create or modify a test role and verify:

  1. The role exists.
  2. The role has the expected permissions.
  3. The mapping exists.
  4. The expected user or group receives the role.
  5. Authentication succeeds.
  6. Authorized resources remain accessible.
  7. Unauthorized resources remain inaccessible.

You can also compare configuration checksums when appropriate:

sha256sum /etc/wazuh-indexer/opensearch-security/roles_mapping.yml

However, do not assume that identical local files alone prove that the security state is synchronized.

Validate the effective authorization behavior through the relevant Wazuh interfaces and APIs.

Avoid Restoring Conflicting Configurations Across Nodes

One of the most dangerous mistakes during recovery is restoring different RBAC configurations to different cluster nodes.

For example:

indexer-01 → roles_mapping.yml from Monday
indexer-02 → roles_mapping.yml from Wednesday
indexer-03 → roles_mapping.yml from Friday

This creates uncertainty about which security state represents the intended configuration.

Instead:

  1. Stop or isolate the affected recovery process as appropriate.
  2. Select a known-good backup.
  3. Confirm the Wazuh/Indexer version.
  4. Confirm the cluster topology.
  5. Restore according to Wazuh’s supported procedure.
  6. Validate cluster health.
  7. Test authentication.
  8. Test authorization.
  9. Confirm role mappings.
  10. Record the recovery event.

Never merge security configuration files manually unless you understand the resulting authorization model and have a tested recovery procedure.


Automate Wazuh RBAC Backups

Manual backups are useful before major configuration changes, but production environments should also automate recurring RBAC backups.

Automation reduces the likelihood that an administrator forgets to create a backup before modifying a role, changing an SSO mapping, or upgrading Wazuh.

A practical automated workflow can:

Create backup directory
        ↓
Collect RBAC configuration
        ↓
Export API configuration
        ↓
Create archive
        ↓
Encrypt archive
        ↓
Generate checksum
        ↓
Transfer to backup server
        ↓
Apply retention policy
        ↓
Report success/failure

Create a Scheduled Backup Script

Create a dedicated script rather than placing a long sequence of commands directly into cron.

For example:

sudo mkdir -p /usr/local/sbin
sudo nano /usr/local/sbin/backup-wazuh-rbac.sh

A production script should:

  • Create a timestamp.
  • Create a temporary working directory.
  • Collect required configuration.
  • Export API data.
  • Create an archive.
  • Generate a checksum.
  • Apply permissions.
  • Transfer the archive.
  • Remove temporary files.
  • Return a non-zero exit code when something fails.

Use strict shell behavior where appropriate:

set -euo pipefail

This helps prevent the script from silently continuing after a failed command.

Generate Timestamped Backup Directories

Create a unique directory for every backup:

BACKUP_DATE=$(date '+%Y%m%d-%H%M%S')

BACKUP_DIR="/var/backups/wazuh-rbac/${BACKUP_DATE}"

mkdir -p "$BACKUP_DIR"
chmod 700 "$BACKUP_DIR"

This produces a structure such as:

/var/backups/wazuh-rbac/
├── 20260808-010000/
├── 20260809-010000/
└── 20260810-010000/

Timestamped directories make individual backups easy to identify and simplify retention management.

Archive RBAC Configuration Files

After collecting the configuration:

tar -czpf \
  "/var/backups/wazuh-rbac/wazuh-rbac-${BACKUP_DATE}.tar.gz" \
  "$BACKUP_DIR"

Then create a checksum:

sha256sum \
  "/var/backups/wazuh-rbac/wazuh-rbac-${BACKUP_DATE}.tar.gz" \
  > "/var/backups/wazuh-rbac/wazuh-rbac-${BACKUP_DATE}.sha256"

The checksum gives you a simple way to detect accidental or malicious modification of the archive.

Export RBAC Settings Automatically

If you want the backup to contain a logical representation of Server API RBAC, have the script authenticate to the Wazuh API and export relevant resources.

The script can collect:

  • Security configuration.
  • Roles.
  • Users.
  • Policies.
  • Rules.
  • Role associations.

Wazuh documents these security resources through its API reference.

Avoid embedding a production API password directly in the script.

Instead, use a protected credentials file, environment supplied by a secure service, or an enterprise secrets manager.

Use Cron for Scheduled Backups

Once the script has been tested manually, schedule it with cron.

For example, to run the backup every day at 1:00 AM:

sudo crontab -e

Add:

0 1 * * * /usr/local/sbin/backup-wazuh-rbac.sh

Before relying on the scheduled job, run it manually:

sudo /usr/local/sbin/backup-wazuh-rbac.sh

Then inspect:

ls -lah /var/backups/wazuh-rbac/

A scheduled job that fails silently is worse than no automated backup because it can create a false assumption that recoverable backups exist.

Store Backups on a Separate System

Do not keep every backup exclusively on the Wazuh server.

If an attacker compromises the server and obtains administrative privileges, locally stored backups may also be deleted, modified, or encrypted.

A stronger design is:

Wazuh Server
     │
     ├── Local short-term backup
     │
     └── Secure transfer
             ↓
       Backup Server
             ↓
       Offline / Immutable
             Copy

Possible destinations include:

  • Dedicated backup servers.
  • Encrypted object storage.
  • Enterprise backup platforms.
  • Offline storage.
  • Immutable storage.

Use a dedicated backup identity with only the permissions necessary to upload backups.

Implement Backup Retention

A useful retention policy might retain:

  • Daily backups for 7–14 days.
  • Weekly backups for 4–8 weeks.
  • Monthly backups for 6–12 months.

The exact retention period should follow your organization’s security, compliance, and disaster-recovery requirements.

For example:

Daily   → 14 copies
Weekly  → 8 copies
Monthly → 12 copies

Do not implement retention by simply deleting the oldest backup without first confirming that newer backups completed successfully.

A failed backup should not trigger deletion of the last known-good copy.

Encrypt Sensitive Backup Archives

RBAC backups can contain security-sensitive information, so encrypt them before moving them to external storage.

For example, an organization might use an approved enterprise encryption system or a tool such as GPG:

gpg --symmetric \
    --cipher-algo AES256 \
    --output wazuh-rbac-${BACKUP_DATE}.tar.gz.gpg \
    wazuh-rbac-${BACKUP_DATE}.tar.gz

However, encryption is only useful if the encryption key can itself be recovered.

Do not store the encryption key next to the backup.

Use your organization’s approved key-management or secrets-management solution whenever possible.

Monitor Backup Job Failures

A backup script should provide a clear success or failure signal.

For example:

if /usr/local/sbin/backup-wazuh-rbac.sh; then
    echo "Wazuh RBAC backup completed successfully"
else
    echo "Wazuh RBAC backup FAILED"
    exit 1
fi

Production environments should integrate backup monitoring with their existing monitoring or alerting platform.

Create alerts for:

  • Backup script failures.
  • Missing daily backups.
  • Failed API authentication.
  • Insufficient disk space.
  • Archive creation failures.
  • Encryption failures.
  • Backup-transfer failures.
  • Checksum mismatches.
  • Unexpectedly small backup files.

The objective is not merely to create backups, but to know when the backup process stops working.


Secure Wazuh RBAC Backups

RBAC backups contain information that can help reconstruct your security model.

In some environments, they may also contain password hashes, authentication settings, certificates, role mappings, or other sensitive configuration.

Treat them as confidential security assets.

Protect Administrative Credentials

Never hard-code administrative passwords into backup scripts.

Avoid:

curl -u admin:SuperSecretPassword ...

because credentials can appear in:

  • Shell history.
  • Process listings.
  • Script files.
  • Configuration-management repositories.
  • Backup archives.
  • Logs.

Instead, use a secure credential-management mechanism.

If an API credential must be stored locally, restrict the file:

chmod 600 /etc/wazuh/wazuh-api-credentials
chown root:root /etc/wazuh/wazuh-api-credentials

Prefer an enterprise secrets manager when one is available.

Restrict Backup File Permissions

RBAC backup files should not be readable by ordinary users.

For example:

chmod 700 /var/backups/wazuh-rbac
chmod 600 /var/backups/wazuh-rbac/*

Verify the result:

ls -la /var/backups/wazuh-rbac/

The backup process should normally run under a dedicated administrative account with the minimum permissions necessary to perform the backup.

Encrypt Backups at Rest

Encryption at rest protects backups if the storage system, backup server, or physical media is compromised.

Use your organization’s approved encryption technology.

For cloud or enterprise backup platforms, enable:

  • Server-side encryption.
  • Customer-managed keys where required.
  • Key rotation.
  • Access logging.
  • Least-privilege access.

For local archives, use strong encryption and keep encryption keys separate from the backup data.

The security model should look like:

RBAC Configuration
       ↓
Encrypted Backup
       ↓
Separate Key Management
       ↓
Restricted Backup Access

Do not store the encryption key and encrypted archive in the same unrestricted directory.

Secure Backup Transfers

When transferring backups to another server, use an encrypted transport mechanism.

For example, SSH/SFTP can be used to transfer an archive:

scp wazuh-rbac-20260810.tar.gz \
    backupuser@backup-server:/secure/wazuh/

For automated production environments, use SSH keys rather than passwords where appropriate, and restrict the backup account’s permissions.

Additional controls can include:

  • Dedicated backup network.
  • Firewall restrictions.
  • IP allowlisting.
  • SSH key restrictions.
  • Transfer logging.
  • Destination-side encryption.

See our How to Configure a Wazuh IP Whitelist  guide to learn about network restrictions for backup servers or administrative access.

Avoid Storing Passwords in Scripts

A backup script should contain logic, not secrets.

Bad:

API_PASSWORD="MyPassword123"

Better approaches include:

  • Environment-provided secrets.
  • Protected credential files.
  • Secret-management platforms.
  • Short-lived credentials.
  • Interactive authentication for manual backups.

Make sure the backup script itself is protected:

sudo chown root:root /usr/local/sbin/backup-wazuh-rbac.sh
sudo chmod 700 /usr/local/sbin/backup-wazuh-rbac.sh

This prevents ordinary users from modifying a script that runs with elevated privileges.

Protect API Tokens and Certificates

API tokens are credentials.

If your backup process creates a JWT or other authentication token, do not write it into the backup archive unless there is a documented operational requirement.

For example, avoid creating:

wazuh-rbac-backup/
├── roles.json
├── users.json
├── policies.json
└── api-token.txt

The token should normally be used temporarily and then discarded.

Certificates require similar protection. Public certificates may not be particularly sensitive, but private keys absolutely are.

Never include private keys in an unsecured backup archive.

If certificates are necessary for disaster recovery, encrypt the archive and restrict access to the recovery personnel and systems that require it.

Separate Production Systems From Backup Storage

A backup should not depend entirely on the same infrastructure that it protects.

For example, avoid:

Wazuh Server
└── /var/backups/wazuh-rbac/

as your only copy.

A better arrangement is:

                  Wazuh Production
                         │
                         │ encrypted transfer
                         ↓
                  Backup Repository
                         │
                  ┌──────┴──────┐
                  ↓             ↓
             Online Copy   Immutable Copy
                                │
                                ↓
                         Offline Recovery

This reduces the risk that a compromise of the Wazuh environment results in simultaneous destruction of production data and backups.

Maintain Offline or Immutable Backup Copies

For high-value Wazuh deployments, maintain at least one backup copy that cannot easily be modified or deleted by an attacker who compromises the production environment.

Possible approaches include:

  • Immutable object storage.
  • Write-once storage.
  • Offline media.
  • Air-gapped backup infrastructure.
  • Backup platforms with immutable retention.
  • Separate administrative credentials for backup management.

This is particularly important for ransomware scenarios.

If an attacker obtains administrative access to the Wazuh environment, the attacker may attempt to destroy security logs, monitoring configuration, and recovery data.

An immutable RBAC backup provides a known-good configuration from which access control can be reconstructed.

Finally, test the backups.

A backup that has never been restored is an assumption, not a proven recovery mechanism.

Periodically restore a Wazuh RBAC backup in an isolated test environment and verify:

  • Users can authenticate.
  • Expected roles exist.
  • Role mappings are intact.
  • API permissions work.
  • Indexer permissions work.
  • Tenant access is correct.
  • SSO mappings function as expected.
  • Unauthorized operations remain blocked.

That validation closes the loop between creating a Wazuh RBAC backup and actually being able to use it during a recovery event.


Verify a Wazuh RBAC Backup

Creating a backup archive does not prove that the backup is usable.

A successful tar, cp, or API export command only confirms that a command completed; it does not guarantee that every required RBAC object was captured or that the backup can be restored.

A reliable Wazuh RBAC backup should therefore be verified immediately after creation and periodically through an actual restoration test.

The verification process should cover both the Wazuh Server API RBAC layer and the Wazuh Indexer security layer.

Check That Expected Configuration Files Exist

Start by inspecting the backup archive or directory and confirming that the expected files are present.

For an Indexer security backup, this may include files such as:

internal_users.yml
roles.yml
roles_mapping.yml
action_groups.yml
tenants.yml
config.yml

The exact files depend on your Wazuh version and configuration.

Inspect a compressed archive with:

tar -tzpf wazuh-rbac-20260810-010000.tar.gz

You should also verify that the backup contains any relevant Dashboard and Wazuh Server configuration.

For example:

wazuh-rbac-backup/
├── indexer/
│   ├── internal_users.yml
│   ├── roles.yml
│   ├── roles_mapping.yml
│   └── ...
├── dashboard/
│   └── wazuh.yml
└── api/
    ├── users.json
    ├── roles.json
    ├── policies.json
    ├── rules.json
    └── security-config.json

Do not use a generic file-count check as your only validation.

A backup can contain many files while still missing the one custom role or mapping required for recovery.

Validate File Integrity

Compare the backup files against their original counterparts where appropriate.

For example:

sha256sum /etc/wazuh-indexer/opensearch-security/roles.yml
sha256sum /root/wazuh-rbac-backup/indexer/roles.yml

If the files are expected to be identical, their hashes should match.

For an archive, generate a checksum:

sha256sum wazuh-rbac-20260810-010000.tar.gz \
    > wazuh-rbac-20260810-010000.sha256

Later, validate it with:

sha256sum -c wazuh-rbac-20260810-010000.sha256

A successful result should resemble:

wazuh-rbac-20260810-010000.tar.gz: OK

Checksums do not prove that the configuration is correct, but they help detect corruption or unexpected modification.

Verify Exported Roles and Mappings

If you created API exports, inspect the JSON files and verify that expected custom roles are present.

For example:

jq '.data' wazuh-rbac-roles.json

You can search for a specific custom role:

jq '.. | objects | select(.name? == "incident_responder")' \
    wazuh-rbac-roles.json

Similarly, verify important users and role associations.

Check for:

  • Custom analyst roles.
  • Incident-response roles.
  • Administrator roles.
  • Auditor roles.
  • Role mappings.
  • Policies.
  • Rules.
  • Tenant assignments.

This is particularly important after a major RBAC change.

If a new role was created yesterday but is missing from today’s backup, the backup process has failed its primary objective.

See our Troubleshooting Wazuh RBAC for validation of role assignments.

Test Archive Extraction

Always verify that the archive can actually be extracted.

Create a temporary test directory:

mkdir -p /tmp/wazuh-rbac-restore-test

Extract the archive:

tar -xzpf wazuh-rbac-20260810-010000.tar.gz \
    -C /tmp/wazuh-rbac-restore-test

Then inspect the resulting files:

find /tmp/wazuh-rbac-restore-test -type f -print

Clean up after the test:

rm -rf /tmp/wazuh-rbac-restore-test

This catches problems such as:

  • Corrupted archives.
  • Missing files.
  • Incorrect archive paths.
  • Permission problems.
  • Incomplete backup jobs.

Confirm Backup Ownership and Permissions

RBAC backups should normally be accessible only to authorized administrators.

Check ownership:

ls -la /var/backups/wazuh-rbac/

For more detailed information:

stat /var/backups/wazuh-rbac/wazuh-rbac-20260810-010000.tar.gz

A typical protected backup might be owned by root with restrictive permissions:

-rw------- 1 root root ...

The exact ownership model should follow your organization’s backup architecture.

Avoid permissions such as:

-rw-r--r-- 

for files containing sensitive security configuration unless there is a specific reason and the contents have been appropriately protected.

Maintain Backup Checksums

Keep the checksum separately from the backup archive where practical.

For example:

wazuh-rbac-20260810-010000.tar.gz
wazuh-rbac-20260810-010000.sha256

When transferring the archive to another system, verify the checksum again after transfer.

For example:

sha256sum -c wazuh-rbac-20260810-010000.sha256

This gives you confidence that the backup arrived intact.

For higher-assurance environments, consider signing backup manifests or checksums with an organizational signing key.

Perform Periodic Restore Tests

The most important verification step is an actual restoration test.

At scheduled intervals, restore a backup into an isolated Wazuh test environment.

Test:

  1. Internal-user authentication.
  2. Administrator access.
  3. Analyst permissions.
  4. Incident-response permissions.
  5. Role mappings.
  6. Indexer permissions.
  7. Tenant access.
  8. SSO mappings.
  9. Wazuh Server API permissions.

A restore test should answer one question:

Can this backup actually reproduce the intended authorization model?

A backup that passes a checksum test but fails to restore the expected administrator role is not a usable backup.


Restore Wazuh RBAC Configurations

RBAC restoration should be treated as a controlled security operation.

Replacing authentication and authorization configuration can immediately change who can access Wazuh and what they can do.

A poorly planned restoration can lock administrators out, grant excessive privileges, or cause SSO users to lose access.

Before restoring anything, identify the affected Wazuh component and determine whether the problem concerns:

  • Wazuh Server API RBAC.
  • Wazuh Indexer security.
  • Wazuh Dashboard authentication.
  • Internal users.
  • Role mappings.
  • Tenant configuration.
  • SAML/OIDC/LDAP integration.

When RBAC Restoration Is Necessary

You may need to restore Wazuh RBAC after:

  • Accidental deletion of a custom role.
  • Incorrect role permissions.
  • Corrupted security configuration.
  • Failed authentication changes.
  • Incorrect SSO mappings.
  • Failed LDAP configuration.
  • Failed Wazuh upgrade.
  • Indexer security configuration corruption.
  • Server replacement.
  • Disaster recovery.
  • Unauthorized configuration changes.

Restoration can also be useful when an administrator needs to roll back a known-bad security change.

For example, suppose an administrator changes an Indexer role mapping and unintentionally removes access for the SOC team.

Rather than manually reconstructing the previous configuration, the administrator can restore the last known-good backup after confirming that the backup is appropriate.

Prepare the Wazuh Environment for Restoration

Before restoring anything, record the current environment.

Capture:

Wazuh version:
Wazuh Manager version:
Wazuh Indexer version:
Wazuh Dashboard version:
Manager cluster topology:
Indexer cluster topology:
Authentication method:
Backup timestamp:
Restore reason:

Also create a backup of the current broken or modified configuration before replacing it.

For example:

sudo cp -a /etc/wazuh-indexer/opensearch-security \
    /root/wazuh-rbac-before-restore/

This gives you a rollback point if the restoration does not produce the expected result.

Stop Affected Wazuh Services When Required

Whether services need to be stopped depends on the specific configuration being restored and the Wazuh-supported procedure for your version.

Do not blindly stop every Wazuh service.

For example, if you are replacing static configuration files that are read during service startup, the affected service may need to be stopped before the files are replaced and restarted afterward.

For an Indexer restoration, follow the Wazuh documentation for the applicable security administration procedure rather than treating the Indexer as a simple file-copy operation.

The general sequence is:

Backup current state
        ↓
Stop affected service if required
        ↓
Restore configuration
        ↓
Validate configuration
        ↓
Start/restart service
        ↓
Validate authentication
        ↓
Validate authorization

Restore RBAC Configuration Files

Extract the known-good archive into a temporary location first:

mkdir -p /tmp/wazuh-rbac-restore
tar -xzpf wazuh-rbac-20260810-010000.tar.gz \
    -C /tmp/wazuh-rbac-restore

Do not immediately overwrite production files.

Review the extracted configuration:

find /tmp/wazuh-rbac-restore -type f -print

Confirm:

  • The backup is from the correct Wazuh version.
  • The backup came from the correct environment.
  • The expected custom roles exist.
  • The expected mappings exist.
  • The configuration paths match the target system.

Then restore the files using the appropriate Wazuh-supported procedure.

For example, when restoring a file-level Indexer configuration:

sudo cp -a \
    /tmp/wazuh-rbac-restore/wazuh-rbac-backup/indexer/. \
    /etc/wazuh-indexer/opensearch-security/

Do not use this example blindly on a production cluster. Wazuh/OpenSearch security configuration can require additional initialization or security-admin operations depending on the configuration and version.

Restore Roles and Role Mappings

Roles and mappings must be restored together.

Restoring:

roles

without:

role mappings

can produce a system where the required permissions exist but users are not assigned them.

Likewise, restoring mappings without the corresponding roles can produce references to missing or incompatible authorization objects.

For a Wazuh Server API restoration, use the API’s supported role, policy, rule, and user-management operations where appropriate.

For the Indexer, follow the Wazuh-supported security configuration procedure for restoring roles and mappings.

Restore Internal Users

If your deployment uses internal authentication, restore the relevant internal-user configuration.

The Indexer security configuration commonly includes:

internal_users.yml

Before restoring it, confirm that:

  • The backup belongs to the same environment.
  • The Wazuh/Indexer versions are compatible.
  • The required administrator account exists.
  • Password hashes are from the intended configuration.
  • File ownership and permissions are correct.

Do not restore an internal-user database from an unrelated Wazuh environment simply because the usernames appear similar.

Apply Restored Security Configuration

After restoring the files, apply them using the security-management mechanism appropriate to your Wazuh version.

This distinction matters because copying an Indexer security file onto disk does not necessarily mean that the running OpenSearch security subsystem has immediately adopted the change.

Wazuh’s documentation provides specific procedures and utilities for managing Indexer security configuration.

Follow the procedure corresponding to your installed version rather than improvising a production restoration command.

For Wazuh Server API RBAC, use the supported API operations to recreate or verify users, roles, policies, and rules where necessary.

Restart Affected Services

Once the configuration has been restored and validated, restart the affected services according to the Wazuh recovery procedure.

For example, a Dashboard configuration change may require restarting the Dashboard service.

An Indexer configuration change may require restarting or otherwise reloading the relevant security configuration depending on the restoration method.

Avoid restarting unrelated components unnecessarily.

After restarting, immediately inspect service status and logs.

For example:

sudo systemctl status wazuh-indexer

and:

sudo journalctl -u wazuh-indexer --since "10 minutes ago"

The exact service names and diagnostic locations depend on the Wazuh component being restored.

Verify RBAC Functionality

Restoration is not complete until authorization has been tested.

Test at least three permission levels:

Administrator

  • Can authenticate.
  • Can manage users.
  • Can manage roles.
  • Can access administrative interfaces.

Analyst

  • Can access permitted security data.
  • Cannot perform unauthorized administrative actions.

Incident responder

  • Can perform the additional operational actions assigned to the responder role.
  • Cannot perform administrator-only operations.

For API RBAC, test the actual API operations associated with each role.

For Dashboard/Indexer RBAC, test both data visibility and administrative actions.

A successful login alone is not sufficient. Authentication proves the identity was accepted; RBAC validation requires proving that the identity received the correct authorization.


Restore Wazuh RBAC After a Server Failure

A server failure can turn a straightforward RBAC restoration into a complete disaster-recovery exercise.

If the failed server hosted the Wazuh Indexer, Dashboard, or Manager, you may need to rebuild the underlying platform before restoring the security configuration.

The correct recovery order is generally:

Rebuild infrastructure
        ↓
Install compatible Wazuh components
        ↓
Restore base configuration
        ↓
Restore security configuration
        ↓
Restore RBAC
        ↓
Reconnect authentication
        ↓
Validate access
        ↓
Validate security boundaries

Rebuild the Wazuh Environment

First rebuild the failed component using a supported Wazuh version.

Document and match:

  • Wazuh version.
  • Operating system.
  • Component versions.
  • Cluster configuration.
  • Hostnames.
  • Certificates.
  • Network configuration.
  • Authentication architecture.

Do not restore an RBAC configuration from a significantly different Wazuh/Indexer version without first checking compatibility.

Restore the Wazuh Indexer Security Configuration

If the failed server hosted an Indexer node, restore the Indexer security configuration after the base Indexer installation and cluster configuration are ready.

This may include:

internal_users.yml
roles.yml
roles_mapping.yml
action_groups.yml
tenants.yml
config.yml

Only restore the files that were part of your backup and applicable to the target deployment.

Use Wazuh’s documented Indexer security procedures to apply the restored configuration.

Then verify:

  • Indexer cluster health.
  • Internal-user authentication.
  • Roles.
  • Role mappings.
  • Tenant access.
  • Index permissions.

See our The Ultimate Wazuh Indexer Guide for rebuilding or troubleshooting the Indexer layer.

Restore Wazuh Dashboard Settings

Next restore the Dashboard security-related configuration.

This may include:

  • wazuh.yml.
  • SSO configuration.
  • Authentication configuration.
  • Tenant configuration.
  • TLS certificates.
  • Identity-provider settings.

For example, if your deployment uses Wazuh role mappings through the Dashboard, verify the run_as configuration documented by Wazuh.

Restart the Dashboard after applying the appropriate configuration, then test both local and SSO authentication as applicable.

Restore Custom Roles and Mappings

Recreate or restore your custom authorization model.

Verify:

Custom roles
     ↓
Policies
     ↓
Rules
     ↓
Role mappings
     ↓
Users / groups
     ↓
Tenants

Do not stop after confirming that the role names appear.

For every critical role, confirm its actual permissions.

For example:

incident_responder
    ├── Read alerts
    ├── Read agents
    ├── Perform approved response actions
    └── No administrative user-management access

This ensures the restored configuration retains the intended least-privilege model.

Reconnect Authentication Providers

If the deployment uses SSO, restore the relationship between Wazuh and the external identity provider.

Depending on your architecture, this may involve:

  • LDAP.
  • Active Directory.
  • SAML.
  • OIDC.
  • Microsoft Entra ID.
  • Okta.
  • Google Workspace.
  • Keycloak.

Restore the appropriate Wazuh-side configuration and then verify the identity-provider configuration.

Do not assume that restoring Wazuh configuration restores the identity provider itself.

The external IdP remains an independent system.

Related Guides:

Validate Administrator Access

Test an administrator account first.

Confirm that the administrator can:

  • Log in.
  • Access the Dashboard.
  • Access the appropriate security-management interfaces.
  • View Wazuh resources.
  • Manage users.
  • Manage roles.
  • Access Indexer security administration where authorized.
  • Perform required API operations.

If administrator access fails, stop the restoration process and resolve it before testing lower-privileged users.

A common recovery mistake is testing an analyst account first and then discovering that the administrator account cannot make the configuration changes required to correct the problem.

Validate Analyst and Responder Access

After administrator access works, test representative lower-privilege accounts.

For an analyst:

Login → Dashboard → Alerts → Allowed data
                         ↓
                  Unauthorized action
                         ↓
                     DENIED

For an incident responder:

Login → Dashboard → Alerts
                  ↓
            Response actions
                  ↓
           Permitted actions

Test both positive and negative authorization cases.

You want to prove that users can perform the actions they need while remaining unable to perform actions outside their assigned roles.

This is particularly important after restoring a role mapping because a mapping error can accidentally grant excessive privileges.

Confirm Multi-Tenancy Behavior

If your deployment uses multi-tenancy, test each important tenant.

Verify that:

  • Users can access their assigned tenant.
  • Users cannot access unauthorized tenants.
  • Saved objects appear where expected.
  • Index permissions are correct.
  • Analyst groups see the correct security data.
  • Administrators retain the appropriate cross-tenant privileges.

A useful recovery test matrix is:

AccountRoleExpected TenantExpected Result
SOC administratorAdministratorGlobalFull administrative access
SOC analystRead-only/AnalystSOCRead assigned data
Incident responderResponderIncident ResponseResponse permissions
AuditorAuditorAuditRead-only audit access

Finally, document the restoration.

Record:

  • Failure date and time.
  • Backup used.
  • Wazuh version.
  • Indexer version.
  • Components restored.
  • Authentication provider.
  • Roles restored.
  • Role mappings restored.
  • Tenant configuration restored.
  • Validation results.
  • Any configuration changes made during recovery.

This turns a one-time recovery into a documented disaster-recovery procedure that can be repeated during the next Wazuh outage or server failure.


Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *