Privileged session management for SSH, Kubernetes and databases

The Formal Connector sits in the path of every privileged connection. It records SSH and kubectl exec sessions for replay, logs each database query with the person who ran it, scores sessions for risk, and can end a session or block a user while it runs.

sessions · productionexample
# every connection through the Connector is a session
ALLOW   maya@acme.com   ssh prod-api-1 · recorded · risk 4 of 5
AGENT   cloud-agent for sam@acme.com   kubectl exec api-7f · recorded
ALLOW   sam@acme.com   psql prod-postgres · 38 queries logged
BLOCK   contractor@acme.com   quarantined · all sessions ended

Why now

Why record privileged sessions at the proxy?

Admins, on-call engineers and AI agents all open privileged sessions. Every connection through the Formal Connector is a session, from ssh and kubectl exec to a psql login, so privileged session management at the proxy sees each one for what it is: who opened it, over which protocol, and every command or query inside it.

  1. Bastion logs without commands

    A bastion log shows that someone reached a host, and stops there.

  2. Shared database logins

    Database audit settings differ per engine and rarely know which person sits behind a shared login.

  3. Agent sessions with no owner

    An AI agent's session usually looks like any other service account, and the recordings pile up faster than anyone has time to review them.

today · no policy on the pathexample
01
bastion · sshmaya to prod-api-1, no commands loggedALLOWED
02
app_admin · psqlSELECT * FROM patientsALLOWED
03
svc-deploy · kubectlexec -it api-7f -- shALLOWED

# Three privileged sessions, and none of them names a person.

What you get

What is privileged session management?

privileged session managementnoun

Privileged session management (PSM) is the part of privileged access management that records, monitors and controls sessions opened with elevated rights: a root shell on a production host, an exec into a pod, an admin login to a database. Privileged session recording keeps the evidence, and privileged session monitoring acts while the session is still open.
  • Replay SSH and kubectl exec sessions

    Play a terminal session back as it happened, scrub through it, and read the extracted command list beside it. kubectl attach is recorded too; port-forward only gets a log entry.

  • Every database query logged

    Database sessions keep each query’s text, bind parameters, execution time and rows affected, plus what policy did to it: a mask, a denial or a warning.

  • Risk scored from 1 to 5

    Formal analyzes recorded SSH and Kubernetes sessions, writes a plain-language summary and assigns a risk level, so reviewers open privilege escalation and credential access first.

  • Sessions stopped while they run

    Session rules re-evaluate during SSH and kubectl exec sessions. Suspend ends one session. Quarantine closes everything the user has open and keeps them out until an admin lifts the block.

  • Agent sessions tied to a person

    An agent connects as a machine user and can pass the end user it acts for. Sessions filters by that end user, so you find every session an agent opened on someone’s behalf.

  • Session logs in your SIEM

    A session is a grouping of logs. Forward them to S3, Google Cloud Storage, Pub/Sub, Azure Blob Storage, Datadog, Splunk or Panther for alerting and long-term retention.

What gets recorded

What Formal records in each privileged session

A screen video is a fine record of a remote desktop. Infrastructure protocols carry more than a screen: the command a client asked an SSH server to run, the pod and container behind an exec, the SQL text and bind parameters of a query. We record at that level because the Connector parses each protocol on its way through. A session is one TCP connection through the Connector, and sessions are a view over Logs, so every query, command and policy decision inside one stays searchable by its session.id.

  • SSH and AWS SSM

    Full terminal recording, extracted commands, a summary and a risk level from 1 to 5, with pause, rewind and fast-forward. SSH session recording covers what the Connector captures over SSH and SSM.

    Replay
  • kubectl exec and kubectl attach

    Pod and container, commands executed, user identity and risk analysis. An interactive kubectl exec is the part of Kubernetes access that gets a recording.

    Replay
  • kubectl port-forward and other Kubernetes API requests

    A log entry per request, with no replay.

    Log entry
  • Databases (Postgres, MySQL, MongoDB, Snowflake and others)

    Query text, bind parameters, execution time, rows affected and policy actions. There’s no replay: it’s a query history.

    Query history
  • HTTP and APIs

    Path and method, headers, request and response bodies, and status codes, with no replay.

    Request log

Each session moves through its own events: session-start when the TCP connection opens, session-login or session-login-failed when the user authenticates to the resource, session-end when it closes and, for SSH and Kubernetes, session-analysis with the risk score. Every session also carries its user, resource, protocol, start and end time, number of queries or commands, the policies that ran, the actions they took, the client IP and the client application (psql, Looker, an ssh client). A failed login is a session too, which makes event_type:session-login-failed one of the more useful searches during an incident. The sessions docs list each field.

Setup

Set up privileged session recording

  1. Step 1 of 4

    Put the Connector in the path

    Run the Connector in your VPC, then send ssh, kubectl and database clients to its hostname. People sign in with SSO; agents connect as machine users.

    IN THE PATHexample
    • ssh clients point at the Connector✓
    • kubectl points at the Connector✓
    • psql points at the Connector✓
  2. Step 2 of 4

    Add resources and native users

    Register hosts, clusters and databases as resources. A native user holds each credential on the Connector, so nobody in the session sees it.

    NATIVE USERSexample
    • prod-api-1 · SSH keyHOST
    • eks-prod · AWS IAM RoleCLUSTER
    • prod-postgres · readonlyDATABASE
  3. Step 3 of 4

    Write session policies

    Decide who can open which session, and when to require MFA, suspend or quarantine. Run a new policy in dry-run before you enforce it.

    SESSION POLICIESexample
    • maya · ssh prod-api-1ALLOWED
    • contractor · ssh productionBLOCKED
    • new quarantine ruleDRY RUN
  4. Step 4 of 4

    Review sessions and export the logs

    Replay recordings and read query histories in Sessions, and forward the logs to your SIEM or storage for alerting and retention.

    SESSIONSexample
    • ssh prod-api-1 · risk 4 of 5RECORDED
    • kubectl exec api-7fRECORDED
    • psql prod-postgres · 38 queriesALLOWED

Capabilities

What privileged session monitoring covers

SSH and kubectl exec

Read the summary, then open the replay

Session analysis lists the commands, summarizes the session in plain language and gives it a risk level. A reviewer reads the summary and replays the sessions that need a closer look, with pause, rewind and fast-forward in Sessions.

  • Risk 4: privilege escalation attempts, sensitive file access, suspicious downloads, reconnaissance
  • Risk 5: malicious payloads, exfiltration attempts, backdoors, credential theft
ssh · prod-api-1recording · 6m 42s
maya@acme.comrisk4/5
  1. 11:20:03ssh prod-api-1
  2. 11:21:15sudo -i
  3. 11:22:40cat /etc/shadow
  4. 11:26:45exit
SummaryOpened a root shell and read /etc/shadow: privilege escalation and sensitive file access.
While it runs

Privileged session monitoring while the session runs

For SSH and kubectl exec sessions, Formal re-evaluates session rules while the session runs, and a rule that matches can require MFA, end that one session or quarantine the user. Other protocols get their session decision when the connection opens, then request and response policies on each query or API call where the protocol supports them.

  • Session analysis gives each recorded SSH and Kubernetes session a summary and a risk level. Few teams can watch a week of recordings end to end, but most can read the summary of every session scored 4 or 5
  • To stop a session by hand, an admin opens it in Sessions and clicks Terminate. In-flight queries and commands are aborted
sessions · productionexample
11:20:03maya@acme.comssh prod-api-1RECORDED
11:27:10session-analysisrisk 4 of 5 · privilege escalationREVIEW
11:31:02admin · Terminatecontractor session on prod-api-1 endedBLOCKED
Databases

Database sessions are kept as queries

A Postgres or Snowflake session has no terminal to replay. Formal keeps what an investigation needs instead: each query, how long it ran, how many rows it touched and what policy did to it.

  • Client: psql, Looker or the app that opened the connection, with its IP address
  • Search: every event in the session is in Logs under its session.id
Database access management ›
session · psql · prod-postgresexample
sam@acme.com> SELECT id, email FROM users LIMIT 50
idemail
1042s***@example.com
1043d***@example.com
1044k***@example.com
3 rows · policy mask-email-by-labelMASKED
AI agents

Sessions opened by AI agents

An agent with production access opens the same kinds of sessions an engineer does, and without its own identity it shows up as a shared service account. In Formal, the agent gets a machine user that policies treat like any person, signing in with a short-lived OIDC token where the platform issues one (Cursor and Devin are among the built-in issuers).

  • The machine user can pass the end user it acts for, and the End User filter in Sessions finds every session opened on that person’s behalf
  • We’d fix attribution before adding more recording. A replay of a root shell under a shared account shows what happened and leaves out who asked for it, which is the first thing an incident review needs
  • Agent identity covers how agents get their own credentials
  • At Cursor, Formal secures SSH, PostgreSQL, Redis, ClickHouse and Kubernetes, and ties each cloud agent’s activity back to the employee who started it
AI agent identity ›
sessions · end user sam@acme.comexample
09:12:40cloud-agent for sam@acme.comkubectl exec api-7fRECORDED
09:14:02cloud-agent for sam@acme.compsql prod-postgres · 12 queriesALLOWED
09:15:30sam@acme.comssh prod-api-1RECORDED

Stop a session

Stopping a session with suspend and quarantine

Two session-stage actions end SSH and kubectl exec sessions. suspend ends one session, and the user can reconnect. quarantine is the heavier one. Matched in a running session, it closes every session the user has open, and no new SSH, Kubernetes or RDP session opens for them until an admin lifts the block from the user’s page in Users. This policy is the quarantine example from the enforcement docs.

  • The timing changes the outcome. If the rule matches as an SSH session starts, Formal refuses that session and the contractor isn’t blocked. If it matches during a running session, the contractor loses every open session and stays blocked
  • The message is what the client sees, and the reason goes into the logs for the audit
  • The mfa action is the softer step: users running the Formal Endpoint verify on their device first
  • Put any new session policy in dry-run and read its matches in Logs before you enforce it
Quarantine action in the enforcement docs ›
quarantine-contractors.regorego
package formal.v2

import future.keywords.if
import future.keywords.in

session := {
  "action": "quarantine",
  "message": "Your access is paused. Contact the security team.",
  "reason": "Contractors cannot open SSH sessions to production"
} if {
  input.resource.technology == "ssh"
  input.resource.environment == "production"
  "contractor" in input.user.groups
}

Session recording vs DAM

Session recording vs database activity monitoring

Database activity monitoring (DAM) watches databases. Privileged session management watches people and agents with elevated access across hosts, clusters and databases. If databases are your only concern, start with what a database activity monitoring record holds. If you also want to decide on each query before it runs, see database access management.

Database activity monitoringPrivileged session management
What it watchesDatabasesPeople and agents with elevated access across hosts, clusters and databases
At the databaseA record of each queryA query log with an identity on every line, which is also what a DAM record holds
Hosts and clustersOutside its scopeSSH and kubectl exec sessions recorded for replay

Audit

How do you audit privileged sessions?

Auditing privileged sessions in Formal starts in Sessions, filtered by user, end user, resource, technology, connector, space, IP address or time range. From a session, Logs shows every event inside it. The audit trail is the recording or query history, for what happened, plus the policy results, for what was allowed, masked or denied. One limit to plan for: the Sessions table shows status and risk level but can’t filter on either. To pull high-risk SSH sessions, query Logs instead.

  • For retention and alerting, the docs recommend exporting session logs to your warehouse or SIEM. Log integrations send them to S3, Google Cloud Storage, Pub/Sub, Azure Blob Storage, Datadog, Splunk or Panther, and your SIEM’s rules can then page on a risk score of 4 or a failed login
  • At Notion, Formal logs flow into Notion’s SIEM
  • Session records support audit evidence; they don’t make you compliant on their own. NIST SP 800-53 Rev. 5 lists session audit as its own control (AU-14) in the Audit and Accountability family, and whether you meet it still depends on your processes
  • For our own audits (SOC 2 Type II, ISO/IEC 27001), see security.formal.ai
Logs and log search docs ›
logs searchtext
resource.technology:ssh AND event_type:session-analysis AND session.analysis.data.riskscore:>=4

Works with

Works with the protocols your admins use

Recorded where there’s a terminal, logged where there’s a query. The Connector parses each protocol, so what a session keeps depends on what the protocol carries, and clients such as ssh, kubectl, psql and VS Code Remote SSH keep working.

Deployment and enterprise

Runs in your network, next to your hosts and databases

Session records that fit your audit stack.

Formal Connector in your VPC

Linux on AMD64 or ARM64: AWS ECS Fargate behind a Network Load Balancer, or Helm on EKS, GKE, AKS or on-premises Kubernetes. In production, run 2 or more nodes behind a load balancer.

Deployment docs ›

Your identity provider

People sign in with SSO, and SCIM keeps users and groups in sync. Policies use the groups you already manage.

Logs in your SIEM

Log integrations forward Formal logs to AWS S3, Google Cloud Storage, Azure Blob Storage, Datadog, Splunk or Panther.

Policy and configuration as code

Policies are written in Rego. Manage Formal with Terraform, Pulumi or the Kubernetes Operator.

Audited controls

Formal holds SOC 2 Type II and ISO/IEC 27001. The reports are on security.formal.ai.

Session recording is one part of our privileged access management software, built on the Formal Connector. SSH access replaces the bastion host, Kubernetes access puts a policy on every API request, and database access decides on each query. To remove standing access as well, just-in-time access grants time-bound exceptions approved in Slack.

In production

Logs per week
40M+
Sessions per week
600K+
“We've limited the amount of data that those cloud agents can access and we're able to tie that back to the specific user who is using that cloud agent, which is a feature that I'm only aware of Formal having.”
Roy Xu
Roy Xu
Software Engineer, Security, Cursor
Read the Cursor story ›

FAQ

Questions about privileged session management

Buying and fit

What is the difference between privileged session monitoring and recording?

Privileged session recording tells you what happened once the session is over. Privileged session monitoring is about the session that’s still open, so a team that only records learns about a risky command at review time. Formal writes the record as the session runs and can end the same session from a policy or by hand, the step usually called a kill session.

What does PSM mean in CyberArk?

CyberArk’s documentation uses PSM for its Privileged Session Manager component. Outside CyberArk, PSM is the general category of tools that record, monitor and control privileged sessions. Formal is one of them, and records at the protocol level through the Connector.

Is privileged session management the same as PASM?

PASM, privileged account and session management, is the wider category: it adds the accounts and credentials behind the sessions. In Formal, the account side is the native user, which holds the host, cluster or database credential on the Connector and injects it, so people and agents never receive it.

How do you compare PAM session recording features?

Ask each vendor which protocols get a replay and which only a log, whether database sessions keep query text and parameters, whether an agent’s session names the person it acts for, and how a session is stopped while it runs. Our PAM solutions comparison has a session recording column for each of the ten tools it covers, Formal included.

Product

How does AI risk scoring work for privileged sessions?

Formal scores recorded SSH and Kubernetes sessions from 1 to 5 based on the commands and actions in them. Level 1 is navigation and reading non-sensitive files; 3 covers system configuration, database operations, user management and service restarts. The score ranks sessions for review; ending one takes a session policy or an admin.

Does Formal record RDP sessions?

RDP recording isn’t part of what we document today. Formal brokers RDP connections with identity and session-level policy (allow, block or MFA), and a quarantined user can’t open RDP sessions until an admin unblocks them. Recording and replay cover SSH, AWS SSM and kubectl exec and attach.

See every privileged session

Recorded SSH and kubectl exec sessions, query-level database logs and agent sessions tied to a person, from one Connector.