Skip to main content

Integrate with Wazuh

Support level: Community

What is Wazuh?

Wazuh is an open source security platform that provides unified threat detection and response for endpoints and cloud workloads.

-- https://wazuh.com/

Preparation

The following placeholders are used in this guide:

  • wazuh-dashboard.company is the FQDN of the Wazuh Dashboard installation.
  • wazuh-indexer.company is the FQDN of the Wazuh Indexer installation.
  • authentik.company is the FQDN of the authentik installation.
info

This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application.

authentik configuration

To support the integration of Wazuh with authentik, you need to create a group, a property mapping, and an application/provider pair in authentik.

Create a user group in authentik

  1. Log in to authentik as an administrator and open the authentik Admin interface.
  2. Navigate to Directory > Groups and click Create.
  3. Set a name for the group, such as wazuh-administrators, and click Create.
  4. Click the name of the newly created group and navigate to the Users tab.
  5. Click Add existing user, select the users that need Wazuh administrator access, and click Add.

Create a property mapping

  1. Log in to authentik as an administrator and open the authentik Admin interface.

  2. Navigate to Customization > Property Mappings and click Create.

  3. Create a SAML Provider Property Mapping with the following settings:

    • Name: choose a descriptive name, such as Wazuh roles.
    • SAML Attribute Name: Roles.
    • Expression: change wazuh-administrators to the authentik group name that should receive administrator access in Wazuh.
    if ak_is_group_member(request.user, name="wazuh-administrators"):
    yield "wazuh-admin"

    The yielded value, wazuh-admin, is the backend role that Wazuh evaluates later. To map additional Wazuh roles, add more group checks that yield different backend role values.

  4. Click Finish.

Create an application and provider

SAML provider changes in authentik 2026.5

authentik 2026.5 introduces changes to how the SAML provider behaves. Specifically, the provider now automatically sets the Issuer value to: https://authentik.company/application/saml/<application_slug>/metadata/

Older versions of authentik set this value to authentik by default. If you're running an older version, please set Issuer to https://authentik.company/application/saml/<application_slug>/metadata/, where <application_slug> is the slug that you selected for the application.

  1. Log in to authentik as an administrator and open the authentik Admin interface.
  2. Navigate to Applications > Applications and click New Application to open the application wizard.
    • Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings. Note the Slug value because it will be required later.
    • Choose a Provider type: select SAML Provider as the provider type.
    • Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations.
      • Set the ACS URL to https://wazuh-dashboard.company/_opendistro/_security/saml/acs.
      • Set the Audience to wazuh-saml.
      • Under Advanced protocol settings:
        • Select a Signing Certificate. If you do not already have one, create it under System > Certificates before configuring the provider.
        • Set NameID Property Mapping to the property mapping that Wazuh should use for usernames, such as authentik default SAML Mapping: Name or authentik default SAML Mapping: Email.
        • Add the Wazuh roles property mapping that you created earlier.
    • Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's Application Dashboard page.
  3. Click Submit to save the new application and provider.

Download the provider metadata

  1. Navigate to Applications > Providers and open the SAML provider that you created in the previous section.
  2. Open the Metadata tab.
  3. Under SAML Metadata, click Download. Save the file as wazuh_authentik_meta.xml; this metadata file is required in the next section.

Wazuh configuration

To support the integration of authentik with Wazuh, you need to configure SAML authentication on the Wazuh Indexer server and create role mappings on the Wazuh Dashboard server.

Configure SAML on the Wazuh Indexer server

Back up the Wazuh Indexer security configuration before changing it.

  1. Generate a 64-character exchange key:

    openssl rand -hex 32

    The output is the exchange_key value that you will use in /etc/wazuh-indexer/opensearch-security/config.yml.

  2. Copy the downloaded wazuh_authentik_meta.xml file to the /etc/wazuh-indexer/opensearch-security/ directory on your Wazuh Indexer server.

  3. Change ownership of the metadata file:

    sudo chown wazuh-indexer:wazuh-indexer /etc/wazuh-indexer/opensearch-security/wazuh_authentik_meta.xml
  4. Edit /etc/wazuh-indexer/opensearch-security/config.yml. Set order to 0 and challenge to false in the existing basic_internal_auth_domain section, then add a saml_auth_domain section under authc:

    /etc/wazuh-indexer/opensearch-security/config.yml
    ---
    authc:
    basic_internal_auth_domain:
    description: "Authenticate via HTTP Basic against internal users database"
    http_enabled: true
    transport_enabled: true
    order: 0
    http_authenticator:
    type: "basic"
    challenge: false
    authentication_backend:
    type: "intern"
    saml_auth_domain:
    http_enabled: true
    transport_enabled: false
    order: 1
    http_authenticator:
    type: saml
    challenge: true
    config:
    idp:
    metadata_file: "/etc/wazuh-indexer/opensearch-security/wazuh_authentik_meta.xml"
    entity_id: "https://authentik.company/application/saml/<application_slug>/metadata/"
    sp:
    entity_id: "wazuh-saml"
    kibana_url: "https://wazuh-dashboard.company/"
    roles_key: Roles
    exchange_key: "<exchange key generated in step 1>"
    authentication_backend:
    type: noop
  5. Run the securityadmin.sh script to load the configuration changes. Update the -h value to your Wazuh Indexer FQDN:

    sudo env JAVA_HOME=/usr/share/wazuh-indexer/jdk/ bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh -f /etc/wazuh-indexer/opensearch-security/config.yml -icl -key /etc/wazuh-indexer/certs/admin-key.pem -cert /etc/wazuh-indexer/certs/admin.pem -cacert /etc/wazuh-indexer/certs/root-ca.pem -h wazuh-indexer.company -nhnv
  6. Edit /etc/wazuh-indexer/opensearch-security/roles_mapping.yml and include wazuh-admin as a backend_role in the appropriate section. The following example maps wazuh-admin to the all_access role:

    /etc/wazuh-indexer/opensearch-security/roles_mapping.yml
    all_access:
    reserved: true
    hidden: false
    backend_roles:
    - "wazuh-admin"
    - "admin"
    hosts: []
    users: []
    and_backend_roles: []
    description: "Maps admin to all_access"
  7. Run the securityadmin.sh script again, with the -f value set to /etc/wazuh-indexer/opensearch-security/roles_mapping.yml. Update the -h value to your Wazuh Indexer FQDN:

    sudo env JAVA_HOME=/usr/share/wazuh-indexer/jdk/ bash /usr/share/wazuh-indexer/plugins/opensearch-security/tools/securityadmin.sh -f /etc/wazuh-indexer/opensearch-security/roles_mapping.yml -icl -key /etc/wazuh-indexer/certs/admin-key.pem -cert /etc/wazuh-indexer/certs/admin.pem -cacert /etc/wazuh-indexer/certs/root-ca.pem -h wazuh-indexer.company -nhnv

Configure the Wazuh Dashboard server

  1. On the Wazuh Dashboard server, check the value of run_as in the /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml configuration file:

    /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
    hosts:
    - default:
    url: https://127.0.0.1
    port: 55000
    username: wazuh-wui
    password: "<WAZUH_WUI_PASSWORD>"
    run_as: false

    When run_as is set to true, Wazuh uses authorization context information to assign roles to users.

    If run_as is set to false, proceed to step 4. If run_as is set to true, proceed with the following steps to add a role mapping on the Wazuh dashboard.

  2. On the Wazuh dashboard, click the upper-left menu icon ☰ to open the menu, then go to Server management > Security > Roles mapping.

  3. Click Create Role mapping and configure the following parameters:

    • Role Name: set a name for the role mapping, such as authentik_admins.
    • Roles: select a role, such as administrator.
    • Custom rules: click Add new rule and set:
      • User field: backend_roles
      • Search operation: FIND
      • Value: wazuh-admin

    Click Save role mapping.

  4. On the Wazuh Dashboard server, add the SAML settings to /etc/wazuh-dashboard/opensearch_dashboards.yml. If opensearch_security.session.keepalive already exists in your configuration, change it to false.

    /etc/wazuh-dashboard/opensearch_dashboards.yml
    opensearch_security.auth.type: "saml"
    server.xsrf.allowlist:
    [
    "/_opendistro/_security/saml/acs",
    "/_opendistro/_security/saml/logout",
    "/_opendistro/_security/saml/acs/idpinitiated",
    ]
    opensearch_security.session.keepalive: false

    Use this configuration block instead if you want to keep both username/password authentication and SAML SSO enabled:

    /etc/wazuh-dashboard/opensearch_dashboards.yml
    opensearch_security.auth.type: ["basicauth", "saml"]
    opensearch_security.auth.multiple_auth_enabled: true
    server.xsrf.allowlist:
    [
    "/_opendistro/_security/saml/acs",
    "/_opendistro/_security/saml/logout",
    "/_opendistro/_security/saml/acs/idpinitiated",
    ]
    opensearch_security.session.keepalive: false
  5. Restart the Wazuh dashboard service using the following command:

    sudo systemctl restart wazuh-dashboard

Configuration verification

To confirm that authentik is properly configured with Wazuh, open Wazuh and log in using an account that is a member of the appropriate authentik group, such as wazuh-administrators.

Resources