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.
-
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/ --recursiveYou’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.
-
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 -
Check that your changes have been accepted:
oc get image.config.openshift.io/cluster -o yaml | grep allowedRegistries -A 10Output
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.
-
Head to the RHACS tab in the workshop panel and click on the Compliance → OpenShift Schedules tab.
-
Next, click on the Create scan schedule.
-
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
-
-
Click Next
-
Select the clusters: production
-
Click Next
-
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. |
-
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.
-
Click Next
-
Review your masterpiece and click Save
-
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.
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. -
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.
Remember that we passed the check for the production cluster by adding the allowed registries to the cluster configuration.
-
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.This view shows you all of the clusters and their status for the check. As you can see, the production cluster is passing.
-
Click on the Details tab to view the description, rationale, and remediation for the compliance check.
This view shows you the details of the check for the production cluster. As you can see, the production cluster is passing.
-
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}'
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.
-
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 EOFNext, you will use
tmuxto watch OpenShift events while running the test so you can see how RHACS enforces the policy at runtime. -
From the terminal, start tmux with two panes:
tmux new-session \; split-window -v \; attach -
Next, run a watch on OpenShift events in the first shell pane:
oc get events -n patient-portal -w -
Press Ctrl+b, o to switch to the next pane. (Ctrl+b THEN o)
Ctrl+bis the prefix key for tmux.ois the command to switch to the next pane. -
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/shSample 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 $ -
Run the alpine package manager in this shell:
apk update -
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. -
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 killedAfter 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.
-
Exit the tmux session and return to the bastion host terminal:
-
If you are still inside the container shell, type
exitto exit the container. -
Press
Ctrl+Cto stop thewatchcommand running in the tmux pane. -
Type
exitorCtrl-Dto 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
-
Switch back to the RHACS console in your browser and navigate to the Violations page.
-
Filter by the policy violation Policy, Name,
r/alpineOR by the most recent policy violations (sort by time). You will see a policy violation that has been enforced. -
Click on your Alpine Linux Package Manager Execution - Patient-Portal Enforcement to view the details.
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
-
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
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.










