Wazuh Server API Authentication
Basic Authentication
The Dashboard connects to the Wazuh Server API using configured credentials. These credentials are defined in theopensearch_dashboards.yml file under the wazuh_core.hosts section.
Configuration Structure
Multiple API Hosts
You can configure multiple Wazuh Server API hosts to connect to different environments or clusters:API Host Configuration Parameters
URL
Parameter:url
Type: String
Default: https://localhost
Description: The Wazuh Server API URL. Must be a valid URL starting with http:// or https://.
Validation: Non-empty string
Port
Parameter:port
Type: Number
Default: 55000
Range: 1-65535
Description: The port number where the Wazuh Server API is listening.
Validation: Integer between 1 and 65535
Username
Parameter:username
Type: String
Default: wazuh-wui
Description: The username for authenticating to the Wazuh Server API.
Validation:
- Non-empty string
- Minimum 4 characters
- Maximum 64 characters
Password
Parameter:password
Type: String (sensitive)
Default: wazuh-wui
Description: The password for the specified username.
Validation:
- Non-empty string
- Maximum 64 characters
opensearch_dashboards.yml to protect password values.
Run As Mode
Parameter:run_as
Type: Boolean
Default: true
Description: Enables the authentication context feature, allowing the Dashboard to execute API requests using the logged-in user’s credentials rather than the configured API user.
Values:
true: Enable run_as mode (RBAC enabled)false: Disable run_as mode
Run As Authentication Mode
Overview
Therun_as parameter controls how the Dashboard authenticates with the Wazuh Server API. This feature implements Role-Based Access Control (RBAC) by executing API requests in the context of the logged-in Dashboard user.
How Run As Works
When run_as is Enabled (true)
- User authenticates to the Dashboard through OpenSearch Security
- Dashboard receives the user’s credentials from the authentication context
- Dashboard makes API requests to Wazuh Server using the logged-in user’s credentials
- Wazuh Server enforces permissions based on the user’s role assignments
- Users see only the data they have permission to access
When run_as is Disabled (false)
- User authenticates to the Dashboard through OpenSearch Security
- Dashboard makes all API requests using the configured API credentials (
wazuh-wui) - All users share the same API access level
- User-level RBAC is not enforced at the Wazuh Server level
Requirements for Run As Mode
Server API Configuration: The Wazuh Server API must haveallow_run_as enabled in its configuration:
- When
run_asis enabled, the Dashboard username must bewazuh-wui - Users logging into the Dashboard must exist in both OpenSearch Security and Wazuh Server
- User roles must be properly configured in Wazuh Server to define access permissions
Run As Status Codes
The Dashboard health check system verifies run_as configuration and reports one of the following statuses:| Status Code | Description |
|---|---|
| Enabled | Run as allowed for user and host |
| Host Disabled | Run as disabled in the Wazuh Server configuration |
| All Disabled | Run as disabled in both host and user configuration |
| User Not Allowed | Run as not permitted for the configured user |
| Unable to Check | Cannot verify run_as permission status |
Checking Run As Status
The Dashboard automatically checks the run_as status during initialization. Review the Dashboard logs or health check results to verify the configuration:OpenSearch Security Integration
The Dashboard integrates with OpenSearch Security for user authentication and session management.Security Plugin Configuration
Request Headers
For proper authentication context propagation, configure the request headers allowlist: OpenSearch Dashboards 2.0+:Authentication Workflow
User Login Process
- User accesses the Dashboard URL
- OpenSearch Security intercepts the request
- User is redirected to the login page (or IdP if SSO is configured)
- User provides credentials
- OpenSearch Security validates credentials
- Session is created and user is granted access to the Dashboard
- Dashboard retrieves user context for API requests
API Request Authentication
- User action triggers an API request in the Dashboard
- Dashboard determines authentication method:
- If
run_as: true→ Use logged-in user’s credentials - If
run_as: false→ Use configured API credentials
- If
- Dashboard sends request to Wazuh Server API with appropriate credentials
- Wazuh Server validates credentials and checks permissions
- Response is returned and displayed to the user
Security Best Practices
Credential Management
- Use Strong Passwords: Configure complex passwords for API users
- Rotate Credentials: Periodically update API passwords
- Secure Configuration Files: Set restrictive permissions on
opensearch_dashboards.yml
- Use HTTPS: Always configure SSL/TLS for API connections
- Enable Run As: Use
run_as: truefor production environments to enforce proper RBAC
User Management
- Create users with minimum required permissions
- Define roles that align with organizational responsibilities
- Regularly audit user access and permissions
- Remove or disable accounts for departed users
- Monitor authentication logs for suspicious activity
Troubleshooting Authentication Issues
Connection Failures
Symptom: Cannot connect to Wazuh Server API Solutions:- Verify the API URL and port are correct
- Check that the Wazuh Server API service is running
- Confirm network connectivity between Dashboard and Server
- Validate SSL/TLS certificates if using HTTPS
- Review firewall rules
Authentication Failures
Symptom: API requests fail with 401 Unauthorized Solutions:- Verify username and password are correct
- Check that the user exists in Wazuh Server
- Confirm the user has required permissions
- Review Wazuh Server API logs for details
Run As Issues
Symptom: Run as not working or permission errors Solutions:- Verify
allow_run_asis enabled in Wazuh Server configuration - Confirm the Dashboard username is
wazuh-wuiwhen run_as is enabled - Check that logged-in users exist in Wazuh Server
- Verify user role assignments in Wazuh Server
- Review health check output for run_as status
Version Compatibility
Symptom: API version mismatch errors Solutions:- Ensure Dashboard and Wazuh Server versions are compatible
- Major and minor version numbers should match
- Update components to matching versions if needed
- Review compatibility matrix in documentation