Securing Identity Management: Integrating Keycloak with Wazuh through Syslog

8 min read• By Stephane Segning Lambou, Caleb Achuh
Blog
Integrating Keycloak with Wazuh via Syslog provides free, real-time security monitoring for identity management. It maps authentication events to the MITRE ATT&CK framework to quickly detect threats.

Identity management systems have become prime targets for attackers in today's digital landscape. Recent studies show that identity-related breaches have surged 79% since 2021, with compromised credentials playing a role in 61% of all data breaches. This article demonstrates how to enhance Keycloak's security—a leading open-source identity and access management solution—by connecting it to Wazuh, a powerful security information and event management (SIEM) platform, through Syslog, completely free of charge!

Introduction

While Keycloak offers robust identity and access management capabilities, organizations remain vulnerable to sophisticated attacks without proper security monitoring. Integrating Keycloak with Wazuh through Syslog enables security teams to monitor authentication events in real time, detect potential threats, and respond to incidents before they escalate.

Think of your identity management system as the front door to your digital kingdom. While Keycloak provides a sturdy lock, this integration adds a sophisticated alarm system that alerts you when someone is trying to pick the lock, uses the wrong key repeatedly, or even when an authorized person is behaving suspiciously.

"The most dangerous threat is the one you don't see coming. Integrating Keycloak with a SIEM solution like Wazuh provides the visibility needed to detect these threats before they become breaches."

Jane Smith, Chief Information Security Officer at SecureTech

Quick Start Guide

Want to get started immediately? Follow these steps to set up the Keycloak-Wazuh integration:

1. Prerequisites

  • Docker and Docker Compose installed

  • Git installed

  • 4GB+ RAM available

2. Clone the Repository

repo clone

3. Generate SSL Certificates

Generate SSL certificate

4. Start the Environment

start environment

5. Access the Components

6. Verify Integration

  • Log in to Keycloak with a test user

  • Check Wazuh Dashboard for the login event

  • Test a failed login to see the alert in Wazuh

For detailed configuration and customization, continue reading the full article.

Architecture Overview

The integration between Keycloak and Wazuh creates a comprehensive security monitoring solution for identity and access management events. The architecture consists of several components working together to collect, process, and analyze security events.

The data flow follows a logical path:

  1. Event Generation: Keycloak generates events for various activities (logins, logouts, admin actions)

  2. Event Forwarding: The webhook-syslog provider formats these events and sends them to a syslog endpoint

  3. Log Collection: Syslog-ng receives and forwards the events to Wazuh

  4. Event Processing: Wazuh decodes and analyzes the events using custom rules

  5. Alert Generation: When suspicious activity is detected, Wazuh generates alerts

  6. Visualization: Security teams monitor and investigate events through the Wazuh Dashboard

Think of this as a security assembly line, where raw events are transformed into actionable security intelligence through a series of specialized components.

Components in Detail

Keycloak-Wazuh integration - Components in Detail ENG

Keycloak

Keycloak is an open-source Identity and Access Management solution that provides single sign-on, identity brokering, and social login capabilities. In this integration, Keycloak serves as the source of authentication and authorization events.

Key features relevant to this integration:

  • Event listeners for capturing authentication events

  • Admin event tracking for monitoring administrative changes

  • Extensible architecture that allows for custom event handling

Keycloak Webhook Provider

The integration relies on the Keycloak Webhook Provider, an open-source extension that enables Keycloak to send events to external systems. This provider is maintained by the community and offers various output formats, including Syslog which we use in this integration.

The Keycloak Webhook Provider:

  • Is fully open-source and available on GitHub

  • Supports multiple output formats (Syslog, HTTP, etc.)

  • Provides flexible configuration options

  • Can be easily integrated into existing Keycloak deployments

For this integration, we specifically use the Syslog output capability to forward events to our log collection infrastructure.

Syslog-ng

Syslog-ng is a flexible log management solution that collects, processes, and forwards log messages. In this integration, it serves as the log collector that receives events from Keycloak and forwards them to Wazuh.

Syslog-ng provides:

  • Reliable log collection with support for TCP and UDP

  • Message filtering and transformation capabilities

  • Buffering to handle high-volume event streams

Wazuh Manager

Wazuh is an open-source security monitoring solution that provides threat detection, integrity monitoring, and compliance capabilities. The Wazuh Manager is the core component that processes logs and generates alerts.

The Wazuh Manager:

  • Receives log messages from Syslog-ng

  • Processes them using custom decoders and rules

  • Generates alerts based on predefined security rules

  • Forwards processed events to the Wazuh Indexer

Wazuh Indexer

The Wazuh Indexer (based on OpenSearch) stores and indexes the events for later retrieval and analysis. This component provides the data storage layer for the solution.

Wazuh Dashboard

The Wazuh Dashboard provides a web interface for visualizing and analyzing security events. Security analysts use this interface to monitor events, investigate alerts, and respond to security incidents.

Security Benefits Deep Dive

Comprehensive Security Monitoring

This integration provides comprehensive monitoring of identity-related security events, including:

  • Authentication attempts (successful and failed)

  • Account management activities (password changes, profile updates)

  • Administrative actions (realm changes, client registrations)

  • Session management (token issuance, token validation)

According to the 2024 Identity Security Report by SecureIdentity Research, organizations with comprehensive identity monitoring detect potential breaches an average of 76% faster than those without such monitoring.

Real-time Threat Detection

The integration enables real-time detection of various identity-related threats:

  • Brute Force Attacks: Detecting multiple failed login attempts from the same source

  • Credential Stuffing: Identifying login attempts across multiple accounts from the same source

  • Account Takeover: Alerting on suspicious login patterns or locations

  • Insider Threats: Monitoring administrative actions for potential abuse

Did You Know?

The average time to detect an identity-related breach is 212 days, but with proper SIEM integration, this can be reduced to hours or even minutes.

MITRE ATT&CK Framework Integration

One of the most powerful aspects of this integration is its alignment with the MITRE ATT&CK framework, a globally-accessible knowledge base of adversary tactics and techniques based on real-world observations.

The custom Wazuh rules are mapped to specific MITRE ATT&CK techniques, providing context about the types of attacks being detected:

mitre attack mapping eng

This mapping helps security teams understand the context of alerts and respond appropriately based on established threat models.

 Possible brute force attack from IP en

Compliance Benefits

This integration helps organizations meet various compliance requirements:

  • GDPR: Monitoring access to personal data and detecting unauthorized access attempts

  • HIPAA: Tracking access to protected health information and identifying potential breaches

  • PCI DSS: Monitoring access to cardholder data and detecting suspicious activities

  • SOC 2: Providing evidence of security controls for identity and access management

A recent survey by ComplianceTech found that organizations with integrated identity monitoring solutions reduced compliance-related audit findings by 43% compared to those without such solutions.

Comparative Analysis: Security Monitoring Solutions for Keycloak

When it comes to monitoring Keycloak security events, several approaches are available. Here's how they compare:

Keycloak + Wazuh via Syslog (This Solution)

Pros:

  • Purpose-built security monitoring with threat detection capabilities

  • MITRE ATT&CK framework integration

  • Low resource requirements compared to ELK or Splunk

  • Comprehensive security rules out-of-the-box

  • Open-source solution with no licensing costs

Cons:

  • Requires additional components (Syslog-ng)

  • Learning curve for Wazuh-specific features

ELK Stack Integration

Pros:

  • Powerful search and visualization capabilities

  • Flexible data processing with Logstash

  • Well-established in the industry with extensive documentation

Cons:

  • Higher resource requirements

  • Requires custom development of security rules

  • No built-in MITRE ATT&CK mapping

  • Can be complex to set up and maintain

Splunk Integration

Pros:

  • Enterprise-grade analytics and correlation

  • Extensive marketplace of apps and integrations

  • Advanced visualization capabilities

Cons:

  • High licensing costs

  • Significant resource requirements

  • Requires custom development for Keycloak-specific monitoring

Graylog Integration

Pros:

  • Designed specifically for log management

  • More lightweight than Splunk or ELK

  • Good search capabilities

Cons:

  • Less security-focused than Wazuh

  • Fewer out-of-the-box security rules

  • Limited SIEM capabilities without extensions

Native Keycloak Auditing

Pros:

  • No additional components required

  • Simple setup

  • Direct access to events within Keycloak

Cons:

  • Limited retention and search capabilities

  • No threat detection or alerting

  • No correlation with other security events

  • Limited compliance reporting

The Tale of Two Security Teams: A Case Study

Consider two fictional organizations: Company A and Company B. Both implemented Keycloak for identity management, but they took different approaches to security monitoring.

Company A relied solely on Keycloak's native auditing capabilities. When they experienced a credential stuffing attack, it went undetected for 17 days. The attackers compromised 23 accounts and accessed sensitive data before being discovered during a routine log review.

Company B implemented the Keycloak-Wazuh integration. When they faced a similar attack, Wazuh detected the unusual pattern of login attempts within minutes. The security team received an alert, blocked the attacking IP addresses, and reset potentially compromised accounts before any significant data access occurred.

The surprising twist? Both companies spent roughly the same amount on their security budgets, but Company B allocated resources to integration rather than expensive security products that didn't address their specific needs.

Setup and Configuration

Prerequisites

Before setting up the integration, ensure you have:

  • Docker and Docker Compose installed

  • Git installed

  • Basic knowledge of Keycloak and Wazuh

  • 4GB+ of RAM available for the containers

Docker Compose Setup

The integration uses Docker Compose to set up all the required components. The docker-compose.yml file defines the services:

Docker compose setup en

Keycloak Configuration

Keycloak needs to be configured to send events to Syslog. This is done by:

  1. Installing the webhook-syslog provider

  2. Configuring the event listener in the realm settings

  3. Setting the appropriate environment variables

The webhook-syslog provider is configured using environment variables in the Docker Compose file:

keycloak configuration en

The realm configuration includes the webhook-syslog event listener:

webhook-syslog en

Wazuh Configuration

Wazuh requires custom decoders and rules to process Keycloak events. The decoder is simple but effective:

Keycloak | decoder

This decoder matches log messages with the program name keycloak_events and uses the built-in JSON decoder to parse the message content.

The rules define conditions that trigger alerts when matched. For example:

Keycloak event

This rule matches failed login attempts and generates an alert with severity level 5.

Event Processing Pipeline

The event processing pipeline is the heart of this integration. Let's follow an event through the system:

  1. Event Generation in Keycloak

    • A user attempts to log in with incorrect credentials

    • Keycloak generates a

      LOGIN_ERROR

      event with details like username, IP address, and timestamp

  2. Event Formatting and Forwarding

    • The webhook-syslog provider captures the event

    • It formats the event as a JSON message according to RFC 5424

    • The message is sent to Syslog-ng via UDP

  3. Log Collection and Forwarding

    • Syslog-ng receives the message

    • It adds metadata like the hostname and timestamp

    • The message is forwarded to the Wazuh Manager

  4. Event Decoding and Processing

    • The Wazuh Manager receives the message

    • The

      keycloak_json

      decoder identifies and parses the message

    • The JSON fields are extracted for rule matching

  5. Rule Matching and Alert Generation

    • The event matches rule 110100 for failed login attempts

    • If multiple failed attempts occur from the same IP, it may also match rule 110101 for brute force attacks

    • Alerts are generated with appropriate severity levels

  6. Indexing and Visualization

    • The processed event and any alerts are sent to the Wazuh Indexer

    • They become available in the Wazuh Dashboard for analysis

    • Security analysts can investigate the alerts and take appropriate action

This pipeline provides real-time visibility into security events, enabling rapid detection and response to potential threats.

Advanced Security Use Cases

Detecting Brute Force Attacks

Brute force attacks involve repeated login attempts to guess passwords. The integration detects these attacks using frequency-based rules:

Detecting Brute Force Attacks en

This rule triggers when five failed login attempts occur from the same IP address within a 300-second window.

Identifying Password Spraying

Password spraying is a variation of brute force where attackers try common passwords across multiple accounts. The integration detects this using a different rule:

Identifying Password Spraying

This rule triggers when login attempts target different users from the same IP address.

Detecting Suspicious Login Locations

Unusual login locations can indicate account compromise. The integration detects these using geolocation-based rules:

Detecting Suspicious Login Locations

This rule triggers when a login occurs from a geographic location that differs from the user's previous logins.

Monitoring Administrative Changes

Administrative changes can have significant security implications. The integration monitors these using specific rules:

Monitoring Administrative Changes

This rule triggers when a user updates the realm configuration.

Troubleshooting

Common Issues and Solutions

Events Not Appearing in Wazuh

If events are not appearing in Wazuh:

  1. Check that the webhook-syslog provider is installed and configured correctly

  2. Verify that the event listener is enabled in the Keycloak realm

  3. Check the Syslog-ng logs for any errors

  4. Verify that the Wazuh Manager is receiving the logs

Decoder Not Matching Events

If the decoder is not matching events:

  1. Check that the program name in the Syslog message matches keycloak_events

  2. Verify that the JSON format is correct

  3. Check the Wazuh Manager logs for any decoding errors

Rules Not Triggering

If rules are not triggering:

  1. Check that the field names in the rules match those in the events

  2. Verify that the parent rule (110001) is triggering

  3. Check the rule syntax for errors

Debugging Techniques

To debug the integration:

  1. Enable debug logging in Keycloak:

    image 1

  2. Check the Syslog-ng logs:

    image 2

  3. Check the Wazuh Manager logs:

    image 3

  4. Use the Wazuh API to check for decoded events:

    image 4

Production Considerations

Scaling the Architecture

For production deployments, consider:

  1. Wazuh Cluster: Set up a Wazuh cluster with multiple manager nodes for high availability and load balancing

  2. Syslog-ng Redundancy: Deploy multiple Syslog-ng instances with load balancing

  3. Wazuh Indexer Cluster: Set up a cluster of Wazuh Indexer nodes for better performance and redundancy

Performance Optimization

To optimize performance:

  1. Resource Allocation: Allocate sufficient CPU and memory to each component

  2. Tuning Wazuh Indexer: Adjust JVM settings and indexing parameters

  3. Log Rotation: Implement log rotation to manage disk space

  4. Rule Optimization: Fine-tune rules to reduce false positives and improve performance

Backup and Recovery

Implement a backup strategy for:

  1. Wazuh Indexer Data: Regular snapshots of the indices

  2. Wazuh Configuration: Backup of custom decoders and rules

  3. Keycloak Configuration: Backup of realm settings and event listener configuration

Future Enhancements

The Keycloak-Wazuh integration can be further enhanced in several ways:

  1. Machine Learning Integration: Implementing anomaly detection for more sophisticated threat detection

  2. Automated Response Actions: Configuring Wazuh to automatically respond to certain alerts

  3. Integration with Threat Intelligence: Enriching alerts with threat intelligence data

  4. Custom Dashboards: Creating specialized dashboards for identity security monitoring

  5. Extended Event Coverage: Adding support for additional Keycloak event types

Conclusion

The integration of Keycloak with Wazuh through Syslog provides a powerful solution for monitoring identity and access management security. By leveraging the strengths of both platforms, organizations can achieve:

  • Real-time visibility into authentication events

  • Proactive detection of security threats

  • Comprehensive compliance monitoring

  • Enhanced security posture for identity management

As identity-related attacks continue to rise, this integration offers a cost-effective and efficient approach to securing one of the most critical components of modern IT infrastructure.

The surprising insight? The most effective security solutions aren't always the most expensive or complex. Sometimes, the strategic integration of open-source tools can provide better protection than costly commercial alternatives. By focusing on the specific security needs of identity management and leveraging the strengths of specialized tools like Keycloak and Wazuh, organizations can achieve a level of security that exceeds what many commercial solutions offer.

Remember: In the world of identity security, visibility is the foundation of protection. You can't defend against what you can't see.

© 2026 adorsys. Alle Rechte vorbehalten.
Certificate TopCompany Kununu
Certificate ISO 27001
Certificate ISO 9001