Red Hat Advanced Cluster Security (RHACS)

Module Overview

Duration: 15-20 minutes
Format: Hands-on lab
Audience: Security Engineers, Platform Engineers, IT Operations

Console Access
  • Username: {openshift_cluster_admin_username}

  • Password: {openshift_cluster_admin_password}

  • Console: {openshift_cluster_console_url}[window=blank]

We recommend using the OCP Console tab within this Showroom interface as it is easier to follow along.
The same admin credentials are used for the RHACS console.

Learning Objectives

By the end of this module, you will:

  • Deploy a bunch of insecure applications

  • Setup compliance reporting and compliance checks

  • Scan workloads with Red Hat Advanced Cluster Security (RHACS)

Ensure access to the ACS console

The RHACS Web Console provides a unified securityview of your clusters. We recommend that you use the embedded browser tab for this workshop.

If you see an authentication error, click Try Again or reload the tab at the top and try again.

RHACS administrator login credentials:

Username:

{openshift_cluster_admin_username}

Password:

{openshift_cluster_admin_password}

Deploy a bunch of insecure applications

Let’s deploy a bunch of insecure applications to the cluster. This will help us demonstrate the capabilities of RHACS.

Procedure
  1. Run the following command in your terminal to deploy the insecure applications:

    git clone https://github.com/mfosterrox/demo-applications.git
    cd ~/demo-applications
    oc apply -f k8s-deployment-manifests/-namespaces --recursive
    oc apply -f k8s-deployment-manifests/emojivoto --recursive
    oc apply -f k8s-deployment-manifests/apache-struts --recursive
    oc apply -f k8s-deployment-manifests/dvwa --recursive
    oc apply -f k8s-deployment-manifests/log4shell --recursive
    oc apply -f skupper-demo/ --recursive

    You’ll see applications being deployed (output truncated):

    namespace/emojivoto created
    namespace/apache-struts created
    namespace/dvwa created
    namespace/emojivoto configured
    namespace/juice-shop created
    namespace/log4shell created
    namespace/nodejs-goof-vuln-main created

Security and Environment Insights

Let’s review the basics of RHACS.

RHACS Basics

RHACS provides essential tools for security workflows in Kubernetes, including:

  • Vulnerability management (Platform, workloads, Nodes, and Virtual Machines)

  • Policy lifecycle management (Policy-as-Code)

  • Compliance auditing

  • Risk profiling

  • Threat detection and response

With RHACS, you can ensure your Kubernetes clusters remain secure and compliant across CNCF supported Kubernetes environment.

Compliance Checks with RHACS and the Compliance Operator

Production clusters and applications should meet your security standards and internal policies consistently. RHACS, together with the OpenShift compliance operator, helps you measure that posture, spot compliance gaps, and remediate them before they reach production or drifts out of compliance (over time).

First, let’s add a configuration to the local cluster so you can see the difference between compliance check results.

Make a Simple Cluster Change to Pass the Compliance Check

Let’s focus on the ocp4-e8 compliance standard and see how we can pass the ocp4-e8-ocp-allowed-registries control. Follow the steps below to pass the check for the production cluster.

Procedure
  1. Click the command below to execute it.

    oc apply -f - <<EOF
    ---
    apiVersion: config.openshift.io/v1
    kind: Image
    metadata:
      name: cluster
    spec:
      registrySources:
        allowedRegistries:
          - quay.io
          - registry.redhat.io
          - registry.access.redhat.com
          - image-registry.openshift-image-registry.svc:5000
          - gcr.io
          - docker.io
    EOF
  2. Check that your changes have been accepted:

    oc get image.config.openshift.io/cluster -o yaml | grep allowedRegistries -A 10

    Output

    allowedRegistries:
    - quay.io
    - registry.redhat.io
    - registry.access.redhat.com
    - image-registry.openshift-image-registry.svc:5000
    - gcr.io
    - docker.io
status:
  internalRegistryHostname: image-registry.openshift-image-registry.svc:5000

Great! Now let’s set up compliance checks for your local cluster.

Set up a Compliance Scan

Follow the steps below to set up the compliance scan.

Procedure
  1. Head to the RHACS tab in the workshop panel and click on the Compliance → OpenShift Schedules tab.

    RHACS Compliance OpenShift Schedules tab
  2. Next, click on the Create scan schedule.

    Create scan schedule dialog
  3. Next, fill in the form with the following information:

    • Name:

      acs-catch-all
    • Description:

      Daily compliance scan for all profiles covering CIS, E8, Moderate, NERC-CIP, PCI-DSS, and STIG standards.
    • Frequency: Daily

    • Time: 00:00 UTC

  4. Click Next

  5. Select the clusters: production

  6. Click Next

  7. Add the following profiles:

    • ocp4-cis

    • ocp4-e8

    • ocp4-nerc-cip

    • ocp4-pci-dss

    • ocp4-stig

There are many profiles to select but here we are selecting the most common profiles that are used in most organizations. If you want to only add the ones necessary for the lab. Select `ocp4-cis` & `ocp4-e8` only.
  1. Click Next

    You can send notifications via email, get details via API or download reports via the console. However, we will not add a delivery destination so we will skip this step.

  2. Click Next

  3. Review your masterpiece and click Save

  4. The scan should start automatically. If not, you can always use the menu (three dots) linked to the schedule and select Run scan to trigger a manual scan.

    Scan schedule menu with Run scan option
    Compliance scan running
    The scan may take a few minutes to complete. If the scan status doesn’t update, click on another section in the RHACS console and come back to refresh the view.
  5. Head over to the OpenShift coverage section where you can view all of the details from the scan. Click on the Compliance → OpenShift Coverage → E8 tab to view the results.

    E8 compliance standard overview

    Remember that we passed the check for the production cluster by adding the allowed registries to the cluster configuration.

  6. Let’s take a look at the details of the check by scrolling down and clicking on the passing standard ocp4-e8-ocp-allowed-registries.

    Allowed registries compliance clusters

    This view shows you all of the clusters and their status for the check. As you can see, the production cluster is passing.

  7. Click on the Details tab to view the description, rationale, and remediation for the compliance check.

    Allowed registries compliance check details

    This view shows you the details of the check for the production cluster. As you can see, the production cluster is passing.

  8. And you can run the verification step to ensure the check is passing.

    oc get image.config.openshift.io cluster -o jsonpath='{.spec.registrySources.allowedRegistries}'
Fun celebration

Great job! Compliance reporting can be a pain. RHACS and OpenShift want to make it easy for your teams to pass audits and compliance checks across regional barriers.

Runtime Security and Immutable Workloads

In production Kubernetes environments, strict control over what runs inside your cluster is essential for security. Monitoring for file integrity and anomalous behavior helps you detect drift from approved images and configurations.

RHACS includes built-in policies that detect and block risky behaviors such as unauthorized access attempts, persistent threats, lateral movement, and file integrity violations. These policies help you enforce the immutable container principle — containers should only run exactly what you approved, with no unexpected changes.

Use Policy-as-Code to Block Anomalous Behavior at Runtime

Package managers such as apt, apk, yum, and dnf are useful on virtual machines, but they have no place in production containers. Allowing them enables uncontrolled software installation, increases the attack surface in your cluster, and breaks auditability and immutability — core expectations for production workloads.

Policy-as-Code is an effective way to scale this protection across your clusters.

Let’s look at an example of how we can use Policy-as-Code to block anomalous behavior at runtime.

Procedure
  1. Apply the following policy configuration into the terminal. It will create a security policy to enforce runtime protection against package manager execution.

    oc apply -f - <<EOF
    ---
    apiVersion: config.stackrox.io/v1alpha1
    kind: SecurityPolicy
    metadata:
      name: alpine-linux-package-manager-execution-patient-portal-enforcement
      namespace: stackrox
    spec:
      policyName: Alpine Linux Package Manager Execution - Patient-Portal Enforcement
      description: Alert when the Alpine Linux package manager (apk) is executed at runtime
      rationale: Use of package managers at runtime indicates that new software may be being introduced into containers while they are running.
      remediation: Run 'apk --purge del apk-tools' in the image build for production containers. Change applications to no longer use package managers at runtime, if applicable.
      categories:
        - Anomalous Activity
        - Package Management
      lifecycleStages:
        - RUNTIME
      eventSource: DEPLOYMENT_EVENT
      severity: LOW_SEVERITY
      enforcementActions:
        - FAIL_KUBE_REQUEST_ENFORCEMENT
        - KILL_POD_ENFORCEMENT
      policySections:
        - policyGroups:
            - fieldName: Process Name
              booleanOperator: OR
              values:
                - value: apk
                - value: apk-tools
                - value: apk update
                - value: apk add
                - value: apk remove
                - value: apk upgrade
                - value: apk del
                - value: apk cache
                - value: apk clean
                - value: apk info
                - value: apk show
                - value: apk version
      mitreAttackVectors:
        - tactic: TA0011
          techniques:
            - T1105
      criteriaLocked: false
      mitreVectorsLocked: false
      isDefault: false
    EOF

    Next, you will use tmux to watch OpenShift events while running the test so you can see how RHACS enforces the policy at runtime.

  2. From the terminal, start tmux with two panes:

    tmux new-session \; split-window -v \; attach
  3. Next, run a watch on OpenShift events in the first shell pane:

    oc get events -n patient-portal -w
  4. Press Ctrl+b, o to switch to the next pane. (Ctrl+b THEN o)

    Ctrl+b is the prefix key for tmux. o is the command to switch to the next pane.

  5. Exec into our patient-frontend application by getting the pod details and adding them to the following command.

    POD=$(oc get pod -n patient-portal -l app=frontend -o jsonpath="{.items[0].metadata.name}")
    oc exec -n patient-portal $POD -i --tty -- /bin/sh
    Sample output
    [demo-user@bastion ~]$ POD=$(oc get pod -n patient-portal -l app=frontend -o jsonpath="{.items[0].metadata.name}")
    oc exec -n patient-portal $POD -i --tty -- /bin/sh
    /home/fritz $
  6. Run the alpine package manager in this shell:

    apk update
  7. Examine the output and expect to see that the package manager attempts to perform an update operation:

    /home/fritz $ apk update
    ERROR: Unable to lock database: Permission denied
    ERROR: Failed to open apk database: Permission denied
    /home/fritz $ command terminated with exit code 137
    [demo-user@bastion ~]$
    It’s normal to see Unable to lock database: Permission denied. This is because OpenShift is blocking the sudo behavior of the pod thanks to pod security policies.
  8. Examine the oc get events tmux pane (The pane on the bottom), and note that it shows that RHACS detected the package manager invocation and deleted the pod:

    ^C^C[demo-user@bastion ~]$ oc get events -n patient-portal -w
    LAST SEEN   TYPE      REASON                 OBJECT                           MESSAGE
    50s         Normal    Killing                pod/frontend-8667d5c56b-f9fcj    Stopping container frontend
    50s         Normal    Scheduled              pod/frontend-8667d5c56b-s6dph    Successfully assigned patient-portal/frontend-8667d5c56b-s6dph to ip-10-0-61-109.us-east-2.compute.internal
    49s         Normal    Created                pod/frontend-8667d5c56b-s6dph    Created container frontend
    49s         Normal    Started                pod/frontend-8667d5c56b-s6dph    Started container frontend
    50s         Normal    SuccessfulCreate       replicaset/frontend-8667d5c56b   Created pod: frontend-8667d5c56b-s6dph
    50s         Warning   StackRox enforcement   deployment/frontend              A pod (frontend-8667d5c56b-f9fcj) violated StackRox policy "Alpine Linux Package Manager Execution - Enforce" and was killed

    After a few seconds, you can see the pod is deleted and recreated. In your tmux shell pane, note that your shell session has terminated and that you are returned to the Bastion VM command line.

  9. Exit the tmux session and return to the bastion host terminal:

    1. If you are still inside the container shell, type exit to exit the container.

    2. Press Ctrl+C to stop the watch command running in the tmux pane.

    3. Type exit or Ctrl-D to exit the tmux session and return to the bastion host terminal.

      You can see that the behavior is blocked by the policy, however, the security team still needs to be aware of this behavior and investigate why it is happening.

You have successfully stopped yourself from running a (Potentially breaking) update! However, the security investigative process continues, as you have now raised an alert that must be triaged!

Violations and Reporting for Audit and Compliance

Event audits support security best practices and give your team a clear record of what happened when a policy fired. RHACS captures forensic detail for each violation so you can investigate, report, and tune policies with confidence.

Procedure

  1. Switch back to the RHACS console in your browser and navigate to the Violations page.

  2. Filter by the policy violation Policy, Name, r/alpine OR by the most recent policy violations (sort by time). You will see a policy violation that has been enforced.

    RHACS Violations list filtered by policy
  3. Click on your Alpine Linux Package Manager Execution - Patient-Portal Enforcement to view the details.

    RHACS violation detail for package manager policy

    If configured properly, each violation record should be pushed to a Security Information and Event Management (SIEM) application and is available to be retrieved via the API. The forensic data shown in the UI is recorded, including the timestamp, process user IDs, process arguments, process ancestors, and enforcement action.

Clean up

Procedure
  1. Run the following commands in your terminal to clean up the demo applications and ACS changes from this module:

    cd ~/demo-applications
    oc delete -f k8s-deployment-manifests/emojivoto --recursive
    oc delete -f k8s-deployment-manifests/apache-struts --recursive
    oc delete -f k8s-deployment-manifests/dvwa --recursive
    oc delete -f k8s-deployment-manifests/log4shell --recursive
    oc delete -f skupper-demo/ --recursive
    oc patch image.config.openshift.io cluster --type=json -p='[{"op":"remove","path":"/spec/registrySources"}]'
    oc delete securitypolicy --all -n stackrox --ignore-not-found
Fun celebration

Great job! Thanks for playing along and checking out the RHACS basics. You’re ready to move on to the next module in the left navigation when you are ready.