# Msk Cluster Auditor

> Audits Amazon MSK (Managed Streaming for Kafka) clusters for encryption in-transit (TLS between clients and brokers, inter-broker), encryption at-rest (customer-managed KMS key), client authentication (TLS/IAM/SCRAM/ unauthenticated), broker logging (CloudWatch/S3/Firehose), and public access exposure (private vs public subnets, SERVICE_PROVIDED_EIPS). Emits a deterministic categorical verdict per cluster. Use when reviewing MSK cluster security, checking Kafka encryption settings, validating client authentication modes, auditing broker logging coverage, or assessing public access exposure before production deployment.

- Skill: `jhkchan/msk-cluster-auditor` (Agent Skill, multi-file: 20 files)
- Install (CLI): `npx get-skill add jhkchan/msk-cluster-auditor`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jhkchan/msk-cluster-auditor/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- License: Apache-2.0
- Author: jhkchan (https://skillmd.com/u/jhkchan)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/jhkchan/msk-cluster-auditor

---


# MSK Cluster Auditor

## Mindset

**One-line takeaway:** the verdict is always the **first matching condition**
in priority order — NO_ENCRYPTION beats UNAUTHENTICATED beats PUBLIC_ACCESS
beats CONFIG_GAP beats OK. Plaintext data on the wire dwarfs every other
finding because it exposes every Kafka message to network-level interception.

MSK runs managed Apache Kafka brokers inside an AWS VPC. Five dimensions
determine cluster security posture, and their severity is NOT equal:

- **Encryption in-transit** is the wire-level guarantee. With
  `ClientBroker: PLAINTEXT`, every Kafka message, credential, and payload
  travels unencrypted between clients and brokers. `TLS_PLAINTEXT` is
  equally dangerous — it allows clients to choose plaintext, defeating the
  encryption guarantee.
- **Client authentication** determines who can connect. `UNAUTHENTICATED:
  enabled` means anyone who can reach the brokers (VPC-peered, on-prem
  via Direct Connect, or internet-routed) can produce and consume without
  any identity check.
- **Public access** exposes brokers to the internet via Elastic IPs. Even
  with TLS and auth, an internet-reachable broker is an attack surface
  that should not exist in most deployments.
- **Broker logging** is the forensic record. With all log destinations
  disabled, you cannot answer "who produced what, and when" during an
  incident.
- **Encryption at-rest (KMS)** controls key governance. MSK always
  encrypts data volumes — the question is whether you control the key
  (customer-managed CMK with rotation + policy) or AWS does (AWS-managed
  key, no rotation control, shared across the account).

## Quick reference — verdict priority matrix

| # | Condition | Verdict | Priority |
|---|---|---|---|
| 1 | `ClientBroker: PLAINTEXT` OR `ClientBroker: TLS_PLAINTEXT` | **NO_ENCRYPTION** | Highest |
| 2 | `ClientAuthentication.Unauthenticated.enabled: true` | **UNAUTHENTICATED** | |
| 3 | `PublicAccess.Type: SERVICE_PROVIDED_EIPS` | **PUBLIC_ACCESS** | |
| 4 | All broker logging destinations disabled; OR no customer-managed KMS key (AWS-managed only) | **CONFIG_GAP** | |
| 5 | All dimensions pass | **OK** | Lowest |

The first matching row is the final verdict — subsequent dimensions produce
additional findings in the FINDINGS list but do not change the verdict.

## Pre-flight: cluster metadata gate (run before classification)

Several cluster attributes short-circuit the audit or change the
classification logic. Misclassifying them produces false positives.

| Attribute | Value | Effect on audit |
|---|---|---|
| `ClusterType` | `SERVERLESS` | **MSK Serverless.** Encryption in-transit is ALWAYS TLS (forced), at-rest is ALWAYS encrypted with a customer-managed key by default, auth is ALWAYS IAM, public access is NOT supported. Skip Steps 1-3 (always pass). Audit only logging (Step 4). |
| `ClusterType` | `PROVISIONED` | Proceed with full audit (Steps 1-5). |
| `State` | `CREATING` | Cluster not yet live — skip audit, output advisory. |
| `State` | `DELETING` / `FAILED` | Cluster is being torn down or failed — skip audit, output advisory. |
| `State` | `MAINTENANCE` | Cluster is undergoing AWS-side maintenance — audit normally but note brokers may be restarting. |
| `EncryptionInfo` | absent | Encryption settings unknown — this only happens on very old clusters or malformed input. Output `VERDICT: CONFIG_GAP` with "Encryption configuration not reported by describe-cluster — re-fetch with aws kafka describe-cluster." |

**If the cluster JSON is malformed** (invalid JSON, missing required fields
like `ClusterArn` or `ClusterName`), output:

```text
CLUSTER: <name or "unknown">
VERDICT: ERROR
REASON: Cluster configuration is not valid JSON or is missing required fields — cannot classify.
REMEDIATION: Retrieve the canonical config with `aws kafka describe-cluster --cluster-arn <arn> --region <region>` and re-audit.
```

## Process — Classification logic (apply in order, first match is the verdict)

### Step 0: Expert knowledge — non-obvious MSK behaviors that change classification

Full catalog of non-obvious MSK behaviors that change classification (TLS_PLAINTEXT semantics, in-cluster encryption, Serverless defaults, public subnets, setting immutability, SASL/SCRAM secrets, mTLS/PCA, logging toggles, monitoring layers, topic configs, security groups): moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).
Load that catalog before classifying any cluster; the branch rules in Steps 1-5 assume these behaviors.

### Step 1: Encryption in-transit evaluation (NO_ENCRYPTION)

Examine `EncryptionInfo.EncryptionInTransit`:

1. If `ClientBroker` is `PLAINTEXT` → **NO_ENCRYPTION**. All
   client-to-broker traffic is unencrypted. Credentials (SASL/SCRAM),
   message payloads, and topic metadata are readable by anyone with a
   network tap on the path.

2. If `ClientBroker` is `TLS_PLAINTEXT` → **NO_ENCRYPTION**. Both TLS
   and plaintext listeners are active. A client connecting over the
   plaintext port sends everything unencrypted. The presence of a TLS
   option does not compensate for the plaintext path.

3. If `ClientBroker` is `TLS` → encryption-in-transit dimension passes
   for the client wire. Proceed to evaluate `InClusterEncryption`:
   - `InClusterEncryption: false` (or absent) → inter-broker traffic is
     plaintext. Note as a CONFIG_GAP finding (not NO_ENCRYPTION — the
     client wire is encrypted).
   - `InClusterEncryption: true` → full TLS in-transit. Dimension passes.

4. If `EncryptionInfo` or `EncryptionInTransit` is absent → treat as
   unknown encryption. Flag as CONFIG_GAP (cannot verify encryption
   posture from input).

### Step 2: Client authentication evaluation (UNAUTHENTICATED)

Examine `ClientAuthentication`:

1. If `Unauthenticated.Enabled: true` → **UNAUTHENTICATED**. Any client
   that can reach the broker TCP port can produce and consume without
   presenting credentials. This is the Kafka equivalent of an open
   database — the data is accessible to any network participant.

2. If `Unauthenticated.Enabled: false` (or `Unauthenticated` is absent)
   → authentication dimension passes. Note which auth modes are enabled:
   - `Tls.Enabled: true` → mTLS via ACM PCA (strongest — cryptographic
     client identity).
   - `Sasl.Iam.Enabled: true` → AWS IAM auth (strong — integrates with
     IAM policy governance).
   - `Sasl.Scram.Enabled: true` → SCRAM-SHA-512 via Secrets Manager
     (acceptable — credential-based, no IAM integration).

3. If NO authentication modes are enabled AND `Unauthenticated` is
   disabled or absent → the cluster accepts no clients. This is a
   misconfiguration — note as an ERROR advisory (not a security verdict).

### Step 3: Public access evaluation (PUBLIC_ACCESS)

Examine `BrokerNodeGroupInfo.ConnectivityInfo.PublicAccess`:

1. If `PublicAccess.Type` is `SERVICE_PROVIDED_EIPS` → **PUBLIC_ACCESS**.
   MSK attaches Elastic IPs to broker ENIs. Brokers are reachable from
   the internet on the client-facing ports (9092 for plaintext, 9094 for
   TLS). Even with TLS and authentication, this exposes the broker
   listener to global scanning, brute-force, and protocol-level CVE
   exploitation.

2. If `PublicAccess.Type` is `DISABLED` (or `ConnectivityInfo` / `PublicAccess`
   is absent) → no public access. Dimension passes.

3. If broker subnets are public (route table has `0.0.0.0/0` → IGW) but
   `PublicAccess` is `DISABLED` → brokers still have private IPs only.
   No PUBLIC_ACCESS, but note as an advisory finding (brokers in public
   subnets is an anti-pattern — they should be in private subnets for
   defense-in-depth).

### Step 4: Logging and encryption-at-rest evaluation (CONFIG_GAP)

This step covers two sub-dimensions. If EITHER triggers, the verdict is
CONFIG_GAP (assuming Steps 1-3 did not trigger).

#### 4a: Broker logging

Examine `LoggingInfo.BrokerLogs`:

1. If `LoggingInfo` is absent, or `BrokerLogs` is absent, or ALL
   destinations (`CloudWatchLogs`, `S3`, `Firehose`) have `Enabled: false`
   → **CONFIG_GAP**. No broker logs are being delivered. During an
   incident, you cannot reconstruct topic access, consumer group
   activity, or broker-level errors.

2. If at least ONE destination has `Enabled: true` → logging dimension
   passes. The cluster is delivering broker logs somewhere.

#### 4b: Encryption at-rest (KMS key governance)

Examine `EncryptionInfo.EncryptionAtRest.DataVolumeKMSKeyId`:

1. If `DataVolumeKMSKeyId` is absent, empty, or references an AWS-managed
   key (e.g., `alias/aws/kafka`) → **CONFIG_GAP**. Data is still
   encrypted (MSK always encrypts volumes), but key rotation, key policy,
   and decrypt-audit visibility are controlled by AWS, not the customer.

2. If `DataVolumeKMSKeyId` references a customer-managed CMK (a
   concrete key ARN or alias) → at-rest encryption dimension passes.

### Step 5: Aggregation — first match wins

The verdict is the **first matching condition** in priority order:

```text
if ClientBroker is PLAINTEXT or TLS_PLAINTEXT → verdict = NO_ENCRYPTION
elif Unauthenticated.Enabled: true            → verdict = UNAUTHENTICATED
elif PublicAccess.Type: SERVICE_PROVIDED_EIPS → verdict = PUBLIC_ACCESS
elif all logging disabled OR no CMK           → verdict = CONFIG_GAP
else                                          → verdict = OK
```

All triggered dimensions are listed as findings regardless of which
becomes the verdict.

## Output format (per cluster)

```text
CLUSTER: <cluster-name>
VERDICT: NO_ENCRYPTION | UNAUTHENTICATED | PUBLIC_ACCESS | CONFIG_GAP | OK
REASON: <1-2 sentences citing the worst finding and its step number>
FINDINGS:
  - [NO_ENCRYPTION] <finding description (Step 1)>
  - [CONFIG_GAP] <finding description (Step 4a/4b)>
  - [OK] <dimension that passed>
REMEDIATION: <specific action per finding, or "None required" if OK>
```

### Worked example — plaintext with no logging

```text
CLUSTER: plaintext-broker
VERDICT: NO_ENCRYPTION
REASON: ClientBroker is PLAINTEXT — all client-to-broker traffic is
unencrypted (Step 1). Broker logging is also fully disabled (Step 4a).
FINDINGS:
  - [NO_ENCRYPTION] ClientBroker: PLAINTEXT — credentials and payloads
    transmitted in cleartext (Step 1)
  - [CONFIG_GAP] All broker log destinations disabled (Step 4a)
REMEDIATION:
  1. MSK encryption is immutable post-creation. Create a new cluster with
     ClientBroker: TLS and migrate topics. This is NOT an in-place fix.
  2. Enable broker logging on the replacement cluster:
     aws kafka update-broker-storage --cluster-arn <arn> # (no direct CLI for
     logging; use update-cluster-configuration or CloudFormation).
```

## Anti-Patterns — NEVER

- NEVER classify `ClientBroker: TLS_PLAINTEXT` as anything other than
  NO_ENCRYPTION. The plaintext listener is active — clients can and do
  connect without TLS. The existence of a TLS path does not compensate
  for the open plaintext path. This is the most common MSK
  misclassification.

- NEVER treat `ClientBroker: PLAINTEXT` as "acceptable if the VPC is
  private." VPC-level isolation is defense-in-depth, not a substitute
  for wire-level encryption. VPC traffic is interceptable by any
  compromised instance, peered network, or transit-gateway participant.
  Plaintext is always NO_ENCRYPTION regardless of network topology.

- NEVER apply Steps 1-3 (encryption, auth, public access) to an MSK
  Serverless cluster. Serverless enforces TLS + IAM auth and cannot be
  public. Applying Provisioned-audit logic produces false positives.
  Check `ClusterType: SERVERLESS` in the pre-flight gate and skip to
  Step 4.

- NEVER flag missing customer-managed KMS key as NO_ENCRYPTION. MSK
  ALWAYS encrypts data volumes at rest — the question is key governance
  (customer-managed vs AWS-managed), not encryption presence. Missing
  CMK is CONFIG_GAP, not NO_ENCRYPTION. Confusing the two produces
  false-critical alerts.

- NEVER assume `InClusterEncryption: false` is NO_ENCRYPTION. The
  client wire (`ClientBroker: TLS`) is still encrypted. Inter-broker
  plaintext is a CONFIG_GAP finding — the data crosses AZs unencrypted
  between brokers, but client-to-broker TLS is intact.

- NEVER classify `Unauthenticated.Enabled: true` as CONFIG_GAP. It is
  UNAUTHENTICATED — a separate, higher-priority verdict. Unauthenticated
  Kafka access means any network participant can read and write topics
  without credentials. This is not a "configuration gap" — it is an open
  data plane.

- NEVER classify `PublicAccess.Type: DISABLED` as PUBLIC_ACCESS. The
  `DISABLED` value is the explicit "off" state. An absent
  `ConnectivityInfo` block also means no public access. Both are safe.

- NEVER recommend changing `ClientBroker` from PLAINTEXT to TLS as an
  in-place operation. MSK encryption settings are immutable after
  cluster creation. The correct remediation is to create a new cluster
  with TLS enabled and migrate topics/consumer groups. Stating "enable
  TLS" without explaining the immutability constraint misleads operators.

- NEVER conflate broker logging with Enhanced Monitoring or Open
  Monitoring (Prometheus). `EnhancedMonitoring` controls metric
  granularity (DEFAULT / PER_BROKER / PER_TOPIC_PER_BROKER). Open
  Monitoring controls Prometheus scrape endpoints. Neither delivers
  broker log lines. The logging dimension checks
  `LoggingInfo.BrokerLogs` (CloudWatch / S3 / Firehose) only.

- NEVER assume the absence of `LoggingInfo` means logging is enabled.
  MSK defaults to NO broker logging on cluster creation. All four
  destinations start disabled. An absent `LoggingInfo` block means zero
  log delivery — classify as CONFIG_GAP.

- NEVER recommend SASL/SCRAM as equivalent to mTLS. SCRAM uses shared
  credentials stored in Secrets Manager — any client with the credential
  can impersonate any identity. mTLS binds the client identity to a
  certificate issued by a trusted PCA. SCRAM is acceptable; mTLS is
  stronger. State the trade-off, not a false equivalence.

- NEVER audit SCRAM auth without verifying the Secrets Manager secret
  exists and is tagged `AmazonMSK_20181101`. A cluster with
  `Sasl.Scram.Enabled: true` but no correctly tagged secret will fail
  all client connections with `SASL_AUTHENTICATION_FAILED`. The
  configuration says "SCRAM is on" but the credential store is empty —
  flag this as an operational ERROR, not a security verdict.

## Pre-flight safety checks (run before any remediation CLI)

Pre-flight safety checks (confirmation gate, encryption-immutability migration path, public-access blast radius, logging cost, rolling-restart propagation): moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).
The CONFIRM gate is mandatory before any state-changing CLI — see Anti-Patterns below.

## Remediation guidance

### For NO_ENCRYPTION — ClientBroker PLAINTEXT or TLS_PLAINTEXT

1. MSK encryption settings are **immutable**. You cannot change
   `ClientBroker` on an existing cluster. The remediation is:
   - Create a new cluster with `ClientBroker: TLS` and
     `InClusterEncryption: true`.
   - Mirror topics using MirrorMaker 2 or MSK Replicator.
   - Validate consumer group offsets on the new cluster.
   - Cut over producers and consumers.
   - Decommission the old cluster.

2. Example CloudFormation snippet for the replacement cluster:
   ```yaml
   EncryptionInfo:
     EncryptionInTransit:
       ClientBroker: TLS
       InClusterEncryption: true
   ```

3. If regulatory constraints require immediate cessation of plaintext
   traffic, restrict the broker security group to deny inbound on port
   9092 (plaintext) as an interim control while the migration proceeds.

### For UNAUTHENTICATED — unauthenticated clients enabled

1. Disable unauthenticated access via MSK configuration. Note: this
   requires a cluster configuration update and broker rolling restart:
   ```bash
   # The client-authentication settings are part of the cluster's
   # security configuration and may require cluster recreation on
   # older MSK versions. On MSK 2.7.1+, update via:
   aws kafka update-security --cluster-arn <arn> \
     --client-authentication '{"unauthenticated": {"enabled": false}}'
   ```

2. Verify at least one auth mode (TLS, SASL/IAM, or SASL/SCRAM) remains
   enabled BEFORE disabling unauthenticated. Locking out all clients is
   an instant outage.

### For PUBLIC_ACCESS — brokers exposed via Elastic IPs

1. Disable public access:
   ```bash
   aws kafka update-connectivity --cluster-arn <arn> \
     --connectivity-info '{"publicAccess": {"type": "DISABLED"}}'
   ```

2. Verify VPN, Direct Connect, or VPC peering provides client access
   BEFORE disabling. All clients using the Elastic IP endpoints will
   lose connectivity immediately.

3. Verify the change:
   ```bash
   aws kafka describe-cluster --cluster-arn <arn> \
     --query 'clusterInfo.brokerNodeGroupInfo.connectivityInfo.publicAccess'
   ```

### For CONFIG_GAP — broker logging disabled

1. Enable at least one log destination (CloudWatch recommended for
   operational visibility):
   ```bash
   aws kafka update-broker-storage --cluster-arn <arn>  # logging requires
   # update-cluster-configuration or the console; CLI support varies by
   # MSK API version. Use CloudFormation or the AWS Console for logging
   # updates.
   ```

2. Set a retention policy on the log group:
   ```bash
   aws logs put-retention-policy \
     --log-group-name /aws/kafka/cluster-<id> \
     --retention-in-days 90
   ```

### For CONFIG_GAP — no customer-managed KMS key

1. Create a customer-managed KMS key with a restrictive policy.
2. This requires cluster recreation (at-rest encryption key is
   immutable post-creation). Plan a migration similar to the
   NO_ENCRYPTION remediation.
3. On the new cluster, specify:
   ```yaml
   EncryptionInfo:
     EncryptionAtRest:
       DataVolumeKMSKeyId: arn:aws:kms:us-east-1:111111111111:key/<cmk-id>
   ```

### For OK

1. No remediation required for the current posture.
2. Recommend periodic re-audit (quarterly) as Kafka versions and MSK
   features evolve.
3. Consider enabling Open Monitoring (Prometheus) for deeper operational
   visibility if not already configured.
4. Verify the MSK configuration properties do not include
   `auto.create.topics.enable=true` or
   `unclean.leader.election.enable=true` (these are not visible in
   describe-cluster output — fetch separately with
   `aws kafka describe-configuration`).

## Recent AWS features (2024-2026)

Recent AWS features (2024-2026) affecting audit verdicts: moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).
Consult before auditing Serverless, Express-tier, or KRaft clusters.

## Domain

AWS CloudOps / MSK Analytics Security & Compliance.

## AWS documentation

- **Amazon Managed Streaming for Kafka Developer Guide** — https://docs.aws.amazon.com/msk/latest/developerguide/what-is-msk.html
- **MSK API Reference** — https://docs.aws.amazon.com/msk/latest/APIReference/
- **MSK Security** — https://docs.aws.amazon.com/msk/latest/developerguide/security.html
- **MSK CLI Reference** — https://docs.aws.amazon.com/cli/latest/reference/kafka/
- **MSK Serverless** — https://docs.aws.amazon.com/msk/latest/developerguide/serverless.html

## References (load on demand)

- [references/advanced-patterns.md](references/advanced-patterns.md) — Step 0 expert-knowledge catalog (non-obvious MSK behaviors that change classification) and recent AWS features (2024-2026).
- [references/diagnostic-commands.md](references/diagnostic-commands.md) — Pre-flight safety checks to run before any remediation CLI.


