Replace your SSH bastion host

The Formal Connector runs in your VPC where the bastion used to be. Engineers SSH in as their own SSO identity, the Connector holds the host credentials, and every SSH and AWS SSM session is checked by policy, recorded and scored for risk.

ssh · prod-api-1example
# maya@acme.com through the Connector, session recorded
ALLOW  session  shell on prod-api-1
BLOCK  session  port forward to db.internal:5432
VERIFY session  git push acme/infrastructure.git, MFA required
# host key held by the Native User, never sent to the laptop

Why now

What does an SSH bastion host miss?

An SSH bastion host narrows the network path to one hardened machine, which is still worth doing. It doesn’t know which person should reach which host, it keeps no record of what happens after the login unless you add one, and the target server usually sees one shared account. When an incident review asks who ran a command on a production host, the bastion’s logs rarely answer it.

  1. One shared account on every target

    The target host sees ec2-user, not the engineer who hopped through the bastion to get there.

  2. No record past the login

    The bastion logs the login and the next address. With ProxyJump it only relays encrypted bytes, and there's no clean way to end a live session.

  3. Every host one ssh away

    Keys and forwarded agents sit on the hop, and any host the security group allows is one command away.

today · no policy on the pathexample
01
ec2-user · prod-api-1sudo systemctl stop apiALLOWED
02
maya · ProxyJumpssh -J bastion prod-db-2ALLOWED
03
leo · ssh -L5432:db.internal:5432 via bastionALLOWED

# The bastion logged three logins. It can't say what ran after them.

Bastion vs Connector

What an SSH bastion host does, and what it misses

An SSH bastion host is the one hardened server your private hosts accept SSH from. Engineers connect to it and hop on to the target, either by running a second ssh from a shell on the bastion or by tunneling through it with ProxyJump. That shrinks the network path to one machine. It doesn’t decide which person reaches which host, and with ProxyJump it only relays encrypted bytes. The setup, the hardening checklist and the AWS and Azure managed options are in what a bastion host is. The table compares the two on the questions an incident review asks.

SSH bastion hostFormal Connector
Who the target host seesThe account the hop logs in as, often one shared ec2-userA Native User account, with the person's Formal identity on the session
What gets recordedLogins to the bastion, unless you wrap shells in script and turn forwarding offThe terminal of every session, its commands, a 1 to 5 risk level and a summary
Which hosts a person can reachAny host the bastion's security group allowsWhat session policies allow: by host, EC2 tag, ECS task or remote command
Where host credentials liveOn laptops, or on the bastion itselfOn the Connector, as Native Users
Ending a session in progressFind the process on the bastion and kill itTerminate in Sessions, or a policy that suspends the session or quarantines the user
EC2 and ECS FargateInbound port 22 from the bastionAWS SSM, no inbound port
Port forwards and VS Code Remote SSHNeed TCP forwarding, which a recorded bastion turns offEach forward is its own session with its own policy decision

Setup

How it works

  1. Step 1 of 4

    Put the Connector where the bastion was

    Add an SSH resource per host, or reach EC2 and ECS Fargate through AWS SSM. A Native User on the Connector holds each host credential.

    SSH RESOURCESexample
    • prod-api-1 over SSH✓
    • i-0abc12 (EC2) over AWS SSM✓
    • orders task (ECS Fargate) over AWS SSM✓
  2. Step 2 of 4

    Engineers connect as themselves

    Users SSH to the Connector with their Formal identity and their access token or the Endpoint key at ~/.formal/id_rsa. The Endpoint writes ~/.ssh/config for them.

    WHO CONNECTSexample
    • maya@acme.com · SSOPERSON
    • ~/.ssh/config written by the EndpointENDPOINT
    • prod-api-1 key · Native UserNEVER SHOWN
  3. Step 3 of 4

    Policies decide each session

    Rego reads the command, shell or SFTP, port forward destination and EC2 or ECS attributes, then allows, blocks or asks for MFA.

    SESSION POLICYexample
    • shell on prod-api-1ALLOWED
    • port forward to db.internal:5432BLOCKED
    • new rule · refuse machine usersDRY RUN
  4. Step 4 of 4

    Review, score and stop sessions

    Recordings, commands, risk levels and summaries land in Sessions. Admins can terminate an active session there.

    SESSIONSexample
    • prod-api-1 · risk 4 of 5RECORDED
    • i-0abc12 over SSM · risk 1 of 5RECORDED
    • contractor session · TerminateBLOCKED

Bastion alternative

How the Connector works as a bastion host alternative

We built the Formal Connector as a protocol-aware reverse proxy you deploy in your VPC, so it can sit exactly where the bastion sat. The login user is the engineer’s Formal identity, and the remote command tells the Connector which resource to open. This is the plain form from the SSH and AWS SSM guide.

  • In practice the Formal Endpoint writes those entries into ~/.ssh/config, and the password is the user’s Formal access token or the key the Endpoint keeps at ~/.formal/id_rsa
  • The Connector terminates that connection and opens its own: over SSH to a Linux host, or over AWS SSM to an EC2 instance or an ECS Fargate container. Because the terminal stream goes through it, it sees the commands, which a jump host reached with ProxyJump never does
  • The same Connector handles your databases and Kubernetes clusters and brokers RDP, so one identity and one policy language cover all of them
  • Two limits to know up front. On laptops, Transparent Mode runs on macOS and Linux only. And RDP goes through the same identity and session policies, but the recording, risk scores and summaries on this page are for SSH
Connect to the Connector ›
ssh through the Connectorbash
ssh -t -p [CONNECTOR_LISTENER_PORT] \
  'idp:formal:human:john@joinformal.com'@[CONNECTOR_HOSTNAME] \
  formal connect ssh --instance-name [RESOURCE_NAME]

Capabilities

SSH access management on the path

The Connector ends each SSH session itself, so every session is tied to a person, checked against policy and recorded.

Recordings

How do you summarize production SSH session recordings with AI?

Formal summarizes SSH session recordings for you. For each SSH session through the Connector, Sessions keeps a full terminal recording you can pause, rewind and fast-forward, the commands extracted from it, a plain-language summary of what the user did, and a risk level from 1 to 5. Triage starts from the summary; the replay is there when the summary raises a question.

  • Level 1: ran ls, pwd and read non-sensitive files
  • Level 3: service restarts and system configuration changes
  • Level 4: privilege escalation attempts, sensitive files touched or suspicious downloads
  • Level 5: payload execution, exfiltration attempts and credential theft
  • Kubernetes exec sessions get the same recording and scoring
Privileged session recording for both protocols ›
ssh · prod-api-1recording · 9m 37s
maya@acme.comrisk4/5
  1. 10:02:11df -h
  2. 10:03:40sudo su -
  3. 10:05:02curl -O http://203.0.113.7/tool.sh
  4. 10:11:48exit
SummaryChecked disk usage, tried to switch to root, then downloaded a script from an unknown host.
Live control

Stop a risky SSH session while it runs

Session policies run when an SSH connection opens and, for SSH and Kubernetes exec, again while the session runs (enforcement docs). Two actions are meant for the second case, and they differ in how far they reach.

  • suspend: ends that one session. The user can reconnect
  • quarantine: ends every active session the user has and blocks them. They can’t open SSH, Kubernetes or RDP sessions until an admin opens the user in Users and clicks Unblock User
  • At session start, either action just refuses the new session; nobody gets blocked
  • An admin can also stop a session by hand from its page in Sessions with Terminate, which aborts whatever command is in flight, or block a user directly with Block User
  • We’d run any rule that can end sessions in dry-run first and backtest it on retained traffic. A quarantine rule that matches too broadly locks engineers out of production in the middle of an incident
sessions · productionexample
15:20:04maya@acme.comssh prod-api-1RECORDED
15:31:12policy · suspendmaya's session on prod-api-1 endedBLOCKED
15:40:55policy · quarantineevery session of contractor@acme.com endedBLOCKED
Credentials

Do engineers still need SSH keys or certificates?

Engineers don’t need SSH keys for the hosts behind the Connector. Each host credential is a Native User on the Connector: a username with a password, or with a private key and an optional CA-signed SSH certificate. Engineers sign in to Formal through your SSO provider, authenticate to the Connector as idp:formal:human:<email>, and never receive the host credential.

  • The secret can be stored in Formal, read from Connector environment variables, or fetched by a hook at connection time, after policy has allowed the session
  • A default selection rule picks the Native User for each identity, so admins can land on a privileged account and everyone else on a read-only one. The host still sees admin or readonly, and Formal knows which person each session belongs to
  • That turns the SSH user key sprawl NIST IR 7966 describes into a short list of Native User credentials
  • The one exception is Transparent Mode on the Endpoint, covered below, where engineers keep using their own keys against the real host
ssh · prod-api-1example
10:14:03maya@acme.comsign in as idp:formal:human:maya@acme.comALLOWED
10:14:03connectorreadonly key from the Native UserTOKEN INJECTED
10:14:04maya@acme.comshell on prod-api-1 as readonlyRECORDED

Triage

Pull the high-risk SSH sessions from Logs

The Sessions list shows the risk level inside each session but can’t filter on it. Logs can, with the query from the docs.

Sessions and recordings docs ›
logs searchtext
resource.technology:ssh AND event_type:session-analysis AND session.analysis.data.riskscore:>=4

Works with

Which SSH tools work through Formal?

The SSH tools engineers already use work through the Formal Connector, with a few client settings from the SSH guide. VS Code and Cursor Remote SSH work for SSH and SSM remotes. scp and sftp work for SSH resources only. rsync works over SSH, and over SSM through an rsync daemon on the host, because of an AWS limitation.

  • ssh
  • SCscp
  • SFsftp
  • RSrsync
  • VSVS Code Remote SSH
  • Cursor Remote SSH
  • Linux hosts over SSH
  • Amazon EC2 over SSM
  • Amazon ECS
Client settings in the SSH and AWS SSM guide ›

Session policy

Policies per host, per command and per port forward

A bastion decides on network addresses. A session policy in Formal reads the request. The command field is how a policy tells a git push from a clone over SSH: a push runs git-receive-pack and a clone runs git-upload-pack, each naming the repository. This rule from the docs asks for MFA before anyone pushes to one repository.

  • For EC2, a policy can match the instance ARN and tags; for ECS, the cluster ARN, service ARN, task ID, task tags and container name
  • For every SSH resource, the SSH object says whether the client asked for a shell, a terminal or an SFTP transfer, and carries the remote command exactly as the client sent it
  • Port forwards are decided one by one. Each ssh -L or ssh -D forward is a session of its own, with the destination host and port in the policy input, so a rule can allow the shell and block a tunnel to db.internal:5432 on the same connection
  • Over SSM, the Connector only forwards to the instance itself (localhost, 127.0.0.1 or ::1), because AWS’s port-forwarding document only reaches ports on the instance. Reverse forwards (ssh -R) aren’t supported
SSH policy input docs ›
mfa-on-git-push.regorego
package formal.v2

import future.keywords.if

repository := "acme/infrastructure.git"

session := {
	"action": "mfa",
	"message": sprintf("push to %s", [repository]),
} if {
	contains(input.ssh.command, "git-receive-pack")
	contains(input.ssh.command, repository)
}

Beyond the bastion

SSM, laptops and just-in-time SSH access

AWS SSM

EC2 and ECS through AWS SSM Session Manager, no open port 22

AWS SSM Session Manager reaches instances “without the need to open inbound ports, maintain bastion hosts, or manage SSH keys,” as AWS puts it. The Connector uses it for EC2 instances and ECS Fargate containers, signing in to AWS with its own IAM role or with an IAM Role Native User, which is also how one Connector reaches instances in another account.

  • On its own, Session Manager has a gap that matters for audits. Its session logs cover interactive shells, and for SSH over Session Manager, AWS’s note is blunt: “Logging isn’t available for Session Manager sessions that connect through port forwarding or SSH.”
  • With Formal, the engineer’s SSH ends at the Connector, which starts the SSM session itself. An EC2 or ECS session gets the same recording, summary and risk level as any SSH host
  • Making VS Code Remote SSH work over SSM took us down a rabbit hole: we forked AWS’s session-manager-plugin to fix concurrency bugs that broke parallel port forwards, and wrote up how SSH port forwarding over SSM works
SSH and AWS SSM guide ›
ssm · i-0abc12 (EC2)recording · 3m 05s
leo@acme.comrisk1/5
  1. 09:40:02pwd
  2. 09:40:10ls /srv/app
  3. 09:41:30cat /srv/app/README
  4. 09:43:07exit
SummaryMoved around the app directory and read a non-sensitive file. No privileged commands.
Transparent Mode

Keep typing ssh against the real host

If engineers should keep typing ssh against the real host, use Transparent Mode instead. On macOS and Linux, the Endpoint intercepts ssh, scp and sftp with the user’s own keys and applies the same session policies, with no Connector in the path.

  • A network rule picks the traffic it watches, for example everything on port 22. Once a rule matches SSH, the Endpoint refuses any connection it can’t proxy; it never lets one through unwatched
  • Native Users, SSM and the formal connect commands stay Connector-only
  • Coding agents get the same treatment. Transparent Mode can tell an agent from a person by process, which lets a policy block agent pushes to sensitive repositories while engineers push as usual, a useful layer under command allowlisting in Claude Code
Formal Endpoint ›
endpoint · maya's laptopexample
agentcoding agent for mayagit push acme/infrastructure.gitBLOCKED
terminalmaya@acme.comgit push acme/infrastructure.gitALLOWED
terminalmaya@acme.comssh prod-api-1 with her own keyALLOWED
Audit and just-in-time

SSH audit log and just-in-time SSH access

Every SSH session lands in Logs under the person’s Formal identity: the login or failed login, the policies evaluated, the actions taken, the end of the session and its risk analysis. Log integrations forward the same records to your SIEM, so the SSH audit log sits next to your database and Kubernetes logs instead of in each host’s auth.log.

  • Most bastions end up granting standing access to production. Our preference is a session policy that blocks production SSH by default, with exceptions granted as policy suspensions
  • Each suspension lifts one policy for one user or group, one-off or time-bound, optionally narrowed by a CEL condition on the request. It carries a reason for the audit trail, and deleting it revokes it at once
  • Engineers ask for one in Access Requests, for 30 minutes to 7 days, or through a Slack approval built with Workflows. Just-in-time access explains the model behind it
  • At Cursor, SSH runs through Formal next to PostgreSQL, Redis, ClickHouse and Kubernetes, with no standing production access: engineers get just-in-time access, scoped to the job in front of them
Just-in-time access in Workflows ›
slack · #prod-sshexample
FormalAPP
leo requests SSH to prod-api-1 for one hour
Resource
prod-api-1
Policy
block-prod-ssh
Scope
1 hour
sam approved. The suspension lifts block-prod-ssh for Leo, then expires.
APPROVED

Deployment and enterprise

SSH access that uses the identity, logging and IaC you already run

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 ›

Formal Endpoint on laptops

Writes ~/.ssh/config for Connector access, and runs Transparent Mode on macOS and Linux. Roll it out to Macs with your MDM.

Endpoint 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.

SSH access is part of Formal’s privileged access management software. The same Connector proxies your databases and Kubernetes clusters and brokers RDP, the Endpoint covers laptops in Transparent Mode, and the Control Plane holds the policies, recordings and logs for all of them.

In production

Resources secured
1,000+
Sessions per week
600K+
“What I love about Formal: while it's very powerful and does a lot of things, when you actually dig, it does those things.”
Travis McPeak
Travis McPeak
Head of Security, Cursor
Read the Cursor story ›

FAQ

Questions about replacing an SSH bastion host

Buying and fit

Are bastion hosts still used?

Yes. Plenty of teams still run an SSH bastion host, and Azure sells a managed one. What changed is that you no longer need one to reach private hosts: AWS Session Manager and access proxies such as the Formal Connector get there without it. Keep the bastion if the hop is all you need. Replace it when you also need per-person identity and a record of what ran (are bastion hosts still used goes through the trade-off).

Does an SSH bastion host record sessions?

Not on its own. An SSH bastion logs who signed in to it and which address they connected to next. Recording what ran takes extra tooling on the bastion, such as wrapping shells in script, plus turning off the TCP forwarding that ProxyJump and VS Code Remote SSH depend on. The Connector records sessions because it terminates them, so forwarding keeps working and each forward gets its own policy decision.

What is the difference between a bastion host and a jump server?

For SSH access there’s no practical difference: bastion host, jump server, jump box and jump host all name the entry point into a private network. Where people separate them, a bastion is the hardened machine facing attackers and a jump server is any hop between two network zones. Bastion host vs jump server has the longer answer.

Why is SSH considered a risky port?

Port 22 gives a remote shell to anyone with a valid key or password, and MITRE ATT&CK lists SSH with valid accounts as a lateral movement technique (T1021.004). With the Connector in front, you can let your hosts accept SSH from the Connector only, EC2 and ECS need no inbound port over SSM, and each session belongs to a named person.

AI agents

Can AI agents use SSH through Formal?

Yes, under their own identity, and policies can treat them differently from people. The enforcement docs show a rule that refuses SSH sessions from machine users. On laptops, Transparent Mode tells coding agents from people by process, which is how Formal blocks agent git pushes over SSH and HTTPS while pushes from the engineer’s own terminal still go through.

Product

Can Formal record SSH sessions on Amazon EC2 and ECS Fargate?

Yes. EC2 instances need the SSM Agent running and an instance role with AmazonSSMManagedInstanceCore. ECS Fargate services and tasks need ECS Exec enabled. The Connector’s IAM role needs ssm:StartSession, ssm:TerminateSession and the EC2 and ECS describe and execute permissions listed in the SSH and SSM guide.

Is Formal an SSH certificate authority, and does it rotate keys?

No to both. A Native User can present a certificate your own CA signed, next to its private key, and the Connector uses it for every session. Rotation is a manual step: update the Native User’s credential once, instead of on every laptop or every bastion account.

Retire the bastion, keep ssh

One entry point to your hosts, EC2 instances and ECS tasks, with a person, a policy and a recording behind every session.