Classify Session Recordings
Session Classifiers let you define what risky activity means for your organization and monitor completed sessions for those patterns. They evaluate session summaries 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 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.
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 (optional). Teleport Enterprise Cloud includes Access Graph.
- Session Recording Summaries configured and generating summaries successfully.
- Permission to manage
classifierresources. The preseteditorrole grants this access. For a custom role, grantread,list,create,update, anddeleteonclassifier. - 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
- tctl
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.
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.
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
- tctl
- Kubernetes Operator
- Terraform
-
On the Classifiers page, click Add Classifier.
-
Under Details, enter
file-permission-changesas the Name and a description such asIdentify chmod commands in SSH sessions. Names starting withteleport-are reserved for built-in classifiers. -
Under Sessions, select SSH. Leave Filter expression empty to evaluate all summarized SSH sessions.
-
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. -
Under Actions on every match, leave Raise risk floor set to Unchanged, and enable Emit audit event and Flag session for review.
-
Click Save classifier.
After saving the classifier, find it on the Classifiers page. It starts evaluating matching sessions.
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.
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 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
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 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
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
- tctl
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.
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-testexit
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 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.
You can reach out to our Slack community or customer support for help.
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 for classifier match and configuration events.
Next steps
- Use the predicate language reference to find supported operators, functions, and fields for classifier filters.
- Configure Session Recording Search to find summarized recordings by activity, metadata, and severity.
- Manage classifiers with the
teleport_classifierTerraform resource. - Review Identity Security Alerts for detections based on audit activity across Teleport and integrated services.