Teleport: ditch SSH keys, get audited access
Think about the authorized_keys file on your oldest production server. Do you know who owns each key? How many belong to people who no longer work at the company? What exactly did each of them do last Tuesday at 3 a.m.?
If you hesitate on any of those answers, you have the problem Teleport solves. Static SSH keys were a brilliant solution in 1995. Today they’re a security debt that grows quietly with every hire, every departure and every lost laptop. In this post you’ll see how to replace them with ephemeral certificates, how to deploy Teleport step by step, and how to get what classic SSH never gives you: real auditing of who did what.
Why SSH keys no longer scale
A traditional SSH key has three structural flaws.
- It never expires. A key generated six years ago still opens doors today unless someone manually deletes it from every server.
- It doesn’t identify the person. The server knows that some authorized key logged in as
ubuntu, but the account is usually shared. Attributing an action to an individual means cross-referencing logs and guessing. - It isn’t centrally governed. Revoking access means touching N servers. In auto-scaling environments, where machines are born and die every hour, that model falls apart.
Add to that bastion hosts, VPNs and spreadsheets of “who has access to what”. Each layer adds friction and, paradoxically, doesn’t solve the underlying problem: the credential lives too long and isn’t tied to a verified identity.
What Teleport is and how it changes the model
Teleport is an infrastructure access platform that unifies SSH, Kubernetes, databases, web apps and Windows desktops under a single identity plane. Its core idea is simple: nobody holds a permanent credential. Instead, the user authenticates against your identity provider (such as Okta, GitHub or Google Workspace) and receives a certificate that expires within hours.
There are three basic components:
- Auth Service: the certificate authority and audit log. It issues certificates and stores events.
- Proxy Service: the only public entry point. It handles web connections,
tshand the reverse tunnel to the nodes. - Teleport Agent (SSH Service): runs on each server. It connects out to the proxy, so you never need to open port 22 to the world.
On the client side you’ll use tsh for day-to-day work and tctl for cluster administration.
Advantages over classic SSH
- Ephemeral certificates: once expired, there’s nothing to revoke or steal.
- Real identity: every session is tied to an SSO user, not a shared account.
- No open ports: agents dial out to the proxy, which drastically shrinks your attack surface.
- Native auditing: structured events and replayable session recordings.
- Label-based RBAC: permissions depend on attributes like
env: prod, not server lists.
Reference architecture for your first deployment
To get off on the right foot, start with this minimal setup:
- One machine for Auth and Proxy (a single instance is fine at first), with a domain like
teleport.tuempresa.comand a valid TLS certificate. With built-in ACME, Teleport can fetch one automatically from Let’s Encrypt. - Port 443 open to the internet for the proxy. Nothing else.
- Agents on your servers, with outbound access to the proxy.
- An SSO provider for production. Local users are only for the initial test.
For real production, separate state and event storage into managed services (DynamoDB and S3 on AWS, Firestore and GCS on Google Cloud, or PostgreSQL depending on the case) and deploy several Auth and Proxy instances behind a load balancer.
Step-by-step installation
1. Install Teleport on the central server
Use your distribution’s official repository or the install script documented by Teleport, and always pin the major version you intend to run. Then generate a base configuration:
sudo teleport configure \
--acme --acme-email=infra@tuempresa.com \
--cluster-name=teleport.tuempresa.com \
-o file
Review the resulting /etc/teleport.yaml file and enable the service:
sudo systemctl enable --now teleport
2. Create the first user
sudo tctl users add admin --roles=editor,access --logins=root
The command returns a one-time link to set a password and enroll a second factor. From that moment on, access requires MFA.
3. Join a server as a node
Generate a short-lived token on the cluster:
tctl tokens add --type=node --ttl=15m
Then, on the server you want to add, install Teleport and start the agent pointing at the proxy with that token. Join tokens can also be replaced by cloud identity-based methods (AWS IAM, GitHub Actions tokens, etc.), which removes boot secrets entirely: ideal for auto-scaling groups.
4. Connect
tsh login --proxy=teleport.tuempresa.com --user=admin
tsh ls
tsh ssh deploy@web-01
After tsh login, your client stores a certificate that expires within the configured window (12 hours by default). You can keep using standard ssh and scp through tsh config, so your usual tools keep working.
Access control with RBAC and labels
The real power shows up when you model roles. Each node carries labels (env, team, region) and roles authorize based on them:
kind: role
version: v7
metadata:
name: dev-staging
spec:
options:
max_session_ttl: 8h
allow:
logins: ["deploy"]
node_labels:
env: staging
With this role, a developer only sees and accesses staging servers, with a maximum session of eight hours. Nobody edits files on servers: the change is applied with tctl create -f rol.yaml and can be versioned in Git like any other infrastructure resource.
Just-in-time access for production
Instead of granting permanent access to production, define a role that only allows you to request another:
kind: role
version: v7
metadata:
name: dev-base
spec:
allow:
request:
roles: ["prod-admin"]
The engineer runs tsh request create --roles=prod-admin --reason="Incidente 4821". A teammate with permission approves it, whether from the UI, Slack or PagerDuty via integrations, and the privilege expires on its own. The result is least privilege actually enforced, with the reason for the request on record.
Auditing: the real reason to migrate
This is where Teleport makes the difference. Every action produces a structured JSON event: logins, executed commands (with enhanced recording auditing based on eBPF), file transfers, role changes and access requests.
Sessions are also recorded and can be replayed:
tsh recordings ls
tsh play <id-de-sesion>
To make recording reliable, set the recording mode on the nodes (session_recording: node) or, if you don’t want the agent to be able to tamper with it, on the proxy. Export events to your SIEM using Teleport’s event connector or its Fluentd integration. That covers SOC 2, ISO 27001, PCI DSS or HIPAA requirements with concrete evidence instead of screenshots and good faith.
Best practices for a smooth migration
- Migrate environment by environment. Start with staging, measure adoption and move to production once the team is comfortable with
tsh. - Keep an emergency path. Define a documented, tested break-glass procedure in case the SSO provider goes down.
- Turn off traditional SSH gradually. Once all traffic goes through Teleport, close port 22 in your security groups and delete
authorized_keys. - Label with discipline. A consistent label scheme from day one saves you from unmanageable roles later.
- Protect the CA. Back up the cluster keys and, if your compliance bar demands it, store them in an HSM or KMS.
- Manage your remaining secrets well. Teleport eliminates keys, but your applications will still need secrets. If you’re weighing open alternatives to Vault, check out our guide to migrating from Vault to OpenBao in production.
Common mistakes to avoid
The most common one is deploying Teleport but leaving authorized_keys active “just in case”. As long as that back door exists, auditing is incomplete and your attack surface is unchanged. The second is granting overly broad roles for convenience: a blanket logins: ["root"] wipes out much of the benefit. The third is underestimating training: spend a 30-minute hands-on session teaching tsh login, tsh ssh and how to request access, and the initial resistance disappears.
Conclusion: from trusting keys to verifying identities
For decades, SSH keys forced us to trust a file. Teleport proposes something sturdier: verifying who you are, with MFA, every time you connect, with permissions that expire and a record that doesn’t depend on anyone’s memory. For a DevOps team, that means less time revoking keys, less risk when people leave and audits you pass with data.
Start today with a test cluster, connect three staging servers and define a single role. In one afternoon you’ll have seen, with your own eyes, the first recorded session on your infrastructure. After that, going back to authorized_keys is hard to justify.