SV-257523r1050555_rule
V-257523
SRG-APP-000109-CTR-000215
CNTR-OS-000210
CAT II
10
Apply the following Prometheus rule by executing the following:
oc apply -f - << 'EOF'
---
# platform = multi_platform_ocp
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: audit-errors
namespace: openshift-kube-apiserver
spec:
groups:
- name: apiserver-audit
rules:
- alert: AuditLogError
annotations:
summary: |-
An API Server instance was unable to write audit logs. This could be
triggered by the node running out of space, or a malicious actor
tampering with the audit logs.
description: An API Server had an error writing to an audit log.
expr: |
sum by (apiserver,instance)(rate(apiserver_audit_error_total{apiserver=~".+-apiserver"}[5m])) / sum by (apiserver,instance) (rate(apiserver_audit_event_total{apiserver=~".+-apiserver"}[5m])) > 0
for: 1m
labels:
severity: warning
EOF
Verify there is a Prometheus rule to watch for audit events by executing the following:
oc get prometheusrule -o yaml --all-namespaces | grep apiserver_audit
Output:
sum by (apiserver,instance)(rate(apiserver_audit_error_total{apiserver=~".+-apiserver"}[5m])) / sum by (apiserver,instance) (rate(apiserver_audit_event_total{apiserver=~".+-apiserver"}[5m])) > 0
If the output above is not displayed, this is a finding.
V-257523
False
CNTR-OS-000210
Verify there is a Prometheus rule to watch for audit events by executing the following:
oc get prometheusrule -o yaml --all-namespaces | grep apiserver_audit
Output:
sum by (apiserver,instance)(rate(apiserver_audit_error_total{apiserver=~".+-apiserver"}[5m])) / sum by (apiserver,instance) (rate(apiserver_audit_event_total{apiserver=~".+-apiserver"}[5m])) > 0
If the output above is not displayed, this is a finding.
M
5547