<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title><![CDATA[Anand Vyas - Elastic Security Labs]]></title>
    <description><![CDATA[Trusted security news & research from the team at Elastic.]]></description>
    <copyright><![CDATA[© 2026. Elasticsearch B.V. All Rights Reserved]]></copyright>
    <image>
      <title><![CDATA[Anand Vyas - Elastic Security Labs]]></title>
      <url>https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte2c6b841aff36df4/6a88d9784acc96e3f324863d/security-labs-thumbnail.png</url>
      <link>https://www.elastic.co/security-labs/author/anand-vyas</link>
    </image>
    <link>https://www.elastic.co/security-labs/author/anand-vyas</link>
    <atom:link href="https://www.elastic.co/security-labs/rss/author/anand-vyas.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[en]]></language>
    <lastBuildDate>Thu, 19 Nov 2026 17:07:14 GMT</lastBuildDate>
  <item>
    <title><![CDATA[From posture to root cause: Investigate OpenShift compliance with Elastic Agent Builder]]></title>
    <description><![CDATA[When an OpenShift compliance control fails, Elastic Agent Builder traces the root cause, from Compliance Operator scans centralized in Elasticsearch and CEL checks for the rules the scanner marks manual.]]></description>
    <content:encoded><![CDATA[<p>A single<a href="https://www.elastic.co/elastic-agent"> Elastic Agent</a> on each cluster polls <a href="https://docs.redhat.com/en/documentation/openshift_container_platform/latest/html/security_and_compliance/compliance-operator">OpenShift Compliance Operator</a> APIs every 60 seconds. An<a href="https://www.elastic.co/elasticsearch/agent-builder"> Elastic Agent Builder</a> agent on top of that data can tell you what change failed the compliance control. Every scan and check result lands in Elasticsearch, as do the remediations, so the agent answers questions (like, <em>Which clusters failed checks this week?</em> <em>Why did a control start failing, and when?</em>) in plain English.  The rules that the scanner marks as manual get evaluated with Common Expression Language (CEL) custom rules, and a scheduled<a href="https://www.elastic.co/elasticsearch/workflows"> workflow in Elastic Workflows</a> annotates the result back to the manual rule in the cluster. Rescans and remediation patches run through those same workflows and pause for your approval. Everything in this post is on <a href="https://github.com/elastic/elastic-labs/tree/main/supporting-blog-content/security-labs/openshift-compliance-agent">GitHub</a>, including the integration package and workflows, along with the manifests.</p><p>The Compliance Operator scans each<a href="https://www.redhat.com/en/technologies/cloud-computing/openshift"> OpenShift</a> cluster against configured profiles covering the CIS Benchmarks, National Institute of Standards and Technology (NIST) 800-53 moderate (the basis for<a href="https://www.fedramp.gov/"> Federal Risk and Authorization Management Program [FedRAMP]</a> authorization), the<a href="https://www.cyber.gov.au/essential-eight"> Australian Essential Eight</a> and more, and then stores the results on that cluster. For one cluster, that’s fine, but across a fleet, nobody has a single view. A rule that passed last week starts failing after a deployment, and a scheduled scan silently fails to trigger. But the only way to find out is to log in and run <code>oc get compliancecheckresult</code> cluster by cluster.</p><h2>Why OpenShift compliance is hard to track across a fleet</h2><h3>Scan results stored on each cluster</h3><p>The Compliance Operator runs scans on each OpenShift cluster and stores the results locally. This approach works across a few clusters, but as the fleet grows, it becomes difficult for OpenShift administrators to maintain visibility across each cluster.</p><p>A compliance rule that had previously passed might start to fail after a new workload deployment or a cluster upgrade. Similarly, a scheduled scan can fail to trigger, due to unresolved dependencies. Without a central view of compliance scan status and results, these failures go unnoticed until an OpenShift administrator logs in to the cluster and manually checks, using commands such as <code>oc get compliancecheckresult</code> and <code>oc get compliancescan</code>.</p><p>In this blog post, we explore how this challenge can be addressed by ingesting OpenShift compliance data into Elasticsearch, giving platform and security teams a unified way to track compliance posture and investigate drift across the fleet.</p><h3>Manual compliance rules tracked outside the cluster</h3><p>Not all compliance rules are automated, so they need a manual assessment. Platform teams usually track these rules and their status in shared spreadsheets or Confluence pages. Those trackers sit apart from the scan results, and someone has to update and reconcile them with each cluster’s findings.</p><p>Organizational controls add another layer. A team may exclude certain controls from specific clusters because of internal requirements or operational needs. Without a central record, it’s hard to determine which controls apply to which cluster and why an exception exists, and that’s exactly what an auditor will ask.</p><h3>Compliance reporting spread across clusters</h3><p>With scan results spread across clusters, security teams have to find their own way to aggregate the data before they can build a report. Auditors can ask for reports at regular intervals, so this aggregation repeats every cycle. Each report draws on scan output and manual rule status, along with documented exceptions that live in different places. Pulling all of that together can leave gaps.</p><h2>Centralizing OpenShift compliance data in Elasticsearch</h2><p><a href="https://www.elastic.co/docs/explore-analyze/ai-features/elastic-agent-builder">Elastic Agent Builder</a> lets you build interactive AI agents on top of your compliance data. Teams can query compliance posture across their entire fleet in plain English, investigate why specific controls failed, and safely trigger remediations with human-in-the-loop approvals, rather than combing through endless scan JSON or switching between cluster consoles.</p><p>A custom <a href="https://www.elastic.co/docs/extend/integrations/what-is-an-integration">Elastic integration</a> collects compliance scan data from each cluster and sends it to Elasticsearch. It uses the HTTP JSON input to query the OpenShift Compliance Operator APIs and retrieve scan results, in addition to ingesting them into Elasticsearch. During ingestion, compliance data is parsed and normalized, making it easier to search, build dashboards, set up alerts, and generate compliance reports.</p><p>With the data centralized, the next step is to make it easy for platform and security teams to work with it. Together, the integration and the agent turn compliance data into something that teams can interact with directly instead of static dashboards. The agent helps the team to find the information it needs and decide what to investigate next.</p><p>The following diagram illustrates the high-level architecture of the entire workflow discussed in this solution:</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt79491276c787f5f8/6afd8c33e2faff360091428c/image5.png" alt="OpenShift compliance architecture: Compliance Operator APIs to Elasticsearch, Elastic Agent Builder, and chat" /><p>Note: The proof of concept (PoC) in this solution has been tested with OpenShift Local version 4.22, Compliance Operator 1.10.0, and Elastic Serverless. On Elastic Stack deployments (self-managed or Elastic Cloud Hosted [ECH]), both Agent Builder and Workflows require version 9.5 or later and an <a href="https://www.elastic.co/subscriptions">Enterprise subscription</a>. On Elastic Cloud Serverless, these capabilities are available on supported project feature tiers (such as Serverless Security Complete).</p><p>Elastic also offers a <a href="https://www.elastic.co/cloud/cloud-trial-overview">free, 14-day Elastic Cloud trial</a> to help you get started. </p><h2>How to ingest OpenShift compliance data into Elasticsearch</h2><p>We deploy Elastic Agent directly on each OpenShift cluster using a single integration policy. Every 60 seconds, the agent queries the Compliance Operator API endpoints via HTTP JSON and ships the raw scan records into Elasticsearch data streams across your entire fleet.</p><p>The integration reads three Compliance Operator resources:</p><p><strong>Resource / API</strong></p><p><strong>What it provides</strong></p><p>compliancescans.compliance.openshift.io</p><p>The scans configured in the cluster, including scan name, phase, and result.</p><p>compliancecheckresults.compliance.openshift.io</p><p>Individual check details, including rule name, status, and severity.</p><p>complianceremediations.compliance.openshift.io</p><p>Available remediations for checks, including their current state.</p><p>Because the HTTP JSON integration appends time-series documents to a data stream on every polling cycle, three <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html">Elasticsearch transforms</a> (<code>scans</code>, <code>checks</code>, and <code>remedy</code>) continuously collapse each stream into dedicated latest-state indices (<code>ospm-compliance_-latest</code>). The <code>checks</code> transform deduplicates events by cluster and check resource name (<code>metadata.name</code>). This ensures that checks evaluated across different node roles (such as master and worker) are preserved without creating duplicate records across repeated scan cycles. </p><p>The agent queries these latest-state indices for current posture and uses the raw time-series data streams for historical investigations.</p><p>The following diagram illustrates the compliance scan data ingestion workflow from multiple OpenShift clusters into Elastic:</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt931abe75ecf7324a/6afd8cc7a5a8756640b0f79e/image3.png" alt="Four OpenShift clusters running Elastic Agent polling Compliance Operator APIs into centralized Elasticsearch" /><p>Note: This is a custom-built integration and isn’t officially supported by Elastic Support.</p><h3>Deploy the OpenShift compliance integration in Kibana</h3><p>The custom integration is a zip file package that has all the required components. To deploy the package, you can upload the package directly using Kibana UI.</p><p>The integration follows the standard Elastic package specification and bundles all the required Kibana and Elasticsearch assets into a single archive. When uploaded through the Kibana UI, the package registers three data streams with dedicated ingest pipelines, configures prebuilt dashboards, sets up latest-state index views, and installs the continuous Elasticsearch transforms that maintain current compliance posture:</p>OpenShift Security Posture Management
 │
 ├── 1. Dashboards (kibana/dashboard/)
 │   ├── [OpenShift Compliance] Posture Overview
 │   ├── [OpenShift Compliance] Overall Results
 │   └── [OpenShift Compliance] Auto Remediations
 │
 ├── 2. Data Views / Index Patterns (kibana/index_pattern/)
 │   ├── ospm-compliance-*-latest
 │   └── logs-openshift_security_posture_management.compliance*
 │
 ├── 3. Data Streams (data_stream/)
 │   ├── compliance_check_results (with Ingest Pipeline)
 │   ├── compliance_scans (with Ingest Pipeline)
 │   └── compliance_remediations (with Ingest Pipeline)
 │
 └── 4. Elasticsearch Transforms (elasticsearch/transform/)
├── checks
├── remedy
└── scans<p>Download the integration from the GitHub <a href="https://github.com/elastic/elastic-labs/tree/main/supporting-blog-content/security-labs/openshift-compliance-agent/elastic/integration">repository</a>.</p><p>The video below walks through deploying and configuring the custom OpenShift Security Posture Management (OSPM) integration package in Kibana Fleet. It covers setting the three compliance endpoints for scans, check results, and remediations, setting the 60-second polling interval, and mapping the <code>orchestrator.cluster.name</code> field from the agent's environment variables.</p><h3>Configure the Compliance Operator API endpoints and polling interval</h3><p>The integration has three data collection endpoints that cover compliance scans, check results, and remediations. Each endpoint builds the OpenShift API URL from environment variables that Kubernetes sets in the pod, so the same configuration works on every cluster.</p><p>For compliance check results, the URL looks like this:</p>https://${env.KUBERNETES_SERVICE_HOST}:${env.KUBERNETES_SERVICE_PORT_HTTPS}/apis/compliance.openshift.io/v1alpha1/compliancecheckresults<p>The integration polls each endpoint every 60 seconds by default. You can change the interval to match how fresh you need the data to be.</p><p>When the configuration is complete, create an Elastic Agent policy with these settings and deploy it on your OpenShift cluster to start collecting compliance data.</p><h3>Deploy Elastic Agent on each OpenShift cluster</h3><p>To deploy the agent and the integration:</p><ol><li><p>In Kibana, create or update an Elastic Agent policy and add the OSPM integration to it. Confirm that the API endpoints and polling interval match your environment.</p></li><li><p>The integration automatically enriches each event with <code>orchestrator.cluster.name</code> using the <code>CLUSTER_NAME</code> environment variable configured on the agent.</p></li><li><p>Generate an enrollment token to be passed along with the Fleet URL endpoint.</p></li><li><p>Replace the token and Fleet URL in the following reference YAML, and deploy the Elastic Agent on the cluster.</p></li><li><p>In Fleet, check that the agent is healthy.</p></li><li><p>Once healthy, add the OSPM integration policy to the agent to start polling data.</p></li><li><p>In Kibana, open the integration’s data streams. Confirm that documents are arriving and that each one carries the expected cluster name in <code>orchestrator.cluster.name</code>.</p></li><li><p>Repeat these steps for every OpenShift cluster that you want to monitor, and set the matching cluster name for each environment.</p></li></ol><p>To collect OpenShift compliance data, deploy Elastic Agent as a single-replica deployment on each OpenShift cluster. The manifest below runs the agent with Fleet enrollment enabled and mounts a persistent volume to preserve agent state across pod restarts. It also injects the <code>CLUSTER_NAME</code> environment variable. The integration uses this variable to tag every ingested event with <code>orchestrator.cluster.name</code>, ensuring that multi-cluster scan results remain separated in Elasticsearch.</p>---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: elastic-agent
  namespace: elastic-agent-ocp
  labels:
    app.kubernetes.io/name: elastic-agent
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: elastic-agent
  template:
    metadata:
      labels:
        app.kubernetes.io/name: elastic-agent
    spec:
      serviceAccountName: elastic-agent
      containers:
        - name: elastic-agent
          image: docker.elastic.co/elastic-agent/elastic-agent:9.5.5
          env:
            - name: CLUSTER_NAME
              value: "&lt;Replace-cluster-name&gt;" #replace this with your actual cluster name
            # Set to 1 for enrollment into Fleet server. If not set, Elastic Agent runs standalone.
            - name: FLEET_ENROLL
              value: "1"
            # Set to true to communicate with Fleet with either insecure HTTP or unverified HTTPS.
            - name: FLEET_INSECURE
              value: "false"
            # Fleet Server URL to enroll the Elastic Agent into.
            # Found in Kibana: Management &gt; Fleet &gt; Settings.
            - name: FLEET_URL
              value: "&lt;Replace-fleet-url&gt;"
            # Enrollment token used to enroll the Elastic Agent in Fleet.
            - name: FLEET_ENROLLMENT_TOKEN
              value: "&lt;replace-token&gt;"
          resources:
            limits:
              memory: 500Mi
            requests:
              cpu: 100m
              memory: 200Mi
          volumeMounts:
            # Persist Elastic Agent state across pod restarts within the pod's lifetime.
            - name: elastic-agent-state
              mountPath: /usr/share/elastic-agent/state
      volumes:
        - name: elastic-agent-state
          persistentVolumeClaim:
            claimName: agent-state<p>Note: The above manifest is to deploy a single replica <code>elastic agent</code> pod to scan and ingest compliance data. For OpenShift cluster logs and metrics, use the Elastic <a href="https://docs.elastic.co/integrations/kubernetes">Kubernetes</a> integration separately.</p><p>Complete Kubernetes manifests and role-based access control (RBAC) are available in the GitHub <a href="https://github.com/elastic/elastic-labs/tree/main/supporting-blog-content/security-labs/openshift-compliance-agent/openshift">repository</a>.</p><h2>How to automate manual OpenShift compliance rules with CEL</h2><p>Starting with <a href="https://docs.redhat.com/en/documentation/openshift_container_platform/4.22/html/security_and_compliance/compliance-operator#compliance-operator-release-notes-1-10-0_compliance-operator-release-notes-v0">Red Hat OpenShift Compliance Operator version 1.10.0</a>, CEL-based custom rules are generally available (GA). Using this feature, create a <code>CustomRule</code> object for rules tagged as <code>Manual</code>.</p><p>For example, the compliance rule <code>accounts-restrict-service-account-tokens</code> is common across the profiles <code>ocp4-cis</code> and <code>ocp4-high</code>. Using a CEL expression, check whether any pods have the property <code>spec.automountServiceAccountToken</code> set to <code>true</code>:</p>apiVersion: compliance.openshift.io/v1alpha1
kind: CustomRule
metadata:
  name: custom-accounts-restrict-service-account-tokens
  namespace: openshift-compliance
spec:
  id: xccdf_org.ssgproject.content_rule_accounts_restrict_service_account_tokens
  title: "Service account tokens should not be automounted unless required"
  severity: medium
  checkType: Platform
  scannerType: CEL
  expression: |
    pods.items.all(p,
      !has(p.spec.automountServiceAccountToken) ||
      p.spec.automountServiceAccountToken == false
    )
  failureReason: "A pod has automountServiceAccountToken set to true"
  inputs:
    - name: pods
      kubernetesInputSpec:
        apiVersion: v1
        resource: pods<p>Note: In the custom rule above, <code>spec.id</code> is mapped the same as in the original rule with status of <code>Manual</code>.</p><p>Custom rules cannot be evaluated directly on their own; they must be enabled through a <a href="https://docs.redhat.com/en/documentation/openshift_container_platform/4.22/html/security_and_compliance/compliance-operator#tailored-profile-object_compliance-crd"><code>TailoredProfile</code></a> object. To execute the checks, bind this <code>TailoredProfile</code> to a <code>ScanSetting</code> using a <code>ScanSettingBinding</code>.</p><p>For example, create a <code>TailoredProfile</code> named <code>custom-ocp4-manual-rules</code> for the custom CEL rule <code>custom-accounts-restrict-service-account-tokens</code>:</p>apiVersion: compliance.openshift.io/v1alpha1
kind: TailoredProfile
metadata:
  name: custom-ocp4-manual-rules
  namespace: openshift-compliance
spec:
  title: "Custom CEL automation for shared manual rules (cis/e8/high)"
  description: "Each rule is evaluated once; rationale documents which native profiles it should be patched back to."
  enableRules:
    - name: custom-accounts-restrict-service-account-tokens
      kind: CustomRule
      rationale: "applies-to: cis,high"<p>Using a similar pattern, CEL checks for all the rules tagged as <code>MANUAL</code> can be evaluated.</p><p>Note: CEL-based evaluation only supports <code>platform</code> type rules.</p><p>In the <a href="https://www.elastic.co/security-labs/blog/openshift-compliance-elastic-agent-builder#elastic-workflows-for-live-openShift-cluster-actions">Elastic Workflows for live OpenShift cluster actions</a> section, we define a workflow that reads scan data from these custom rules ingested into Elasticsearch and uses it to annotate <code>MANUAL rules</code> on the OpenShift Container Platform (OCP) cluster based on their <code>custom scan status</code>. Because the OpenShift Compliance Operator automatically propagates custom annotations from <code>Rule</code> custom resources (CRs) to their corresponding <code>ComplianceCheckResult</code> objects during scan runs, these evaluated statuses are automatically ingested into Elasticsearch on the subsequent scan cycle.</p><p>The following diagram illustrates the sequence for evaluating MANUAL compliance rules using a CEL-based check and annotating the result to the actual rule:</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltc5da79691177af45/6afd8e5fe2a1787f1d0743e1/image1.png" alt="Sequence diagram: CEL CustomRule scan in OpenShift, result ingested to Elasticsearch, workflow annotates rule" /><h2>Build the OpenShift compliance agent in Agent Builder</h2><p>Agent Builder lets you build purpose-driven AI agents connected to your Elasticsearch data. It provides four core building blocks (instructions, skills, tools, and connectors) that govern how the agent reasons and queries data, along with how it interacts with external platforms.</p><p>In this post, we build a custom OpenShift compliance agent, which reviews compliance scan data and identifies noncompliant clusters. It also evaluates failed compliance rules. Using tools, it can also trigger compliance scans and apply auto-remediation patches. Plus, it can generate operational reports.</p><p>The goal of this compliance agent is to let platform and security teams query compliance data in natural language, without writing custom queries or manually correlating results across clusters.</p><p>The following diagram illustrates the anatomy of the OpenShift compliance agent:</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6eadce292b815b43/6afd8e82b16cac6c21f6d312/image2.png" alt="Anatomy of the OpenShift compliance agent in Elastic Agent Builder: instructions, skills, tools, data sources" /><h3>Set the compliance agent’s instructions and guardrails</h3><p>Configuring an agent in Agent Builder starts with custom instructions, which become part of the system prompt. They set the persona and reasoning habits for everything the agent does, in addition to the guardrails. For an OpenShift compliance agent, the most important decision is what level of actions the agent is allowed to perform. This agent uses a strictly precautionary role. It reviews and queries ingested compliance data and can apply remediation patches or trigger scans on the cluster with user approval. It treats the data in Elasticsearch as the source of truth and asks for any unstated detail, such as the cluster name or scan identifier, rather than assuming defaults.</p><p>The instructions are structured in Markdown across six focused sections (goal, steps, guardrails, domain context, output conventions, and edge cases):</p><p><strong>Section</strong></p><p><strong>What it covers</strong></p><p>Goal</p><p>The agent only handles OpenShift compliance; the ingested Elasticsearch data is the source of truth.</p><p>Steps</p><p>Confirm scope, retrieve data with the provided tools, verify the results, summarize, and then ask before acting.</p><p>Guardrails</p><p>No change without explicit approval; only the provided tools; no invented IDs or remediation; and off-topic requests are declined.</p><p>Domain context</p><p>Rules that the model cannot infer from the data, such as the custom scan and how manual checks are reported.</p><p>Output conventions</p><p>Timestamps in local time, plus the ingested and original timestamps for Elasticsearch data; sources are cited.</p><p>Edge cases</p><p>Missing input means ask; a failed or empty tool result is stated, never read as "compliant."</p><p>This excerpt from the directives and guardrails shows the tone:</p># Guardrails
- **Cluster Mapping**: Cluster name provided by the user must match <code>orchestrator.cluster.name</code> exactly as recorded in compliance data.
- **Silent Exclusion of Custom Scans**: By default, completely omit and suppress any scan or check result where <code>scan_name</code> contains <code>custom</code> (case-insensitive <code>*custom*</code>). Do NOT list, mention, or show an "Excluded custom scans" section or table in the output. Filter them out completely silently. Only include them if the user explicitly requests custom scans.
- **Handling Manual Rules**: Treat OpenShift's base status MANUAL as manual review. If a custom automated evaluation exists, read <code>manual_scan_status</code> (<code>PASS</code>/<code>FAIL</code>) and <code>last_manual_scan</code> timestamp and report that custom evaluation separately. If absent, report "no manual scan annotation recorded".
- **Strict Read-Only Workload Investigation**: When investigating which workload or pod caused a rule to fail, the agent operates in strictly read-only mode. The agent must NEVER mutate, patch, or change application workloads. It identifies the root cause and user attribution, and provides the remediation steps for the OpenShift administrator to execute.
- **Safety**: Never execute live cluster changes or scans without presenting the plan and receiving explicit user confirmation.
- **Concise Communication**: Answer directly and concisely using clear Markdown tables. Do not ask follow-up questions or offer unsolicited next steps unless clarification is strictly necessary to answer the prompt.<p>The instructions also carry domain context that a model cannot infer from the data. In OpenShift clusters, a custom scan bound to the <code>custom-ocp4-manual-rules</code> tailored profile tests manual rules. The agent leaves it out of summaries and counts unless the user asks for it. </p><p>For manual checks in the other scans, the agent reports two statuses side by side: the original status (MANUAL); and the manual scan status from the annotation that a scheduled Elastic workflow writes back to the cluster. Putting these rules in the instructions keeps them in one place, so no tool or skill needs to repeat them. Also, the whole block is static, with no timestamps or session IDs, so prompt caching keeps working.</p><h3>Add skills for posture, failure investigation, and reporting</h3><p>Custom instructions are loaded on every turn, making them ideal for general guardrails and domain context. However, adding detailed task workflows to system instructions creates unnecessary prompt overhead. Instead, define modular skills that the agent loads dynamically when the user request matches the skill description.</p><p>The OpenShift compliance agent uses four skills, each covering a single responsibility:</p><p><strong>Skill</strong></p><p><strong>Reads from</strong></p><p><strong>What it does</strong></p><p>Posture summary</p><p>Latest-state indices</p><p>Summarizes current scan results, pass and fail counts, failed controls by severity, manual check status, and remediation state.</p><p>Failure investigation</p><p>Raw data streams</p><p>Explains why a check failed or when it started failing, using history and remediation records. Kubernetes log correlation comes once audit logs are ingested.</p><p>Live cluster actions</p><p>Live cluster, through workflows</p><p>Reads live state, triggers a rescan, and applies or reverts a remediation, always after user approval.</p><p>Reporting</p><p>Latest and raw data</p><p>Produces reports, trends, and scan comparisons, and creates dashboards after user approves.</p><p>Each skill includes a description specifying its purpose and trigger criteria. Below is the description for the <code>Posture Summary</code> skill:</p>Summarize OpenShift compliance posture, scan execution status, check results, manual rule evaluations, and remediation states from latest-state indices (ospm-compliance_*-latest).<p>Each skill defines its own trigger conditions, available tools, workflow rules, and decision trees, along with output standards, execution steps, examples, and edge cases. For example, the manual check logic described in the previous section is implemented as:</p><strong>Manual Rules &amp; Custom Automated Evaluations</strong>
	When manual rules are requested, call <strong>ocp_compliance.list_checks_by_status</strong> with status: <strong>"MANUAL"</strong>.
	For every manual check, inspect both the base OpenShift status and the custom evaluation annotations:
		Report the base status as <strong>MANUAL</strong>.
		If <strong>manual_scan_status</strong> contains a value (e.g. <strong>PASS</strong> or <strong>FAIL</strong>), present it separately as: "Custom Evaluation Status: (last evaluated at &lt;last_manual_scan&gt;)".
		If both <strong>manual_scan_status</strong> and <strong>last_manual_scan</strong> are empty/null, explicitly state: <strong>"No manual scan annotation recorded"</strong> (indicating it still requires manual verification).
		Do not interpret or alter values beyond what the data fields show.<h3>Custom ES|QL tools for querying compliance data</h3><p>Skills tell the agent how to approach a task, but executing those steps requires tools to query data and perform actions. Because compliance scan data is normalized and stored in Elasticsearch, the agent uses targeted tools to search current posture and historical trends.
Following are the tools configured for the compliance agent:</p><p><strong>Tool</strong></p><p><strong>Type</strong></p><p><strong>What it does</strong></p><p>ocp_compliance.get_scan_status</p><p>Elasticsearch Query Language (ES|QL)</p><p>Lists the scans on a cluster with result, phase, and timestamps.</p><p>ocp_compliance.list_checks_by_status</p><p>ES|QL</p><p>Lists checks with a given status, including manual scan annotations for manual checks.</p><p>ocp_compliance.list_remediations</p><p>ES|QL</p><p>Lists auto remediations with their apply flag, state, and target object.</p><p>ocp_compliance.get_rule_details</p><p>ES|QL</p><p>Looks up a specific compliance rule from latest-state data.</p><p>ocp_compliance.search_audit_logs</p><p>Index search</p><p>Searches the OpenShift cluster audit logs ingested into Elasticsearch cluster.</p><p>ocp_compliance.search_compliance_history</p><p>Index search</p><p>Offers open-ended search over the raw event history.</p><h3>Elastic Workflows for live OpenShift cluster actions</h3><p>Although large language models (LLMs) excel at reasoning and synthesis, you don't want an AI model improvising arbitrary mutations against a live OpenShift cluster. <a href="https://www.elastic.co/docs/explore-analyze/workflows">Elastic Workflows</a> solves this by executing deterministic, YAML-defined steps that run identically every time. When exposed to Agent Builder as tools, the agent decides when to invoke a workflow based on your prompt but cannot alter its underlying execution logic, ensuring strict guardrails around cluster interactions.</p><p>Four workflows handle the live cluster interactions supported by the agent, alongside a scheduled automation workflow that reconciles manual rule annotations:</p><p><strong>Workflow name</strong></p><p><strong>Agent tool</strong></p><p><strong>What it does</strong></p><p>openshift-compliance-query-live-workload</p><p>ocp_compliance.query_live_workload</p><p>Executes a strictly read-only HTTP GET request against the live OpenShift API to inspect objects and pinpoint the offending resource.</p><p></p><p>openshift-compliance-read-live-state </p><p></p><p>ocp_compliance.live_read_state </p><p></p><p>Reads the live state of one ComplianceScan, ComplianceCheckResult, or ComplianceRemediation directly from the OpenShift API.</p><p>openshift-compliance-trigger-scan </p><p></p><p>ocp_compliance.trigger_scan </p><p></p><p>Reruns an existing ComplianceScan on the live cluster by setting the rescan annotation.</p><p>openshift-compliance-set-remediation-state</p><p></p><p></p><p>ocp_compliance.set_remediation_state</p><p></p><p>Applies (apply: true) or reverts a native ComplianceRemediation on the live cluster.</p><p>Annotate custom compliance Rule resources</p><p></p><p></p><p>N/A</p><p>Checks custom CEL rule outcomes in Elasticsearch and annotates the corresponding rule object on the OpenShift cluster.</p><p>Each workflow tool has <code>Require user confirmation</code> set to <code>Always</code>, so Agent Builder pauses and asks to approve every call.</p><h3>Connect Elastic to the OpenShift API with the Kubernetes connector</h3><p>The Elastic <a href="https://www.elastic.co/docs/reference/kibana/connectors-kibana/kubernetes-action-type">Kubernetes connector</a> provides secure connectivity between the Elastic Stack and OpenShift API endpoints, allowing workflows to interact directly with cluster resources.</p><p>The service account token configured for the connector must follow the principle of least privilege, scoped strictly to the operations required by the workflows.</p><p>The connector needs patch permissions on the Compliance Operator custom resource definitions (CRDs), so workflows can trigger scans and apply remediations. Investigations need more than that; the agent has to read pods and service accounts, along with RBAC bindings, to find the workload behind a failed check, which also means read-only access to cluster workloads. You can grant both in two ways:</p><p><strong>Approach</strong></p><p><strong>Permissions granted</strong></p><p><strong>When to use</strong></p><p>Dedicated connector service account</p><p>Bound to the OpenShift view or cluster-reader ClusterRole for read-only workload queries, plus a scoped role granting patch on compliancescans and complianceremediations in compliance.openshift.io.</p><p>Production. The connector’s access is separate from the agent’s and can be audited and revoked on its own.</p><p>Extend the existing agent service account</p><p>Adds get and list on pods, serviceaccounts, and rolebindings to the existing elastic-agent-ospm ClusterRole.</p><p>PoCs and lab environments, where standing up a second service account is more setup than the exercise warrants.</p><p>The example below generates a token for the existing <code>elastic-agent</code> service account:</p>oc create token elastic-agent -n elastic-agent-ocp --duration=720h<p>Note: When deploying across multiple clusters or staging environments, ensure that <code>connector-id</code> in the workflow matches the specific Kubernetes connector configured for that cluster.</p><h3>The complete OpenShift compliance agent architecture</h3><p>The finished agent combines custom instructions, skills, tools, workflows, and connectors. The final structure looks like this:</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltce944f0b2584e15a/6afd9168d7925819b3647b38/image4.png" alt="Agentic compliance for OpenShift: agent read path to Elasticsearch and approval-gated act path to the cluster" /><p>The complete agent and its supporting components manifests are available in the GitHub <a href="https://github.com/elastic/elastic-labs/tree/main/supporting-blog-content/security-labs/openshift-compliance-agent/elastic">repository</a>.</p><h2>OpenShift compliance agent demo: From failed control to root cause</h2><p>The demo below follows the OpenShift compliance agent across an end-to-end investigation scenario. It shows how the agent summarizes multi-cluster posture and flags rule failures. It also demonstrates how the agent uses Elastic Workflows to query live pods without leaving the chat interface. From there, the agent correlates OpenShift audit logs in Elasticsearch to trace the exact user and deployment that caused the policy drift and documents the timeline into an Elastic case. And it shows how execution guardrails block unauthorized or destructive cluster commands.</p><h2>Conclusion: OpenShift compliance monitoring at fleet scale</h2><p>The OpenShift Compliance Operator does the essential work of auditing cluster configurations, but keeping a multi-cluster fleet compliant shouldn't require juggling spreadsheets or hunting down failed pods manually, nor should it force you to scramble before every audit.</p><p>Centralizing compliance findings in Elasticsearch and putting Agent Builder on top shifts the experience from static dashboards to active, evidence-backed investigation. Teams can query posture across clusters in plain English and automate manual checks with CEL and scheduled workflows. They can also trace policy drift down to the exact OpenShift user and timestamp, all while keeping humans firmly in control of live cluster changes.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/openshift-compliance-elastic-agent-builder</link>
    <guid isPermaLink="false">openshift-compliance-elastic-agent-builder</guid>
    <category><![CDATA[AI & Automation]]></category>
    <category><![CDATA[Cloud Security]]></category>
    <category><![CDATA[Integrations & Tools]]></category>
    <dc:creator><![CDATA[Anand Vyas]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt80cbdbf2fbd4f976/6afd53c0706cd3af058d1884/image6.png" length="0" type="image/png"/>
    <pubDate>Thu, 19 Nov 2026 15:30:00 GMT</pubDate>
  </item>
  </channel>
</rss>