{"token_count": 3981}

# Classify Session Recordings

Identity Security is available only with Teleport Enterprise.

**Session Classifiers** let you define what risky activity means for your organization and monitor completed sessions for those patterns. They evaluate [session summaries](https://goteleport.com/docs/ver/19.x/identity-security/session-summaries.md) against built-in or custom natural-language criteria, such as data exfiltration or persistent access outside Teleport. When a session matches, a classifier can raise its risk level, flag the recording for review, or emit an audit event.

This guide walks through the built-in classifiers and shows you how to create and test a custom classifier for file permission changes.

## How it works

An [inference policy](https://goteleport.com/docs/ver/19.x/identity-security/session-summaries.md#step-34-set-up-an-inference-policy) is a dynamic Teleport resource that selects which completed sessions Teleport summarizes and which model generates each summary. For each successful summary, Teleport runs every enabled classifier whose session kinds and optional filters match the session.

Each classifier evaluates the summary and any available command or desktop event analysis, rather than the full session recording. Teleport saves matches with the summary, along with the model's reasoning, matched rules, and applied actions. A session can match multiple classifiers.

Classifiers use the same inference provider and model as the summary, selected by the inference policy's `spec.model` field. A policy that references `teleport-cloud-default` uses Teleport's managed model. A policy that references a custom inference model uses its configured OpenAI-compatible or Amazon Bedrock provider model. Classifiers have no separate model setting.

Classifiers match on the type of session recording summaries and any optional filters you define. The available actions for classifiers include:

| Action                  | Effect on a match                                                                                                  |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Raise risk floor        | Raises the session's risk level and score to at least the selected level. It never lowers the existing risk level. |
| Emit audit event        | Emits a `classifier.matched` audit event.                                                                          |
| Flag session for review | Marks the session summary as needing further review.                                                               |

Risk floors and review flags require a structured summary. Classifiers can still record matches and emit audit events for database summaries and shell summaries that fall back to plain text.

Creating or editing a classifier applies it to new summaries. Existing summaries are not reclassified.

Classifiers analyze completed sessions. They cannot block commands or terminate active sessions.

---

NOTE

A language model can miss activity or report incorrect matches. Check the match reasoning and recording when investigating a session.

---

## Prerequisites

- A Teleport Enterprise cluster running v19.0.0 or later with Identity Security enabled.
- To display classifier statistics, configure [Access Graph](https://goteleport.com/docs/ver/19.x/identity-security/access-graph.md) (optional). Teleport Enterprise Cloud includes Access Graph.
- [Session Recording Summaries](https://goteleport.com/docs/ver/19.x/identity-security/session-summaries.md) configured and generating summaries successfully.
- Permission to manage `classifier` resources. The preset `editor` role grants this access. For a custom role, grant `read`, `list`, `create`, `update`, and `delete` on `classifier`.
- Permission to view the session recordings used to verify your classifier.
- An SSH server connected to Teleport where you can run a test session.

## Step 1/3. Review the built-in classifiers

Teleport enables these built-in classifiers by default:

| Classifier (Web UI)      | Activity detected                                               | Risk floor |
| ------------------------ | --------------------------------------------------------------- | ---------- |
| `credential-access`      | Reading or retrieving credentials, keys, or secrets.            | High       |
| `data-exfiltration`      | Moving data out of the environment or staging it for transfer.  | Critical   |
| `destructive-actions`    | Destructive or irreversible operations.                         | High       |
| `persistence`            | Establishing persistent access outside Teleport's control.      | High       |
| `privilege-escalation`   | Gaining privileges during a session.                            | High       |
| `secrets-exposed-inline` | Exposing secrets in plaintext session input or output.          | Medium     |
| `user-frustration`       | Repeated failures or other signs that a user or agent is stuck. | Low        |

The built-in classifiers apply to SSH, Kubernetes, and database sessions. `persistence` applies only to SSH and Kubernetes sessions.

All except `user-frustration` also emit audit events and flag sessions for review. Risk and review actions require structured summaries, as described above.

The Web UI hides the `teleport-` prefix in built-in resource names. For example, `credential-access` in the UI is `teleport-credential-access` in `tctl`.

**Web UI**

In the Teleport Web UI, navigate to Audit > Session Recordings. Click **Manage** on the Session Summaries status in the page header, then select Classifiers under Summarization & AI. The page lists built-in and custom classifiers.

![Built-in session classifiers and their configured actions](/docs/assets/images/session-classifiers-b3474ca546edee221106c8b330e583a5.png)

Select a classifier to see its criteria and actions. Click **Disable** to stop evaluating it, or **Enable** to turn it back on.

To change a built-in classifier's criteria or actions, click **Duplicate** and edit the copy under a new name. If the original is enabled, the form lets you disable it when you save the copy. Keep that option selected if the copy should replace the original. If both are enabled, a session can match both.

**tctl**

List all built-in and custom classifiers:

```
$ tctl get classifier
```

Use the full resource name to inspect a built-in classifier:

```
$ tctl get classifier/teleport-credential-access
```

## Step 2/3. Create a custom classifier

You can create a custom classifier to find activity that matters to your organization. As an example, create `file-permission-changes` to detect `chmod` commands in SSH sessions. It emits an audit event and flags matching sessions for review. These criteria also match harmless permission changes.

**Web UI**

1. On the Classifiers page, click **Add Classifier**.

2. Under Details, enter `file-permission-changes` as the Name and a description such as `Identify chmod commands in SSH sessions`. Names starting with `teleport-` are reserved for built-in classifiers.

3. Under Sessions, select SSH. Leave Filter expression empty to evaluate all summarized SSH sessions.

4. Under Criteria, enter:

   ```
   Flag sessions where the user changes file or directory permissions using
   chmod. Match numeric and symbolic permission changes. Do not match commands
   that only inspect permissions, such as ls -l or stat.

   ```

5. Under Actions on every match, leave Raise risk floor set to Unchanged, and enable Emit audit event and Flag session for review.

6. Click **Save classifier**.

![Create classifier form with session kinds, criteria, and match actions](/docs/assets/images/create-session-classifier-da25058b04d107594c7cbac2a4312c4c.png)

After saving the classifier, find it on the Classifiers page. It starts evaluating matching sessions.

**tctl**

Create a file named `file-permission-changes.yaml` with the following content:

```
kind: classifier
version: v1
metadata:
  name: file-permission-changes
  description: Identify chmod commands in SSH sessions
spec:
  kinds:
    - ssh
  criteria: >-
    Flag sessions where the user changes file or directory permissions using
    chmod. Match numeric and symbolic permission changes. Do not match commands
    that only inspect permissions, such as ls -l or stat.
  actions:
    emit_audit_event: true
    flag_for_review: true

```

Create the classifier:

```
$ tctl create file-permission-changes.yaml
```

Check its configuration:

```
$ tctl get classifier/file-permission-changes
```

If the command reports that the classifier does not exist, check that you created it in the same cluster you are querying. You must create `file-permission-changes` before running this command; it is not built in.

**Kubernetes Operator**

If you use the Teleport Kubernetes Operator, create a file named `file-permission-changes.yaml` with this custom resource:

Visit the [Teleport Kubernetes Operator setup guide](https://goteleport.com/docs/ver/19.x/configuration/teleport-operator.md) to get started with the operator.

```
apiVersion: resources.teleport.dev/v1
kind: TeleportClassifierV1
metadata:
  name: file-permission-changes
  annotations:
    description: Identify chmod commands in SSH sessions
spec:
  kinds:
    - ssh
  criteria: >-
    Flag sessions where the user changes file or directory permissions using
    chmod. Match numeric and symbolic permission changes. Do not match commands
    that only inspect permissions, such as ls -l or stat.
  actions:
    emit_audit_event: CLASSIFIER_ACTION_MODE_ENABLED
    flag_for_review: CLASSIFIER_ACTION_MODE_ENABLED

```

Apply the custom resource:

```
$ kubectl apply -f file-permission-changes.yaml
```

**Terraform**

After configuring the Teleport Terraform provider, add a `teleport_classifier` resource to your Terraform configuration. This example detects potentially destructive commands in SSH and Kubernetes sessions on resources labeled `env: test`. It emits an audit event for each match and raises the risk floor to Critical when the destroyed resource was a backup or snapshot.

Visit the [Teleport Terraform provider setup guide](https://goteleport.com/docs/ver/19.x/configuration/terraform-provider/terraform-getting-started.md) to get started with the Terraform provider.

```
resource "teleport_classifier" "example" {
  version = "v1"
  metadata = {
    name        = "example"
    description = "Example classifier"
  }
  spec = {
    kinds    = ["ssh", "k8s"]
    filter   = "equals(resource.metadata.labels[\"env\"], \"test\")"
    criteria = "The user ran a potentially destructive command."
    actions = {
      emit_audit_event = true
    }
    rules = [
      {
        name     = "backups"
        criteria = "The destroyed resource was a backup or snapshot."
        actions = {
          risk_level_floor = "critical"
          emit_audit_event = true
        }
      },
    ]
  }
}

```

Apply the configuration:

```
$ terraform apply
```

See the [`teleport_classifier` resource reference](https://goteleport.com/docs/ver/19.x/reference/infrastructure-as-code/terraform-provider/resources/classifier.md) for all supported fields.

### Narrow the sessions evaluated

A classifier's filter expression selects sessions by resource, user, or session metadata, using the same predicate language and matching context as an inference policy. For example, the following filter selects resources with the label `env: prod`:

```
equals(resource.metadata.labels["env"], "prod")

```

In YAML, set this expression in `spec.filter`. The filter selects sessions to evaluate. The natural-language criteria describe the activity to look for.

### Add actions for a subset of matches

Use a sub-rule to add actions for some matches. For example, flag all file permission changes for review, then raise the risk floor to High for changes on production resources.

**Web UI**

In the creation form, click **Add rule**, name it `production`, set its Filter expression to `equals(resource.metadata.labels["env"], "prod")`, and set Raise risk floor to High. Leave Additional criteria empty to apply the rule to every classifier match on those resources. To add this rule to an existing custom classifier, open it and click **Edit**.

**tctl**

In YAML, add this rule under `spec`:

```
rules:
  - name: production
    filter: 'equals(resource.metadata.labels["env"], "prod")'
    actions:
      risk_level_floor: high

```

For an existing classifier, add the rule using:

```
$ tctl edit classifier/file-permission-changes
```

A sub-rule applies when the main classifier matches and the rule's filter and any additional criteria also match. Rule names must be unique within a classifier.

Actions from the main classifier and all matching rules apply together. The highest risk floor wins. An audit or review action stays enabled if any matching rule or the main classifier enables it. Rules cannot undo actions, and their order does not affect the result.

## Step 3/3. Verify a classifier match

Start a new SSH session after saving the classifier. Replace login with your SSH login and server with the name of a connected server:

```
$ tsh ssh login@server
```

In the remote shell, create a test directory, change its permissions, and remove it. The `&&` operators stop the command if creating the directory fails:

```
$ mkdir classifier-test && chmod 700 classifier-test && rmdir classifier-test
$ exit
```

Wait for Teleport to generate the session summary, then open it from Audit > Session Recordings. Under Matched Classifiers, select `file-permission-changes` to inspect Why it matched, any Matched rules, and Applied actions. Check that the match shows Audit event emitted. For a structured summary, it should also show Flagged for review. If you added the `production` rule and the server has the label `env: prod`, check that the risk level is at least High.

To inspect the `classifier.matched` event, open Audit > Audit Log.

---

**CHECKPOINT: The test session matches your classifier**

If the check fails, troubleshoot:

If no match appears, check that the classifier is enabled and its session kinds and filter match the test session. Make sure Teleport generated the summary after you saved the classifier and that the summary describes the permission change.

If the summary shows Classification incomplete, check the error details and inference provider configuration. If risk or review actions are missing, check whether the session has a plain-text summary.

---

## Audit events

When Emit audit event is enabled, each matching classifier emits a `classifier.matched` event after Teleport saves the summary. For example, these fields show a match by the built-in `teleport-secrets-exposed-inline` classifier:

```
{
  "classifier_name": "teleport-secrets-exposed-inline",
  "cluster_name": "teleport.example.com",
  "code": "INF017I",
  "event": "classifier.matched",
  "login": "ubuntu",
  "matched_command_count": 3,
  "risk_level_after": "medium",
  "session_type": "ssh",
  "sid": "11111111-2222-4333-8444-555555555555",
  "time": "2026-10-27T05:24:31.94467207Z",
  "user": "alice",
  "user_cluster_name": "teleport.example.com"
}

```

| Field                   | Meaning                                                                                                      |
| ----------------------- | ------------------------------------------------------------------------------------------------------------ |
| `classifier_name`       | Full resource name of the classifier that matched.                                                           |
| `sid`                   | Session ID used to find the recording.                                                                       |
| `matched_command_count` | Number of analyzed commands that triggered the match. Omitted when zero, including for plain-text summaries. |
| `risk_level_after`      | Risk level attributed to this classifier's match. Omitted when no risk level is assigned.                    |
| `matched_rules`         | Names of sub-rules that applied. Omitted when no sub-rules matched.                                          |

Another matching classifier can raise the session's final risk level above the `risk_level_after` reported by this event.

See the [AI and inference audit event reference](https://goteleport.com/docs/ver/19.x/reference/audit-events/ai-inference.md#classifiermatched) for classifier match and configuration events.

## Next steps

- Use the [predicate language reference](https://goteleport.com/docs/ver/19.x/identity-security/session-summaries.md#predicate-language) to find supported operators, functions, and fields for classifier filters.
- Configure [Session Recording Search](https://goteleport.com/docs/ver/19.x/identity-security/session-summaries/session-search.md) to find summarized recordings by activity, metadata, and severity.
- Manage classifiers with the [`teleport_classifier` Terraform resource](https://goteleport.com/docs/ver/19.x/reference/infrastructure-as-code/terraform-provider/resources/classifier.md).
- Review [Identity Security Alerts](https://goteleport.com/docs/ver/19.x/identity-security/usage/alerts.md) for detections based on audit activity across Teleport and integrated services.
